query
stringlengths
7
3.85k
document
stringlengths
11
430k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
/ It returns a value type ARRAY.
func (this *ObjectNames) Type() value.Type { return value.ARRAY }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (v Value) Array() []Value {\n\tif v.Typ == '*' && !v.Null {\n\t\treturn v.ArrayV\n\t}\n\treturn nil\n}", "func (v Value) AsArray() []Value {\n\treturn v.iface.([]Value)\n}", "func ArrayValue(vals []Value) Value { return Value{Typ: '*', ArrayV: vals} }", "func (v *Value) Array() ([]Value, error) {\n\tif v.kind == kindArray {\n\t\treturn v.arrayContent, nil\n\t}\n\treturn nil, errors.New(\"JSON value is not an array\")\n}", "func (array Array) Values() []interface{} {\n\treturn array\n}", "func (value *Value) ArrayValue() []*Value {\n\tif value.valueType == Array {\n\t\treturn value.value.([]*Value)\n\t}\n\n\tpanic(fmt.Sprintf(\"requested array value but found %T type\", value.value))\n}", "func (this *ObjectValues) Type() value.Type { return value.ARRAY }", "func (this *ObjectValues) Type() value.Type { return value.ARRAY }", "func (v *ValueGetter) Array() (ss []string) {\n\treturn v.Strings()\n}", "func Array(vi interface{}) *ArrayValue {\n\tv := reflect.ValueOf(vi)\n\tif !v.IsValid() {\n\t\tpanic(fmt.Errorf(\"bun: Array(nil)\"))\n\t}\n\n\treturn &ArrayValue{\n\t\tv: v,\n\n\t\tappend: arrayAppender(v.Type()),\n\t\tscan: arrayScanner(v.Type()),\n\t}\n}", "func Array(value interface{}) dgo.Array {\n\tswitch value := value.(type) {\n\tcase dgo.Array:\n\t\treturn value.FrozenCopy().(dgo.Array)\n\tcase dgo.Iterable:\n\t\treturn arrayFromIterator(value.Len(), value.Each)\n\tcase []dgo.Value:\n\t\tarr := make([]dgo.Value, len(value))\n\t\tfor i := range value {\n\t\t\te := value[i]\n\t\t\tif f, ok := e.(dgo.Freezable); ok {\n\t\t\t\te = f.FrozenCopy()\n\t\t\t} else if e == nil {\n\t\t\t\te = Nil\n\t\t\t}\n\t\t\tarr[i] = e\n\t\t}\n\t\treturn &array{slice: arr, frozen: true}\n\tcase reflect.Value:\n\t\treturn ValueFromReflected(value).(dgo.Array)\n\tdefault:\n\t\treturn ValueFromReflected(reflect.ValueOf(value)).(dgo.Array)\n\t}\n}", "func Array(arr Arr) Val {\n\tif arr == nil {\n\t\treturn Val{t: bsontype.Null}\n\t}\n\treturn Val{t: bsontype.Array, primitive: arr}\n}", "func ArrayValue(a []Value) Value {\n\treturn Value{iface: a}\n}", "func (this *ObjectInnerValues) Type() value.Type { return value.ARRAY }", "func (v *JSONValue) Array() []*JSONValue {\n\tv.parseArray()\n\treturn v.valArray\n}", "func (data *Data) Array(s ...string) []interface{} {\n\treturn data.Interface(s...).([]interface{})\n}", "func ValueArrayOf(items ...Value) ValueArray {\n\t// ValueArrayOf() with no parameters will pass nil rather than a zero-length slice; logically we\n\t// still want it to create a non-nil array.\n\tif items == nil {\n\t\treturn ValueArray{emptyArray}\n\t}\n\treturn CopyValueArray(items)\n}", "func (e *Expect) Array(value []interface{}) *Array {\n\topChain := e.chain.enter(\"Array()\")\n\tdefer opChain.leave()\n\n\treturn newArray(opChain, value)\n}", "func Array(k string, v valf.ValueArray) Field {\n\treturn Field{Key: k, Value: valf.Array(v)}\n}", "func (this *ExDomain) Values_asSlice() []int {\n\treturn Keys_MapIntToBool(this.GetValues())\n}", "func Values(values []interface{}) dgo.Array {\n\treturn &array{slice: valueSlice(values, true), frozen: true}\n}", "func AsArray(dt DataType) *Array {\n\tswitch t := dt.(type) {\n\tcase *UserTypeExpr:\n\t\treturn AsArray(t.Type)\n\tcase *ResultTypeExpr:\n\t\treturn AsArray(t.Type)\n\tcase *Array:\n\t\treturn t\n\tdefault:\n\t\treturn nil\n\t}\n}", "func (i GinBindType) ValueSlice() []GinBindType {\n\treturn _GinBindTypeValues\n}", "func Array(dest interface{}) interface {\n\tsql.Scanner\n\tdriver.Valuer\n} {\n\tswitch dest := dest.(type) {\n\tcase *[]GraphId:\n\t\treturn (*graphIdArray)(dest)\n\tcase []GraphId:\n\t\treturn (*graphIdArray)(&dest)\n\n\tcase *[]BasicVertex:\n\t\treturn (*basicVertexArray)(dest)\n\n\tcase *[]BasicEdge:\n\t\treturn (*basicEdgeArray)(dest)\n\t}\n\n\treturn elementArray{dest}\n}", "func Array(args ...interface{}) []interface{} {\n\treturn []interface{}{args}\n}", "func (a GenericArray) Value() (driver.Value, error) {\n\tif a.A == nil {\n\t\treturn nil, nil\n\t}\n\n\trv := reflect.ValueOf(a.A)\n\n\tswitch rv.Kind() {\n\tcase reflect.Slice:\n\t\tif rv.IsNil() {\n\t\t\treturn nil, nil\n\t\t}\n\tcase reflect.Array:\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"pq: Unable to convert %T to array\", a.A)\n\t}\n\n\tif n := rv.Len(); n > 0 {\n\t\t// There will be at least two curly brackets, N bytes of values,\n\t\t// and N-1 bytes of delimiters.\n\t\tb := make([]byte, 0, 1+2*n)\n\n\t\tb, _, err := appendArray(b, rv, n)\n\t\treturn string(b), err\n\t}\n\n\treturn \"{}\", nil\n}", "func (l *ListaXTienda) GetArray() []XTiendas{\n\ta := make([]XTiendas, l.len)\n\ti := 0\n\tAux := l.Inicio\n\tfor Aux != nil{\n\t\ta[i] = Aux.Dato\n\t\ti++\n\t\tAux = Aux.Siguiente\n\t}\n\treturn a\n}", "func Array() *A {\n\treturn &A{}\n}", "func (v AnnotationValue) AsSlice() []AnnotationValue {\n\treturn v.Value.([]AnnotationValue)\n}", "func (c *Container) array() []uint16 {\n\tif c == nil {\n\t\tpanic(\"attempt to read a nil container's array\")\n\t}\n\tif roaringParanoia {\n\t\tif c.typeID != ContainerArray {\n\t\t\tpanic(\"attempt to read non-array's array\")\n\t\t}\n\t}\n\treturn (*[1 << 16]uint16)(unsafe.Pointer(c.pointer))[:c.len:c.cap]\n}", "func ToArray(\n\tvalue *model.Value,\n) (*model.Value, error) {\n\tswitch {\n\tcase value == nil:\n\t\treturn nil, errors.New(\"unable to coerce null to array\")\n\tcase value.Array != nil:\n\t\treturn value, nil\n\tcase value.Boolean != nil:\n\t\treturn nil, fmt.Errorf(\"unable to coerce boolean to array: %w\", errIncompatibleTypes)\n\tcase value.Dir != nil:\n\t\treturn nil, fmt.Errorf(\"unable to coerce dir to array: %w\", errIncompatibleTypes)\n\tcase value.File != nil:\n\t\tfileBytes, err := os.ReadFile(*value.File)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to coerce file to array: %w\", err)\n\t\t}\n\t\tvalueArray := new([]interface{})\n\t\terr = json.Unmarshal([]byte(fileBytes), valueArray)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to coerce file to array: %w\", err)\n\t\t}\n\t\treturn &model.Value{Array: valueArray}, nil\n\tcase value.Number != nil:\n\t\treturn nil, fmt.Errorf(\"unable to coerce number to array: %w\", errIncompatibleTypes)\n\tcase value.Socket != nil:\n\t\treturn nil, fmt.Errorf(\"unable to coerce socket to array: %w\", errIncompatibleTypes)\n\tcase value.String != nil:\n\t\tvalueArray := new([]interface{})\n\t\terr := json.Unmarshal([]byte(*value.String), valueArray)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to coerce string to array: %w\", err)\n\t\t}\n\t\treturn &model.Value{Array: valueArray}, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unable to coerce '%+v' to array\", value)\n\t}\n}", "func (v *Value) Slice() []interface{} {\n\tsize := (int)(C.value_array_size(v.value))\n\tval := make([]interface{}, size)\n\n\tC.value_array_reset(v.value)\n\n\tfor i := 0; i < size; i++ {\n\t\tt := &Value{value: C.value_array_next_get(v.value)}\n\n\t\tval[i] = t.Interface()\n\t\tt.Destroy()\n\t}\n\n\treturn val\n}", "func NewValueArray(array []Value) *ValueArray {\n\t// return &ValueArray{*NewListerValue(valueList(array))}\n\tres := ValueArray(array)\n\treturn &res\n}", "func (a AttributeValue) ArrayVal() AnyValueArray {\n\tarr := a.orig.GetArrayValue()\n\tif arr == nil {\n\t\treturn NewAnyValueArray()\n\t}\n\treturn newAnyValueArray(&arr.Values)\n}", "func (this *ObjectInnerPairs) Type() value.Type { return value.ARRAY }", "func (this *ObjectPairs) Type() value.Type { return value.ARRAY }", "func (this *ObjectPairs) Type() value.Type { return value.ARRAY }", "func (j *JSONElement) Array() []string {\n\tvalues := make([]string, 0)\n\tresults := j.Result.Array() //gjson.GetBytes(j.Response.Body, jpath).Array()\n\tfor _, result := range results {\n\t\tvalues = append(values, result.String())\n\t}\n\treturn values\n}", "func (s Section) ValueAsSlice(keyword string) []string {\n\t// TODO Implement Value\n\treturn nil\n}", "func (l *Lista) GetArray() []Tiendas{\n\ta := make([]Tiendas, l.len)\n\ti := 0\n\tAux := l.Inicio\n\tfor Aux != nil{\n\t\ta[i] = Aux.Dato\n\t\ti++\n\t\tAux = Aux.Siguiente\n\t}\n\treturn a\n}", "func (i GinJwtSignAlgorithm) ValueSlice() []GinJwtSignAlgorithm {\n\treturn _GinJwtSignAlgorithmValues\n}", "func (list *ArrayList) Values() []interface{} {\n\tnewE := make([]interface{}, list.size, list.size)\n\tcopy(newE, list.elements[:list.size])\n\treturn newE\n}", "func (a *ArrayObject) Value() interface{} {\n\treturn a.Elements\n}", "func NewArray(values []*Value) *Value {\n\treturn &Value{values, Array}\n}", "func sliceToScalarArray(v []any) (*gnmipb.ScalarArray, error) {\n\tarr := &gnmipb.ScalarArray{}\n\tfor _, e := range v {\n\t\ttv, err := value.FromScalar(e)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tarr.Element = append(arr.Element, tv)\n\t}\n\treturn arr, nil\n}", "func (s *stack) ToArray() (arr []interface{}) {\n\tarr = make([]interface{}, s.length)\n\tnode := s.top\n\tfor index := s.length - 1; index >= 0; index-- {\n\t\tarr[index] = node.value\n\t\tnode = node.prev\n\t}\n\treturn\n}", "func (s *Store) Values() []interface{} {\n\ts.access.RLock()\n\tdefer s.access.RUnlock()\n\n\tcpy := make([]interface{}, len(s.data))\n\ti := 0\n\tfor _, value := range s.data {\n\t\tcpy[i] = value\n\t\ti++\n\t}\n\treturn cpy\n}", "func ArrayValue(v Value) (*Array, bool) {\n\tif v.Type() != ArrayType {\n\t\treturn nil, false\n\t}\n\tval, ok := v.(*Array)\n\treturn val, ok\n}", "func Valueize(values ...reflect.Value) []reflect.Value {\n\treturn values\n}", "func ArrayValueFromArray(value []interface{}, dataType DataType) (interface{}, error) {\n\tarrValue := NewArrayValue(dataType)\n\tfor _, item := range value {\n\t\tif item == nil {\n\t\t\tarrValue.AddItem(nil)\n\t\t} else {\n\t\t\tif s, ok := item.(string); ok && len(s) == 0 {\n\t\t\t\tarrValue.AddItem(nil)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tval, err := ConvertValueForType(dataType, item)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tarrValue.AddItem(val)\n\t\t}\n\t}\n\treturn arrValue, nil\n}", "func NewArray() *Value {\n\t// TODO: think about size and capacity defaults\n\treturn &Value{kind: kindArray, arrayContent: make([]Value, 0)}\n}", "func (m *Value) Values() []xmlrpc.Value { return m.ValuesMock() }", "func (r *Ring) Values() []interface{} {\n\tif r.head == -1 {\n\t\treturn []interface{}{}\n\t}\n\tarr := make([]interface{}, 0, r.Capacity())\n\tfor i := 0; i < r.Capacity(); i++ {\n\t\tidx := r.mod(i + r.tail)\n\t\tarr = append(arr, r.get(idx))\n\t\tif idx == r.head {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn arr\n}", "func ConvertToArrayValue(dataType DataType, value interface{}) (interface{}, error) {\n\tswitch v := value.(type) {\n\tcase []interface{}:\n\t\treturn ArrayValueFromArray(v, GetElementDataType(dataType))\n\tcase string:\n\t\treturn ArrayValueFromString(v, GetElementDataType(dataType))\n\t}\n\treturn nil, errors.New(fmt.Sprintf(\"unknown data type %T\", value))\n}", "func (r *Decoder) Array() []byte {\n\tlength := r.VarInt()\n\tdata := r.Bytes(int(length))\n\treturn data\n}", "func Array(slice []interface{}, buf []byte) ([]byte, error) {\n\tvar comma bool\n\tbuf = append(buf, '[')\n\tvar err error\n\tfor i := 0; i < len(slice); i++ {\n\t\tif comma {\n\t\t\tbuf = append(buf, ',')\n\t\t}\n\t\tcomma = true\n\t\tbuf, err = Value(slice[i], buf)\n\t\tif err != nil {\n\t\t\treturn buf, err\n\t\t}\n\t}\n\treturn append(buf, ']'), nil\n}", "func (bst *BST) ToArray() []interface{} {\n\tvar result = make([]interface{}, 0)\n\tbst.Traverse(func(n *Node) bool {\n\t\tresult = append(result, n.Key)\n\t\treturn true\n\t})\n\n\treturn result\n}", "func (f *StringSlice) Value() []string {\n\treturn *f\n}", "func (i SNSPlatformApplicationAttribute) ValueSlice() []SNSPlatformApplicationAttribute {\n\treturn _SNSPlatformApplicationAttributeValues\n}", "func (b *Buffer) Values() interface{} {\n return b.buffer.Slice(0, b.idx).Interface()\n}", "func (f *Int64Slice) Value() []int64 {\n\treturn *f\n}", "func (j *JSONData) Array(path ...interface{}) ([]interface{}, error) {\n\tjson, err := j.get(path...)\n\treturn json.MustArray(), err\n}", "func (i SNSProtocol) ValueSlice() []SNSProtocol {\n\treturn _SNSProtocolValues\n}", "func (m *DomainCollectionResponse) GetValue()([]Domainable) {\n return m.value\n}", "func (ao *Array) Type() ObjectType { return ARRAY_OBJ }", "func (m *ApplicationCollectionResponse) GetValue()([]Applicationable) {\n return m.value\n}", "func (e ValuesResultArrayHashEntry) Value() calculation.ResultArray {\n\treturn e.value\n}", "func typeToArray(args ...DataType) (DataType, error) {\n\tif len(args) != 1 {\n\t\treturn nil, fmt.Errorf(\"Type.toArray expects exactly 1 argument\")\n\t}\n\n\tswitch object := args[0].(type) {\n\tcase *StringType:\n\t\tresult := []DataType{}\n\t\tfor _, k := range object.Value {\n\t\t\tresult = append(result, &StringType{Value: string(k)})\n\t\t}\n\n\t\treturn &ArrayType{Elements: result}, nil\n\tcase *IntegerType, *FloatType:\n\t\treturn &ArrayType{Elements: []DataType{object}}, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Type.toArray can't convert '%s' to Array\", object.Type())\n\t}\n}", "func (mat *T) Array() *[9]float64 {\n\treturn &[...]float64{\n\t\tmat[0][0], mat[0][1], mat[0][2],\n\t\tmat[1][0], mat[1][1], mat[1][2],\n\t\tmat[2][0], mat[2][1], mat[2][2],\n\t}\n}", "func (d *decoder) array(childKey string, value reflect.Value) error {\n\tglobal := d.getGlobalProvider()\n\tar := global.Get(childKey)\n\ta := ar.Value()\n\tav := reflect.ValueOf(a)\n\tif err := checkCollections(av.Kind(), value.Kind()); err != nil && ar.Value() != nil {\n\t\treturn err\n\t}\n\n\tvalueType := value.Type()\n\n\t// start looking for child values.\n\telementType := derefType(valueType).Elem()\n\tchildKey = addSeparator(childKey)\n\n\tfor ai := 0; ai < value.Len(); ai++ {\n\t\tarrayKey := childKey + strconv.Itoa(ai)\n\n\t\t// Iterate until we find first missing value.\n\t\tif v2 := global.Get(arrayKey); v2.Value() != nil {\n\t\t\tif err := checkCollections(reflect.TypeOf(v2.value).Kind(), elementType.Kind()); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tval := reflect.New(elementType).Elem()\n\n\t\t\t// Unmarshal current element.\n\t\t\tif err := d.unmarshal(arrayKey, val, \"\"); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvalue.Index(ai).Set(val)\n\t\t} else if value.Index(ai).Kind() == reflect.Struct {\n\t\t\tif err := d.valueStruct(arrayKey, value.Index(ai).Addr().Interface()); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (a ValueArray) AsValue() Value {\n\tif a.data == nil {\n\t\treturn Null()\n\t}\n\treturn Value{valueType: ArrayType, arrayValue: a}\n}", "func (l *ListaPro) GetArray() []Producto{\n\ta := make([]Producto, l.len)\n\ti := 0\n\tAux := l.Inicio\n\tfor Aux != nil{\n\t\ta[i] = Aux.Dato\n\t\ti++\n\t\tAux = Aux.Siguiente\n\t}\n\treturn a\n}", "func (pb *PageBuffer) Values() interface{} {\n offset := pb.pageOffset(pb.page_no)\n return pb.buffer.Slice(offset, offset + pb.idx).Interface()\n}", "func (m *OpenTypeExtensionCollectionResponse) GetValue()([]OpenTypeExtensionable) {\n return m.value\n}", "func (s *Slice) Value() Type {\n\treturn s.basic\n}", "func (i SNSSubscribeAttribute) ValueSlice() []SNSSubscribeAttribute {\n\treturn _SNSSubscribeAttributeValues\n}", "func (a IntArray) Value() (driver.Value, error) {\n\tvar strs []string\n\tfor _, i := range a {\n\t\tstrs = append(strs, strconv.FormatInt(int64(i), 10))\n\t}\n\treturn \"{\" + strings.Join(strs, \",\") + \"}\", nil\n}", "func (ki *KernelInfo) ToArray() [][]float64 {\n\tvar values [][]float64\n\n\tcount := 0\n\tcValues := (*[1 << 10]C.double)(unsafe.Pointer(ki.info.values))\n\n\tfor y := C.size_t(0); y < ki.info.height; y++ {\n\t\trowValues := make([]float64, ki.info.width)\n\t\tfor x := C.size_t(0); x < ki.info.width; x++ {\n\t\t\trowValues[x] = float64(cValues[count])\n\t\t\tcount++\n\t\t}\n\t\tvalues = append(values, rowValues)\n\t}\n\n\truntime.KeepAlive(ki)\n\treturn values\n}", "func (nData *NaiveData) Value() []gotypes.Value {\n\treturn nData.Val\n}", "func (_ Always) Values() []int {\n\tvar answer []int\n\treturn answer\n}", "func Values(v interface{}) []interface{} {\n\treturn New(v).Values()\n}", "func toValueSlice(slice reflect.Value) []reflect.Value {\n\tsliceCopy := reflect.MakeSlice(slice.Type(), slice.Len(), slice.Len())\n\treflect.Copy(sliceCopy, slice)\n\tvalues := make([]reflect.Value, sliceCopy.Len())\n\tfor i := 0; i < sliceCopy.Len(); i++ {\n\t\tvalues[i] = sliceCopy.Index(i)\n\t}\n\treturn values\n}", "func (q *PriorityQueue) Values() []interface{} {\n\tsize := q.data.Size()\n\tvalues := q.data.Values()\n\tres := make([]interface{}, size)\n\tfor i := 0; i < size; i++ {\n\t\tres[i] = values[i].(*pqItem).value\n\t}\n\treturn res\n}", "func (c *AdapterMemory) Values(ctx context.Context) ([]interface{}, error) {\n\treturn c.data.Values()\n}", "func (a ArrayVal) ToSlice() []any {\n\tarr := make([]any, len(a))\n\tfor i, elem := range a {\n\t\tswitch actual := elem.(type) {\n\t\tcase ArrayVal:\n\t\t\tarr[i] = actual.ToSlice()\n\t\tcase MapVal:\n\t\t\tarr[i] = actual.ToMap()\n\t\tdefault:\n\t\t\tarr[i] = actual\n\t\t}\n\t}\n\treturn arr\n}", "func arrayOf(\n\tref ast.ResolvableTypeReference, bounds []int32,\n) (ast.ResolvableTypeReference, error) {\n\t// If the reference is a statically known type, then return an array type,\n\t// rather than an array type reference.\n\tif typ, ok := ast.GetStaticallyKnownType(ref); ok {\n\t\tif err := types.CheckArrayElementType(typ); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn types.MakeArray(typ), nil\n\t}\n\treturn &ast.ArrayTypeReference{ElementType: ref}, nil\n}", "func (m *IdentitySetCollectionResponse) GetValue()([]IdentitySetable) {\n val, err := m.GetBackingStore().Get(\"value\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]IdentitySetable)\n }\n return nil\n}", "func (c *ColDecimal256) Array() *ColArr[Decimal256] {\n\treturn &ColArr[Decimal256]{\n\t\tData: c,\n\t}\n}", "func (s SExp) Value() []Value {\n\treturn s.values\n}", "func (ArrayJobDependency) Values() []ArrayJobDependency {\n\treturn []ArrayJobDependency{\n\t\t\"N_TO_N\",\n\t\t\"SEQUENTIAL\",\n\t}\n}", "func (d *adapterMemoryData) Values() ([]interface{}, error) {\n\td.mu.RLock()\n\tvar (\n\t\tindex = 0\n\t\tvalues = make([]interface{}, len(d.data))\n\t)\n\tfor _, v := range d.data {\n\t\tif !v.IsExpired() {\n\t\t\tvalues[index] = v.v\n\t\t\tindex++\n\t\t}\n\t}\n\td.mu.RUnlock()\n\treturn values, nil\n}", "func (nvp *NameValues) ToInterfaceArray() []interface{} {\n\treturn NameValuesToInterfaceArray(*nvp)\n}", "func (c *Capture) Values() []interface{} {\n\tret := make([]interface{}, 8)\n\n\tret[0] = c.Timestamp\n\tret[1] = c.ColIP.String()\n\tret[2] = c.PeerIP.String()\n\tret[3] = pq.Array(c.ASPath)\n\tret[4] = c.NextHop.String()\n\tret[5] = c.Origin\n\n\tadvArr := util.PrefixesToPQArray(c.Advertised)\n\twdrArr := util.PrefixesToPQArray(c.Withdrawn)\n\tret[6] = advArr\n\tret[7] = wdrArr\n\n\treturn ret\n}", "func (c *ColDecimal64) Array() *ColArr[Decimal64] {\n\treturn &ColArr[Decimal64]{\n\t\tData: c,\n\t}\n}", "func ToArray(head *Node) (ret []int) {\n\tfor head != nil {\n\t\tret = append(ret, head.Val)\n\t\thead = head.Next\n\t}\n\treturn\n}", "func (c *ColDecimal32) Array() *ColArr[Decimal32] {\n\treturn &ColArr[Decimal32]{\n\t\tData: c,\n\t}\n}", "func AsSlice(v interface{}) []interface{} {\n\tif v == nil {\n\t\treturn []interface{}{}\n\t}\n\tr := AsValueRef(reflect.ValueOf(v))\n\tswitch r.Kind() {\n\tcase reflect.Slice, reflect.Array:\n\t\tres := make([]interface{}, r.Len())\n\t\tfor i := 0; i < r.Len(); i++ {\n\t\t\tres[i] = r.Index(i).Interface()\n\t\t}\n\t\treturn res\n\tcase reflect.Map:\n\t\tres := make([]interface{}, r.Len())\n\t\tfor i, k := range r.MapKeys() {\n\t\t\tres[i] = k.Interface()\n\t\t}\n\t\treturn res\n\tcase reflect.Struct:\n\t\tt := r.Type()\n\t\tres := make([]string, t.NumField())\n\t\tfor i := 0; i < t.NumField(); i++ {\n\t\t\tres[i] = t.Field(i).Name\n\t\t}\n\t}\n\treturn []interface{}{v}\n}", "func (d *Document) Array() Node {\n\tid := uint(len(d.nodes))\n\tn := d.grow()\n\tn.reset(vArray|infRoot, \"\", n.values[:0])\n\treturn d.Node(id)\n}", "func ValueArrayBuild() *ValueArrayBuilder {\n\treturn &ValueArrayBuilder{}\n}" ]
[ "0.7823361", "0.75855696", "0.74754494", "0.7281895", "0.7198584", "0.7157273", "0.7129963", "0.7129963", "0.7126476", "0.71061283", "0.7052501", "0.7034025", "0.7030175", "0.6983035", "0.68611586", "0.68397593", "0.6761906", "0.6658249", "0.6644863", "0.6622976", "0.66021454", "0.65110886", "0.6502923", "0.6497482", "0.64917517", "0.6440682", "0.6399739", "0.6383279", "0.6332408", "0.63267523", "0.6321993", "0.631796", "0.63142866", "0.630334", "0.62999636", "0.6274134", "0.6274134", "0.6259917", "0.6224701", "0.6208194", "0.6193965", "0.61874926", "0.6184298", "0.6181131", "0.61556363", "0.61488765", "0.6112015", "0.6106167", "0.6104074", "0.60886115", "0.6086518", "0.605923", "0.60546684", "0.60543704", "0.6044528", "0.6023555", "0.6006845", "0.5990869", "0.5989655", "0.5987084", "0.5986677", "0.5984226", "0.5976743", "0.5971418", "0.59704506", "0.5954092", "0.5942297", "0.59413683", "0.59379107", "0.59246665", "0.5908588", "0.59060395", "0.5875078", "0.58720607", "0.58556575", "0.5845624", "0.5845134", "0.5833531", "0.58241516", "0.5812028", "0.5804738", "0.5801126", "0.5799075", "0.5798379", "0.5796714", "0.5794648", "0.5766882", "0.5766353", "0.5757353", "0.57561874", "0.5754581", "0.5737061", "0.57363284", "0.5734828", "0.57343984", "0.5733569", "0.57221633", "0.57125825", "0.57102686" ]
0.60708594
52
/ Calls the Eval method for unary functions and passes in the receiver, current item and current context.
func (this *ObjectNames) Evaluate(item value.Value, context Context) (value.Value, error) { return this.UnaryEval(this, item, context) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (fn NoArgFunc) Eval(ctx *Context, r Row) (interface{}, error) {\n\treturn fn.Logic(ctx, r)\n}", "func (bp *BinaryPlus) Eval() float64 {\n\treturn bp.left.(Eval).Eval() + bp.right.(Eval).Eval()\n}", "func (ast *Unary) Eval(env *Env, ctx *Codegen, gen *ssa.Generator) (\n\tssa.Value, bool, error) {\n\texpr, ok, err := ast.Expr.Eval(env, ctx, gen)\n\tif err != nil || !ok {\n\t\treturn ssa.Undefined, ok, err\n\t}\n\tswitch val := expr.ConstValue.(type) {\n\tcase bool:\n\t\tswitch ast.Type {\n\t\tcase UnaryNot:\n\t\t\treturn gen.Constant(!val, types.Bool), true, nil\n\t\tdefault:\n\t\t\treturn ssa.Undefined, false, ctx.Errorf(ast.Expr,\n\t\t\t\t\"invalid unary expression: %s%T\", ast.Type, val)\n\t\t}\n\tcase int32:\n\t\tswitch ast.Type {\n\t\tcase UnaryMinus:\n\t\t\treturn gen.Constant(-val, types.Int32), true, nil\n\t\tdefault:\n\t\t\treturn ssa.Undefined, false, ctx.Errorf(ast.Expr,\n\t\t\t\t\"Unary.Eval: '%s%T' not implemented yet\", ast.Type, val)\n\t\t}\n\tdefault:\n\t\treturn ssa.Undefined, false, ctx.Errorf(ast.Expr,\n\t\t\t\"invalid value %s%T\", ast.Type, val)\n\t}\n}", "func Eval(ctx context.Context, e Expr, vs Values) (interface{}, error) {\r\n\tfn, err := FuncOf(ctx, e, vs)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\treturn fn.Call(ctx, vs)\r\n}", "func (f *function) Eval(a *Apl) (Value, error) {\n\tvar err error\n\tvar l, r Value\n\n\t// The right argument must be evaluated first.\n\t// Otherwise this A←1⋄A+(A←2) evaluates to 3,\n\t// but it should evaluate to 4.\n\tr, err = f.right.Eval(a)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif f.left != nil {\n\n\t\t// Special case for modified assignments.\n\t\t// Defer evaluation of the left argument.\n\t\tif d, ok := f.Function.(*derived); ok && d.op == \"←\" {\n\t\t\tl = assignment{f.left}\n\t\t} else {\n\t\t\tl, err = f.left.Eval(a)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Special case: the last function in a selective assignment uses Select instead of Call.\n\tif _, ok := f.right.(numVar); ok && f.selection {\n\t\tif d, ok := f.Function.(*derived); ok == true {\n\t\t\treturn d.Select(a, l, r)\n\t\t} else if p, ok := f.Function.(Primitive); ok == false {\n\t\t\treturn nil, fmt.Errorf(\"cannot use %T in selective assignment\", f.Function)\n\t\t} else {\n\t\t\treturn p.Select(a, l, r)\n\t\t}\n\t}\n\treturn f.Function.Call(a, l, r)\n}", "func Eval(txApp *sysl.Application, assign Scope, e *sysl.Expr) *sysl.Value {\n\tswitch x := e.Expr.(type) {\n\tcase *sysl.Expr_Transform_:\n\t\treturn evalTransform(txApp, assign, x, e)\n\tcase *sysl.Expr_Binexpr:\n\t\treturn evalBinExpr(txApp, assign, x.Binexpr)\n\tcase *sysl.Expr_Call_:\n\t\treturn evalCall(txApp, assign, x)\n\tcase *sysl.Expr_Name:\n\t\treturn evalName(assign, x)\n\tcase *sysl.Expr_GetAttr_:\n\t\treturn evalGetAttr(txApp, assign, x)\n\tcase *sysl.Expr_Ifelse:\n\t\treturn evalIfelse(txApp, assign, x)\n\tcase *sysl.Expr_Literal:\n\t\treturn x.Literal\n\tcase *sysl.Expr_Set:\n\t\treturn evalSet(txApp, assign, x)\n\tcase *sysl.Expr_List_:\n\t\treturn evalList(txApp, assign, x)\n\tcase *sysl.Expr_Unexpr:\n\t\treturn evalUnaryFunc(x.Unexpr.Op, Eval(txApp, assign, x.Unexpr.Arg))\n\tdefault:\n\t\tlogrus.Warnf(\"Skipping Expr of type %T\\n\", x)\n\t\treturn nil\n\t}\n}", "func (op *OpMinus) Eval(x, y float32) float32 {\n\treturn op.LeftChild.Eval(x, y) - op.RightChild.Eval(x, y)\n}", "func (op *OpPlus) Eval(x, y float32) float32 {\n\treturn op.LeftChild.Eval(x, y) + op.RightChild.Eval(x, y)\n}", "func (op *OpPlus) Eval(x, y float32) float32 {\n\treturn op.LeftChild.Eval(x, y) + op.RightChild.Eval(x, y)\n}", "func (e *Exp) Eval() float64 {\n\te.init()\n\tresult, _ := e.eval(e.opTree)\n\treturn result\n}", "func (f *FunctionLike) Eval(env types.Env) (types.Expr, error) {\n\treturn nil, fmt.Errorf(\"interpreterTypes.FunctionLike: cannot eval a function-like: %s\", f)\n}", "func (form *Form) Eval(scope Scope, args ...interface{}) interface{} {\n\treturn form.Fn(scope, args...)\n}", "func (op *OpX) Eval(x, y float32) float32 {\n\treturn x\n}", "func (op *OpX) Eval(x, y float32) float32 {\n\treturn x\n}", "func ExampleEval() {\n\tfmt.Println(Eval(\"5\"))\n\tfmt.Println(Eval(\"1 + 2\"))\n\tfmt.Println(Eval(\"1 - 2 + 3\"))\n\tfmt.Println(Eval(\"3 * ( 3 + 1 * 3 ) / 2\"))\n\tfmt.Println(Eval(\"3 * ( ( 3 + 1 ) * 3 ) / 2\"))\n\t//OutPut:\n\t//5\n\t//3\n\t//2\n\t//9\n\t//18\n}", "func (this *ObjectUnwrap) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (rt *invalidRuntime) Eval(vs parser.Scope, is map[string]interface{}, tid uint64) (interface{}, error) {\n\t_, err := rt.baseRuntime.Eval(vs, is, tid)\n\tif err == nil {\n\t\terr = rt.erp.NewRuntimeError(util.ErrInvalidConstruct, fmt.Sprintf(\"Unknown node: %s\", rt.node.Name), rt.node)\n\t}\n\treturn nil, err\n}", "func (this *Not) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (rt *voidRuntime) Eval(vs parser.Scope, is map[string]interface{}, tid uint64) (interface{}, error) {\n\treturn rt.baseRuntime.Eval(vs, is, tid)\n}", "func (le ListExpr) Eval(scope Scope) (interface{}, error) {\n\tif len(le.List) == 0 {\n\t\treturn le.List, nil\n\t}\n\n\tval, err := le.List[0].Eval(scope)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif macroFn, ok := val.(MacroFunc); ok {\n\t\tvar name string\n\t\tif sym, ok := le.List[0].(SymbolExpr); ok {\n\t\t\tname = sym.Symbol\n\t\t}\n\t\treturn macroFn(scope, name, le.List[1:])\n\t}\n\n\targs := []interface{}{}\n\tfor i := 1; i < len(le.List); i++ {\n\t\targ, err := le.List[i].Eval(scope)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\targs = append(args, arg)\n\t}\n\n\tif scopedFn, ok := val.(ScopedFunc); ok {\n\t\treturn scopedFn(scope, args...)\n\t}\n\n\treturn reflection.Call(val, args...)\n}", "func (o Nil) Eval(*Vm) (Object, error) { return o, nil }", "func Eval(node ast.Node, env *object.Environment, stop <-chan struct{}) object.Object {\n\tselect {\n\tcase <-stop:\n\t\treturn ConstNil\n\tdefault:\n\t}\n\n\tswitch node := node.(type) {\n\t// statements\n\tcase *ast.Program:\n\t\treturn evalProgram(node, env, stop)\n\tcase *ast.LetStatement:\n\t\tval := Eval(node.Value, env, stop)\n\t\tif isError(val) {\n\t\t\treturn val\n\t\t}\n\t\tenv.Set(node.Name.Value, val)\n\tcase *ast.ReturnStatement:\n\t\tval := Eval(node.Value, env, stop)\n\t\tif isError(val) {\n\t\t\treturn val\n\t\t}\n\t\treturn &object.ReturnValue{Value: val}\n\tcase *ast.BlockStatement:\n\t\treturn evalBlockStatement(node, env, stop)\n\tcase *ast.ExpressionStatement:\n\t\treturn Eval(node.Expression, env, stop)\n\n\t\t// expressions\n\tcase *ast.PrefixExpression:\n\t\tright := Eval(node.Right, env, stop)\n\t\tif isError(right) {\n\t\t\treturn right\n\t\t}\n\t\treturn evalPrefixExpr(node.Token, right)\n\tcase *ast.InfixExpression:\n\t\tif node.Operator == token.Assign {\n\t\t\treturn evalAssign(node, env, stop)\n\t\t}\n\n\t\tleft := Eval(node.Left, env, stop)\n\t\tif isError(left) {\n\t\t\treturn left\n\t\t}\n\t\tright := Eval(node.Right, env, stop)\n\t\tif isError(right) {\n\t\t\treturn right\n\t\t}\n\t\treturn evalInfixExpr(node.Token, left, right)\n\tcase *ast.IndexExpression:\n\t\tleft := Eval(node.Left, env, stop)\n\t\tif isError(left) {\n\t\t\treturn left\n\t\t}\n\n\t\tindex := Eval(node.Index, env, stop)\n\t\tif isError(index) {\n\t\t\treturn index\n\t\t}\n\t\treturn evalIndexExpr(node.Token, left, index)\n\tcase *ast.IfExpression:\n\t\treturn evalIfExpr(node, env, stop)\n\tcase *ast.WhileExpression:\n\t\treturn evalWhileExpr(node, env, stop)\n\tcase *ast.CallExpression:\n\t\tfunction := Eval(node.Func, env, stop)\n\t\tif isError(function) {\n\t\t\treturn function\n\t\t}\n\n\t\targs, err := evalExpressions(node.Args, env, stop)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn doFunction(node.Token, function, args, stop)\n\n\t\t// literals\n\tcase *ast.IntegerLiteral:\n\t\treturn &object.Integer{Value: node.Value}\n\tcase *ast.FloatLiteral:\n\t\treturn &object.Float{Value: node.Value}\n\tcase *ast.BooleanLiteral:\n\t\treturn boolToBoolean(node.Value)\n\tcase *ast.NilLiteral:\n\t\treturn ConstNil\n\tcase *ast.FunctionLiteral:\n\t\treturn &object.Function{Params: node.Params, Body: node.Body, Env: env}\n\tcase *ast.StringLiteral:\n\t\treturn &object.String{Value: node.Value}\n\tcase *ast.ArrayLiteral:\n\t\telems, err := evalExpressions(node.Elements, env, stop)\n\t\tif len(elems) == 1 && err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn &object.Array{Elements: elems}\n\tcase *ast.Identifier:\n\t\treturn evalIdentifier(node, env)\n\tcase *ast.AccessIdentifier:\n\t\treturn evalAccessIdentifier(node, env)\n\t}\n\treturn nil\n}", "func (inst *hiddenInstance) Eval(expr ast.Expr) Value {\n\tv := inst.Value()\n\treturn v.Context().BuildExpr(expr, Scope(v), InferBuiltins(true))\n}", "func (a *AddActivity) Eval(context activity.Context) (done bool, err error) {\n\n\t//mv := context.GetInput(ivMessage)\n\tnum1, _ := context.GetInput(ivNum1).(int)\n\tnum2, _ := context.GetInput(ivNum2).(int)\n\n\tactivityLog.Info(fmt.Sprintf(\"Num1: %d, Num2: %d\", num1, num2))\n\tactivityLog.Info(fmt.Sprintf(\"Addition is : %d\", num1+num2))\n\tcontext.SetOutput(ovAddition, num1+num2)\n\n\treturn true, nil\n}", "func (o Args) Eval(*Vm) (Object, error) { return o, nil }", "func (n *NotLikeOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tpanic(\"implement me\")\n}", "func eval(list []*Item) int {\n\n\tvar stack *Item\n\n\tfor _, node := range list {\n\n\t\tif node.Typ == Number {\n\t\t\tstack = stack.Push(node)\n\t\t\tcontinue\n\t\t}\n\n\t\tvar left, right *Item\n\n\t\tstack, right = stack.Pop()\n\t\tstack, left = stack.Pop()\n\n\t\tvar val int\n\t\tswitch node.Operation {\n\t\tcase \"+\":\n\t\t\tval = left.Value + right.Value\n\t\tcase \"-\":\n\t\t\tval = left.Value - right.Value\n\t\tcase \"/\":\n\t\t\t// Watch for div-by-zero\n\t\t\tval = left.Value / right.Value\n\t\tcase \"*\":\n\t\t\tval = left.Value * right.Value\n\t\t}\n\t\tstack = stack.Push(&Item{Typ: Number, Value: val})\n\t}\n\n\treturn stack.Value\n}", "func (e *BinExpr) Eval(ctx context.Context, local Scope) (_ Value, err error) {\n\ta, err := e.a.Eval(ctx, local)\n\tif err != nil {\n\t\treturn nil, WrapContextErr(err, e, local)\n\t}\n\n\tb, err := e.b.Eval(ctx, local)\n\tif err != nil {\n\t\treturn nil, WrapContextErr(err, e, local)\n\t}\n\tval, err := e.eval(ctx, a, b, local)\n\tif err != nil {\n\t\treturn nil, WrapContextErr(err, e, local)\n\t}\n\treturn val, nil\n}", "func (m *Message) Eval(vm *VM, locals Interface) (result Interface) {\n\treturn m.Send(vm, locals, locals)\n}", "func (p *Qlang) Eval(expr string) (err error) {\n\n\treturn p.Exec([]byte(expr), \"\")\n}", "func eval(sc *scope, e sexpr) sexpr {\n\te = transform(sc, e)\n\tswitch e := e.(type) {\n\tcase cons: // a function to evaluate\n\t\tcons := e\n\t\tcar := eval(sc, cons.car)\n\t\tif !isFunction(car) && !isPrimitive(car) {\n\t\t\tpanic(\"Attempted application on non-function\")\n\t\t}\n\t\tcdr := cons.cdr\n\t\targs := flatten(cdr)\n\t\tif isPrimitive(car) {\n\t\t\treturn (car.(primitive))(sc, args)\n\t\t}\n\t\tf := car.(function)\n\t\t// This is a function - evaluate all arguments\n\t\tfor i, a := range args {\n\t\t\targs[i] = eval(sc, a)\n\t\t}\n\t\treturn f(sc, args)\n\tcase sym:\n\t\treturn sc.lookup(e)\n\t}\n\treturn e\n}", "func (mr *MockExpressionNodeMockRecorder) Eval() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Eval\", reflect.TypeOf((*MockExpressionNode)(nil).Eval))\n}", "func (this *Self) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn item, nil\n}", "func (n *NotInOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tpanic(\"implement me\")\n}", "func (f *Function) Eval(inputs ...interface{}) (args.Const, error) {\n\tlenInputs := len(inputs)\n\tif lenInputs != f.numVars {\n\t\treturn nil, errors.New(\"Number of inputs is not equal to the number of variables in function\")\n\t}\n\n\tvar operand1 args.Const\n\tvar operand2 args.Const\n\tvar operandStack []args.Const\n\n\ti := 0\n\tfor i < len(f.Args) {\n\t\tif f.typeInput(i) == args.Constant || f.typeInput(i) == args.Variable {\n\t\t\tvariable, err := f.getVar(i)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif lenInputs != 0 {\n\t\t\t\toperand, err := variable.Eval(inputs[f.varNum[variable]])\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\toperandStack = append(operandStack, operand)\n\t\t\t} else {\n\t\t\t\t// If length inputs is 0, then all variables must be constant.\n\t\t\t\t// This code assumes variable is a constant and so uses 0 as an input\n\t\t\t\t// to MustEval as it will never fail as the input does not matter for constants\n\t\t\t\toperandStack = append(operandStack, variable.MustEval(0))\n\t\t\t}\n\t\t} else if f.typeInput(i) == args.Operation {\n\t\t\toperation, err := f.getOp(i)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif h, ok := unaryFuncs[operation]; ok {\n\t\t\t\tif len(operandStack) == 0 {\n\t\t\t\t\treturn nil, errors.New(\"Not enough operands\")\n\t\t\t\t}\n\n\t\t\t\toperand1, operandStack = operandStack[len(operandStack)-1], operandStack[:len(operandStack)-1]\n\t\t\t\tresult, err := h(operand1)\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\toperandStack = append(operandStack, result)\n\t\t\t} else if h, ok := binaryFuncs[operation]; ok {\n\t\t\t\tif len(operandStack) < 2 {\n\t\t\t\t\treturn nil, errors.New(\"Not enough operands\")\n\t\t\t\t}\n\n\t\t\t\toperand2, operandStack = operandStack[len(operandStack)-1], operandStack[:len(operandStack)-1]\n\t\t\t\toperand1, operandStack = operandStack[len(operandStack)-1], operandStack[:len(operandStack)-1]\n\t\t\t\tresult, err := h(operand1, operand2)\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\toperandStack = append(operandStack, result)\n\t\t\t} else {\n\t\t\t\treturn nil, errors.New(\"Operation not supported\")\n\t\t\t}\n\t\t}\n\t\ti++\n\t}\n\n\tif len(operandStack) > 1 {\n\t\treturn nil, errors.New(\"To many operands left over after calculation\")\n\t}\n\n\treturn operandStack[0], nil\n}", "func (op *OpSine) Eval(x, y float32) float32 {\n\treturn float32(math.Sin(float64(op.Child.Eval(x, y))))\n}", "func (b *Builder) Eval(desc string, f predicate.TransformFunc) *Builder {\n\tb.p.RegisterTransformation(impl.Eval(desc, f))\n\treturn b\n}", "func (e *Evaluator) Eval(expr string) (interface{}, error) {\n\tn := e.n.Copy()\n\t_expr, err := xpath.Compile(expr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"expr cannot compile: %w\", err)\n\t}\n\n\tv := _expr.Evaluate(n)\n\tswitch v := v.(type) {\n\tcase *xpath.NodeIterator:\n\t\tns := nodes(v)\n\t\tvs := make([]interface{}, 0, len(ns))\n\t\tfor i := range ns {\n\t\t\tswitch n := ns[i].(type) {\n\t\t\tcase attr:\n\t\t\t\tvs = append(vs, n.val)\n\t\t\t}\n\t\t}\n\t\tif len(vs) == len(ns) {\n\t\t\treturn vs, nil\n\t\t}\n\t\treturn ns, nil\n\t}\n\n\treturn v, nil\n}", "func (n *NotRegexpOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tpanic(\"implement me\")\n}", "func (rt *baseRuntime) Eval(vs parser.Scope, is map[string]interface{}, tid uint64) (interface{}, error) {\n\tvar err error\n\n\terrorutil.AssertTrue(rt.validated, \"Runtime component has not been validated - please call Validate() before Eval()\")\n\n\tif rt.erp.Debugger != nil {\n\t\terr = rt.erp.Debugger.VisitState(rt.node, vs, tid)\n\t\trt.erp.Debugger.SetLockingState(rt.erp.MutexeOwners, rt.erp.MutexLog)\n\t\trt.erp.Debugger.SetThreadPool(rt.erp.Processor.ThreadPool())\n\t}\n\n\treturn nil, err\n}", "func (s *Subtraction) Evaluate(left, right EvalResult) (EvalResult, error) {\n\treturn subtractNumericWithError(left, right)\n}", "func (this *ObjectValues) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (this *ObjectValues) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (c *Context) Eval(script string) (*Value, error) {\n\t// When PHP compiles code with a non-NULL return value expected, it simply\n\t// prepends a `return` call to the code, thus breaking simple scripts that\n\t// would otherwise work. Thus, we need to wrap the code in a closure, and\n\t// call it immediately.\n\ts := C.CString(\"call_user_func(function(){\" + script + \"});\")\n\tdefer C.free(unsafe.Pointer(s))\n\n\tvptr, err := C.context_eval(c.context, s)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error executing script '%s' in context\", script)\n\t}\n\n\tval, err := NewValueFromPtr(vptr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn val, nil\n}", "func (f *CallExpression) Evaluate(ctx *Context) Value {\n\tcallable := f.Callable.Evaluate(ctx)\n\n\tif callable.Type == vtVariable {\n\t\tcallable = callable.Evaluate(ctx)\n\t}\n\n\tif callable.isCallable() {\n\t\tnewCtx := NewContext(\"\", nil)\n\t\targs := f.Args.EvaluateAll(ctx)\n\t\treturn callable.callable().Execute(newCtx, &args)\n\t}\n\n\tpanic(NewNotCallableError(callable))\n}", "func (lscript *Scripting) Eval(luacmd string, arguments ...interface{}) (*ScriptingReturnValues, error) {\n\targs := asScriptingArgs(arguments...)\n\tlargs := forLua(args)\n\tfor _, larg := range largs {\n\t\tlscript.Push(larg)\n\t}\n\tvar r *ScriptingReturnValues\n\terr := lscript.DoString(luacmd)\n\tif err != nil {\n\t\tT().P(\"script\", \"lua\").Errorf(\"scripting error: %s\", err.Error())\n\t} else {\n\t\tif err == nil {\n\t\t\tT().P(\"lua\", \"eval\").Debugf(\"%d return values on the stack\", lscript.GetTop())\n\t\t\tr = lscript.returnFromScripting(lscript.GetTop()) // return all values on the stack\n\t\t}\n\t}\n\treturn r, err\n}", "func (e *binaryExprEvaluator) eval(lhs, rhs interface{}) interface{} {\n\tswitch e.op {\n\tcase ADD:\n\t\treturn lhs.(float64) + rhs.(float64)\n\tcase SUB:\n\t\treturn lhs.(float64) - rhs.(float64)\n\tcase MUL:\n\t\treturn lhs.(float64) * rhs.(float64)\n\tcase DIV:\n\t\trhs := rhs.(float64)\n\t\tif rhs == 0 {\n\t\t\treturn float64(0)\n\t\t}\n\t\treturn lhs.(float64) / rhs\n\tdefault:\n\t\t// TODO: Validate operation & data types.\n\t\tpanic(\"invalid operation: \" + e.op.String())\n\t}\n}", "func (p *Qlang) SafeEval(expr string) (err error) {\n\n\treturn p.SafeExec([]byte(expr), \"\")\n}", "func Eval(input string, context map[string]interface{}) float64 {\n\tnode, err := Parse(input)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\texpr := &expression{node, context}\n\treturn expr.eval(expr.ast)\n}", "func (op *OpAtan) Eval(x, y float32) float32 {\n\treturn float32(math.Atan(float64(op.Child.Eval(x, y))))\n}", "func (op *OpMult) Eval(x, y float32) float32 {\n\treturn op.LeftChild.Eval(x, y) * op.RightChild.Eval(x, y)\n}", "func (i *InOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tpanic(\"implement me\")\n}", "func prepareEvalInfixExp(opfStack, opftStack, opfdStack, argsStack *Stack) {\n\t// current token is function stop\n\tfor opftStack.Peek().(efp.Token) != opfStack.Peek().(efp.Token) {\n\t\t// calculate trigger\n\t\ttopOpt := opftStack.Peek().(efp.Token)\n\t\tif err := calculate(opfdStack, topOpt); err != nil {\n\t\t\targsStack.Peek().(*list.List).PushBack(newErrorFormulaArg(err.Error(), err.Error()))\n\t\t\topftStack.Pop()\n\t\t\tcontinue\n\t\t}\n\t\topftStack.Pop()\n\t}\n\targument := true\n\tif opftStack.Len() > 2 && opfdStack.Len() == 1 {\n\t\ttopOpt := opftStack.Pop()\n\t\tif opftStack.Peek().(efp.Token).TType == efp.TokenTypeOperatorInfix {\n\t\t\targument = false\n\t\t}\n\t\topftStack.Push(topOpt)\n\t}\n\t// push opfd to args\n\tif argument && opfdStack.Len() > 0 {\n\t\targsStack.Peek().(*list.List).PushBack(opfdStack.Pop().(formulaArg))\n\t}\n}", "func (e PackageExpr) Eval(_ rel.Scope) (rel.Value, error) {\n\treturn e.a.Eval(stdScope())\n}", "func (p *prog) Eval(input any) (v ref.Val, det *EvalDetails, err error) {\n\t// Configure error recovery for unexpected panics during evaluation. Note, the use of named\n\t// return values makes it possible to modify the error response during the recovery\n\t// function.\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tswitch t := r.(type) {\n\t\t\tcase interpreter.EvalCancelledError:\n\t\t\t\terr = t\n\t\t\tdefault:\n\t\t\t\terr = fmt.Errorf(\"internal error: %v\", r)\n\t\t\t}\n\t\t}\n\t}()\n\t// Build a hierarchical activation if there are default vars set.\n\tvar vars interpreter.Activation\n\tswitch v := input.(type) {\n\tcase interpreter.Activation:\n\t\tvars = v\n\tcase map[string]any:\n\t\tvars = activationPool.Setup(v)\n\t\tdefer activationPool.Put(vars)\n\tdefault:\n\t\treturn nil, nil, fmt.Errorf(\"invalid input, wanted Activation or map[string]any, got: (%T)%v\", input, input)\n\t}\n\tif p.defaultVars != nil {\n\t\tvars = interpreter.NewHierarchicalActivation(p.defaultVars, vars)\n\t}\n\tv = p.interpretable.Eval(vars)\n\t// The output of an internal Eval may have a value (`v`) that is a types.Err. This step\n\t// translates the CEL value to a Go error response. This interface does not quite match the\n\t// RPC signature which allows for multiple errors to be returned, but should be sufficient.\n\tif types.IsError(v) {\n\t\terr = v.(*types.Err)\n\t}\n\treturn\n}", "func (this *ObjectAdd) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.TernaryEval(this, item, context)\n}", "func (op *OpSin) Eval(x, y float32) float32 {\n\treturn float32(math.Sin(float64(op.Child.Eval(x, y))))\n}", "func (l *LikeOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tpanic(\"implement me\")\n}", "func (e *ExpressionAtom) Evaluate(dataContext IDataContext, memory *WorkingMemory) (reflect.Value, error) {\n\tif e.Evaluated == true {\n\t\treturn e.Value, nil\n\t}\n\tif e.Variable != nil {\n\t\tval, err := e.Variable.Evaluate(dataContext, memory)\n\t\tif err != nil {\n\t\t\treturn reflect.Value{}, err\n\t\t}\n\t\te.Value = val\n\t\te.Evaluated = true\n\t\treturn val, err\n\t}\n\tif e.FunctionCall != nil {\n\t\tvalueNode := dataContext.Get(\"DEFUNC\")\n\t\targs, err := e.FunctionCall.EvaluateArgumentList(dataContext, memory)\n\t\tif err != nil {\n\t\t\treturn reflect.Value{}, err\n\t\t}\n\t\tret, err := valueNode.CallFunction(e.FunctionCall.FunctionName, args...)\n\t\tif err != nil {\n\t\t\treturn reflect.Value{}, err\n\t\t}\n\t\te.Value = ret\n\t\te.Evaluated = true\n\t\treturn ret, err\n\t}\n\tpanic(\"should not be reached\")\n}", "func (this *ObjectRemove) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.BinaryEval(this, item, context)\n}", "func (s *ScriptReal) Eval(c Scripter, keys []string, args ...interface{}) *redis.Cmd {\n\treturn s.script.Eval(c, keys, args...)\n}", "func (this *ObjectInnerValues) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (p Primitive) Eval(a *Apl) (Value, error) {\n\treturn p, nil\n}", "func (this *Element) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.BinaryEval(this, item, context)\n}", "func (op *OpY) Eval(x, y float32) float32 {\n\treturn y\n}", "func (op *OpY) Eval(x, y float32) float32 {\n\treturn y\n}", "func (s *String) Eval(_, _ *Scope) (Value, error) {\n\treturn s, nil\n}", "func (ev *Evaler) Eval(name, text string, n *parse.Chunk, ports []*Port) error {\n\top, err := ev.Compile(n)\n\tif err != nil {\n\t\treturn err\n\t}\n\tec := NewTopEvalCtx(ev, name, text, ports)\n\treturn ec.PEval(op)\n}", "func TestEval(t *testing.T) {\n\tany := `.+`\n\ttestCases := []struct {\n\t\tname string\n\t\tquery string\n\t\twantErr string\n\t\twant []values.Value\n\t}{\n\t\t{\n\t\t\tname: \"string interpolation\",\n\t\t\tquery: `\n\t\t\t\tstr = \"str\"\n\t\t\t\ting = \"ing\"\n\t\t\t\t\"str + ing = ${str+ing}\"`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewString(\"str + ing = string\"),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"string interpolation missing field\",\n\t\t\tquery: `\n\t\t\t\tr = makeRecord(o: {a: \"foo\", b: 42})\n\t\t\t\t\"r._value = ${r._value}\"`,\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"string interpolation non-string type\",\n\t\t\tquery: `\n\t\t\t\tr = makeRecord(o: {a: \"foo\", b: 42})\n\t\t\t\t\"r._value = ${r.b}\"`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewString(\"r._value = 42\"),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"string interpolation wrong type\",\n\t\t\tquery: `\n\t\t\t\tr = makeRecord(o: {a: \"foo\", b: 42})\n\t\t\t\t\"r = ${r}\"`,\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"call builtin function\",\n\t\t\tquery: \"six()\",\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewFloat(6.0),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"call function with fail\",\n\t\t\tquery: \"fail()\",\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"call function with duplicate args\",\n\t\t\tquery: \"plusOne(x:1.0, x:2.0)\",\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"binary expressions\",\n\t\t\tquery: `\n\t\t\tsix_value = six()\n\t\t\tnine_value = nine()\n\n\t\t\tfortyTwo() == six_value * nine_value\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(false),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"logical expressions short circuit\",\n\t\t\tquery: `\n six_value = six()\n nine_value = nine()\n\n not (fortyTwo() == six_value * nine_value) or fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"function\",\n\t\t\tquery: `\n plusSix = (r) => r + six()\n plusSix(r:1.0) == 7.0 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"function block\",\n\t\t\tquery: `\n f = (r) => {\n r1 = 1.0 + r\n return (r + r1) / r\n }\n f(r:1.0) == 3.0 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"function block polymorphic\",\n\t\t\tquery: `\n f = (r) => {\n r2 = r * r\n return r2 / r\n }\n f(r:2.0) == 2.0 or fail()\n f(r:2) == 2 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"function with default param\",\n\t\t\tquery: `\n addN = (r,n=4) => r + n\n addN(r:2) == 6 or fail()\n addN(r:3,n:1) == 4 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"scope closing\",\n\t\t\tquery: `\n\t\t\tx = 5\n plusX = (r) => r + x\n plusX(r:2) == 7 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"nested scope mutations not visible outside\",\n\t\t\tquery: `\n\t\t\tx = 5\n xinc = () => {\n x = x + 1\n return x\n }\n xinc() == 6 or fail()\n x == 5 or fail()\n\t\t\t`,\n\t\t},\n\t\t// TODO(jsternberg): This test seems to not\n\t\t// infer the type constraints correctly for m.a,\n\t\t// but it doesn't fail.\n\t\t{\n\t\t\tname: \"return map from func\",\n\t\t\tquery: `\n toMap = (a,b) => ({\n a: a,\n b: b,\n })\n m = toMap(a:1, b:false)\n m.a == 1 or fail()\n not m.b or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"pipe expression\",\n\t\t\tquery: `\n\t\t\tadd = (a=<-,b) => a + b\n\t\t\tone = 1\n\t\t\tone |> add(b:2) == 3 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"ignore pipe default\",\n\t\t\tquery: `\n\t\t\tadd = (a=<-,b) => a + b\n\t\t\tadd(a:1, b:2) == 3 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"pipe expression function\",\n\t\t\tquery: `\n\t\t\tadd = (a=<-,b) => a + b\n\t\t\tsix() |> add(b:2.0) == 8.0 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"pipe builtin function\",\n\t\t\tquery: `\n\t\t\tsix() |> plusOne() == 7.0 or fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"regex match\",\n\t\t\tquery: `\n\t\t\t\"abba\" =~ /^a.*a$/ or fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"regex not match\",\n\t\t\tquery: `\n\t\t\t\"abc\" =~ /^a.*a$/ and fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(false),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"not regex match\",\n\t\t\tquery: `\n\t\t\t\"abc\" !~ /^a.*a$/ or fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"not regex not match\",\n\t\t\tquery: `\n\t\t\t\"abba\" !~ /^a.*a$/ and fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(false),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"options metadata\",\n\t\t\tquery: `\n\t\t\toption task = {\n\t\t\t\tname: \"foo\",\n\t\t\t\trepeat: 100,\n\t\t\t}\n\t\t\ttask.name == \"foo\" or fail()\n\t\t\ttask.repeat == 100 or fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"query with side effects\",\n\t\t\tquery: `sideEffect() == 0 or fail()`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewInt(0),\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"array index expression\",\n\t\t\tquery: `\n\t\t\t\ta = [1, 2, 3]\n\t\t\t\tx = a[1]\n\t\t\t\tx == 2 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"dict expression\",\n\t\t\tquery: `\n\t\t\t\tm = [\"a\" + \"b\": 0, \"c\" + \"d\": 1]\n\t\t\t\tx = get(dict: m, key: \"ab\", default: 2)\n\t\t\t\ty = get(dict: m, key: \"cd\", default: 2)\n\t\t\t\tz = get(dict: m, key: \"ef\", default: 2)\n\t\t\t\tx == 0 and y == 1 and z == 2 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"empy dictionary\",\n\t\t\tquery: `\n\t\t\t\tm0 = [:]\n\t\t\t\tm1 = insert(dict: m0, key: \"a\", value: 0)\n\t\t\t\tm2 = insert(dict: m0, key: 0, value: \"a\")\n\t\t\t\tv1 = get(dict: m1, key: \"a\", default: -1)\n\t\t\t\tv2 = get(dict: m2, key: 0, default: \"b\")\n\t\t\t\tv1 == 0 and v2 == \"a\" or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"array index expression out of bounds low\",\n\t\t\tquery: `\n\t\t\t\ta = [1, 2, 3]\n\t\t\t\ti = -1\n\t\t\t\tx = a[i]\n\t\t\t`,\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"array index expression out of bounds high\",\n\t\t\tquery: `\n\t\t\t\ta = [1, 2, 3]\n\t\t\t\ti = 3\n\t\t\t\tx = a[i]\n\t\t\t`,\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"array with complex index expression\",\n\t\t\tquery: `\n\t\t\t\tf = () => ({l: 0, m: 1, n: 2})\n\t\t\t\ta = [1, 2, 3]\n\t\t\t\tx = a[f().l]\n\t\t\t\ty = a[f().m]\n\t\t\t\tz = a[f().n]\n\t\t\t\tx == 1 or fail()\n\t\t\t\ty == 2 or fail()\n\t\t\t\tz == 3 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"short circuit logical and\",\n\t\t\tquery: `\n false and fail()\n `,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(false),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"short circuit logical or\",\n\t\t\tquery: `\n true or fail()\n `,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"no short circuit logical and\",\n\t\t\tquery: `\n true and fail()\n `,\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"no short circuit logical or\",\n\t\t\tquery: `\n false or fail()\n `,\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"conditional true\",\n\t\t\tquery: `\n\t\t\t\tif 1 != 0 then 10 else 100\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewInt(10),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"conditional false\",\n\t\t\tquery: `\n\t\t\t\tif 1 == 0 then 10 else 100\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewInt(100),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"conditional in function\",\n\t\t\tquery: `\n\t\t\t\tf = (t, c, a) => if t then c else a\n\t\t\t\t{\n\t\t\t\t\tv1: f(t: false, c: 30, a: 300),\n\t\t\t\t\tv2: f(t: true, c: \"cats\", a: \"dogs\"),\n\t\t\t\t}\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewObjectWithValues(map[string]values.Value{\n\t\t\t\t\t\"v1\": values.NewInt(300),\n\t\t\t\t\t\"v2\": values.NewString(\"cats\"),\n\t\t\t\t}),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"exists\",\n\t\t\tquery: `hasValue(o: makeRecord(o: {value: 1}))`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"exists null\",\n\t\t\tquery: `hasValue(o: makeRecord(o: {val: 2}))`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(false),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"invalid function parameter\",\n\t\t\tquery: `from(bucket: \"telegraf\") |> window(every: 0s)`,\n\t\t\twantErr: `error calling function \"window\" @\\d+:\\d+-\\d+:\\d+: window function requires at least one of \"every\" or \"period\" to be set and non-zero`,\n\t\t},\n\t\t{\n\t\t\t// tests that we don't nest error messages when\n\t\t\t// a function call fails and gets piped into another\n\t\t\t// function.\n\t\t\tname: \"nested function error\",\n\t\t\tquery: `from(bucket: \"telegraf\") |> window(every: 0s) |> mean()`,\n\t\t\twantErr: `error calling function \"window\" @\\d+:\\d+-\\d+:\\d+: window function requires at least one of \"every\" or \"period\" to be set and non-zero`,\n\t\t},\n\t}\n\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\tsrc := prelude + tc.query\n\n\t\t\tctx, deps := dependency.Inject(context.Background(), dependenciestest.Default())\n\t\t\tdefer deps.Finish()\n\n\t\t\tsideEffects, _, err := runtime.Eval(ctx, src)\n\t\t\tif err != nil {\n\t\t\t\tif tc.wantErr == \"\" {\n\t\t\t\t\tt.Fatalf(\"unexpected error: %s\", err)\n\t\t\t\t}\n\n\t\t\t\t// We expect an error, so it should be a non-internal Flux error.\n\t\t\t\tif code := flux.ErrorCode(err); code == codes.Internal || code == codes.Unknown {\n\t\t\t\t\tt.Errorf(\"expected non-internal error code, got %s\", code)\n\t\t\t\t}\n\n\t\t\t\tre := regexp.MustCompile(tc.wantErr)\n\t\t\t\tif got := err.Error(); !re.MatchString(got) {\n\t\t\t\t\tt.Errorf(\"expected error to match pattern %q, but error was %q\", tc.wantErr, got)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t} else if tc.wantErr != \"\" {\n\t\t\t\tt.Fatal(\"expected error\")\n\t\t\t}\n\n\t\t\tvs := getSideEffectsValues(sideEffects)\n\t\t\tif tc.want != nil && !cmp.Equal(tc.want, vs, semantictest.CmpOptions...) {\n\t\t\t\tt.Fatalf(\"unexpected side effect values -want/+got: \\n%s\", cmp.Diff(tc.want, vs, semantictest.CmpOptions...))\n\t\t\t}\n\t\t})\n\t}\n}", "func (ev *Evaler) Eval(name, text string, n *parse.Chunk, ports []*Port) error {\n\top, err := ev.Compile(name, text, n)\n\tif err != nil {\n\t\treturn err\n\t}\n\tec := NewTopEvalCtx(ev, name, text, ports)\n\treturn ec.PEval(op)\n}", "func (e *Evaluator) Eval(expr *tipb.Expr) (types.Datum, error) {\n\tswitch expr.GetTp() {\n\tcase tipb.ExprType_Null:\n\t\treturn types.Datum{}, nil\n\tcase tipb.ExprType_Int64:\n\t\treturn e.evalInt(expr.Val)\n\tcase tipb.ExprType_Uint64:\n\t\treturn e.evalUint(expr.Val)\n\tcase tipb.ExprType_String:\n\t\treturn e.evalString(expr.Val)\n\tcase tipb.ExprType_Bytes:\n\t\treturn types.NewBytesDatum(expr.Val), nil\n\tcase tipb.ExprType_Float32:\n\t\treturn e.evalFloat(expr.Val, true)\n\tcase tipb.ExprType_Float64:\n\t\treturn e.evalFloat(expr.Val, false)\n\tcase tipb.ExprType_MysqlDecimal:\n\t\treturn e.evalDecimal(expr.Val)\n\tcase tipb.ExprType_MysqlDuration:\n\t\treturn e.evalDuration(expr.Val)\n\tcase tipb.ExprType_ColumnRef:\n\t\treturn e.evalColumnRef(expr.Val)\n\tcase tipb.ExprType_LT:\n\t\treturn e.evalLT(expr)\n\tcase tipb.ExprType_LE:\n\t\treturn e.evalLE(expr)\n\tcase tipb.ExprType_EQ:\n\t\treturn e.evalEQ(expr)\n\tcase tipb.ExprType_NE:\n\t\treturn e.evalNE(expr)\n\tcase tipb.ExprType_GE:\n\t\treturn e.evalGE(expr)\n\tcase tipb.ExprType_GT:\n\t\treturn e.evalGT(expr)\n\tcase tipb.ExprType_NullEQ:\n\t\treturn e.evalNullEQ(expr)\n\tcase tipb.ExprType_And:\n\t\treturn e.evalAnd(expr)\n\tcase tipb.ExprType_Or:\n\t\treturn e.evalOr(expr)\n\tcase tipb.ExprType_Like:\n\t\treturn e.evalLike(expr)\n\tcase tipb.ExprType_Not:\n\t\treturn e.evalNot(expr)\n\tcase tipb.ExprType_In:\n\t\treturn e.evalIn(expr)\n\tcase tipb.ExprType_Plus, tipb.ExprType_Div:\n\t\treturn e.evalArithmetic(expr)\n\t}\n\treturn types.Datum{}, nil\n}", "func (this *Mod) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.BinaryEval(this, item, context)\n}", "func (this *NowStr) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.Eval(this, item, context)\n}", "func (*Base) Unary(p ASTPass, node *ast.Unary, ctx Context) {\n\tp.Visit(p, &node.Expr, ctx)\n}", "func (i *IntNode) Eval(m memory.M) dragonscript.Value {\n\treturn dragonscript.Integer(i.value)\n}", "func (op *OpDiv) Eval(x, y float32) float32 {\n\treturn op.LeftChild.Eval(x, y) / op.RightChild.Eval(x, y)\n}", "func (e *Not) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {\n\tv, err := e.Child.Eval(ctx, row)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif v == nil {\n\t\treturn nil, nil\n\t}\n\n\treturn !v.(bool), nil\n}", "func (l *ListType) eval() Value {\n\treturn l\n}", "func eval(x interface{}, env map[string]interface{}) interface{} {\r\n if str, ok := isSymbol(x); ok { // variable reference\r\n\treturn env[str]\r\n }\r\n l, ok := isList(x)\r\n if !ok { // constant literal\r\n\treturn x\r\n }\r\n if len(l) == 0 {\r\n\tpanic(\"empty list\")\r\n }\r\n if str, ok := isSymbol(l[0]); ok {\r\n\tswitch (str) {\r\n\tcase \"quote\": // (quote exp)\r\n\t return l[1]\r\n\tcase \"if\": // (if test conseq alt)\r\n\t test := l[1]\r\n\t conseq := l[2]\r\n\t alt := l[3]\r\n\t r := eval(test, env)\r\n\t if b, ok := isFalse(r); ok && !b {\r\n\t\treturn eval(alt, env)\r\n\t } else {\r\n\t\treturn eval(conseq, env)\r\n\t }\r\n\tcase \"define\": // (define var exp)\r\n\t car := l[1]\r\n\t cdr := l[2]\r\n\t if str, ok = isSymbol(car); ok {\r\n\t\tenv[str] = eval(cdr, env)\r\n\t\treturn env[str]\r\n\t } else {\r\n\t\tpanic(\"define needs a symbol\")\r\n\t }\r\n\tdefault: // (proc arg...)\r\n\t car := eval(l[0], env)\r\n\t proc, ok := car.(func([]interface{})interface{})\r\n\t if !ok {\r\n\t\tpanic(\"not a procedure\")\r\n\t }\r\n args := makeArgs(l[1:], env)\r\n return proc(args)\r\n\t}\r\n }\r\n return nil\r\n}", "func (e *Not) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {\n\tv, err := e.Child.Eval(ctx, row)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif v == nil {\n\t\treturn nil, nil\n\t}\n\n\tb, ok := v.(bool)\n\tif !ok {\n\t\tb, err = types.ConvertToBool(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn !b, nil\n}", "func (op *OpCos) Eval(x, y float32) float32 {\n\treturn float32(math.Cos(float64(op.Child.Eval(x, y))))\n}", "func (da *DateArith) Eval(ctx context.Context, args map[interface{}]interface{}) (interface{}, error) {\n\tt, years, months, days, durations, err := da.evalArgs(ctx, args)\n\tif t.IsZero() || err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\tif !da.isAdd() {\n\t\tyears, months, days, durations = -years, -months, -days, -durations\n\t}\n\tt.Time = t.Time.Add(durations)\n\tt.Time = t.Time.AddDate(int(years), int(months), int(days))\n\n\t// \"2011-11-11 10:10:20.000000\" outputs \"2011-11-11 10:10:20\".\n\tif t.Time.Nanosecond() == 0 {\n\t\tt.Fsp = 0\n\t}\n\n\treturn t, nil\n}", "func evaluateExpression(c *Context, exp interface{}) interface{} {\r\n var val interface{}\r\n\r\n // fmt.Printf(\"Evaluating type %T, \\n\", exp)\r\n switch t := exp.(type) {\r\n case int:\r\n // fmt.Printf(\"Returning int %d\\n\", t)\r\n val = t\r\n case *Integer:\r\n val = t.Number\r\n case *StringPrimitive:\r\n val = t.str\r\n case string:\r\n val = t\r\n case []interface{}:\r\n val = t\r\n case *InfixExpression:\r\n // fmt.Printf(\"Evaluating infix expresison %T l: %T, r:%T\\n\", t,t.leftNode.Exp, t.rightNode.Exp)\r\n //Get the value of the left node and right\r\n lVal := evaluateExpression(c, t.leftNode.Exp)\r\n rVal := evaluateExpression(c, t.rightNode.Exp)\r\n\r\n\r\n //then apply the correct infix operator to the values\r\n val = evaluateInfixExpression(c, t.opType, lVal, rVal)\r\n\r\n case *Identifier:\r\n // fmt.Printf(\"Was identifier returning %v\\n\", t.id)\r\n if(t.id == \"nil\") {\r\n val = NewNil(0)\r\n } else {\r\n // fmt.Printf(\"Posssible indeitEifer %T\\n\", c.values[t.id])\r\n val = evaluateExpression(c, c.values[t.id])\r\n }\r\n case *CallExpression:\r\n // fmt.Printf(\"Evaluation call to %s\\n\",t.callee)\r\n\r\n //get declaration of call\r\n callDec := c.lookup(t.callee).(*FuncDeclaration)\r\n if(callDec.returnType == \"\") { //no rreturn type = unit\r\n val = &UnitType{}\r\n } else { //Evaluate the expression of the body for a value\r\n //This should produce a value and will execute all\r\n //of the code of the body as well\r\n for i, _ := range callDec.paramNodes {\r\n paramDec := callDec.paramNodes[i].Exp.(*Param)\r\n paramValue := t.paramNodes[i].Exp\r\n c.values[paramDec.id] = evaluateExpression(c, paramValue)\r\n val = c.values[paramDec.id]\r\n }\r\n\r\n }\r\n\r\n if(t.callee == \"printi\") {\r\n invokePrintI(c, t)\r\n } else if(t.callee == \"print\") {\r\n invokePrint(c, t)\r\n } else if(t.callee == \"not\") {\r\n invokeNot(c, t)\r\n } else { //Regular other user defined function do your thing!\r\n //invoke the body\r\n //Get the declaration of the calling function so we can execute it\r\n callDec := c.lookup(t.callee).(*FuncDeclaration)\r\n // fmt.Printf(\"Invoking random func \\n\")\r\n evaluateExpression(c, callDec.body.Exp)\r\n }\r\n case *IfThenElseExpression:\r\n condition := evaluateExpression(c, t.condNode.Exp).(bool)\r\n // fmt.Printf(\"Cond was %v \\n\", condition)\r\n //If else is nil then its an IfThen Exp\r\n if(t.elseNode == nil) {\r\n val = &UnitType{}\r\n if(condition) { //if the condition is true evaluatie the code inside\r\n evaluateExpression(c, t.thenNode.Exp)\r\n }\r\n } else { //otherwise its and ifThenElse\r\n if(condition) {\r\n val = evaluateExpression(c, t.thenNode.Exp)\r\n } else {\r\n val = evaluateExpression(c, t.elseNode.Exp)\r\n }\r\n }\r\n case *SeqExpression:\r\n // Value is equivalent to the last node of the seqence expression\r\n if(len(t.nodes) == 0) {\r\n val = &UnitType{}\r\n } else {\r\n // fmt.Printf(\"Seq type was %T\\n\", t.nodes[len(t.nodes)-1].Exp)\r\n val = evaluateExpression(c, t.nodes[len(t.nodes)-1].Exp)\r\n }\r\n case *Nil:\r\n val = NewNil(0)\r\n case *ArrayExp:\r\n arrType := getType(c, c.lookup(t.typeId)).(*Identifier)\r\n val = c.lookup(arrType.id)\r\n case *ForExpression:\r\n val = &UnitType{}\r\n case *LetExpression:\r\n if(len(t.exps) == 0) {\r\n val = &UnitType{}\r\n } else {\r\n // fmt.Printf(\"%T is last exp type\\n\", t.exps[len(t.exps)-1].Exp)\r\n // val = getType(c, t.exps[len(t.exps)-1].Exp)\r\n }\r\n case *Assignment:\r\n val = &UnitType{}\r\n case *RecordExp:\r\n var slc []interface{}\r\n for _, fcNode := range t.fieldCreateNodes {\r\n if b, isABinding := fcNode.Exp.(*Binding); isABinding {\r\n slc = append(slc, evaluateExpression(c, b.exp.Exp))\r\n }\r\n }\r\n val = slc\r\n default:\r\n fmt.Fprintf(os.Stderr, \"Could not evaluate exp %T\\n\", t)\r\n os.Exit(4)\r\n }\r\n\r\n return val\r\n}", "func Eval(node ast.Node, env *object.Environment) object.Object {\n\tswitch node := node.(type) {\n\n\t// Statements\n\tcase *ast.RootNode:\n\t\treturn evalRootNode(node, env)\n\n\tcase *ast.BlockStatement:\n\t\treturn evalBlockStmt(node, env)\n\n\tcase *ast.ExpressionStatement:\n\t\treturn Eval(node.Expression, env)\n\n\tcase *ast.ReturnStatement:\n\t\tval := Eval(node.ReturnValue, env)\n\t\tif isError(val) {\n\t\t\treturn val\n\t\t}\n\t\treturn &object.ReturnValue{Value: val}\n\n\tcase *ast.LetStatement:\n\t\tval := Eval(node.Value, env)\n\t\tif isError(val) {\n\t\t\treturn val\n\t\t}\n\t\tenv.Set(node.Name.Value, val)\n\n\tcase *ast.ConstStatement:\n\t\tval := Eval(node.Value, env)\n\t\tif isError(val) {\n\t\t\treturn val\n\t\t}\n\t\tenv.Set(node.Name.Value, val)\n\n\t// Expressions\n\tcase *ast.IntegerLiteral:\n\t\treturn &object.Integer{Value: node.Value}\n\n\tcase *ast.StringLiteral:\n\t\treturn &object.String{Value: node.Value}\n\n\tcase *ast.Boolean:\n\t\treturn nativeBoolToBooleanObj(node.Value)\n\n\tcase *ast.PrefixExpression:\n\t\tright := Eval(node.Right, env)\n\t\tif isError(right) {\n\t\t\treturn right\n\t\t}\n\t\treturn evalPrefixExpr(node.Operator, right, node.Token.Line)\n\n\tcase *ast.InfixExpression:\n\t\tleft := Eval(node.Left, env)\n\t\tif isError(left) {\n\t\t\treturn left\n\t\t}\n\t\tright := Eval(node.Right, env)\n\t\tif isError(right) {\n\t\t\treturn right\n\t\t}\n\t\treturn evalInfixExpr(node.Operator, left, right, node.Token.Line)\n\n\tcase *ast.PostfixExpression:\n\t\treturn evalPostfixExpr(env, node.Operator, node)\n\n\tcase *ast.IfExpression:\n\t\treturn evalIfExpr(node, env)\n\n\tcase *ast.Identifier:\n\t\treturn evalIdentifier(node, env)\n\n\tcase *ast.FunctionLiteral:\n\t\tparams := node.Parameters\n\t\tbody := node.Body\n\t\treturn &object.Function{\n\t\t\tParameters: params,\n\t\t\tBody: body,\n\t\t\tEnv: env,\n\t\t}\n\n\tcase *ast.CallExpression:\n\t\tfn := Eval(node.Function, env)\n\t\tif isError(fn) {\n\t\t\treturn fn\n\t\t}\n\t\targs := evalExprs(node.Arguments, env)\n\t\tif len(args) == 1 && isError(args[0]) {\n\t\t\treturn args[0]\n\t\t}\n\t\treturn applyFunction(fn, args, node.Token.Line)\n\n\tcase *ast.ArrayLiteral:\n\t\telements := evalExprs(node.Elements, env)\n\t\tif len(elements) == 1 && isError(elements[0]) {\n\t\t\treturn elements[0]\n\t\t}\n\t\treturn &object.Array{Elements: elements}\n\n\tcase *ast.IndexExpression:\n\t\tleft := Eval(node.Left, env)\n\t\tif isError(left) {\n\t\t\treturn left\n\t\t}\n\t\tindex := Eval(node.Index, env)\n\t\tif isError(index) {\n\t\t\treturn index\n\t\t}\n\t\treturn evalIndexExpr(left, index, node.Token.Line)\n\n\tcase *ast.HashLiteral:\n\t\treturn evalHashLiteral(node, env)\n\t}\n\n\treturn nil\n}", "func Evaluate(item interface{}, passedContext interface{}) map[string]float64 {\n\t//fmt.Fprintf(os.Stderr, \"eval:: %v %T\\n\", item, item)\n\n\tif item != nil {\n\t\tswitch passedContext.(type) {\n\t\tcase *DimContext:\n\t\t\t{\n\t\t\t\t//fmt.Fprintf(os.Stderr, \"here before processMember %v\\n\", item)\n\t\t\t\tprocessMember(item, passedContext)\n\t\t\t\t//fmt.Fprintf(os.Stderr, \"here after processMember %v %T\\n\", item, item)\n\t\t\t}\n\t\t}\n\t\tswitch v := item.(type) {\n\t\tcase hasResults:\n\t\t\t{\n\t\t\t\treturn v.Results()\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (sf *ScalarFunction) Eval(row chunk.Row) (d types.Datum, err error) {\n\tvar (\n\t\tres interface{}\n\t\tisNull bool\n\t)\n\tswitch tp, evalType := sf.GetType(), sf.GetType().EvalType(); evalType {\n\tcase types.ETInt:\n\t\tvar intRes int64\n\t\tintRes, isNull, err = sf.EvalInt(sf.GetCtx(), row)\n\t\tif mysql.HasUnsignedFlag(tp.Flag) {\n\t\t\tres = uint64(intRes)\n\t\t} else {\n\t\t\tres = intRes\n\t\t}\n\tcase types.ETString:\n\t\tres, isNull, err = sf.EvalString(sf.GetCtx(), row)\n\t}\n\n\tif isNull || err != nil {\n\t\td.SetNull()\n\t\treturn d, err\n\t}\n\td.SetValue(res, sf.RetType)\n\treturn\n}", "func (s server) Eval(ctx context.Context, req *entity.Request) (*entity.Result, error) {\n\tlog.Printf(\"Received a request: %+v\\n\", req)\n\tresult := &entity.Result{}\n\tres, err := s.usecase.Eval(req.Value)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\tresult.Value = strconv.FormatFloat(res, 'G', -1, 64)\n\treturn result, nil\n}", "func execEval(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\tret, ret1 := types.Eval(args[0].(*token.FileSet), args[1].(*types.Package), token.Pos(args[2].(int)), args[3].(string))\n\tp.Ret(4, ret, ret1)\n}", "func (p Polynomial) Eval(arg int) ed25519.Scalar {\n\tx := ed25519.New_scalar(*big.NewInt(int64(arg)))\n\tresult := p.coeffs[0].Add(p.coeffs[1].Mul(x))\n\tx_pow := x.Copy()\n\tfor i := 2; i < len(p.coeffs); i++ {\n\t\tx_pow = x_pow.Mul(x)\n\t\tresult = result.Add(p.coeffs[i].Mul(x_pow))\n\t}\n\treturn result\n}", "func (s Scope) Eval(ctx context.Context, local Scope) (Value, error) {\n\ttuple := NewTuple()\n\tfor e := s.Enumerator(); e.MoveNext(); {\n\t\tname, expr := e.Current()\n\t\tvalue, err := expr.Eval(ctx, local)\n\t\tif err != nil {\n\t\t\treturn nil, WrapContextErr(err, expr, local)\n\t\t}\n\t\ttuple = tuple.With(name, value)\n\t}\n\treturn tuple, nil\n}", "func (t *Check) Eval(r, s string) (bool, error) {\n\treturn false, errors.New(\"Not implemented\")\n}", "func (r *Rule) Eval(devices *devices.List, rules map[string]bool) (bool, error) {\n\treturn eval(r.Expression(), devices, rules, r.ast)\n}", "func lvalCall(e *LEnv, f *LVal, a *LVal) *LVal {\n\t//If it is a builtin function, return the result of running that function\n\tif f.Builtin != nil {\n\t\treturn f.Builtin(e, a)\n\t}\n\n\t//Bind the arguments that were passed into the function\n\tfor len(a.Cell) > 0 {\n\t\tif len(f.Formals.Cell) == 0 {\n\t\t\treturn lvalErr(\"Function passed too many arguments\")\n\t\t}\n\n\t\tsym := lvalPop(f.Formals, 0)\n\n\t\tif sym.Sym == \"&\" {\n\t\t\tif len(f.Formals.Cell) != 1 {\n\t\t\t\treturn lvalErr(\"Symbol & not followed by a single symbol.\")\n\t\t\t}\n\n\t\t\tnsym := lvalPop(f.Formals, 0)\n\t\t\tlenvPut(f.Env, nsym, builtinList(e, a))\n\t\t}\n\n\t\tval := lvalPop(a, 0)\n\n\t\tlenvPut(f.Env, sym, val)\n\t}\n\n\tif len(f.Formals.Cell) == 0 {\n\t\tf.Env.Par = e\n\n\t\treturn builtinEval(f.Env, lvalAdd(lvalSexpr(), lvalCopy(f.Body)))\n\t} else {\n\t\treturn lvalCopy(f)\n\t}\n}", "func unary(typ int, op string, od1 *expr) *expr {\n\treturn &expr{\n\t\tsexp: append(exprlist{atomic(typ, op)}, od1),\n\t}\n}", "func (f UnFunc) Apply(ctx context.Context, data interface{}) (interface{}, error) {\n\treturn f(ctx, data)\n}", "func (ev *evaluator) eval(expr Expr) model.Value {\n\t// This is the top-level evaluation method.\n\t// Thus, we check for timeout/cancellation here.\n\tif err := contextDone(ev.ctx, \"expression evaluation\"); err != nil {\n\t\tev.error(err)\n\t}\n\n\tswitch e := expr.(type) {\n\tcase *AggregateExpr:\n\t\tvector := ev.evalVector(e.Expr)\n\t\treturn ev.aggregation(e.Op, e.Grouping, e.Without, e.KeepCommonLabels, e.Param, vector)\n\n\tcase *BinaryExpr:\n\t\tlhs := ev.evalOneOf(e.LHS, model.ValScalar, model.ValVector)\n\t\trhs := ev.evalOneOf(e.RHS, model.ValScalar, model.ValVector)\n\n\t\tswitch lt, rt := lhs.Type(), rhs.Type(); {\n\t\tcase lt == model.ValScalar && rt == model.ValScalar:\n\t\t\treturn &model.Scalar{\n\t\t\t\tValue: scalarBinop(e.Op, lhs.(*model.Scalar).Value, rhs.(*model.Scalar).Value),\n\t\t\t\tTimestamp: ev.Timestamp,\n\t\t\t}\n\n\t\tcase lt == model.ValVector && rt == model.ValVector:\n\t\t\tswitch e.Op {\n\t\t\tcase itemLAND:\n\t\t\t\treturn ev.vectorAnd(lhs.(vector), rhs.(vector), e.VectorMatching)\n\t\t\tcase itemLOR:\n\t\t\t\treturn ev.vectorOr(lhs.(vector), rhs.(vector), e.VectorMatching)\n\t\t\tcase itemLUnless:\n\t\t\t\treturn ev.vectorUnless(lhs.(vector), rhs.(vector), e.VectorMatching)\n\t\t\tdefault:\n\t\t\t\treturn ev.vectorBinop(e.Op, lhs.(vector), rhs.(vector), e.VectorMatching, e.ReturnBool)\n\t\t\t}\n\t\tcase lt == model.ValVector && rt == model.ValScalar:\n\t\t\treturn ev.vectorScalarBinop(e.Op, lhs.(vector), rhs.(*model.Scalar), false, e.ReturnBool)\n\n\t\tcase lt == model.ValScalar && rt == model.ValVector:\n\t\t\treturn ev.vectorScalarBinop(e.Op, rhs.(vector), lhs.(*model.Scalar), true, e.ReturnBool)\n\t\t}\n\n\tcase *Call:\n\t\treturn e.Func.Call(ev, e.Args)\n\n\tcase *MatrixSelector:\n\t\treturn ev.matrixSelector(e)\n\n\tcase *NumberLiteral:\n\t\treturn &model.Scalar{Value: e.Val, Timestamp: ev.Timestamp}\n\n\tcase *ParenExpr:\n\t\treturn ev.eval(e.Expr)\n\n\tcase *StringLiteral:\n\t\treturn &model.String{Value: e.Val, Timestamp: ev.Timestamp}\n\n\tcase *UnaryExpr:\n\t\tse := ev.evalOneOf(e.Expr, model.ValScalar, model.ValVector)\n\t\t// Only + and - are possible operators.\n\t\tif e.Op == itemSUB {\n\t\t\tswitch v := se.(type) {\n\t\t\tcase *model.Scalar:\n\t\t\t\tv.Value = -v.Value\n\t\t\tcase vector:\n\t\t\t\tfor i, sv := range v {\n\t\t\t\t\tv[i].Value = -sv.Value\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn se\n\n\tcase *VectorSelector:\n\t\treturn ev.vectorSelector(e)\n\t}\n\tpanic(fmt.Errorf(\"unhandled expression of type: %T\", expr))\n}", "func (m *MockExpressionNode) Eval() func(backend.Row) (core.Value, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Eval\")\n\tret0, _ := ret[0].(func(backend.Row) (core.Value, error))\n\treturn ret0\n}", "func (o NotOperator) Evaluate(ctx interface{}) (bool, error) {\n\t// fmt.Println(\"Not.Evaluate()\")\n\tresult, err := o.Operand.Evaluate(ctx)\n\treturn !result, err\n}", "func evaluate(arg1 *vector.Vector, oper *vector.Vector, arg2 *vector.Vector) *vector.Vector {\n\t//Store the operator in a temp string, to save typing it out\n\tvar operS string\n\toperS = oper.At(0).(string)\n\tvar val1, val2 int \n\tvar err1, err2 os.Error\n\tval1, err1 = strconv.Atoi(arg1.At(0).(string))\n\tval2, err2 = strconv.Atoi(arg2.At(0).(string))\n\t//screens for consecutive operators\n\tif(err1 != nil || err2 != nil){\n\t\tfmt.Println(\"expr: syntax error\")\n\t\tos.Exit(-2)\n\t}\n\tvar result int = -1\n\t//Evaluate based on the operator\n\tif operS == \"+\" {\n\t\tresult = val1 + val2\n\t} else if operS == \"-\" {\n\t\tresult = val1 - val2\n\t} else if operS == \"/\" {\n\t\tresult = val1 / val2\n\t} else if operS == \"*\" {\n\t\tresult = val1 * val2\n\t} else if operS == \"%\" {\n\t\tresult = val1 % val2\n\t}\n\t//Clear the arg1 vector and add the result to it, then return\n\t//(saves memory by not creating a new vector)\n\targ1.Cut(0, arg1.Len())\n\targ1.Push(strconv.Itoa(result))\n\treturn arg1\n}" ]
[ "0.65595543", "0.62546283", "0.6108872", "0.6097263", "0.60695493", "0.6036691", "0.5988384", "0.59279025", "0.59279025", "0.5880389", "0.5870704", "0.5835574", "0.58030385", "0.58030385", "0.5791403", "0.5744493", "0.57420194", "0.573196", "0.57011765", "0.5694317", "0.5689354", "0.5674573", "0.5669151", "0.5619979", "0.5591362", "0.55852973", "0.5583008", "0.55749935", "0.55336136", "0.5526991", "0.5526954", "0.550571", "0.54969144", "0.5495889", "0.5473144", "0.5457676", "0.54540604", "0.5397223", "0.5373039", "0.537217", "0.536783", "0.5362784", "0.5362784", "0.5353833", "0.53533196", "0.53504956", "0.5349783", "0.53294647", "0.53083706", "0.5305044", "0.5287442", "0.5285157", "0.5282981", "0.5281684", "0.5277707", "0.52742606", "0.5263609", "0.5263155", "0.5258789", "0.52530026", "0.524969", "0.5244637", "0.52341306", "0.52311856", "0.5226741", "0.5226741", "0.522261", "0.5196474", "0.51939565", "0.5179526", "0.5176584", "0.51650256", "0.5158251", "0.5153515", "0.5136048", "0.5129726", "0.512609", "0.51231015", "0.51215166", "0.5112109", "0.51101106", "0.5107827", "0.5106561", "0.51064914", "0.5104398", "0.5097119", "0.50868475", "0.50603026", "0.5053217", "0.5049944", "0.5043144", "0.5029906", "0.50245243", "0.50226367", "0.50202715", "0.5012599", "0.50091726", "0.5006603", "0.5003481" ]
0.51304144
76
/ This method takes in an object and returns a slice of values that contains the attribute names. If the type of input is missing then return a missing value, and if not an object return a null value. Convert it to a valid Go type. Cast it to a map from string to interface. Range over this map and retrieve the keys. Sort it and then use it to save the corresponding values into a slice of interfaces. Return the slice.
func (this *ObjectNames) Apply(context Context, arg value.Value) (value.Value, error) { if arg.Type() == value.MISSING { return value.MISSING_VALUE, nil } else if arg.Type() != value.OBJECT { return value.NULL_VALUE, nil } oa := arg.Actual().(map[string]interface{}) keys := make(sort.StringSlice, 0, len(oa)) for key, _ := range oa { keys = append(keys, key) } sort.Sort(keys) ra := make([]interface{}, len(keys)) for i, k := range keys { ra[i] = k } return value.NewValue(ra), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (nvp *NameValues) ToInterfaceArray() []interface{} {\n\treturn NameValuesToInterfaceArray(*nvp)\n}", "func objToNames(obj interface{}, names []string, tag string) []string {\n\tvar typ reflect.Type\n\n\tif sf, ok := obj.(reflect.StructField); ok {\n\t\ttyp = sf.Type\n\t} else {\n\t\ttyp = reflect.TypeOf(obj)\n\t\tif typ.Kind() == reflect.Ptr {\n\t\t\ttyp = typ.Elem()\n\t\t}\n\t}\n\n\tfor i := 0; i < typ.NumField(); i++ {\n\t\tfield := typ.Field(i)\n\n\t\tif field.Type.Kind() == reflect.Struct {\n\t\t\tnames = objToNames(field, names, tag)\n\t\t\tcontinue\n\t\t}\n\n\t\t// If tag is passed to the function, we only append if the field is tagged and that it matches tag.\n\t\tif tag == \"\" || field.Tag.Get(tag) != \"\" {\n\t\t\tnames = append(names, field.Name)\n\t\t}\n\t}\n\n\treturn names\n}", "func Keys(i interface{}) (keys []string) {\n\tv := reflect.ValueOf(i)\n\n\tif v.Kind() != reflect.Map {\n\t\tfmt.Fprintf(os.Stderr, \"Input type is not a map type: %v\", v)\n\t\treturn nil\n\t}\n\n\tfor _,key := range v.MapKeys() {\n\t\tkeys = append(keys, key.Interface().(string))\n\t}\n\n\treturn keys\n}", "func SortedValues(i interface{}) []interface{} {\n\tm, ok := i.(map[string]interface{})\n\tif !ok {\n\t\tFatalf(\"SortedValues: expected map[string]interface{}, didn't get it\")\n\t}\n\tmapping := map[string]string{} // sort key: original key\n\tfor name, element := range m {\n\t\tsubmap, ok := element.(map[string]interface{})\n\t\tif !ok {\n\t\t\tmapping[name] = name\n\t\t\tcontinue\n\t\t}\n\t\tsortkey, ok := submap[\"sortkey\"]\n\t\tif !ok {\n\t\t\tmapping[name] = name\n\t\t\tcontinue\n\t\t}\n\t\tsortkeyString, ok := sortkey.(string)\n\t\tif !ok {\n\t\t\tmapping[name] = name\n\t\t\tcontinue\n\t\t}\n\t\tmapping[sortkeyString] = name\n\t}\n\n\tsortkeys := stringSlice{}\n\tfor sortkey, _ := range mapping {\n\t\tsortkeys = append(sortkeys, sortkey)\n\t}\n\tsort.Sort(sortkeys)\n\n\torderedValues := []interface{}{}\n\tfor _, k := range sortkeys {\n\t\torderedValues = append(orderedValues, m[mapping[k]])\n\t}\n\treturn orderedValues\n}", "func ToStringStringMap(tagName string, input interface{}, properties ...string) (map[string]string, error) {\n\tvmap := make(map[string]string)\n\ts := structs.New(input)\n\ts.TagName = tagName\n\tif len(properties) == 0 {\n\t\tproperties = s.Names()\n\t}\n\n\tfor _, field := range s.Fields() {\n\t\tif !field.IsExported() {\n\t\t\tcontinue\n\t\t}\n\n\t\tif !stringInSlice(field.Name(), properties) {\n\t\t\tcontinue\n\t\t}\n\n\t\tfieldName, opts := parseTag(field.Tag(tagName))\n\t\tif fieldName == \"\" || fieldName == \"-\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tval := field.Value()\n\n\t\tif opts.Has(\"omitempty\") {\n\t\t\tif field.IsZero() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif z, ok := val.(isZeroer); ok && z.IsZero() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif z, ok := val.(isEmptier); ok && z.IsEmpty() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tkind := field.Kind()\n\t\tif kind == reflect.Ptr {\n\t\t\tv := reflect.ValueOf(val)\n\t\t\tif v.IsNil() {\n\t\t\t\tvmap[fieldName] = \"\"\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\telem := v.Elem()\n\t\t\tkind = elem.Kind()\n\t\t\tval = elem.Interface()\n\t\t}\n\n\t\tif opts.Has(\"include\") && kind == reflect.Struct {\n\t\t\tvar newProperties []string\n\t\t\tfor _, prop := range properties {\n\t\t\t\tif strings.HasPrefix(prop, fieldName+\".\") {\n\t\t\t\t\tnewProperties = append(newProperties, strings.TrimPrefix(prop, fieldName+\".\"))\n\t\t\t\t}\n\t\t\t}\n\t\t\tm, err := ToStringStringMap(tagName, val, newProperties...)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tfor k, v := range m {\n\t\t\t\tvmap[fieldName+\".\"+k] = v\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif v, ok := val.(string); ok {\n\t\t\tvmap[fieldName] = v\n\t\t\tcontinue\n\t\t} else if v, ok := val.(*string); ok {\n\t\t\tvmap[fieldName] = *v\n\t\t\tcontinue\n\t\t}\n\n\t\tif !field.IsZero() {\n\t\t\tif m, ok := val.(encoding.TextMarshaler); ok {\n\t\t\t\ttxt, err := m.MarshalText()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tvmap[fieldName] = string(txt)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif m, ok := val.(json.Marshaler); ok {\n\t\t\t\ttxt, err := m.MarshalJSON()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tvmap[fieldName] = string(txt)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif kind == reflect.String {\n\t\t\tvmap[fieldName] = fmt.Sprint(val)\n\t\t\tcontinue\n\t\t}\n\n\t\tif txt, err := json.Marshal(val); err == nil {\n\t\t\tvmap[fieldName] = string(txt)\n\t\t\tif vmap[fieldName] == `\"\"` || vmap[fieldName] == \"null\" {\n\t\t\t\tvmap[fieldName] = \"\"\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tvmap[fieldName] = fmt.Sprintf(\"%v\", val)\n\t}\n\treturn vmap, nil\n}", "func GetNames(result []interface{})[]string{\n\tvar names []string\n\tfor _, poi := range result {\n\t\t//fmt.Println(poi.(map[string]interface{})[\"name\"])\n\t\tnames = append(names, poi.(map[string]interface{})[\"name\"].(string))\n\t}\n\treturn names\n}", "func SortedKeys(i interface{}) []string {\n\tvMap := reflect.ValueOf(i)\n\tvKeys := vMap.MapKeys()\n\tkeys := make([]string, len(vKeys), len(vKeys))\n\tidx := 0\n\tfor _,vKey := range vKeys {\n\t\tkeys[idx] = vKey.String()\n\t\tidx++\n\t}\n\tsort.Strings(keys)\n\treturn keys\n}", "func attributes(m interface{}) map[string]reflect.Type {\n\ttyp := reflect.TypeOf(m)\n\t// if a pointer to a struct is passed, get the type of the dereferenced object\n\tif typ.Kind() == reflect.Ptr {\n\t\ttyp = typ.Elem()\n\t}\n\n\t// create an attribute data structure as a map of types keyed by a string.\n\tattrs := make(map[string]reflect.Type)\n\t// Only structs are supported so return an empty result if the passed object\n\t// isn't a struct\n\tif typ.Kind() != reflect.Struct {\n\t\tfmt.Printf(\"%v type can't have attributes inspected\\n\", typ.Kind())\n\t\treturn attrs\n\t}\n\n\t// loop through the struct's fields and set the map\n\tfor i := 0; i < typ.NumField(); i++ {\n\t\tp := typ.Field(i)\n\t\tif !p.Anonymous {\n\t\t\tattrs[p.Name] = p.Type\n\t\t}\n\t}\n\n\treturn attrs\n}", "func Values(i interface{}) ([]interface{}) {\n\tvar result []interface{}\n\tv := reflect.ValueOf(i)\n\n\tif v.Kind() != reflect.Map {\n\t\tfmt.Fprintf(os.Stderr, \"Input type is not a map type: %v\", v)\n\t\treturn nil\n\t}\n\n\tfor _,key := range (v.MapKeys()) {\n\t\tresult = append(result, v.MapIndex(key).Interface())\n\t}\n\n\treturn result\n}", "func Keys(i interface{}) (keys []string, ok bool) {\n\tkeys = make([]string, 0)\n\tv, k := preprocess(i)\n\tswitch k {\n\tcase reflect.Map:\n\t\tk := v.MapKeys()\n\t\tfor i := range k {\n\t\t\ts, ok := k[i].Interface().(string)\n\t\t\tif !ok {\n\t\t\t\treturn nil, false\n\t\t\t}\n\t\t\tkeys = append(keys, s)\n\t\t}\n\t\treturn keys, true\n\tcase reflect.Struct:\n\t\tt := v.Type()\n\t\tfor i := 0; i < v.NumField(); i++ {\n\t\t\tt2 := t.Field(i)\n\t\t\tfname := t2.Tag.Get(\"duck\")\n\t\t\tif fname != \"-\" {\n\t\t\t\tif fname == \"\" {\n\t\t\t\t\tfname = t2.Name\n\t\t\t\t}\n\t\t\t\tkeys = append(keys, fname)\n\t\t\t}\n\t\t}\n\t\treturn keys, true\n\t}\n\treturn nil, false\n}", "func IntegerFieldToSortedArray(m []interface{}, fieldName string) (vKeys []int) {\n\tif len(m) > 1000 {\n\t\tpanic(\"this uses reflection - not for large structs\")\n\t}\n\tvKeys = make([]int, len(m))\n\tfor i, iface := range m {\n\t\tvKeys[i] = GetIntField(iface, fieldName)\n\t}\n\tsort.Ints(vKeys)\n\treturn\n}", "func InterfaceToUveKeysTypeSlice(i interface{}) []*UveKeysType {\n\tlist := schema.InterfaceToInterfaceList(i)\n\tif list == nil {\n\t\treturn nil\n\t}\n\tresult := []*UveKeysType{}\n\tfor _, item := range list {\n\t\tresult = append(result, InterfaceToUveKeysType(item))\n\t}\n\treturn result\n}", "func (claim Claim) ToAttributes() []*Attribute {\n\tvar attributes []*Attribute\n\n\tqueue := list.New()\n\tqueue.PushBack(&nestedObject{\n\t\tprefix: \"\",\n\t\tcontent: claim,\n\t})\n\t// go through every property of the claim, transform it into an int and put it into the attributes array\n\tfor queue.Len() > 0 {\n\t\telem := queue.Front()\n\t\tqueue.Remove(elem)\n\t\tjsonObj := elem.Value.(*nestedObject)\n\t\tfor n, v := range jsonObj.content {\n\t\t\tvar name string\n\t\t\tn = escape(n, []rune(Separator)[0])\n\t\t\tif jsonObj.prefix != \"\" {\n\t\t\t\tname = jsonObj.prefix + Separator + n\n\t\t\t} else {\n\t\t\t\tname = n\n\t\t\t}\n\t\t\treflected := reflect.ValueOf(v)\n\n\t\t\tswitch reflected.Kind() {\n\t\t\tcase reflect.Map:\n\t\t\t\tif m, ok := v.(Claim); ok {\n\t\t\t\t\tqueue.PushBack(&nestedObject{\n\t\t\t\t\t\tprefix: name,\n\t\t\t\t\t\tcontent: m,\n\t\t\t\t\t})\n\t\t\t\t} else if m, ok := v.(map[string]interface{}); ok {\n\t\t\t\t\tqueue.PushBack(&nestedObject{\n\t\t\t\t\t\tprefix: name,\n\t\t\t\t\t\tcontent: (Claim)(m),\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tpanic(fmt.Sprintf(\"unsupported map type %T\", v))\n\t\t\t\t}\n\t\t\tcase reflect.Slice, reflect.Array:\n\t\t\t\tmarshaledV, err := json.Marshal(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(\"could not marshal array\")\n\t\t\t\t}\n\t\t\t\t// for big ints prepend with non null byte\n\t\t\t\tmarshaledV = append([]byte{MagicByte}, marshaledV...)\n\t\t\t\tattributes = append(attributes, &Attribute{\n\t\t\t\t\tName: name,\n\t\t\t\t\tTypename: \"array\",\n\t\t\t\t\tValue: marshaledV,\n\t\t\t\t})\n\t\t\tcase reflect.String:\n\t\t\t\tattributes = append(attributes, &Attribute{\n\t\t\t\t\tName: name,\n\t\t\t\t\tTypename: \"string\",\n\t\t\t\t\tValue: []byte(reflected.String()),\n\t\t\t\t})\n\t\t\tcase reflect.Float32, reflect.Float64:\n\t\t\t\tvar buf [8]byte\n\t\t\t\tbinary.BigEndian.PutUint64(buf[:], math.Float64bits(reflected.Float()))\n\t\t\t\tattributes = append(attributes, &Attribute{\n\t\t\t\t\tName: name,\n\t\t\t\t\tTypename: \"float\",\n\t\t\t\t\tValue: buf[:],\n\t\t\t\t})\n\t\t\tcase reflect.Bool:\n\t\t\t\tvar value byte\n\t\t\t\tif reflected.Bool() {\n\t\t\t\t\tvalue = 1\n\t\t\t\t} else {\n\t\t\t\t\tvalue = 0\n\t\t\t\t}\n\t\t\t\tattributes = append(attributes, &Attribute{\n\t\t\t\t\tName: name,\n\t\t\t\t\tTypename: \"bool\",\n\t\t\t\t\tValue: []byte{value},\n\t\t\t\t})\n\t\t\tcase 0:\n\t\t\t\tattributes = append(attributes, &Attribute{\n\t\t\t\t\tName: name,\n\t\t\t\t\tTypename: \"\",\n\t\t\t\t\tValue: []byte{},\n\t\t\t\t})\n\t\t\tdefault:\n\t\t\t\tpanic(fmt.Sprintf(\"unknown type %T of property %s\", v, name))\n\t\t\t}\n\t\t}\n\t}\n\t// sort attributes by name\n\tsort.Slice(attributes[:], func(i, j int) bool {\n\t\treturn strings.Compare(attributes[i].Name, attributes[j].Name) < 0\n\t})\n\treturn attributes\n}", "func StringToInterface(i []string) []interface{} {\n\to := make([]interface{}, len(i))\n\tfor k, v := range i {\n\t\to[k] = v\n\t}\n\n\treturn o\n}", "func (attestedClaim *AttestedClaim) getAttributes() ([]*Attribute, error) {\n\tbInts := attestedClaim.getRawAttributes()\n\tattributes, err := BigIntsToAttributes(bInts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsorted := sort.SliceIsSorted(attributes, func(p, q int) bool {\n\t\treturn strings.Compare(attributes[p].Name, attributes[q].Name) < 0\n\t})\n\tif !sorted {\n\t\treturn nil, errors.New(\"expected attributes inside credential to be sorted\")\n\t}\n\treturn attributes, nil\n}", "func keys(dict interface{}) interface{} {\n var m = dict.(map[interface{}]interface{})\n var keys = make([]interface{}, 0, len(m))\n for k := range m {\n keys = append(keys, k)\n }\n return keys\n}", "func (*K8sObjectTag) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase k8sobjecttag.FieldID, k8sobjecttag.FieldK8sObjectId, k8sobjecttag.FieldK8sLabelId:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase k8sobjecttag.FieldCreatedAt, k8sobjecttag.FieldUpdatedAt, k8sobjecttag.FieldDeletedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type K8sObjectTag\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "func objFields(obj interface{}, skipKey bool) (interface{}, []interface{}) {\n\tval := reflect.ValueOf(obj)\n\tt := reflect.TypeOf(obj)\n\ta := make([]interface{}, 0, t.NumField())\n\tvar key interface{}\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tf := t.Field(i)\n\t\tif len(f.Tag.Get(\"sql\")) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif f.Tag.Get(\"key\") == \"true\" {\n\t\t\tkey = val.Field(i).Interface()\n\t\t\tif skipKey {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\ta = append(a, val.Field(i).Interface())\n\t}\n\treturn key, a\n}", "func attributes(m interface{}) map[string]reflect.Type {\n\ttyp := reflect.TypeOf(m)\n\tif typ.Kind() == reflect.Ptr {\n\t\ttyp = typ.Elem()\n\t}\n\n\tattrs := make(map[string]reflect.Type)\n\tif typ.Kind() != reflect.Struct {\n\t\treturn nil\n\t}\n\n\tfor i := 0; i < typ.NumField(); i++ {\n\t\tp := typ.Field(i)\n\t\tif !p.Anonymous {\n\t\t\tattrs[p.Name] = p.Type\n\t\t}\n\t}\n\n\treturn attrs\n}", "func printNames(names []pkix.AttributeTypeAndValue, buf *bytes.Buffer) []string {\n values := []string{} \n for _, name := range names {\n oid := name.Type\n if len(oid) == 4 && oid[0] == 2 && oid[1] == 5 && oid[2] == 4 {\n switch oid[3] {\n case 3:\n values = append(values, fmt.Sprintf(\"CN=%s\", name.Value))\n case 6:\n values = append(values, fmt.Sprintf(\"C=%s\", name.Value))\n case 8:\n values = append(values, fmt.Sprintf(\"ST=%s\", name.Value))\n case 10:\n values = append(values, fmt.Sprintf(\"O=%s\", name.Value))\n case 11:\n values = append(values, fmt.Sprintf(\"OU=%s\", name.Value))\n default: \n values = append(values, fmt.Sprintf(\"UnknownOID=%s\", name.Type.String()))\n }\n } else if oid.Equal(oidEmailAddress) {\n values = append(values, fmt.Sprintf(\"emailAddress=%s\", name.Value))\n } else {\n values = append(values, fmt.Sprintf(\"UnknownOID=%s\", name.Type.String()))\n }\n }\n\nif len(values) > 0 {\n buf.WriteString(values[0])\n for i := 1; i < len(values); i++ {\n buf.WriteString(\",\" + values[i])\n }\n buf.WriteString(\"\\n\")\n }\n return values\n}", "func (set *AppleSet) ToInterfaceSlice() []interface{} {\n\tset.s.RLock()\n\tdefer set.s.RUnlock()\n\n\ts := make([]interface{}, 0, len(set.m))\n\tfor v := range set.m {\n\t\ts = append(s, v)\n\t}\n\treturn s\n}", "func getTags(s interface{}, tag string) []string {\n\tvar columns []string\n\ttblStructType := reflect.TypeOf(s)\n\n\tfor fnum := 0; fnum < tblStructType.NumField(); fnum++ {\n\t\tfield := tblStructType.Field(fnum)\n\t\tif fieldName, ok := field.Tag.Lookup(tag); ok {\n\t\t\tif fieldName != \"\" {\n\t\t\t\tcolumns = append(columns, fieldName)\n\t\t\t}\n\t\t}\n\t}\n\treturn columns\n}", "func GetFieldMap(obj interface{}) (ret map[string]string) {\n\tval := reflect.ValueOf(obj).Elem()\n\tret = make(map[string]string)\n\tfor i := 0; i < val.NumField(); i++ {\n\t\ttypeField := val.Type().Field(i)\n\t\tkey := strings.ToLower(typeField.Name)\n\t\tif typeField.PkgPath != \"\" {\n\t\t\t// Private method\n\t\t\tcontinue\n\t\t} else {\n\t\t\tret[key] = typeField.Name\n\t\t}\n\t}\n\treturn\n}", "func (ModelSortKey) Values() []ModelSortKey {\n\treturn []ModelSortKey{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t}\n}", "func objToValues(obj interface{}, vals []string) []string {\n\tvar val reflect.Value\n\n\tif rval, ok := obj.(reflect.Value); ok {\n\t\tval = rval\n\t} else {\n\t\tval = reflect.ValueOf(obj)\n\t\tif val.Kind() == reflect.Ptr {\n\t\t\tval = val.Elem()\n\t\t}\n\t}\n\n\tfor i := 0; i < val.NumField(); i++ {\n\t\tfield := val.Field(i)\n\n\t\tswitch field.Kind() {\n\t\tcase reflect.Struct:\n\t\t\tvals = objToValues(field, vals)\n\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\tvals = append(vals, strconv.FormatInt(field.Int(), 10))\n\t\tcase reflect.Float32, reflect.Float64:\n\t\t\tvals = append(vals, strconv.FormatFloat(field.Float(), 'f', 3, 32))\n\t\tcase reflect.String:\n\t\t\tvals = append(vals, field.String())\n\t\tdefault:\n\t\t\t// This is sample code, so this is fine.\n\t\t\t// As a best practice, we should really have an exhaustive list of cases to extract the field value.\n\t\t\tvals = append(vals, \"<Field type not supported>\")\n\t\t}\n\t}\n\n\treturn vals\n}", "func GetFields(m interface{}) (ns []string) {\n\ttyp := GetType(m)\n\t// Only structs are supported so return an empty result if the passed object\n\t// isn't a struct\n\tif typ.Kind() != reflect.Struct {\n\t\tfmt.Printf(\"%v type can't have attributes inspected\\n\", typ.Kind())\n\t\treturn\n\t}\n\t// loop through the struct's fields\n\tfor i := 0; i < typ.NumField(); i++ {\n\t\tf := typ.Field(i)\n\t\tif f.Anonymous {\n\t\t\tfkind := f.Type.Kind()\n\t\t\tif fkind == reflect.Struct || fkind == reflect.Ptr {\n\t\t\t\tfns := GetFields(reflect.New(f.Type).Interface())\n\t\t\t\tfor _, fn := range fns {\n\t\t\t\t\tif String(fn).IsInArray(ns) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tns = append(ns, fn)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif String(f.Name).IsInArray(ns) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tns = append(ns, f.Name)\n\t\t}\n\t}\n\treturn ns\n}", "func (NetworkInterfaceAttribute) Values() []NetworkInterfaceAttribute {\n\treturn []NetworkInterfaceAttribute{\n\t\t\"description\",\n\t\t\"groupSet\",\n\t\t\"sourceDestCheck\",\n\t\t\"attachment\",\n\t}\n}", "func (b bindingContainer) InterfaceNames() (keys []string) {\n\t//TODO: use Interfaces() here.\n\tkeys = make([]string, len(b))\n\ti := 0\n\tfor k, _ := range b {\n\t\tkeys[i] = k\n\t\ti++\n\t}\n\treturn\n}", "func (ModelPackageSortBy) Values() []ModelPackageSortBy {\n\treturn []ModelPackageSortBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t}\n}", "func getFields(s interface{}) []interface{} {\n\tv := reflect.ValueOf(s)\n\tv = dereference(v)\n\tfields := []interface{}{}\n\tfor i := 0; i < v.NumField(); i++ {\n\t\tfield := v.Field(i)\n\t\tif field.CanInterface() {\n\t\t\tfields = append(fields, field.Interface())\n\t\t}\n\t}\n\treturn fields\n}", "func MapKeyAsStrings(m interface{}) []string {\n\tkeys := reflect.ValueOf(m).MapKeys()\n\tres := make([]string, len(keys))\n\tfor i, key := range keys {\n\t\tres[i] = key.String()\n\t}\n\treturn res\n}", "func (SortLineageGroupsBy) Values() []SortLineageGroupsBy {\n\treturn []SortLineageGroupsBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t}\n}", "func (SortAssociationsBy) Values() []SortAssociationsBy {\n\treturn []SortAssociationsBy{\n\t\t\"SourceArn\",\n\t\t\"DestinationArn\",\n\t\t\"SourceType\",\n\t\t\"DestinationType\",\n\t\t\"CreationTime\",\n\t}\n}", "func (InterfacePermissionType) Values() []InterfacePermissionType {\n\treturn []InterfacePermissionType{\n\t\t\"INSTANCE-ATTACH\",\n\t\t\"EIP-ASSOCIATE\",\n\t}\n}", "func attrsFrom(schema interface{}) (attrs []string) {\n\t// fields from schema\n\ts := reflect.ValueOf(schema).Elem()\n\tfs := s.Type()\n\tfor i := 0; i < s.NumField(); i++ {\n\t\tfield := s.Field(i)\n\t\tif skipField(fs.Field(i).Name, field) {\n\t\t\tcontinue\n\t\t}\n\t\tattrs = append(attrs, fs.Field(i).Name)\n\t}\n\treturn\n}", "func InterfaceValues() []Interface {\n\treturn _InterfaceValues\n}", "func InterfaceValues() []Interface {\n\treturn _InterfaceValues\n}", "func ToInterface(v interface{}) ([]interface{}, error) {\n\tlist := []interface{}{}\n\ta := reflect.ValueOf(v)\n\tif !a.IsValid() {\n\t\treturn list, errors.New(\"failed to get reflection value\")\n\t}\n\tfor i := 0; i < a.NumField(); i++ {\n\t\tval := a.Field(i)\n\t\tswitch val.Kind() {\n\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\tlist = append(list, strconv.FormatInt(val.Int(), 10))\n\t\tcase reflect.String:\n\t\t\tlist = append(list, val.String())\n\t\tcase reflect.Float32, reflect.Float64:\n\t\t\tlist = append(list, val.Float())\n\t\tcase reflect.Bool:\n\t\t\tlist = append(list, val.Bool())\n\t\t}\n\t}\n\treturn list, nil\n}", "func InterfaceToStringMap(i interface{}) map[string]string {\n\tstringMap := map[string]string{}\n\tfor key, value := range i.(map[interface{}]interface{}) {\n\t\tstringMap[key.(string)] = value.(string)\n\t}\n\treturn stringMap\n}", "func SlotTypeSortAttribute_Values() []string {\n\treturn []string{\n\t\tSlotTypeSortAttributeSlotTypeName,\n\t\tSlotTypeSortAttributeLastUpdatedDateTime,\n\t}\n}", "func (SpaceSortKey) Values() []SpaceSortKey {\n\treturn []SpaceSortKey{\n\t\t\"CreationTime\",\n\t\t\"LastModifiedTime\",\n\t}\n}", "func (ModelCardSortBy) Values() []ModelCardSortBy {\n\treturn []ModelCardSortBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t}\n}", "func Values(a interface{}) interface{} {\n\tval := reflect.ValueOf(a)\n\tkeys := val.MapKeys()\n\ttyp := reflect.TypeOf(a).Elem()\n\n\t// Create result slice.\n\tresultValue := reflect.MakeSlice(reflect.SliceOf(typ),\n\t\tlen(keys), len(keys))\n\tfor i := range keys {\n\t\tresultValue.Index(i).Set(val.MapIndex(keys[i]))\n\t}\n\tresult := resultValue.Interface()\n\tsortSlice(result) // Sort result, for consistency.\n\treturn result\n}", "func (k2h *K2hash) GetAttrs(k string) ([]Attr, error) {\n\t// 1. retrieve an attribute using k2h_get_attrs\n\t// bool k2h_get_attrs(k2h_h handle, const unsigned char* pkey, size_t keylength, PK2HATTRPCK* ppattrspck, int* pattrspckcnt)\n\tcKey := C.CBytes([]byte(k))\n\tdefer C.free(unsafe.Pointer(cKey))\n\tvar attrpack C.PK2HATTRPCK\n\tvar attrpackCnt C.int\n\tok := C.k2h_get_attrs(\n\t\tk2h.handle,\n\t\t(*C.uchar)(cKey),\n\t\tC.size_t(len([]byte(k))+1), // plus one for a null termination\n\t\t&attrpack,\n\t\t&attrpackCnt,\n\t)\n\tdefer C.k2h_free_attrpack(attrpack, attrpackCnt) // free the memory for the keypack for myself(GC doesn't know the area)\n\n\tif ok == false {\n\t\tfmt.Println(\"C.k2h_get_attrs returns false\")\n\t\treturn []Attr{}, fmt.Errorf(\"C.k2h_get_attrs() = %v\", ok)\n\t} else if attrpackCnt == 0 {\n\t\tfmt.Printf(\"attrpackLen is zero\")\n\t\treturn []Attr{}, nil\n\t} else {\n\t\tfmt.Printf(\"attrpackLen is %v\\n\", attrpackCnt)\n\t}\n\t// 2. copy an attribute data to a slice\n\tvar CAttrs C.PK2HATTRPCK = attrpack\n\tcount := (int)(attrpackCnt)\n\tslice := (*[1 << 28]C.K2HATTRPCK)(unsafe.Pointer(CAttrs))[:count:count]\n\tfmt.Printf(\"slice size is %v\\n\", len(slice))\n\t//\n\tattrs := make([]Attr, count) // copy\n\tfor i, data := range slice {\n\t\t// copy the data with len-1 length, which exclude a null termination.\n\t\tattrkey := C.GoBytes(unsafe.Pointer(data.pkey), (C.int)(data.keylength-1))\n\t\tfmt.Printf(\"i %v data %T pkey %v length %v attrkey %v\\n\", i, data, data.pkey, data.keylength, string(attrkey))\n\t\tattrval := C.GoBytes(unsafe.Pointer(data.pval), (C.int)(data.vallength-1))\n\t\tfmt.Printf(\"i %v data %T pval %v length %v attrval %v\\n\", i, data, data.pval, data.vallength, string(attrval))\n\t\t// cast bytes to a string\n\t\tattrs[i].key = string(attrkey)\n\t\tattrs[i].val = string(attrval)\n\t}\n\treturn attrs, nil\n}", "func (AutoMLSortBy) Values() []AutoMLSortBy {\n\treturn []AutoMLSortBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t\t\"Status\",\n\t}\n}", "func (claim *Claim) ToAttributes() ([]*Attribute, []*big.Int) {\n\tvar attributes []*Attribute\n\tvar values []*big.Int\n\n\t// TODO: nested attributes, array might not be a wise choice here (many memcopy ops?)\n\tattributes = append(attributes, &Attribute{\n\t\t\"ctype\",\n\t\t\"string\",\n\t})\n\tvalues = append(values, new(big.Int).SetBytes([]byte(claim.CType)))\n\n\tqueue := list.New()\n\tqueue.PushBack(&nestedObject{\n\t\tprefix: \"contents\",\n\t\tcontent: claim.Contents,\n\t})\n\tfor queue.Len() > 0 {\n\t\telem := queue.Front()\n\t\tqueue.Remove(elem)\n\t\tjsonObj := elem.Value.(*nestedObject)\n\t\tfor n, v := range jsonObj.content {\n\t\t\tname := jsonObj.prefix + SEPARATOR + n\n\t\t\tif f, ok := v.(map[string]interface{}); ok {\n\t\t\t\tqueue.PushBack(&nestedObject{\n\t\t\t\t\tprefix: name,\n\t\t\t\t\tcontent: f,\n\t\t\t\t})\n\t\t\t} else if str, ok := v.(string); ok {\n\t\t\t\tattributes = append(attributes, &Attribute{\n\t\t\t\t\tname,\n\t\t\t\t\t\"string\",\n\t\t\t\t})\n\t\t\t\tvalues = append(values, new(big.Int).SetBytes([]byte(str)))\n\t\t\t} else if f, ok := v.(float64); ok {\n\t\t\t\tvar buf [8]byte\n\t\t\t\tbinary.BigEndian.PutUint64(buf[:], math.Float64bits(f))\n\t\t\t\tattributes = append(attributes, &Attribute{\n\t\t\t\t\tname,\n\t\t\t\t\t\"float\",\n\t\t\t\t})\n\t\t\t\tvalues = append(values, new(big.Int).SetBytes(buf[:]))\n\t\t\t} else if f, ok := v.(bool); ok {\n\t\t\t\tvar value *big.Int\n\t\t\t\tif f {\n\t\t\t\t\tvalue = new(big.Int).SetInt64(1)\n\t\t\t\t} else {\n\t\t\t\t\tvalue = new(big.Int).SetInt64(0)\n\t\t\t\t}\n\t\t\t\tattributes = append(attributes, &Attribute{\n\t\t\t\t\tname,\n\t\t\t\t\t\"bool\",\n\t\t\t\t})\n\t\t\t\tvalues = append(values, value)\n\t\t\t} else {\n\t\t\t\tpanic(\"Unknown type\")\n\t\t\t}\n\t\t}\n\t}\n\tsort.Sort(byName{attributes, values})\n\n\treturn attributes, values\n}", "func (res *Resource) SortableAttrs(columns ...string) []string {\n\tif len(columns) != 0 || res.sortableAttrs == nil {\n\t\tif len(columns) == 0 {\n\t\t\tcolumns = res.ConvertSectionToStrings(res.indexSections)\n\t\t}\n\t\tres.sortableAttrs = &[]string{}\n\t\tscope := res.GetAdmin().Config.DB.NewScope(res.Value)\n\t\tfor _, column := range columns {\n\t\t\tif field, ok := scope.FieldByName(column); ok && field.DBName != \"\" {\n\t\t\t\tattrs := append(*res.sortableAttrs, column)\n\t\t\t\tres.sortableAttrs = &attrs\n\t\t\t}\n\t\t}\n\t}\n\treturn *res.sortableAttrs\n}", "func (ImageSortBy) Values() []ImageSortBy {\n\treturn []ImageSortBy{\n\t\t\"CREATION_TIME\",\n\t\t\"LAST_MODIFIED_TIME\",\n\t\t\"IMAGE_NAME\",\n\t}\n}", "func (a adapter) Attrs(key string) []string {\n\treturn a.entry.GetAttributeValues(key)\n}", "func sortedKeys(v any) []any {\n\tkeys := reflect.ValueOf(v).MapKeys()\n\tsort.Slice(keys, func(i, j int) bool {\n\t\ta := keys[i].Convert(u32).Interface().(uint32)\n\t\tb := keys[j].Convert(u32).Interface().(uint32)\n\t\treturn a < b\n\t})\n\tvals := make([]any, len(keys))\n\tfor i, key := range keys {\n\t\tvals[i] = key.Interface()\n\t}\n\treturn vals\n}", "func (c EntityObject) Attributes() map[string]interface{} {\n\treturn c.attributes\n}", "func stringKeys(m map[string]interface{}) []string {\n\tvar ss []string\n\tfor k := range m {\n\t\tss = append(ss, k)\n\t}\n\treturn ss\n}", "func (NotebookInstanceSortKey) Values() []NotebookInstanceSortKey {\n\treturn []NotebookInstanceSortKey{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t\t\"Status\",\n\t}\n}", "func BuiltInSlotTypeSortAttribute_Values() []string {\n\treturn []string{\n\t\tBuiltInSlotTypeSortAttributeSlotTypeSignature,\n\t}\n}", "func (data *Data) Interface(s ...string) interface{} {\n\tx := *data\n\tvar y interface{}\n\n\tfor _, i := range s {\n\n\t\tif _, ok := x[i]; ok == false {\n\t\t\treturn nil\n\t\t}\n\n\t\tswitch x[i].(type) {\n\t\tdefault:\n\t\t\ty = x[i].(interface{})\n\n\t\tcase map[string]interface{}:\n\t\t\tx = x[i].(map[string]interface{})\n\t\t}\n\t}\n\treturn y\n}", "func (ResourceCatalogSortBy) Values() []ResourceCatalogSortBy {\n\treturn []ResourceCatalogSortBy{\n\t\t\"CreationTime\",\n\t}\n}", "func (SortTrialComponentsBy) Values() []SortTrialComponentsBy {\n\treturn []SortTrialComponentsBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t}\n}", "func (jbobject *ServicesEc2ModelImageAttributeName) Values() []*ServicesEc2ModelImageAttributeName {\n\tjret, err := javabind.GetEnv().CallStaticMethod(\"com/amazonaws/services/ec2/model/ImageAttributeName\", \"values\", javabind.ObjectArrayType(\"com/amazonaws/services/ec2/model/ImageAttributeName\"))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tretconv := javabind.NewJavaToGoObjectArray(javabind.NewJavaToGoCallable(), \"com/amazonaws/services/ec2/model/ImageAttributeName\")\n\tdst := new([]*ServicesEc2ModelImageAttributeName)\n\tretconv.Dest(dst)\n\tif err := retconv.Convert(javabind.ObjectRef(jret)); err != nil {\n\t\tpanic(err)\n\t}\n\tretconv.CleanUp()\n\treturn *dst\n}", "func (p *PersistableEvent) ToStringKeys() []string {\n\treturn []string{\"type\", \"nodeID\", \"fullNodeID\", \"amount\", \"time\", \"manaType\", \"transactionID\", \"inputID\"}\n}", "func GetAttributes(t reflect.Type) (attrs []AttributeDesc) {\n\tif t == nil {\n\t\treturn\n\t}\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tdfield := t.Field(i)\n\t\tattr := AttributeDesc{\n\t\t\tName: dfield.Name,\n\t\t\tIndex: i + 1,\n\t\t\tDesc: dfield.Tag.Get(\"description\"),\n\t\t\tKind: dfield.Tag.Get(\"kind\"),\n\t\t\tRelation: dfield.Tag.Get(\"ref\"),\n\t\t}\n\t\tattrs = append(attrs, attr)\n\t}\n\treturn\n}", "func (SortByEnum) Values() []SortByEnum {\n\treturn []SortByEnum{\n\t\t\"repositoryName\",\n\t\t\"lastModifiedDate\",\n\t}\n}", "func (FpgaImageAttributeName) Values() []FpgaImageAttributeName {\n\treturn []FpgaImageAttributeName{\n\t\t\"description\",\n\t\t\"name\",\n\t\t\"loadPermission\",\n\t\t\"productCodes\",\n\t}\n}", "func UniqueInterfaces(input []interface{}) []interface{} {\n\tkeys := make(map[interface{}]bool)\n\tlist := []interface{}{}\n\tfor _, entry := range input {\n\t\tif _, value := keys[entry]; !value {\n\t\t\tkeys[entry] = true\n\t\t\tlist = append(list, entry)\n\t\t}\n\t}\n\treturn list\n}", "func (SortTrialsBy) Values() []SortTrialsBy {\n\treturn []SortTrialsBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t}\n}", "func (ModelPackageGroupSortBy) Values() []ModelPackageGroupSortBy {\n\treturn []ModelPackageGroupSortBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t}\n}", "func makeAttributes(tags map[string]interface{}) (map[string]pdata.AttributeValue, error) {\n\tm := make(map[string]pdata.AttributeValue, len(tags))\n\t// todo: attribute val as array?\n\tfor k, v := range tags {\n\t\tswitch val := v.(type) {\n\t\tcase int64:\n\t\t\tm[k] = pdata.NewAttributeValueInt(val)\n\t\tcase bool:\n\t\t\tm[k] = pdata.NewAttributeValueBool(val)\n\t\tcase string:\n\t\t\tm[k] = pdata.NewAttributeValueString(val)\n\t\tcase float64:\n\t\t\tm[k] = pdata.NewAttributeValueDouble(val)\n\t\tcase []byte:\n\t\t\tm[k] = pdata.NewAttributeValueBytes(val)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unknown tag type %T\", v)\n\t\t}\n\t}\n\treturn m, nil\n}", "func (*ObjectType) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // name\n\t\t&sql.NullString{}, // kind\n\t\t&sql.NullString{}, // description\n\t}\n}", "func (SortArtifactsBy) Values() []SortArtifactsBy {\n\treturn []SortArtifactsBy{\n\t\t\"CreationTime\",\n\t}\n}", "func (SnapshotAttributeName) Values() []SnapshotAttributeName {\n\treturn []SnapshotAttributeName{\n\t\t\"productCodes\",\n\t\t\"createVolumePermission\",\n\t}\n}", "func keysFromValue(v reflect.Value) ([]state.Key, error) {\n\tvar keys []state.Key\n\n\tswitch v.Type().String() {\n\tcase `[]string`:\n\t\tfor i := 0; i < v.Len(); i++ {\n\t\t\tkeys = append(keys, state.Key{v.Index(i).String()})\n\t\t}\n\n\tdefault:\n\t\treturn nil, ErrFieldTypeNotSupportedForKeyExtraction\n\t}\n\n\treturn keys, nil\n}", "func GetChildrenMap(input interface{}) []Child {\n\tvalueOf := GetBaseValue(input)\n\n\tvar children []Child\n\tchildren = make([]Child, 0)\n\n\tfor _, key := range valueOf.MapKeys() {\n\t\tvalue := valueOf.MapIndex(key)\n\t\tkind := value.Kind()\n\n\t\tname := Value2String(key)\n\t\tchildren = append(children, Child{Name: name, Value: value.Interface(), Kind: kind})\n\t}\n\treturn children\n}", "func (ImageAttributeName) Values() []ImageAttributeName {\n\treturn []ImageAttributeName{\n\t\t\"description\",\n\t\t\"kernel\",\n\t\t\"ramdisk\",\n\t\t\"launchPermission\",\n\t\t\"productCodes\",\n\t\t\"blockDeviceMapping\",\n\t\t\"sriovNetSupport\",\n\t\t\"bootMode\",\n\t\t\"tpmSupport\",\n\t\t\"uefiData\",\n\t\t\"lastLaunchedTime\",\n\t\t\"imdsSupport\",\n\t}\n}", "func (o *IscsiInterfaceGetIterResponseResultAttributesList) values() []IscsiInterfaceListEntryInfoType {\n\tr := o.IscsiInterfaceListEntryInfoPtr\n\treturn r\n}", "func GetAttrs(obj runtime.Object) (labels.Set, fields.Set, error) {\n\tsecret, ok := obj.(*api.Secret)\n\tif !ok {\n\t\treturn nil, nil, fmt.Errorf(\"not a secret\")\n\t}\n\treturn labels.Set(secret.Labels), SelectableFields(secret), nil\n}", "func (is *IfaceStat) GetTags() []string {\n\tvar tags []string\n\tvalueMap := structs.Map(is)\n\tfor k := range valueMap {\n\t\ttags = append(tags, k)\n\t}\n\n\treturn tags\n}", "func (self *Map) Keys(tagName ...string) []interface{} {\n\treturn Keys(self.MapNative(tagName...))\n}", "func (AppImageConfigSortKey) Values() []AppImageConfigSortKey {\n\treturn []AppImageConfigSortKey{\n\t\t\"CreationTime\",\n\t\t\"LastModifiedTime\",\n\t\t\"Name\",\n\t}\n}", "func (i StringHashMap[T, V]) Items() []struct {\n\tKey T\n\tVal V\n} {\n\tresult := make([]struct {\n\t\tKey T\n\t\tVal V\n\t}, 0, len(i.hashToKey))\n\tfor hash, key := range i.hashToKey {\n\t\tval := i.hashToVal[hash]\n\t\tresult = append(result, struct {\n\t\t\tKey T\n\t\t\tVal V\n\t\t}{key, val})\n\t}\n\treturn result\n}", "func SlotSortAttribute_Values() []string {\n\treturn []string{\n\t\tSlotSortAttributeSlotName,\n\t\tSlotSortAttributeLastUpdatedDateTime,\n\t}\n}", "func ToMap(i interface{}) (map[string]interface{}, error) {\n\tvar stringInterfaceMap map[string]interface{}\n\titr, _ := bson.Marshal(i)\n\terr := bson.Unmarshal(itr, &stringInterfaceMap)\n\treturn stringInterfaceMap, err\n}", "func JSONSliceOfInterfaceToSliceOfMaps(input []any) ([]map[any]any, error) {\n\toutputMap := make([]map[any]any, 0)\n\tfor _, current := range input {\n\t\tdata, err := JSONToMapOfInterfaces(current.(string))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmap2 := map[any]any{}\n\n\t\tfor k, v := range data {\n\t\t\tmap2[k] = v\n\t\t}\n\n\t\toutputMap = append(outputMap, map2)\n\t}\n\treturn outputMap, nil\n}", "func GetAttrs(obj runtime.Object) (labels.Set, fields.Set, error) {\n\tserviceclass, ok := obj.(*servicecatalog.ServiceClass)\n\tif !ok {\n\t\treturn nil, nil, fmt.Errorf(\"given object is not a ServiceClass\")\n\t}\n\treturn labels.Set(serviceclass.ObjectMeta.Labels), ToSelectableFields(serviceclass), nil\n}", "func DecodeAttributes(attrs proto.Attributes) map[string]interface{} {\n\tfields := make(map[string]interface{})\n\tfor k, v := range attrs.Strings {\n\t\tfields[attrs.Words[k]] = attrs.Words[v]\n\t}\n\tfor k, v := range attrs.StringList {\n\t\tvals := make([]string, len(v.Items))\n\t\tfor i, val := range v.Items {\n\t\t\tvals[i] = attrs.Words[val]\n\t\t}\n\t\tfields[attrs.Words[k]] = vals\n\t}\n\tfor k, v := range attrs.Int64S {\n\t\tfields[attrs.Words[k]] = v\n\t}\n\tfor k, v := range attrs.Int64List {\n\t\tfields[attrs.Words[k]] = v.Items\n\t}\n\tfor k, v := range attrs.Doubles {\n\t\tfields[attrs.Words[k]] = v\n\t}\n\tfor k, v := range attrs.DoubleList {\n\t\tfields[attrs.Words[k]] = v.Items\n\t}\n\tfor k, v := range attrs.Bools {\n\t\tfields[attrs.Words[k]] = v\n\t}\n\tfor k, v := range attrs.BoolList {\n\t\tfields[attrs.Words[k]] = v.Items\n\t}\n\tfor k, v := range attrs.Timestamps {\n\t\tfields[attrs.Words[k]] = v\n\t}\n\tfor k, v := range attrs.TimestampList {\n\t\tfields[attrs.Words[k]] = v.Items\n\t}\n\tfor k, v := range attrs.Durations {\n\t\tfields[attrs.Words[k]] = v\n\t}\n\tfor k, v := range attrs.DurationList {\n\t\tfields[attrs.Words[k]] = v.Items\n\t}\n\tfor k, v := range attrs.Bytes {\n\t\tfields[attrs.Words[k]] = v\n\t}\n\tfor k, v := range attrs.Attributes {\n\t\tfields[attrs.Words[k]] = DecodeAttributes(v)\n\t}\n\n\treturn fields\n}", "func (SortBy) Values() []SortBy {\n\treturn []SortBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t\t\"Status\",\n\t}\n}", "func InterfaceToStringSlice(i interface{}) []string {\n\tstringSlice := []string{}\n\tfor _, v := range i.([]interface{}) {\n\t\tstringSlice = append(stringSlice, v.(string))\n\t}\n\treturn stringSlice\n}", "func (r *GetAttrsResult) String() map[string]string {\n\tif r.attrs == nil {\n\t\treturn nil\n\t}\n\tattrs := make(map[string]string, len(r.attrs))\n\tfor _, attr := range r.attrs {\n\t\tkey := string(attr.key)\n\t\tif string(attr.key[len(attr.key)-1]) == string(\"\\u0000\") {\n\t\t\tkey = string(attr.key[:len(attr.key)-1])\n\t\t}\n\t\tval := string(attr.val)\n\t\tif key == \"expire\" || key == \"mtime\" {\n\t\t\tif unixTime, err := getUnixTime(attr.val); err == nil {\n\t\t\t\tval = strconv.FormatUint(unixTime, 10)\n\t\t\t}\n\t\t}\n\t\tattrs[key] = val\n\t}\n\treturn attrs\n}", "func (e *Extractor) ValuesFromTag(tag string) (out []interface{}, err error) {\n\n\tif err := e.isValidStruct(); err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := reflect.ValueOf(e.StructAddr).Elem()\n\tfields := e.fields(s)\n\n\tfor _, field := range fields {\n\t\tif val, ok := field.tags.Lookup(tag); ok {\n\t\t\tif _, omit := e.parseOmitempty(val, field.value); omit {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tout = append(out, field.value.Interface())\n\t\t}\n\t}\n\n\treturn\n}", "func (AlgorithmSortBy) Values() []AlgorithmSortBy {\n\treturn []AlgorithmSortBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t}\n}", "func getKeys(data map[string]interface{}) []string {\n\tvar list []string\n\tfor key := range data {\n\t\tlist = append(list, key)\n\t}\n\treturn list\n}", "func (NotebookInstanceLifecycleConfigSortKey) Values() []NotebookInstanceLifecycleConfigSortKey {\n\treturn []NotebookInstanceLifecycleConfigSortKey{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t\t\"LastModifiedTime\",\n\t}\n}", "func (v AnnotationValue) AsSlice() []AnnotationValue {\n\treturn v.Value.([]AnnotationValue)\n}", "func (SortActionsBy) Values() []SortActionsBy {\n\treturn []SortActionsBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t}\n}", "func (v AnnotationValue) AsMap() []AnnotationMapEntry {\n\treturn v.Value.([]AnnotationMapEntry)\n}", "func fieldNames(value interface{}) []ProcessClass {\n\tcountType := reflect.TypeOf(value)\n\tnames := make([]ProcessClass, 0, countType.NumField())\n\tfor index := 0; index < countType.NumField(); index++ {\n\t\ttag := strings.Split(countType.Field(index).Tag.Get(\"json\"), \",\")\n\t\tnames = append(names, ProcessClass(tag[0]))\n\t}\n\treturn names\n}", "func (*Category) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase category.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase category.FieldName, category.FieldDescription:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase category.FieldCreatedAt, category.FieldModifiedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Category\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "func ToI(slice interface{}) []interface{} {\n\ts := reflect.ValueOf(slice)\n\tif s.Kind() != reflect.Slice {\n\t\tpanic(\"ToInterface expects a slice type\")\n\t}\n\n\tret := make([]interface{}, s.Len())\n\n\tfor i := 0; i < s.Len(); i++ {\n\t\tret[i] = s.Index(i).Interface()\n\t}\n\treturn ret\n}", "func (SortExperimentsBy) Values() []SortExperimentsBy {\n\treturn []SortExperimentsBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t}\n}", "func Keys(a interface{}) interface{} {\n\tkeys := reflect.ValueOf(a).MapKeys()\n\ttyp := reflect.TypeOf(a).Key()\n\n\t// Create result slice.\n\tresultValue := reflect.MakeSlice(reflect.SliceOf(typ),\n\t\tlen(keys), len(keys))\n\tfor i := range keys {\n\t\tresultValue.Index(i).Set(keys[i])\n\t}\n\tresult := resultValue.Interface()\n\tsortSlice(result) // Sort result, for consistency.\n\treturn result\n}", "func (i *Identity) GetAttributeNames() ([]string, error) {\n\treturn nil, errors.New(\"NotImplemented\")\n}", "func Valueize(values ...reflect.Value) []reflect.Value {\n\treturn values\n}" ]
[ "0.53901917", "0.527543", "0.5258148", "0.51660067", "0.51634353", "0.51448506", "0.5136107", "0.51138806", "0.5065162", "0.50453967", "0.50142014", "0.50008076", "0.4989892", "0.4953383", "0.49406418", "0.49164325", "0.49099028", "0.48897067", "0.4877051", "0.48768914", "0.48722404", "0.48693573", "0.48576903", "0.48365712", "0.4827977", "0.48058656", "0.48043036", "0.47978228", "0.47910786", "0.4786921", "0.4757716", "0.47487903", "0.4740558", "0.47350156", "0.47269964", "0.47231212", "0.47231212", "0.47164768", "0.47100338", "0.4700809", "0.46860188", "0.46679467", "0.46303555", "0.46248418", "0.45972174", "0.45929196", "0.45916572", "0.45901787", "0.45847803", "0.45824495", "0.45818266", "0.4560168", "0.4554113", "0.45512795", "0.45487294", "0.4547034", "0.4542526", "0.45393562", "0.45359802", "0.4534452", "0.45338312", "0.45336327", "0.45308122", "0.45286208", "0.4522792", "0.4516596", "0.4513245", "0.45070451", "0.4506106", "0.44785124", "0.44783545", "0.4477002", "0.4471538", "0.44705957", "0.4464603", "0.44627875", "0.44552037", "0.44541842", "0.4453629", "0.44396082", "0.44382864", "0.44322976", "0.44315", "0.44312608", "0.4422939", "0.44112816", "0.44085696", "0.44010633", "0.43958524", "0.43894655", "0.43815917", "0.437775", "0.43761095", "0.43680707", "0.4365434", "0.43633047", "0.43597937", "0.43589076", "0.43580395", "0.4351673" ]
0.45692024
51
/ The constructor returns a NewObjectNames with the an operand cast to a Function as the FunctionConstructor.
func (this *ObjectNames) Constructor() FunctionConstructor { return func(operands ...Expression) Function { return NewObjectNames(operands[0]) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (this *ObjectAdd) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectAdd(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *StrToZoneName) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToZoneName(operands[0], operands[1])\n\t}\n}", "func (this *DateAddStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateAddStr(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectRemove) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectRemove(operands[0], operands[1])\n\t}\n}", "func NewObjectNames(operand Expression) Function {\n\trv := &ObjectNames{\n\t\t*NewUnaryFunctionBase(\"object_names\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectNames(operand Expression) Function {\n\trv := &ObjectNames{\n\t\t*NewUnaryFunctionBase(\"object_names\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func (this *DateDiffStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateDiffStr(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectValues(operands[0])\n\t}\n}", "func (this *ObjectValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectValues(operands[0])\n\t}\n}", "func (this *ObjectUnwrap) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectUnwrap(operands[0])\n\t}\n}", "func (this *DatePartStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDatePartStr(operands[0], operands[1])\n\t}\n}", "func (this *ObjectPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPairs(operands[0])\n\t}\n}", "func (this *ObjectPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPairs(operands[0])\n\t}\n}", "func NewConstructor(x interface{}) (*Constructor, error) {\n\tif x == nil {\n\t\treturn nil, kerror.New(kerror.EViolation, \"function expected, nil given\")\n\t}\n\tft := reflect.TypeOf(x)\n\tfv := reflect.ValueOf(x)\n\tif ft.Kind() != reflect.Func {\n\t\treturn nil, kerror.Newf(kerror.EViolation, \"function expected, %s given\", ft)\n\t}\n\tif fv.IsNil() {\n\t\treturn nil, kerror.New(kerror.EViolation, \"function expected, nil given\")\n\t}\n\tc := &Constructor{\n\t\tfunction: fv,\n\t}\n\tnumIn := ft.NumIn()\n\tif ft.IsVariadic() {\n\t\tnumIn--\n\t}\n\tc.inTypes = make([]reflect.Type, numIn)\n\tfor i := 0; i < numIn; i++ {\n\t\tc.inTypes[i] = ft.In(i)\n\t}\n\tswitch ft.NumOut() {\n\tdefault:\n\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\tcase 1:\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = -1\n\t\tc.errorOutIndex = -1\n\tcase 2:\n\t\tif ft.Out(1) != errorType {\n\t\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\t\t}\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = -1\n\t\tc.errorOutIndex = 1\n\tcase 3:\n\t\tif ft.Out(1) != destructorType || ft.Out(2) != errorType {\n\t\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\t\t}\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = 1\n\t\tc.errorOutIndex = 2\n\t}\n\treturn c, nil\n}", "func (this *DateAddMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateAddMillis(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectLength) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectLength(operands[0])\n\t}\n}", "func (this *ObjectLength) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectLength(operands[0])\n\t}\n}", "func (this *StrToMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToMillis(operands[0])\n\t}\n}", "func (this *NowStr) Constructor() FunctionConstructor { return NewNowStr }", "func (this *ObjectPut) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPut(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectInnerValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectInnerValues(operands[0])\n\t}\n}", "func (this *DateDiffMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateDiffMillis(operands[0], operands[1], operands[2])\n\t}\n}", "func Function(args ...Type) *Operator {\n\treturn &Operator{functionName, args}\n}", "func (this *MillisToZoneName) Constructor() FunctionConstructor { return NewMillisToZoneName }", "func (this *ObjectInnerPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectInnerPairs(operands[0])\n\t}\n}", "func (this *MillisToStr) Constructor() FunctionConstructor { return NewMillisToStr }", "func (this *NowMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function { return _NOW_MILLIS }\n}", "func (this *StrToUTC) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToUTC(operands[0])\n\t}\n}", "func (this *Mod) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewMod(operands[0], operands[1])\n\t}\n}", "func (this *DateTruncStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateTruncStr(operands[0], operands[1])\n\t}\n}", "func (this *DatePartMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDatePartMillis(operands[0], operands[1])\n\t}\n}", "func (this *Element) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewElement(operands[0], operands[1])\n\t}\n}", "func (this *Not) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewNot(operands[0])\n\t}\n}", "func (this *ClockMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function { return _CLOCK_MILLIS }\n}", "func NewFunc(name string, typ Type) *Func {\n\treturn &Func{object: object{scope: nil, name: name, typ: typ}}\n}", "func tcNew(n *ir.UnaryExpr) ir.Node {\n\tif n.X == nil {\n\t\t// Fatalf because the OCALL above checked for us,\n\t\t// so this must be an internally-generated mistake.\n\t\tbase.Fatalf(\"missing argument to new\")\n\t}\n\tl := n.X\n\tl = typecheck(l, ctxType)\n\tt := l.Type()\n\tif t == nil {\n\t\tn.SetType(nil)\n\t\treturn n\n\t}\n\tn.X = l\n\tn.SetType(types.NewPtr(t))\n\treturn n\n}", "func (object *Object) GenerateConstructor(suffix string) string {\n\tobjectType := object.getType(suffix)\n\tcode := fmt.Sprintf(\n\t\t\"func Make%s() %s {\\n\\treturn &%s{\\n\",\n\t\tobjectType,\n\t\tobject.Type(suffix),\n\t\tobjectType,\n\t)\n\n\tproperties := object.properties.ToArray()\n\tfor _, property := range properties {\n\t\tpropertyCode := property.(*Property).GenerateConstructor(suffix)\n\t\tif propertyCode != \"\" {\n\t\t\tcode += fmt.Sprintf(\n\t\t\t\t\"\\t\\t%s,\\n\",\n\t\t\t\tpropertyCode,\n\t\t\t)\n\t\t}\n\t}\n\treturn code + \"\\t}\\n}\\n\"\n}", "func (this *DateTruncMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateTruncMillis(operands[0], operands[1])\n\t}\n}", "func (this *ClockStr) Constructor() FunctionConstructor { return NewClockStr }", "func NewFunction(ifunc IFunction, name string) IQueryField {\n\treturn &SFunctionFieldBase{\n\t\tIFunction: ifunc,\n\t\talias: name,\n\t}\n}", "func (c *Constructor) Create(a ...reflect.Value) (reflect.Value, kdone.Destructor, error) {\n\tif c == nil {\n\t\treturn reflect.Value{}, kdone.Noop, nil\n\t}\n\tif len(a) != len(c.inTypes) {\n\t\treturn reflect.Value{}, nil, kerror.Newf(kerror.EViolation,\n\t\t\t\"%s constructor expects %d argument(s), %d given\",\n\t\t\tc.t, len(c.inTypes), len(a))\n\t}\n\tfor i, v := range a {\n\t\tif v.Type() != c.inTypes[i] {\n\t\t\treturn reflect.Value{}, nil, kerror.Newf(kerror.EViolation,\n\t\t\t\t\"%s constructor expects argument %d to be of %s type, %s given\",\n\t\t\t\tc.t, i+1, c.inTypes[i], v.Type())\n\t\t}\n\t}\n\tout := c.function.Call(a)\n\tobj := out[c.objectOutIndex]\n\tvar dtor kdone.Destructor = kdone.Noop\n\tif c.destructorOutIndex >= 0 {\n\t\tif v := out[c.destructorOutIndex].Interface(); v != nil {\n\t\t\tdtor = v.(kdone.Destructor)\n\t\t}\n\t}\n\tvar err error\n\tif c.errorOutIndex >= 0 {\n\t\tif v := out[c.errorOutIndex].Interface(); v != nil {\n\t\t\terr = v.(error)\n\t\t}\n\t}\n\treturn obj, dtor, err\n}", "func TermConstructor(t TermT) TermConstructorT {\n\treturn TermConstructorT(C.yices_term_constructor(C.term_t(t)))\n}", "func NewFunction(name, cname, comment, member string, typ Type) *Function {\n\tfunctionName := UpperFirstCharacter(name)\n\treceiverType := TrimLanguagePrefix(cname)\n\treceiverName := CommonReceiverName(receiverType)\n\n\tf := &Function{\n\t\tIncludeFiles: NewIncludeFiles(),\n\t\tName: functionName,\n\t\tCName: cname,\n\t\tComment: comment,\n\t\tParameters: []FunctionParameter{ // TODO(go-clang): this might not be needed if the receiver code is refactored: https://github.com/go-clang/gen/issues/52\n\t\t\t{\n\t\t\t\tName: receiverName,\n\t\t\t\tCName: cname,\n\t\t\t\tType: Type{\n\t\t\t\t\tGoName: receiverType,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tReturnType: typ,\n\t\tReceiver: Receiver{\n\t\t\tName: receiverName,\n\t\t\tType: Type{\n\t\t\t\tGoName: receiverType,\n\t\t\t},\n\t\t},\n\t\tMember: &FunctionParameter{\n\t\t\tName: member,\n\t\t\tType: typ,\n\t\t},\n\t}\n\n\treturn f\n}", "func NewFunction(retType types.WaccType, ident *Ident, params ParamList,\n\tstats Statement, pos errors.Position) *Function {\n\tfn := &Function{\n\t\tretType: retType,\n\t\tident: ident,\n\t\tparams: params,\n\t\tpos: pos,\n\t}\n\tswitch st := stats.(type) {\n\tcase StatMultiple:\n\t\tfn.stats = st\n\tdefault:\n\t\tfn.stats = StatMultiple{st}\n\t}\n\treturn fn\n}", "func New(spec *Spec) Function {\n\tf := Function{\n\t\tspec: spec,\n\t}\n\treturn f\n}", "func NewOperators(ops ...*Symbol) *Operators {\n\t// Construct the root\n\troot := &Operators{children: map[rune]*Operators{}}\n\n\t// Add each of the symbols to it\n\tfor _, op := range ops {\n\t\troot.Add(op)\n\t}\n\n\treturn root\n}", "func execNewNamed(_ int, p *gop.Context) {\n\targs := p.GetArgs(3)\n\tret := types.NewNamed(args[0].(*types.TypeName), args[1].(types.Type), args[2].([]*types.Func))\n\tp.Ret(3, ret)\n}", "func NewFunction(ctx sctx.Context, funcName string, retType *types.FieldType, args ...Expression) (Expression, error) {\n\treturn newFunctionImpl(ctx, true, funcName, retType, args...)\n}", "func New() *Compiler {\n\tmainScope := CompilationScope{\n\t\tinstructions: code.Instructions{},\n\t\tlastInstruction: EmittedInstruction{},\n\t\tpreviousInstruction: EmittedInstruction{},\n\t}\n\ttable := NewSymbolTable()\n\tfor i, fn := range object.GetBuiltins() {\n\t\ttable.DefineBuiltin(i, fn.Name)\n\t}\n\treturn &Compiler{\n\t\tconstants: []object.Object{},\n\t\tscopes: []CompilationScope{mainScope},\n\t\tscopeIndex: 0,\n\t\tsymbolTable: table,\n\t}\n}", "func NewFunction(name string, typ semantic.Type, call func(args Object) (Value, error), sideEffect bool) Function {\n\treturn &function{\n\t\tname: name,\n\t\tt: typ,\n\t\tcall: call,\n\t\thasSideEffect: sideEffect,\n\t}\n}", "func execNewFunc(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\tret := types.NewFunc(token.Pos(args[0].(int)), args[1].(*types.Package), args[2].(string), args[3].(*types.Signature))\n\tp.Ret(4, ret)\n}", "func NewFunctionCall(name string, params []Expression, returnType Type) Expression {\n\treturn &functionCall{\n\t\tname: name,\n\t\tparams: params,\n\t\treturnType: returnType,\n\t}\n}", "func generateGoPrimitiveTypesNewFuncs() ([]byte, error) {\n\tb := bytes.NewBufferString(`\nfunc newString(s string) *string {\n\treturn &s\n}\n\nfunc newInt(i int) *int {\n\treturn &i\n}\n\nfunc newFloat(f float64) *float64 {\n\treturn &f\n}\n\nfunc newBool(b bool) *bool {\n\treturn &b\n}\n\t`)\n\n\treturn format.Source(b.Bytes())\n}", "func newFunction(p *Package, fl *File, f *ast.FuncDecl) *Function {\n\tres := &Function{\n\t\tpkg: p,\n\t\tfile: fl,\n\t\tfn: f,\n\t\tname: nameFromIdent(f.Name),\n\t\tdef: getFunc(p, fl, f.Type).(*FuncType),\n\t}\n\n\tif res.fn.Recv != nil {\n\t\tn := \"\"\n\t\tif res.fn.Recv.List[0].Names != nil {\n\t\t\tn = nameFromIdent(res.fn.Recv.List[0].Names[0])\n\t\t}\n\t\tres.receiver = newVariableFromExpr(res.pkg, res.file, n, res.fn.Recv.List[0].Type)\n\t\tvar def Definition\n\t\tvar def2 *StarType\n\t\tdef = res.receiver.def\n\t\tdef2, res.receiverPointer = def.(*StarType)\n\t\tif res.receiverPointer {\n\t\t\tdef = def2.Target()\n\t\t}\n\t\tres.receiverClass = def.String()\n\t}\n\treturn res\n}", "func NewFunctionCall(name string) *FunctionCall {\n\tfc := new(FunctionCall)\n\tfc.addr = C.LookupSymAddr(C.CString(name))\n\treturn fc\n}", "func ClosureNew(f interface{}) *C.GClosure {\n\tclosure := C._g_closure_new()\n\tclosures.Lock()\n\tclosures.m[closure] = reflect.ValueOf(f)\n\tclosures.Unlock()\n\treturn closure\n}", "func NewFunctionCall(name string, context string, args ...interface{}) FunctionCall {\n\treturn FunctionCall{name, context, args}\n}", "func newFuncExpr(funcName FuncName, funcs ...Expr) (*funcExpr, error) {\n\tswitch funcName {\n\tcase Avg, Max, Min, Sum:\n\t\tif len(funcs) != 1 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly one argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errParseNonUnaryAgregateFunctionCall(err)\n\t\t}\n\n\t\tif !funcs[0].ReturnType().isNumberKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument %v evaluate to %v, not number\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase Count:\n\t\tif len(funcs) != 1 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly one argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errParseNonUnaryAgregateFunctionCall(err)\n\t\t}\n\n\t\tswitch funcs[0].ReturnType() {\n\t\tcase Null, Bool, Int, Float, String, Timestamp, column, record:\n\t\tdefault:\n\t\t\terr := fmt.Errorf(\"%v(): argument %v evaluate to %v is incompatible\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase CharLength, CharacterLength, Trim, Lower, Upper, ToTimestamp:\n\t\tif len(funcs) != 1 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly one argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\tif !funcs[0].ReturnType().isStringKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument %v evaluate to %v, not string\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase Coalesce:\n\t\tif len(funcs) < 1 {\n\t\t\terr := fmt.Errorf(\"%v(): one or more argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\tfor i := range funcs {\n\t\t\tif !funcs[i].ReturnType().isBaseKind() {\n\t\t\t\terr := fmt.Errorf(\"%v(): argument-%v %v evaluate to %v is incompatible\", funcName, i+1, funcs[i], funcs[i].ReturnType())\n\t\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t\t}\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase NullIf:\n\t\tif len(funcs) != 2 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly two arguments expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\tif !funcs[0].ReturnType().isBaseKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument-1 %v evaluate to %v is incompatible\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\tif !funcs[1].ReturnType().isBaseKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument-2 %v evaluate to %v is incompatible\", funcName, funcs[1], funcs[1].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase UTCNow:\n\t\tif len(funcs) != 0 {\n\t\t\terr := fmt.Errorf(\"%v(): no argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase Substring:\n\t\tif len(funcs) < 2 || len(funcs) > 3 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly two or three arguments expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\tif !funcs[0].ReturnType().isStringKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument-1 %v evaluate to %v, not string\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\tif !funcs[1].ReturnType().isIntKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument-2 %v evaluate to %v, not int\", funcName, funcs[1], funcs[1].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\tif len(funcs) > 2 {\n\t\t\tif !funcs[2].ReturnType().isIntKind() {\n\t\t\t\terr := fmt.Errorf(\"%v(): argument-3 %v evaluate to %v, not int\", funcName, funcs[2], funcs[2].ReturnType())\n\t\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t\t}\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\t}\n\n\treturn nil, errUnsupportedFunction(fmt.Errorf(\"unknown function name %v\", funcName))\n}", "func NewFunction0(name string, sqlType Type, logic EvalLogic) Function0 {\n\tfn := func() Expression {\n\t\treturn NoArgFunc{name, sqlType, logic}\n\t}\n\n\treturn Function0{Name: name, Fn: fn}\n}", "func NewLiteral(value Object) Expression {\n\treturn &literal{value: value}\n}", "func NewFunction(config *truce.HTTP, function truce.Function) (*Function, error) {\n\tif function.Transports.HTTP == nil {\n\t\treturn nil, nil\n\t}\n\n\ttransport := *function.Transports.HTTP\n\n\tb := &Function{\n\t\tDefinition: function,\n\t\tQuery: map[string]QueryParam{},\n\t}\n\n\ttype argument struct {\n\t\tvariable string\n\t\tposVariable string\n\t\ttyp string\n\t}\n\n\tvar (\n\t\tpathMappings = map[string]string{}\n\t\targs = map[string]argument{}\n\t)\n\n\tfor i, field := range function.Arguments {\n\t\targs[field.Name] = argument{\n\t\t\ttyp: string(field.Type),\n\t\t\tposVariable: fmt.Sprintf(\"v%d\", i),\n\t\t\tvariable: field.Name,\n\t\t}\n\t}\n\n\tif function.Return.Present && function.Return.Name != \"\" {\n\t\tb.HasReturn = true\n\t\tb.ReturnType = string(function.Return.Type)\n\n\t\tif len(b.ReturnType) < 1 {\n\t\t\treturn nil, errors.New(\"return type cannot be empty\")\n\t\t}\n\n\t\tif b.ReturnType[0] == '*' {\n\t\t\tb.ReturnType = b.ReturnType[1:]\n\t\t\tb.ReturnIsPtr = true\n\t\t}\n\t}\n\n\tb.Method = transport.Method\n\n\t// Sort the arguments by name for consistent positional ordering.\n\tvar argVals []truce.ArgumentValue\n\tfor _, arg := range transport.Arguments {\n\t\targVals = append(argVals, arg)\n\t}\n\tsort.Slice(argVals, func(i, j int) bool {\n\t\treturn argVals[i].Name < argVals[j].Name\n\t})\n\n\tvar qpos int\n\tfor _, arg := range argVals {\n\t\ta, ok := args[arg.Name]\n\n\t\tswitch arg.From {\n\t\tcase \"body\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tb.BodyVar = a.posVariable\n\t\t\tb.BodyType = a.typ\n\t\tcase \"path\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpathMappings[arg.Var] = args[arg.Name].variable\n\t\tcase \"query\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tb.Query[arg.Var] = QueryParam{\n\t\t\t\tPos: qpos,\n\t\t\t\tQueryVar: arg.Var,\n\t\t\t\tGoVar: a.posVariable,\n\t\t\t\tType: a.typ,\n\t\t\t}\n\n\t\t\tqpos++\n\t\tcase \"static\":\n\t\t\t// TODO(georgemac)\n\t\t}\n\t}\n\n\tfor _, part := range strings.Split(config.Prefix, \"/\") {\n\t\tif part == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tb.Path = append(b.Path, Element{Type: \"static\", Value: part})\n\t}\n\n\tb.Path = append(b.Path, parsePath(pathMappings, transport.Path)...)\n\n\treturn b, nil\n}", "func (this *MillisToUTC) Constructor() FunctionConstructor { return NewMillisToUTC }", "func NewFuncs(ctx context.Context, enums []xo.Enum) *Funcs {\n\tdriver, _, _ := xo.DriverSchemaNthParam(ctx)\n\tenumMap := make(map[string]xo.Enum)\n\tif driver == \"mysql\" {\n\t\tfor _, e := range enums {\n\t\t\tenumMap[e.Name] = e\n\t\t}\n\t}\n\treturn &Funcs{\n\t\tdriver: driver,\n\t\tenumMap: enumMap,\n\t\tconstraint: Constraint(ctx),\n\t\tescCols: Esc(ctx, \"columns\"),\n\t\tescTypes: Esc(ctx, \"types\"),\n\t\tengine: Engine(ctx),\n\t}\n}", "func NewFunc(name string, nestDepth uint32) *FuncInfo {\n\tif name != \"\" {\n\t\treturn &FuncInfo{name: name}\n\t}\n\treturn &FuncInfo{closure: &printer.ReservedExpr{}}\n}", "func (f *Function) Type() ObjectType { return FUNCTION_OBJ }", "func NewLambda(vs []Argument, u bool, as []Argument, e Expression, t types.Type) Lambda {\n\treturn Lambda{as, e, t, vs, u}\n}", "func (f Function) New(ctx string) error {\n\treturn f.unsafeWrap(errors.New(ctx), ctx, \"\")\n}", "func Construct(ops ...AnsiCode) string {\n\tres := \"\\x1b[\"\n\tfor i, v := range ops {\n\t\tres += strconv.Itoa(int(v))\n\n\t\tif i != len(ops)-1 {\n\t\t\tres += \";\"\n\t\t}\n\t}\n\tres += \"m\"\n\n\treturn res\n}", "func (er *expressionRewriter) newFunction(funcName string, retType *types.FieldType, args ...expression.Expression) (expression.Expression, error) {\n\ttrace_util_0.Count(_expression_rewriter_00000, 275)\n\tif er.disableFoldCounter > 0 {\n\t\ttrace_util_0.Count(_expression_rewriter_00000, 277)\n\t\treturn expression.NewFunctionBase(er.ctx, funcName, retType, args...)\n\t}\n\ttrace_util_0.Count(_expression_rewriter_00000, 276)\n\treturn expression.NewFunction(er.ctx, funcName, retType, args...)\n}", "func (s *Prototype) Constructor() Value { return s.constructor }", "func (s StorageType) Constructor(optionalLiteralArgs string) string {\n\n\targs := \"\"\n\n\tswitch s {\n\tcase StorageFilesystem:\n\t\targs = \"\\\"games/\\\"\"\n\tcase StorageBolt:\n\t\targs = \"\\\".database\\\"\"\n\tcase StorageMysql:\n\t\targs = \"false\"\n\t}\n\n\tif optionalLiteralArgs != \"\" {\n\t\targs = optionalLiteralArgs\n\t}\n\n\treturn s.String() + \".NewStorageManager(\" + args + \")\"\n\n}", "func newInstance0(frame *rtda.Frame) {\n\tvars := frame.LocalVars()\n\tconstructorObj := vars.GetRef(0)\n\targArrObj := vars.GetRef(1)\n\n\tgoConstructor := getExtra(constructorObj)\n\tgoClass := goConstructor.Class()\n\tobj := goClass.NewObj()\n\tstack := frame.OperandStack()\n\tstack.PushRef(obj)\n\n\t// call <init>\n\targs := actualConstructorArgs(obj, argArrObj, goConstructor)\n\tframe.Thread().InvokeMethodWithShim(goConstructor, args)\n}", "func NewFunctionCall(callee Expression, arguments []Expression, trailing *TrailingFunction, metadata *Metadata) *FunctionCall {\n\treturn &FunctionCall{callee, arguments, trailing, metadata}\n}", "func (sf *ScalarFunction) Clone() Expression {\n\tc := &ScalarFunction{\n\t\tFuncName: sf.FuncName,\n\t\tRetType: sf.RetType,\n\t\tFunction: sf.Function.Clone(),\n\t}\n\treturn c\n}", "func NewConstructor() *Constructor {\n\treturn &Constructor{}\n}", "func New(chainFunc ...interface{}) *Chain {\n\tc := &Chain{}\n\tc.Add(chainFunc...)\n\treturn c\n}", "func NewMeta(operands ...Expression) Function {\n\trv := &Meta{\n\t\t*NewFunctionBase(\"meta\", operands...),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func Constructor() MinStack {\n\treturn MinStack{atoms: []atom{}}\n}", "func Constructor() MyStack {\n\treturn MyStack{New(), New(), 1}\n}", "func NewObjectAdd(first, second, third Expression) Function {\n\trv := &ObjectAdd{\n\t\t*NewTernaryFunctionBase(\"object_add\", first, second, third),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewFunction(fnLit *ast.FunctionLiteral, env *Environment) *Function {\n\treturn &Function{\n\t\tParameters: fnLit.Parameters,\n\t\tBody: fnLit.Body,\n\t\tEnv: env,\n\t}\n}", "func NewOperator(kind string, in, out reflect.Type, f func(ctx context.Context, field string, object interface{}) (interface{}, error)) Operator {\n\treturn &operator{\n\t\tkind: kind,\n\t\tin: in,\n\t\tout: out,\n\t\tf: f,\n\t}\n}", "func (e *exprHelper) NewCall(function string, args ...ast.Expr) ast.Expr {\n\treturn e.exprFactory.NewCall(e.nextMacroID(), function, args...)\n}", "func NewObject(t ...[2]*Term) Object {\n\tobj := newobject(len(t))\n\tfor i := range t {\n\t\tobj.Insert(t[i][0], t[i][1])\n\t}\n\treturn obj\n}", "func NewFunction(ctx openedge.Context, cfg FunctionInfo) *Function {\n\tf := &Function{\n\t\tcfg: cfg,\n\t\tctx: ctx,\n\t\tids: make(chan string, cfg.Instance.Max),\n\t\tlog: logger.WithField(\"function\", cfg.Name),\n\t}\n\tfor index := 1; index <= cfg.Instance.Max; index++ {\n\t\tf.ids <- fmt.Sprintf(\"f%d\", index)\n\t}\n\tpc := pool.NewDefaultPoolConfig()\n\tpc.MinIdle = cfg.Instance.Min\n\tpc.MaxIdle = cfg.Instance.Max\n\tpc.MaxTotal = cfg.Instance.Max\n\tpc.MinEvictableIdleTime = cfg.Instance.IdleTime\n\tpc.TimeBetweenEvictionRuns = cfg.Instance.EvictTime\n\tf.pool = pool.NewObjectPool(context.Background(), newFactory(f), pc)\n\treturn f\n}", "func new_(e interface{}) func() Event {\n\ttyp := reflect.TypeOf(e)\n\treturn func() Event {\n\t\treturn reflect.New(typ).Interface().(Event)\n\t}\n}", "func ListConstructor(context RunContext, arguments []Argument) Value {\n\tvalues := make([]Value, len(arguments))\n\tfor i, arg := range arguments {\n\t\tvar value = EvalArgument(context, arg)\n\n\t\t// accept blocks within a list\n\t\t// as dictionaries in order to support\n\t\t// [{...} {...} ...] constructions\n\t\t//\n\t\tif value.Type() == TypeBlock {\n\t\t\tvalue = NewDictionaryWithBlock(context, value.(Block))\n\t\t}\n\n\t\tvalues[i] = value\n\t}\n\treturn NewListValue(values)\n}", "func MakeFunc(regVars []args.Var, inputs ...interface{}) (*Function, error) {\n\tfunction := new(Function)\n\n\tfunction.regVars = regVars\n\tvar varNum = make(map[args.Var]int)\n\tvar numVars int\n\tvar tempOpsStack []string\n\tvar postfixStack []interface{}\n\tfor i, v := range regVars {\n\t\tif _, ok := varNum[v]; !ok {\n\t\t\tvarNum[v] = numVars\n\t\t\tnumVars++\n\t\t\tcontinue\n\t\t}\n\t\treturn nil, fmt.Errorf(\"Error registering variables. Variable at index %d, is a duplicate\", i)\n\n\t}\n\tvar inputType = make(map[int]args.Type)\n\tfor i, n := range inputs {\n\t\ttopIndexInPostfixStack := len(postfixStack) - 1\n\t\tswitch n.(type) {\n\t\tcase string:\n\t\t\toperation := n.(string)\n\t\t\tvar finishComparing bool\n\t\t\ttopIndexInTempOpsStack := len(tempOpsStack) - 1\n\t\t\tif len(tempOpsStack) == 0 ||\n\t\t\t\t(tempOpsStack[topIndexInTempOpsStack] == leftParen && operation != rightParen) {\n\t\t\t\ttempOpsStack = append(tempOpsStack, operation)\n\t\t\t} else if operation == leftParen {\n\t\t\t\ttempOpsStack = append(tempOpsStack, operation)\n\t\t\t} else if operation == rightParen {\n\t\t\t\tfor !finishComparing {\n\t\t\t\t\tif len(tempOpsStack) == 0 {\n\t\t\t\t\t\treturn nil, errors.New(\"Mismatch of Parentheses found\")\n\t\t\t\t\t}\n\t\t\t\t\ttopOperationInTempOpsStack := tempOpsStack[topIndexInTempOpsStack]\n\t\t\t\t\tif topOperationInTempOpsStack == leftParen {\n\t\t\t\t\t\ttempOpsStack = tempOpsStack[:topIndexInTempOpsStack]\n\t\t\t\t\t\tfinishComparing = true\n\t\t\t\t\t} else {\n\t\t\t\t\t\tinputType[topIndexInPostfixStack+1] = args.Operation\n\t\t\t\t\t\tpostfixStack, tempOpsStack = append(postfixStack, topOperationInTempOpsStack), tempOpsStack[:topIndexInTempOpsStack]\n\t\t\t\t\t}\n\t\t\t\t\ttopIndexInTempOpsStack = len(tempOpsStack) - 1\n\t\t\t\t\ttopIndexInPostfixStack = len(postfixStack) - 1\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttopOperationInTempOpsStack := tempOpsStack[topIndexInTempOpsStack]\n\t\t\t\tvar isPreviousUnary bool\n\t\t\t\tvar isUnary bool\n\t\t\t\tif _, ok := unaryFuncs[topOperationInTempOpsStack]; ok {\n\t\t\t\t\tisPreviousUnary = true\n\t\t\t\t}\n\t\t\t\tif _, ok := unaryFuncs[operation]; ok {\n\t\t\t\t\tisUnary = true\n\t\t\t\t}\n\t\t\t\tif isPreviousUnary || orderOfOperations[operation] < orderOfOperations[topOperationInTempOpsStack] {\n\t\t\t\t\tfor !finishComparing {\n\t\t\t\t\t\tif isUnary && isPreviousUnary {\n\t\t\t\t\t\t\ttempOpsStack = append(tempOpsStack, operation)\n\t\t\t\t\t\t\tfinishComparing = true\n\t\t\t\t\t\t} else if (topOperationInTempOpsStack == leftParen ||\n\t\t\t\t\t\t\torderOfOperations[operation] > orderOfOperations[topOperationInTempOpsStack] ||\n\t\t\t\t\t\t\tisUnary) &&\n\t\t\t\t\t\t\t!isPreviousUnary {\n\t\t\t\t\t\t\ttempOpsStack = append(tempOpsStack, operation)\n\t\t\t\t\t\t\tfinishComparing = true\n\t\t\t\t\t\t} else if orderOfOperations[operation] == orderOfOperations[topOperationInTempOpsStack] {\n\t\t\t\t\t\t\tif operation == pow {\n\t\t\t\t\t\t\t\ttempOpsStack = append(tempOpsStack, operation)\n\t\t\t\t\t\t\t\tfinishComparing = true\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tinputType[topIndexInPostfixStack+1] = args.Operation\n\t\t\t\t\t\t\t\tpostfixStack, tempOpsStack = append(postfixStack, topOperationInTempOpsStack), tempOpsStack[:topIndexInTempOpsStack]\n\t\t\t\t\t\t\t\ttopIndexInTempOpsStack = len(tempOpsStack) - 1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if orderOfOperations[operation] < orderOfOperations[topOperationInTempOpsStack] || isPreviousUnary {\n\t\t\t\t\t\t\tinputType[topIndexInPostfixStack+1] = args.Operation\n\t\t\t\t\t\t\tpostfixStack, tempOpsStack = append(postfixStack, topOperationInTempOpsStack), tempOpsStack[:topIndexInTempOpsStack]\n\t\t\t\t\t\t\ttopIndexInTempOpsStack = len(tempOpsStack) - 1\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif len(tempOpsStack) == 0 {\n\t\t\t\t\t\t\ttempOpsStack = append(tempOpsStack, operation)\n\t\t\t\t\t\t\tfinishComparing = true\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttopOperationInTempOpsStack = tempOpsStack[topIndexInTempOpsStack]\n\t\t\t\t\t\t\ttopIndexInPostfixStack = len(postfixStack) - 1\n\t\t\t\t\t\t\tif _, ok := unaryFuncs[topOperationInTempOpsStack]; !ok {\n\t\t\t\t\t\t\t\tisPreviousUnary = false\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} else if orderOfOperations[operation] > orderOfOperations[topOperationInTempOpsStack] {\n\t\t\t\t\ttempOpsStack = append(tempOpsStack, operation)\n\t\t\t\t} else if orderOfOperations[operation] == orderOfOperations[topOperationInTempOpsStack] {\n\t\t\t\t\tif operation == pow {\n\t\t\t\t\t\ttempOpsStack = append(tempOpsStack, operation)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tinputType[topIndexInPostfixStack+1] = args.Operation\n\t\t\t\t\t\tpostfixStack, tempOpsStack = append(postfixStack, topOperationInTempOpsStack), tempOpsStack[:topIndexInTempOpsStack]\n\t\t\t\t\t\ttempOpsStack = append(tempOpsStack, operation)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase int, int32, int64, float32, float64, complex64, complex128, gcv.Value, v.Vector, m.Matrix:\n\t\t\tpostfixStack = append(postfixStack, args.MakeConst(inputs[i]))\n\t\t\tinputType[topIndexInPostfixStack+1] = args.Constant\n\t\tcase args.Const:\n\t\t\tpostfixStack = append(postfixStack, n)\n\t\t\tinputType[topIndexInPostfixStack+1] = args.Constant\n\t\tcase args.Var:\n\t\t\tif _, ok := varNum[n.(args.Var)]; !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"Variable at index %d, was not registered\", i)\n\n\t\t\t}\n\t\t\tpostfixStack = append(postfixStack, n)\n\t\t\tinputType[topIndexInPostfixStack+1] = args.Variable\n\t\tdefault:\n\t\t\treturn nil, errors.New(\"Input type not supported\")\n\t\t}\n\t}\n\n\tfor len(tempOpsStack) > 0 {\n\t\ttopIndexInTempOpsStack := len(tempOpsStack) - 1\n\t\ttopIndexInPostfixStack := len(postfixStack) - 1\n\t\tvar operation string\n\t\toperation, tempOpsStack = tempOpsStack[topIndexInTempOpsStack], tempOpsStack[:topIndexInTempOpsStack]\n\t\tif operation == \"(\" {\n\t\t\treturn nil, errors.New(\"Mismatch of Parentheses found\")\n\t\t}\n\t\tinputType[topIndexInPostfixStack+1] = args.Operation\n\t\tpostfixStack = append(postfixStack, operation)\n\t}\n\n\tfunction.inputTypes = inputType\n\tfunction.numVars = numVars\n\tfunction.varNum = varNum\n\tfunction.Args = postfixStack\n\treturn function, nil\n}", "func NewSelf() Function {\n\trv := &Self{\n\t\t*NewNullaryFunctionBase(\"self\"),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewFunctions() Functions {\n\treturn dynaml.NewFunctions()\n}", "func NewFunctionBase(ctx sctx.Context, funcName string, retType *types.FieldType, args ...Expression) (Expression, error) {\n\treturn newFunctionImpl(ctx, false, funcName, retType, args...)\n}", "func NewCurry(fn interface{}) (*Curry, error) {\n\ttyp := reflect.TypeOf(fn)\n\n\tif typ.Kind() != reflect.Func {\n\t\treturn nil, fmt.Errorf(\"Handler is not a function!\")\n\t}\n\n\tc := &Curry{\n\t\tname: getFunctionName(fn),\n\t\tfnType: typ,\n\t\tfn: fn,\n\t}\n\n\treturn c, nil\n}", "func NewFunction(pkg, name string,\n\tparams, ret, block []jen.Code) *Function {\n\treturn &Function{\n\t\tqual: jen.Qual(pkg, name),\n\t\tname: name,\n\t\tparams: params,\n\t\tret: ret,\n\t\tblock: block,\n\t}\n}", "func Constructor() MapSum {\n\treturn MapSum{}\n}", "func (o *FakeObject) New(args ...interface{}) Object { return o.Invoke(args) }", "func NewConstructor() Constructor {\n\treturn func(ctx context.Context, cmw configmap.Watcher) *controller.Impl {\n\t\treturn NewController(ctx, cmw)\n\t}\n}", "func parseFuncDecl(bci *BenchClientInfo, decl *ast.FuncDecl) {\n\tif !strings.HasPrefix(decl.Name.String(), \"New\") {\n\t\treturn\n\t}\n\n\tfuncName := decl.Name.String()\n\tfor _, r := range decl.Type.Results.List {\n\t\tretName := types.ExprString(r.Type)\n\t\tif s, ok := bci.Services[retName]; ok {\n\t\t\t// s has already been added in parseGenDecl()\n\t\t\ts.Factory = funcName\n\t\t}\n\t}\n}", "func NewObjectLength(operand Expression) Function {\n\trv := &ObjectLength{\n\t\t*NewUnaryFunctionBase(\"object_length\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectLength(operand Expression) Function {\n\trv := &ObjectLength{\n\t\t*NewUnaryFunctionBase(\"object_length\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}" ]
[ "0.7036529", "0.6818059", "0.67975676", "0.6667405", "0.66347975", "0.66347975", "0.66178346", "0.65968144", "0.65968144", "0.65434146", "0.65172905", "0.6424325", "0.6424325", "0.641571", "0.63585794", "0.6329511", "0.6329511", "0.6309147", "0.6287411", "0.6280646", "0.6214294", "0.6196266", "0.6126052", "0.6097895", "0.6062177", "0.60584515", "0.60473454", "0.60315204", "0.6030186", "0.60016966", "0.6000327", "0.585112", "0.58025867", "0.5747753", "0.57385254", "0.5614321", "0.5601523", "0.5551406", "0.5546488", "0.55286205", "0.5491208", "0.54055727", "0.5379269", "0.5364316", "0.5355526", "0.53401476", "0.53310925", "0.53122747", "0.5296172", "0.52830225", "0.5273873", "0.52616894", "0.5257792", "0.5224439", "0.5186851", "0.5178486", "0.515678", "0.51486593", "0.5148182", "0.51481396", "0.5128279", "0.5124688", "0.5117706", "0.51036257", "0.5103022", "0.50986475", "0.50704956", "0.5061644", "0.5056158", "0.49909496", "0.4986926", "0.49712572", "0.49703315", "0.49675047", "0.49645776", "0.49492168", "0.49399224", "0.49399146", "0.49380735", "0.49322143", "0.49319184", "0.4921877", "0.49149275", "0.48981756", "0.48855713", "0.48841634", "0.48812827", "0.48759952", "0.4847985", "0.4845226", "0.48359388", "0.48344636", "0.48194623", "0.48074317", "0.48070437", "0.47857314", "0.4775789", "0.47756872", "0.47756872" ]
0.78175247
1
/ The function NewObjectPairs calls NewUnaryFunctionBase to create a function named OBJECT_PAIRS with an expression as input.
func NewObjectPairs(operand Expression) Function { rv := &ObjectPairs{ *NewUnaryFunctionBase("object_pairs", operand), } rv.expr = rv return rv }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewObjectInnerPairs(operand Expression) Function {\n\trv := &ObjectInnerPairs{\n\t\t*NewUnaryFunctionBase(\"object_innerpairs\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewPairs(array *expression.ArrayConstruct) (pairs Pairs, err error) {\n\toperands := array.Operands()\n\tpairs = make(Pairs, len(operands))\n\tfor i, op := range operands {\n\t\tpairs[i], err = NewPair(op)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn\n}", "func NewPair(expr expression.Expression) (*Pair, error) {\n\tarray, ok := expr.(*expression.ArrayConstruct)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Invalid VALUES expression %s\", expr.String())\n\t}\n\n\toperands := array.Operands()\n\tif len(operands) != 2 {\n\t\treturn nil, fmt.Errorf(\"Invalid VALUES expression %s\", expr.String())\n\t}\n\n\tpair := &Pair{\n\t\tKey: operands[0],\n\t\tValue: operands[1],\n\t}\n\n\treturn pair, nil\n}", "func (s Record) NewPairs(n int32) (Pair_List, error) {\n\tl, err := NewPair_List(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn Pair_List{}, err\n\t}\n\terr = s.Struct.SetPtr(7, l.List.ToPtr())\n\treturn l, err\n}", "func (this *ObjectPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPairs(operands[0])\n\t}\n}", "func (this *ObjectPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPairs(operands[0])\n\t}\n}", "func NewObject(t ...[2]*Term) Object {\n\tobj := newobject(len(t))\n\tfor i := range t {\n\t\tobj.Insert(t[i][0], t[i][1])\n\t}\n\treturn obj\n}", "func (this *ObjectInnerPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectInnerPairs(operands[0])\n\t}\n}", "func NewObjectValues(operand Expression) Function {\n\trv := &ObjectValues{\n\t\t*NewUnaryFunctionBase(\"object_values\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectValues(operand Expression) Function {\n\trv := &ObjectValues{\n\t\t*NewUnaryFunctionBase(\"object_values\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func (o *Object) AddPair(key, value string) {\n\to.Pairs = append(o.Pairs, Pair{Key: key, Value: value})\n}", "func NewPair(key string, value interface{}) *Pair {\n\treturn &Pair{\n\t\tkey: key,\n\t\tvalue: value,\n\t}\n}", "func NewPairs(local, remote Candidates) Pairs {\n\tp := make(Pairs, 0, 100)\n\tfor l := range local {\n\t\tfor r := range remote {\n\t\t\t// Same data stream.\n\t\t\tif local[l].ComponentID != remote[r].ComponentID {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvar (\n\t\t\t\tipL, ipR = local[l].Addr.IP, remote[r].Addr.IP\n\t\t\t)\n\t\t\t// Same IP address family.\n\t\t\tif !sameFamily(ipL, ipR) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ipL.To4() == nil && ipL.IsLinkLocalUnicast() {\n\t\t\t\t// IPv6 link-local addresses MUST NOT be paired with other\n\t\t\t\t// than link-local addresses.\n\t\t\t\tif !ipR.IsLinkLocalUnicast() {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tp = append(p, Pair{\n\t\t\t\tLocal: local[l], Remote: local[r],\n\t\t\t})\n\t\t}\n\t}\n\treturn p\n}", "func NewPair(base, counter Asset) Pair {\n\treturn Pair{\n\t\tBase: base,\n\t\tCounter: counter,\n\t}\n}", "func NewObjectNames(operand Expression) Function {\n\trv := &ObjectNames{\n\t\t*NewUnaryFunctionBase(\"object_names\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectNames(operand Expression) Function {\n\trv := &ObjectNames{\n\t\t*NewUnaryFunctionBase(\"object_names\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func Make(e1, e2 interface{}) (p Pair) {\n\tp[0] = e1\n\tp[1] = e2\n\n\treturn p\n}", "func NewPair(baseCurrency, quoteCurrency Code) Pair {\n\treturn Pair{\n\t\tBase: baseCurrency,\n\t\tQuote: quoteCurrency,\n\t}\n}", "func NewPair_List(s *capnp.Segment, sz int32) (Pair_List, error) {\n\tl, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 16, PointerCount: 2}, sz)\n\treturn Pair_List{l}, err\n}", "func NewObjectInnerValues(operand Expression) Function {\n\trv := &ObjectInnerValues{\n\t\t*NewUnaryFunctionBase(\"object_innervalues\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func (_SushiV2Factory *SushiV2FactorySession) CreatePair(tokenA common.Address, tokenB common.Address) (*types.Transaction, error) {\n\treturn _SushiV2Factory.Contract.CreatePair(&_SushiV2Factory.TransactOpts, tokenA, tokenB)\n}", "func newPair(key, value []byte) *item {\n\treturn &item{key: key, value: value}\n}", "func (_IUniswapV2Factory *IUniswapV2FactoryFilterer) FilterPairCreated(opts *bind.FilterOpts, token0 []common.Address, token1 []common.Address) (*IUniswapV2FactoryPairCreatedIterator, error) {\r\n\r\n\tvar token0Rule []interface{}\r\n\tfor _, token0Item := range token0 {\r\n\t\ttoken0Rule = append(token0Rule, token0Item)\r\n\t}\r\n\tvar token1Rule []interface{}\r\n\tfor _, token1Item := range token1 {\r\n\t\ttoken1Rule = append(token1Rule, token1Item)\r\n\t}\r\n\r\n\tlogs, sub, err := _IUniswapV2Factory.contract.FilterLogs(opts, \"PairCreated\", token0Rule, token1Rule)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\treturn &IUniswapV2FactoryPairCreatedIterator{contract: _IUniswapV2Factory.contract, event: \"PairCreated\", logs: logs, sub: sub}, nil\r\n}", "func EvalPairlist(ev *Evaluator, node *ast.CallExpr) (r *RSEXP) {\n\tTRACE := ev.Trace\n\tif TRACE {\n\t\tprintln(\"Pairlist\")\n\t}\n\n\treturn &RSEXP{ValuePos: node.Fun.Pos(),\n\t\tCAR: EvalExprOrAssignment(ev, node.Args[0]),\n\t\tCDR: EvalExprOrAssignment(ev, node.Args[1])}\n}", "func (_SushiV2Factory *SushiV2FactoryFilterer) FilterPairCreated(opts *bind.FilterOpts, token0 []common.Address, token1 []common.Address) (*SushiV2FactoryPairCreatedIterator, error) {\n\n\tvar token0Rule []interface{}\n\tfor _, token0Item := range token0 {\n\t\ttoken0Rule = append(token0Rule, token0Item)\n\t}\n\tvar token1Rule []interface{}\n\tfor _, token1Item := range token1 {\n\t\ttoken1Rule = append(token1Rule, token1Item)\n\t}\n\n\tlogs, sub, err := _SushiV2Factory.contract.FilterLogs(opts, \"PairCreated\", token0Rule, token1Rule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &SushiV2FactoryPairCreatedIterator{contract: _SushiV2Factory.contract, event: \"PairCreated\", logs: logs, sub: sub}, nil\n}", "func FromPairs(data interface{}) (interface{}, error) {\n\tvar err error\n\n\tresult := func(err *error) interface{} {\n\t\tdefer catch(err)\n\n\t\tif !isNonNilData(err, \"data\", data) {\n\t\t\treturn nil\n\t\t}\n\n\t\tdataValue, dataValueType, _, dataValueLen := inspectData(data)\n\n\t\tif !isSlice(err, \"data\", dataValue) {\n\t\t\treturn nil\n\t\t}\n\n\t\tif dataValueType.Elem().Kind() != reflect.Interface {\n\t\t\t*err = errors.New(\"supported type only []interface{}\")\n\t\t\treturn nil\n\t\t}\n\n\t\tresult := make(map[interface{}]interface{}, 0)\n\n\t\tif dataValueLen == 0 {\n\t\t\treturn result\n\t\t}\n\n\t\tforEachSliceStoppable(dataValue, dataValueLen, func(each reflect.Value, i int) bool {\n\t\t\tif *err != nil {\n\t\t\t\tresult = nil\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\teachSlice := each.Elem()\n\t\t\teachSliceLen := eachSlice.Len()\n\n\t\t\tif eachSliceLen > 2 {\n\t\t\t\teachSliceLen = 2\n\t\t\t}\n\n\t\t\tif eachSliceLen > 0 {\n\t\t\t\teachSliceKey := eachSlice.Index(0).Interface()\n\t\t\t\tresult[eachSliceKey] = nil\n\n\t\t\t\tif eachSliceLen > 1 {\n\t\t\t\t\teachSliceVal := eachSlice.Index(1).Interface()\n\t\t\t\t\tresult[eachSliceKey] = eachSliceVal\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true\n\t\t})\n\n\t\treturn result\n\t}(&err)\n\n\treturn result, err\n}", "func (_SushiV2Factory *SushiV2FactoryTransactorSession) CreatePair(tokenA common.Address, tokenB common.Address) (*types.Transaction, error) {\n\treturn _SushiV2Factory.Contract.CreatePair(&_SushiV2Factory.TransactOpts, tokenA, tokenB)\n}", "func (_SushiV2Factory *SushiV2FactoryTransactor) CreatePair(opts *bind.TransactOpts, tokenA common.Address, tokenB common.Address) (*types.Transaction, error) {\n\treturn _SushiV2Factory.contract.Transact(opts, \"createPair\", tokenA, tokenB)\n}", "func Pair(arg1 TermT, arg2 TermT) TermT {\n\treturn TermT(C.yices_pair(C.term_t(arg1), C.term_t(arg2)))\n}", "func NewPairFromStrings(baseCurrency, quoteCurrency string) Pair {\n\treturn Pair{\n\t\tBase: NewCode(baseCurrency),\n\t\tQuote: NewCode(quoteCurrency),\n\t}\n}", "func (this *ObjectPairs) Apply(context Context, arg value.Value) (value.Value, error) {\n\tif arg.Type() == value.MISSING {\n\t\treturn value.MISSING_VALUE, nil\n\t} else if arg.Type() != value.OBJECT {\n\t\treturn value.NULL_VALUE, nil\n\t}\n\n\toa := arg.Actual().(map[string]interface{})\n\tkeys := make(sort.StringSlice, 0, len(oa))\n\tfor key, _ := range oa {\n\t\tkeys = append(keys, key)\n\t}\n\n\tsort.Sort(keys)\n\tra := make([]interface{}, len(keys))\n\tfor i, k := range keys {\n\t\tra[i] = map[string]interface{}{\"name\": k, \"value\": oa[k]}\n\t}\n\n\treturn value.NewValue(ra), nil\n}", "func (this *ObjectPairs) Apply(context Context, arg value.Value) (value.Value, error) {\n\tif arg.Type() == value.MISSING {\n\t\treturn value.MISSING_VALUE, nil\n\t} else if arg.Type() != value.OBJECT {\n\t\treturn value.NULL_VALUE, nil\n\t}\n\n\toa := arg.Actual().(map[string]interface{})\n\tkeys := make(sort.StringSlice, 0, len(oa))\n\tfor key, _ := range oa {\n\t\tkeys = append(keys, key)\n\t}\n\n\tsort.Sort(keys)\n\tra := make([]interface{}, len(keys))\n\tfor i, k := range keys {\n\t\tra[i] = map[string]interface{}{\"name\": k, \"value\": oa[k]}\n\t}\n\n\treturn value.NewValue(ra), nil\n}", "func (_IUniswapV2Factory *IUniswapV2FactorySession) CreatePair(tokenA common.Address, tokenB common.Address) (*types.Transaction, error) {\r\n\treturn _IUniswapV2Factory.Contract.CreatePair(&_IUniswapV2Factory.TransactOpts, tokenA, tokenB)\r\n}", "func GenerateNewKeypair() *Keypair {\n\n\tpk, _ := ecdsa.GenerateKey(elliptic.P224(), rand.Reader)\n\n\tb := bigJoin(KEY_SIZE, pk.PublicKey.X, pk.PublicKey.Y)\n\n\tpublic := base58.EncodeBig([]byte{}, b)\n\tprivate := base58.EncodeBig([]byte{}, pk.D)\n\n\tkp := Keypair{Public: public, Private: private}\n\n\treturn &kp\n}", "func execNewTuple(arity int, p *gop.Context) {\n\targs := p.GetArgs(arity)\n\tconv := func(args []interface{}) []*types.Var {\n\t\tret := make([]*types.Var, len(args))\n\t\tfor i, arg := range args {\n\t\t\tret[i] = arg.(*types.Var)\n\t\t}\n\t\treturn ret\n\t}\n\tret := types.NewTuple(conv(args[0:])...)\n\tp.Ret(arity, ret)\n}", "func NewHashPair(pos int, line int) *HashPair {\n\treturn &HashPair{\n\t\tNodeType: NodeHashPair,\n\t\tLoc: Loc{pos, line},\n\t}\n}", "func (_IUniswapV2Factory *IUniswapV2FactoryTransactorSession) CreatePair(tokenA common.Address, tokenB common.Address) (*types.Transaction, error) {\r\n\treturn _IUniswapV2Factory.Contract.CreatePair(&_IUniswapV2Factory.TransactOpts, tokenA, tokenB)\r\n}", "func (this *ObjectInnerPairs) Apply(context Context, arg value.Value) (value.Value, error) {\n\tif arg.Type() == value.MISSING {\n\t\treturn value.MISSING_VALUE, nil\n\t} else if arg.Type() != value.OBJECT {\n\t\treturn value.NULL_VALUE, nil\n\t}\n\n\toa := removeMissing(arg)\n\tkeys := make(sort.StringSlice, 0, len(oa))\n\tfor key, _ := range oa {\n\t\tkeys = append(keys, key)\n\t}\n\n\tsort.Sort(keys)\n\tra := make([]interface{}, len(keys))\n\tfor i, k := range keys {\n\t\tra[i] = map[string]interface{}{\"name\": k, \"value\": oa[k]}\n\t}\n\n\treturn value.NewValue(ra), nil\n}", "func (lscript *Scripting) registerPairType() {\n\tmt := lscript.NewTypeMetatable(luaPairTypeName)\n\tlscript.SetGlobal(\"pair\", mt)\n\t// static attributes\n\tlscript.SetField(mt, \"new\", lscript.NewFunction(newPair))\n\t// methods\n\tlscript.SetField(mt, \"__index\", lscript.SetFuncs(lscript.NewTable(), pairMethods))\n}", "func (_IUniswapV2Factory *IUniswapV2FactoryTransactor) CreatePair(opts *bind.TransactOpts, tokenA common.Address, tokenB common.Address) (*types.Transaction, error) {\r\n\treturn _IUniswapV2Factory.contract.Transact(opts, \"createPair\", tokenA, tokenB)\r\n}", "func (p *SliceOfMap) Pair() (first, second *Object) {\n\tfirst, second = &Object{}, &Object{}\n\tif p == nil {\n\t\treturn\n\t}\n\tif len(*p) > 0 {\n\t\tfirst = p.At(0)\n\t}\n\tif len(*p) > 1 {\n\t\tsecond = p.At(1)\n\t}\n\treturn\n}", "func NewPatternExprPair(pattern Pattern, expr Expr) PatternExprPair {\n\treturn PatternExprPair{pattern, expr}\n}", "func Pair(x, y interface{}) Node {\n\treturn Expr(\":\", x, y)\n}", "func NewKeypair() (*Keypair, error) {\n\tpub, priv, err := GenerateKeypair()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Keypair{\n\t\tpriv: *priv,\n\t\tpub: *pub,\n\t}, nil\n}", "func NewKeyPair(rootKey RootKeyable, chainKey ChainKeyable) *KeyPair {\n\tkeyPair := KeyPair{\n\t\tRootKey: rootKey,\n\t\tChainKey: chainKey,\n\t}\n\n\treturn &keyPair\n}", "func NewPair[T1, T2 any](first T1, second T2) Pair[T1, T2] {\n\treturn Pair[T1, T2]{First: first, Second: second}\n}", "func NewKeyValuePair(key QualifiedName, value Variant) *_KeyValuePair {\n\t_result := &_KeyValuePair{\n\t\tKey: key,\n\t\tValue: value,\n\t\t_ExtensionObjectDefinition: NewExtensionObjectDefinition(),\n\t}\n\t_result._ExtensionObjectDefinition._ExtensionObjectDefinitionChildRequirements = _result\n\treturn _result\n}", "func newPagePairHandlerFunc(params *pages.HandlerParams) *pages.Result {\n\tdecoder := json.NewDecoder(params.R.Body)\n\tvar data newPagePairData\n\terr := decoder.Decode(&data)\n\tif err != nil {\n\t\treturn pages.Fail(\"Couldn't decode json\", err).Status(http.StatusBadRequest)\n\t}\n\n\treturn newPagePairHandlerInternal(params.DB, params.U, &data)\n}", "func Pair(children ...Element) *CompoundElement { return newCE(\"Pair\", children) }", "func NewObjectAdd(first, second, third Expression) Function {\n\trv := &ObjectAdd{\n\t\t*NewTernaryFunctionBase(\"object_add\", first, second, third),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func (s *GitTestHelper) NewRepoPair(basedir string) {\n\tgit := s.Git()\n\ttarget := s.toAbsPath(basedir)\n\ts.Chdir(target)\n\ts.Mkdir(\"source\")\n\ts.Chdir(\"source\")\n\ts.Exec(git, \"init\", \"--bare\")\n\ts.Chdir(\"..\")\n\ts.Exec(git, \"clone\", \"source\", \"dest\")\n\n\ts.Chdir(\"dest\")\n\ts.TouchAndCommit(\"init.txt\", \"init\")\n\ts.Exec(git, \"push\", \"origin\")\n}", "func NewKeyPair(pub crypto.PublicKey, privArmor string) KeyPair {\n\treturn KeyPair{\n\t\tPublicKey: pub,\n\t\tPrivKeyArmor: privArmor,\n\t}\n}", "func (_SushiV2Factory *SushiV2FactoryCaller) AllPairs(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) {\n\tvar out []interface{}\n\terr := _SushiV2Factory.contract.Call(opts, &out, \"allPairs\", arg0)\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}", "func NewObjectExpression() *ObjectExpression {\n\treturn &ObjectExpression{\n\t\tprops: make(map[string]Expression),\n\t}\n}", "func NewAttributePair(attributeVals []string, attrOwner *AttributeOwner) (*AttributePair, error) {\n\tif len(attributeVals) < 6 {\n\t\treturn nil, errors.New(\"Invalid attribute entry\")\n\t}\n\tvar attrPair = *new(AttributePair)\n\tif attrOwner != nil {\n\t\tattrPair.SetOwner(attrOwner)\n\t} else {\n\t\tattrPair.SetOwner(&AttributeOwner{strings.TrimSpace(attributeVals[0]), strings.TrimSpace(attributeVals[1])})\n\t}\n\tattrPair.SetAttributeName(strings.TrimSpace(attributeVals[2]))\n\tattrPair.SetAttributeValue([]byte(strings.TrimSpace(attributeVals[3])))\n\t//Reading validFrom date\n\tdateStr := strings.TrimSpace(attributeVals[4])\n\tif dateStr != \"\" {\n\t\tvar t time.Time\n\t\tvar err error\n\t\tif t, err = time.Parse(time.RFC3339, dateStr); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tattrPair.SetValidFrom(t)\n\t}\n\t//Reading validTo date\n\tdateStr = strings.TrimSpace(attributeVals[5])\n\tif dateStr != \"\" {\n\t\tvar t time.Time\n\t\tvar err error\n\t\tif t, err = time.Parse(time.RFC3339, dateStr); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tattrPair.SetValidTo(t)\n\t}\n\treturn &attrPair, nil\n}", "func NewPairWithDelimiter(base, quote, delimiter string) Pair {\n\treturn Pair{\n\t\tBase: NewCode(base),\n\t\tQuote: NewCode(quote),\n\t\tDelimiter: delimiter,\n\t}\n}", "func GenericHpairFunction(env *Zlisp, name string, args []Sexp) (Sexp, error) {\n\tif len(args) != 2 {\n\t\treturn SexpNull, WrongNargs\n\t}\n\n\tposreq, isInt := args[1].(*SexpInt)\n\tif !isInt {\n\t\treturn SexpNull, fmt.Errorf(\"hpair position request must be an integer\")\n\t}\n\tpos := int(posreq.Val)\n\n\tswitch seq := args[0].(type) {\n\tcase *SexpHash:\n\t\tif pos < 0 || pos >= len(seq.KeyOrder) {\n\t\t\treturn SexpNull, fmt.Errorf(\"hpair position request %d out of bounds\", pos)\n\t\t}\n\t\treturn seq.HashPairi(pos)\n\tcase *SexpArray:\n\t\tif pos < 0 || pos >= len(seq.Val) {\n\t\t\treturn SexpNull, fmt.Errorf(\"hpair position request %d out of bounds\", pos)\n\t\t}\n\t\treturn Cons(&SexpInt{Val: int64(pos)}, Cons(seq.Val[pos], SexpNull)), nil\n\tdefault:\n\t\treturn SexpNull, errors.New(\"first argument of to hpair function must be hash, list, or array\")\n\t}\n\t//return SexpNull, nil\n}", "func NewPair(p *big.Int, g int64) (private, public *big.Int) {\n\tprivate = PrivateKey(p)\n\tpublic = PublicKey(private, p, g)\n\treturn\n}", "func NewPair(p *big.Int, g int64) (*big.Int, *big.Int) {\n\tprivateKey := PrivateKey(p)\n\tpublicKey := PublicKey(privateKey, p, g)\n\treturn privateKey, publicKey\n}", "func (e *Engine) AddPair(g1 *PointG1, g2 *PointG2) *Engine {\n\tp := newPair(g1, g2)\n\tif !(e.G1.IsZero(p.g1) || e.G2.IsZero(p.g2)) {\n\t\te.G1.Affine(p.g1)\n\t\te.G2.Affine(p.g2)\n\t\te.pairs = append(e.pairs, p)\n\t}\n\treturn e\n}", "func CreateVethPairs(veth1 string, veth2 string) (err error) {\n\terr = exec.Command(\"ip\", \"link\", \"add\", veth1, \"type\", \"veth\", \"peer\", \"name\", veth2).Run()\n\tif err != nil {\n\t\tlogger.WithFields(log.Fields{\n\t\t\t\"veth1\": veth1,\n\t\t\t\"veth2\": veth2,\n\t\t}).Error(\"Fail to createVethPair()\", err.Error())\n\t\treturn\n\t}\n\tlogger.Info(\"%s & %s was created.\", veth1, veth2)\n\terr = exec.Command(\"ip\", \"link\", \"set\", veth1, \"up\").Run()\n\tif err != nil {\n\t\tlogger.Error(\"Fail to createVeth() veth1 up: %v\", err)\n\t\treturn\n\t}\n\terr = exec.Command(\"ip\", \"link\", \"set\", veth2, \"up\").Run()\n\tif err != nil {\n\t\tlogger.Error(\"Fail to createVeth() veth2 up: %v\", err)\n\t\treturn\n\t}\n\tlogger.Info(\"%s & %s was up.\", veth1, veth2)\n\treturn\n}", "func (_SushiV2Factory *SushiV2FactoryCallerSession) AllPairs(arg0 *big.Int) (common.Address, error) {\n\treturn _SushiV2Factory.Contract.AllPairs(&_SushiV2Factory.CallOpts, arg0)\n}", "func NewKeyPair(config CreateKeyPairConfig) (KeyPair, error) {\n\tif config.Type == Default {\n\t\tconfig.Type = Ecdsa\n\t}\n\n\tswitch config.Type {\n\tcase Ecdsa:\n\t\treturn newEcdsaKeyPair(config)\n\tcase Rsa:\n\t\treturn newRsaKeyPair(config)\n\t}\n\n\treturn KeyPair{}, fmt.Errorf(\"Unable to generate new key pair, type %s is not supported\",\n\t\tconfig.Type.String())\n}", "func (_SushiV2Factory *SushiV2FactorySession) AllPairs(arg0 *big.Int) (common.Address, error) {\n\treturn _SushiV2Factory.Contract.AllPairs(&_SushiV2Factory.CallOpts, arg0)\n}", "func NewAutorepair(opts AutorepairOptions, kubeClient kube_client.Interface,\n\tkubeEventRecorder kube_record.EventRecorder, listerRegistry kube_util.ListerRegistry) (Autorepair, errors.AutorepairError) {\n\n\tautorepairBuilder := NewAutorepairBuilder(opts.AutorepairingOptions, kubeClient, kubeEventRecorder, listerRegistry )\n\treturn NewDynamicAutorepair(autorepairBuilder)\n}", "func NewPairFromString(currencyPair string) Pair {\n\tdelimiters := []string{\"_\", \"-\", \"/\"}\n\tvar delimiter string\n\tfor _, x := range delimiters {\n\t\tif strings.Contains(currencyPair, x) {\n\t\t\tdelimiter = x\n\t\t\treturn NewPairDelimiter(currencyPair, delimiter)\n\t\t}\n\t}\n\treturn NewPairFromStrings(currencyPair[0:3], currencyPair[3:])\n}", "func (_IUniswapV2Factory *IUniswapV2FactoryFilterer) ParsePairCreated(log types.Log) (*IUniswapV2FactoryPairCreated, error) {\r\n\tevent := new(IUniswapV2FactoryPairCreated)\r\n\tif err := _IUniswapV2Factory.contract.UnpackLog(event, \"PairCreated\", log); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\tevent.Raw = log\r\n\treturn event, nil\r\n}", "func (s stack) CreateKeyPair(ctx context.Context, name string) (_ *abstract.KeyPair, ferr fail.Error) {\n\tif valid.IsNil(s) {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\tif name == \"\" {\n\t\treturn nil, fail.InvalidParameterError(\"name\", \"cannot be empty string\")\n\t}\n\n\treturn abstract.NewKeyPair(name)\n}", "func NewPairing(address common.Address, backend bind.ContractBackend) (*Pairing, error) {\n\tcontract, err := bindPairing(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Pairing{PairingCaller: PairingCaller{contract: contract}, PairingTransactor: PairingTransactor{contract: contract}, PairingFilterer: PairingFilterer{contract: contract}}, nil\n}", "func NewSliceStringPairs(s [][2]string) StringPairs {\n\treturn sliceStringPairs(s)\n}", "func (this *ObjectPairs) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (this *ObjectPairs) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (_IUniswapV2Factory *IUniswapV2FactoryCaller) AllPairs(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) {\r\n\tvar out []interface{}\r\n\terr := _IUniswapV2Factory.contract.Call(opts, &out, \"allPairs\", arg0)\r\n\r\n\tif err != nil {\r\n\t\treturn *new(common.Address), err\r\n\t}\r\n\r\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\r\n\r\n\treturn out0, err\r\n\r\n}", "func (s *clusterPairLister) ClusterPairs(namespace string) ClusterPairNamespaceLister {\n\treturn clusterPairNamespaceLister{indexer: s.indexer, namespace: namespace}\n}", "func NewPairing(controller *pair.PairingController) *Pairing {\n\thandler := Pairing{\n\t\tcontroller: controller,\n\t}\n\n\treturn &handler\n}", "func NewKeyPair() (*keyPair, error) {\n\tprivKey, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprivKey.Precompute()\n\n\tpubKey := &privKey.PublicKey\n\treturn &keyPair{Private: privKey, Public: pubKey}, nil\n}", "func (_SushiV2Factory *SushiV2FactoryFilterer) ParsePairCreated(log types.Log) (*SushiV2FactoryPairCreated, error) {\n\tevent := new(SushiV2FactoryPairCreated)\n\tif err := _SushiV2Factory.contract.UnpackLog(event, \"PairCreated\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "func newPairsHash(c []Card) pairsHash {\n\tpairs := make(pairsHash)\n\tfor _, v := range c {\n\t\tif _, ok := pairs[v.Rank()]; ok {\n\t\t\tpairs[v.Rank()]++\n\t\t} else {\n\t\t\tpairs[v.Rank()] = 1\n\t\t}\n\t}\n\treturn pairs\n}", "func createKeypair() *keypair.Full {\n\tpair, err := keypair.Random()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Println(\"Seed:\", pair.Seed())\n\tlog.Println(\"Address:\", pair.Address())\n\n\treturn pair\n}", "func (_IUniswapV2Factory *IUniswapV2FactoryCallerSession) AllPairs(arg0 *big.Int) (common.Address, error) {\r\n\treturn _IUniswapV2Factory.Contract.AllPairs(&_IUniswapV2Factory.CallOpts, arg0)\r\n}", "func NewObjectPut(first, second, third Expression) Function {\n\trv := &ObjectPut{\n\t\t*NewTernaryFunctionBase(\"object_put\", first, second, third),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewEnvironmentVariablePair1(name string, value string) *EnvironmentVariablePair1 {\n\tthis := EnvironmentVariablePair1{}\n\tthis.Name = name\n\tthis.Value = value\n\treturn &this\n}", "func NewPair(p *big.Int, g int64) (private, public *big.Int) {\n\tprivKey := PrivateKey(p)\n\tpubKey := PublicKey(privKey, p, g)\n\treturn privKey, pubKey\n}", "func CreateTree(pairs []string) (root Node) {\n\troot = Node{Name: \"COM\", Parent: nil, Children: nil}\n\trecursiveInsertToTree(&root, pairs)\n\treturn\n}", "func CreateKeyPair(conn *ec2.EC2) (KeyPair, error) {\n\tname := generateKeyPairName()\n\tvar kp KeyPair\n\tkp.KeyName = name\n\n\tparams := &ec2.CreateKeyPairInput{\n\t\tKeyName: aws.String(name),\n\t}\n\n\tresp, err := conn.CreateKeyPair(params)\n\tif err != nil {\n\t\treturn kp, err\n\t}\n\n\tkp.Fingerprint = *resp.KeyFingerprint\n\tkp.PrivateKeyPEM = *resp.KeyMaterial\n\tkp.Created = true\n\n\treturn kp, nil\n}", "func (f *FieldsWithValue) Pairs(separator string) []string {\n\tpairs := make([]string, len(f.fields))\n\tfor i, v := range f.fields {\n\t\tpairs[i] = fmt.Sprintf(\"%s%s%s\", v.Name, separator, v.Value)\n\t}\n\treturn pairs\n}", "func NewObjectUnwrap(operand Expression) Function {\n\trv := &ObjectUnwrap{\n\t\t*NewUnaryFunctionBase(\"object_unwrap\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func (_IUniswapV2Factory *IUniswapV2FactorySession) AllPairs(arg0 *big.Int) (common.Address, error) {\r\n\treturn _IUniswapV2Factory.Contract.AllPairs(&_IUniswapV2Factory.CallOpts, arg0)\r\n}", "func (this *ObjectValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectValues(operands[0])\n\t}\n}", "func (this *ObjectValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectValues(operands[0])\n\t}\n}", "func Pairs(word string, opts ...FuncOpt) []Pair {\n\tvar m funcMod\n\tfor _, opt := range opts {\n\t\topt(&m)\n\t}\n\tif m.buf == nil && len(word) > 0 {\n\t\tm.buf = make([]Pair, 0, len([]rune(word))-1)\n\t}\n\n\treturn pairs(word, m.buf)\n}", "func NewTable(syms []obj.Sym) *Table {\n\t// Put syms in address order for fast address lookup.\n\tsort.Slice(syms, func(i, j int) bool {\n\t\treturn syms[i].Value < syms[j].Value\n\t})\n\n\t// Create name map for fast name lookup.\n\tname := make(map[string]int)\n\tfor i, s := range syms {\n\t\tname[s.Name] = i\n\t}\n\n\treturn &Table{syms, name}\n}", "func NewCryptorPair(key [keyLen]byte, nonce [nonceLen]byte, when int64) (\n\tstoi *Cryptor, /* Shift to Insert stream */\n\titos *Cryptor, /* Insert to Shift stream */\n\terr error) {\n\n\t/* Generate the time-adjusted nonce */\n\ttimedNonce := make([]byte, 8)\n\tfor i, n := range nonce {\n\t\t/* Should never happen */\n\t\tif 0 > i {\n\t\t\treturn nil, nil,\n\t\t\t\tfmt.Errorf(\"unpossible negative nonce index\")\n\t\t}\n\t\ttimedNonce[i] = n ^ byte((when>>(8*uint(i)))&0xFF)\n\t}\n\tdebug(\"Time-adjusted nonce: %02X\", timedNonce)\n\n\t/* Make the cryptors */\n\ttimedNonce[0] &= 0xFC\n\ts, err := chacha20.New(key[:], timedNonce)\n\tif nil != err {\n\t\treturn nil, nil, err\n\t}\n\tstoi = &Cryptor{s}\n\ttimedNonce[0] |= 0x03\n\ti, err := chacha20.New(key[:], timedNonce)\n\tif nil != err {\n\t\treturn nil, nil, err\n\t}\n\titos = &Cryptor{i}\n\t/* TODO: Make sure key is 32 bytes long early */\n\treturn\n}", "func NewObject(x, y, w, h int, s string) Object {\n\treturn Object{\n\t\tpoint: Point{X: x, Y: y},\n\t\tsize: Size{Width: w, Height: h},\n\t\tstr: s,\n\t}\n}", "func CreateTokenPair(userID string) (*TokenPair, error) {\n\n\trefreshTokenExp := time.Now().Add(time.Hour * 24 * 7).Unix()\n\trefreshTokenUUID := uuid.New().String()\n\trefreshToken, err := createRefreshToken(userID, refreshTokenUUID, refreshTokenExp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taccessTokenExp := time.Now().Add(time.Hour * 24 * 7).Unix()\n\taccessToken, err := createAccessToken(userID, refreshTokenUUID, accessTokenExp)\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\treturn nil, err\n\t}\n\n\ttokens := &TokenPair{\n\t\tAccessToken: AccessToken{\n\t\t\tToken: accessToken,\n\t\t\tExpiresAt: accessTokenExp,\n\t\t},\n\t\tRefreshToken: RefreshToken{\n\t\t\tUserID: userID,\n\t\t\tUUID: refreshTokenUUID,\n\t\t\tToken: refreshToken,\n\t\t\tExpiresAt: refreshTokenExp,\n\t\t\tUsed: false,\n\t\t},\n\t}\n\treturn tokens, nil\n}", "func NewPairDelimiter(currencyPair, delimiter string) Pair {\n\tresult := strings.Split(currencyPair, delimiter)\n\treturn Pair{\n\t\tDelimiter: delimiter,\n\t\tBase: NewCode(result[0]),\n\t\tQuote: NewCode(result[1]),\n\t}\n}", "func SecretObjectWrapper(create SecretCreator) ObjectCreator {\n\treturn func(existing runtime.Object) (runtime.Object, error) {\n\t\tif existing != nil {\n\t\t\treturn create(existing.(*corev1.Secret))\n\t\t}\n\t\treturn create(&corev1.Secret{})\n\t}\n}", "func (this *Pair) Expression() expression.Expression {\n\treturn expression.NewArrayConstruct(this.Key, this.Value)\n}", "func execNewSignature(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\tret := types.NewSignature(args[0].(*types.Var), args[1].(*types.Tuple), args[2].(*types.Tuple), args[3].(bool))\n\tp.Ret(4, ret)\n}" ]
[ "0.77096313", "0.681373", "0.6260862", "0.61187327", "0.5915429", "0.5915429", "0.55906564", "0.5551416", "0.55439746", "0.55439746", "0.5494457", "0.5456087", "0.5395901", "0.52397954", "0.52306813", "0.52306813", "0.5191114", "0.5183652", "0.50730604", "0.5071748", "0.50323707", "0.5000556", "0.49824095", "0.49402797", "0.49374795", "0.49330083", "0.48987958", "0.48858437", "0.48843855", "0.4837739", "0.48075974", "0.48075974", "0.48062378", "0.48058397", "0.47867522", "0.47482663", "0.47295603", "0.47034577", "0.4690848", "0.46796137", "0.46550348", "0.46428305", "0.46425322", "0.46410403", "0.46301135", "0.46277732", "0.4626216", "0.46231946", "0.46226606", "0.4613411", "0.46023062", "0.45954734", "0.4565777", "0.4561767", "0.45466456", "0.45461842", "0.45425412", "0.45391974", "0.45331043", "0.4520012", "0.45195407", "0.44953293", "0.4468698", "0.44655803", "0.4460085", "0.44586506", "0.44555813", "0.44500566", "0.44392452", "0.4434785", "0.4418887", "0.4418887", "0.4418184", "0.44173518", "0.44122982", "0.44058698", "0.44023958", "0.4388038", "0.43830162", "0.4381459", "0.43789434", "0.4342684", "0.4315637", "0.4312647", "0.43051913", "0.4302888", "0.42798987", "0.42777643", "0.42696467", "0.42696467", "0.42672274", "0.42631987", "0.4249676", "0.42470747", "0.42457303", "0.4243811", "0.4236493", "0.42360723", "0.42340407" ]
0.83893144
1
/ It calls the VisitFunction method by passing in the receiver to and returns the interface. It is a visitor pattern.
func (this *ObjectPairs) Accept(visitor Visitor) (interface{}, error) { return visitor.VisitFunction(this) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (this *NowStr) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (e FunctionCallExpression) Visit(env Environment) Value {\n\treturn NoneValue()\n}", "func (i *InterfaceSet) Visit(n ast.Node) (w ast.Visitor) {\n\tswitch n := n.(type) {\n\tcase *ast.TypeSpec:\n\t\tif data, ok := n.Type.(*ast.InterfaceType); ok {\n\t\t\tr := InterfaceInfo{\n\t\t\t\tMethods: []*Method{},\n\t\t\t}\n\t\t\tmethods := data.Methods.List\n\t\t\tr.Name = n.Name.Name\n\t\t\tr.Doc = n.Doc.Text()\n\n\t\t\tfor _, m := range methods {\n\t\t\t\tfor _, name := range m.Names {\n\t\t\t\t\tr.Methods = append(r.Methods, &Method{\n\t\t\t\t\t\tMethodName: name.Name,\n\t\t\t\t\t\tDoc: m.Doc.Text(),\n\t\t\t\t\t\tParams: getParamList(m.Type.(*ast.FuncType).Params),\n\t\t\t\t\t\tResult: getParamList(m.Type.(*ast.FuncType).Results),\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t}\n\t\t\ti.Interfaces = append(i.Interfaces, r)\n\t\t}\n\t}\n\treturn i\n}", "func FuncInterface(_ T1) {}", "func (this *ExecuteFunction) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitExecuteFunction(this)\n}", "func (this *ObjectValues) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectValues) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectUnwrap) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (r *Resolver) Visitor() generated.VisitorResolver { return &visitorResolver{r} }", "func (this *ObjectInnerValues) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (f VisitorFunc) Visit(node Node, visitType int) error {\n\treturn f(node, visitType)\n}", "func (this *ObjectNames) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectNames) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ClockStr) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *NowMillis) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (statement *FunctionCall) Accept(visitor StatementVisitor) {\n\tvisitor.VisitFunctionCall(statement)\n}", "func (this *ObjectLength) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectLength) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectRemove) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *DateDiffStr) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectAdd) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectInnerPairs) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectPut) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (v Value) AsFunction() Callable {\n\treturn v.iface.(Callable)\n}", "func (bf *BuiltInFunc) Call(interpreter *Interpreter, args ...interface{}) interface{} {\n\t// we actually omit the `interpreter` because we already known how\n\t// to convert it into a go function.\n\treturn bf.call(bf.instance, args...)\n}", "func (this *ClockMillis) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (statement *NativeCall) Accept(visitor StatementVisitor) {\n\tvisitor.VisitNativeCall(statement)\n}", "func (this *DatePartStr) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func Visit(node Node, visitor func(Node)) {\n\tReplace(node, func(n Node) Node { visitor(n); return n })\n}", "func (n *Interface) Walk(v walker.Visitor) {\n\tif v.EnterNode(n) == false {\n\t\treturn\n\t}\n\n\tif n.InterfaceName != nil {\n\t\tvv := v.GetChildrenVisitor(\"InterfaceName\")\n\t\tn.InterfaceName.Walk(vv)\n\t}\n\n\tif n.Extends != nil {\n\t\tvv := v.GetChildrenVisitor(\"Extends\")\n\t\tn.Extends.Walk(vv)\n\t}\n\n\tif n.Stmts != nil {\n\t\tvv := v.GetChildrenVisitor(\"Stmts\")\n\t\tfor _, nn := range n.Stmts {\n\t\t\tif nn != nil {\n\t\t\t\tnn.Walk(vv)\n\t\t\t}\n\t\t}\n\t}\n\n\tv.LeaveNode(n)\n}", "func (this *Element) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitElement(this)\n}", "func (*Base) Visit(p ASTPass, node *ast.Node, ctx Context) {\n\n\tf := *(*node).OpenFodder()\n\tp.Fodder(p, &f, ctx)\n\t*(*node).OpenFodder() = f\n\n\tswitch node := (*node).(type) {\n\tcase *ast.Apply:\n\t\tp.Apply(p, node, ctx)\n\tcase *ast.ApplyBrace:\n\t\tp.ApplyBrace(p, node, ctx)\n\tcase *ast.Array:\n\t\tp.Array(p, node, ctx)\n\tcase *ast.ArrayComp:\n\t\tp.ArrayComp(p, node, ctx)\n\tcase *ast.Assert:\n\t\tp.Assert(p, node, ctx)\n\tcase *ast.Binary:\n\t\tp.Binary(p, node, ctx)\n\tcase *ast.Conditional:\n\t\tp.Conditional(p, node, ctx)\n\tcase *ast.Dollar:\n\t\tp.Dollar(p, node, ctx)\n\tcase *ast.Error:\n\t\tp.Error(p, node, ctx)\n\tcase *ast.Function:\n\t\tp.Function(p, node, ctx)\n\tcase *ast.Import:\n\t\tp.Import(p, node, ctx)\n\tcase *ast.ImportStr:\n\t\tp.ImportStr(p, node, ctx)\n\tcase *ast.ImportBin:\n\t\tp.ImportBin(p, node, ctx)\n\tcase *ast.Index:\n\t\tp.Index(p, node, ctx)\n\tcase *ast.InSuper:\n\t\tp.InSuper(p, node, ctx)\n\tcase *ast.LiteralBoolean:\n\t\tp.LiteralBoolean(p, node, ctx)\n\tcase *ast.LiteralNull:\n\t\tp.LiteralNull(p, node, ctx)\n\tcase *ast.LiteralNumber:\n\t\tp.LiteralNumber(p, node, ctx)\n\tcase *ast.LiteralString:\n\t\tp.LiteralString(p, node, ctx)\n\tcase *ast.Local:\n\t\tp.Local(p, node, ctx)\n\tcase *ast.Object:\n\t\tp.Object(p, node, ctx)\n\tcase *ast.ObjectComp:\n\t\tp.ObjectComp(p, node, ctx)\n\tcase *ast.Parens:\n\t\tp.Parens(p, node, ctx)\n\tcase *ast.Self:\n\t\tp.Self(p, node, ctx)\n\tcase *ast.Slice:\n\t\tp.Slice(p, node, ctx)\n\tcase *ast.SuperIndex:\n\t\tp.SuperIndex(p, node, ctx)\n\tcase *ast.Unary:\n\t\tp.Unary(p, node, ctx)\n\tcase *ast.Var:\n\t\tp.Var(p, node, ctx)\n\t}\n}", "func (this *StrToZoneName) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func Visit(visitor func(funcName string, backend TemplateFunc)) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tfor funcName, backend := range backends {\n\t\tvisitor(funcName, backend)\n\t}\n}", "func (this *DateDiffMillis) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *StrToUTC) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (u Unary) Accept(interpreter *Interpreter) Object {\n\treturn interpreter.visitUnary(u)\n}", "func (v *FuncVisitor) Visit(node ast.Node) ast.Visitor {\n\tswitch n := node.(type) {\n\tcase *ast.FuncDecl:\n\t\tif n.Body == nil {\n\t\t\t// Do not count declarations of assembly functions.\n\t\t\tbreak\n\t\t}\n\t\tstart := v.fset.Position(n.Pos())\n\t\tend := v.fset.Position(n.End())\n\n\t\tfe := &FuncExtent{\n\t\t\tName: v.signature(n),\n\t\t\tDecl: n,\n\t\t\tstartLine: start.Line,\n\t\t\tstartCol: start.Column,\n\t\t\tendLine: end.Line,\n\t\t\tendCol: end.Column,\n\t\t\tOffset: start.Offset,\n\t\t\tEnd: end.Offset,\n\t\t}\n\t\tv.funcs = append(v.funcs, fe)\n\t}\n\treturn v\n}", "func (this *DateAddStr) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *MillisToStr) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *Mod) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitMod(this)\n}", "func (this *StrToMillis) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (b Binary) Accept(interpreter *Interpreter) Object {\n\treturn interpreter.visitBinary(b)\n}", "func (this *MillisToUTC) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (v visitor) Visit(n ast.Node) ast.Visitor {\n\tif n == nil {\n\t\treturn nil\n\t}\n\n\tif ShouldPrintAbstractSyntaxTree {\n\t\tfmt.Printf(\"%s%T\\n\", strings.Repeat(\"\\t\", int(v)), n)\n\t\tfmt.Printf(\"%d\", v)\n\n\t\treturn v + 1\n\t}\n\n\tswitch d := n.(type) {\n\tcase *ast.Ident:\n\t\tif d.Obj == nil {\n\t\t\treturn v + 1\n\t\t}\n\n\t\tif d.Obj.Kind == ast.Typ {\n\t\t\tresult := parseStruct(d)\n\n\t\t\tfor i := range result {\n\t\t\t\t_, ok := Result[CurrentFile].StructScanResult[result[i].Name]\n\t\t\t\tif !ok {\n\t\t\t\t\tResult[CurrentFile].StructScanResult[result[i].Name] = result[i]\n\t\t\t\t}\n\t\t\t}\n\t\t} else if d.Obj.Kind == ast.Con || d.Obj.Kind == ast.Var {\n\t\t\tresult := parseConstantsAndVariables(d)\n\n\t\t\tfor i := range result {\n\t\t\t\t_, ok := Result[CurrentFile].ScanResult[result[i].Name]\n\t\t\t\tif !ok {\n\t\t\t\t\tResult[CurrentFile].ScanResult[result[i].Name] = result[i]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\tdefault:\n\t\tbreak\n\t}\n\n\treturn v + 1\n}", "func (p Passengers) Visit(visitor func(Passenger)) {\n\tfor _, one := range p {\n\t\tvisitor(one)\n\t}\n}", "func (p Passengers) Visit(visitor func(Passenger)) {\n\tfor _, one := range p {\n\t\tvisitor(one)\n\t}\n}", "func (this *MillisToZoneName) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *DateTruncStr) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (x AstSlice) Interface() interface{} { return asInterface(x.X, x.X == nil) }", "func (p *Parser) Interface() interface{} {\n\treturn p.data\n}", "func (*FuncExpr) iCallable() {}", "func (this *DateAddMillis) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (c *CallExpr) accept(v ExprVisitor) {\n\tv.VisitCall(c)\n}", "func (this *DatePartMillis) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (f *Function) Call(arg interface{}) {\n\tf.input <- arg\n}", "func (f WalkFunc) Walk(ctx context.Context, call *Call, path string) Node { return f(path) }", "func (l *List) Visit(f func(n *Node)) {\n\tp := l.head\n\tfor p != nil {\n\t\tf(p)\n\t\tp = p.next\n\t}\n}", "func Replace(node Node, visitor func(Node) Node) {\n\tswitch n := node.(type) {\n\tcase *Abort:\n\tcase *API:\n\t\tfor i, c := range n.Enums {\n\t\t\tn.Enums[i] = visitor(c).(*Enum)\n\t\t}\n\t\tfor i, c := range n.Definitions {\n\t\t\tn.Definitions[i] = visitor(c).(*Definition)\n\t\t}\n\t\tfor i, c := range n.Classes {\n\t\t\tn.Classes[i] = visitor(c).(*Class)\n\t\t}\n\t\tfor i, c := range n.Pseudonyms {\n\t\t\tn.Pseudonyms[i] = visitor(c).(*Pseudonym)\n\t\t}\n\t\tfor i, c := range n.Externs {\n\t\t\tn.Externs[i] = visitor(c).(*Function)\n\t\t}\n\t\tfor i, c := range n.Subroutines {\n\t\t\tn.Subroutines[i] = visitor(c).(*Function)\n\t\t}\n\t\tfor i, c := range n.Functions {\n\t\t\tn.Functions[i] = visitor(c).(*Function)\n\t\t}\n\t\tfor i, c := range n.Methods {\n\t\t\tn.Methods[i] = visitor(c).(*Function)\n\t\t}\n\t\tfor i, c := range n.Globals {\n\t\t\tn.Globals[i] = visitor(c).(*Global)\n\t\t}\n\t\tfor i, c := range n.StaticArrays {\n\t\t\tn.StaticArrays[i] = visitor(c).(*StaticArray)\n\t\t}\n\t\tfor i, c := range n.Maps {\n\t\t\tn.Maps[i] = visitor(c).(*Map)\n\t\t}\n\t\tfor i, c := range n.Pointers {\n\t\t\tn.Pointers[i] = visitor(c).(*Pointer)\n\t\t}\n\t\tfor i, c := range n.Slices {\n\t\t\tn.Slices[i] = visitor(c).(*Slice)\n\t\t}\n\t\tfor i, c := range n.References {\n\t\t\tn.References[i] = visitor(c).(*Reference)\n\t\t}\n\t\tfor i, c := range n.Signatures {\n\t\t\tn.Signatures[i] = visitor(c).(*Signature)\n\t\t}\n\tcase *ArrayAssign:\n\t\tn.To = visitor(n.To).(*ArrayIndex)\n\t\tn.Value = visitor(n.Value).(Expression)\n\tcase *ArrayIndex:\n\t\tn.Array = visitor(n.Array).(Expression)\n\t\tn.Index = visitor(n.Index).(Expression)\n\tcase *ArrayInitializer:\n\t\tn.Array = visitor(n.Array).(Type)\n\t\tfor i, c := range n.Values {\n\t\t\tn.Values[i] = visitor(c).(Expression)\n\t\t}\n\tcase *Slice:\n\t\tn.To = visitor(n.To).(Type)\n\tcase *SliceIndex:\n\t\tn.Slice = visitor(n.Slice).(Expression)\n\t\tn.Index = visitor(n.Index).(Expression)\n\tcase *SliceAssign:\n\t\tn.To = visitor(n.To).(*SliceIndex)\n\t\tn.Value = visitor(n.Value).(Expression)\n\tcase *Assert:\n\t\tn.Condition = visitor(n.Condition).(Expression)\n\tcase *Assign:\n\t\tn.LHS = visitor(n.LHS).(Expression)\n\t\tn.RHS = visitor(n.RHS).(Expression)\n\tcase *Annotation:\n\t\tfor i, c := range n.Arguments {\n\t\t\tn.Arguments[i] = visitor(c).(Expression)\n\t\t}\n\tcase *Block:\n\t\tfor i, c := range n.Statements {\n\t\t\tn.Statements[i] = visitor(c).(Statement)\n\t\t}\n\tcase BoolValue:\n\tcase *BinaryOp:\n\t\tif n.LHS != nil {\n\t\t\tn.LHS = visitor(n.LHS).(Expression)\n\t\t}\n\t\tif n.RHS != nil {\n\t\t\tn.RHS = visitor(n.RHS).(Expression)\n\t\t}\n\tcase *BitTest:\n\t\tn.Bitfield = visitor(n.Bitfield).(Expression)\n\t\tn.Bits = visitor(n.Bits).(Expression)\n\tcase *UnaryOp:\n\t\tn.Expression = visitor(n.Expression).(Expression)\n\tcase *Branch:\n\t\tn.Condition = visitor(n.Condition).(Expression)\n\t\tn.True = visitor(n.True).(*Block)\n\t\tif n.False != nil {\n\t\t\tn.False = visitor(n.False).(*Block)\n\t\t}\n\tcase *Builtin:\n\tcase *Reference:\n\t\tn.To = visitor(n.To).(Type)\n\tcase *Call:\n\t\tn.Type = visitor(n.Type).(Type)\n\t\tn.Target = visitor(n.Target).(*Callable)\n\t\tfor i, a := range n.Arguments {\n\t\t\tn.Arguments[i] = visitor(a).(Expression)\n\t\t}\n\tcase *Callable:\n\t\tif n.Object != nil {\n\t\t\tn.Object = visitor(n.Object).(Expression)\n\t\t}\n\t\tn.Function = visitor(n.Function).(*Function)\n\tcase *Case:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\t\tfor i, c := range n.Conditions {\n\t\t\tn.Conditions[i] = visitor(c).(Expression)\n\t\t}\n\t\tn.Block = visitor(n.Block).(*Block)\n\tcase *Cast:\n\t\tn.Object = visitor(n.Object).(Expression)\n\t\tn.Type = visitor(n.Type).(Type)\n\tcase *Class:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\t\tfor i, f := range n.Fields {\n\t\t\tn.Fields[i] = visitor(f).(*Field)\n\t\t}\n\t\tfor i, m := range n.Methods {\n\t\t\tn.Methods[i] = visitor(m).(*Function)\n\t\t}\n\tcase *ClassInitializer:\n\t\tfor i, f := range n.Fields {\n\t\t\tn.Fields[i] = visitor(f).(*FieldInitializer)\n\t\t}\n\tcase *Choice:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\t\tfor i, c := range n.Conditions {\n\t\t\tn.Conditions[i] = visitor(c).(Expression)\n\t\t}\n\t\tn.Expression = visitor(n.Expression).(Expression)\n\tcase *Definition:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\t\tn.Expression = visitor(n.Expression).(Expression)\n\tcase *DefinitionUsage:\n\t\tn.Expression = visitor(n.Expression).(Expression)\n\t\tn.Definition = visitor(n.Definition).(*Definition)\n\tcase *DeclareLocal:\n\t\tn.Local = visitor(n.Local).(*Local)\n\t\tif n.Local.Value != nil {\n\t\t\tn.Local.Value = visitor(n.Local.Value).(Expression)\n\t\t}\n\tcase Documentation:\n\tcase *Enum:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\t\tfor i, e := range n.Entries {\n\t\t\tn.Entries[i] = visitor(e).(*EnumEntry)\n\t\t}\n\tcase *EnumEntry:\n\tcase *Fence:\n\t\tif n.Statement != nil {\n\t\t\tn.Statement = visitor(n.Statement).(Statement)\n\t\t}\n\tcase *Field:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\t\tn.Type = visitor(n.Type).(Type)\n\t\tif n.Default != nil {\n\t\t\tn.Default = visitor(n.Default).(Expression)\n\t\t}\n\tcase *FieldInitializer:\n\t\tn.Value = visitor(n.Value).(Expression)\n\tcase Float32Value:\n\tcase Float64Value:\n\tcase *Function:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\t\tif n.Return != nil {\n\t\t\tn.Return = visitor(n.Return).(*Parameter)\n\t\t}\n\t\tfor i, c := range n.FullParameters {\n\t\t\tn.FullParameters[i] = visitor(c).(*Parameter)\n\t\t}\n\t\tif n.Block != nil {\n\t\t\tn.Block = visitor(n.Block).(*Block)\n\t\t}\n\t\tn.Signature = visitor(n.Signature).(*Signature)\n\tcase *Global:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\tcase *StaticArray:\n\t\tn.ValueType = visitor(n.ValueType).(Type)\n\t\tn.SizeExpr = visitor(n.SizeExpr).(Expression)\n\tcase *Signature:\n\tcase Int8Value:\n\tcase Int16Value:\n\tcase Int32Value:\n\tcase Int64Value:\n\tcase *Iteration:\n\t\tn.Iterator = visitor(n.Iterator).(*Local)\n\t\tn.From = visitor(n.From).(Expression)\n\t\tn.To = visitor(n.To).(Expression)\n\t\tn.Block = visitor(n.Block).(*Block)\n\tcase *MapIteration:\n\t\tn.IndexIterator = visitor(n.IndexIterator).(*Local)\n\t\tn.KeyIterator = visitor(n.KeyIterator).(*Local)\n\t\tn.ValueIterator = visitor(n.ValueIterator).(*Local)\n\t\tn.Map = visitor(n.Map).(Expression)\n\t\tn.Block = visitor(n.Block).(*Block)\n\tcase Invalid:\n\tcase *Length:\n\t\tn.Object = visitor(n.Object).(Expression)\n\tcase *Local:\n\t\tn.Type = visitor(n.Type).(Type)\n\tcase *Map:\n\t\tn.KeyType = visitor(n.KeyType).(Type)\n\t\tn.ValueType = visitor(n.ValueType).(Type)\n\tcase *MapAssign:\n\t\tn.To = visitor(n.To).(*MapIndex)\n\t\tn.Value = visitor(n.Value).(Expression)\n\tcase *MapContains:\n\t\tn.Key = visitor(n.Key).(Expression)\n\t\tn.Map = visitor(n.Map).(Expression)\n\tcase *MapIndex:\n\t\tn.Map = visitor(n.Map).(Expression)\n\t\tn.Index = visitor(n.Index).(Expression)\n\tcase *MapRemove:\n\t\tn.Map = visitor(n.Map).(Expression)\n\t\tn.Key = visitor(n.Key).(Expression)\n\tcase *MapClear:\n\t\tn.Map = visitor(n.Map).(Expression)\n\tcase *Member:\n\t\tn.Object = visitor(n.Object).(Expression)\n\t\tn.Field = visitor(n.Field).(*Field)\n\tcase *MessageValue:\n\t\tfor i, a := range n.Arguments {\n\t\t\tn.Arguments[i] = visitor(a).(*FieldInitializer)\n\t\t}\n\tcase *New:\n\t\tn.Type = visitor(n.Type).(*Reference)\n\tcase *Parameter:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\t\tn.Type = visitor(n.Type).(Type)\n\tcase *Pointer:\n\t\tn.To = visitor(n.To).(Type)\n\tcase *Pseudonym:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\t\tn.To = visitor(n.To).(Type)\n\t\tfor i, m := range n.Methods {\n\t\t\tn.Methods[i] = visitor(m).(*Function)\n\t\t}\n\tcase *Return:\n\t\tif n.Value != nil {\n\t\t\tn.Value = visitor(n.Value).(Expression)\n\t\t}\n\tcase *Select:\n\t\tn.Value = visitor(n.Value).(Expression)\n\t\tfor i, c := range n.Choices {\n\t\t\tn.Choices[i] = visitor(c).(*Choice)\n\t\t}\n\t\tif n.Default != nil {\n\t\t\tn.Default = visitor(n.Default).(Expression)\n\t\t}\n\tcase StringValue:\n\tcase *Switch:\n\t\tn.Value = visitor(n.Value).(Expression)\n\t\tfor i, c := range n.Cases {\n\t\t\tn.Cases[i] = visitor(c).(*Case)\n\t\t}\n\t\tif n.Default != nil {\n\t\t\tn.Default = visitor(n.Default).(*Block)\n\t\t}\n\tcase Uint8Value:\n\tcase Uint16Value:\n\tcase Uint32Value:\n\tcase Uint64Value:\n\tcase *Unknown:\n\tcase *Clone:\n\t\tn.Slice = visitor(n.Slice).(Expression)\n\tcase *Copy:\n\t\tn.Src = visitor(n.Src).(Expression)\n\t\tn.Dst = visitor(n.Dst).(Expression)\n\tcase *Create:\n\t\tn.Type = visitor(n.Type).(*Reference)\n\t\tn.Initializer = visitor(n.Initializer).(*ClassInitializer)\n\tcase *Ignore:\n\tcase *Make:\n\t\tn.Type = visitor(n.Type).(*Slice)\n\t\tn.Size = visitor(n.Size).(Expression)\n\tcase Null:\n\tcase *PointerRange:\n\t\tn.Pointer = visitor(n.Pointer).(Expression)\n\t\tn.Range = visitor(n.Range).(*BinaryOp)\n\tcase *Read:\n\t\tn.Slice = visitor(n.Slice).(Expression)\n\tcase *SliceContains:\n\t\tn.Value = visitor(n.Value).(Expression)\n\t\tn.Slice = visitor(n.Slice).(Expression)\n\tcase *SliceRange:\n\t\tn.Slice = visitor(n.Slice).(Expression)\n\t\tn.Range = visitor(n.Range).(*BinaryOp)\n\tcase *Write:\n\t\tn.Slice = visitor(n.Slice).(Expression)\n\tdefault:\n\t\tpanic(fmt.Errorf(\"Unsupported semantic node type %T\", n))\n\t}\n}", "func (r *fakeResourceResult) Visit(fn resource.VisitorFunc) error {\n\tfor _, info := range r.Infos {\n\t\terr := fn(info, nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (h *MapInt16ToInt) Visit(fn func(int16, int)) {\n\tfor _, e := range h.slots {\n\t\tfor ; e != nil; e = e.next {\n\t\t\tfn(e.k, e.v)\n\t\t}\n\t}\n}", "func FuncInterfaceCompatible(_ T1) {}", "func (b *Binary) Accept(v Visitor) {\n\tv.VisitBinary(b)\n}", "func (s *InterfaceStep) Interface() interface{} {\n\treturn s.value\n}", "func (h *MapInt16ToInt8) Visit(fn func(int16, int8)) {\n\tfor _, e := range h.slots {\n\t\tfor ; e != nil; e = e.next {\n\t\t\tfn(e.k, e.v)\n\t\t}\n\t}\n}", "func (s *Sequenced) Accept(v Visitor) {\n\tv.VisitSequenced(s)\n}", "func testVisitors(methodCalled *string) (*SimpleVisitor, []*SimpleVisitor) {\n\tv := &SimpleVisitor{\n\t\tDoVisitEnumNode: func(*EnumNode) error {\n\t\t\t*methodCalled = \"*EnumNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitEnumValueNode: func(*EnumValueNode) error {\n\t\t\t*methodCalled = \"*EnumValueNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitFieldDeclNode: func(FieldDeclNode) error {\n\t\t\t*methodCalled = \"FieldDeclNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitFieldNode: func(*FieldNode) error {\n\t\t\t*methodCalled = \"*FieldNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitGroupNode: func(*GroupNode) error {\n\t\t\t*methodCalled = \"*GroupNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitOneofNode: func(*OneofNode) error {\n\t\t\t*methodCalled = \"*OneofNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitMapTypeNode: func(*MapTypeNode) error {\n\t\t\t*methodCalled = \"*MapTypeNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitMapFieldNode: func(*MapFieldNode) error {\n\t\t\t*methodCalled = \"*MapFieldNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitFileNode: func(*FileNode) error {\n\t\t\t*methodCalled = \"*FileNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitSyntaxNode: func(*SyntaxNode) error {\n\t\t\t*methodCalled = \"*SyntaxNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitImportNode: func(*ImportNode) error {\n\t\t\t*methodCalled = \"*ImportNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitPackageNode: func(*PackageNode) error {\n\t\t\t*methodCalled = \"*PackageNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitIdentValueNode: func(IdentValueNode) error {\n\t\t\t*methodCalled = \"IdentValueNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitIdentNode: func(*IdentNode) error {\n\t\t\t*methodCalled = \"*IdentNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitCompoundIdentNode: func(*CompoundIdentNode) error {\n\t\t\t*methodCalled = \"*CompoundIdentNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitKeywordNode: func(*KeywordNode) error {\n\t\t\t*methodCalled = \"*KeywordNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitMessageDeclNode: func(MessageDeclNode) error {\n\t\t\t*methodCalled = \"MessageDeclNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitMessageNode: func(*MessageNode) error {\n\t\t\t*methodCalled = \"*MessageNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitExtendNode: func(*ExtendNode) error {\n\t\t\t*methodCalled = \"*ExtendNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitNode: func(Node) error {\n\t\t\t*methodCalled = \"Node\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitTerminalNode: func(TerminalNode) error {\n\t\t\t*methodCalled = \"TerminalNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitCompositeNode: func(CompositeNode) error {\n\t\t\t*methodCalled = \"CompositeNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitRuneNode: func(*RuneNode) error {\n\t\t\t*methodCalled = \"*RuneNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitEmptyDeclNode: func(*EmptyDeclNode) error {\n\t\t\t*methodCalled = \"*EmptyDeclNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitOptionNode: func(*OptionNode) error {\n\t\t\t*methodCalled = \"*OptionNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitOptionNameNode: func(*OptionNameNode) error {\n\t\t\t*methodCalled = \"*OptionNameNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitFieldReferenceNode: func(*FieldReferenceNode) error {\n\t\t\t*methodCalled = \"*FieldReferenceNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitCompactOptionsNode: func(*CompactOptionsNode) error {\n\t\t\t*methodCalled = \"*CompactOptionsNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitExtensionRangeNode: func(*ExtensionRangeNode) error {\n\t\t\t*methodCalled = \"*ExtensionRangeNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitRangeNode: func(*RangeNode) error {\n\t\t\t*methodCalled = \"*RangeNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitReservedNode: func(*ReservedNode) error {\n\t\t\t*methodCalled = \"*ReservedNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitServiceNode: func(*ServiceNode) error {\n\t\t\t*methodCalled = \"*ServiceNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitRPCNode: func(*RPCNode) error {\n\t\t\t*methodCalled = \"*RPCNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitRPCTypeNode: func(*RPCTypeNode) error {\n\t\t\t*methodCalled = \"*RPCTypeNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitValueNode: func(ValueNode) error {\n\t\t\t*methodCalled = \"ValueNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitStringValueNode: func(StringValueNode) error {\n\t\t\t*methodCalled = \"StringValueNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitStringLiteralNode: func(*StringLiteralNode) error {\n\t\t\t*methodCalled = \"*StringLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitCompoundStringLiteralNode: func(*CompoundStringLiteralNode) error {\n\t\t\t*methodCalled = \"*CompoundStringLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitIntValueNode: func(IntValueNode) error {\n\t\t\t*methodCalled = \"IntValueNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitUintLiteralNode: func(*UintLiteralNode) error {\n\t\t\t*methodCalled = \"*UintLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitPositiveUintLiteralNode: func(*PositiveUintLiteralNode) error {\n\t\t\t*methodCalled = \"*PositiveUintLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitNegativeIntLiteralNode: func(*NegativeIntLiteralNode) error {\n\t\t\t*methodCalled = \"*NegativeIntLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitFloatValueNode: func(FloatValueNode) error {\n\t\t\t*methodCalled = \"FloatValueNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitFloatLiteralNode: func(*FloatLiteralNode) error {\n\t\t\t*methodCalled = \"*FloatLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitSpecialFloatLiteralNode: func(*SpecialFloatLiteralNode) error {\n\t\t\t*methodCalled = \"*SpecialFloatLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitSignedFloatLiteralNode: func(*SignedFloatLiteralNode) error {\n\t\t\t*methodCalled = \"*SignedFloatLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitArrayLiteralNode: func(*ArrayLiteralNode) error {\n\t\t\t*methodCalled = \"*ArrayLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitMessageLiteralNode: func(*MessageLiteralNode) error {\n\t\t\t*methodCalled = \"*MessageLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitMessageFieldNode: func(*MessageFieldNode) error {\n\t\t\t*methodCalled = \"*MessageFieldNode\"\n\t\t\treturn nil\n\t\t},\n\t}\n\tothers := []*SimpleVisitor{\n\t\t{\n\t\t\tDoVisitEnumNode: v.DoVisitEnumNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitEnumValueNode: v.DoVisitEnumValueNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitFieldDeclNode: v.DoVisitFieldDeclNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitFieldNode: v.DoVisitFieldNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitGroupNode: v.DoVisitGroupNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitOneofNode: v.DoVisitOneofNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitMapTypeNode: v.DoVisitMapTypeNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitMapFieldNode: v.DoVisitMapFieldNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitFileNode: v.DoVisitFileNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitSyntaxNode: v.DoVisitSyntaxNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitImportNode: v.DoVisitImportNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitPackageNode: v.DoVisitPackageNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitIdentValueNode: v.DoVisitIdentValueNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitIdentNode: v.DoVisitIdentNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitCompoundIdentNode: v.DoVisitCompoundIdentNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitKeywordNode: v.DoVisitKeywordNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitMessageDeclNode: v.DoVisitMessageDeclNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitMessageNode: v.DoVisitMessageNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitExtendNode: v.DoVisitExtendNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitNode: v.DoVisitNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitTerminalNode: v.DoVisitTerminalNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitCompositeNode: v.DoVisitCompositeNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitRuneNode: v.DoVisitRuneNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitEmptyDeclNode: v.DoVisitEmptyDeclNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitOptionNode: v.DoVisitOptionNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitOptionNameNode: v.DoVisitOptionNameNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitFieldReferenceNode: v.DoVisitFieldReferenceNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitCompactOptionsNode: v.DoVisitCompactOptionsNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitExtensionRangeNode: v.DoVisitExtensionRangeNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitRangeNode: v.DoVisitRangeNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitReservedNode: v.DoVisitReservedNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitServiceNode: v.DoVisitServiceNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitRPCNode: v.DoVisitRPCNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitRPCTypeNode: v.DoVisitRPCTypeNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitValueNode: v.DoVisitValueNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitStringValueNode: v.DoVisitStringValueNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitStringLiteralNode: v.DoVisitStringLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitCompoundStringLiteralNode: v.DoVisitCompoundStringLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitIntValueNode: v.DoVisitIntValueNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitUintLiteralNode: v.DoVisitUintLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitPositiveUintLiteralNode: v.DoVisitPositiveUintLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitNegativeIntLiteralNode: v.DoVisitNegativeIntLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitFloatValueNode: v.DoVisitFloatValueNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitFloatLiteralNode: v.DoVisitFloatLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitSpecialFloatLiteralNode: v.DoVisitSpecialFloatLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitSignedFloatLiteralNode: v.DoVisitSignedFloatLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitArrayLiteralNode: v.DoVisitArrayLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitMessageLiteralNode: v.DoVisitMessageLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitMessageFieldNode: v.DoVisitMessageFieldNode,\n\t\t},\n\t}\n\treturn v, others\n}", "func _[T interface{ ~func(string) int }](f T) int {\n\treturn f(\"hello\")\n}", "func VisitedFunctions(prog *ssa.Program, packs []*ssa.Package, isOvl isOverloaded) (seen, usesGR map[*ssa.Function]bool) {\n\tvisit := visitor{\n\t\tprog: prog,\n\t\tpacks: packs, // new\n\t\tseen: make(map[*ssa.Function]bool),\n\t\tusesGR: make(map[*ssa.Function]bool),\n\t}\n\tvisit.program(isOvl)\n\t//fmt.Printf(\"DEBUG VisitedFunctions.usesGR %v\\n\", visit.usesGR)\n\t//fmt.Printf(\"DEBUG VisitedFunctions.seen %v\\n\", visit.seen)\n\treturn visit.seen, visit.usesGR\n}", "func (h *MapInt16ToInt32) Visit(fn func(int16, int32)) {\n\tfor _, e := range h.slots {\n\t\tfor ; e != nil; e = e.next {\n\t\t\tfn(e.k, e.v)\n\t\t}\n\t}\n}", "func (x *fastReflection_Evidence) Interface() protoreflect.ProtoMessage {\n\treturn (*Evidence)(x)\n}", "func (f *functionQuery) Evaluate(t iterator) interface{} {\n\treturn f.Func(f.Input, t)\n}", "func Visit(node Node, visitor func(node Node, next func() error) error) error {\n\tif reflect.ValueOf(node).IsNil() { // Workaround for Go's typed nil interfaces.\n\t\treturn nil\n\t}\n\treturn visitor(node, func() error {\n\t\tfor _, child := range node.children() {\n\t\t\tif err := Visit(child, visitor); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n}", "func (x *fastReflection_Output) Interface() protoreflect.ProtoMessage {\n\treturn (*Output)(x)\n}", "func (i I) I() I { return i }", "func (rf RendererFunc) Render(w io.Writer, v interface{}) error { return rf(w, v) }", "func (v Variable) Accept(interpreter *Interpreter) Object {\n\treturn interpreter.visitVariable(v)\n}", "func (*Base) Function(p ASTPass, node *ast.Function, ctx Context) {\n\tp.Parameters(p, &node.ParenLeftFodder, &node.Parameters, &node.ParenRightFodder, ctx)\n\tp.Visit(p, &node.Body, ctx)\n}", "func (t *FileTree) VisitorFn(fn func(file.Reference)) func(node.Node) {\n\treturn func(node node.Node) {\n\t\tfn(t.fileByPathID(node.ID()))\n\t}\n}", "func execNewInterface(_ int, p *gop.Context) {\n\targs := p.GetArgs(2)\n\tret := types.NewInterface(args[0].([]*types.Func), args[1].([]*types.Named))\n\tp.Ret(2, ret)\n}", "func (h *MapInt16ToUint8) Visit(fn func(int16, uint8)) {\n\tfor _, e := range h.slots {\n\t\tfor ; e != nil; e = e.next {\n\t\t\tfn(e.k, e.v)\n\t\t}\n\t}\n}", "func FuncInterfaceCompatible2(_ io.Writer) {}", "func (h *MapInt16ToInt16) Visit(fn func(int16, int16)) {\n\tfor _, e := range h.slots {\n\t\tfor ; e != nil; e = e.next {\n\t\t\tfn(e.k, e.v)\n\t\t}\n\t}\n}", "func Function(sig *CallSignature) Type {\n\treturn Type{functionImpl{sig: sig}}\n}", "func (mi *ModifierInvocation) Visit(ctx *parser.ModifierInvocationContext) {\n\tmi.Start = ctx.GetStart()\n\tmi.Stop = ctx.GetStop()\n\tmi.Identifier = ctx.Identifier().GetText()\n\n\tif ctx.ExpressionList() != nil {\n\t\texpList := ctx.ExpressionList().(*parser.ExpressionListContext)\n\n\t\tfor _, exprCtx := range expList.AllExpression() {\n\t\t\texpression := NewExpression()\n\t\t\texpression.Visit(exprCtx.(*parser.ExpressionContext))\n\n\t\t\tmi.Expressions = append(mi.Expressions, expression)\n\t\t}\n\t}\n}", "func (x *fastReflection_Input) Interface() protoreflect.ProtoMessage {\n\treturn (*Input)(x)\n}", "func (a Assign) Accept(interpreter *Interpreter) Object {\n\treturn interpreter.visitAssign(a)\n}", "func (h *MapInt16ToUint) Visit(fn func(int16, uint)) {\n\tfor _, e := range h.slots {\n\t\tfor ; e != nil; e = e.next {\n\t\t\tfn(e.k, e.v)\n\t\t}\n\t}\n}", "func (_Contract *ContractCallerSession) InterfaceImplementer(node [32]byte, interfaceID [4]byte) (common.Address, error) {\n\treturn _Contract.Contract.InterfaceImplementer(&_Contract.CallOpts, node, interfaceID)\n}", "func (h *MapInt16ToUint32) Visit(fn func(int16, uint32)) {\n\tfor _, e := range h.slots {\n\t\tfor ; e != nil; e = e.next {\n\t\t\tfn(e.k, e.v)\n\t\t}\n\t}\n}", "func (g Grouping) Accept(interpreter *Interpreter) Object {\n\treturn interpreter.visitGrouping(g)\n}", "func Interface(ifname string) func(*NetworkTap) error {\n\treturn func(filterdev *NetworkTap) error {\n\t\terr := filterdev.SetInterface(int(filterdev.device.Fd()), ifname)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n}", "func (f *FlagSet) Visit(fn func(*Flag)) {\n\tfor _, flag := range sortFlags(f.actual) {\n\t\tfn(flag)\n\t}\n}", "func (_Contract *ContractFilterer) FilterInterfaceChanged(opts *bind.FilterOpts, node [][32]byte, interfaceID [][4]byte) (*ContractInterfaceChangedIterator, error) {\n\n\tvar nodeRule []interface{}\n\tfor _, nodeItem := range node {\n\t\tnodeRule = append(nodeRule, nodeItem)\n\t}\n\tvar interfaceIDRule []interface{}\n\tfor _, interfaceIDItem := range interfaceID {\n\t\tinterfaceIDRule = append(interfaceIDRule, interfaceIDItem)\n\t}\n\n\tlogs, sub, err := _Contract.contract.FilterLogs(opts, \"InterfaceChanged\", nodeRule, interfaceIDRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ContractInterfaceChangedIterator{contract: _Contract.contract, event: \"InterfaceChanged\", logs: logs, sub: sub}, nil\n}", "func (f *FlagSet) Visit(fn func(*Flag)) {\n\tif len(f.actual) == 0 {\n\t\treturn\n\t}\n\n\tvar flags []*Flag\n\tif f.SortFlags {\n\t\tif len(f.actual) != len(f.sortedActual) {\n\t\t\tf.sortedActual = sortFlags(f.actual)\n\t\t}\n\t\tflags = f.sortedActual\n\t} else {\n\t\tflags = f.orderedActual\n\t}\n\n\tfor _, flag := range flags {\n\t\tfn(flag)\n\t}\n}", "func (x *fastReflection_EventRetire) Interface() protoreflect.ProtoMessage {\n\treturn (*EventRetire)(x)\n}", "func execmInterfaceMethod(_ int, p *gop.Context) {\n\targs := p.GetArgs(2)\n\tret := args[0].(*types.Interface).Method(args[1].(int))\n\tp.Ret(2, ret)\n}", "func (lambda PresenterFunc) Render(message interface{}) error {\n\treturn lambda(message)\n}", "func underlyingInterface(w v1alpha1.ExecutableWorkflow, node v1alpha1.ExecutableNode) (*core.TypedInterface, error) {\n\tiface := &core.TypedInterface{}\n\tif node.GetTaskID() != nil {\n\t\tt, err := w.GetTask(*node.GetTaskID())\n\t\tif err != nil {\n\t\t\t// Should never happen\n\t\t\treturn nil, err\n\t\t}\n\n\t\tiface.Outputs = t.CoreTask().GetInterface().Outputs\n\t} else if wfNode := node.GetWorkflowNode(); wfNode != nil {\n\t\tif wfRef := wfNode.GetSubWorkflowRef(); wfRef != nil {\n\t\t\tt := w.FindSubWorkflow(*wfRef)\n\t\t\tif t == nil {\n\t\t\t\t// Should never happen\n\t\t\t\treturn nil, errors.Errorf(errors.IllegalStateError, node.GetID(), \"Couldn't find subworkflow [%v].\", wfRef)\n\t\t\t}\n\n\t\t\tiface.Outputs = t.GetOutputs().VariableMap\n\t\t} else {\n\t\t\treturn nil, errors.Errorf(errors.IllegalStateError, node.GetID(), \"Unknown interface\")\n\t\t}\n\t} else if node.GetBranchNode() != nil {\n\t\tif ifBlock := node.GetBranchNode().GetIf(); ifBlock != nil && ifBlock.GetThenNode() != nil {\n\t\t\tbn, found := w.GetNode(*ifBlock.GetThenNode())\n\t\t\tif !found {\n\t\t\t\treturn nil, errors.Errorf(errors.IllegalStateError, node.GetID(), \"Couldn't find branch node [%v]\",\n\t\t\t\t\t*ifBlock.GetThenNode())\n\t\t\t}\n\n\t\t\treturn underlyingInterface(w, bn)\n\t\t}\n\n\t\treturn nil, errors.Errorf(errors.IllegalStateError, node.GetID(), \"Empty branch detected.\")\n\t} else {\n\t\treturn nil, errors.Errorf(errors.IllegalStateError, node.GetID(), \"Unknown interface.\")\n\t}\n\n\treturn iface, nil\n}" ]
[ "0.60175425", "0.5906299", "0.59027874", "0.5845828", "0.5825935", "0.5819577", "0.5819577", "0.580104", "0.5785162", "0.5777933", "0.5703701", "0.56876904", "0.56876904", "0.5627525", "0.5536116", "0.549273", "0.54699755", "0.54699755", "0.5463964", "0.5434355", "0.5402595", "0.5397546", "0.53573", "0.5347492", "0.5327222", "0.5282537", "0.52577364", "0.52453923", "0.5236527", "0.51695585", "0.5169153", "0.51691335", "0.5150039", "0.5100336", "0.5098669", "0.5096844", "0.5092909", "0.5025056", "0.5013577", "0.5006477", "0.4981647", "0.4977761", "0.49491403", "0.49481136", "0.49135387", "0.4902572", "0.4902572", "0.48868135", "0.48798364", "0.48651856", "0.48479375", "0.48444048", "0.48257497", "0.48061544", "0.47927007", "0.4789761", "0.47619694", "0.47598982", "0.47561255", "0.47533038", "0.47495225", "0.47481802", "0.47395724", "0.47342122", "0.47313806", "0.4717683", "0.47168908", "0.46870023", "0.46790814", "0.4676445", "0.4658523", "0.46575442", "0.46539652", "0.46523747", "0.46460128", "0.46418434", "0.46396607", "0.46377394", "0.46143577", "0.46142966", "0.46093234", "0.46074614", "0.46003863", "0.45997134", "0.45860335", "0.4582408", "0.4575352", "0.45601138", "0.45586434", "0.45583653", "0.4555357", "0.45495585", "0.4543396", "0.45388633", "0.4532948", "0.45328376", "0.45314434", "0.45284674", "0.45211044" ]
0.54164505
21
/ It returns a value type ARRAY.
func (this *ObjectPairs) Type() value.Type { return value.ARRAY }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (v Value) Array() []Value {\n\tif v.Typ == '*' && !v.Null {\n\t\treturn v.ArrayV\n\t}\n\treturn nil\n}", "func (v Value) AsArray() []Value {\n\treturn v.iface.([]Value)\n}", "func ArrayValue(vals []Value) Value { return Value{Typ: '*', ArrayV: vals} }", "func (v *Value) Array() ([]Value, error) {\n\tif v.kind == kindArray {\n\t\treturn v.arrayContent, nil\n\t}\n\treturn nil, errors.New(\"JSON value is not an array\")\n}", "func (array Array) Values() []interface{} {\n\treturn array\n}", "func (value *Value) ArrayValue() []*Value {\n\tif value.valueType == Array {\n\t\treturn value.value.([]*Value)\n\t}\n\n\tpanic(fmt.Sprintf(\"requested array value but found %T type\", value.value))\n}", "func (this *ObjectValues) Type() value.Type { return value.ARRAY }", "func (this *ObjectValues) Type() value.Type { return value.ARRAY }", "func (v *ValueGetter) Array() (ss []string) {\n\treturn v.Strings()\n}", "func Array(vi interface{}) *ArrayValue {\n\tv := reflect.ValueOf(vi)\n\tif !v.IsValid() {\n\t\tpanic(fmt.Errorf(\"bun: Array(nil)\"))\n\t}\n\n\treturn &ArrayValue{\n\t\tv: v,\n\n\t\tappend: arrayAppender(v.Type()),\n\t\tscan: arrayScanner(v.Type()),\n\t}\n}", "func Array(value interface{}) dgo.Array {\n\tswitch value := value.(type) {\n\tcase dgo.Array:\n\t\treturn value.FrozenCopy().(dgo.Array)\n\tcase dgo.Iterable:\n\t\treturn arrayFromIterator(value.Len(), value.Each)\n\tcase []dgo.Value:\n\t\tarr := make([]dgo.Value, len(value))\n\t\tfor i := range value {\n\t\t\te := value[i]\n\t\t\tif f, ok := e.(dgo.Freezable); ok {\n\t\t\t\te = f.FrozenCopy()\n\t\t\t} else if e == nil {\n\t\t\t\te = Nil\n\t\t\t}\n\t\t\tarr[i] = e\n\t\t}\n\t\treturn &array{slice: arr, frozen: true}\n\tcase reflect.Value:\n\t\treturn ValueFromReflected(value).(dgo.Array)\n\tdefault:\n\t\treturn ValueFromReflected(reflect.ValueOf(value)).(dgo.Array)\n\t}\n}", "func Array(arr Arr) Val {\n\tif arr == nil {\n\t\treturn Val{t: bsontype.Null}\n\t}\n\treturn Val{t: bsontype.Array, primitive: arr}\n}", "func ArrayValue(a []Value) Value {\n\treturn Value{iface: a}\n}", "func (this *ObjectInnerValues) Type() value.Type { return value.ARRAY }", "func (v *JSONValue) Array() []*JSONValue {\n\tv.parseArray()\n\treturn v.valArray\n}", "func (data *Data) Array(s ...string) []interface{} {\n\treturn data.Interface(s...).([]interface{})\n}", "func ValueArrayOf(items ...Value) ValueArray {\n\t// ValueArrayOf() with no parameters will pass nil rather than a zero-length slice; logically we\n\t// still want it to create a non-nil array.\n\tif items == nil {\n\t\treturn ValueArray{emptyArray}\n\t}\n\treturn CopyValueArray(items)\n}", "func (e *Expect) Array(value []interface{}) *Array {\n\topChain := e.chain.enter(\"Array()\")\n\tdefer opChain.leave()\n\n\treturn newArray(opChain, value)\n}", "func Array(k string, v valf.ValueArray) Field {\n\treturn Field{Key: k, Value: valf.Array(v)}\n}", "func (this *ExDomain) Values_asSlice() []int {\n\treturn Keys_MapIntToBool(this.GetValues())\n}", "func Values(values []interface{}) dgo.Array {\n\treturn &array{slice: valueSlice(values, true), frozen: true}\n}", "func AsArray(dt DataType) *Array {\n\tswitch t := dt.(type) {\n\tcase *UserTypeExpr:\n\t\treturn AsArray(t.Type)\n\tcase *ResultTypeExpr:\n\t\treturn AsArray(t.Type)\n\tcase *Array:\n\t\treturn t\n\tdefault:\n\t\treturn nil\n\t}\n}", "func (i GinBindType) ValueSlice() []GinBindType {\n\treturn _GinBindTypeValues\n}", "func Array(dest interface{}) interface {\n\tsql.Scanner\n\tdriver.Valuer\n} {\n\tswitch dest := dest.(type) {\n\tcase *[]GraphId:\n\t\treturn (*graphIdArray)(dest)\n\tcase []GraphId:\n\t\treturn (*graphIdArray)(&dest)\n\n\tcase *[]BasicVertex:\n\t\treturn (*basicVertexArray)(dest)\n\n\tcase *[]BasicEdge:\n\t\treturn (*basicEdgeArray)(dest)\n\t}\n\n\treturn elementArray{dest}\n}", "func Array(args ...interface{}) []interface{} {\n\treturn []interface{}{args}\n}", "func (a GenericArray) Value() (driver.Value, error) {\n\tif a.A == nil {\n\t\treturn nil, nil\n\t}\n\n\trv := reflect.ValueOf(a.A)\n\n\tswitch rv.Kind() {\n\tcase reflect.Slice:\n\t\tif rv.IsNil() {\n\t\t\treturn nil, nil\n\t\t}\n\tcase reflect.Array:\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"pq: Unable to convert %T to array\", a.A)\n\t}\n\n\tif n := rv.Len(); n > 0 {\n\t\t// There will be at least two curly brackets, N bytes of values,\n\t\t// and N-1 bytes of delimiters.\n\t\tb := make([]byte, 0, 1+2*n)\n\n\t\tb, _, err := appendArray(b, rv, n)\n\t\treturn string(b), err\n\t}\n\n\treturn \"{}\", nil\n}", "func (l *ListaXTienda) GetArray() []XTiendas{\n\ta := make([]XTiendas, l.len)\n\ti := 0\n\tAux := l.Inicio\n\tfor Aux != nil{\n\t\ta[i] = Aux.Dato\n\t\ti++\n\t\tAux = Aux.Siguiente\n\t}\n\treturn a\n}", "func Array() *A {\n\treturn &A{}\n}", "func (v AnnotationValue) AsSlice() []AnnotationValue {\n\treturn v.Value.([]AnnotationValue)\n}", "func (c *Container) array() []uint16 {\n\tif c == nil {\n\t\tpanic(\"attempt to read a nil container's array\")\n\t}\n\tif roaringParanoia {\n\t\tif c.typeID != ContainerArray {\n\t\t\tpanic(\"attempt to read non-array's array\")\n\t\t}\n\t}\n\treturn (*[1 << 16]uint16)(unsafe.Pointer(c.pointer))[:c.len:c.cap]\n}", "func ToArray(\n\tvalue *model.Value,\n) (*model.Value, error) {\n\tswitch {\n\tcase value == nil:\n\t\treturn nil, errors.New(\"unable to coerce null to array\")\n\tcase value.Array != nil:\n\t\treturn value, nil\n\tcase value.Boolean != nil:\n\t\treturn nil, fmt.Errorf(\"unable to coerce boolean to array: %w\", errIncompatibleTypes)\n\tcase value.Dir != nil:\n\t\treturn nil, fmt.Errorf(\"unable to coerce dir to array: %w\", errIncompatibleTypes)\n\tcase value.File != nil:\n\t\tfileBytes, err := os.ReadFile(*value.File)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to coerce file to array: %w\", err)\n\t\t}\n\t\tvalueArray := new([]interface{})\n\t\terr = json.Unmarshal([]byte(fileBytes), valueArray)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to coerce file to array: %w\", err)\n\t\t}\n\t\treturn &model.Value{Array: valueArray}, nil\n\tcase value.Number != nil:\n\t\treturn nil, fmt.Errorf(\"unable to coerce number to array: %w\", errIncompatibleTypes)\n\tcase value.Socket != nil:\n\t\treturn nil, fmt.Errorf(\"unable to coerce socket to array: %w\", errIncompatibleTypes)\n\tcase value.String != nil:\n\t\tvalueArray := new([]interface{})\n\t\terr := json.Unmarshal([]byte(*value.String), valueArray)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to coerce string to array: %w\", err)\n\t\t}\n\t\treturn &model.Value{Array: valueArray}, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unable to coerce '%+v' to array\", value)\n\t}\n}", "func (v *Value) Slice() []interface{} {\n\tsize := (int)(C.value_array_size(v.value))\n\tval := make([]interface{}, size)\n\n\tC.value_array_reset(v.value)\n\n\tfor i := 0; i < size; i++ {\n\t\tt := &Value{value: C.value_array_next_get(v.value)}\n\n\t\tval[i] = t.Interface()\n\t\tt.Destroy()\n\t}\n\n\treturn val\n}", "func NewValueArray(array []Value) *ValueArray {\n\t// return &ValueArray{*NewListerValue(valueList(array))}\n\tres := ValueArray(array)\n\treturn &res\n}", "func (a AttributeValue) ArrayVal() AnyValueArray {\n\tarr := a.orig.GetArrayValue()\n\tif arr == nil {\n\t\treturn NewAnyValueArray()\n\t}\n\treturn newAnyValueArray(&arr.Values)\n}", "func (this *ObjectInnerPairs) Type() value.Type { return value.ARRAY }", "func (j *JSONElement) Array() []string {\n\tvalues := make([]string, 0)\n\tresults := j.Result.Array() //gjson.GetBytes(j.Response.Body, jpath).Array()\n\tfor _, result := range results {\n\t\tvalues = append(values, result.String())\n\t}\n\treturn values\n}", "func (s Section) ValueAsSlice(keyword string) []string {\n\t// TODO Implement Value\n\treturn nil\n}", "func (l *Lista) GetArray() []Tiendas{\n\ta := make([]Tiendas, l.len)\n\ti := 0\n\tAux := l.Inicio\n\tfor Aux != nil{\n\t\ta[i] = Aux.Dato\n\t\ti++\n\t\tAux = Aux.Siguiente\n\t}\n\treturn a\n}", "func (i GinJwtSignAlgorithm) ValueSlice() []GinJwtSignAlgorithm {\n\treturn _GinJwtSignAlgorithmValues\n}", "func (list *ArrayList) Values() []interface{} {\n\tnewE := make([]interface{}, list.size, list.size)\n\tcopy(newE, list.elements[:list.size])\n\treturn newE\n}", "func (a *ArrayObject) Value() interface{} {\n\treturn a.Elements\n}", "func NewArray(values []*Value) *Value {\n\treturn &Value{values, Array}\n}", "func sliceToScalarArray(v []any) (*gnmipb.ScalarArray, error) {\n\tarr := &gnmipb.ScalarArray{}\n\tfor _, e := range v {\n\t\ttv, err := value.FromScalar(e)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tarr.Element = append(arr.Element, tv)\n\t}\n\treturn arr, nil\n}", "func (s *stack) ToArray() (arr []interface{}) {\n\tarr = make([]interface{}, s.length)\n\tnode := s.top\n\tfor index := s.length - 1; index >= 0; index-- {\n\t\tarr[index] = node.value\n\t\tnode = node.prev\n\t}\n\treturn\n}", "func (s *Store) Values() []interface{} {\n\ts.access.RLock()\n\tdefer s.access.RUnlock()\n\n\tcpy := make([]interface{}, len(s.data))\n\ti := 0\n\tfor _, value := range s.data {\n\t\tcpy[i] = value\n\t\ti++\n\t}\n\treturn cpy\n}", "func ArrayValue(v Value) (*Array, bool) {\n\tif v.Type() != ArrayType {\n\t\treturn nil, false\n\t}\n\tval, ok := v.(*Array)\n\treturn val, ok\n}", "func Valueize(values ...reflect.Value) []reflect.Value {\n\treturn values\n}", "func ArrayValueFromArray(value []interface{}, dataType DataType) (interface{}, error) {\n\tarrValue := NewArrayValue(dataType)\n\tfor _, item := range value {\n\t\tif item == nil {\n\t\t\tarrValue.AddItem(nil)\n\t\t} else {\n\t\t\tif s, ok := item.(string); ok && len(s) == 0 {\n\t\t\t\tarrValue.AddItem(nil)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tval, err := ConvertValueForType(dataType, item)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tarrValue.AddItem(val)\n\t\t}\n\t}\n\treturn arrValue, nil\n}", "func NewArray() *Value {\n\t// TODO: think about size and capacity defaults\n\treturn &Value{kind: kindArray, arrayContent: make([]Value, 0)}\n}", "func (this *ObjectNames) Type() value.Type { return value.ARRAY }", "func (this *ObjectNames) Type() value.Type { return value.ARRAY }", "func (m *Value) Values() []xmlrpc.Value { return m.ValuesMock() }", "func (r *Ring) Values() []interface{} {\n\tif r.head == -1 {\n\t\treturn []interface{}{}\n\t}\n\tarr := make([]interface{}, 0, r.Capacity())\n\tfor i := 0; i < r.Capacity(); i++ {\n\t\tidx := r.mod(i + r.tail)\n\t\tarr = append(arr, r.get(idx))\n\t\tif idx == r.head {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn arr\n}", "func ConvertToArrayValue(dataType DataType, value interface{}) (interface{}, error) {\n\tswitch v := value.(type) {\n\tcase []interface{}:\n\t\treturn ArrayValueFromArray(v, GetElementDataType(dataType))\n\tcase string:\n\t\treturn ArrayValueFromString(v, GetElementDataType(dataType))\n\t}\n\treturn nil, errors.New(fmt.Sprintf(\"unknown data type %T\", value))\n}", "func (r *Decoder) Array() []byte {\n\tlength := r.VarInt()\n\tdata := r.Bytes(int(length))\n\treturn data\n}", "func Array(slice []interface{}, buf []byte) ([]byte, error) {\n\tvar comma bool\n\tbuf = append(buf, '[')\n\tvar err error\n\tfor i := 0; i < len(slice); i++ {\n\t\tif comma {\n\t\t\tbuf = append(buf, ',')\n\t\t}\n\t\tcomma = true\n\t\tbuf, err = Value(slice[i], buf)\n\t\tif err != nil {\n\t\t\treturn buf, err\n\t\t}\n\t}\n\treturn append(buf, ']'), nil\n}", "func (bst *BST) ToArray() []interface{} {\n\tvar result = make([]interface{}, 0)\n\tbst.Traverse(func(n *Node) bool {\n\t\tresult = append(result, n.Key)\n\t\treturn true\n\t})\n\n\treturn result\n}", "func (i SNSPlatformApplicationAttribute) ValueSlice() []SNSPlatformApplicationAttribute {\n\treturn _SNSPlatformApplicationAttributeValues\n}", "func (f *StringSlice) Value() []string {\n\treturn *f\n}", "func (b *Buffer) Values() interface{} {\n return b.buffer.Slice(0, b.idx).Interface()\n}", "func (f *Int64Slice) Value() []int64 {\n\treturn *f\n}", "func (j *JSONData) Array(path ...interface{}) ([]interface{}, error) {\n\tjson, err := j.get(path...)\n\treturn json.MustArray(), err\n}", "func (i SNSProtocol) ValueSlice() []SNSProtocol {\n\treturn _SNSProtocolValues\n}", "func (m *DomainCollectionResponse) GetValue()([]Domainable) {\n return m.value\n}", "func (ao *Array) Type() ObjectType { return ARRAY_OBJ }", "func (m *ApplicationCollectionResponse) GetValue()([]Applicationable) {\n return m.value\n}", "func (e ValuesResultArrayHashEntry) Value() calculation.ResultArray {\n\treturn e.value\n}", "func typeToArray(args ...DataType) (DataType, error) {\n\tif len(args) != 1 {\n\t\treturn nil, fmt.Errorf(\"Type.toArray expects exactly 1 argument\")\n\t}\n\n\tswitch object := args[0].(type) {\n\tcase *StringType:\n\t\tresult := []DataType{}\n\t\tfor _, k := range object.Value {\n\t\t\tresult = append(result, &StringType{Value: string(k)})\n\t\t}\n\n\t\treturn &ArrayType{Elements: result}, nil\n\tcase *IntegerType, *FloatType:\n\t\treturn &ArrayType{Elements: []DataType{object}}, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Type.toArray can't convert '%s' to Array\", object.Type())\n\t}\n}", "func (mat *T) Array() *[9]float64 {\n\treturn &[...]float64{\n\t\tmat[0][0], mat[0][1], mat[0][2],\n\t\tmat[1][0], mat[1][1], mat[1][2],\n\t\tmat[2][0], mat[2][1], mat[2][2],\n\t}\n}", "func (d *decoder) array(childKey string, value reflect.Value) error {\n\tglobal := d.getGlobalProvider()\n\tar := global.Get(childKey)\n\ta := ar.Value()\n\tav := reflect.ValueOf(a)\n\tif err := checkCollections(av.Kind(), value.Kind()); err != nil && ar.Value() != nil {\n\t\treturn err\n\t}\n\n\tvalueType := value.Type()\n\n\t// start looking for child values.\n\telementType := derefType(valueType).Elem()\n\tchildKey = addSeparator(childKey)\n\n\tfor ai := 0; ai < value.Len(); ai++ {\n\t\tarrayKey := childKey + strconv.Itoa(ai)\n\n\t\t// Iterate until we find first missing value.\n\t\tif v2 := global.Get(arrayKey); v2.Value() != nil {\n\t\t\tif err := checkCollections(reflect.TypeOf(v2.value).Kind(), elementType.Kind()); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tval := reflect.New(elementType).Elem()\n\n\t\t\t// Unmarshal current element.\n\t\t\tif err := d.unmarshal(arrayKey, val, \"\"); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvalue.Index(ai).Set(val)\n\t\t} else if value.Index(ai).Kind() == reflect.Struct {\n\t\t\tif err := d.valueStruct(arrayKey, value.Index(ai).Addr().Interface()); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (a ValueArray) AsValue() Value {\n\tif a.data == nil {\n\t\treturn Null()\n\t}\n\treturn Value{valueType: ArrayType, arrayValue: a}\n}", "func (l *ListaPro) GetArray() []Producto{\n\ta := make([]Producto, l.len)\n\ti := 0\n\tAux := l.Inicio\n\tfor Aux != nil{\n\t\ta[i] = Aux.Dato\n\t\ti++\n\t\tAux = Aux.Siguiente\n\t}\n\treturn a\n}", "func (pb *PageBuffer) Values() interface{} {\n offset := pb.pageOffset(pb.page_no)\n return pb.buffer.Slice(offset, offset + pb.idx).Interface()\n}", "func (m *OpenTypeExtensionCollectionResponse) GetValue()([]OpenTypeExtensionable) {\n return m.value\n}", "func (s *Slice) Value() Type {\n\treturn s.basic\n}", "func (i SNSSubscribeAttribute) ValueSlice() []SNSSubscribeAttribute {\n\treturn _SNSSubscribeAttributeValues\n}", "func (a IntArray) Value() (driver.Value, error) {\n\tvar strs []string\n\tfor _, i := range a {\n\t\tstrs = append(strs, strconv.FormatInt(int64(i), 10))\n\t}\n\treturn \"{\" + strings.Join(strs, \",\") + \"}\", nil\n}", "func (ki *KernelInfo) ToArray() [][]float64 {\n\tvar values [][]float64\n\n\tcount := 0\n\tcValues := (*[1 << 10]C.double)(unsafe.Pointer(ki.info.values))\n\n\tfor y := C.size_t(0); y < ki.info.height; y++ {\n\t\trowValues := make([]float64, ki.info.width)\n\t\tfor x := C.size_t(0); x < ki.info.width; x++ {\n\t\t\trowValues[x] = float64(cValues[count])\n\t\t\tcount++\n\t\t}\n\t\tvalues = append(values, rowValues)\n\t}\n\n\truntime.KeepAlive(ki)\n\treturn values\n}", "func (nData *NaiveData) Value() []gotypes.Value {\n\treturn nData.Val\n}", "func (_ Always) Values() []int {\n\tvar answer []int\n\treturn answer\n}", "func Values(v interface{}) []interface{} {\n\treturn New(v).Values()\n}", "func toValueSlice(slice reflect.Value) []reflect.Value {\n\tsliceCopy := reflect.MakeSlice(slice.Type(), slice.Len(), slice.Len())\n\treflect.Copy(sliceCopy, slice)\n\tvalues := make([]reflect.Value, sliceCopy.Len())\n\tfor i := 0; i < sliceCopy.Len(); i++ {\n\t\tvalues[i] = sliceCopy.Index(i)\n\t}\n\treturn values\n}", "func (q *PriorityQueue) Values() []interface{} {\n\tsize := q.data.Size()\n\tvalues := q.data.Values()\n\tres := make([]interface{}, size)\n\tfor i := 0; i < size; i++ {\n\t\tres[i] = values[i].(*pqItem).value\n\t}\n\treturn res\n}", "func (c *AdapterMemory) Values(ctx context.Context) ([]interface{}, error) {\n\treturn c.data.Values()\n}", "func (a ArrayVal) ToSlice() []any {\n\tarr := make([]any, len(a))\n\tfor i, elem := range a {\n\t\tswitch actual := elem.(type) {\n\t\tcase ArrayVal:\n\t\t\tarr[i] = actual.ToSlice()\n\t\tcase MapVal:\n\t\t\tarr[i] = actual.ToMap()\n\t\tdefault:\n\t\t\tarr[i] = actual\n\t\t}\n\t}\n\treturn arr\n}", "func arrayOf(\n\tref ast.ResolvableTypeReference, bounds []int32,\n) (ast.ResolvableTypeReference, error) {\n\t// If the reference is a statically known type, then return an array type,\n\t// rather than an array type reference.\n\tif typ, ok := ast.GetStaticallyKnownType(ref); ok {\n\t\tif err := types.CheckArrayElementType(typ); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn types.MakeArray(typ), nil\n\t}\n\treturn &ast.ArrayTypeReference{ElementType: ref}, nil\n}", "func (m *IdentitySetCollectionResponse) GetValue()([]IdentitySetable) {\n val, err := m.GetBackingStore().Get(\"value\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]IdentitySetable)\n }\n return nil\n}", "func (c *ColDecimal256) Array() *ColArr[Decimal256] {\n\treturn &ColArr[Decimal256]{\n\t\tData: c,\n\t}\n}", "func (s SExp) Value() []Value {\n\treturn s.values\n}", "func (ArrayJobDependency) Values() []ArrayJobDependency {\n\treturn []ArrayJobDependency{\n\t\t\"N_TO_N\",\n\t\t\"SEQUENTIAL\",\n\t}\n}", "func (d *adapterMemoryData) Values() ([]interface{}, error) {\n\td.mu.RLock()\n\tvar (\n\t\tindex = 0\n\t\tvalues = make([]interface{}, len(d.data))\n\t)\n\tfor _, v := range d.data {\n\t\tif !v.IsExpired() {\n\t\t\tvalues[index] = v.v\n\t\t\tindex++\n\t\t}\n\t}\n\td.mu.RUnlock()\n\treturn values, nil\n}", "func (c *Capture) Values() []interface{} {\n\tret := make([]interface{}, 8)\n\n\tret[0] = c.Timestamp\n\tret[1] = c.ColIP.String()\n\tret[2] = c.PeerIP.String()\n\tret[3] = pq.Array(c.ASPath)\n\tret[4] = c.NextHop.String()\n\tret[5] = c.Origin\n\n\tadvArr := util.PrefixesToPQArray(c.Advertised)\n\twdrArr := util.PrefixesToPQArray(c.Withdrawn)\n\tret[6] = advArr\n\tret[7] = wdrArr\n\n\treturn ret\n}", "func (nvp *NameValues) ToInterfaceArray() []interface{} {\n\treturn NameValuesToInterfaceArray(*nvp)\n}", "func ToArray(head *Node) (ret []int) {\n\tfor head != nil {\n\t\tret = append(ret, head.Val)\n\t\thead = head.Next\n\t}\n\treturn\n}", "func (c *ColDecimal64) Array() *ColArr[Decimal64] {\n\treturn &ColArr[Decimal64]{\n\t\tData: c,\n\t}\n}", "func (c *ColDecimal32) Array() *ColArr[Decimal32] {\n\treturn &ColArr[Decimal32]{\n\t\tData: c,\n\t}\n}", "func AsSlice(v interface{}) []interface{} {\n\tif v == nil {\n\t\treturn []interface{}{}\n\t}\n\tr := AsValueRef(reflect.ValueOf(v))\n\tswitch r.Kind() {\n\tcase reflect.Slice, reflect.Array:\n\t\tres := make([]interface{}, r.Len())\n\t\tfor i := 0; i < r.Len(); i++ {\n\t\t\tres[i] = r.Index(i).Interface()\n\t\t}\n\t\treturn res\n\tcase reflect.Map:\n\t\tres := make([]interface{}, r.Len())\n\t\tfor i, k := range r.MapKeys() {\n\t\t\tres[i] = k.Interface()\n\t\t}\n\t\treturn res\n\tcase reflect.Struct:\n\t\tt := r.Type()\n\t\tres := make([]string, t.NumField())\n\t\tfor i := 0; i < t.NumField(); i++ {\n\t\t\tres[i] = t.Field(i).Name\n\t\t}\n\t}\n\treturn []interface{}{v}\n}", "func (d *Document) Array() Node {\n\tid := uint(len(d.nodes))\n\tn := d.grow()\n\tn.reset(vArray|infRoot, \"\", n.values[:0])\n\treturn d.Node(id)\n}", "func ValueArrayBuild() *ValueArrayBuilder {\n\treturn &ValueArrayBuilder{}\n}" ]
[ "0.7823326", "0.7585927", "0.7475762", "0.7281528", "0.71981394", "0.7158558", "0.7132027", "0.7132027", "0.71263963", "0.7104742", "0.7050486", "0.7032845", "0.7031735", "0.6985119", "0.6861485", "0.68375707", "0.6759842", "0.6657196", "0.6643962", "0.66232395", "0.6600766", "0.65097433", "0.6504333", "0.64955777", "0.64901286", "0.6441535", "0.63992923", "0.63822573", "0.6332669", "0.63269454", "0.6320884", "0.6317883", "0.63138384", "0.63040704", "0.6301502", "0.6259327", "0.62251675", "0.62080675", "0.6196695", "0.61880916", "0.61857563", "0.61797464", "0.61529905", "0.6148011", "0.6112893", "0.6106889", "0.61055607", "0.6087107", "0.6084833", "0.60723245", "0.60723245", "0.6060866", "0.60565245", "0.6052801", "0.604245", "0.6021018", "0.60050684", "0.5991607", "0.59909886", "0.5988211", "0.5987756", "0.59819806", "0.5977973", "0.5971801", "0.59703255", "0.5954528", "0.59440994", "0.5940089", "0.5935538", "0.5924608", "0.5908911", "0.5904212", "0.58768535", "0.5873293", "0.5857427", "0.584686", "0.5845891", "0.58312666", "0.5827747", "0.5813263", "0.5805148", "0.5801441", "0.580016", "0.5799163", "0.579483", "0.57909757", "0.57673156", "0.57636917", "0.5759947", "0.57566315", "0.5756271", "0.5738362", "0.5736533", "0.573351", "0.5732079", "0.5730702", "0.57198685", "0.5710347", "0.5709655" ]
0.62758046
36
/ Calls the Eval method for unary functions and passes in the receiver, current item and current context.
func (this *ObjectPairs) Evaluate(item value.Value, context Context) (value.Value, error) { return this.UnaryEval(this, item, context) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (fn NoArgFunc) Eval(ctx *Context, r Row) (interface{}, error) {\n\treturn fn.Logic(ctx, r)\n}", "func (bp *BinaryPlus) Eval() float64 {\n\treturn bp.left.(Eval).Eval() + bp.right.(Eval).Eval()\n}", "func (ast *Unary) Eval(env *Env, ctx *Codegen, gen *ssa.Generator) (\n\tssa.Value, bool, error) {\n\texpr, ok, err := ast.Expr.Eval(env, ctx, gen)\n\tif err != nil || !ok {\n\t\treturn ssa.Undefined, ok, err\n\t}\n\tswitch val := expr.ConstValue.(type) {\n\tcase bool:\n\t\tswitch ast.Type {\n\t\tcase UnaryNot:\n\t\t\treturn gen.Constant(!val, types.Bool), true, nil\n\t\tdefault:\n\t\t\treturn ssa.Undefined, false, ctx.Errorf(ast.Expr,\n\t\t\t\t\"invalid unary expression: %s%T\", ast.Type, val)\n\t\t}\n\tcase int32:\n\t\tswitch ast.Type {\n\t\tcase UnaryMinus:\n\t\t\treturn gen.Constant(-val, types.Int32), true, nil\n\t\tdefault:\n\t\t\treturn ssa.Undefined, false, ctx.Errorf(ast.Expr,\n\t\t\t\t\"Unary.Eval: '%s%T' not implemented yet\", ast.Type, val)\n\t\t}\n\tdefault:\n\t\treturn ssa.Undefined, false, ctx.Errorf(ast.Expr,\n\t\t\t\"invalid value %s%T\", ast.Type, val)\n\t}\n}", "func Eval(ctx context.Context, e Expr, vs Values) (interface{}, error) {\r\n\tfn, err := FuncOf(ctx, e, vs)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\treturn fn.Call(ctx, vs)\r\n}", "func (f *function) Eval(a *Apl) (Value, error) {\n\tvar err error\n\tvar l, r Value\n\n\t// The right argument must be evaluated first.\n\t// Otherwise this A←1⋄A+(A←2) evaluates to 3,\n\t// but it should evaluate to 4.\n\tr, err = f.right.Eval(a)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif f.left != nil {\n\n\t\t// Special case for modified assignments.\n\t\t// Defer evaluation of the left argument.\n\t\tif d, ok := f.Function.(*derived); ok && d.op == \"←\" {\n\t\t\tl = assignment{f.left}\n\t\t} else {\n\t\t\tl, err = f.left.Eval(a)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Special case: the last function in a selective assignment uses Select instead of Call.\n\tif _, ok := f.right.(numVar); ok && f.selection {\n\t\tif d, ok := f.Function.(*derived); ok == true {\n\t\t\treturn d.Select(a, l, r)\n\t\t} else if p, ok := f.Function.(Primitive); ok == false {\n\t\t\treturn nil, fmt.Errorf(\"cannot use %T in selective assignment\", f.Function)\n\t\t} else {\n\t\t\treturn p.Select(a, l, r)\n\t\t}\n\t}\n\treturn f.Function.Call(a, l, r)\n}", "func Eval(txApp *sysl.Application, assign Scope, e *sysl.Expr) *sysl.Value {\n\tswitch x := e.Expr.(type) {\n\tcase *sysl.Expr_Transform_:\n\t\treturn evalTransform(txApp, assign, x, e)\n\tcase *sysl.Expr_Binexpr:\n\t\treturn evalBinExpr(txApp, assign, x.Binexpr)\n\tcase *sysl.Expr_Call_:\n\t\treturn evalCall(txApp, assign, x)\n\tcase *sysl.Expr_Name:\n\t\treturn evalName(assign, x)\n\tcase *sysl.Expr_GetAttr_:\n\t\treturn evalGetAttr(txApp, assign, x)\n\tcase *sysl.Expr_Ifelse:\n\t\treturn evalIfelse(txApp, assign, x)\n\tcase *sysl.Expr_Literal:\n\t\treturn x.Literal\n\tcase *sysl.Expr_Set:\n\t\treturn evalSet(txApp, assign, x)\n\tcase *sysl.Expr_List_:\n\t\treturn evalList(txApp, assign, x)\n\tcase *sysl.Expr_Unexpr:\n\t\treturn evalUnaryFunc(x.Unexpr.Op, Eval(txApp, assign, x.Unexpr.Arg))\n\tdefault:\n\t\tlogrus.Warnf(\"Skipping Expr of type %T\\n\", x)\n\t\treturn nil\n\t}\n}", "func (op *OpMinus) Eval(x, y float32) float32 {\n\treturn op.LeftChild.Eval(x, y) - op.RightChild.Eval(x, y)\n}", "func (op *OpPlus) Eval(x, y float32) float32 {\n\treturn op.LeftChild.Eval(x, y) + op.RightChild.Eval(x, y)\n}", "func (op *OpPlus) Eval(x, y float32) float32 {\n\treturn op.LeftChild.Eval(x, y) + op.RightChild.Eval(x, y)\n}", "func (e *Exp) Eval() float64 {\n\te.init()\n\tresult, _ := e.eval(e.opTree)\n\treturn result\n}", "func (f *FunctionLike) Eval(env types.Env) (types.Expr, error) {\n\treturn nil, fmt.Errorf(\"interpreterTypes.FunctionLike: cannot eval a function-like: %s\", f)\n}", "func (form *Form) Eval(scope Scope, args ...interface{}) interface{} {\n\treturn form.Fn(scope, args...)\n}", "func (op *OpX) Eval(x, y float32) float32 {\n\treturn x\n}", "func (op *OpX) Eval(x, y float32) float32 {\n\treturn x\n}", "func ExampleEval() {\n\tfmt.Println(Eval(\"5\"))\n\tfmt.Println(Eval(\"1 + 2\"))\n\tfmt.Println(Eval(\"1 - 2 + 3\"))\n\tfmt.Println(Eval(\"3 * ( 3 + 1 * 3 ) / 2\"))\n\tfmt.Println(Eval(\"3 * ( ( 3 + 1 ) * 3 ) / 2\"))\n\t//OutPut:\n\t//5\n\t//3\n\t//2\n\t//9\n\t//18\n}", "func (this *ObjectUnwrap) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (rt *invalidRuntime) Eval(vs parser.Scope, is map[string]interface{}, tid uint64) (interface{}, error) {\n\t_, err := rt.baseRuntime.Eval(vs, is, tid)\n\tif err == nil {\n\t\terr = rt.erp.NewRuntimeError(util.ErrInvalidConstruct, fmt.Sprintf(\"Unknown node: %s\", rt.node.Name), rt.node)\n\t}\n\treturn nil, err\n}", "func (this *Not) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (rt *voidRuntime) Eval(vs parser.Scope, is map[string]interface{}, tid uint64) (interface{}, error) {\n\treturn rt.baseRuntime.Eval(vs, is, tid)\n}", "func (le ListExpr) Eval(scope Scope) (interface{}, error) {\n\tif len(le.List) == 0 {\n\t\treturn le.List, nil\n\t}\n\n\tval, err := le.List[0].Eval(scope)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif macroFn, ok := val.(MacroFunc); ok {\n\t\tvar name string\n\t\tif sym, ok := le.List[0].(SymbolExpr); ok {\n\t\t\tname = sym.Symbol\n\t\t}\n\t\treturn macroFn(scope, name, le.List[1:])\n\t}\n\n\targs := []interface{}{}\n\tfor i := 1; i < len(le.List); i++ {\n\t\targ, err := le.List[i].Eval(scope)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\targs = append(args, arg)\n\t}\n\n\tif scopedFn, ok := val.(ScopedFunc); ok {\n\t\treturn scopedFn(scope, args...)\n\t}\n\n\treturn reflection.Call(val, args...)\n}", "func (o Nil) Eval(*Vm) (Object, error) { return o, nil }", "func Eval(node ast.Node, env *object.Environment, stop <-chan struct{}) object.Object {\n\tselect {\n\tcase <-stop:\n\t\treturn ConstNil\n\tdefault:\n\t}\n\n\tswitch node := node.(type) {\n\t// statements\n\tcase *ast.Program:\n\t\treturn evalProgram(node, env, stop)\n\tcase *ast.LetStatement:\n\t\tval := Eval(node.Value, env, stop)\n\t\tif isError(val) {\n\t\t\treturn val\n\t\t}\n\t\tenv.Set(node.Name.Value, val)\n\tcase *ast.ReturnStatement:\n\t\tval := Eval(node.Value, env, stop)\n\t\tif isError(val) {\n\t\t\treturn val\n\t\t}\n\t\treturn &object.ReturnValue{Value: val}\n\tcase *ast.BlockStatement:\n\t\treturn evalBlockStatement(node, env, stop)\n\tcase *ast.ExpressionStatement:\n\t\treturn Eval(node.Expression, env, stop)\n\n\t\t// expressions\n\tcase *ast.PrefixExpression:\n\t\tright := Eval(node.Right, env, stop)\n\t\tif isError(right) {\n\t\t\treturn right\n\t\t}\n\t\treturn evalPrefixExpr(node.Token, right)\n\tcase *ast.InfixExpression:\n\t\tif node.Operator == token.Assign {\n\t\t\treturn evalAssign(node, env, stop)\n\t\t}\n\n\t\tleft := Eval(node.Left, env, stop)\n\t\tif isError(left) {\n\t\t\treturn left\n\t\t}\n\t\tright := Eval(node.Right, env, stop)\n\t\tif isError(right) {\n\t\t\treturn right\n\t\t}\n\t\treturn evalInfixExpr(node.Token, left, right)\n\tcase *ast.IndexExpression:\n\t\tleft := Eval(node.Left, env, stop)\n\t\tif isError(left) {\n\t\t\treturn left\n\t\t}\n\n\t\tindex := Eval(node.Index, env, stop)\n\t\tif isError(index) {\n\t\t\treturn index\n\t\t}\n\t\treturn evalIndexExpr(node.Token, left, index)\n\tcase *ast.IfExpression:\n\t\treturn evalIfExpr(node, env, stop)\n\tcase *ast.WhileExpression:\n\t\treturn evalWhileExpr(node, env, stop)\n\tcase *ast.CallExpression:\n\t\tfunction := Eval(node.Func, env, stop)\n\t\tif isError(function) {\n\t\t\treturn function\n\t\t}\n\n\t\targs, err := evalExpressions(node.Args, env, stop)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn doFunction(node.Token, function, args, stop)\n\n\t\t// literals\n\tcase *ast.IntegerLiteral:\n\t\treturn &object.Integer{Value: node.Value}\n\tcase *ast.FloatLiteral:\n\t\treturn &object.Float{Value: node.Value}\n\tcase *ast.BooleanLiteral:\n\t\treturn boolToBoolean(node.Value)\n\tcase *ast.NilLiteral:\n\t\treturn ConstNil\n\tcase *ast.FunctionLiteral:\n\t\treturn &object.Function{Params: node.Params, Body: node.Body, Env: env}\n\tcase *ast.StringLiteral:\n\t\treturn &object.String{Value: node.Value}\n\tcase *ast.ArrayLiteral:\n\t\telems, err := evalExpressions(node.Elements, env, stop)\n\t\tif len(elems) == 1 && err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn &object.Array{Elements: elems}\n\tcase *ast.Identifier:\n\t\treturn evalIdentifier(node, env)\n\tcase *ast.AccessIdentifier:\n\t\treturn evalAccessIdentifier(node, env)\n\t}\n\treturn nil\n}", "func (inst *hiddenInstance) Eval(expr ast.Expr) Value {\n\tv := inst.Value()\n\treturn v.Context().BuildExpr(expr, Scope(v), InferBuiltins(true))\n}", "func (a *AddActivity) Eval(context activity.Context) (done bool, err error) {\n\n\t//mv := context.GetInput(ivMessage)\n\tnum1, _ := context.GetInput(ivNum1).(int)\n\tnum2, _ := context.GetInput(ivNum2).(int)\n\n\tactivityLog.Info(fmt.Sprintf(\"Num1: %d, Num2: %d\", num1, num2))\n\tactivityLog.Info(fmt.Sprintf(\"Addition is : %d\", num1+num2))\n\tcontext.SetOutput(ovAddition, num1+num2)\n\n\treturn true, nil\n}", "func (o Args) Eval(*Vm) (Object, error) { return o, nil }", "func (n *NotLikeOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tpanic(\"implement me\")\n}", "func eval(list []*Item) int {\n\n\tvar stack *Item\n\n\tfor _, node := range list {\n\n\t\tif node.Typ == Number {\n\t\t\tstack = stack.Push(node)\n\t\t\tcontinue\n\t\t}\n\n\t\tvar left, right *Item\n\n\t\tstack, right = stack.Pop()\n\t\tstack, left = stack.Pop()\n\n\t\tvar val int\n\t\tswitch node.Operation {\n\t\tcase \"+\":\n\t\t\tval = left.Value + right.Value\n\t\tcase \"-\":\n\t\t\tval = left.Value - right.Value\n\t\tcase \"/\":\n\t\t\t// Watch for div-by-zero\n\t\t\tval = left.Value / right.Value\n\t\tcase \"*\":\n\t\t\tval = left.Value * right.Value\n\t\t}\n\t\tstack = stack.Push(&Item{Typ: Number, Value: val})\n\t}\n\n\treturn stack.Value\n}", "func (e *BinExpr) Eval(ctx context.Context, local Scope) (_ Value, err error) {\n\ta, err := e.a.Eval(ctx, local)\n\tif err != nil {\n\t\treturn nil, WrapContextErr(err, e, local)\n\t}\n\n\tb, err := e.b.Eval(ctx, local)\n\tif err != nil {\n\t\treturn nil, WrapContextErr(err, e, local)\n\t}\n\tval, err := e.eval(ctx, a, b, local)\n\tif err != nil {\n\t\treturn nil, WrapContextErr(err, e, local)\n\t}\n\treturn val, nil\n}", "func (m *Message) Eval(vm *VM, locals Interface) (result Interface) {\n\treturn m.Send(vm, locals, locals)\n}", "func eval(sc *scope, e sexpr) sexpr {\n\te = transform(sc, e)\n\tswitch e := e.(type) {\n\tcase cons: // a function to evaluate\n\t\tcons := e\n\t\tcar := eval(sc, cons.car)\n\t\tif !isFunction(car) && !isPrimitive(car) {\n\t\t\tpanic(\"Attempted application on non-function\")\n\t\t}\n\t\tcdr := cons.cdr\n\t\targs := flatten(cdr)\n\t\tif isPrimitive(car) {\n\t\t\treturn (car.(primitive))(sc, args)\n\t\t}\n\t\tf := car.(function)\n\t\t// This is a function - evaluate all arguments\n\t\tfor i, a := range args {\n\t\t\targs[i] = eval(sc, a)\n\t\t}\n\t\treturn f(sc, args)\n\tcase sym:\n\t\treturn sc.lookup(e)\n\t}\n\treturn e\n}", "func (p *Qlang) Eval(expr string) (err error) {\n\n\treturn p.Exec([]byte(expr), \"\")\n}", "func (mr *MockExpressionNodeMockRecorder) Eval() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Eval\", reflect.TypeOf((*MockExpressionNode)(nil).Eval))\n}", "func (this *Self) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn item, nil\n}", "func (n *NotInOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tpanic(\"implement me\")\n}", "func (f *Function) Eval(inputs ...interface{}) (args.Const, error) {\n\tlenInputs := len(inputs)\n\tif lenInputs != f.numVars {\n\t\treturn nil, errors.New(\"Number of inputs is not equal to the number of variables in function\")\n\t}\n\n\tvar operand1 args.Const\n\tvar operand2 args.Const\n\tvar operandStack []args.Const\n\n\ti := 0\n\tfor i < len(f.Args) {\n\t\tif f.typeInput(i) == args.Constant || f.typeInput(i) == args.Variable {\n\t\t\tvariable, err := f.getVar(i)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif lenInputs != 0 {\n\t\t\t\toperand, err := variable.Eval(inputs[f.varNum[variable]])\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\toperandStack = append(operandStack, operand)\n\t\t\t} else {\n\t\t\t\t// If length inputs is 0, then all variables must be constant.\n\t\t\t\t// This code assumes variable is a constant and so uses 0 as an input\n\t\t\t\t// to MustEval as it will never fail as the input does not matter for constants\n\t\t\t\toperandStack = append(operandStack, variable.MustEval(0))\n\t\t\t}\n\t\t} else if f.typeInput(i) == args.Operation {\n\t\t\toperation, err := f.getOp(i)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif h, ok := unaryFuncs[operation]; ok {\n\t\t\t\tif len(operandStack) == 0 {\n\t\t\t\t\treturn nil, errors.New(\"Not enough operands\")\n\t\t\t\t}\n\n\t\t\t\toperand1, operandStack = operandStack[len(operandStack)-1], operandStack[:len(operandStack)-1]\n\t\t\t\tresult, err := h(operand1)\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\toperandStack = append(operandStack, result)\n\t\t\t} else if h, ok := binaryFuncs[operation]; ok {\n\t\t\t\tif len(operandStack) < 2 {\n\t\t\t\t\treturn nil, errors.New(\"Not enough operands\")\n\t\t\t\t}\n\n\t\t\t\toperand2, operandStack = operandStack[len(operandStack)-1], operandStack[:len(operandStack)-1]\n\t\t\t\toperand1, operandStack = operandStack[len(operandStack)-1], operandStack[:len(operandStack)-1]\n\t\t\t\tresult, err := h(operand1, operand2)\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\toperandStack = append(operandStack, result)\n\t\t\t} else {\n\t\t\t\treturn nil, errors.New(\"Operation not supported\")\n\t\t\t}\n\t\t}\n\t\ti++\n\t}\n\n\tif len(operandStack) > 1 {\n\t\treturn nil, errors.New(\"To many operands left over after calculation\")\n\t}\n\n\treturn operandStack[0], nil\n}", "func (op *OpSine) Eval(x, y float32) float32 {\n\treturn float32(math.Sin(float64(op.Child.Eval(x, y))))\n}", "func (b *Builder) Eval(desc string, f predicate.TransformFunc) *Builder {\n\tb.p.RegisterTransformation(impl.Eval(desc, f))\n\treturn b\n}", "func (e *Evaluator) Eval(expr string) (interface{}, error) {\n\tn := e.n.Copy()\n\t_expr, err := xpath.Compile(expr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"expr cannot compile: %w\", err)\n\t}\n\n\tv := _expr.Evaluate(n)\n\tswitch v := v.(type) {\n\tcase *xpath.NodeIterator:\n\t\tns := nodes(v)\n\t\tvs := make([]interface{}, 0, len(ns))\n\t\tfor i := range ns {\n\t\t\tswitch n := ns[i].(type) {\n\t\t\tcase attr:\n\t\t\t\tvs = append(vs, n.val)\n\t\t\t}\n\t\t}\n\t\tif len(vs) == len(ns) {\n\t\t\treturn vs, nil\n\t\t}\n\t\treturn ns, nil\n\t}\n\n\treturn v, nil\n}", "func (rt *baseRuntime) Eval(vs parser.Scope, is map[string]interface{}, tid uint64) (interface{}, error) {\n\tvar err error\n\n\terrorutil.AssertTrue(rt.validated, \"Runtime component has not been validated - please call Validate() before Eval()\")\n\n\tif rt.erp.Debugger != nil {\n\t\terr = rt.erp.Debugger.VisitState(rt.node, vs, tid)\n\t\trt.erp.Debugger.SetLockingState(rt.erp.MutexeOwners, rt.erp.MutexLog)\n\t\trt.erp.Debugger.SetThreadPool(rt.erp.Processor.ThreadPool())\n\t}\n\n\treturn nil, err\n}", "func (n *NotRegexpOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tpanic(\"implement me\")\n}", "func (s *Subtraction) Evaluate(left, right EvalResult) (EvalResult, error) {\n\treturn subtractNumericWithError(left, right)\n}", "func (this *ObjectValues) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (this *ObjectValues) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (c *Context) Eval(script string) (*Value, error) {\n\t// When PHP compiles code with a non-NULL return value expected, it simply\n\t// prepends a `return` call to the code, thus breaking simple scripts that\n\t// would otherwise work. Thus, we need to wrap the code in a closure, and\n\t// call it immediately.\n\ts := C.CString(\"call_user_func(function(){\" + script + \"});\")\n\tdefer C.free(unsafe.Pointer(s))\n\n\tvptr, err := C.context_eval(c.context, s)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error executing script '%s' in context\", script)\n\t}\n\n\tval, err := NewValueFromPtr(vptr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn val, nil\n}", "func (f *CallExpression) Evaluate(ctx *Context) Value {\n\tcallable := f.Callable.Evaluate(ctx)\n\n\tif callable.Type == vtVariable {\n\t\tcallable = callable.Evaluate(ctx)\n\t}\n\n\tif callable.isCallable() {\n\t\tnewCtx := NewContext(\"\", nil)\n\t\targs := f.Args.EvaluateAll(ctx)\n\t\treturn callable.callable().Execute(newCtx, &args)\n\t}\n\n\tpanic(NewNotCallableError(callable))\n}", "func (lscript *Scripting) Eval(luacmd string, arguments ...interface{}) (*ScriptingReturnValues, error) {\n\targs := asScriptingArgs(arguments...)\n\tlargs := forLua(args)\n\tfor _, larg := range largs {\n\t\tlscript.Push(larg)\n\t}\n\tvar r *ScriptingReturnValues\n\terr := lscript.DoString(luacmd)\n\tif err != nil {\n\t\tT().P(\"script\", \"lua\").Errorf(\"scripting error: %s\", err.Error())\n\t} else {\n\t\tif err == nil {\n\t\t\tT().P(\"lua\", \"eval\").Debugf(\"%d return values on the stack\", lscript.GetTop())\n\t\t\tr = lscript.returnFromScripting(lscript.GetTop()) // return all values on the stack\n\t\t}\n\t}\n\treturn r, err\n}", "func (e *binaryExprEvaluator) eval(lhs, rhs interface{}) interface{} {\n\tswitch e.op {\n\tcase ADD:\n\t\treturn lhs.(float64) + rhs.(float64)\n\tcase SUB:\n\t\treturn lhs.(float64) - rhs.(float64)\n\tcase MUL:\n\t\treturn lhs.(float64) * rhs.(float64)\n\tcase DIV:\n\t\trhs := rhs.(float64)\n\t\tif rhs == 0 {\n\t\t\treturn float64(0)\n\t\t}\n\t\treturn lhs.(float64) / rhs\n\tdefault:\n\t\t// TODO: Validate operation & data types.\n\t\tpanic(\"invalid operation: \" + e.op.String())\n\t}\n}", "func (p *Qlang) SafeEval(expr string) (err error) {\n\n\treturn p.SafeExec([]byte(expr), \"\")\n}", "func Eval(input string, context map[string]interface{}) float64 {\n\tnode, err := Parse(input)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\texpr := &expression{node, context}\n\treturn expr.eval(expr.ast)\n}", "func (op *OpAtan) Eval(x, y float32) float32 {\n\treturn float32(math.Atan(float64(op.Child.Eval(x, y))))\n}", "func (op *OpMult) Eval(x, y float32) float32 {\n\treturn op.LeftChild.Eval(x, y) * op.RightChild.Eval(x, y)\n}", "func (i *InOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tpanic(\"implement me\")\n}", "func prepareEvalInfixExp(opfStack, opftStack, opfdStack, argsStack *Stack) {\n\t// current token is function stop\n\tfor opftStack.Peek().(efp.Token) != opfStack.Peek().(efp.Token) {\n\t\t// calculate trigger\n\t\ttopOpt := opftStack.Peek().(efp.Token)\n\t\tif err := calculate(opfdStack, topOpt); err != nil {\n\t\t\targsStack.Peek().(*list.List).PushBack(newErrorFormulaArg(err.Error(), err.Error()))\n\t\t\topftStack.Pop()\n\t\t\tcontinue\n\t\t}\n\t\topftStack.Pop()\n\t}\n\targument := true\n\tif opftStack.Len() > 2 && opfdStack.Len() == 1 {\n\t\ttopOpt := opftStack.Pop()\n\t\tif opftStack.Peek().(efp.Token).TType == efp.TokenTypeOperatorInfix {\n\t\t\targument = false\n\t\t}\n\t\topftStack.Push(topOpt)\n\t}\n\t// push opfd to args\n\tif argument && opfdStack.Len() > 0 {\n\t\targsStack.Peek().(*list.List).PushBack(opfdStack.Pop().(formulaArg))\n\t}\n}", "func (e PackageExpr) Eval(_ rel.Scope) (rel.Value, error) {\n\treturn e.a.Eval(stdScope())\n}", "func (p *prog) Eval(input any) (v ref.Val, det *EvalDetails, err error) {\n\t// Configure error recovery for unexpected panics during evaluation. Note, the use of named\n\t// return values makes it possible to modify the error response during the recovery\n\t// function.\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tswitch t := r.(type) {\n\t\t\tcase interpreter.EvalCancelledError:\n\t\t\t\terr = t\n\t\t\tdefault:\n\t\t\t\terr = fmt.Errorf(\"internal error: %v\", r)\n\t\t\t}\n\t\t}\n\t}()\n\t// Build a hierarchical activation if there are default vars set.\n\tvar vars interpreter.Activation\n\tswitch v := input.(type) {\n\tcase interpreter.Activation:\n\t\tvars = v\n\tcase map[string]any:\n\t\tvars = activationPool.Setup(v)\n\t\tdefer activationPool.Put(vars)\n\tdefault:\n\t\treturn nil, nil, fmt.Errorf(\"invalid input, wanted Activation or map[string]any, got: (%T)%v\", input, input)\n\t}\n\tif p.defaultVars != nil {\n\t\tvars = interpreter.NewHierarchicalActivation(p.defaultVars, vars)\n\t}\n\tv = p.interpretable.Eval(vars)\n\t// The output of an internal Eval may have a value (`v`) that is a types.Err. This step\n\t// translates the CEL value to a Go error response. This interface does not quite match the\n\t// RPC signature which allows for multiple errors to be returned, but should be sufficient.\n\tif types.IsError(v) {\n\t\terr = v.(*types.Err)\n\t}\n\treturn\n}", "func (this *ObjectAdd) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.TernaryEval(this, item, context)\n}", "func (op *OpSin) Eval(x, y float32) float32 {\n\treturn float32(math.Sin(float64(op.Child.Eval(x, y))))\n}", "func (l *LikeOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tpanic(\"implement me\")\n}", "func (e *ExpressionAtom) Evaluate(dataContext IDataContext, memory *WorkingMemory) (reflect.Value, error) {\n\tif e.Evaluated == true {\n\t\treturn e.Value, nil\n\t}\n\tif e.Variable != nil {\n\t\tval, err := e.Variable.Evaluate(dataContext, memory)\n\t\tif err != nil {\n\t\t\treturn reflect.Value{}, err\n\t\t}\n\t\te.Value = val\n\t\te.Evaluated = true\n\t\treturn val, err\n\t}\n\tif e.FunctionCall != nil {\n\t\tvalueNode := dataContext.Get(\"DEFUNC\")\n\t\targs, err := e.FunctionCall.EvaluateArgumentList(dataContext, memory)\n\t\tif err != nil {\n\t\t\treturn reflect.Value{}, err\n\t\t}\n\t\tret, err := valueNode.CallFunction(e.FunctionCall.FunctionName, args...)\n\t\tif err != nil {\n\t\t\treturn reflect.Value{}, err\n\t\t}\n\t\te.Value = ret\n\t\te.Evaluated = true\n\t\treturn ret, err\n\t}\n\tpanic(\"should not be reached\")\n}", "func (this *ObjectRemove) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.BinaryEval(this, item, context)\n}", "func (s *ScriptReal) Eval(c Scripter, keys []string, args ...interface{}) *redis.Cmd {\n\treturn s.script.Eval(c, keys, args...)\n}", "func (this *ObjectInnerValues) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (p Primitive) Eval(a *Apl) (Value, error) {\n\treturn p, nil\n}", "func (this *Element) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.BinaryEval(this, item, context)\n}", "func (op *OpY) Eval(x, y float32) float32 {\n\treturn y\n}", "func (op *OpY) Eval(x, y float32) float32 {\n\treturn y\n}", "func (s *String) Eval(_, _ *Scope) (Value, error) {\n\treturn s, nil\n}", "func (ev *Evaler) Eval(name, text string, n *parse.Chunk, ports []*Port) error {\n\top, err := ev.Compile(n)\n\tif err != nil {\n\t\treturn err\n\t}\n\tec := NewTopEvalCtx(ev, name, text, ports)\n\treturn ec.PEval(op)\n}", "func TestEval(t *testing.T) {\n\tany := `.+`\n\ttestCases := []struct {\n\t\tname string\n\t\tquery string\n\t\twantErr string\n\t\twant []values.Value\n\t}{\n\t\t{\n\t\t\tname: \"string interpolation\",\n\t\t\tquery: `\n\t\t\t\tstr = \"str\"\n\t\t\t\ting = \"ing\"\n\t\t\t\t\"str + ing = ${str+ing}\"`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewString(\"str + ing = string\"),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"string interpolation missing field\",\n\t\t\tquery: `\n\t\t\t\tr = makeRecord(o: {a: \"foo\", b: 42})\n\t\t\t\t\"r._value = ${r._value}\"`,\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"string interpolation non-string type\",\n\t\t\tquery: `\n\t\t\t\tr = makeRecord(o: {a: \"foo\", b: 42})\n\t\t\t\t\"r._value = ${r.b}\"`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewString(\"r._value = 42\"),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"string interpolation wrong type\",\n\t\t\tquery: `\n\t\t\t\tr = makeRecord(o: {a: \"foo\", b: 42})\n\t\t\t\t\"r = ${r}\"`,\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"call builtin function\",\n\t\t\tquery: \"six()\",\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewFloat(6.0),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"call function with fail\",\n\t\t\tquery: \"fail()\",\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"call function with duplicate args\",\n\t\t\tquery: \"plusOne(x:1.0, x:2.0)\",\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"binary expressions\",\n\t\t\tquery: `\n\t\t\tsix_value = six()\n\t\t\tnine_value = nine()\n\n\t\t\tfortyTwo() == six_value * nine_value\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(false),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"logical expressions short circuit\",\n\t\t\tquery: `\n six_value = six()\n nine_value = nine()\n\n not (fortyTwo() == six_value * nine_value) or fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"function\",\n\t\t\tquery: `\n plusSix = (r) => r + six()\n plusSix(r:1.0) == 7.0 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"function block\",\n\t\t\tquery: `\n f = (r) => {\n r1 = 1.0 + r\n return (r + r1) / r\n }\n f(r:1.0) == 3.0 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"function block polymorphic\",\n\t\t\tquery: `\n f = (r) => {\n r2 = r * r\n return r2 / r\n }\n f(r:2.0) == 2.0 or fail()\n f(r:2) == 2 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"function with default param\",\n\t\t\tquery: `\n addN = (r,n=4) => r + n\n addN(r:2) == 6 or fail()\n addN(r:3,n:1) == 4 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"scope closing\",\n\t\t\tquery: `\n\t\t\tx = 5\n plusX = (r) => r + x\n plusX(r:2) == 7 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"nested scope mutations not visible outside\",\n\t\t\tquery: `\n\t\t\tx = 5\n xinc = () => {\n x = x + 1\n return x\n }\n xinc() == 6 or fail()\n x == 5 or fail()\n\t\t\t`,\n\t\t},\n\t\t// TODO(jsternberg): This test seems to not\n\t\t// infer the type constraints correctly for m.a,\n\t\t// but it doesn't fail.\n\t\t{\n\t\t\tname: \"return map from func\",\n\t\t\tquery: `\n toMap = (a,b) => ({\n a: a,\n b: b,\n })\n m = toMap(a:1, b:false)\n m.a == 1 or fail()\n not m.b or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"pipe expression\",\n\t\t\tquery: `\n\t\t\tadd = (a=<-,b) => a + b\n\t\t\tone = 1\n\t\t\tone |> add(b:2) == 3 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"ignore pipe default\",\n\t\t\tquery: `\n\t\t\tadd = (a=<-,b) => a + b\n\t\t\tadd(a:1, b:2) == 3 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"pipe expression function\",\n\t\t\tquery: `\n\t\t\tadd = (a=<-,b) => a + b\n\t\t\tsix() |> add(b:2.0) == 8.0 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"pipe builtin function\",\n\t\t\tquery: `\n\t\t\tsix() |> plusOne() == 7.0 or fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"regex match\",\n\t\t\tquery: `\n\t\t\t\"abba\" =~ /^a.*a$/ or fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"regex not match\",\n\t\t\tquery: `\n\t\t\t\"abc\" =~ /^a.*a$/ and fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(false),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"not regex match\",\n\t\t\tquery: `\n\t\t\t\"abc\" !~ /^a.*a$/ or fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"not regex not match\",\n\t\t\tquery: `\n\t\t\t\"abba\" !~ /^a.*a$/ and fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(false),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"options metadata\",\n\t\t\tquery: `\n\t\t\toption task = {\n\t\t\t\tname: \"foo\",\n\t\t\t\trepeat: 100,\n\t\t\t}\n\t\t\ttask.name == \"foo\" or fail()\n\t\t\ttask.repeat == 100 or fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"query with side effects\",\n\t\t\tquery: `sideEffect() == 0 or fail()`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewInt(0),\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"array index expression\",\n\t\t\tquery: `\n\t\t\t\ta = [1, 2, 3]\n\t\t\t\tx = a[1]\n\t\t\t\tx == 2 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"dict expression\",\n\t\t\tquery: `\n\t\t\t\tm = [\"a\" + \"b\": 0, \"c\" + \"d\": 1]\n\t\t\t\tx = get(dict: m, key: \"ab\", default: 2)\n\t\t\t\ty = get(dict: m, key: \"cd\", default: 2)\n\t\t\t\tz = get(dict: m, key: \"ef\", default: 2)\n\t\t\t\tx == 0 and y == 1 and z == 2 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"empy dictionary\",\n\t\t\tquery: `\n\t\t\t\tm0 = [:]\n\t\t\t\tm1 = insert(dict: m0, key: \"a\", value: 0)\n\t\t\t\tm2 = insert(dict: m0, key: 0, value: \"a\")\n\t\t\t\tv1 = get(dict: m1, key: \"a\", default: -1)\n\t\t\t\tv2 = get(dict: m2, key: 0, default: \"b\")\n\t\t\t\tv1 == 0 and v2 == \"a\" or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"array index expression out of bounds low\",\n\t\t\tquery: `\n\t\t\t\ta = [1, 2, 3]\n\t\t\t\ti = -1\n\t\t\t\tx = a[i]\n\t\t\t`,\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"array index expression out of bounds high\",\n\t\t\tquery: `\n\t\t\t\ta = [1, 2, 3]\n\t\t\t\ti = 3\n\t\t\t\tx = a[i]\n\t\t\t`,\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"array with complex index expression\",\n\t\t\tquery: `\n\t\t\t\tf = () => ({l: 0, m: 1, n: 2})\n\t\t\t\ta = [1, 2, 3]\n\t\t\t\tx = a[f().l]\n\t\t\t\ty = a[f().m]\n\t\t\t\tz = a[f().n]\n\t\t\t\tx == 1 or fail()\n\t\t\t\ty == 2 or fail()\n\t\t\t\tz == 3 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"short circuit logical and\",\n\t\t\tquery: `\n false and fail()\n `,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(false),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"short circuit logical or\",\n\t\t\tquery: `\n true or fail()\n `,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"no short circuit logical and\",\n\t\t\tquery: `\n true and fail()\n `,\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"no short circuit logical or\",\n\t\t\tquery: `\n false or fail()\n `,\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"conditional true\",\n\t\t\tquery: `\n\t\t\t\tif 1 != 0 then 10 else 100\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewInt(10),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"conditional false\",\n\t\t\tquery: `\n\t\t\t\tif 1 == 0 then 10 else 100\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewInt(100),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"conditional in function\",\n\t\t\tquery: `\n\t\t\t\tf = (t, c, a) => if t then c else a\n\t\t\t\t{\n\t\t\t\t\tv1: f(t: false, c: 30, a: 300),\n\t\t\t\t\tv2: f(t: true, c: \"cats\", a: \"dogs\"),\n\t\t\t\t}\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewObjectWithValues(map[string]values.Value{\n\t\t\t\t\t\"v1\": values.NewInt(300),\n\t\t\t\t\t\"v2\": values.NewString(\"cats\"),\n\t\t\t\t}),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"exists\",\n\t\t\tquery: `hasValue(o: makeRecord(o: {value: 1}))`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"exists null\",\n\t\t\tquery: `hasValue(o: makeRecord(o: {val: 2}))`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(false),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"invalid function parameter\",\n\t\t\tquery: `from(bucket: \"telegraf\") |> window(every: 0s)`,\n\t\t\twantErr: `error calling function \"window\" @\\d+:\\d+-\\d+:\\d+: window function requires at least one of \"every\" or \"period\" to be set and non-zero`,\n\t\t},\n\t\t{\n\t\t\t// tests that we don't nest error messages when\n\t\t\t// a function call fails and gets piped into another\n\t\t\t// function.\n\t\t\tname: \"nested function error\",\n\t\t\tquery: `from(bucket: \"telegraf\") |> window(every: 0s) |> mean()`,\n\t\t\twantErr: `error calling function \"window\" @\\d+:\\d+-\\d+:\\d+: window function requires at least one of \"every\" or \"period\" to be set and non-zero`,\n\t\t},\n\t}\n\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\tsrc := prelude + tc.query\n\n\t\t\tctx, deps := dependency.Inject(context.Background(), dependenciestest.Default())\n\t\t\tdefer deps.Finish()\n\n\t\t\tsideEffects, _, err := runtime.Eval(ctx, src)\n\t\t\tif err != nil {\n\t\t\t\tif tc.wantErr == \"\" {\n\t\t\t\t\tt.Fatalf(\"unexpected error: %s\", err)\n\t\t\t\t}\n\n\t\t\t\t// We expect an error, so it should be a non-internal Flux error.\n\t\t\t\tif code := flux.ErrorCode(err); code == codes.Internal || code == codes.Unknown {\n\t\t\t\t\tt.Errorf(\"expected non-internal error code, got %s\", code)\n\t\t\t\t}\n\n\t\t\t\tre := regexp.MustCompile(tc.wantErr)\n\t\t\t\tif got := err.Error(); !re.MatchString(got) {\n\t\t\t\t\tt.Errorf(\"expected error to match pattern %q, but error was %q\", tc.wantErr, got)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t} else if tc.wantErr != \"\" {\n\t\t\t\tt.Fatal(\"expected error\")\n\t\t\t}\n\n\t\t\tvs := getSideEffectsValues(sideEffects)\n\t\t\tif tc.want != nil && !cmp.Equal(tc.want, vs, semantictest.CmpOptions...) {\n\t\t\t\tt.Fatalf(\"unexpected side effect values -want/+got: \\n%s\", cmp.Diff(tc.want, vs, semantictest.CmpOptions...))\n\t\t\t}\n\t\t})\n\t}\n}", "func (ev *Evaler) Eval(name, text string, n *parse.Chunk, ports []*Port) error {\n\top, err := ev.Compile(name, text, n)\n\tif err != nil {\n\t\treturn err\n\t}\n\tec := NewTopEvalCtx(ev, name, text, ports)\n\treturn ec.PEval(op)\n}", "func (e *Evaluator) Eval(expr *tipb.Expr) (types.Datum, error) {\n\tswitch expr.GetTp() {\n\tcase tipb.ExprType_Null:\n\t\treturn types.Datum{}, nil\n\tcase tipb.ExprType_Int64:\n\t\treturn e.evalInt(expr.Val)\n\tcase tipb.ExprType_Uint64:\n\t\treturn e.evalUint(expr.Val)\n\tcase tipb.ExprType_String:\n\t\treturn e.evalString(expr.Val)\n\tcase tipb.ExprType_Bytes:\n\t\treturn types.NewBytesDatum(expr.Val), nil\n\tcase tipb.ExprType_Float32:\n\t\treturn e.evalFloat(expr.Val, true)\n\tcase tipb.ExprType_Float64:\n\t\treturn e.evalFloat(expr.Val, false)\n\tcase tipb.ExprType_MysqlDecimal:\n\t\treturn e.evalDecimal(expr.Val)\n\tcase tipb.ExprType_MysqlDuration:\n\t\treturn e.evalDuration(expr.Val)\n\tcase tipb.ExprType_ColumnRef:\n\t\treturn e.evalColumnRef(expr.Val)\n\tcase tipb.ExprType_LT:\n\t\treturn e.evalLT(expr)\n\tcase tipb.ExprType_LE:\n\t\treturn e.evalLE(expr)\n\tcase tipb.ExprType_EQ:\n\t\treturn e.evalEQ(expr)\n\tcase tipb.ExprType_NE:\n\t\treturn e.evalNE(expr)\n\tcase tipb.ExprType_GE:\n\t\treturn e.evalGE(expr)\n\tcase tipb.ExprType_GT:\n\t\treturn e.evalGT(expr)\n\tcase tipb.ExprType_NullEQ:\n\t\treturn e.evalNullEQ(expr)\n\tcase tipb.ExprType_And:\n\t\treturn e.evalAnd(expr)\n\tcase tipb.ExprType_Or:\n\t\treturn e.evalOr(expr)\n\tcase tipb.ExprType_Like:\n\t\treturn e.evalLike(expr)\n\tcase tipb.ExprType_Not:\n\t\treturn e.evalNot(expr)\n\tcase tipb.ExprType_In:\n\t\treturn e.evalIn(expr)\n\tcase tipb.ExprType_Plus, tipb.ExprType_Div:\n\t\treturn e.evalArithmetic(expr)\n\t}\n\treturn types.Datum{}, nil\n}", "func (this *Mod) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.BinaryEval(this, item, context)\n}", "func (this *NowStr) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.Eval(this, item, context)\n}", "func (*Base) Unary(p ASTPass, node *ast.Unary, ctx Context) {\n\tp.Visit(p, &node.Expr, ctx)\n}", "func (i *IntNode) Eval(m memory.M) dragonscript.Value {\n\treturn dragonscript.Integer(i.value)\n}", "func (this *ObjectNames) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (this *ObjectNames) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (op *OpDiv) Eval(x, y float32) float32 {\n\treturn op.LeftChild.Eval(x, y) / op.RightChild.Eval(x, y)\n}", "func (e *Not) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {\n\tv, err := e.Child.Eval(ctx, row)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif v == nil {\n\t\treturn nil, nil\n\t}\n\n\treturn !v.(bool), nil\n}", "func (l *ListType) eval() Value {\n\treturn l\n}", "func eval(x interface{}, env map[string]interface{}) interface{} {\r\n if str, ok := isSymbol(x); ok { // variable reference\r\n\treturn env[str]\r\n }\r\n l, ok := isList(x)\r\n if !ok { // constant literal\r\n\treturn x\r\n }\r\n if len(l) == 0 {\r\n\tpanic(\"empty list\")\r\n }\r\n if str, ok := isSymbol(l[0]); ok {\r\n\tswitch (str) {\r\n\tcase \"quote\": // (quote exp)\r\n\t return l[1]\r\n\tcase \"if\": // (if test conseq alt)\r\n\t test := l[1]\r\n\t conseq := l[2]\r\n\t alt := l[3]\r\n\t r := eval(test, env)\r\n\t if b, ok := isFalse(r); ok && !b {\r\n\t\treturn eval(alt, env)\r\n\t } else {\r\n\t\treturn eval(conseq, env)\r\n\t }\r\n\tcase \"define\": // (define var exp)\r\n\t car := l[1]\r\n\t cdr := l[2]\r\n\t if str, ok = isSymbol(car); ok {\r\n\t\tenv[str] = eval(cdr, env)\r\n\t\treturn env[str]\r\n\t } else {\r\n\t\tpanic(\"define needs a symbol\")\r\n\t }\r\n\tdefault: // (proc arg...)\r\n\t car := eval(l[0], env)\r\n\t proc, ok := car.(func([]interface{})interface{})\r\n\t if !ok {\r\n\t\tpanic(\"not a procedure\")\r\n\t }\r\n args := makeArgs(l[1:], env)\r\n return proc(args)\r\n\t}\r\n }\r\n return nil\r\n}", "func (e *Not) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {\n\tv, err := e.Child.Eval(ctx, row)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif v == nil {\n\t\treturn nil, nil\n\t}\n\n\tb, ok := v.(bool)\n\tif !ok {\n\t\tb, err = types.ConvertToBool(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn !b, nil\n}", "func (op *OpCos) Eval(x, y float32) float32 {\n\treturn float32(math.Cos(float64(op.Child.Eval(x, y))))\n}", "func evaluateExpression(c *Context, exp interface{}) interface{} {\r\n var val interface{}\r\n\r\n // fmt.Printf(\"Evaluating type %T, \\n\", exp)\r\n switch t := exp.(type) {\r\n case int:\r\n // fmt.Printf(\"Returning int %d\\n\", t)\r\n val = t\r\n case *Integer:\r\n val = t.Number\r\n case *StringPrimitive:\r\n val = t.str\r\n case string:\r\n val = t\r\n case []interface{}:\r\n val = t\r\n case *InfixExpression:\r\n // fmt.Printf(\"Evaluating infix expresison %T l: %T, r:%T\\n\", t,t.leftNode.Exp, t.rightNode.Exp)\r\n //Get the value of the left node and right\r\n lVal := evaluateExpression(c, t.leftNode.Exp)\r\n rVal := evaluateExpression(c, t.rightNode.Exp)\r\n\r\n\r\n //then apply the correct infix operator to the values\r\n val = evaluateInfixExpression(c, t.opType, lVal, rVal)\r\n\r\n case *Identifier:\r\n // fmt.Printf(\"Was identifier returning %v\\n\", t.id)\r\n if(t.id == \"nil\") {\r\n val = NewNil(0)\r\n } else {\r\n // fmt.Printf(\"Posssible indeitEifer %T\\n\", c.values[t.id])\r\n val = evaluateExpression(c, c.values[t.id])\r\n }\r\n case *CallExpression:\r\n // fmt.Printf(\"Evaluation call to %s\\n\",t.callee)\r\n\r\n //get declaration of call\r\n callDec := c.lookup(t.callee).(*FuncDeclaration)\r\n if(callDec.returnType == \"\") { //no rreturn type = unit\r\n val = &UnitType{}\r\n } else { //Evaluate the expression of the body for a value\r\n //This should produce a value and will execute all\r\n //of the code of the body as well\r\n for i, _ := range callDec.paramNodes {\r\n paramDec := callDec.paramNodes[i].Exp.(*Param)\r\n paramValue := t.paramNodes[i].Exp\r\n c.values[paramDec.id] = evaluateExpression(c, paramValue)\r\n val = c.values[paramDec.id]\r\n }\r\n\r\n }\r\n\r\n if(t.callee == \"printi\") {\r\n invokePrintI(c, t)\r\n } else if(t.callee == \"print\") {\r\n invokePrint(c, t)\r\n } else if(t.callee == \"not\") {\r\n invokeNot(c, t)\r\n } else { //Regular other user defined function do your thing!\r\n //invoke the body\r\n //Get the declaration of the calling function so we can execute it\r\n callDec := c.lookup(t.callee).(*FuncDeclaration)\r\n // fmt.Printf(\"Invoking random func \\n\")\r\n evaluateExpression(c, callDec.body.Exp)\r\n }\r\n case *IfThenElseExpression:\r\n condition := evaluateExpression(c, t.condNode.Exp).(bool)\r\n // fmt.Printf(\"Cond was %v \\n\", condition)\r\n //If else is nil then its an IfThen Exp\r\n if(t.elseNode == nil) {\r\n val = &UnitType{}\r\n if(condition) { //if the condition is true evaluatie the code inside\r\n evaluateExpression(c, t.thenNode.Exp)\r\n }\r\n } else { //otherwise its and ifThenElse\r\n if(condition) {\r\n val = evaluateExpression(c, t.thenNode.Exp)\r\n } else {\r\n val = evaluateExpression(c, t.elseNode.Exp)\r\n }\r\n }\r\n case *SeqExpression:\r\n // Value is equivalent to the last node of the seqence expression\r\n if(len(t.nodes) == 0) {\r\n val = &UnitType{}\r\n } else {\r\n // fmt.Printf(\"Seq type was %T\\n\", t.nodes[len(t.nodes)-1].Exp)\r\n val = evaluateExpression(c, t.nodes[len(t.nodes)-1].Exp)\r\n }\r\n case *Nil:\r\n val = NewNil(0)\r\n case *ArrayExp:\r\n arrType := getType(c, c.lookup(t.typeId)).(*Identifier)\r\n val = c.lookup(arrType.id)\r\n case *ForExpression:\r\n val = &UnitType{}\r\n case *LetExpression:\r\n if(len(t.exps) == 0) {\r\n val = &UnitType{}\r\n } else {\r\n // fmt.Printf(\"%T is last exp type\\n\", t.exps[len(t.exps)-1].Exp)\r\n // val = getType(c, t.exps[len(t.exps)-1].Exp)\r\n }\r\n case *Assignment:\r\n val = &UnitType{}\r\n case *RecordExp:\r\n var slc []interface{}\r\n for _, fcNode := range t.fieldCreateNodes {\r\n if b, isABinding := fcNode.Exp.(*Binding); isABinding {\r\n slc = append(slc, evaluateExpression(c, b.exp.Exp))\r\n }\r\n }\r\n val = slc\r\n default:\r\n fmt.Fprintf(os.Stderr, \"Could not evaluate exp %T\\n\", t)\r\n os.Exit(4)\r\n }\r\n\r\n return val\r\n}", "func (da *DateArith) Eval(ctx context.Context, args map[interface{}]interface{}) (interface{}, error) {\n\tt, years, months, days, durations, err := da.evalArgs(ctx, args)\n\tif t.IsZero() || err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\tif !da.isAdd() {\n\t\tyears, months, days, durations = -years, -months, -days, -durations\n\t}\n\tt.Time = t.Time.Add(durations)\n\tt.Time = t.Time.AddDate(int(years), int(months), int(days))\n\n\t// \"2011-11-11 10:10:20.000000\" outputs \"2011-11-11 10:10:20\".\n\tif t.Time.Nanosecond() == 0 {\n\t\tt.Fsp = 0\n\t}\n\n\treturn t, nil\n}", "func Eval(node ast.Node, env *object.Environment) object.Object {\n\tswitch node := node.(type) {\n\n\t// Statements\n\tcase *ast.RootNode:\n\t\treturn evalRootNode(node, env)\n\n\tcase *ast.BlockStatement:\n\t\treturn evalBlockStmt(node, env)\n\n\tcase *ast.ExpressionStatement:\n\t\treturn Eval(node.Expression, env)\n\n\tcase *ast.ReturnStatement:\n\t\tval := Eval(node.ReturnValue, env)\n\t\tif isError(val) {\n\t\t\treturn val\n\t\t}\n\t\treturn &object.ReturnValue{Value: val}\n\n\tcase *ast.LetStatement:\n\t\tval := Eval(node.Value, env)\n\t\tif isError(val) {\n\t\t\treturn val\n\t\t}\n\t\tenv.Set(node.Name.Value, val)\n\n\tcase *ast.ConstStatement:\n\t\tval := Eval(node.Value, env)\n\t\tif isError(val) {\n\t\t\treturn val\n\t\t}\n\t\tenv.Set(node.Name.Value, val)\n\n\t// Expressions\n\tcase *ast.IntegerLiteral:\n\t\treturn &object.Integer{Value: node.Value}\n\n\tcase *ast.StringLiteral:\n\t\treturn &object.String{Value: node.Value}\n\n\tcase *ast.Boolean:\n\t\treturn nativeBoolToBooleanObj(node.Value)\n\n\tcase *ast.PrefixExpression:\n\t\tright := Eval(node.Right, env)\n\t\tif isError(right) {\n\t\t\treturn right\n\t\t}\n\t\treturn evalPrefixExpr(node.Operator, right, node.Token.Line)\n\n\tcase *ast.InfixExpression:\n\t\tleft := Eval(node.Left, env)\n\t\tif isError(left) {\n\t\t\treturn left\n\t\t}\n\t\tright := Eval(node.Right, env)\n\t\tif isError(right) {\n\t\t\treturn right\n\t\t}\n\t\treturn evalInfixExpr(node.Operator, left, right, node.Token.Line)\n\n\tcase *ast.PostfixExpression:\n\t\treturn evalPostfixExpr(env, node.Operator, node)\n\n\tcase *ast.IfExpression:\n\t\treturn evalIfExpr(node, env)\n\n\tcase *ast.Identifier:\n\t\treturn evalIdentifier(node, env)\n\n\tcase *ast.FunctionLiteral:\n\t\tparams := node.Parameters\n\t\tbody := node.Body\n\t\treturn &object.Function{\n\t\t\tParameters: params,\n\t\t\tBody: body,\n\t\t\tEnv: env,\n\t\t}\n\n\tcase *ast.CallExpression:\n\t\tfn := Eval(node.Function, env)\n\t\tif isError(fn) {\n\t\t\treturn fn\n\t\t}\n\t\targs := evalExprs(node.Arguments, env)\n\t\tif len(args) == 1 && isError(args[0]) {\n\t\t\treturn args[0]\n\t\t}\n\t\treturn applyFunction(fn, args, node.Token.Line)\n\n\tcase *ast.ArrayLiteral:\n\t\telements := evalExprs(node.Elements, env)\n\t\tif len(elements) == 1 && isError(elements[0]) {\n\t\t\treturn elements[0]\n\t\t}\n\t\treturn &object.Array{Elements: elements}\n\n\tcase *ast.IndexExpression:\n\t\tleft := Eval(node.Left, env)\n\t\tif isError(left) {\n\t\t\treturn left\n\t\t}\n\t\tindex := Eval(node.Index, env)\n\t\tif isError(index) {\n\t\t\treturn index\n\t\t}\n\t\treturn evalIndexExpr(left, index, node.Token.Line)\n\n\tcase *ast.HashLiteral:\n\t\treturn evalHashLiteral(node, env)\n\t}\n\n\treturn nil\n}", "func Evaluate(item interface{}, passedContext interface{}) map[string]float64 {\n\t//fmt.Fprintf(os.Stderr, \"eval:: %v %T\\n\", item, item)\n\n\tif item != nil {\n\t\tswitch passedContext.(type) {\n\t\tcase *DimContext:\n\t\t\t{\n\t\t\t\t//fmt.Fprintf(os.Stderr, \"here before processMember %v\\n\", item)\n\t\t\t\tprocessMember(item, passedContext)\n\t\t\t\t//fmt.Fprintf(os.Stderr, \"here after processMember %v %T\\n\", item, item)\n\t\t\t}\n\t\t}\n\t\tswitch v := item.(type) {\n\t\tcase hasResults:\n\t\t\t{\n\t\t\t\treturn v.Results()\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (sf *ScalarFunction) Eval(row chunk.Row) (d types.Datum, err error) {\n\tvar (\n\t\tres interface{}\n\t\tisNull bool\n\t)\n\tswitch tp, evalType := sf.GetType(), sf.GetType().EvalType(); evalType {\n\tcase types.ETInt:\n\t\tvar intRes int64\n\t\tintRes, isNull, err = sf.EvalInt(sf.GetCtx(), row)\n\t\tif mysql.HasUnsignedFlag(tp.Flag) {\n\t\t\tres = uint64(intRes)\n\t\t} else {\n\t\t\tres = intRes\n\t\t}\n\tcase types.ETString:\n\t\tres, isNull, err = sf.EvalString(sf.GetCtx(), row)\n\t}\n\n\tif isNull || err != nil {\n\t\td.SetNull()\n\t\treturn d, err\n\t}\n\td.SetValue(res, sf.RetType)\n\treturn\n}", "func (s server) Eval(ctx context.Context, req *entity.Request) (*entity.Result, error) {\n\tlog.Printf(\"Received a request: %+v\\n\", req)\n\tresult := &entity.Result{}\n\tres, err := s.usecase.Eval(req.Value)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\tresult.Value = strconv.FormatFloat(res, 'G', -1, 64)\n\treturn result, nil\n}", "func execEval(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\tret, ret1 := types.Eval(args[0].(*token.FileSet), args[1].(*types.Package), token.Pos(args[2].(int)), args[3].(string))\n\tp.Ret(4, ret, ret1)\n}", "func (p Polynomial) Eval(arg int) ed25519.Scalar {\n\tx := ed25519.New_scalar(*big.NewInt(int64(arg)))\n\tresult := p.coeffs[0].Add(p.coeffs[1].Mul(x))\n\tx_pow := x.Copy()\n\tfor i := 2; i < len(p.coeffs); i++ {\n\t\tx_pow = x_pow.Mul(x)\n\t\tresult = result.Add(p.coeffs[i].Mul(x_pow))\n\t}\n\treturn result\n}", "func (s Scope) Eval(ctx context.Context, local Scope) (Value, error) {\n\ttuple := NewTuple()\n\tfor e := s.Enumerator(); e.MoveNext(); {\n\t\tname, expr := e.Current()\n\t\tvalue, err := expr.Eval(ctx, local)\n\t\tif err != nil {\n\t\t\treturn nil, WrapContextErr(err, expr, local)\n\t\t}\n\t\ttuple = tuple.With(name, value)\n\t}\n\treturn tuple, nil\n}", "func (t *Check) Eval(r, s string) (bool, error) {\n\treturn false, errors.New(\"Not implemented\")\n}", "func (r *Rule) Eval(devices *devices.List, rules map[string]bool) (bool, error) {\n\treturn eval(r.Expression(), devices, rules, r.ast)\n}", "func lvalCall(e *LEnv, f *LVal, a *LVal) *LVal {\n\t//If it is a builtin function, return the result of running that function\n\tif f.Builtin != nil {\n\t\treturn f.Builtin(e, a)\n\t}\n\n\t//Bind the arguments that were passed into the function\n\tfor len(a.Cell) > 0 {\n\t\tif len(f.Formals.Cell) == 0 {\n\t\t\treturn lvalErr(\"Function passed too many arguments\")\n\t\t}\n\n\t\tsym := lvalPop(f.Formals, 0)\n\n\t\tif sym.Sym == \"&\" {\n\t\t\tif len(f.Formals.Cell) != 1 {\n\t\t\t\treturn lvalErr(\"Symbol & not followed by a single symbol.\")\n\t\t\t}\n\n\t\t\tnsym := lvalPop(f.Formals, 0)\n\t\t\tlenvPut(f.Env, nsym, builtinList(e, a))\n\t\t}\n\n\t\tval := lvalPop(a, 0)\n\n\t\tlenvPut(f.Env, sym, val)\n\t}\n\n\tif len(f.Formals.Cell) == 0 {\n\t\tf.Env.Par = e\n\n\t\treturn builtinEval(f.Env, lvalAdd(lvalSexpr(), lvalCopy(f.Body)))\n\t} else {\n\t\treturn lvalCopy(f)\n\t}\n}", "func unary(typ int, op string, od1 *expr) *expr {\n\treturn &expr{\n\t\tsexp: append(exprlist{atomic(typ, op)}, od1),\n\t}\n}", "func (f UnFunc) Apply(ctx context.Context, data interface{}) (interface{}, error) {\n\treturn f(ctx, data)\n}", "func (ev *evaluator) eval(expr Expr) model.Value {\n\t// This is the top-level evaluation method.\n\t// Thus, we check for timeout/cancellation here.\n\tif err := contextDone(ev.ctx, \"expression evaluation\"); err != nil {\n\t\tev.error(err)\n\t}\n\n\tswitch e := expr.(type) {\n\tcase *AggregateExpr:\n\t\tvector := ev.evalVector(e.Expr)\n\t\treturn ev.aggregation(e.Op, e.Grouping, e.Without, e.KeepCommonLabels, e.Param, vector)\n\n\tcase *BinaryExpr:\n\t\tlhs := ev.evalOneOf(e.LHS, model.ValScalar, model.ValVector)\n\t\trhs := ev.evalOneOf(e.RHS, model.ValScalar, model.ValVector)\n\n\t\tswitch lt, rt := lhs.Type(), rhs.Type(); {\n\t\tcase lt == model.ValScalar && rt == model.ValScalar:\n\t\t\treturn &model.Scalar{\n\t\t\t\tValue: scalarBinop(e.Op, lhs.(*model.Scalar).Value, rhs.(*model.Scalar).Value),\n\t\t\t\tTimestamp: ev.Timestamp,\n\t\t\t}\n\n\t\tcase lt == model.ValVector && rt == model.ValVector:\n\t\t\tswitch e.Op {\n\t\t\tcase itemLAND:\n\t\t\t\treturn ev.vectorAnd(lhs.(vector), rhs.(vector), e.VectorMatching)\n\t\t\tcase itemLOR:\n\t\t\t\treturn ev.vectorOr(lhs.(vector), rhs.(vector), e.VectorMatching)\n\t\t\tcase itemLUnless:\n\t\t\t\treturn ev.vectorUnless(lhs.(vector), rhs.(vector), e.VectorMatching)\n\t\t\tdefault:\n\t\t\t\treturn ev.vectorBinop(e.Op, lhs.(vector), rhs.(vector), e.VectorMatching, e.ReturnBool)\n\t\t\t}\n\t\tcase lt == model.ValVector && rt == model.ValScalar:\n\t\t\treturn ev.vectorScalarBinop(e.Op, lhs.(vector), rhs.(*model.Scalar), false, e.ReturnBool)\n\n\t\tcase lt == model.ValScalar && rt == model.ValVector:\n\t\t\treturn ev.vectorScalarBinop(e.Op, rhs.(vector), lhs.(*model.Scalar), true, e.ReturnBool)\n\t\t}\n\n\tcase *Call:\n\t\treturn e.Func.Call(ev, e.Args)\n\n\tcase *MatrixSelector:\n\t\treturn ev.matrixSelector(e)\n\n\tcase *NumberLiteral:\n\t\treturn &model.Scalar{Value: e.Val, Timestamp: ev.Timestamp}\n\n\tcase *ParenExpr:\n\t\treturn ev.eval(e.Expr)\n\n\tcase *StringLiteral:\n\t\treturn &model.String{Value: e.Val, Timestamp: ev.Timestamp}\n\n\tcase *UnaryExpr:\n\t\tse := ev.evalOneOf(e.Expr, model.ValScalar, model.ValVector)\n\t\t// Only + and - are possible operators.\n\t\tif e.Op == itemSUB {\n\t\t\tswitch v := se.(type) {\n\t\t\tcase *model.Scalar:\n\t\t\t\tv.Value = -v.Value\n\t\t\tcase vector:\n\t\t\t\tfor i, sv := range v {\n\t\t\t\t\tv[i].Value = -sv.Value\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn se\n\n\tcase *VectorSelector:\n\t\treturn ev.vectorSelector(e)\n\t}\n\tpanic(fmt.Errorf(\"unhandled expression of type: %T\", expr))\n}", "func (m *MockExpressionNode) Eval() func(backend.Row) (core.Value, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Eval\")\n\tret0, _ := ret[0].(func(backend.Row) (core.Value, error))\n\treturn ret0\n}", "func (o NotOperator) Evaluate(ctx interface{}) (bool, error) {\n\t// fmt.Println(\"Not.Evaluate()\")\n\tresult, err := o.Operand.Evaluate(ctx)\n\treturn !result, err\n}", "func evaluate(arg1 *vector.Vector, oper *vector.Vector, arg2 *vector.Vector) *vector.Vector {\n\t//Store the operator in a temp string, to save typing it out\n\tvar operS string\n\toperS = oper.At(0).(string)\n\tvar val1, val2 int \n\tvar err1, err2 os.Error\n\tval1, err1 = strconv.Atoi(arg1.At(0).(string))\n\tval2, err2 = strconv.Atoi(arg2.At(0).(string))\n\t//screens for consecutive operators\n\tif(err1 != nil || err2 != nil){\n\t\tfmt.Println(\"expr: syntax error\")\n\t\tos.Exit(-2)\n\t}\n\tvar result int = -1\n\t//Evaluate based on the operator\n\tif operS == \"+\" {\n\t\tresult = val1 + val2\n\t} else if operS == \"-\" {\n\t\tresult = val1 - val2\n\t} else if operS == \"/\" {\n\t\tresult = val1 / val2\n\t} else if operS == \"*\" {\n\t\tresult = val1 * val2\n\t} else if operS == \"%\" {\n\t\tresult = val1 % val2\n\t}\n\t//Clear the arg1 vector and add the result to it, then return\n\t//(saves memory by not creating a new vector)\n\targ1.Cut(0, arg1.Len())\n\targ1.Push(strconv.Itoa(result))\n\treturn arg1\n}" ]
[ "0.65601635", "0.62554264", "0.610906", "0.6098628", "0.60711527", "0.6037241", "0.5988044", "0.5928711", "0.5928711", "0.58814615", "0.587307", "0.58361375", "0.5803793", "0.5803793", "0.5791637", "0.5744556", "0.57429147", "0.5731631", "0.5702675", "0.5695341", "0.56899124", "0.5676062", "0.56697935", "0.56211776", "0.5592483", "0.55849653", "0.558394", "0.5576499", "0.5535295", "0.5528006", "0.55279297", "0.55061173", "0.54976064", "0.54953825", "0.5475016", "0.54588026", "0.5454834", "0.5397715", "0.5373656", "0.53727204", "0.5368078", "0.5363978", "0.5363978", "0.53551155", "0.5354837", "0.5352133", "0.53508174", "0.5330089", "0.53097206", "0.5306045", "0.5288367", "0.528527", "0.5282669", "0.52825105", "0.5278601", "0.5274988", "0.5264876", "0.5263729", "0.5260502", "0.5253249", "0.52510667", "0.52458805", "0.52344036", "0.52322716", "0.5227688", "0.5227688", "0.52232075", "0.5196801", "0.51947314", "0.5179887", "0.5176868", "0.51663756", "0.5158357", "0.51531756", "0.51372516", "0.5130771", "0.5130771", "0.51301783", "0.5125869", "0.5124272", "0.512265", "0.5111888", "0.511074", "0.51081043", "0.51079035", "0.5107867", "0.5105482", "0.5097828", "0.50875163", "0.50613976", "0.50544703", "0.5051202", "0.50444084", "0.50313026", "0.50251466", "0.50213575", "0.5020417", "0.5013555", "0.50101", "0.5006659", "0.50044125" ]
0.0
-1
/ This method takes in an object and returns a map of name value pairs. If the type of input is missing then return a missing value, and if not an object return a null value. Convert it to a valid Go type. Cast it to a map from string to interface. Range over this map and save the keys. Sort the keys and range over the keys to create name and value pairs. Return this object.
func (this *ObjectPairs) Apply(context Context, arg value.Value) (value.Value, error) { if arg.Type() == value.MISSING { return value.MISSING_VALUE, nil } else if arg.Type() != value.OBJECT { return value.NULL_VALUE, nil } oa := arg.Actual().(map[string]interface{}) keys := make(sort.StringSlice, 0, len(oa)) for key, _ := range oa { keys = append(keys, key) } sort.Sort(keys) ra := make([]interface{}, len(keys)) for i, k := range keys { ra[i] = map[string]interface{}{"name": k, "value": oa[k]} } return value.NewValue(ra), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ToStringStringMap(tagName string, input interface{}, properties ...string) (map[string]string, error) {\n\tvmap := make(map[string]string)\n\ts := structs.New(input)\n\ts.TagName = tagName\n\tif len(properties) == 0 {\n\t\tproperties = s.Names()\n\t}\n\n\tfor _, field := range s.Fields() {\n\t\tif !field.IsExported() {\n\t\t\tcontinue\n\t\t}\n\n\t\tif !stringInSlice(field.Name(), properties) {\n\t\t\tcontinue\n\t\t}\n\n\t\tfieldName, opts := parseTag(field.Tag(tagName))\n\t\tif fieldName == \"\" || fieldName == \"-\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tval := field.Value()\n\n\t\tif opts.Has(\"omitempty\") {\n\t\t\tif field.IsZero() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif z, ok := val.(isZeroer); ok && z.IsZero() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif z, ok := val.(isEmptier); ok && z.IsEmpty() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tkind := field.Kind()\n\t\tif kind == reflect.Ptr {\n\t\t\tv := reflect.ValueOf(val)\n\t\t\tif v.IsNil() {\n\t\t\t\tvmap[fieldName] = \"\"\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\telem := v.Elem()\n\t\t\tkind = elem.Kind()\n\t\t\tval = elem.Interface()\n\t\t}\n\n\t\tif opts.Has(\"include\") && kind == reflect.Struct {\n\t\t\tvar newProperties []string\n\t\t\tfor _, prop := range properties {\n\t\t\t\tif strings.HasPrefix(prop, fieldName+\".\") {\n\t\t\t\t\tnewProperties = append(newProperties, strings.TrimPrefix(prop, fieldName+\".\"))\n\t\t\t\t}\n\t\t\t}\n\t\t\tm, err := ToStringStringMap(tagName, val, newProperties...)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tfor k, v := range m {\n\t\t\t\tvmap[fieldName+\".\"+k] = v\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif v, ok := val.(string); ok {\n\t\t\tvmap[fieldName] = v\n\t\t\tcontinue\n\t\t} else if v, ok := val.(*string); ok {\n\t\t\tvmap[fieldName] = *v\n\t\t\tcontinue\n\t\t}\n\n\t\tif !field.IsZero() {\n\t\t\tif m, ok := val.(encoding.TextMarshaler); ok {\n\t\t\t\ttxt, err := m.MarshalText()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tvmap[fieldName] = string(txt)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif m, ok := val.(json.Marshaler); ok {\n\t\t\t\ttxt, err := m.MarshalJSON()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tvmap[fieldName] = string(txt)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif kind == reflect.String {\n\t\t\tvmap[fieldName] = fmt.Sprint(val)\n\t\t\tcontinue\n\t\t}\n\n\t\tif txt, err := json.Marshal(val); err == nil {\n\t\t\tvmap[fieldName] = string(txt)\n\t\t\tif vmap[fieldName] == `\"\"` || vmap[fieldName] == \"null\" {\n\t\t\t\tvmap[fieldName] = \"\"\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tvmap[fieldName] = fmt.Sprintf(\"%v\", val)\n\t}\n\treturn vmap, nil\n}", "func makeStringMap(in interface{}) map[string]interface{} {\n\treturn in.(map[string]interface{})\n}", "func InputObject(obj map[string]Input) Input {\n\treturn Input{val: obj}\n}", "func ToMap(object *js.Object) map[string]interface{} {\n\treturn object.Interface().(map[string]interface{})\n}", "func ToMap(i interface{}) (map[string]interface{}, error) {\n\tvar stringInterfaceMap map[string]interface{}\n\titr, _ := bson.Marshal(i)\n\terr := bson.Unmarshal(itr, &stringInterfaceMap)\n\treturn stringInterfaceMap, err\n}", "func CreateMap(i interface{}, indent int) (map[string]interface{}, error) {\n\tm := make(map[string]interface{})\n\tv := reflect.ValueOf(i)\n\tif v.Kind() == reflect.Ptr {\n\t\tv = reflect.Indirect(v)\n\t}\n\tif v.Kind() != reflect.Struct {\n\t\treturn nil, ErrNotAStruct\n\t}\n\tif indent > 0 {\n\t\tfmt.Fprintln(writer,\"Struct: \", strings.Repeat(\" \", indent), v.Type().Name())\n\t} else {\n\t\tfmt.Fprintln(writer,\"Struct:\", v.Type().Name())\n\t}\n\tindent++\n\tscanner := bufio.NewScanner(reader)\n\tfor i := 0; i < v.NumField(); i++ {\n\t\tvar t string\n\t\tf := v.Field(i)\n\t\tn := v.Type().Field(i).Name\n\n\t\tswitch f.Kind() {\n\t\tcase reflect.Struct:\n\t\t\tfmt.Fprintf(writer, \"%sEmbedded struct: %s (name: %s)\\n\", strings.Repeat(\" \", indent+1), n, v.Type().Name())\n\t\tcase reflect.Ptr:\n\t\t\tfmt.Fprintf(writer, \"%sEmbedded pointer: %s (name: %s)\\n\", strings.Repeat(\" \", indent+1), n, v.Type().Name())\n\t\tcase reflect.Func, reflect.Uintptr, reflect.UnsafePointer, reflect.Chan:\n\t\t\tcontinue\n\t\tcase reflect.Interface:\n\t\t\t// if this isn't the empty interface we don't want to store data in it\n\t\t\tif f.NumMethod() != 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif f.Kind() == reflect.Map || f.Kind() == reflect.Slice {\n\t\t\t// if we don't have a valid value type, skip it\n\t\t\tvtyp := reflect.New(f.Type().Elem())\n\t\t\t// TODO - fix - this shouldn't be here, too tired when working on this\n\t\t\tif !ValueTypeIsValid(vtyp, 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif f.Kind() != reflect.Struct && f.Kind() != reflect.Ptr {\n\t\t\tfmt.Fprintf(writer, \"%sPlease enter a value for %s (type: %s)\", strings.Repeat(\" \", indent), n, f.Kind().String())\n\t\t\tif f.Kind() == reflect.Slice {\n\t\t\t\tfmt.Fprintf(writer, \"(%s) (enter your values as a comma separated list) ex: '1,2,3', 'I love configs!' - using double quotes will ignore commas inside them, like a csv. For slices of slices, use double quotes around each slice value: ex: \\\"1,2,3\\\",\\\"a,b,c\\\"\", f.Type().Elem())\n\t\t\t}\n\n\t\t\tif f.Kind() == reflect.Map {\n\t\t\t\tfmt.Fprintf(writer, \"KeyType: %s, ValueType:%s, (enter your values as a comma separated list of key value pairs separated by a colon) ex: 'first_key:first_value,second_key:secondvalue'\", f.Type().Key(), f.Type().Elem())\n\t\t\t}\n\n\t\t\tfmt.Fprintf(writer, \"\\n%s\", strings.Repeat(\" \", indent))\n\t\t\tscanner.Scan()\n\t\t\tt = scanner.Text()\n\t\t}\n\n\n\t\ti, err := ParseType(t, f.Type(), indent)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif i != nil {\n\t\t\tm[n] = i\n\t\t}\n\n\t}\n\treturn m, nil\n}", "func (objs Objects) SortMap() (map[string]*Object, []string) {\n\tvar keys []string\n\tres := make(map[string]*Object)\n\tfor _, obj := range objs {\n\t\tif obj.IsValid() {\n\t\t\thash := obj.Hash()\n\t\t\tres[hash] = obj\n\t\t\tkeys = append(keys, hash)\n\t\t}\n\t}\n\tsort.Strings(keys)\n\treturn res, keys\n}", "func ScanStructIntoMap(obj interface{}) (map[string]interface{}, error) {\n\tdataStruct := reflect.Indirect(reflect.ValueOf(obj))\n\tif dataStruct.Kind() != reflect.Struct {\n\t\treturn nil, errors.New(\"expected a pointer to a struct\")\n\t}\n\n\tdataStructType := dataStruct.Type()\n\n\tmapped := make(map[string]interface{})\n\n\tfor i := 0; i < dataStructType.NumField(); i++ {\n\t\tfield := dataStructType.Field(i)\n\t\tfieldName := field.Name\n\n\t\tmapKey := snakeCasedName(fieldName)\n\t\tvalue := dataStruct.FieldByName(fieldName).Interface()\n\n\t\tmapped[mapKey] = value\n\t}\n\n\treturn mapped, nil\n}", "func prepareData(form url.Values, dataFields interface{}) *orderedmap.OrderedMap {\n\n\t//uMap := make(map[string]interface{}, 0)\n\troMap := orderedmap.NewOrderedMap() //return ordered map\n\n\ttypeSlice := readSructColumnsType(dataFields)\n\toMap := keyValOrder(form, dataFields)\n\n\tfor i, key := range oMap.Keys() {\n\t\tvalue, _ := oMap.Get(key)\n\t\tvtype := typeSlice[i]\n\t\t//fmt.Println(key, \"==\", value, \"->\", vtype)\n\t\tvar keyValue string = fmt.Sprintf(\"%v\", value)\n\n\t\tif vtype == \"int\" {\n\n\t\t\tkValue, _ := strconv.Atoi(keyValue)\n\t\t\troMap.Set(key, kValue)\n\n\t\t} else if vtype == \"int64\" {\n\n\t\t\tkValue, _ := strconv.ParseInt(keyValue, 10, 64)\n\t\t\troMap.Set(key, kValue)\n\n\t\t} else if vtype == \"float64\" {\n\n\t\t\tkValue, _ := strconv.ParseFloat(keyValue, 64)\n\t\t\troMap.Set(key, kValue)\n\n\t\t} else if vtype == \"slice\" {\n\n\t\t\troMap.Set(key, form[key.(string)])\n\n\t\t} else {\n\n\t\t\troMap.Set(key, value.(string))\n\t\t}\n\n\t}\n\n\treturn roMap\n}", "func ConvertMapToStruct(v map[string]interface{}) (interface{}, error) {\n\tif v == nil {\n\t\treturn nil, nil\n\t}\n\n\trv := reflect.ValueOf(v)\n\tif !rv.IsValid() {\n\t\treturn nil, xerrors.Errorf(\"%#v is invalid\", v)\n\t}\n\n\tinstance := dynamicstruct.NewStruct()\n\n\ttype KeyValue struct {\n\t\tName string\n\t\tValue reflect.Value\n\t}\n\n\tkeys := rv.MapKeys()\n\tcollectedKeys := make([]KeyValue, len(keys))\n\tfor i, key := range keys {\n\t\tvalue := rv.MapIndex(key)\n\t\tif !value.CanInterface() {\n\t\t\treturn nil, xerrors.Errorf(\"cannot make interface for value of %s\", key.String())\n\t\t}\n\n\t\tif subMap, ok := value.Interface().(map[string]interface{}); ok {\n\t\t\tsubStruct, err := ConvertMapToStruct(subMap)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, xerrors.Errorf(\"cannot convert child map (key=%s) to struct: %w\", key.String(), err)\n\t\t\t}\n\t\t\tvalue = reflect.ValueOf(subStruct)\n\t\t\tif !value.CanInterface() {\n\t\t\t\treturn nil, xerrors.Errorf(\"cannot make interface for value of %s\", key.String())\n\t\t\t}\n\t\t}\n\n\t\tcollectedKeys[i] = KeyValue{\n\t\t\tName: strings.Title(key.String()),\n\t\t\tValue: value.Elem(),\n\t\t}\n\t}\n\n\t// sort keys\n\tsort.Slice(collectedKeys, func(i, j int) bool {\n\t\treturn strings.Compare(collectedKeys[i].Name, collectedKeys[j].Name) < 0\n\t})\n\n\tfor _, key := range collectedKeys {\n\t\tinstance = instance.AddField(key.Name, key.Value.Interface(), \"\")\n\t}\n\n\tst := instance.Build().New()\n\trst := reflect.ValueOf(st).Elem()\n\n\tfor _, key := range collectedKeys {\n\t\tf := rst.FieldByName(key.Name)\n\t\tif !f.IsValid() {\n\t\t\treturn nil, xerrors.Errorf(\"unable to find %s in new struct\", key.Name)\n\t\t}\n\t\tif !f.CanSet() {\n\t\t\treturn nil, xerrors.Errorf(\"unable to set value for %s in new struct\", key.Name)\n\t\t}\n\t\tf.Set(key.Value)\n\t}\n\n\treturn st, nil\n}", "func toValidMap(v, ov R.Value) (R.Value, error) {\n\tvt := v.Type()\n\n\tif !IsBasicKind(vt.Key().Kind()) {\n\t\treturn R.Value{}, &A.InvalidTypeError{Value: ov}\n\t}\n\n\tif err := validateContainerValue(vt.Elem(), ov); err != nil {\n\t\treturn R.Value{}, err\n\t}\n\n\treturn v, nil\n}", "func ToMap(obj interface{}) map[string]interface{} {\n\tvar result map[string]interface{}\n\tresultRec, _ := json.Marshal(obj)\n\tjson.Unmarshal(resultRec, &result)\n\treturn result\n}", "func MapFromInterface(i interface{}) map[string]interface{} {\n\treturn i.(map[string]interface{})\n}", "func Struct2Map(obj interface{}) map[string]interface{} {\n\tv := reflect.ValueOf(obj)\n\tt := v.Elem()\n\ttypeOfType := t.Type()\n\n\tvar data = make(map[string]interface{})\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tvar f string\n\t\tif typeOfType.Field(i).Tag.Get(\"json\") == \"\" {\n\t\t\tf = typeOfType.Field(i).Name\n\t\t} else {\n\t\t\tf = typeOfType.Field(i).Tag.Get(\"json\")\n\t\t}\n\t\tdata[f] = t.Field(i).Interface()\n\t}\n\treturn data\n}", "func convertMapI2MapS(i interface{}) interface{} {\n switch x := i.(type) {\n case map[interface{}]interface{}:\n m2 := map[string]interface{}{}\n for k, v := range x {\n m2[k.(string)] = convertMapI2MapS(v)\n }\n return m2\n case []interface{}:\n for i, v := range x {\n x[i] = convertMapI2MapS(v)\n }\n }\n return i\n}", "func NewFromMap(v map[string]interface{}) Object {\n\treturn v\n}", "func ConvertToMap(input string, kind string) (map[string]string, error) {\n\tresult := make(map[string]string)\n\tif input == \"\" {\n\t\treturn result, nil\n\t}\n\tinputs := strings.Split(input, \",\")\n\treturn ConvertSliceToMap(inputs, kind)\n}", "func KeyValToInterfaceMap(kv *KeyVal) map[string]interface{} {\n\tretv := make(map[string]interface{})\n\tfor el := kv.Oldest(); el != nil; el = el.Next() {\n\t\tretv[fmt.Sprint(el.Key)] = el.Value\n\t}\n\treturn retv\n}", "func (i *Input) ToMap() map[string]interface{} {\n\tvar keys []interface{}\n\tfor _, k := range i.StateKeys {\n\t\tkeys = append(keys, k)\n\t}\n\tvar orgs []interface{}\n\tfor _, org := range i.Organizations {\n\t\torgs = append(orgs, org)\n\t}\n\n\treturn map[string]interface{}{\n\t\t\"keys\": keys,\n\t\t\"organizations\": orgs,\n\t\t\"policy\": i.Policy,\n\t\t\"privateCollection\": i.PrivateCollection,\n\t}\n}", "func (this *ObjectNames) Apply(context Context, arg value.Value) (value.Value, error) {\n\tif arg.Type() == value.MISSING {\n\t\treturn value.MISSING_VALUE, nil\n\t} else if arg.Type() != value.OBJECT {\n\t\treturn value.NULL_VALUE, nil\n\t}\n\n\toa := arg.Actual().(map[string]interface{})\n\tkeys := make(sort.StringSlice, 0, len(oa))\n\tfor key, _ := range oa {\n\t\tkeys = append(keys, key)\n\t}\n\n\tsort.Sort(keys)\n\tra := make([]interface{}, len(keys))\n\tfor i, k := range keys {\n\t\tra[i] = k\n\t}\n\n\treturn value.NewValue(ra), nil\n}", "func (deltaMergeImpl *DeltaMergeImpl) MapOfStringToGameObject(state *map[string]coreminer.GameObject, delta interface{}) map[string]coreminer.GameObject {\n\tdeltaMap := (*deltaMergeImpl).ToDeltaMap(delta)\n\tfor deltaKey, deltaValue := range deltaMap {\n\t\tif (*deltaMergeImpl).IsDeltaRemoved(deltaValue) {\n\t\t\tdelete(*state, deltaKey)\n\t\t} else {\n\t\t\t(*state)[deltaKey] = deltaMergeImpl.GameObject(deltaValue)\n\t\t}\n\t}\n\treturn *state\n}", "func CreateMap(args ...interface{}) map[string]interface{} {\n\tm := make(map[string]interface{}, 0)\n\tkey := \"\"\n\tfor _, v := range args {\n\t\tif len(key) == 0 {\n\t\t\tkey = string(v.(string))\n\t\t} else {\n\t\t\tm[key] = v\n\t\t}\n\t}\n\treturn m\n}", "func toMap(i interface{}) (iMap map[string]interface{}, err error) {\n\tbytes, err := json.Marshal(i)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = json.Unmarshal(bytes, &iMap)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func Struct2Map(st interface{}) map[string]interface{} {\n\tvt := reflect.TypeOf(st)\n\tvv := reflect.ValueOf(st)\n\tvar data = make(map[string]interface{})\n\tfor i := 0; i < vt.NumField(); i++ {\n\t\tf := vt.Field(i)\n\t\tv := vv.Field(i)\n\t\tchKey := f.Tag.Get(\"json\")\n\t\tswitch v.Kind() {\n\t\tcase reflect.String:\n\t\t\tif s, ok := v.Interface().(string); ok && s != \"\" {\n\t\t\t\tdata[chKey] = s\n\t\t\t}\n\t\tcase reflect.Int:\n\t\t\tif i, ok := v.Interface().(int); ok && i != 0 {\n\t\t\t\tdata[chKey] = i\n\t\t\t}\n\t\tcase reflect.Struct:\n\t\t\tif t, ok := v.Interface().(time.Time); ok && t != (time.Time{}) {\n\t\t\t\tdata[chKey] = t\n\t\t\t}\n\t\tcase reflect.Uint64:\n\t\t\tif u64, ok := v.Interface().(uint64); ok && u64 != 0 {\n\t\t\t\tdata[chKey] = u64\n\t\t\t}\n\t\tcase reflect.Int64:\n\t\t\tif u64, ok := v.Interface().(int64); ok && u64 != 0 {\n\t\t\t\tdata[chKey] = u64\n\t\t\t}\n\t\tcase reflect.Uint:\n\t\t\tif u, ok := v.Interface().(uint); ok && u != 0 {\n\t\t\t\tdata[chKey] = u\n\t\t\t}\n\t\tcase reflect.Float32:\n\t\t\tif u, ok := v.Interface().(float32); ok && u != 0 {\n\t\t\t\tdata[chKey] = u\n\t\t\t}\n\t\tcase reflect.Float64:\n\t\t\tif u, ok := v.Interface().(float64); ok && u != 0 {\n\t\t\t\tdata[chKey] = u\n\t\t\t}\n\t\tcase reflect.Bool:\n\t\t\tif u, ok := v.Interface().(bool); ok {\n\t\t\t\tdata[chKey] = u\n\t\t\t}\n\n\t\tdefault:\n\t\t\tglog.Error(\"unsupport common query type: \" + string(chKey))\n\t\t}\n\t}\n\treturn data\n}", "func (k *KeyValue) GetObject(keys ...string) (map[string]string, error) {\n\tresp, err := iterateToKey(k.Raw, keys, k.CaseInsensitive)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tobj := make(map[string]string)\n\tfor key, val := range resp {\n\t\tswitch v := val.(type) {\n\t\tcase string:\n\t\t\tobj[key] = v\n\t\tdefault:\n\t\t\terr := fmt.Sprintf(\"key '%s' with value of type '%s' is invalid, needs to be string\",\n\t\t\t\tkey, reflect.TypeOf(v))\n\t\t\treturn nil, errors.New(err)\n\t\t}\n\t}\n\n\treturn obj, nil\n}", "func GetFieldMap(obj interface{}) (ret map[string]string) {\n\tval := reflect.ValueOf(obj).Elem()\n\tret = make(map[string]string)\n\tfor i := 0; i < val.NumField(); i++ {\n\t\ttypeField := val.Type().Field(i)\n\t\tkey := strings.ToLower(typeField.Name)\n\t\tif typeField.PkgPath != \"\" {\n\t\t\t// Private method\n\t\t\tcontinue\n\t\t} else {\n\t\t\tret[key] = typeField.Name\n\t\t}\n\t}\n\treturn\n}", "func Struct2Map(v interface{}) (map[string]interface{}, error) {\n bytes, err := json.Marshal(v)\n if err != nil {\n return nil, err\n }\n data := make(map[string]interface{})\n if err := json.Unmarshal(bytes, &data); err != nil {\n return nil, err\n }\n return data, nil\n}", "func (opts UpdateOpts) ToObjectUpdateMap() (map[string]string, error) {\n\th, err := gophercloud.BuildHeaders(opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor k, v := range opts.Metadata {\n\t\th[\"X-Object-Meta-\"+k] = v\n\t}\n\treturn h, nil\n}", "func toMap(params []interface{}) map[string]interface{} {\n\tpar := make(map[string]interface{})\n\tif len(params) == 0 {\n\t\treturn par\n\t}\n\tif len(params)%2 != 0 {\n\t\tpanic(\"WithParams: len(params) % 2 != 0\")\n\t}\n\tfor i := 0; i < len(params)/2; i++ {\n\t\tkey, ok := params[2*i].(string)\n\t\tif !ok {\n\t\t\tpanic(\"WithParams: string expected\")\n\t\t}\n\t\tpar[key] = params[2*i+1]\n\t}\n\treturn par\n}", "func ConvertInterfaceMap(interfaceMap map[interface{}]interface{}) map[string]interface{} {\n\tstringMap := make(map[string]interface{})\n\tfor key, value := range interfaceMap {\n\t\tswitch key := key.(type) {\n\t\tcase string:\n\t\t\tswitch value := value.(type) {\n\t\t\tcase map[string]interface{}:\n\t\t\t\tval := ConvertStringMap(value)\n\t\t\t\tstringMap[key] = val\n\t\t\tcase map[interface{}]interface{}:\n\t\t\t\tval := ConvertInterfaceMap(value)\n\t\t\t\tstringMap[key] = val\n\t\t\tcase []interface{}:\n\t\t\t\tval := ConvertInterfaceArray(value)\n\t\t\t\tstringMap[key] = val\n\t\t\tdefault:\n\t\t\t\tstringMap[key] = value\n\t\t\t}\n\t\t\t// if str, ok := value.(map[interface{}]interface{}); ok {\n\t\t\t// val := ConvertMap(value)\n\t\t\t// stringMap[key] = val\n\t\t\t// } else {\n\t\t\t// stringMap[key] = value\n\t\t\t// }\n\t\t}\n\t}\n\treturn stringMap\n}", "func InterfaceToStringMap(i interface{}) map[string]string {\n\tstringMap := map[string]string{}\n\tfor key, value := range i.(map[interface{}]interface{}) {\n\t\tstringMap[key.(string)] = value.(string)\n\t}\n\treturn stringMap\n}", "func mapCreate(name, rollNo, height, weight, averageMarks, extraCurricularGrade string) map[string]string {\n\tvar mapRet = map[string]string{\n\t\t\"name\": name,\n\t\t\"roll_no\": rollNo,\n\t\t\"weight\": weight,\n\t\t\"height\": height,\n\t\t\"avg_marks\": averageMarks,\n\t\t\"extra_curr_grades\": extraCurricularGrade,\n\t}\n\treturn mapRet\n}", "func kindMapStringToType(o map[string]string) (map[string]kindElement, error) {\n\tr := make(map[string]kindElement)\n\tvar err error\n\tfor k, v := range o {\n\t\tr[k], err = kindFromString(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn r, nil\n}", "func ConvertRecord(binMap as.BinMap) map[string]interface{} {\n\tbins := make(map[string]interface{})\n\tfor key, value := range binMap {\n\t\tswitch value := value.(type) {\n\t\tcase map[string]interface{}:\n\t\t\tlog.Println(\"converting stringMap \", key)\n\t\t\tval := ConvertStringMap(value)\n\t\t\tbins[key] = val\n\t\tcase map[interface{}]interface{}:\n\t\t\tlog.Println(\"converting interfaceMap \", key)\n\t\t\tval := ConvertInterfaceMap(value)\n\t\t\tbins[key] = val\n\t\tcase []interface{}:\n\t\t\tlog.Println(\"converting interfaceArray \", key)\n\t\t\tval := ConvertInterfaceArray(value)\n\t\t\tbins[key] = val\n\t\tdefault:\n\t\t\tlog.Println(\"converting normal \", key)\n\t\t\tbins[key] = value\n\t\t}\n\t}\n\treturn bins\n}", "func (h *sizeHistogram) toMap() map[string]uint64 {\n\tres := make(map[string]uint64, dataUsageBucketLen)\n\tfor i, count := range h {\n\t\tres[ObjectsHistogramIntervals[i].name] = count\n\t}\n\treturn res\n}", "func (o *Input) ToMap() map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"message\": o.Message,\n\t}\n}", "func makeInput() Map {\n\treturn Map{\n\t\t\"a\": 25,\n\t\t\"b\": float32(2.5),\n\t\t\"c\": float64(2.5),\n\t\t\"d\": true,\n\t\t\"e\": false,\n\t\t\"f\": \"25\",\n\t\t\"g\": nil,\n\t}\n}", "func InputTypeToStructMap(t string) IInputSchema {\n\tswitch t {\n\tcase TextInputType:\n\t\treturn TextInputSchema{}\n\tcase TableInputType:\n\t\treturn TableInputSchema{}\n\tcase ImageInputType:\n\t\treturn ImageInputSchema{}\n\t}\n\treturn nil\n}", "func AutotypeMap(input map[string]interface{}) map[string]interface{} {\n\tret := make(map[string]interface{})\n\tfor key, value := range input {\n\t\tret[key] = AutotypeValue(value)\n\t}\n\n\treturn ret\n}", "func (rb *reportBucket) UpdateKindMap() {\n\toSlice := objectSlice(rb.objects)\n\tsort.Sort(oSlice)\n\tkindMap := make(map[string][]*reportObject)\n\tfor _, object := range rb.objects {\n\t\tif object.kind == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tkindMap[object.kind] = append(kindMap[object.kind], object)\n\t}\n\trb.kindMap = kindMap\n}", "func (s SliceOfBar) AsMap() map[string]*Bar {\n\tresult := make(map[string]*Bar)\n\tfor _, value := range s {\n\t\tresult[value.ID] = value\n\t}\n\treturn result\n}", "func ToObject(u map[string]interface{}, obj interface{}) error {\n\treturn runtime.DefaultUnstructuredConverter.FromUnstructured(u, obj)\n}", "func (s *MapSchema) Generic(datum interface{}) (interface{}, error) {\n\tdict := make(map[string]interface{})\n\tif stringMap, ok := datum.(map[string]interface{}); ok {\n\t\tfor field, v := range stringMap {\n\t\t\tif val, err := s.Values.Generic(v); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t} else {\n\t\t\t\tdict[field] = val\n\t\t\t}\n\t\t}\n\t} else if genericMap, ok := datum.(map[interface{}]interface{}); ok {\n\t\tfor k, v := range genericMap {\n\t\t\tfield := \"\"\n\t\t\tif f, ok := k.(string); ok {\n\t\t\t\tfield = f\n\t\t\t} else if f, ok := k.(fmt.Stringer); ok {\n\t\t\t\tfield = f.String()\n\t\t\t}\n\t\t\tif field != \"\" {\n\t\t\t\tif val, err := s.Values.Generic(v); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t} else {\n\t\t\t\t\tdict[field] = val\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\treturn nil, fmt.Errorf(\"don't know how to convert datum to a map value: %v\", datum)\n\t}\n\treturn dict, nil\n}", "func FlattenStruct(obj interface{}, def ...string) map[string]interface{} {\n\tfields := make(map[string]interface{}, 0)\n\tobjValue := reflect.ValueOf(obj)\n\tobjType := reflect.TypeOf(obj)\n\n\tvar prefix string\n\tif len(def) > 0 {\n\t\tprefix = def[0]\n\t}\n\n\tfor i := 0; i < objType.NumField(); i++ {\n\t\tattrField := objValue.Type().Field(i)\n\t\tvalueField := objValue.Field(i)\n\t\tvar key bytes.Buffer\n\t\tkey.WriteString(prefix + attrField.Name)\n\n\t\tswitch valueField.Kind() {\n\t\tcase reflect.Struct:\n\t\t\ttmpMap := FlattenStruct(valueField.Interface(), attrField.Name+\".\")\n\t\t\tfor k, v := range tmpMap {\n\t\t\t\tfields[k] = v\n\t\t\t}\n\t\tcase reflect.Float64:\n\t\t\tfields[key.String()] = valueField.Float()\n\t\tcase reflect.String:\n\t\t\tfields[key.String()] = valueField.String()\n\t\tcase reflect.Int64:\n\t\t\tfields[key.String()] = valueField.Int()\n\t\tcase reflect.Bool:\n\t\t\tfields[key.String()] = valueField.Bool()\n\t\tdefault:\n\t\t\tfields[key.String()] = valueField.Interface()\n\t\t}\n\t}\n\treturn fields\n}", "func Convert(datum map[string]interface{}, schema string) (map[string]interface{}, error) {\n\tvar err error\n\tvar parsedSchema, converted map[string]interface{}\n\tvar out interface{}\n\n\tif err = json.Unmarshal([]byte(schema), &parsedSchema); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif out, err = derive(datum, parsedSchema); err != nil {\n\t\treturn nil, err\n\t}\n\n\tconverted, _ = out.(map[string]interface{})\n\treturn converted, nil\n}", "func ChangeIntoStruct(in interface{}, mapInit map[string]interface{}) error {\n\tif in == nil {\n\t\treturn fmt.Errorf(\"interface is empty\")\n\t}\n\tval := reflect.ValueOf(in)\n\tif val.Kind() == reflect.Ptr {\n\t\tval = val.Elem()\n\t}\n\tif val.Kind() == reflect.Struct {\n\t\tfor i := 0; i < val.NumField(); i += 1 {\n\t\t\ttypeField := val.Type().Field(i)\n\t\t\tif typeField.Type.Kind() == reflect.Slice { // if we need to parse Slice\n\t\t\t\tfor j := 0; j < val.Field(i).Len(); j += 1 {\n\t\t\t\t\titemStruct := val.Field(i).Index(j)\n\t\t\t\t\tChangeIntoStruct(itemStruct.Addr().Interface(), mapInit)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tif typeField.Type.Kind() == reflect.Struct { // if we need to parse Struct\n\t\t\t\tChangeIntoStruct(val.Field(i).Addr().Interface(), mapInit)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tmapValue, ok := mapInit[typeField.Name]\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tswitch typeField.Type.Kind() {\n\t\t\tcase reflect.Int64:\n\t\t\t\tval.Field(i).SetInt(mapValue.(int64))\n\t\t\tcase reflect.String:\n\t\t\t\tval.Field(i).SetString(mapValue.(string))\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"type mistamtch to assign the value\")\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func toValues(in interface{}) (map[string]interface{}, error) {\n\tif in == nil {\n\t\treturn nil, nil\n\t}\n\tout := make(map[string]interface{})\n\tbytes, err := yaml.Marshal(in)\n\tif err == nil {\n\t\terr = yaml.Unmarshal(bytes, &out)\n\t}\n\treturn out, err\n}", "func parseMap(v interface{}) (map[string]interface{}, error) {\n\tstructRfl := reflect.ValueOf(v)\n\n\tresult := map[string]interface{}{}\n\n\t// Fail if the passed type is not a map\n\tif structRfl.Kind() != reflect.Map {\n\t\treturn result, fmt.Errorf(\"Expected map, got: %s\", structRfl.Kind().String())\n\t}\n\n\tmapRange := structRfl.MapRange()\n\tfor mapRange.Next() {\n\t\tresult[mapRange.Key().String()] = mapRange.Value().Interface()\n\t}\n\n\treturn result, nil\n}", "func (this *DynMap) ToMap() map[string]interface{} {\n\tmp := make(map[string]interface{})\n\tfor k, v := range(this.Map) {\n\t\tsubmp, ok := ToDynMap(this.Map[k])\n\t\tif ok {\n\t\t\tv = submp.ToMap()\n\t\t}\n\t\tmp[k] = v\n\t}\n\treturn mp\n}", "func (o *KanbanColumns) ToMap() map[string]interface{} {\n\to.setDefaults(true)\n\treturn map[string]interface{}{\n\t\t// IssueIds the issue ids for the column\n\t\t\"issue_ids\": toKanbanColumnsObject(o.IssueIds, false),\n\t\t// Name the name of the column\n\t\t\"name\": toKanbanColumnsObject(o.Name, false),\n\t}\n}", "func MakeStringDict(m map[string]interface{}) (skylark.StringDict, error) {\n\tdict := make(skylark.StringDict, len(m))\n\tfor k, v := range m {\n\t\tval, err := ToValue(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdict[k] = val\n\t}\n\treturn dict, nil\n}", "func (this *ObjectValues) Apply(context Context, arg value.Value) (value.Value, error) {\n\tif arg.Type() == value.MISSING {\n\t\treturn value.MISSING_VALUE, nil\n\t} else if arg.Type() != value.OBJECT {\n\t\treturn value.NULL_VALUE, nil\n\t}\n\n\toa := arg.Actual().(map[string]interface{})\n\tkeys := make(sort.StringSlice, 0, len(oa))\n\tfor key, _ := range oa {\n\t\tkeys = append(keys, key)\n\t}\n\n\tsort.Sort(keys)\n\tra := make([]interface{}, len(keys))\n\tfor i, k := range keys {\n\t\tra[i] = oa[k]\n\t}\n\n\treturn value.NewValue(ra), nil\n}", "func (this *ObjectValues) Apply(context Context, arg value.Value) (value.Value, error) {\n\tif arg.Type() == value.MISSING {\n\t\treturn value.MISSING_VALUE, nil\n\t} else if arg.Type() != value.OBJECT {\n\t\treturn value.NULL_VALUE, nil\n\t}\n\n\toa := arg.Actual().(map[string]interface{})\n\tkeys := make(sort.StringSlice, 0, len(oa))\n\tfor key, _ := range oa {\n\t\tkeys = append(keys, key)\n\t}\n\n\tsort.Sort(keys)\n\tra := make([]interface{}, len(keys))\n\tfor i, k := range keys {\n\t\tra[i] = oa[k]\n\t}\n\n\treturn value.NewValue(ra), nil\n}", "func (o *ExportDataPartial) ToMap() map[string]interface{} {\n\tkv := map[string]interface{}{\n\t\t\"job_id\": toExportDataObject(o.JobID, true),\n\t\t\"objects\": toExportDataObject(o.Objects, true),\n\t}\n\tfor k, v := range kv {\n\t\tif v == nil || reflect.ValueOf(v).IsZero() {\n\t\t\tdelete(kv, k)\n\t\t} else {\n\t\t}\n\t}\n\treturn kv\n}", "func (element String) MarshalMap() map[string]any {\n\n\tresult := map[string]any{\n\t\t\"type\": TypeString,\n\t\t\"required\": element.Required,\n\t}\n\n\tif element.Default != \"\" {\n\t\tresult[\"default\"] = element.Default\n\t}\n\n\tif element.MinLength > 0 {\n\t\tresult[\"minLength\"] = element.MinLength\n\t}\n\n\tif element.MaxLength > 0 {\n\t\tresult[\"maxLength\"] = element.MaxLength\n\t}\n\n\tif element.Pattern != \"\" {\n\t\tresult[\"pattern\"] = element.Pattern\n\t}\n\n\tif element.Format != \"\" {\n\t\tresult[\"format\"] = element.Format\n\t}\n\n\tif len(element.Enum) > 0 {\n\t\tresult[\"enum\"] = element.Enum\n\t}\n\n\tif element.RequiredIf != \"\" {\n\t\tresult[\"required-if\"] = element.RequiredIf\n\t}\n\n\treturn result\n}", "func MapToStruct(m map[string]interface{}, struc interface{}) error {\n\t//fmt.Printf(\"Input map: %+v\\n\", m)\n\t//fmt.Printf(\"Input struc: %+v\\n\", struc)\n\tval := r.Indirect(r.ValueOf(struc))\n\tsinfo := getStructInfo(val)\n\t//fmt.Printf(\"sinfo: %+v\\n\", sinfo)\n\tfor k, v := range m {\n\t\t//fmt.Printf(\"k: %+v v: %+v\\n\", k, v)\n\t\tif info, ok := sinfo.FieldsMap[k]; ok {\n\t\t\t//fmt.Printf(\"info: %+v\\n\", info)\n\t\t\tstructField := val.Field(info.Num)\n\t\t\t//fmt.Printf(\"type struct: %q, %q, %q\\n\", structField.Type(), structField.Type().Name(), structField.Kind())\n\t\t\t//fmt.Printf(\"type value: %q\\n\", r.TypeOf(v).Name())\n\t\t\t//fmt.Printf(\"value: %+v\\n\", r.ValueOf(v))\n\t\t\tif structField.Kind().String() == \"slice\" && r.TypeOf(v).Kind().String() == \"slice\" {\n\t\t\t\tif structField.Type().Elem() == r.TypeOf(v).Elem() {\n\t\t\t\t\t//fmt.Print(\"Slices of same type\\n\")\n\t\t\t\t\tstructField.Set(r.ValueOf(v))\n\t\t\t\t} else if structField.Type().Elem().Kind().String() == r.TypeOf(v).Elem().Kind().String() {\n\t\t\t\t\t//fmt.Print(\"Slices of same kind\\n\")\n\t\t\t\t\ts := r.ValueOf(v)\n\t\t\t\t\tresult := r.MakeSlice(structField.Type(), 0, s.Len())\n\t\t\t\t\tfor j := 0; j < s.Len(); j++ {\n\t\t\t\t\t\tresult = r.Append(result, r.ValueOf(s.Index(j).Interface()).Convert(structField.Type().Elem()))\n\t\t\t\t\t}\n\t\t\t\t\tstructField.Set(result)\n\t\t\t\t} else if r.TypeOf(v).Elem().String() == \"string\" {\n\t\t\t\t\t//fmt.Print(\"Slices of different kind\\n\")\n\t\t\t\t\tstringList := v.([]string)\n\t\t\t\t\tresult := r.MakeSlice(structField.Type(), 0, len(stringList))\n\t\t\t\t\tfor _, str := range stringList {\n\t\t\t\t\t\ttmp := r.New(structField.Type().Elem())\n\t\t\t\t\t\terr := json.Unmarshal([]byte(str), tmp.Interface())\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t//fmt.Printf(\"Unmarshal failed on: %q due to: %q!!!\\n\", str, err)\n\t\t\t\t\t\t\t//return err\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresult = r.Append(result, r.Indirect(tmp))\n\t\t\t\t\t}\n\t\t\t\t\tstructField.Set(result)\n\t\t\t\t}\n\t\t\t} else if structField.Type().Name() == \"\" || r.TypeOf(v).Name() == \"\" {\n\t\t\t\treturn fmt.Errorf(\"WTF are these types???!!! %q %q\\n\", structField.Kind().String(), r.TypeOf(v).Kind().String())\n\t\t\t} else if structField.Type().Name() == r.TypeOf(v).Name() {\n\t\t\t\t//fmt.Print(\"Field set naturally!!!\\n\")\n\t\t\t\tstructField.Set(r.ValueOf(v))\n\t\t\t} else if structField.Kind().String() == r.TypeOf(v).Name() {\n\t\t\t\t//fmt.Print(\"Field set with convert !!!\\n\")\n\t\t\t\tstructField.Set(r.ValueOf(v).Convert(structField.Type()))\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"Please handle these types: %s with %s\\n\", structField.Kind().String(), r.TypeOf(v).Kind().String())\n\t\t\t}\n\t\t} else {\n\t\t\t//fmt.Printf(\"field %q not found\\n\", k) TODO: in which situation do we reach this point? oO\n\t\t}\n\t\t//fmt.Printf(\"Check fill struc: %+v\\n\", struc)\n\t}\n\treturn nil\n}", "func getNameAndValue(m *dto.Metric) map[string]interface{} {\n\tfields := make(map[string]interface{})\n\tif m.Gauge != nil {\n\t\tif !math.IsNaN(m.GetGauge().GetValue()) {\n\t\t\t//nolint:unconvert // Conversion may be needed for float64 https://github.com/mdempsky/unconvert/issues/40\n\t\t\tfields[\"gauge\"] = float64(m.GetGauge().GetValue())\n\t\t}\n\t} else if m.Counter != nil {\n\t\tif !math.IsNaN(m.GetCounter().GetValue()) {\n\t\t\t//nolint:unconvert // Conversion may be needed for float64 https://github.com/mdempsky/unconvert/issues/40\n\t\t\tfields[\"counter\"] = float64(m.GetCounter().GetValue())\n\t\t}\n\t} else if m.Untyped != nil {\n\t\tif !math.IsNaN(m.GetUntyped().GetValue()) {\n\t\t\t//nolint:unconvert // Conversion may be needed for float64 https://github.com/mdempsky/unconvert/issues/40\n\t\t\tfields[\"value\"] = float64(m.GetUntyped().GetValue())\n\t\t}\n\t}\n\treturn fields\n}", "func (i *Input) FromMap(values map[string]interface{}) error {\n\tvar err error\n\tvar keys interface{}\n\tif keys, err = coerce.ToAny(values[\"keys\"]); err != nil {\n\t\treturn err\n\t}\n\tswitch v := keys.(type) {\n\tcase []interface{}:\n\t\tfor _, d := range v {\n\t\t\tk := strings.TrimSpace(d.(string))\n\t\t\tif len(k) > 0 {\n\t\t\t\ti.StateKeys = append(i.StateKeys, k)\n\t\t\t}\n\t\t}\n\tcase string:\n\t\ti.StateKeys = []string{strings.TrimSpace(v)}\n\t}\n\n\tvar orgs interface{}\n\tif orgs, err = coerce.ToAny(values[\"organizations\"]); err != nil {\n\t\treturn err\n\t}\n\tswitch v := orgs.(type) {\n\tcase []interface{}:\n\t\tfor _, d := range v {\n\t\t\tk := strings.TrimSpace(d.(string))\n\t\t\tif len(k) > 0 {\n\t\t\t\ti.Organizations = append(i.Organizations, k)\n\t\t\t}\n\t\t}\n\tcase string:\n\t\ti.Organizations = []string{strings.TrimSpace(v)}\n\t}\n\n\tif i.Policy, err = coerce.ToString(values[\"policy\"]); err != nil {\n\t\treturn err\n\t}\n\tif i.PrivateCollection, err = coerce.ToString(values[\"privateCollection\"]); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func InterfaceToMapString(subject interface{}) map[string]string {\n\tswitch ReflectKind(subject) {\n\tcase reflect.String:\n\t\treturn JSONStringToMap(subject.(string))\n\t}\n\n\treturn nil\n}", "func ConvertSliceToMap(inputs []string, kind string) (map[string]string, error) {\n\tresult := make(map[string]string)\n\tfor _, input := range inputs {\n\t\tc := strings.Index(input, \":\")\n\t\tswitch {\n\t\tcase c == 0:\n\t\t\t// key is not passed\n\t\t\treturn nil, fmt.Errorf(\"invalid %s: '%s' (%s)\", kind, input, \"need k:v pair where v may be quoted\")\n\t\tcase c < 0:\n\t\t\t// only key passed\n\t\t\tresult[input] = \"\"\n\t\tdefault:\n\t\t\t// both key and value passed\n\t\t\tkey := input[:c]\n\t\t\tvalue := trimQuotes(input[c+1:])\n\t\t\tresult[key] = value\n\t\t}\n\t}\n\treturn result, nil\n}", "func bookInfoToMap(in BookInfo) map[string]string {\n\tret := make(map[string]string)\n\tv := reflect.ValueOf(in)\n\ttyp := v.Type()\n\tfor i := 0; i < v.NumField(); i++ {\n\t\tf := v.Field(i)\n\t\tvar v string\n\t\tswitch f.Type().Kind() {\n\t\tcase reflect.Slice, reflect.Array:\n\t\t\tv = fmt.Sprintf(\"%d\", f.Len())\n\t\tdefault:\n\t\t\tv = fmt.Sprintf(\"%s\", f.String())\n\t\t}\n\t\tret[typ.Field(i).Name] = v\n\t}\n\treturn ret\n}", "func (ud *UserData) ToMap() UserDataMap {\n\tif ud == nil {\n\t\treturn nil\n\t}\n\tm := UserDataMap{}\n\tud.Range(func(key, value interface{}) bool {\n\t\tm[key.(string)] = value.(string)\n\t\treturn true\n\t})\n\treturn m\n}", "func StructToMap(i interface{}) (values map[string]interface{}) {\n\tvalues = map[string]interface{}{}\n\tiVal := reflect.Indirect(reflect.ValueOf(&i)).Elem()\n\ttyp := iVal.Type()\n\tfor i := 0; i < iVal.NumField(); i++ {\n\t\tf := iVal.Field(i)\n\t\t// You ca use tags here...\n\t\t// tag := typ.Field(i).Tag.Get(\"tagname\")\n\t\t// Convert each type into a string for the url.Values string map\n\t\tvar v string\n\t\tswitch f.Interface().(type) {\n\t\tcase int, int8, int16, int32, int64:\n\t\t\tv = strconv.FormatInt(f.Int(), 10)\n\t\tcase uint, uint8, uint16, uint32, uint64:\n\t\t\tv = strconv.FormatUint(f.Uint(), 10)\n\t\tcase float32:\n\t\t\tv = strconv.FormatFloat(f.Float(), 'f', 4, 32)\n\t\tcase float64:\n\t\t\tv = strconv.FormatFloat(f.Float(), 'f', 4, 64)\n\t\tcase []byte:\n\t\t\tv = string(f.Bytes())\n\t\tcase string:\n\t\t\tv = f.String()\n\t\t}\n\t\tvalues[typ.Field(i).Name] = v\n\t}\n\treturn\n}", "func (controller *Controller) parseObjectFromMap(objectData map[string]interface{}) (*object.Object, error) {\n\terrorMessage := \"unable to parse object\"\n\n\tname, err := controller.parseStringFromMap(objectData, \"name\")\n\tif err != nil {\n\t\treturn nil, errors.New(errorMessage)\n\t}\n\n\tcolor, specularReflection, roughness, transmissionReflection, diffuseReflection, err :=\n\t\tcontroller.parseLightCharacteristicsFromMap(objectData)\n\tif err != nil {\n\t\treturn nil, errors.New(errorMessage)\n\t}\n\n\tnormals, err := controller.parseNormalsFromMap(objectData)\n\tif err != nil {\n\t\treturn nil, errors.New(errorMessage)\n\t}\n\n\trepository, err := controller.parseRepositoryFromMap(objectData)\n\tif err != nil {\n\t\treturn nil, errors.New(errorMessage)\n\t}\n\n\ttriangles, err := controller.parseTrianglesFromMap(objectData)\n\tif err != nil {\n\t\treturn nil, errors.New(errorMessage)\n\t}\n\n\tparsedObject, err := object.Init(name, repository, triangles, normals, color, specularReflection, roughness,\n\t\ttransmissionReflection, diffuseReflection)\n\tif err != nil {\n\t\treturn nil, errors.New(errorMessage)\n\t}\n\treturn parsedObject, nil\n}", "func ToStringMapStringSlice(i interface{}) (map[string][]string, error) {\n\tvar m = map[string][]string{}\n\n\tswitch v := i.(type) {\n\tcase map[string][]string:\n\t\treturn v, nil\n\tcase map[string][]interface{}:\n\t\tfor k, val := range v {\n\t\t\tm[MustToString(k)] = MustToStringSlice(val)\n\t\t}\n\t\treturn m, nil\n\tcase map[string]string:\n\t\tfor k, val := range v {\n\t\t\tm[MustToString(k)] = []string{val}\n\t\t}\n\tcase map[string]interface{}:\n\t\tfor k, val := range v {\n\t\t\t//m[MustToString(k)] = []string{MustToString(val)}\n\t\t\tm[MustToString(k)] = MustToStringSlice(val)\n\t\t}\n\t\treturn m, nil\n\tcase map[interface{}][]string:\n\t\tfor k, val := range v {\n\t\t\tm[MustToString(k)] = MustToStringSlice(val)\n\t\t}\n\t\treturn m, nil\n\tcase map[interface{}]string:\n\t\tfor k, val := range v {\n\t\t\tm[MustToString(k)] = MustToStringSlice(val)\n\t\t}\n\t\treturn m, nil\n\tcase map[interface{}][]interface{}:\n\t\tfor k, val := range v {\n\t\t\tm[MustToString(k)] = MustToStringSlice(val)\n\t\t}\n\t\treturn m, nil\n\tcase map[interface{}]interface{}:\n\t\tfor k, val := range v {\n\t\t\tkey, err := ToString(k)\n\t\t\tif err != nil {\n\t\t\t\treturn m, fmt.Errorf(\"unable to cast %#v to map[string][]string\", i)\n\t\t\t}\n\t\t\tvalue, err := ToStringSlice(val)\n\t\t\tif err != nil {\n\t\t\t\treturn m, fmt.Errorf(\"unable to Cast %#v to map[string][]string\", i)\n\t\t\t}\n\t\t\tm[key] = value\n\n\t\t}\n\tdefault:\n\t\treturn m, fmt.Errorf(\"unable to Cast %#v to map[string][]string\", i)\n\t}\n\treturn m, nil\n}", "func (user *User) ConvertToMap() map[string]interface{} {\n\treturn map[string]interface{} {\n\t\t\"ID\": user.ID,\n\t\t\"Email\": user.Email,\n\t\t\"HashedPassword\": user.HashedPassword,\n\t\t\"Gender\": user.Gender,\n\t\t\"Nickname\": user.Nickname,\n\t\t\"Role\": user.Role,\n\t\t\"IsOnline\": user.IsOnline,\n\t\t\"IsBlocked\": user.IsBlocked,\n\t\t\"IpAddr\": user.IpAddr,\n\t\t\"LimitationPeriod\": user.LimitationPeriod,\n\t\t\"LoginTime\": user.LoginTime,\n\t}\n}", "func (opts CreateOpts) ToObjectCreateParams() (map[string]string, string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\th, err := gophercloud.BuildHeaders(opts)\n\tif err != nil {\n\t\treturn nil, q.String(), err\n\t}\n\n\tfor k, v := range opts.Metadata {\n\t\th[\"X-Object-Meta-\"+k] = v\n\t}\n\n\treturn h, q.String(), nil\n}", "func (m OrderedMap[K, V]) ToMap() map[K]V {\n\tresult := map[K]V{}\n\tfor _, item := range m.ToSlice() {\n\t\tresult[item.Key] = item.Value\n\t}\n\treturn result\n}", "func MustToStringMap(i interface{}) map[string]interface{} {\n\tv, _ := ToStringMap(i)\n\treturn v\n}", "func newMap(src *map[string]interface{}) map[string]interface{} {\n\tdst := make(map[string]interface{})\n\tif src == nil {\n\t\treturn dst\n\t}\n\tfor k, v := range *src {\n\t\tif strings.HasPrefix(k, \"_\") {\n\t\t\tcontinue\n\t\t}\n\t\tdst[k] = v\n\t}\n\treturn dst\n}", "func (a *PhonebookAccess1Properties) ToMap() (map[string]interface{}, error) {\n\treturn props.ToMap(a), nil\n}", "func toStringMap(input map[string][]byte) map[string]string {\n\tif input == nil {\n\t\treturn nil\n\t}\n\n\tresult := map[string]string{}\n\n\tfor k, v := range input {\n\t\tresult[k] = string(v)\n\t}\n\n\treturn result\n}", "func Test_interface001(t *testing.T) {\n\ts1 := make([]int, 10, 20)\n\ttest1(&s1)\n\tfmt.Println(s1)\n\n\tfmt.Println(len(s1))\n\n\ts2 := make(map[string]int)\n\ttest2(s2)\n\tfmt.Println(s2)\n\tfmt.Println(s2[\"aaaaa\"])\n\n\ts3 := make(map[string]sample1)\n\ttest2(s3)\n\tfmt.Println(s3)\n\n\ttype1 := reflect.MapOf(reflect.TypeOf(\"\"), reflect.TypeOf(1))\n\tfmt.Println(type1)\n\tfmt.Println(type1.Elem().Kind())\n\ts4 := reflect.MakeMap(type1)\n\tfmt.Println(s4.Kind())\n\tfmt.Println(s4.Type().Key().Kind())\n\tfmt.Println(s4.Type().Elem().Kind())\n\n\ts4.SetMapIndex(reflect.ValueOf(\"ccccc\"), reflect.ValueOf(3333))\n\n\tfmt.Println(s4)\n\n}", "func JSONString2MapInterface(str string) (map[string]interface{}, error) {\n\tresult := make(map[string]interface{})\n\terr := json.Unmarshal([]byte(str), &result)\n\treturn result, err\n}", "func ToStringMapString(i interface{}) (map[string]string, error) {\n\tvar m = map[string]string{}\n\n\tswitch v := i.(type) {\n\tcase map[string]string:\n\t\treturn v, nil\n\tcase map[string]interface{}:\n\t\tfor k, val := range v {\n\t\t\tm[MustToString(k)] = MustToString(val)\n\t\t}\n\t\treturn m, nil\n\tcase map[interface{}]string:\n\t\tfor k, val := range v {\n\t\t\tm[MustToString(k)] = MustToString(val)\n\t\t}\n\t\treturn m, nil\n\tcase map[interface{}]interface{}:\n\t\tfor k, val := range v {\n\t\t\tm[MustToString(k)] = MustToString(val)\n\t\t}\n\t\treturn m, nil\n\tdefault:\n\t\treturn m, fmt.Errorf(\"unable to cast %#v to map[string]string\", i)\n\t}\n}", "func Map(v interface{}) map[string]interface{} {\n\treturn New(v).Map()\n}", "func (object Object) Map(property string, value string, language string) Object {\n\n\t// If property is empty, do not change\n\tif property == \"\" {\n\t\treturn object\n\t}\n\n\t// If value is empty, then do not change\n\tif value == \"\" {\n\t\treturn object\n\t}\n\n\t// If we don't already have a default property, then add it now.\n\tif _, ok := object[property]; !ok {\n\t\tobject[property] = value\n\t}\n\n\t// If language is empty, then do not put an entry in the map\n\tif language == \"\" {\n\t\treturn object\n\t}\n\n\t// Otherwise, add an entry into the language map, too.\n\t// If we don't already have a propertyMap, then add it now\n\tpropertyMap := property + \"Map\"\n\tif _, ok := object[propertyMap]; !ok {\n\t\tobject[propertyMap] = map[string]string{}\n\t}\n\n\t// Safely set the value of the propertyMap\n\tif propertyMap, ok := object[propertyMap].(map[string]string); ok {\n\t\tpropertyMap[language] = value\n\t}\n\n\t// Success!\n\treturn object\n}", "func copyParamValuesIntoMap(dst map[string]interface{}, src interface{}) {\n\t// nil is empty map, just bail with log\n\tif src == nil {\n\t\tlogrus.Debugf(\"src is nil; no work to do\")\n\t\treturn\n\t}\n\t// convert the interface to a map type to walk its keys/values\n\tif srcMap := convertInterfaceToMap(src); srcMap != nil {\n\t\tfor k, v := range srcMap {\n\t\t\t_, value := fetchMetaValue(\"value\", v)\n\t\t\tif _, ok := value.(string); ok {\n\t\t\t\tdst[k] = v\n\t\t\t} else {\n\t\t\t\tlogrus.Tracef(\"value for key %s is of type %T; skipping\", k, value)\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// If not map, warn and bail\n\t\tlogrus.Warnf(\"src is not a map type; skipping\")\n\t}\n}", "func (u *Util) StructToMap(data interface{}) (map[string]interface{}, error) {\n result := make(map[string]interface{})\n\n b, err := json.Marshal(data)\n if err != nil { return nil, err }\n\n err = json.Unmarshal(b, &result)\n return result, err\n}", "func (opts CopyOpts) ToObjectCopyMap() (map[string]string, error) {\n\tif opts.Destination == \"\" {\n\t\treturn nil, fmt.Errorf(\"Required CopyOpts field 'Destination' not set.\")\n\t}\n\th, err := gophercloud.BuildHeaders(opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor k, v := range opts.Metadata {\n\t\th[\"X-Object-Meta-\"+k] = v\n\t}\n\treturn h, nil\n}", "func mapDecodeObj(obj interface{}, customProvider PriceRuleCustomProvider) (typedObject interface{}, err error) {\n\t/* Map CustomerCustom */\n\n\tswitch obj.(type) { //attrType.String() {\n\tcase *Group:\n\t\ttypedObject := obj.(*Group)\n\t\tobjCustom := customProvider.NewGroupCustom()\n\t\tif objCustom != nil && typedObject.Custom != nil {\n\t\t\terr = mapstructure.Decode(typedObject.Custom, objCustom)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\ttypedObject.Custom = objCustom\n\t\t\treturn typedObject, nil\n\t\t}\n\t\treturn typedObject, nil\n\tcase *Voucher:\n\t\ttypedObject := obj.(*Voucher)\n\t\tobjCustom := customProvider.NewVoucherCustom()\n\t\tif objCustom != nil && typedObject.Custom != nil {\n\t\t\terr = mapstructure.Decode(typedObject.Custom, objCustom)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\ttypedObject.Custom = objCustom\n\t\t\treturn typedObject, nil\n\t\t}\n\t\treturn typedObject, nil\n\tcase *PriceRule:\n\t\ttypedObject := obj.(*PriceRule)\n\t\tobjCustom := customProvider.NewPriceRuleCustom()\n\t\tif objCustom != nil && typedObject.Custom != nil {\n\t\t\terr = mapstructure.Decode(typedObject.Custom, objCustom)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\ttypedObject.Custom = objCustom\n\t\t\treturn typedObject, nil\n\t\t}\n\t\treturn typedObject, nil\n\tdefault:\n\t\treturn nil, errors.New(\"unknown type \" + reflect.TypeOf(obj).String())\n\t}\n\n}", "func mapDecodeObj(obj interface{}, customProvider PriceRuleCustomProvider) (typedObject interface{}, err error) {\n\t/* Map CustomerCustom */\n\n\tswitch obj.(type) { //attrType.String() {\n\tcase *Group:\n\t\ttypedObject := obj.(*Group)\n\t\tobjCustom := customProvider.NewGroupCustom()\n\t\tif objCustom != nil && typedObject.Custom != nil {\n\t\t\terr = mapstructure.Decode(typedObject.Custom, objCustom)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\ttypedObject.Custom = objCustom\n\t\t\treturn typedObject, nil\n\t\t}\n\t\treturn typedObject, nil\n\tcase *Voucher:\n\t\ttypedObject := obj.(*Voucher)\n\t\tobjCustom := customProvider.NewVoucherCustom()\n\t\tif objCustom != nil && typedObject.Custom != nil {\n\t\t\terr = mapstructure.Decode(typedObject.Custom, objCustom)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\ttypedObject.Custom = objCustom\n\t\t\treturn typedObject, nil\n\t\t}\n\t\treturn typedObject, nil\n\tcase *PriceRule:\n\t\ttypedObject := obj.(*PriceRule)\n\t\tobjCustom := customProvider.NewPriceRuleCustom()\n\t\tif objCustom != nil && typedObject.Custom != nil {\n\t\t\terr = mapstructure.Decode(typedObject.Custom, objCustom)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\ttypedObject.Custom = objCustom\n\t\t\treturn typedObject, nil\n\t\t}\n\t\treturn typedObject, nil\n\tdefault:\n\t\treturn nil, errors.New(\"unknown type \" + reflect.TypeOf(obj).String())\n\t}\n\n}", "func ToMapStringInterface(r io.Reader) (map[string]interface{}, error) {\n\tresults := make(map[string]interface{})\n\n\tdecoder := json.NewDecoder(r)\n\tdecoder.UseNumber()\n\tdecodeErr := decoder.Decode(&results)\n\n\tswitch {\n\tcase decodeErr == io.EOF:\n\t\tfmt.Println(\"request has no body, decoding skipped returning nil\")\n\t\treturn nil, nil\n\tcase decodeErr != nil:\n\t\treturn nil, fmt.Errorf(\"Failed to decode reader, error %s\", decodeErr.Error())\n\t}\n\n\treturn results, nil\n}", "func GetChildrenMap(input interface{}) []Child {\n\tvalueOf := GetBaseValue(input)\n\n\tvar children []Child\n\tchildren = make([]Child, 0)\n\n\tfor _, key := range valueOf.MapKeys() {\n\t\tvalue := valueOf.MapIndex(key)\n\t\tkind := value.Kind()\n\n\t\tname := Value2String(key)\n\t\tchildren = append(children, Child{Name: name, Value: value.Interface(), Kind: kind})\n\t}\n\treturn children\n}", "func ToStringMapString(value interface{}) (m map[string]string, err error) {\n\tm = make(map[string]string)\n\n\tswitch v := value.(type) {\n\tcase map[string]string:\n\t\treturn v, nil\n\tcase map[string]interface{}:\n\t\tfor k, val := range v {\n\t\t\tif m[k], err = ToString(val); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\treturn\n\tcase map[interface{}]string:\n\t\tfor k, val := range v {\n\t\t\tkey, e := ToString(k)\n\t\t\tif e != nil {\n\t\t\t\treturn m, e\n\t\t\t}\n\t\t\tm[key] = val\n\t\t}\n\t\treturn\n\tcase map[interface{}]interface{}:\n\t\tfor k, val := range v {\n\t\t\tkey, e := ToString(k)\n\t\t\tif e != nil {\n\t\t\t\treturn m, e\n\t\t\t}\n\t\t\tif m[key], err = ToString(val); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\treturn\n\tcase []byte:\n\t\terr = json.Unmarshal(v, &m)\n\t\treturn\n\tcase string:\n\t\terr = json.Unmarshal([]byte(v), &m)\n\t\treturn\n\tdefault:\n\t\terr = fmt.Errorf(\"unable to cast %#v of type %T to map[string]string\", v, v)\n\t\treturn\n\t}\n}", "func (qq Qualifiers) Map() map[string]string {\n\tm := make(map[string]string)\n\n\tfor i := 0; i < len(qq); i++ {\n\t\tk := qq[i].Key\n\t\tv := qq[i].Value\n\t\tm[k] = v\n\t}\n\n\treturn m\n}", "func toMap(s *DefaultIDSetMap) map[int]*IDSet {\n\tif s.key != 0 {\n\t\treturn map[int]*IDSet{\n\t\t\ts.key: s.value,\n\t\t}\n\t}\n\n\tif s.m != nil {\n\t\tm := map[int]*IDSet{}\n\t\tfor k, v := range s.m {\n\t\t\tm[k] = v\n\t\t}\n\t\treturn m\n\t}\n\n\treturn nil\n}", "func toMapStringString(v interface{}) (map[string]string, error) {\n\n\tout, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar f interface{}\n\n\terr = json.Unmarshal(out, &f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := f.(map[string]interface{})\n\n\tresult := map[string]string{}\n\n\tfor k, v := range s {\n\t\tswitch t := v.(type) {\n\t\tcase string:\n\t\t\tresult[k] = t\n\t\t}\n\t}\n\n\treturn result, nil\n}", "func FromMap(input map[string]interface{}) interface{} {\n\tvar (\n\t\ttypeIfc interface{}\n\t\tok bool\n\t)\n\n\tif typeIfc, ok = input[\"type\"]; ok {\n\t\tswitch typeIfc.(string) {\n\t\tcase FEATURE:\n\t\t\treturn FeatureFromMap(input)\n\t\tcase FEATURECOLLECTION:\n\t\t\treturn FeatureCollectionFromMap(input)\n\t\tdefault:\n\t\t\treturn newGeometry(input)\n\t\t}\n\n\t}\n\treturn nil\n}", "func (o *KanbanPartial) ToMap() map[string]interface{} {\n\tkv := map[string]interface{}{\n\t\t\"active\": toKanbanObject(o.Active, true),\n\t\t\"board_id\": toKanbanObject(o.BoardID, true),\n\t\t\"columns\": toKanbanObject(o.Columns, true),\n\t\t\"deleted\": toKanbanObject(o.Deleted, true),\n\t\t\"issue_ids\": toKanbanObject(o.IssueIds, true),\n\t\t\"name\": toKanbanObject(o.Name, true),\n\t\t\"project_ids\": toKanbanObject(o.ProjectIds, true),\n\t\t\"updated_date\": toKanbanObject(o.UpdatedDate, true),\n\t\t\"url\": toKanbanObject(o.URL, true),\n\t}\n\tfor k, v := range kv {\n\t\tif v == nil || reflect.ValueOf(v).IsZero() {\n\t\t\tdelete(kv, k)\n\t\t} else {\n\n\t\t\tif k == \"columns\" {\n\t\t\t\tif arr, ok := v.([]KanbanColumns); ok {\n\t\t\t\t\tif len(arr) == 0 {\n\t\t\t\t\t\tdelete(kv, k)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif k == \"issue_ids\" {\n\t\t\t\tif arr, ok := v.([]string); ok {\n\t\t\t\t\tif len(arr) == 0 {\n\t\t\t\t\t\tdelete(kv, k)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif k == \"project_ids\" {\n\t\t\t\tif arr, ok := v.([]string); ok {\n\t\t\t\t\tif len(arr) == 0 {\n\t\t\t\t\t\tdelete(kv, k)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif k == \"updated_date\" {\n\t\t\t\tif dt, ok := v.(*KanbanUpdatedDate); ok {\n\t\t\t\t\tif dt.Epoch == 0 && dt.Offset == 0 && dt.Rfc3339 == \"\" {\n\t\t\t\t\t\tdelete(kv, k)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn kv\n}", "func paramsAsMap(params *moleculer.ActionSchema) map[string]interface{} {\n\t//TODO\n\tschema := make(map[string]interface{})\n\treturn schema\n}", "func toStringMap(m map[interface{}]interface{}) map[string]interface{} {\n\tresult := make(map[string]interface{})\n\tfor k, v := range m {\n\t\t// convert key to string\n\t\tk := fmt.Sprintf(\"%v\", k)\n\t\tif valMap, ok := v.(map[interface{}]interface{}); ok {\n\t\t\t// convert values recursively\n\t\t\tv = toStringMap(valMap)\n\t\t}\n\t\tresult[k] = v\n\t}\n\n\treturn result\n}", "func keyValOrder(form url.Values, dataFields interface{}) *orderedmap.OrderedMap {\n\n\t//uMap := make(map[string]interface{}, 0)\n\toMap := orderedmap.NewOrderedMap()\n\tiVal := reflect.ValueOf(dataFields).Elem()\n\ttyp := iVal.Type()\n\n\tfor i := 0; i < iVal.NumField(); i++ {\n\n\t\ttag := typ.Field(i).Tag.Get(\"json\")\n\n\t\tvar omitFound bool\n\t\tif strings.Contains(tag, \",\") == true {\n\t\t\tomitFound = true\n\t\t\tcommaFoundAt := strings.Index(tag, \",\")\n\t\t\t//fmt.Println(\"commaFoundAt-->\", commaFoundAt, tag)\n\t\t\ttag = tag[0:commaFoundAt]\n\t\t}\n\n\t\t//ignored omitemty field which has 0 length\n\t\tif omitFound == true && len(form.Get(tag)) == 0 {\n\t\t\toMap.Set(tag, \"\")\n\t\t\t//fmt.Println(\">>\", tag, \"=\", form.Get(tag), omitFound, len(form.Get(tag)))\n\t\t} else {\n\t\t\toMap.Set(tag, form.Get(tag))\n\t\t}\n\t\t//fmt.Println(\">>\", tag, \"=\", form.Get(tag), omitFound, len(form.Get(tag)))\n\t}\n\n\treturn oMap\n}", "func (bm ByteMap) AsMap() map[string]interface{} {\n\tresult := make(map[string]interface{}, 10)\n\tbm.IterateValues(func(key string, value interface{}) bool {\n\t\tresult[key] = value\n\t\treturn true\n\t})\n\treturn result\n}", "func AsMap(dt DataType) *Map {\n\tswitch t := dt.(type) {\n\tcase *UserTypeExpr:\n\t\treturn AsMap(t.Type)\n\tcase *ResultTypeExpr:\n\t\treturn AsMap(t.Type)\n\tcase *Map:\n\t\treturn t\n\tdefault:\n\t\treturn nil\n\t}\n}", "func NewMap() Map {\n\treturn &sortedMap{}\n}", "func (s *Structx) Map() map[string]interface{} {\n\tresult := map[string]interface{}{}\n\n\tfs := s.Fields()\n\tfor _, v := range fs {\n\t\tif !v.IsExport() {\n\t\t\tcontinue\n\t\t}\n\t\tresult[v.Name()] = v.Value()\n\t}\n\n\treturn result\n}", "func (base fontCommon) asPdfObjectDictionary(subtype string) *core.PdfObjectDictionary {\n\n\tif subtype != \"\" && base.subtype != \"\" && subtype != base.subtype {\n\t\tcommon.Log.Debug(\"ERROR: asPdfObjectDictionary. Overriding subtype to %#q %s\", subtype, base)\n\t} else if subtype == \"\" && base.subtype == \"\" {\n\t\tcommon.Log.Debug(\"ERROR: asPdfObjectDictionary no subtype. font=%s\", base)\n\t} else if base.subtype == \"\" {\n\t\tbase.subtype = subtype\n\t}\n\n\td := core.MakeDict()\n\td.Set(\"Type\", core.MakeName(\"Font\"))\n\td.Set(\"BaseFont\", core.MakeName(base.basefont))\n\td.Set(\"Subtype\", core.MakeName(base.subtype))\n\n\tif base.fontDescriptor != nil {\n\t\td.Set(\"FontDescriptor\", base.fontDescriptor.ToPdfObject())\n\t}\n\tif base.toUnicode != nil {\n\t\td.Set(\"ToUnicode\", base.toUnicode)\n\t} else if base.toUnicodeCmap != nil {\n\t\tdata := base.toUnicodeCmap.Bytes()\n\t\to, err := core.MakeStream(data, nil)\n\t\tif err != nil {\n\t\t\tcommon.Log.Debug(\"MakeStream failed. err=%v\", err)\n\t\t} else {\n\t\t\td.Set(\"ToUnicode\", o)\n\t\t}\n\t}\n\treturn d\n}", "func GetValueTagMap(src map[string]interface{}) map[string]interface{} {\n\tres := NewEmptyTagMap()\n\tres[\"inname\"] = \"value\"\n\tres[\"exname\"] = \"value\"\n\tres[\"type\"] = src[\"type\"]\n\tres[\"length\"] = src[\"length\"]\n\tres[\"scale\"] = src[\"scale\"]\n\tres[\"precision\"] = src[\"precision\"]\n\tres[\"fieldid\"] = src[\"fieldid\"]\n\treturn res\n}" ]
[ "0.55518925", "0.53633374", "0.52951515", "0.5275693", "0.52526355", "0.52313364", "0.5227172", "0.51874036", "0.5143649", "0.5123114", "0.51198953", "0.5041665", "0.5022825", "0.5012383", "0.4960311", "0.4957528", "0.49427733", "0.49382833", "0.49110433", "0.49001646", "0.48985896", "0.48412436", "0.4827102", "0.4805584", "0.47962546", "0.47952613", "0.47805926", "0.47718576", "0.4763725", "0.47359118", "0.47244772", "0.47100624", "0.4688761", "0.46418726", "0.46339047", "0.4629712", "0.46090087", "0.4592141", "0.45886624", "0.45878223", "0.4574281", "0.45741478", "0.45654926", "0.45642555", "0.45621333", "0.45579553", "0.4549741", "0.45144206", "0.4500515", "0.44976628", "0.44966573", "0.44811013", "0.44811013", "0.44785187", "0.44644183", "0.44546086", "0.4449487", "0.4445764", "0.44429225", "0.44387168", "0.44272906", "0.44254252", "0.44250506", "0.4415414", "0.4408344", "0.43999386", "0.43946162", "0.43838918", "0.43829536", "0.4378144", "0.43756235", "0.43736053", "0.4369496", "0.43666318", "0.43604296", "0.43531328", "0.4347472", "0.43428347", "0.43414494", "0.4331102", "0.43286154", "0.43286154", "0.4323583", "0.43211776", "0.4318555", "0.43168104", "0.4316739", "0.4308393", "0.43069974", "0.42972198", "0.42962173", "0.42915407", "0.42837763", "0.42739436", "0.42706987", "0.42669272", "0.42616513", "0.426106", "0.42600754" ]
0.4940914
18
/ The constructor returns a NewObjectPairs with the an operand cast to a Function as the FunctionConstructor.
func (this *ObjectPairs) Constructor() FunctionConstructor { return func(operands ...Expression) Function { return NewObjectPairs(operands[0]) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (this *ObjectInnerPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectInnerPairs(operands[0])\n\t}\n}", "func (this *ObjectValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectValues(operands[0])\n\t}\n}", "func (this *ObjectValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectValues(operands[0])\n\t}\n}", "func (this *ObjectAdd) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectAdd(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectPut) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPut(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectUnwrap) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectUnwrap(operands[0])\n\t}\n}", "func (this *ObjectNames) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectNames(operands[0])\n\t}\n}", "func (this *ObjectNames) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectNames(operands[0])\n\t}\n}", "func (this *ObjectInnerValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectInnerValues(operands[0])\n\t}\n}", "func (this *DateAddStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateAddStr(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectRemove) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectRemove(operands[0], operands[1])\n\t}\n}", "func (this *DateAddMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateAddMillis(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *DateDiffStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateDiffStr(operands[0], operands[1], operands[2])\n\t}\n}", "func Function(args ...Type) *Operator {\n\treturn &Operator{functionName, args}\n}", "func NewConstructor(x interface{}) (*Constructor, error) {\n\tif x == nil {\n\t\treturn nil, kerror.New(kerror.EViolation, \"function expected, nil given\")\n\t}\n\tft := reflect.TypeOf(x)\n\tfv := reflect.ValueOf(x)\n\tif ft.Kind() != reflect.Func {\n\t\treturn nil, kerror.Newf(kerror.EViolation, \"function expected, %s given\", ft)\n\t}\n\tif fv.IsNil() {\n\t\treturn nil, kerror.New(kerror.EViolation, \"function expected, nil given\")\n\t}\n\tc := &Constructor{\n\t\tfunction: fv,\n\t}\n\tnumIn := ft.NumIn()\n\tif ft.IsVariadic() {\n\t\tnumIn--\n\t}\n\tc.inTypes = make([]reflect.Type, numIn)\n\tfor i := 0; i < numIn; i++ {\n\t\tc.inTypes[i] = ft.In(i)\n\t}\n\tswitch ft.NumOut() {\n\tdefault:\n\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\tcase 1:\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = -1\n\t\tc.errorOutIndex = -1\n\tcase 2:\n\t\tif ft.Out(1) != errorType {\n\t\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\t\t}\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = -1\n\t\tc.errorOutIndex = 1\n\tcase 3:\n\t\tif ft.Out(1) != destructorType || ft.Out(2) != errorType {\n\t\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\t\t}\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = 1\n\t\tc.errorOutIndex = 2\n\t}\n\treturn c, nil\n}", "func (this *DatePartStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDatePartStr(operands[0], operands[1])\n\t}\n}", "func (this *Mod) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewMod(operands[0], operands[1])\n\t}\n}", "func (this *ObjectLength) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectLength(operands[0])\n\t}\n}", "func (this *ObjectLength) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectLength(operands[0])\n\t}\n}", "func (this *DateDiffMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateDiffMillis(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *Element) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewElement(operands[0], operands[1])\n\t}\n}", "func (this *StrToZoneName) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToZoneName(operands[0], operands[1])\n\t}\n}", "func (this *StrToMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToMillis(operands[0])\n\t}\n}", "func NewObjectPairs(operand Expression) Function {\n\trv := &ObjectPairs{\n\t\t*NewUnaryFunctionBase(\"object_pairs\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectPairs(operand Expression) Function {\n\trv := &ObjectPairs{\n\t\t*NewUnaryFunctionBase(\"object_pairs\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func (this *NowStr) Constructor() FunctionConstructor { return NewNowStr }", "func (this *DatePartMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDatePartMillis(operands[0], operands[1])\n\t}\n}", "func (this *StrToUTC) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToUTC(operands[0])\n\t}\n}", "func New(spec *Spec) Function {\n\tf := Function{\n\t\tspec: spec,\n\t}\n\treturn f\n}", "func (c *Constructor) Create(a ...reflect.Value) (reflect.Value, kdone.Destructor, error) {\n\tif c == nil {\n\t\treturn reflect.Value{}, kdone.Noop, nil\n\t}\n\tif len(a) != len(c.inTypes) {\n\t\treturn reflect.Value{}, nil, kerror.Newf(kerror.EViolation,\n\t\t\t\"%s constructor expects %d argument(s), %d given\",\n\t\t\tc.t, len(c.inTypes), len(a))\n\t}\n\tfor i, v := range a {\n\t\tif v.Type() != c.inTypes[i] {\n\t\t\treturn reflect.Value{}, nil, kerror.Newf(kerror.EViolation,\n\t\t\t\t\"%s constructor expects argument %d to be of %s type, %s given\",\n\t\t\t\tc.t, i+1, c.inTypes[i], v.Type())\n\t\t}\n\t}\n\tout := c.function.Call(a)\n\tobj := out[c.objectOutIndex]\n\tvar dtor kdone.Destructor = kdone.Noop\n\tif c.destructorOutIndex >= 0 {\n\t\tif v := out[c.destructorOutIndex].Interface(); v != nil {\n\t\t\tdtor = v.(kdone.Destructor)\n\t\t}\n\t}\n\tvar err error\n\tif c.errorOutIndex >= 0 {\n\t\tif v := out[c.errorOutIndex].Interface(); v != nil {\n\t\t\terr = v.(error)\n\t\t}\n\t}\n\treturn obj, dtor, err\n}", "func (this *NowMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function { return _NOW_MILLIS }\n}", "func NewFunction(retType types.WaccType, ident *Ident, params ParamList,\n\tstats Statement, pos errors.Position) *Function {\n\tfn := &Function{\n\t\tretType: retType,\n\t\tident: ident,\n\t\tparams: params,\n\t\tpos: pos,\n\t}\n\tswitch st := stats.(type) {\n\tcase StatMultiple:\n\t\tfn.stats = st\n\tdefault:\n\t\tfn.stats = StatMultiple{st}\n\t}\n\treturn fn\n}", "func tcNew(n *ir.UnaryExpr) ir.Node {\n\tif n.X == nil {\n\t\t// Fatalf because the OCALL above checked for us,\n\t\t// so this must be an internally-generated mistake.\n\t\tbase.Fatalf(\"missing argument to new\")\n\t}\n\tl := n.X\n\tl = typecheck(l, ctxType)\n\tt := l.Type()\n\tif t == nil {\n\t\tn.SetType(nil)\n\t\treturn n\n\t}\n\tn.X = l\n\tn.SetType(types.NewPtr(t))\n\treturn n\n}", "func (this *DateTruncStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateTruncStr(operands[0], operands[1])\n\t}\n}", "func (this *Not) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewNot(operands[0])\n\t}\n}", "func NewMapper(m func(srcPtr interface{}, destPtr interface{}) error) Mapper {\n return funcMapper(m)\n}", "func (this *ClockMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function { return _CLOCK_MILLIS }\n}", "func newFunction(p *Package, fl *File, f *ast.FuncDecl) *Function {\n\tres := &Function{\n\t\tpkg: p,\n\t\tfile: fl,\n\t\tfn: f,\n\t\tname: nameFromIdent(f.Name),\n\t\tdef: getFunc(p, fl, f.Type).(*FuncType),\n\t}\n\n\tif res.fn.Recv != nil {\n\t\tn := \"\"\n\t\tif res.fn.Recv.List[0].Names != nil {\n\t\t\tn = nameFromIdent(res.fn.Recv.List[0].Names[0])\n\t\t}\n\t\tres.receiver = newVariableFromExpr(res.pkg, res.file, n, res.fn.Recv.List[0].Type)\n\t\tvar def Definition\n\t\tvar def2 *StarType\n\t\tdef = res.receiver.def\n\t\tdef2, res.receiverPointer = def.(*StarType)\n\t\tif res.receiverPointer {\n\t\t\tdef = def2.Target()\n\t\t}\n\t\tres.receiverClass = def.String()\n\t}\n\treturn res\n}", "func (this *MillisToStr) Constructor() FunctionConstructor { return NewMillisToStr }", "func NewFunction(config *truce.HTTP, function truce.Function) (*Function, error) {\n\tif function.Transports.HTTP == nil {\n\t\treturn nil, nil\n\t}\n\n\ttransport := *function.Transports.HTTP\n\n\tb := &Function{\n\t\tDefinition: function,\n\t\tQuery: map[string]QueryParam{},\n\t}\n\n\ttype argument struct {\n\t\tvariable string\n\t\tposVariable string\n\t\ttyp string\n\t}\n\n\tvar (\n\t\tpathMappings = map[string]string{}\n\t\targs = map[string]argument{}\n\t)\n\n\tfor i, field := range function.Arguments {\n\t\targs[field.Name] = argument{\n\t\t\ttyp: string(field.Type),\n\t\t\tposVariable: fmt.Sprintf(\"v%d\", i),\n\t\t\tvariable: field.Name,\n\t\t}\n\t}\n\n\tif function.Return.Present && function.Return.Name != \"\" {\n\t\tb.HasReturn = true\n\t\tb.ReturnType = string(function.Return.Type)\n\n\t\tif len(b.ReturnType) < 1 {\n\t\t\treturn nil, errors.New(\"return type cannot be empty\")\n\t\t}\n\n\t\tif b.ReturnType[0] == '*' {\n\t\t\tb.ReturnType = b.ReturnType[1:]\n\t\t\tb.ReturnIsPtr = true\n\t\t}\n\t}\n\n\tb.Method = transport.Method\n\n\t// Sort the arguments by name for consistent positional ordering.\n\tvar argVals []truce.ArgumentValue\n\tfor _, arg := range transport.Arguments {\n\t\targVals = append(argVals, arg)\n\t}\n\tsort.Slice(argVals, func(i, j int) bool {\n\t\treturn argVals[i].Name < argVals[j].Name\n\t})\n\n\tvar qpos int\n\tfor _, arg := range argVals {\n\t\ta, ok := args[arg.Name]\n\n\t\tswitch arg.From {\n\t\tcase \"body\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tb.BodyVar = a.posVariable\n\t\t\tb.BodyType = a.typ\n\t\tcase \"path\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpathMappings[arg.Var] = args[arg.Name].variable\n\t\tcase \"query\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tb.Query[arg.Var] = QueryParam{\n\t\t\t\tPos: qpos,\n\t\t\t\tQueryVar: arg.Var,\n\t\t\t\tGoVar: a.posVariable,\n\t\t\t\tType: a.typ,\n\t\t\t}\n\n\t\t\tqpos++\n\t\tcase \"static\":\n\t\t\t// TODO(georgemac)\n\t\t}\n\t}\n\n\tfor _, part := range strings.Split(config.Prefix, \"/\") {\n\t\tif part == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tb.Path = append(b.Path, Element{Type: \"static\", Value: part})\n\t}\n\n\tb.Path = append(b.Path, parsePath(pathMappings, transport.Path)...)\n\n\treturn b, nil\n}", "func (this *ClockStr) Constructor() FunctionConstructor { return NewClockStr }", "func NewFunction(name string, typ semantic.Type, call func(args Object) (Value, error), sideEffect bool) Function {\n\treturn &function{\n\t\tname: name,\n\t\tt: typ,\n\t\tcall: call,\n\t\thasSideEffect: sideEffect,\n\t}\n}", "func New(chainFunc ...interface{}) *Chain {\n\tc := &Chain{}\n\tc.Add(chainFunc...)\n\treturn c\n}", "func NewFunction(name, cname, comment, member string, typ Type) *Function {\n\tfunctionName := UpperFirstCharacter(name)\n\treceiverType := TrimLanguagePrefix(cname)\n\treceiverName := CommonReceiverName(receiverType)\n\n\tf := &Function{\n\t\tIncludeFiles: NewIncludeFiles(),\n\t\tName: functionName,\n\t\tCName: cname,\n\t\tComment: comment,\n\t\tParameters: []FunctionParameter{ // TODO(go-clang): this might not be needed if the receiver code is refactored: https://github.com/go-clang/gen/issues/52\n\t\t\t{\n\t\t\t\tName: receiverName,\n\t\t\t\tCName: cname,\n\t\t\t\tType: Type{\n\t\t\t\t\tGoName: receiverType,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tReturnType: typ,\n\t\tReceiver: Receiver{\n\t\t\tName: receiverName,\n\t\t\tType: Type{\n\t\t\t\tGoName: receiverType,\n\t\t\t},\n\t\t},\n\t\tMember: &FunctionParameter{\n\t\t\tName: member,\n\t\t\tType: typ,\n\t\t},\n\t}\n\n\treturn f\n}", "func NewFunction(ctx openedge.Context, cfg FunctionInfo) *Function {\n\tf := &Function{\n\t\tcfg: cfg,\n\t\tctx: ctx,\n\t\tids: make(chan string, cfg.Instance.Max),\n\t\tlog: logger.WithField(\"function\", cfg.Name),\n\t}\n\tfor index := 1; index <= cfg.Instance.Max; index++ {\n\t\tf.ids <- fmt.Sprintf(\"f%d\", index)\n\t}\n\tpc := pool.NewDefaultPoolConfig()\n\tpc.MinIdle = cfg.Instance.Min\n\tpc.MaxIdle = cfg.Instance.Max\n\tpc.MaxTotal = cfg.Instance.Max\n\tpc.MinEvictableIdleTime = cfg.Instance.IdleTime\n\tpc.TimeBetweenEvictionRuns = cfg.Instance.EvictTime\n\tf.pool = pool.NewObjectPool(context.Background(), newFactory(f), pc)\n\treturn f\n}", "func NewFunction(ctx sctx.Context, funcName string, retType *types.FieldType, args ...Expression) (Expression, error) {\n\treturn newFunctionImpl(ctx, true, funcName, retType, args...)\n}", "func (this *DateTruncMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateTruncMillis(operands[0], operands[1])\n\t}\n}", "func NewObject(t ...[2]*Term) Object {\n\tobj := newobject(len(t))\n\tfor i := range t {\n\t\tobj.Insert(t[i][0], t[i][1])\n\t}\n\treturn obj\n}", "func NewFunc(name string, typ Type) *Func {\n\treturn &Func{object: object{scope: nil, name: name, typ: typ}}\n}", "func execNewFunc(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\tret := types.NewFunc(token.Pos(args[0].(int)), args[1].(*types.Package), args[2].(string), args[3].(*types.Signature))\n\tp.Ret(4, ret)\n}", "func New(args ...float64) Tuple {\n\treturn args\n}", "func (f Function) New(ctx string) error {\n\treturn f.unsafeWrap(errors.New(ctx), ctx, \"\")\n}", "func Constructor() MapSum {\n \n}", "func NewFunction(ifunc IFunction, name string) IQueryField {\n\treturn &SFunctionFieldBase{\n\t\tIFunction: ifunc,\n\t\talias: name,\n\t}\n}", "func NewOperators(ops ...*Symbol) *Operators {\n\t// Construct the root\n\troot := &Operators{children: map[rune]*Operators{}}\n\n\t// Add each of the symbols to it\n\tfor _, op := range ops {\n\t\troot.Add(op)\n\t}\n\n\treturn root\n}", "func (this *MillisToZoneName) Constructor() FunctionConstructor { return NewMillisToZoneName }", "func NewOperator(kind string, in, out reflect.Type, f func(ctx context.Context, field string, object interface{}) (interface{}, error)) Operator {\n\treturn &operator{\n\t\tkind: kind,\n\t\tin: in,\n\t\tout: out,\n\t\tf: f,\n\t}\n}", "func NewMeta(operands ...Expression) Function {\n\trv := &Meta{\n\t\t*NewFunctionBase(\"meta\", operands...),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func Constructor() MapSum {\n\treturn MapSum{}\n}", "func ParsConstructor(lex *lexer.Lexer) *Parser {\n\tpars := &Parser{lex: lex}\n\n\tpars.prefixParseFns = make(map[lexer.TokenType]prefixParseFn)\n\tpars.infixParseFns = make(map[lexer.TokenType]infixParseFn)\n\n\tpars.registerInfix(lexer.PLUS, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.MINUS, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.DIVIDE, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.MULTIP, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.MODULO, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.EQUAL, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.N_EQUAL, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.LESS, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.LESS_EQ, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.MORE, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.MORE_EQ, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.OR, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.AND, pars.parseInfixExpression)\n\n\tpars.registerPrefix(lexer.IDENT, pars.parseIdentifier)\n\tpars.registerPrefix(lexer.NUM, pars.parseIntegerLiteral)\n\tpars.registerPrefix(lexer.LPAR, pars.parseGroupedExpression)\n\tpars.registerPrefix(lexer.IF, pars.parseIfExpression)\n\tpars.registerPrefix(lexer.WHILE, pars.parseWhileExpression)\n\n\t// read two tokens, one for thisToken and one for peekToken\n\tpars.nextToken()\n\tpars.nextToken()\n\n\treturn pars\n}", "func (o *FakeObject) New(args ...interface{}) Object { return o.Invoke(args) }", "func Constructor() TwoSum {\n\treturn TwoSum{data: map[int]int{}}\n}", "func NewFunction(fnLit *ast.FunctionLiteral, env *Environment) *Function {\n\treturn &Function{\n\t\tParameters: fnLit.Parameters,\n\t\tBody: fnLit.Body,\n\t\tEnv: env,\n\t}\n}", "func newInstance0(frame *rtda.Frame) {\n\tvars := frame.LocalVars()\n\tconstructorObj := vars.GetRef(0)\n\targArrObj := vars.GetRef(1)\n\n\tgoConstructor := getExtra(constructorObj)\n\tgoClass := goConstructor.Class()\n\tobj := goClass.NewObj()\n\tstack := frame.OperandStack()\n\tstack.PushRef(obj)\n\n\t// call <init>\n\targs := actualConstructorArgs(obj, argArrObj, goConstructor)\n\tframe.Thread().InvokeMethodWithShim(goConstructor, args)\n}", "func NewPair(expr expression.Expression) (*Pair, error) {\n\tarray, ok := expr.(*expression.ArrayConstruct)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Invalid VALUES expression %s\", expr.String())\n\t}\n\n\toperands := array.Operands()\n\tif len(operands) != 2 {\n\t\treturn nil, fmt.Errorf(\"Invalid VALUES expression %s\", expr.String())\n\t}\n\n\tpair := &Pair{\n\t\tKey: operands[0],\n\t\tValue: operands[1],\n\t}\n\n\treturn pair, nil\n}", "func NewObjectInnerPairs(operand Expression) Function {\n\trv := &ObjectInnerPairs{\n\t\t*NewUnaryFunctionBase(\"object_innerpairs\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewPairs(array *expression.ArrayConstruct) (pairs Pairs, err error) {\n\toperands := array.Operands()\n\tpairs = make(Pairs, len(operands))\n\tfor i, op := range operands {\n\t\tpairs[i], err = NewPair(op)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn\n}", "func Constructor() MinStack {\n\treturn MinStack{atoms: []atom{}}\n}", "func Constructor() MyStack {\n\treturn MyStack{New(), New(), 1}\n}", "func NewFunction(pkg, name string,\n\tparams, ret, block []jen.Code) *Function {\n\treturn &Function{\n\t\tqual: jen.Qual(pkg, name),\n\t\tname: name,\n\t\tparams: params,\n\t\tret: ret,\n\t\tblock: block,\n\t}\n}", "func CreateNewExpr() Expr {\n\tc11 := Constant{value: 1.1}\n\tc22 := Constant{value: 2.2}\n\tc33 := Constant{value: 3.3}\n\tbp := BinaryPlus{left: &BinaryPlus{left: &c11, right: &c22}, right: &c33}\n\treturn &bp\n}", "func Make(e1, e2 interface{}) (p Pair) {\n\tp[0] = e1\n\tp[1] = e2\n\n\treturn p\n}", "func New(root *ssa.Function) *Graph {\n\tg := &Graph{Nodes: make(map[*ssa.Function]*Node)}\n\tg.Root = g.CreateNode(root)\n\treturn g\n}", "func New() *Compiler {\n\tmainScope := CompilationScope{\n\t\tinstructions: code.Instructions{},\n\t\tlastInstruction: EmittedInstruction{},\n\t\tpreviousInstruction: EmittedInstruction{},\n\t}\n\ttable := NewSymbolTable()\n\tfor i, fn := range object.GetBuiltins() {\n\t\ttable.DefineBuiltin(i, fn.Name)\n\t}\n\treturn &Compiler{\n\t\tconstants: []object.Object{},\n\t\tscopes: []CompilationScope{mainScope},\n\t\tscopeIndex: 0,\n\t\tsymbolTable: table,\n\t}\n}", "func (this *MillisToUTC) Constructor() FunctionConstructor { return NewMillisToUTC }", "func NewObjectAdd(first, second, third Expression) Function {\n\trv := &ObjectAdd{\n\t\t*NewTernaryFunctionBase(\"object_add\", first, second, third),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func TermConstructor(t TermT) TermConstructorT {\n\treturn TermConstructorT(C.yices_term_constructor(C.term_t(t)))\n}", "func (e *exprHelper) NewCall(function string, args ...ast.Expr) ast.Expr {\n\treturn e.exprFactory.NewCall(e.nextMacroID(), function, args...)\n}", "func NewFunctionCall(name string, params []Expression, returnType Type) Expression {\n\treturn &functionCall{\n\t\tname: name,\n\t\tparams: params,\n\t\treturnType: returnType,\n\t}\n}", "func New[V any]() ConcurrentMap[string, V] {\n\treturn create[string, V](fnv32)\n}", "func Constructor() MyHashMap {\n\treturn MyHashMap{\n\t\t[1111]*Node{},\n\t}\n}", "func (bfp *FunctionProvider) NewFunction(key string) (dataflow.Function, error) {\n\tfor i := range bfp.functions {\n\t\tcur := bfp.functions[i]\n\t\tif cur.FunctionSpec.Key == key {\n\t\t\treturn cur.NewFunction(), nil\n\t\t}\n\t}\n\n\treturn nil, nil\n}", "func (s Obj_value) NewDeleg() (PublicKey, error) {\n\ts.Struct.SetUint16(4, 4)\n\tss, err := NewPublicKey(s.Struct.Segment())\n\tif err != nil {\n\t\treturn PublicKey{}, err\n\t}\n\terr = s.Struct.SetPtr(0, ss.Struct.ToPtr())\n\treturn ss, err\n}", "func ClosureNew(f interface{}) *C.GClosure {\n\tclosure := C._g_closure_new()\n\tclosures.Lock()\n\tclosures.m[closure] = reflect.ValueOf(f)\n\tclosures.Unlock()\n\treturn closure\n}", "func NewLambda(vs []Argument, u bool, as []Argument, e Expression, t types.Type) Lambda {\n\treturn Lambda{as, e, t, vs, u}\n}", "func NewFunctionCall(callee Expression, arguments []Expression, trailing *TrailingFunction, metadata *Metadata) *FunctionCall {\n\treturn &FunctionCall{callee, arguments, trailing, metadata}\n}", "func (l *Lifter) NewFunc(asmFunc *x86.Func) *Func {\n\tentry := asmFunc.Addr\n\tf, ok := l.Funcs[entry]\n\tif !ok {\n\t\t// TODO: Add proper support for type signatures once type analysis has\n\t\t// been conducted.\n\t\tname := fmt.Sprintf(\"f_%06X\", uint64(entry))\n\t\tsig := types.NewFunc(types.Void)\n\t\ttyp := types.NewPointer(sig)\n\t\tf = &Func{\n\t\t\tFunc: &ir.Func{\n\t\t\t\tTyp: typ,\n\t\t\t\tSig: sig,\n\t\t\t},\n\t\t}\n\t\tf.SetName(name)\n\t\tmd := &metadata.Attachment{\n\t\t\tName: \"addr\",\n\t\t\tNode: &metadata.Tuple{\n\t\t\t\tFields: []metadata.Field{&metadata.String{Value: entry.String()}},\n\t\t\t},\n\t\t}\n\t\tf.Metadata = append(f.Metadata, md)\n\t}\n\tf.AsmFunc = asmFunc\n\tf.blocks = make(map[bin.Address]*ir.Block)\n\tf.regs = make(map[x86asm.Reg]*ir.InstAlloca)\n\tf.statusFlags = make(map[StatusFlag]*ir.InstAlloca)\n\tf.fstatusFlags = make(map[FStatusFlag]*ir.InstAlloca)\n\tf.locals = make(map[string]*ir.InstAlloca)\n\tf.l = l\n\t// Prepare output LLVM IR basic blocks.\n\tfor addr := range asmFunc.Blocks {\n\t\tlabel := fmt.Sprintf(\"block_%06X\", uint64(addr))\n\t\tblock := ir.NewBlock(label)\n\t\tf.blocks[addr] = block\n\t}\n\t// Preprocess the function to assess if any instruction makes use of EDX:EAX\n\t// (e.g. IDIV).\n\tfor _, bb := range asmFunc.Blocks {\n\t\tfor _, inst := range bb.Insts {\n\t\t\tswitch inst.Op {\n\t\t\t// TODO: Identify more instructions which makes use of the FPU register\n\t\t\t// stack.\n\t\t\tcase x86asm.F2XM1, x86asm.FABS, x86asm.FADD, x86asm.FADDP, x86asm.FBLD,\n\t\t\t\tx86asm.FBSTP, x86asm.FCHS, x86asm.FCMOVB, x86asm.FCMOVBE,\n\t\t\t\tx86asm.FCMOVE, x86asm.FCMOVNB, x86asm.FCMOVNBE, x86asm.FCMOVNE,\n\t\t\t\tx86asm.FCMOVNU, x86asm.FCMOVU, x86asm.FCOM, x86asm.FCOMI,\n\t\t\t\tx86asm.FCOMIP, x86asm.FCOMP, x86asm.FCOMPP, x86asm.FCOS,\n\t\t\t\tx86asm.FDECSTP, x86asm.FDIV, x86asm.FDIVP, x86asm.FDIVR, x86asm.FDIVRP,\n\t\t\t\tx86asm.FFREE, x86asm.FFREEP, x86asm.FIADD, x86asm.FICOM, x86asm.FICOMP,\n\t\t\t\tx86asm.FIDIV, x86asm.FIDIVR, x86asm.FILD, x86asm.FIMUL, x86asm.FINCSTP,\n\t\t\t\tx86asm.FIST, x86asm.FISTP, x86asm.FISTTP, x86asm.FISUB, x86asm.FISUBR,\n\t\t\t\tx86asm.FLD, x86asm.FLD1, x86asm.FLDCW, x86asm.FLDENV, x86asm.FLDL2E,\n\t\t\t\tx86asm.FLDL2T, x86asm.FLDLG2, x86asm.FLDLN2, x86asm.FLDPI, x86asm.FLDZ,\n\t\t\t\tx86asm.FMUL, x86asm.FMULP, x86asm.FNCLEX, x86asm.FNINIT, x86asm.FNOP,\n\t\t\t\tx86asm.FNSAVE, x86asm.FNSTCW, x86asm.FNSTENV, x86asm.FNSTSW,\n\t\t\t\tx86asm.FPATAN, x86asm.FPREM, x86asm.FPREM1, x86asm.FPTAN,\n\t\t\t\tx86asm.FRNDINT, x86asm.FRSTOR, x86asm.FSCALE, x86asm.FSIN,\n\t\t\t\tx86asm.FSINCOS, x86asm.FSQRT, x86asm.FST, x86asm.FSTP, x86asm.FSUB,\n\t\t\t\tx86asm.FSUBP, x86asm.FSUBR, x86asm.FSUBRP, x86asm.FTST, x86asm.FUCOM,\n\t\t\t\tx86asm.FUCOMI, x86asm.FUCOMIP, x86asm.FUCOMP, x86asm.FUCOMPP,\n\t\t\t\tx86asm.FWAIT, x86asm.FXAM, x86asm.FXCH, x86asm.FXRSTOR,\n\t\t\t\tx86asm.FXRSTOR64, x86asm.FXSAVE, x86asm.FXSAVE64, x86asm.FXTRACT,\n\t\t\t\tx86asm.FYL2X, x86asm.FYL2XP1:\n\t\t\t\tf.usesFPU = true\n\t\t\t// TODO: Identify more instructions which makes use of EDX:EAX.\n\t\t\tcase x86asm.IDIV:\n\t\t\t\tf.usesEDX_EAX = true\n\t\t\t}\n\t\t}\n\t}\n\treturn f\n}", "func NewCurry(fn interface{}) (*Curry, error) {\n\ttyp := reflect.TypeOf(fn)\n\n\tif typ.Kind() != reflect.Func {\n\t\treturn nil, fmt.Errorf(\"Handler is not a function!\")\n\t}\n\n\tc := &Curry{\n\t\tname: getFunctionName(fn),\n\t\tfnType: typ,\n\t\tfn: fn,\n\t}\n\n\treturn c, nil\n}", "func (s *Prototype) Constructor() Value { return s.constructor }", "func NewConstructor() *Constructor {\n\treturn &Constructor{}\n}", "func NewConversion(from, to Unit, formula string) {\n\texpr, err := govaluate.NewEvaluableExpression(formula)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// create conversion function\n\tfn := func(x float64) float64 {\n\t\tparams := make(map[string]interface{})\n\t\tparams[\"x\"] = x\n\n\t\tres, err := expr.Evaluate(params)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\treturn res.(float64)\n\t}\n\n\tNewConversionFromFn(from, to, fn, formula)\n}", "func NewFuncs(ctx context.Context, enums []xo.Enum) *Funcs {\n\tdriver, _, _ := xo.DriverSchemaNthParam(ctx)\n\tenumMap := make(map[string]xo.Enum)\n\tif driver == \"mysql\" {\n\t\tfor _, e := range enums {\n\t\t\tenumMap[e.Name] = e\n\t\t}\n\t}\n\treturn &Funcs{\n\t\tdriver: driver,\n\t\tenumMap: enumMap,\n\t\tconstraint: Constraint(ctx),\n\t\tescCols: Esc(ctx, \"columns\"),\n\t\tescTypes: Esc(ctx, \"types\"),\n\t\tengine: Engine(ctx),\n\t}\n}", "func Constructor() MyHashMap {\n\treturn MyHashMap{0, InitContainer, make([]*Node, InitContainer)}\n}", "func New() Object {\n\treturn Object{}\n}", "func ListConstructor(context RunContext, arguments []Argument) Value {\n\tvalues := make([]Value, len(arguments))\n\tfor i, arg := range arguments {\n\t\tvar value = EvalArgument(context, arg)\n\n\t\t// accept blocks within a list\n\t\t// as dictionaries in order to support\n\t\t// [{...} {...} ...] constructions\n\t\t//\n\t\tif value.Type() == TypeBlock {\n\t\t\tvalue = NewDictionaryWithBlock(context, value.(Block))\n\t\t}\n\n\t\tvalues[i] = value\n\t}\n\treturn NewListValue(values)\n}", "func NewObjectValues(operand Expression) Function {\n\trv := &ObjectValues{\n\t\t*NewUnaryFunctionBase(\"object_values\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectValues(operand Expression) Function {\n\trv := &ObjectValues{\n\t\t*NewUnaryFunctionBase(\"object_values\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func New(lhs, rhs string, binds pattern.Binds) (*T, error) {\n\tlp, err := pattern.Parse(lhs, binds)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parsing %q: %v\", lhs, err)\n\t}\n\trp, err := lp.Derive(rhs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &T{lhs: lp, rhs: rp}, nil\n}", "func NewFunctionCall(name string, context string, args ...interface{}) FunctionCall {\n\treturn FunctionCall{name, context, args}\n}" ]
[ "0.7153522", "0.7010794", "0.7010794", "0.694256", "0.6708602", "0.66994077", "0.66873187", "0.66873187", "0.66498196", "0.64264494", "0.64111173", "0.62730813", "0.62703615", "0.6267153", "0.6256307", "0.6193001", "0.6129393", "0.6126082", "0.6126082", "0.6101058", "0.60760236", "0.6072029", "0.5984461", "0.5939033", "0.5939033", "0.5936689", "0.58843106", "0.5846959", "0.5815502", "0.57907766", "0.5777012", "0.57463175", "0.569001", "0.56670046", "0.56302834", "0.55515933", "0.55432844", "0.55205935", "0.5510465", "0.54995996", "0.5470192", "0.5465858", "0.5464387", "0.54333854", "0.54066384", "0.5374162", "0.5367669", "0.5366333", "0.5362443", "0.5335453", "0.53314584", "0.5327979", "0.53260267", "0.5323436", "0.53132766", "0.5270561", "0.52670395", "0.52641875", "0.5261494", "0.5252892", "0.5220263", "0.52045107", "0.5187529", "0.5176019", "0.5150126", "0.5148201", "0.5147201", "0.5126834", "0.51176184", "0.51050305", "0.5100466", "0.50934637", "0.50805783", "0.5079722", "0.50743484", "0.50670266", "0.50666845", "0.5065435", "0.5063771", "0.5062426", "0.5052929", "0.5046649", "0.50454557", "0.5041206", "0.5029653", "0.50189084", "0.50009984", "0.49994525", "0.49876493", "0.4977041", "0.49720594", "0.4953011", "0.49245733", "0.49242386", "0.49142313", "0.4904817", "0.4904817", "0.4902918", "0.48963943" ]
0.7555158
1
/ The function NewObjectValues calls NewUnaryFunctionBase to create a function named OBJECT_VALUES with an expression as input.
func NewObjectValues(operand Expression) Function { rv := &ObjectValues{ *NewUnaryFunctionBase("object_values", operand), } rv.expr = rv return rv }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewObjectInnerValues(operand Expression) Function {\n\trv := &ObjectInnerValues{\n\t\t*NewUnaryFunctionBase(\"object_innervalues\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewValuesFunc(ctx sessionctx.Context, offset int, retTp *types.FieldType) *ScalarFunction {\n\tfc := &valuesFunctionClass{baseFunctionClass{ast.Values, 0, 0}, offset, retTp}\n\tbt, err := fc.getFunction(ctx, nil)\n\tterror.Log(err)\n\treturn &ScalarFunction{\n\t\tFuncName: model.NewCIStr(ast.Values),\n\t\tRetType: retTp,\n\t\tFunction: bt,\n\t}\n}", "func (this *ObjectValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectValues(operands[0])\n\t}\n}", "func (this *ObjectValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectValues(operands[0])\n\t}\n}", "func NewValues(col sql.Expression) sql.Expression {\n\treturn &Values{\n\t\tUnaryExpression: expression.UnaryExpression{Child: col},\n\t\tValue: nil,\n\t}\n}", "func NewValues() *Values {\n\tv := &Values{\n\t\tm: map[string]interface{}{\n\t\t\tInputKey: map[string]interface{}{},\n\t\t\tResolverInputKey: map[string]interface{}{},\n\t\t\tStepKey: map[string]interface{}{},\n\t\t\tTaskKey: map[string]interface{}{},\n\t\t\tConfigKey: map[string]interface{}{},\n\t\t\tVarKey: map[string]*Variable{},\n\t\t\tIteratorKey: nil,\n\t\t},\n\t}\n\tv.funcMap = sprig.FuncMap()\n\tv.funcMap[\"field\"] = v.fieldTmpl\n\tv.funcMap[\"jsonfield\"] = v.jsonFieldTmpl\n\tv.funcMap[\"jsonmarshal\"] = v.jsonMarshal\n\tv.funcMap[\"eval\"] = v.varEval\n\treturn v\n}", "func NewObjectValue(key string, v Value) Value {\n\treturn ObjectValue{key, v}\n}", "func (s Stream) NewValues(n int32) (capnp.Float64List, error) {\n\tl, err := capnp.NewFloat64List(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn capnp.Float64List{}, err\n\t}\n\terr = s.Struct.SetPtr(1, l.List.ToPtr())\n\treturn l, err\n}", "func NewValues() Values {\n\treturn Values{}\n}", "func NewObject() *Value {\n\treturn &Value{kind: kindObject, objectContent: make(map[string]Value)}\n}", "func (this *ObjectInnerValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectInnerValues(operands[0])\n\t}\n}", "func NewObjectNames(operand Expression) Function {\n\trv := &ObjectNames{\n\t\t*NewUnaryFunctionBase(\"object_names\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectNames(operand Expression) Function {\n\trv := &ObjectNames{\n\t\t*NewUnaryFunctionBase(\"object_names\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectPairs(operand Expression) Function {\n\trv := &ObjectPairs{\n\t\t*NewUnaryFunctionBase(\"object_pairs\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectPairs(operand Expression) Function {\n\trv := &ObjectPairs{\n\t\t*NewUnaryFunctionBase(\"object_pairs\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewValues() Values {\n\treturn make(values)\n}", "func NewValues() *Values {\n\treturn &Values{\n\t\tlock: &sync.RWMutex{},\n\t\troot: newNode(),\n\t}\n}", "func NewFromValues(values map[string]interface{}) *Values {\n\treturn &Values{values}\n}", "func NewObjectInnerPairs(operand Expression) Function {\n\trv := &ObjectInnerPairs{\n\t\t*NewUnaryFunctionBase(\"object_innerpairs\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObject(t ...[2]*Term) Object {\n\tobj := newobject(len(t))\n\tfor i := range t {\n\t\tobj.Insert(t[i][0], t[i][1])\n\t}\n\treturn obj\n}", "func NewLiteral(value Object) Expression {\n\treturn &literal{value: value}\n}", "func NewObjectExpression() *ObjectExpression {\n\treturn &ObjectExpression{\n\t\tprops: make(map[string]Expression),\n\t}\n}", "func NewObjectAdd(first, second, third Expression) Function {\n\trv := &ObjectAdd{\n\t\t*NewTernaryFunctionBase(\"object_add\", first, second, third),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func newSeriesValues(values []float64) *seriesValues {\n\t// Copy to avoid external modifications. See #174.\n\tv := make([]float64, len(values))\n\tcopy(v, values)\n\n\tmin, max := minMax(v)\n\treturn &seriesValues{\n\t\tvalues: v,\n\t\tmin: min,\n\t\tmax: max,\n\t}\n}", "func NewObject(t token.Token, value Block) *ObjectLiteral {\n\treturn &ObjectLiteral{\n\t\tToken: t,\n\t\tTypeOf: NewObjectType(),\n\t\tValue: value,\n\t}\n}", "func NewValue(val interface{}) (*Value, error) {\n\tvar ptr *C.struct__engine_value\n\tvar err error\n\n\t// Determine value type and create PHP value from the concrete type.\n\tv := reflect.ValueOf(val)\n\tswitch v.Kind() {\n\t// Bind integer to PHP int type.\n\tcase reflect.Int:\n\t\tptr, err = C.value_create_long(C.long(v.Int()))\n\t// Bind floating point number to PHP double type.\n\tcase reflect.Float64:\n\t\tptr, err = C.value_create_double(C.double(v.Float()))\n\t// Bind boolean to PHP bool type.\n\tcase reflect.Bool:\n\t\tptr, err = C.value_create_bool(C.bool(v.Bool()))\n\t// Bind string to PHP string type.\n\tcase reflect.String:\n\t\tstr := C.CString(v.String())\n\n\t\tptr, err = C.value_create_string(str)\n\t\tC.free(unsafe.Pointer(str))\n\t// Bind slice to PHP indexed array type.\n\tcase reflect.Slice:\n\t\tif ptr, err = C.value_create_array(C.uint(v.Len())); err != nil {\n\t\t\tbreak\n\t\t}\n\n\t\tfor i := 0; i < v.Len(); i++ {\n\t\t\tvs, err := NewValue(v.Index(i).Interface())\n\t\t\tif err != nil {\n\t\t\t\tC.value_destroy(ptr)\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tC.value_array_next_set(ptr, vs.value)\n\t\t}\n\t// Bind map (with integer or string keys) to PHP associative array type.\n\tcase reflect.Map:\n\t\tkt := v.Type().Key().Kind()\n\n\t\tif kt == reflect.Int || kt == reflect.String {\n\t\t\tif ptr, err = C.value_create_array(C.uint(v.Len())); err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tfor _, key := range v.MapKeys() {\n\t\t\t\tkv, err := NewValue(v.MapIndex(key).Interface())\n\t\t\t\tif err != nil {\n\t\t\t\t\tC.value_destroy(ptr)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tif kt == reflect.Int {\n\t\t\t\t\tC.value_array_index_set(ptr, C.ulong(key.Int()), kv.value)\n\t\t\t\t} else {\n\t\t\t\t\tstr := C.CString(key.String())\n\n\t\t\t\t\tC.value_array_key_set(ptr, str, kv.value)\n\t\t\t\t\tC.free(unsafe.Pointer(str))\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\treturn nil, errInvalidType(val)\n\t\t}\n\t// Bind struct to PHP object (stdClass) type.\n\tcase reflect.Struct:\n\t\tvt := v.Type()\n\t\tif ptr, err = C.value_create_object(); err != nil {\n\t\t\tbreak\n\t\t}\n\n\t\tfor i := 0; i < v.NumField(); i++ {\n\t\t\t// Skip unexported fields.\n\t\t\tif vt.Field(i).PkgPath != \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfv, err := NewValue(v.Field(i).Interface())\n\t\t\tif err != nil {\n\t\t\t\tC.value_destroy(ptr)\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tstr := C.CString(vt.Field(i).Name)\n\n\t\t\tC.value_object_property_add(ptr, str, fv.value)\n\t\t\tC.free(unsafe.Pointer(str))\n\t\t}\n\tdefault:\n\t\treturn nil, errInvalidType(val)\n\t}\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to create PHP value from Go value '%v'\", val)\n\t}\n\n\treturn &Value{value: ptr}, nil\n}", "func NewObjectTypeValue(name string) *TypeValue {\n\treturn NewTypeValue(name,\n\t\ttraits.FieldTesterType,\n\t\ttraits.IndexerType)\n}", "func New(v interface{}) Value {\n\treturn Value{v}\n}", "func ValueNew(typ Type) *Value {\n\tvar gvalue C.GValue\n\tvalue := ValueNewFromC(unsafe.Pointer(&gvalue))\n\tvalue.Init(typ)\n\n\treturn value\n}", "func (def *Definition) CreateValues(forStoring bool) (err error) {\n\t// Reset values\n\tdef.Values = nil\n\tif Central.IsDebugLevel() {\n\t\tCentral.Log.Debugf(\"Create values from types for storing=%v -> %#v\", forStoring, def.activeFieldTree)\n\t}\n\tparameter := &stackParameter{definition: def, forStoring: forStoring, stack: NewStack()}\n\tt := TraverserMethods{EnterFunction: traverserCreateValue}\n\terr = def.TraverseTypes(t, true, parameter)\n\tif Central.IsDebugLevel() {\n\t\tCentral.Log.Debugf(\"Done creating values ... %v\", err)\n\t\tCentral.Log.Debugf(\"Created %d values\", len(def.Values))\n\t\tdef.DumpValues(true)\n\t}\n\treturn\n}", "func NewGoObject(val interface{}) Object {\n\tif reflect.ValueOf(val).Kind() == reflect.Func {\n\t\t// Functions have a special type\n\t\treturn GoFunc{val: val}\n\t} else {\n\t\treturn GoObject{val: val}\n\t}\n}", "func NewObjectUnwrap(operand Expression) Function {\n\trv := &ObjectUnwrap{\n\t\t*NewUnaryFunctionBase(\"object_unwrap\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewValue(val interface{}) *Value {\n\tswitch val := val.(type) {\n\tcase nil:\n\t\treturn newNullValue()\n\tcase bool:\n\t\treturn newBooleanValue(val)\n\tcase float64:\n\t\treturn newNumberValue(val)\n\tcase string:\n\t\treturn newStringValue(val)\n\tcase []interface{}:\n\t\treturn newArrayValue(val)\n\tcase map[string]interface{}:\n\t\treturn newObjectValue(val)\n\tcase *Value:\n\t\treturn val\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Cannot create value for type %T\", val))\n\t}\n}", "func NewValue() *Value { return &Value{} }", "func CloneRefOfValuesFuncExpr(n *ValuesFuncExpr) *ValuesFuncExpr {\n\tif n == nil {\n\t\treturn nil\n\t}\n\tout := *n\n\tout.Name = CloneRefOfColName(n.Name)\n\treturn &out\n}", "func ObjectValue(id TypeID, value interface{}) (*graph.Value, error) {\n\tdef := &graph.Value{&graph.Value_StrVal{\"\"}}\n\tvar ok bool\n\t// Lets set the object value according to the storage type.\n\tswitch id {\n\tcase StringID:\n\t\tvar v string\n\t\tif v, ok = value.(string); !ok {\n\t\t\treturn def, x.Errorf(\"Expected value of type string. Got : %v\", value)\n\t\t}\n\t\treturn &graph.Value{&graph.Value_StrVal{v}}, nil\n\tcase DefaultID:\n\t\tvar v string\n\t\tif v, ok = value.(string); !ok {\n\t\t\treturn def, x.Errorf(\"Expected value of type string. Got : %v\", value)\n\t\t}\n\t\treturn &graph.Value{&graph.Value_DefaultVal{v}}, nil\n\tcase Int32ID:\n\t\tvar v int32\n\t\tif v, ok = value.(int32); !ok {\n\t\t\treturn def, x.Errorf(\"Expected value of type int32. Got : %v\", value)\n\t\t}\n\t\treturn &graph.Value{&graph.Value_IntVal{v}}, nil\n\tcase FloatID:\n\t\tvar v float64\n\t\tif v, ok = value.(float64); !ok {\n\t\t\treturn def, x.Errorf(\"Expected value of type float64. Got : %v\", value)\n\t\t}\n\t\treturn &graph.Value{&graph.Value_DoubleVal{v}}, nil\n\tcase BoolID:\n\t\tvar v bool\n\t\tif v, ok = value.(bool); !ok {\n\t\t\treturn def, x.Errorf(\"Expected value of type bool. Got : %v\", value)\n\t\t}\n\t\treturn &graph.Value{&graph.Value_BoolVal{v}}, nil\n\tcase BinaryID:\n\t\tvar v []byte\n\t\tif v, ok = value.([]byte); !ok {\n\t\t\treturn def, x.Errorf(\"Expected value of type []byte. Got : %v\", value)\n\t\t}\n\t\treturn &graph.Value{&graph.Value_BytesVal{v}}, nil\n\t// Geo, date and datetime are stored in binary format in the NQuad, so lets\n\t// convert them here.\n\tcase GeoID:\n\t\tb, err := toBinary(id, value)\n\t\tif err != nil {\n\t\t\treturn def, err\n\t\t}\n\t\treturn &graph.Value{&graph.Value_GeoVal{b}}, nil\n\tcase DateID:\n\t\tb, err := toBinary(id, value)\n\t\tif err != nil {\n\t\t\treturn def, err\n\t\t}\n\t\treturn &graph.Value{&graph.Value_DateVal{b}}, nil\n\tcase DateTimeID:\n\t\tb, err := toBinary(id, value)\n\t\tif err != nil {\n\t\t\treturn def, err\n\t\t}\n\t\treturn &graph.Value{&graph.Value_DatetimeVal{b}}, nil\n\tcase PasswordID:\n\t\tvar v string\n\t\tif v, ok = value.(string); !ok {\n\t\t\treturn def, x.Errorf(\"Expected value of type password. Got : %v\", value)\n\t\t}\n\t\treturn &graph.Value{&graph.Value_PasswordVal{v}}, nil\n\tdefault:\n\t\treturn def, x.Errorf(\"ObjectValue not available for: %v\", id)\n\t}\n\treturn def, nil\n}", "func NewWithValues(r, c int, vals []Frac) M {\n\treturn M{r: r, c: c, values: vals}\n}", "func NewObjectLength(operand Expression) Function {\n\trv := &ObjectLength{\n\t\t*NewUnaryFunctionBase(\"object_length\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectLength(operand Expression) Function {\n\trv := &ObjectLength{\n\t\t*NewUnaryFunctionBase(\"object_length\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewValue(x interface{}) (types.Value, error) {\n\tswitch v := x.(type) {\n\tcase nil:\n\t\treturn types.NewNullValue(), nil\n\tcase types.Document:\n\t\treturn types.NewDocumentValue(v), nil\n\tcase types.Array:\n\t\treturn types.NewArrayValue(v), nil\n\tcase int:\n\t\treturn types.NewIntegerValue(int64(v)), nil\n\tcase bool:\n\t\treturn types.NewBoolValue(v), nil\n\tcase float64:\n\t\treturn types.NewDoubleValue(v), nil\n\tcase string:\n\t\treturn types.NewTextValue(v), nil\n\t}\n\n\treturn nil, &ErrUnsupportedType{x, \"\"}\n}", "func Object(k string, v valf.ValueObject) Field {\n\treturn Field{Key: k, Value: valf.Object(v)}\n}", "func NewValueArray(array []Value) *ValueArray {\n\t// return &ValueArray{*NewListerValue(valueList(array))}\n\tres := ValueArray(array)\n\treturn &res\n}", "func (p *Parser) FromValues(ctx context.Context, env *rellenv.Env, values url.Values) (*Object, error) {\n\tobject := &Object{\n\t\tcontext: ctx,\n\t\tenv: env,\n\t\tstatic: p.Static,\n\t}\n\tfor key, values := range values {\n\t\tif strings.Contains(key, \":\") {\n\t\t\tfor _, value := range values {\n\t\t\t\tobject.AddPair(key, value)\n\t\t\t}\n\t\t}\n\t}\n\n\tif object.shouldGenerate(\"og:url\") {\n\t\tcopiedValues := copyValues(values)\n\t\tcopiedValues.Del(\"og:type\")\n\t\tcopiedValues.Del(\"og:title\")\n\t\turl := url.URL{\n\t\t\tScheme: env.Scheme,\n\t\t\tHost: env.Host,\n\t\t\tPath: \"/og/\" + object.Type() + \"/\" + object.Title(),\n\t\t\tRawQuery: sortedEncode(copiedValues),\n\t\t}\n\t\tobject.AddPair(\"og:url\", url.String())\n\t}\n\n\togType := object.Type()\n\tisGlobalOGType := !strings.Contains(ogType, \":\")\n\tisOwnedOGType := strings.HasPrefix(ogType, rellenv.FbApp(ctx).Namespace()+\":\")\n\tif object.shouldGenerate(\"fb:app_id\") && (isGlobalOGType || isOwnedOGType) {\n\t\tobject.AddPair(\"fb:app_id\", strconv.FormatUint(rellenv.FbApp(ctx).ID(), 10))\n\t}\n\n\terr := object.generateDefaults()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn object, nil\n}", "func NewValues(kvs ...string) Values {\n\tif len(kvs)%2 == 1 {\n\t\tpanic(\"twister: even number args required for NewParam\")\n\t}\n\tm := make(Values)\n\tfor i := 0; i < len(kvs); i += 2 {\n\t\tm.Add(kvs[i], kvs[i+1])\n\t}\n\treturn m\n}", "func NewMultilinearByValues(Table []frontend.Variable) MultilinearByValues {\n\treturn MultilinearByValues{Table: Table}\n}", "func CreateValues(m map[string]string) common.Values {\n\tvalues := make([]*common.Value, len(m))\n\ti := 0\n\tfor k, v := range m {\n\t\tvalue := &common.Value{}\n\t\tvalue.Name = k\n\t\tvalue.Value = v\n\t\tvalues[i] = value\n\t\ti++\n\t}\n\n\treturn common.Values{values}\n}", "func NewValue(v interface{}) Value {\n\tswitch val := v.(type) {\n\tcase nil:\n\t\treturn &NullValue{}\n\tcase int:\n\t\treturn NewIntegerValue(val)\n\tcase int64:\n\t\treturn NewLongValue(val)\n\tcase string:\n\t\treturn NewStringValue(val)\n\tcase []Value:\n\t\treturn NewValueArray(val)\n\tcase []byte:\n\t\treturn NewBytesValue(val)\n\tcase int8:\n\t\treturn NewIntegerValue(int(val))\n\tcase int16:\n\t\treturn NewIntegerValue(int(val))\n\tcase int32:\n\t\treturn NewIntegerValue(int(val))\n\tcase uint8: // byte supported here\n\t\treturn NewIntegerValue(int(val))\n\tcase uint16:\n\t\treturn NewIntegerValue(int(val))\n\tcase uint32:\n\t\treturn NewIntegerValue(int(val))\n\tcase float32:\n\t\treturn NewFloatValue(float64(val))\n\tcase float64:\n\t\treturn NewFloatValue(val)\n\tcase uint:\n\t\tif !Buffer.Arch64Bits || (val <= math.MaxInt64) {\n\t\t\treturn NewLongValue(int64(val))\n\t\t}\n\tcase []interface{}:\n\t\treturn NewListValue(val)\n\tcase map[interface{}]interface{}:\n\t\treturn NewMapValue(val)\n\tcase Value:\n\t\treturn val\n\tcase AerospikeBlob:\n\t\treturn NewBlobValue(val)\n\t}\n\n\t// check for array and map\n\trv := reflect.ValueOf(v)\n\tswitch rv.Kind() {\n\tcase reflect.Array, reflect.Slice:\n\t\tl := rv.Len()\n\t\tarr := make([]interface{}, l)\n\t\tfor i := 0; i < l; i++ {\n\t\t\tarr[i] = rv.Index(i).Interface()\n\t\t}\n\n\t\treturn NewListValue(arr)\n\tcase reflect.Map:\n\t\tl := rv.Len()\n\t\tamap := make(map[interface{}]interface{}, l)\n\t\tfor _, i := range rv.MapKeys() {\n\t\t\tamap[i.Interface()] = rv.MapIndex(i).Interface()\n\t\t}\n\n\t\treturn NewMapValue(amap)\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn NewLongValue(reflect.ValueOf(v).Int())\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32:\n\t\treturn NewLongValue(int64(reflect.ValueOf(v).Uint()))\n\tcase reflect.String:\n\t\treturn NewStringValue(rv.String())\n\t}\n\n\t// panic for anything that is not supported.\n\tpanic(NewAerospikeError(TYPE_NOT_SUPPORTED, \"Value type '\"+reflect.TypeOf(v).Name()+\"' not supported\"))\n}", "func Values(v interface{}) []interface{} {\n\treturn New(v).Values()\n}", "func (s *BasePlSqlParserListener) EnterNew_values_clause(ctx *New_values_clauseContext) {}", "func New(value ...interface{}) Stack {\n\ts := Stack{}\n\tfor _, e := range value {\n\t\ts.Push(e)\n\t}\n\treturn s\n}", "func NewValue(v interface{}) Value {\n\tif value := tryConcreteValue(v); value != nil {\n\t\treturn value\n\t}\n\n\tif newValueReflect != nil {\n\t\tif res := newValueReflect(v); res != nil {\n\t\t\treturn res\n\t\t}\n\t}\n\n\t// panic for anything that is not supported.\n\tpanic(types.NewAerospikeError(types.TYPE_NOT_SUPPORTED, fmt.Sprintf(\"Value type '%v' (%s) not supported (if you are compiling via 'as_performance' tag, use cast either to primitives, or use ListIter or MapIter interfaces.)\", v, reflect.TypeOf(v).String())))\n}", "func ClosureNewObject(sizeofClosure uint32, object *Object) *Closure {\n\tc_sizeof_closure := (C.guint)(sizeofClosure)\n\n\tc_object := (*C.GObject)(C.NULL)\n\tif object != nil {\n\t\tc_object = (*C.GObject)(object.ToC())\n\t}\n\n\tretC := C.g_closure_new_object(c_sizeof_closure, c_object)\n\tretGo := ClosureNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "func NewArray(values []*Value) *Value {\n\treturn &Value{values, Array}\n}", "func NewValue(data interface{}, startSeconds int64, endSeconds int64) Value {\n\treturn Value{data, startSeconds, endSeconds}\n}", "func (this *ObjectValues) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (this *ObjectValues) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (this *ObjectAdd) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectAdd(operands[0], operands[1], operands[2])\n\t}\n}", "func NewListValue(list []interface{}) ListValue {\n\treturn ListValue(list)\n}", "func NewValue(e expr.Expr, ts time.Time, params expr.Params, metadata goexpr.Params) Sequence {\n\tseq := NewSequence(e.EncodedWidth(), 1)\n\tseq.SetUntil(ts)\n\tseq.UpdateValueAt(0, e, params, metadata)\n\treturn seq\n}", "func NewValue(t Type, val interface{}) Value {\n\tv, err := newValue(t, val)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func convertFloatsToObjects(vals []float64) []interface{} {\n\tresult := make([]interface{}, 0, len(vals))\n\tfor _, f := range vals {\n\t\tresult = append(result, f)\n\t}\n\treturn result\n}", "func (this *ObjectPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPairs(operands[0])\n\t}\n}", "func (this *ObjectPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPairs(operands[0])\n\t}\n}", "func NewObjectRemove(first, second Expression) Function {\n\trv := &ObjectRemove{\n\t\t*NewBinaryFunctionBase(\"object_remove\", first, second),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewValue(value string, id *Ident) *Value {\n\t*id = New(value)\n\treturn (*Value)(id)\n}", "func (this *ObjectUnwrap) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectUnwrap(operands[0])\n\t}\n}", "func Valueize(values ...reflect.Value) []reflect.Value {\n\treturn values\n}", "func CreateObject(v *Instance, config interface{}) (interface{}, error) {\n\tctx := context.Background()\n\tif v != nil {\n\t\tctx = context.WithValue(ctx, v2rayKey, v)\n\t}\n\treturn common.CreateObject(ctx, config)\n}", "func NewValueArray(array []Value) *ValueArray {\n\tres := &ValueArray{\n\t\tarray: array,\n\t}\n\n\tres.bytes, _ = packValueArray(array)\n\n\treturn res\n}", "func CloneValues(n Values) Values {\n\tres := make(Values, 0, len(n))\n\tfor _, x := range n {\n\t\tres = append(res, CloneValTuple(x))\n\t}\n\treturn res\n}", "func (this *ObjectValues) Apply(context Context, arg value.Value) (value.Value, error) {\n\tif arg.Type() == value.MISSING {\n\t\treturn value.MISSING_VALUE, nil\n\t} else if arg.Type() != value.OBJECT {\n\t\treturn value.NULL_VALUE, nil\n\t}\n\n\toa := arg.Actual().(map[string]interface{})\n\tkeys := make(sort.StringSlice, 0, len(oa))\n\tfor key, _ := range oa {\n\t\tkeys = append(keys, key)\n\t}\n\n\tsort.Sort(keys)\n\tra := make([]interface{}, len(keys))\n\tfor i, k := range keys {\n\t\tra[i] = oa[k]\n\t}\n\n\treturn value.NewValue(ra), nil\n}", "func (this *ObjectValues) Apply(context Context, arg value.Value) (value.Value, error) {\n\tif arg.Type() == value.MISSING {\n\t\treturn value.MISSING_VALUE, nil\n\t} else if arg.Type() != value.OBJECT {\n\t\treturn value.NULL_VALUE, nil\n\t}\n\n\toa := arg.Actual().(map[string]interface{})\n\tkeys := make(sort.StringSlice, 0, len(oa))\n\tfor key, _ := range oa {\n\t\tkeys = append(keys, key)\n\t}\n\n\tsort.Sort(keys)\n\tra := make([]interface{}, len(keys))\n\tfor i, k := range keys {\n\t\tra[i] = oa[k]\n\t}\n\n\treturn value.NewValue(ra), nil\n}", "func NewValueRef(ref unsafe.Pointer) *Value {\n\tif ref == nil {\n\t\treturn nil\n\t}\n\tobj := new(Value)\n\tobj.ref23e8c9e3 = (*C.YGValue)(unsafe.Pointer(ref))\n\treturn obj\n}", "func NewValuesHelper(config *config.GardenletConfiguration, imageVector imagevector.ImageVector) ValuesHelper {\n\treturn &valuesHelper{\n\t\tconfig: config,\n\t\timageVector: imageVector,\n\t}\n}", "func New() *Objects {\n\to := &Objects{\n\t\tvalues: map[string]*Object{},\n\t\tgcInterval: 60,\n\t\tgcMaxOnce: 100,\n\t\tgcExit: make(chan int),\n\t}\n\n\tgo o.gc()\n\n\treturn o\n}", "func (this *ObjectInnerValues) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func ValExpandFunction(model ModelT, yval *YvalT, def *YvalT) (vector []YvalT) {\n\tvar tv C.yval_vector_t\n\tC.yices_init_yval_vector(&tv)\n\terrcode := int32(C.yices_val_expand_function(ymodel(model), (*C.yval_t)(yval), (*C.yval_t)(def), (*C.yval_vector_t)(&tv)))\n\tif errcode != -1 {\n\t\tcount := int(tv.size)\n\t\tvector = make([]YvalT, count, count)\n\t\t// defined in the preamble yices_term_vector_get(term_vector_t* vec, uint32_t elem)\n\t\tfor i := 0; i < count; i++ {\n\t\t\tvar yv C.yval_t\n\t\t\tC.yices_yval_vector_get(&tv, C.uint32_t(i), (*C.yval_t)(&yv))\n\t\t\tvector[i] = YvalT(yv)\n\t\t}\n\t}\n\tC.yices_delete_yval_vector(&tv)\n\treturn\n}", "func NewValue(raw []byte) *Value {\n\treturn &Value{Raw: raw}\n}", "func (this *ObjectValues) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectValues) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func NewExecuteFunction(name functions.FunctionName, exprs expression.Expressions) *ExecuteFunction {\n\trv := &ExecuteFunction{\n\t\tname: name,\n\t\texprs: exprs,\n\t}\n\n\trv.stmt = rv\n\treturn rv\n}", "func (n *JsonParseNode) GetCollectionOfObjectValues(ctor absser.ParsableFactory) ([]absser.Parsable, error) {\n\tif n == nil || n.value == nil {\n\t\treturn nil, nil\n\t}\n\tif ctor == nil {\n\t\treturn nil, errors.New(\"ctor is nil\")\n\t}\n\tnodes, ok := n.value.([]*JsonParseNode)\n\tif !ok {\n\t\treturn nil, errors.New(\"value is not a collection\")\n\t}\n\tresult := make([]absser.Parsable, len(nodes))\n\tfor i, v := range nodes {\n\t\tval, err := (*v).GetObjectValue(ctor)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresult[i] = val\n\t}\n\treturn result, nil\n}", "func NewObject() (Object) {\n\tvar newobj Object = Object{\n\t\tObject : make(map[string]interface{}, 0),\n\t}\n\treturn newobj\n}", "func ValueInit(t Type) *Value {\n\tin := libc.Malloc(24) // 8bytes x 3\n\tlibc.Memset(in, 0, 24)\n\tout := Candy().Guify(\"g_value_init\", in, t).String()\n\tobj := NewValue(Candy(), out)\n\treturn obj\n}", "func (ot *ObjectType) assignValues(values ...interface{}) error {\n\tif m, n := len(values), len(objecttype.Columns); m < n {\n\t\treturn fmt.Errorf(\"mismatch number of scan values: %d != %d\", m, n)\n\t}\n\tvalue, ok := values[0].(*sql.NullInt64)\n\tif !ok {\n\t\treturn fmt.Errorf(\"unexpected type %T for field id\", value)\n\t}\n\tot.ID = int(value.Int64)\n\tvalues = values[1:]\n\tif value, ok := values[0].(*sql.NullString); !ok {\n\t\treturn fmt.Errorf(\"unexpected type %T for field name\", values[0])\n\t} else if value.Valid {\n\t\tot.Name = value.String\n\t}\n\tif value, ok := values[1].(*sql.NullString); !ok {\n\t\treturn fmt.Errorf(\"unexpected type %T for field kind\", values[1])\n\t} else if value.Valid {\n\t\tot.Kind = value.String\n\t}\n\tif value, ok := values[2].(*sql.NullString); !ok {\n\t\treturn fmt.Errorf(\"unexpected type %T for field description\", values[2])\n\t} else if value.Valid {\n\t\tot.Description = value.String\n\t}\n\treturn nil\n}", "func NEW_VECTOR(indices []int, values []float64, n int) VECTOR_TYPE {\n if len(indices) != len(values) {\n panic(\"number of indices does not match number of values\")\n }\n r := NIL_VECTOR(n)\n for i, k := range indices {\n if k >= n {\n panic(\"index larger than vector dimension\")\n }\n if _, ok := r.values[k]; ok {\n panic(\"index appeared multiple times\")\n } else {\n if values[i] != 0.0 {\n r.values[k] = NEW_SCALAR(values[i])\n r.indexInsert(k)\n }\n }\n }\n return r\n}", "func NewObject(handle int, t ObjectType, id string, enigmaobject interface{}) *Object {\n\tobj := &Object{\n\t\tHandle: handle,\n\t\tType: t,\n\t\tID: id,\n\t\tEnigmaObject: enigmaobject,\n\t}\n\treturn obj\n}", "func New(values ...interface{}) *Set {\n\tset := &Set{items: make(map[interface{}]struct{})}\n\tif len(values) > 0 {\n\t\tset.Add(values...)\n\t}\n\treturn set\n}", "func (c MethodsCollection) ProcessCreateValues() pProcessCreateValues {\n\treturn pProcessCreateValues{\n\t\tMethod: c.MustGet(\"ProcessCreateValues\"),\n\t}\n}", "func (o *JS) New(args []interface{}) Object {\n\treturn &JS{o.object.New(args...)}\n}", "func NewObjectArray(vs []*Object) *Array {\n\tvar ja Array\n\tif len(vs) > 0 {\n\t\tja.Values = make([]Value, len(vs))\n\t\tfor i, v := range vs {\n\t\t\tja.Values[i] = v\n\t\t}\n\t}\n\treturn &ja\n}", "func NewObjectPut(first, second, third Expression) Function {\n\trv := &ObjectPut{\n\t\t*NewTernaryFunctionBase(\"object_put\", first, second, third),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewValueFromPtr(val unsafe.Pointer) (*Value, error) {\n\tif val == nil {\n\t\treturn nil, fmt.Errorf(\"Cannot create value from 'nil' pointer\")\n\t}\n\n\tv, err := C.value_new((*C.zval)(val))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to create PHP value from pointer\")\n\t}\n\n\treturn &Value{value: v}, nil\n}", "func New(vals ...interface{}) *List {\n\thead := list.New()\n\tfor _, v := range vals {\n\t\thead.PushBack(v)\n\t}\n\treturn &List{head}\n}", "func (j *Env) NewObject(className string, args ...interface{}) (*ObjectRef, error) {\n\tclass, err := j.callFindClass(className)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := replaceConvertedArgs(args); err != nil {\n\t\treturn nil, err\n\t}\n\tvar methodSig string\n\tif j.preCalcSig != \"\" {\n\t\tmethodSig = j.preCalcSig\n\t\tj.preCalcSig = \"\"\n\t} else {\n\t\tcalcSig, err := sigForMethod(Void, \"\", args)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmethodSig = calcSig\n\t}\n\n\tmid, err := j.callGetMethodID(false, class, \"<init>\", methodSig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// create args for jni call\n\tjniArgs, refs, err := j.createArgs(args)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tcleanUpArgs(jniArgs)\n\t\tfor _, ref := range refs {\n\t\t\tdeleteLocalRef(j.jniEnv, ref)\n\t\t}\n\t}()\n\n\tobj := newObjectA(j.jniEnv, class, mid, jniArgs)\n\tif obj == 0 {\n\t\treturn nil, j.handleException()\n\t}\n\n\treturn &ObjectRef{obj, className, false}, nil\n}", "func ConstObject(k string, v valf.ValueObject) Field {\n\treturn Field{Key: k, Value: valf.ConstObject(v)}\n}", "func (e Entry) ObjectFunc(k string, v func(Entry)) Entry {\n\te.enc.ObjectKey(k, Object(func(enc *Encoder) {\n\t\tv(e)\n\t}))\n\treturn e\n}", "func NewValue(v *sqlparser.SQLVal) (*Value, error) {\n\tswitch v.Type {\n\tcase sqlparser.StrVal:\n\t\treturn NewString(string(v.Val)), nil\n\tcase sqlparser.IntVal:\n\t\ti64, err := strconv.ParseInt(string(v.Val), 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn NewInt(i64), nil\n\tcase sqlparser.FloatVal:\n\t\tf64, err := strconv.ParseFloat(string(v.Val), 64)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn NewFloat(f64), nil\n\tcase sqlparser.HexNum: // represented as 0xDD\n\t\ti64, err := strconv.ParseInt(string(v.Val), 16, 64)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn NewInt(i64), nil\n\tcase sqlparser.HexVal: // represented as X'0DD'\n\t\ti64, err := strconv.ParseInt(string(v.Val), 16, 64)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn NewInt(i64), nil\n\tcase sqlparser.BitVal: // represented as B'00'\n\t\ti64, err := strconv.ParseInt(string(v.Val), 2, 64)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn NewInt(i64), nil\n\tcase sqlparser.ValArg:\n\t\t// FIXME: the format is unknown and not sure how to handle it.\n\t}\n\n\treturn nil, fmt.Errorf(\"unknown SQL value %v; %v \", v, v.Type)\n}", "func (set ReadableConversionEndpointSet) CreateValueFunctionEndpoints(sourceType astmodel.Type) int {\n\t// Add more endpoints for any value functions we can read\n\treturn set.addForEachValueFunction(sourceType, func(fn astmodel.ValueFunction) *ReadableConversionEndpoint {\n\t\treturn NewReadableConversionEndpointReadingValueFunction(fn.Name(), fn.ReturnType())\n\t})\n}" ]
[ "0.751708", "0.63653314", "0.6325895", "0.6325895", "0.621891", "0.6025096", "0.58745253", "0.5860087", "0.5854441", "0.57969606", "0.5770344", "0.57039964", "0.57039964", "0.5660476", "0.5660476", "0.5658049", "0.5558985", "0.54201657", "0.5405711", "0.5354272", "0.53477496", "0.53025335", "0.5297057", "0.52873605", "0.5252346", "0.5236855", "0.52179193", "0.52081513", "0.5180284", "0.5158768", "0.5069697", "0.50609624", "0.5001707", "0.49926218", "0.49743062", "0.49639452", "0.4946432", "0.49421304", "0.49421304", "0.4933853", "0.49260026", "0.48862493", "0.48679423", "0.48563868", "0.48327494", "0.47878215", "0.4785791", "0.47751448", "0.47728702", "0.47359145", "0.47327122", "0.47242185", "0.47094685", "0.46996573", "0.46923658", "0.46923658", "0.46916726", "0.46753", "0.46739984", "0.4663983", "0.46384203", "0.46375877", "0.46375877", "0.46267712", "0.46021032", "0.4589818", "0.45851785", "0.45755413", "0.4569549", "0.4567076", "0.4556229", "0.4556229", "0.4538459", "0.45239872", "0.45043358", "0.45012194", "0.44982302", "0.44878495", "0.44874752", "0.44874752", "0.44859505", "0.44854382", "0.4475825", "0.44724953", "0.44711387", "0.44669607", "0.44649172", "0.44545618", "0.44487122", "0.44455904", "0.44455162", "0.44423756", "0.444015", "0.44375694", "0.44355786", "0.44353783", "0.44339275", "0.4433597", "0.44303298" ]
0.83485734
1
/ It calls the VisitFunction method by passing in the receiver to and returns the interface. It is a visitor pattern.
func (this *ObjectValues) Accept(visitor Visitor) (interface{}, error) { return visitor.VisitFunction(this) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (this *NowStr) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (e FunctionCallExpression) Visit(env Environment) Value {\n\treturn NoneValue()\n}", "func (i *InterfaceSet) Visit(n ast.Node) (w ast.Visitor) {\n\tswitch n := n.(type) {\n\tcase *ast.TypeSpec:\n\t\tif data, ok := n.Type.(*ast.InterfaceType); ok {\n\t\t\tr := InterfaceInfo{\n\t\t\t\tMethods: []*Method{},\n\t\t\t}\n\t\t\tmethods := data.Methods.List\n\t\t\tr.Name = n.Name.Name\n\t\t\tr.Doc = n.Doc.Text()\n\n\t\t\tfor _, m := range methods {\n\t\t\t\tfor _, name := range m.Names {\n\t\t\t\t\tr.Methods = append(r.Methods, &Method{\n\t\t\t\t\t\tMethodName: name.Name,\n\t\t\t\t\t\tDoc: m.Doc.Text(),\n\t\t\t\t\t\tParams: getParamList(m.Type.(*ast.FuncType).Params),\n\t\t\t\t\t\tResult: getParamList(m.Type.(*ast.FuncType).Results),\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t}\n\t\t\ti.Interfaces = append(i.Interfaces, r)\n\t\t}\n\t}\n\treturn i\n}", "func FuncInterface(_ T1) {}", "func (this *ExecuteFunction) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitExecuteFunction(this)\n}", "func (this *ObjectUnwrap) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (r *Resolver) Visitor() generated.VisitorResolver { return &visitorResolver{r} }", "func (this *ObjectInnerValues) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (f VisitorFunc) Visit(node Node, visitType int) error {\n\treturn f(node, visitType)\n}", "func (this *ObjectNames) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectNames) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ClockStr) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *NowMillis) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (statement *FunctionCall) Accept(visitor StatementVisitor) {\n\tvisitor.VisitFunctionCall(statement)\n}", "func (this *ObjectLength) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectLength) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectRemove) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *DateDiffStr) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectPairs) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectPairs) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectAdd) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectInnerPairs) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectPut) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (v Value) AsFunction() Callable {\n\treturn v.iface.(Callable)\n}", "func (bf *BuiltInFunc) Call(interpreter *Interpreter, args ...interface{}) interface{} {\n\t// we actually omit the `interpreter` because we already known how\n\t// to convert it into a go function.\n\treturn bf.call(bf.instance, args...)\n}", "func (this *ClockMillis) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (statement *NativeCall) Accept(visitor StatementVisitor) {\n\tvisitor.VisitNativeCall(statement)\n}", "func (this *DatePartStr) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func Visit(node Node, visitor func(Node)) {\n\tReplace(node, func(n Node) Node { visitor(n); return n })\n}", "func (*Base) Visit(p ASTPass, node *ast.Node, ctx Context) {\n\n\tf := *(*node).OpenFodder()\n\tp.Fodder(p, &f, ctx)\n\t*(*node).OpenFodder() = f\n\n\tswitch node := (*node).(type) {\n\tcase *ast.Apply:\n\t\tp.Apply(p, node, ctx)\n\tcase *ast.ApplyBrace:\n\t\tp.ApplyBrace(p, node, ctx)\n\tcase *ast.Array:\n\t\tp.Array(p, node, ctx)\n\tcase *ast.ArrayComp:\n\t\tp.ArrayComp(p, node, ctx)\n\tcase *ast.Assert:\n\t\tp.Assert(p, node, ctx)\n\tcase *ast.Binary:\n\t\tp.Binary(p, node, ctx)\n\tcase *ast.Conditional:\n\t\tp.Conditional(p, node, ctx)\n\tcase *ast.Dollar:\n\t\tp.Dollar(p, node, ctx)\n\tcase *ast.Error:\n\t\tp.Error(p, node, ctx)\n\tcase *ast.Function:\n\t\tp.Function(p, node, ctx)\n\tcase *ast.Import:\n\t\tp.Import(p, node, ctx)\n\tcase *ast.ImportStr:\n\t\tp.ImportStr(p, node, ctx)\n\tcase *ast.ImportBin:\n\t\tp.ImportBin(p, node, ctx)\n\tcase *ast.Index:\n\t\tp.Index(p, node, ctx)\n\tcase *ast.InSuper:\n\t\tp.InSuper(p, node, ctx)\n\tcase *ast.LiteralBoolean:\n\t\tp.LiteralBoolean(p, node, ctx)\n\tcase *ast.LiteralNull:\n\t\tp.LiteralNull(p, node, ctx)\n\tcase *ast.LiteralNumber:\n\t\tp.LiteralNumber(p, node, ctx)\n\tcase *ast.LiteralString:\n\t\tp.LiteralString(p, node, ctx)\n\tcase *ast.Local:\n\t\tp.Local(p, node, ctx)\n\tcase *ast.Object:\n\t\tp.Object(p, node, ctx)\n\tcase *ast.ObjectComp:\n\t\tp.ObjectComp(p, node, ctx)\n\tcase *ast.Parens:\n\t\tp.Parens(p, node, ctx)\n\tcase *ast.Self:\n\t\tp.Self(p, node, ctx)\n\tcase *ast.Slice:\n\t\tp.Slice(p, node, ctx)\n\tcase *ast.SuperIndex:\n\t\tp.SuperIndex(p, node, ctx)\n\tcase *ast.Unary:\n\t\tp.Unary(p, node, ctx)\n\tcase *ast.Var:\n\t\tp.Var(p, node, ctx)\n\t}\n}", "func (this *Element) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitElement(this)\n}", "func (n *Interface) Walk(v walker.Visitor) {\n\tif v.EnterNode(n) == false {\n\t\treturn\n\t}\n\n\tif n.InterfaceName != nil {\n\t\tvv := v.GetChildrenVisitor(\"InterfaceName\")\n\t\tn.InterfaceName.Walk(vv)\n\t}\n\n\tif n.Extends != nil {\n\t\tvv := v.GetChildrenVisitor(\"Extends\")\n\t\tn.Extends.Walk(vv)\n\t}\n\n\tif n.Stmts != nil {\n\t\tvv := v.GetChildrenVisitor(\"Stmts\")\n\t\tfor _, nn := range n.Stmts {\n\t\t\tif nn != nil {\n\t\t\t\tnn.Walk(vv)\n\t\t\t}\n\t\t}\n\t}\n\n\tv.LeaveNode(n)\n}", "func (this *StrToZoneName) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func Visit(visitor func(funcName string, backend TemplateFunc)) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tfor funcName, backend := range backends {\n\t\tvisitor(funcName, backend)\n\t}\n}", "func (this *DateDiffMillis) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *StrToUTC) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (u Unary) Accept(interpreter *Interpreter) Object {\n\treturn interpreter.visitUnary(u)\n}", "func (v *FuncVisitor) Visit(node ast.Node) ast.Visitor {\n\tswitch n := node.(type) {\n\tcase *ast.FuncDecl:\n\t\tif n.Body == nil {\n\t\t\t// Do not count declarations of assembly functions.\n\t\t\tbreak\n\t\t}\n\t\tstart := v.fset.Position(n.Pos())\n\t\tend := v.fset.Position(n.End())\n\n\t\tfe := &FuncExtent{\n\t\t\tName: v.signature(n),\n\t\t\tDecl: n,\n\t\t\tstartLine: start.Line,\n\t\t\tstartCol: start.Column,\n\t\t\tendLine: end.Line,\n\t\t\tendCol: end.Column,\n\t\t\tOffset: start.Offset,\n\t\t\tEnd: end.Offset,\n\t\t}\n\t\tv.funcs = append(v.funcs, fe)\n\t}\n\treturn v\n}", "func (this *DateAddStr) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *MillisToStr) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *Mod) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitMod(this)\n}", "func (this *StrToMillis) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (b Binary) Accept(interpreter *Interpreter) Object {\n\treturn interpreter.visitBinary(b)\n}", "func (this *MillisToUTC) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (v visitor) Visit(n ast.Node) ast.Visitor {\n\tif n == nil {\n\t\treturn nil\n\t}\n\n\tif ShouldPrintAbstractSyntaxTree {\n\t\tfmt.Printf(\"%s%T\\n\", strings.Repeat(\"\\t\", int(v)), n)\n\t\tfmt.Printf(\"%d\", v)\n\n\t\treturn v + 1\n\t}\n\n\tswitch d := n.(type) {\n\tcase *ast.Ident:\n\t\tif d.Obj == nil {\n\t\t\treturn v + 1\n\t\t}\n\n\t\tif d.Obj.Kind == ast.Typ {\n\t\t\tresult := parseStruct(d)\n\n\t\t\tfor i := range result {\n\t\t\t\t_, ok := Result[CurrentFile].StructScanResult[result[i].Name]\n\t\t\t\tif !ok {\n\t\t\t\t\tResult[CurrentFile].StructScanResult[result[i].Name] = result[i]\n\t\t\t\t}\n\t\t\t}\n\t\t} else if d.Obj.Kind == ast.Con || d.Obj.Kind == ast.Var {\n\t\t\tresult := parseConstantsAndVariables(d)\n\n\t\t\tfor i := range result {\n\t\t\t\t_, ok := Result[CurrentFile].ScanResult[result[i].Name]\n\t\t\t\tif !ok {\n\t\t\t\t\tResult[CurrentFile].ScanResult[result[i].Name] = result[i]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\tdefault:\n\t\tbreak\n\t}\n\n\treturn v + 1\n}", "func (p Passengers) Visit(visitor func(Passenger)) {\n\tfor _, one := range p {\n\t\tvisitor(one)\n\t}\n}", "func (p Passengers) Visit(visitor func(Passenger)) {\n\tfor _, one := range p {\n\t\tvisitor(one)\n\t}\n}", "func (this *MillisToZoneName) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *DateTruncStr) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (x AstSlice) Interface() interface{} { return asInterface(x.X, x.X == nil) }", "func (p *Parser) Interface() interface{} {\n\treturn p.data\n}", "func (*FuncExpr) iCallable() {}", "func (this *DateAddMillis) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (c *CallExpr) accept(v ExprVisitor) {\n\tv.VisitCall(c)\n}", "func (this *DatePartMillis) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (f *Function) Call(arg interface{}) {\n\tf.input <- arg\n}", "func (l *List) Visit(f func(n *Node)) {\n\tp := l.head\n\tfor p != nil {\n\t\tf(p)\n\t\tp = p.next\n\t}\n}", "func (f WalkFunc) Walk(ctx context.Context, call *Call, path string) Node { return f(path) }", "func (r *fakeResourceResult) Visit(fn resource.VisitorFunc) error {\n\tfor _, info := range r.Infos {\n\t\terr := fn(info, nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func Replace(node Node, visitor func(Node) Node) {\n\tswitch n := node.(type) {\n\tcase *Abort:\n\tcase *API:\n\t\tfor i, c := range n.Enums {\n\t\t\tn.Enums[i] = visitor(c).(*Enum)\n\t\t}\n\t\tfor i, c := range n.Definitions {\n\t\t\tn.Definitions[i] = visitor(c).(*Definition)\n\t\t}\n\t\tfor i, c := range n.Classes {\n\t\t\tn.Classes[i] = visitor(c).(*Class)\n\t\t}\n\t\tfor i, c := range n.Pseudonyms {\n\t\t\tn.Pseudonyms[i] = visitor(c).(*Pseudonym)\n\t\t}\n\t\tfor i, c := range n.Externs {\n\t\t\tn.Externs[i] = visitor(c).(*Function)\n\t\t}\n\t\tfor i, c := range n.Subroutines {\n\t\t\tn.Subroutines[i] = visitor(c).(*Function)\n\t\t}\n\t\tfor i, c := range n.Functions {\n\t\t\tn.Functions[i] = visitor(c).(*Function)\n\t\t}\n\t\tfor i, c := range n.Methods {\n\t\t\tn.Methods[i] = visitor(c).(*Function)\n\t\t}\n\t\tfor i, c := range n.Globals {\n\t\t\tn.Globals[i] = visitor(c).(*Global)\n\t\t}\n\t\tfor i, c := range n.StaticArrays {\n\t\t\tn.StaticArrays[i] = visitor(c).(*StaticArray)\n\t\t}\n\t\tfor i, c := range n.Maps {\n\t\t\tn.Maps[i] = visitor(c).(*Map)\n\t\t}\n\t\tfor i, c := range n.Pointers {\n\t\t\tn.Pointers[i] = visitor(c).(*Pointer)\n\t\t}\n\t\tfor i, c := range n.Slices {\n\t\t\tn.Slices[i] = visitor(c).(*Slice)\n\t\t}\n\t\tfor i, c := range n.References {\n\t\t\tn.References[i] = visitor(c).(*Reference)\n\t\t}\n\t\tfor i, c := range n.Signatures {\n\t\t\tn.Signatures[i] = visitor(c).(*Signature)\n\t\t}\n\tcase *ArrayAssign:\n\t\tn.To = visitor(n.To).(*ArrayIndex)\n\t\tn.Value = visitor(n.Value).(Expression)\n\tcase *ArrayIndex:\n\t\tn.Array = visitor(n.Array).(Expression)\n\t\tn.Index = visitor(n.Index).(Expression)\n\tcase *ArrayInitializer:\n\t\tn.Array = visitor(n.Array).(Type)\n\t\tfor i, c := range n.Values {\n\t\t\tn.Values[i] = visitor(c).(Expression)\n\t\t}\n\tcase *Slice:\n\t\tn.To = visitor(n.To).(Type)\n\tcase *SliceIndex:\n\t\tn.Slice = visitor(n.Slice).(Expression)\n\t\tn.Index = visitor(n.Index).(Expression)\n\tcase *SliceAssign:\n\t\tn.To = visitor(n.To).(*SliceIndex)\n\t\tn.Value = visitor(n.Value).(Expression)\n\tcase *Assert:\n\t\tn.Condition = visitor(n.Condition).(Expression)\n\tcase *Assign:\n\t\tn.LHS = visitor(n.LHS).(Expression)\n\t\tn.RHS = visitor(n.RHS).(Expression)\n\tcase *Annotation:\n\t\tfor i, c := range n.Arguments {\n\t\t\tn.Arguments[i] = visitor(c).(Expression)\n\t\t}\n\tcase *Block:\n\t\tfor i, c := range n.Statements {\n\t\t\tn.Statements[i] = visitor(c).(Statement)\n\t\t}\n\tcase BoolValue:\n\tcase *BinaryOp:\n\t\tif n.LHS != nil {\n\t\t\tn.LHS = visitor(n.LHS).(Expression)\n\t\t}\n\t\tif n.RHS != nil {\n\t\t\tn.RHS = visitor(n.RHS).(Expression)\n\t\t}\n\tcase *BitTest:\n\t\tn.Bitfield = visitor(n.Bitfield).(Expression)\n\t\tn.Bits = visitor(n.Bits).(Expression)\n\tcase *UnaryOp:\n\t\tn.Expression = visitor(n.Expression).(Expression)\n\tcase *Branch:\n\t\tn.Condition = visitor(n.Condition).(Expression)\n\t\tn.True = visitor(n.True).(*Block)\n\t\tif n.False != nil {\n\t\t\tn.False = visitor(n.False).(*Block)\n\t\t}\n\tcase *Builtin:\n\tcase *Reference:\n\t\tn.To = visitor(n.To).(Type)\n\tcase *Call:\n\t\tn.Type = visitor(n.Type).(Type)\n\t\tn.Target = visitor(n.Target).(*Callable)\n\t\tfor i, a := range n.Arguments {\n\t\t\tn.Arguments[i] = visitor(a).(Expression)\n\t\t}\n\tcase *Callable:\n\t\tif n.Object != nil {\n\t\t\tn.Object = visitor(n.Object).(Expression)\n\t\t}\n\t\tn.Function = visitor(n.Function).(*Function)\n\tcase *Case:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\t\tfor i, c := range n.Conditions {\n\t\t\tn.Conditions[i] = visitor(c).(Expression)\n\t\t}\n\t\tn.Block = visitor(n.Block).(*Block)\n\tcase *Cast:\n\t\tn.Object = visitor(n.Object).(Expression)\n\t\tn.Type = visitor(n.Type).(Type)\n\tcase *Class:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\t\tfor i, f := range n.Fields {\n\t\t\tn.Fields[i] = visitor(f).(*Field)\n\t\t}\n\t\tfor i, m := range n.Methods {\n\t\t\tn.Methods[i] = visitor(m).(*Function)\n\t\t}\n\tcase *ClassInitializer:\n\t\tfor i, f := range n.Fields {\n\t\t\tn.Fields[i] = visitor(f).(*FieldInitializer)\n\t\t}\n\tcase *Choice:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\t\tfor i, c := range n.Conditions {\n\t\t\tn.Conditions[i] = visitor(c).(Expression)\n\t\t}\n\t\tn.Expression = visitor(n.Expression).(Expression)\n\tcase *Definition:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\t\tn.Expression = visitor(n.Expression).(Expression)\n\tcase *DefinitionUsage:\n\t\tn.Expression = visitor(n.Expression).(Expression)\n\t\tn.Definition = visitor(n.Definition).(*Definition)\n\tcase *DeclareLocal:\n\t\tn.Local = visitor(n.Local).(*Local)\n\t\tif n.Local.Value != nil {\n\t\t\tn.Local.Value = visitor(n.Local.Value).(Expression)\n\t\t}\n\tcase Documentation:\n\tcase *Enum:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\t\tfor i, e := range n.Entries {\n\t\t\tn.Entries[i] = visitor(e).(*EnumEntry)\n\t\t}\n\tcase *EnumEntry:\n\tcase *Fence:\n\t\tif n.Statement != nil {\n\t\t\tn.Statement = visitor(n.Statement).(Statement)\n\t\t}\n\tcase *Field:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\t\tn.Type = visitor(n.Type).(Type)\n\t\tif n.Default != nil {\n\t\t\tn.Default = visitor(n.Default).(Expression)\n\t\t}\n\tcase *FieldInitializer:\n\t\tn.Value = visitor(n.Value).(Expression)\n\tcase Float32Value:\n\tcase Float64Value:\n\tcase *Function:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\t\tif n.Return != nil {\n\t\t\tn.Return = visitor(n.Return).(*Parameter)\n\t\t}\n\t\tfor i, c := range n.FullParameters {\n\t\t\tn.FullParameters[i] = visitor(c).(*Parameter)\n\t\t}\n\t\tif n.Block != nil {\n\t\t\tn.Block = visitor(n.Block).(*Block)\n\t\t}\n\t\tn.Signature = visitor(n.Signature).(*Signature)\n\tcase *Global:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\tcase *StaticArray:\n\t\tn.ValueType = visitor(n.ValueType).(Type)\n\t\tn.SizeExpr = visitor(n.SizeExpr).(Expression)\n\tcase *Signature:\n\tcase Int8Value:\n\tcase Int16Value:\n\tcase Int32Value:\n\tcase Int64Value:\n\tcase *Iteration:\n\t\tn.Iterator = visitor(n.Iterator).(*Local)\n\t\tn.From = visitor(n.From).(Expression)\n\t\tn.To = visitor(n.To).(Expression)\n\t\tn.Block = visitor(n.Block).(*Block)\n\tcase *MapIteration:\n\t\tn.IndexIterator = visitor(n.IndexIterator).(*Local)\n\t\tn.KeyIterator = visitor(n.KeyIterator).(*Local)\n\t\tn.ValueIterator = visitor(n.ValueIterator).(*Local)\n\t\tn.Map = visitor(n.Map).(Expression)\n\t\tn.Block = visitor(n.Block).(*Block)\n\tcase Invalid:\n\tcase *Length:\n\t\tn.Object = visitor(n.Object).(Expression)\n\tcase *Local:\n\t\tn.Type = visitor(n.Type).(Type)\n\tcase *Map:\n\t\tn.KeyType = visitor(n.KeyType).(Type)\n\t\tn.ValueType = visitor(n.ValueType).(Type)\n\tcase *MapAssign:\n\t\tn.To = visitor(n.To).(*MapIndex)\n\t\tn.Value = visitor(n.Value).(Expression)\n\tcase *MapContains:\n\t\tn.Key = visitor(n.Key).(Expression)\n\t\tn.Map = visitor(n.Map).(Expression)\n\tcase *MapIndex:\n\t\tn.Map = visitor(n.Map).(Expression)\n\t\tn.Index = visitor(n.Index).(Expression)\n\tcase *MapRemove:\n\t\tn.Map = visitor(n.Map).(Expression)\n\t\tn.Key = visitor(n.Key).(Expression)\n\tcase *MapClear:\n\t\tn.Map = visitor(n.Map).(Expression)\n\tcase *Member:\n\t\tn.Object = visitor(n.Object).(Expression)\n\t\tn.Field = visitor(n.Field).(*Field)\n\tcase *MessageValue:\n\t\tfor i, a := range n.Arguments {\n\t\t\tn.Arguments[i] = visitor(a).(*FieldInitializer)\n\t\t}\n\tcase *New:\n\t\tn.Type = visitor(n.Type).(*Reference)\n\tcase *Parameter:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\t\tn.Type = visitor(n.Type).(Type)\n\tcase *Pointer:\n\t\tn.To = visitor(n.To).(Type)\n\tcase *Pseudonym:\n\t\tfor i, c := range n.Annotations {\n\t\t\tn.Annotations[i] = visitor(c).(*Annotation)\n\t\t}\n\t\tn.To = visitor(n.To).(Type)\n\t\tfor i, m := range n.Methods {\n\t\t\tn.Methods[i] = visitor(m).(*Function)\n\t\t}\n\tcase *Return:\n\t\tif n.Value != nil {\n\t\t\tn.Value = visitor(n.Value).(Expression)\n\t\t}\n\tcase *Select:\n\t\tn.Value = visitor(n.Value).(Expression)\n\t\tfor i, c := range n.Choices {\n\t\t\tn.Choices[i] = visitor(c).(*Choice)\n\t\t}\n\t\tif n.Default != nil {\n\t\t\tn.Default = visitor(n.Default).(Expression)\n\t\t}\n\tcase StringValue:\n\tcase *Switch:\n\t\tn.Value = visitor(n.Value).(Expression)\n\t\tfor i, c := range n.Cases {\n\t\t\tn.Cases[i] = visitor(c).(*Case)\n\t\t}\n\t\tif n.Default != nil {\n\t\t\tn.Default = visitor(n.Default).(*Block)\n\t\t}\n\tcase Uint8Value:\n\tcase Uint16Value:\n\tcase Uint32Value:\n\tcase Uint64Value:\n\tcase *Unknown:\n\tcase *Clone:\n\t\tn.Slice = visitor(n.Slice).(Expression)\n\tcase *Copy:\n\t\tn.Src = visitor(n.Src).(Expression)\n\t\tn.Dst = visitor(n.Dst).(Expression)\n\tcase *Create:\n\t\tn.Type = visitor(n.Type).(*Reference)\n\t\tn.Initializer = visitor(n.Initializer).(*ClassInitializer)\n\tcase *Ignore:\n\tcase *Make:\n\t\tn.Type = visitor(n.Type).(*Slice)\n\t\tn.Size = visitor(n.Size).(Expression)\n\tcase Null:\n\tcase *PointerRange:\n\t\tn.Pointer = visitor(n.Pointer).(Expression)\n\t\tn.Range = visitor(n.Range).(*BinaryOp)\n\tcase *Read:\n\t\tn.Slice = visitor(n.Slice).(Expression)\n\tcase *SliceContains:\n\t\tn.Value = visitor(n.Value).(Expression)\n\t\tn.Slice = visitor(n.Slice).(Expression)\n\tcase *SliceRange:\n\t\tn.Slice = visitor(n.Slice).(Expression)\n\t\tn.Range = visitor(n.Range).(*BinaryOp)\n\tcase *Write:\n\t\tn.Slice = visitor(n.Slice).(Expression)\n\tdefault:\n\t\tpanic(fmt.Errorf(\"Unsupported semantic node type %T\", n))\n\t}\n}", "func (h *MapInt16ToInt) Visit(fn func(int16, int)) {\n\tfor _, e := range h.slots {\n\t\tfor ; e != nil; e = e.next {\n\t\t\tfn(e.k, e.v)\n\t\t}\n\t}\n}", "func FuncInterfaceCompatible(_ T1) {}", "func (b *Binary) Accept(v Visitor) {\n\tv.VisitBinary(b)\n}", "func (s *InterfaceStep) Interface() interface{} {\n\treturn s.value\n}", "func (h *MapInt16ToInt8) Visit(fn func(int16, int8)) {\n\tfor _, e := range h.slots {\n\t\tfor ; e != nil; e = e.next {\n\t\t\tfn(e.k, e.v)\n\t\t}\n\t}\n}", "func (s *Sequenced) Accept(v Visitor) {\n\tv.VisitSequenced(s)\n}", "func testVisitors(methodCalled *string) (*SimpleVisitor, []*SimpleVisitor) {\n\tv := &SimpleVisitor{\n\t\tDoVisitEnumNode: func(*EnumNode) error {\n\t\t\t*methodCalled = \"*EnumNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitEnumValueNode: func(*EnumValueNode) error {\n\t\t\t*methodCalled = \"*EnumValueNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitFieldDeclNode: func(FieldDeclNode) error {\n\t\t\t*methodCalled = \"FieldDeclNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitFieldNode: func(*FieldNode) error {\n\t\t\t*methodCalled = \"*FieldNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitGroupNode: func(*GroupNode) error {\n\t\t\t*methodCalled = \"*GroupNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitOneofNode: func(*OneofNode) error {\n\t\t\t*methodCalled = \"*OneofNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitMapTypeNode: func(*MapTypeNode) error {\n\t\t\t*methodCalled = \"*MapTypeNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitMapFieldNode: func(*MapFieldNode) error {\n\t\t\t*methodCalled = \"*MapFieldNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitFileNode: func(*FileNode) error {\n\t\t\t*methodCalled = \"*FileNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitSyntaxNode: func(*SyntaxNode) error {\n\t\t\t*methodCalled = \"*SyntaxNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitImportNode: func(*ImportNode) error {\n\t\t\t*methodCalled = \"*ImportNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitPackageNode: func(*PackageNode) error {\n\t\t\t*methodCalled = \"*PackageNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitIdentValueNode: func(IdentValueNode) error {\n\t\t\t*methodCalled = \"IdentValueNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitIdentNode: func(*IdentNode) error {\n\t\t\t*methodCalled = \"*IdentNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitCompoundIdentNode: func(*CompoundIdentNode) error {\n\t\t\t*methodCalled = \"*CompoundIdentNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitKeywordNode: func(*KeywordNode) error {\n\t\t\t*methodCalled = \"*KeywordNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitMessageDeclNode: func(MessageDeclNode) error {\n\t\t\t*methodCalled = \"MessageDeclNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitMessageNode: func(*MessageNode) error {\n\t\t\t*methodCalled = \"*MessageNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitExtendNode: func(*ExtendNode) error {\n\t\t\t*methodCalled = \"*ExtendNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitNode: func(Node) error {\n\t\t\t*methodCalled = \"Node\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitTerminalNode: func(TerminalNode) error {\n\t\t\t*methodCalled = \"TerminalNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitCompositeNode: func(CompositeNode) error {\n\t\t\t*methodCalled = \"CompositeNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitRuneNode: func(*RuneNode) error {\n\t\t\t*methodCalled = \"*RuneNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitEmptyDeclNode: func(*EmptyDeclNode) error {\n\t\t\t*methodCalled = \"*EmptyDeclNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitOptionNode: func(*OptionNode) error {\n\t\t\t*methodCalled = \"*OptionNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitOptionNameNode: func(*OptionNameNode) error {\n\t\t\t*methodCalled = \"*OptionNameNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitFieldReferenceNode: func(*FieldReferenceNode) error {\n\t\t\t*methodCalled = \"*FieldReferenceNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitCompactOptionsNode: func(*CompactOptionsNode) error {\n\t\t\t*methodCalled = \"*CompactOptionsNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitExtensionRangeNode: func(*ExtensionRangeNode) error {\n\t\t\t*methodCalled = \"*ExtensionRangeNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitRangeNode: func(*RangeNode) error {\n\t\t\t*methodCalled = \"*RangeNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitReservedNode: func(*ReservedNode) error {\n\t\t\t*methodCalled = \"*ReservedNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitServiceNode: func(*ServiceNode) error {\n\t\t\t*methodCalled = \"*ServiceNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitRPCNode: func(*RPCNode) error {\n\t\t\t*methodCalled = \"*RPCNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitRPCTypeNode: func(*RPCTypeNode) error {\n\t\t\t*methodCalled = \"*RPCTypeNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitValueNode: func(ValueNode) error {\n\t\t\t*methodCalled = \"ValueNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitStringValueNode: func(StringValueNode) error {\n\t\t\t*methodCalled = \"StringValueNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitStringLiteralNode: func(*StringLiteralNode) error {\n\t\t\t*methodCalled = \"*StringLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitCompoundStringLiteralNode: func(*CompoundStringLiteralNode) error {\n\t\t\t*methodCalled = \"*CompoundStringLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitIntValueNode: func(IntValueNode) error {\n\t\t\t*methodCalled = \"IntValueNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitUintLiteralNode: func(*UintLiteralNode) error {\n\t\t\t*methodCalled = \"*UintLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitPositiveUintLiteralNode: func(*PositiveUintLiteralNode) error {\n\t\t\t*methodCalled = \"*PositiveUintLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitNegativeIntLiteralNode: func(*NegativeIntLiteralNode) error {\n\t\t\t*methodCalled = \"*NegativeIntLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitFloatValueNode: func(FloatValueNode) error {\n\t\t\t*methodCalled = \"FloatValueNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitFloatLiteralNode: func(*FloatLiteralNode) error {\n\t\t\t*methodCalled = \"*FloatLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitSpecialFloatLiteralNode: func(*SpecialFloatLiteralNode) error {\n\t\t\t*methodCalled = \"*SpecialFloatLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitSignedFloatLiteralNode: func(*SignedFloatLiteralNode) error {\n\t\t\t*methodCalled = \"*SignedFloatLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitArrayLiteralNode: func(*ArrayLiteralNode) error {\n\t\t\t*methodCalled = \"*ArrayLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitMessageLiteralNode: func(*MessageLiteralNode) error {\n\t\t\t*methodCalled = \"*MessageLiteralNode\"\n\t\t\treturn nil\n\t\t},\n\t\tDoVisitMessageFieldNode: func(*MessageFieldNode) error {\n\t\t\t*methodCalled = \"*MessageFieldNode\"\n\t\t\treturn nil\n\t\t},\n\t}\n\tothers := []*SimpleVisitor{\n\t\t{\n\t\t\tDoVisitEnumNode: v.DoVisitEnumNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitEnumValueNode: v.DoVisitEnumValueNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitFieldDeclNode: v.DoVisitFieldDeclNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitFieldNode: v.DoVisitFieldNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitGroupNode: v.DoVisitGroupNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitOneofNode: v.DoVisitOneofNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitMapTypeNode: v.DoVisitMapTypeNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitMapFieldNode: v.DoVisitMapFieldNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitFileNode: v.DoVisitFileNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitSyntaxNode: v.DoVisitSyntaxNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitImportNode: v.DoVisitImportNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitPackageNode: v.DoVisitPackageNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitIdentValueNode: v.DoVisitIdentValueNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitIdentNode: v.DoVisitIdentNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitCompoundIdentNode: v.DoVisitCompoundIdentNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitKeywordNode: v.DoVisitKeywordNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitMessageDeclNode: v.DoVisitMessageDeclNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitMessageNode: v.DoVisitMessageNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitExtendNode: v.DoVisitExtendNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitNode: v.DoVisitNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitTerminalNode: v.DoVisitTerminalNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitCompositeNode: v.DoVisitCompositeNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitRuneNode: v.DoVisitRuneNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitEmptyDeclNode: v.DoVisitEmptyDeclNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitOptionNode: v.DoVisitOptionNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitOptionNameNode: v.DoVisitOptionNameNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitFieldReferenceNode: v.DoVisitFieldReferenceNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitCompactOptionsNode: v.DoVisitCompactOptionsNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitExtensionRangeNode: v.DoVisitExtensionRangeNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitRangeNode: v.DoVisitRangeNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitReservedNode: v.DoVisitReservedNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitServiceNode: v.DoVisitServiceNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitRPCNode: v.DoVisitRPCNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitRPCTypeNode: v.DoVisitRPCTypeNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitValueNode: v.DoVisitValueNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitStringValueNode: v.DoVisitStringValueNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitStringLiteralNode: v.DoVisitStringLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitCompoundStringLiteralNode: v.DoVisitCompoundStringLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitIntValueNode: v.DoVisitIntValueNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitUintLiteralNode: v.DoVisitUintLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitPositiveUintLiteralNode: v.DoVisitPositiveUintLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitNegativeIntLiteralNode: v.DoVisitNegativeIntLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitFloatValueNode: v.DoVisitFloatValueNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitFloatLiteralNode: v.DoVisitFloatLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitSpecialFloatLiteralNode: v.DoVisitSpecialFloatLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitSignedFloatLiteralNode: v.DoVisitSignedFloatLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitArrayLiteralNode: v.DoVisitArrayLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitMessageLiteralNode: v.DoVisitMessageLiteralNode,\n\t\t},\n\t\t{\n\t\t\tDoVisitMessageFieldNode: v.DoVisitMessageFieldNode,\n\t\t},\n\t}\n\treturn v, others\n}", "func _[T interface{ ~func(string) int }](f T) int {\n\treturn f(\"hello\")\n}", "func VisitedFunctions(prog *ssa.Program, packs []*ssa.Package, isOvl isOverloaded) (seen, usesGR map[*ssa.Function]bool) {\n\tvisit := visitor{\n\t\tprog: prog,\n\t\tpacks: packs, // new\n\t\tseen: make(map[*ssa.Function]bool),\n\t\tusesGR: make(map[*ssa.Function]bool),\n\t}\n\tvisit.program(isOvl)\n\t//fmt.Printf(\"DEBUG VisitedFunctions.usesGR %v\\n\", visit.usesGR)\n\t//fmt.Printf(\"DEBUG VisitedFunctions.seen %v\\n\", visit.seen)\n\treturn visit.seen, visit.usesGR\n}", "func (h *MapInt16ToInt32) Visit(fn func(int16, int32)) {\n\tfor _, e := range h.slots {\n\t\tfor ; e != nil; e = e.next {\n\t\t\tfn(e.k, e.v)\n\t\t}\n\t}\n}", "func (x *fastReflection_Evidence) Interface() protoreflect.ProtoMessage {\n\treturn (*Evidence)(x)\n}", "func (f *functionQuery) Evaluate(t iterator) interface{} {\n\treturn f.Func(f.Input, t)\n}", "func Visit(node Node, visitor func(node Node, next func() error) error) error {\n\tif reflect.ValueOf(node).IsNil() { // Workaround for Go's typed nil interfaces.\n\t\treturn nil\n\t}\n\treturn visitor(node, func() error {\n\t\tfor _, child := range node.children() {\n\t\t\tif err := Visit(child, visitor); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n}", "func (x *fastReflection_Output) Interface() protoreflect.ProtoMessage {\n\treturn (*Output)(x)\n}", "func (i I) I() I { return i }", "func (rf RendererFunc) Render(w io.Writer, v interface{}) error { return rf(w, v) }", "func (v Variable) Accept(interpreter *Interpreter) Object {\n\treturn interpreter.visitVariable(v)\n}", "func (*Base) Function(p ASTPass, node *ast.Function, ctx Context) {\n\tp.Parameters(p, &node.ParenLeftFodder, &node.Parameters, &node.ParenRightFodder, ctx)\n\tp.Visit(p, &node.Body, ctx)\n}", "func (t *FileTree) VisitorFn(fn func(file.Reference)) func(node.Node) {\n\treturn func(node node.Node) {\n\t\tfn(t.fileByPathID(node.ID()))\n\t}\n}", "func execNewInterface(_ int, p *gop.Context) {\n\targs := p.GetArgs(2)\n\tret := types.NewInterface(args[0].([]*types.Func), args[1].([]*types.Named))\n\tp.Ret(2, ret)\n}", "func (h *MapInt16ToUint8) Visit(fn func(int16, uint8)) {\n\tfor _, e := range h.slots {\n\t\tfor ; e != nil; e = e.next {\n\t\t\tfn(e.k, e.v)\n\t\t}\n\t}\n}", "func FuncInterfaceCompatible2(_ io.Writer) {}", "func (h *MapInt16ToInt16) Visit(fn func(int16, int16)) {\n\tfor _, e := range h.slots {\n\t\tfor ; e != nil; e = e.next {\n\t\t\tfn(e.k, e.v)\n\t\t}\n\t}\n}", "func Function(sig *CallSignature) Type {\n\treturn Type{functionImpl{sig: sig}}\n}", "func (mi *ModifierInvocation) Visit(ctx *parser.ModifierInvocationContext) {\n\tmi.Start = ctx.GetStart()\n\tmi.Stop = ctx.GetStop()\n\tmi.Identifier = ctx.Identifier().GetText()\n\n\tif ctx.ExpressionList() != nil {\n\t\texpList := ctx.ExpressionList().(*parser.ExpressionListContext)\n\n\t\tfor _, exprCtx := range expList.AllExpression() {\n\t\t\texpression := NewExpression()\n\t\t\texpression.Visit(exprCtx.(*parser.ExpressionContext))\n\n\t\t\tmi.Expressions = append(mi.Expressions, expression)\n\t\t}\n\t}\n}", "func (x *fastReflection_Input) Interface() protoreflect.ProtoMessage {\n\treturn (*Input)(x)\n}", "func (a Assign) Accept(interpreter *Interpreter) Object {\n\treturn interpreter.visitAssign(a)\n}", "func (h *MapInt16ToUint) Visit(fn func(int16, uint)) {\n\tfor _, e := range h.slots {\n\t\tfor ; e != nil; e = e.next {\n\t\t\tfn(e.k, e.v)\n\t\t}\n\t}\n}", "func (h *MapInt16ToUint32) Visit(fn func(int16, uint32)) {\n\tfor _, e := range h.slots {\n\t\tfor ; e != nil; e = e.next {\n\t\t\tfn(e.k, e.v)\n\t\t}\n\t}\n}", "func (_Contract *ContractCallerSession) InterfaceImplementer(node [32]byte, interfaceID [4]byte) (common.Address, error) {\n\treturn _Contract.Contract.InterfaceImplementer(&_Contract.CallOpts, node, interfaceID)\n}", "func (g Grouping) Accept(interpreter *Interpreter) Object {\n\treturn interpreter.visitGrouping(g)\n}", "func Interface(ifname string) func(*NetworkTap) error {\n\treturn func(filterdev *NetworkTap) error {\n\t\terr := filterdev.SetInterface(int(filterdev.device.Fd()), ifname)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n}", "func (f *FlagSet) Visit(fn func(*Flag)) {\n\tfor _, flag := range sortFlags(f.actual) {\n\t\tfn(flag)\n\t}\n}", "func (_Contract *ContractFilterer) FilterInterfaceChanged(opts *bind.FilterOpts, node [][32]byte, interfaceID [][4]byte) (*ContractInterfaceChangedIterator, error) {\n\n\tvar nodeRule []interface{}\n\tfor _, nodeItem := range node {\n\t\tnodeRule = append(nodeRule, nodeItem)\n\t}\n\tvar interfaceIDRule []interface{}\n\tfor _, interfaceIDItem := range interfaceID {\n\t\tinterfaceIDRule = append(interfaceIDRule, interfaceIDItem)\n\t}\n\n\tlogs, sub, err := _Contract.contract.FilterLogs(opts, \"InterfaceChanged\", nodeRule, interfaceIDRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ContractInterfaceChangedIterator{contract: _Contract.contract, event: \"InterfaceChanged\", logs: logs, sub: sub}, nil\n}", "func (f *FlagSet) Visit(fn func(*Flag)) {\n\tif len(f.actual) == 0 {\n\t\treturn\n\t}\n\n\tvar flags []*Flag\n\tif f.SortFlags {\n\t\tif len(f.actual) != len(f.sortedActual) {\n\t\t\tf.sortedActual = sortFlags(f.actual)\n\t\t}\n\t\tflags = f.sortedActual\n\t} else {\n\t\tflags = f.orderedActual\n\t}\n\n\tfor _, flag := range flags {\n\t\tfn(flag)\n\t}\n}", "func (x *fastReflection_EventRetire) Interface() protoreflect.ProtoMessage {\n\treturn (*EventRetire)(x)\n}", "func execmInterfaceMethod(_ int, p *gop.Context) {\n\targs := p.GetArgs(2)\n\tret := args[0].(*types.Interface).Method(args[1].(int))\n\tp.Ret(2, ret)\n}", "func (lambda PresenterFunc) Render(message interface{}) error {\n\treturn lambda(message)\n}", "func underlyingInterface(w v1alpha1.ExecutableWorkflow, node v1alpha1.ExecutableNode) (*core.TypedInterface, error) {\n\tiface := &core.TypedInterface{}\n\tif node.GetTaskID() != nil {\n\t\tt, err := w.GetTask(*node.GetTaskID())\n\t\tif err != nil {\n\t\t\t// Should never happen\n\t\t\treturn nil, err\n\t\t}\n\n\t\tiface.Outputs = t.CoreTask().GetInterface().Outputs\n\t} else if wfNode := node.GetWorkflowNode(); wfNode != nil {\n\t\tif wfRef := wfNode.GetSubWorkflowRef(); wfRef != nil {\n\t\t\tt := w.FindSubWorkflow(*wfRef)\n\t\t\tif t == nil {\n\t\t\t\t// Should never happen\n\t\t\t\treturn nil, errors.Errorf(errors.IllegalStateError, node.GetID(), \"Couldn't find subworkflow [%v].\", wfRef)\n\t\t\t}\n\n\t\t\tiface.Outputs = t.GetOutputs().VariableMap\n\t\t} else {\n\t\t\treturn nil, errors.Errorf(errors.IllegalStateError, node.GetID(), \"Unknown interface\")\n\t\t}\n\t} else if node.GetBranchNode() != nil {\n\t\tif ifBlock := node.GetBranchNode().GetIf(); ifBlock != nil && ifBlock.GetThenNode() != nil {\n\t\t\tbn, found := w.GetNode(*ifBlock.GetThenNode())\n\t\t\tif !found {\n\t\t\t\treturn nil, errors.Errorf(errors.IllegalStateError, node.GetID(), \"Couldn't find branch node [%v]\",\n\t\t\t\t\t*ifBlock.GetThenNode())\n\t\t\t}\n\n\t\t\treturn underlyingInterface(w, bn)\n\t\t}\n\n\t\treturn nil, errors.Errorf(errors.IllegalStateError, node.GetID(), \"Empty branch detected.\")\n\t} else {\n\t\treturn nil, errors.Errorf(errors.IllegalStateError, node.GetID(), \"Unknown interface.\")\n\t}\n\n\treturn iface, nil\n}" ]
[ "0.601801", "0.59070253", "0.59054166", "0.58446676", "0.58266926", "0.5802115", "0.57868934", "0.577937", "0.57069504", "0.56891", "0.56891", "0.5627799", "0.5535857", "0.5494115", "0.5471187", "0.5471187", "0.5465064", "0.5435572", "0.54174775", "0.54174775", "0.5403646", "0.5398771", "0.535826", "0.53455204", "0.5325374", "0.5281957", "0.52587587", "0.5246482", "0.52396625", "0.5171417", "0.51708597", "0.51699823", "0.5150497", "0.5102451", "0.5098949", "0.50967133", "0.50936455", "0.5027757", "0.5014371", "0.50071734", "0.49832156", "0.4978006", "0.49501696", "0.4947642", "0.49169374", "0.4905309", "0.4905309", "0.4886982", "0.48809353", "0.4865095", "0.48484156", "0.4842497", "0.48256105", "0.4806719", "0.47928524", "0.478826", "0.47633818", "0.47612065", "0.47563323", "0.4756313", "0.47518948", "0.47470203", "0.47409767", "0.47342384", "0.47334284", "0.47197035", "0.4717382", "0.46857443", "0.4679505", "0.46787944", "0.46590173", "0.46579817", "0.4657036", "0.4652146", "0.46448997", "0.46417892", "0.46409145", "0.46362963", "0.461541", "0.46128434", "0.46116787", "0.46064425", "0.46029806", "0.45986757", "0.45887613", "0.4581343", "0.45772165", "0.45628566", "0.4561018", "0.45593852", "0.4557327", "0.4549671", "0.45452303", "0.45387414", "0.45345315", "0.45330152", "0.45300865", "0.45288858", "0.45200968" ]
0.5820728
6
/ It returns a value type ARRAY.
func (this *ObjectValues) Type() value.Type { return value.ARRAY }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (v Value) Array() []Value {\n\tif v.Typ == '*' && !v.Null {\n\t\treturn v.ArrayV\n\t}\n\treturn nil\n}", "func (v Value) AsArray() []Value {\n\treturn v.iface.([]Value)\n}", "func ArrayValue(vals []Value) Value { return Value{Typ: '*', ArrayV: vals} }", "func (v *Value) Array() ([]Value, error) {\n\tif v.kind == kindArray {\n\t\treturn v.arrayContent, nil\n\t}\n\treturn nil, errors.New(\"JSON value is not an array\")\n}", "func (array Array) Values() []interface{} {\n\treturn array\n}", "func (value *Value) ArrayValue() []*Value {\n\tif value.valueType == Array {\n\t\treturn value.value.([]*Value)\n\t}\n\n\tpanic(fmt.Sprintf(\"requested array value but found %T type\", value.value))\n}", "func (v *ValueGetter) Array() (ss []string) {\n\treturn v.Strings()\n}", "func Array(vi interface{}) *ArrayValue {\n\tv := reflect.ValueOf(vi)\n\tif !v.IsValid() {\n\t\tpanic(fmt.Errorf(\"bun: Array(nil)\"))\n\t}\n\n\treturn &ArrayValue{\n\t\tv: v,\n\n\t\tappend: arrayAppender(v.Type()),\n\t\tscan: arrayScanner(v.Type()),\n\t}\n}", "func Array(value interface{}) dgo.Array {\n\tswitch value := value.(type) {\n\tcase dgo.Array:\n\t\treturn value.FrozenCopy().(dgo.Array)\n\tcase dgo.Iterable:\n\t\treturn arrayFromIterator(value.Len(), value.Each)\n\tcase []dgo.Value:\n\t\tarr := make([]dgo.Value, len(value))\n\t\tfor i := range value {\n\t\t\te := value[i]\n\t\t\tif f, ok := e.(dgo.Freezable); ok {\n\t\t\t\te = f.FrozenCopy()\n\t\t\t} else if e == nil {\n\t\t\t\te = Nil\n\t\t\t}\n\t\t\tarr[i] = e\n\t\t}\n\t\treturn &array{slice: arr, frozen: true}\n\tcase reflect.Value:\n\t\treturn ValueFromReflected(value).(dgo.Array)\n\tdefault:\n\t\treturn ValueFromReflected(reflect.ValueOf(value)).(dgo.Array)\n\t}\n}", "func Array(arr Arr) Val {\n\tif arr == nil {\n\t\treturn Val{t: bsontype.Null}\n\t}\n\treturn Val{t: bsontype.Array, primitive: arr}\n}", "func ArrayValue(a []Value) Value {\n\treturn Value{iface: a}\n}", "func (this *ObjectInnerValues) Type() value.Type { return value.ARRAY }", "func (v *JSONValue) Array() []*JSONValue {\n\tv.parseArray()\n\treturn v.valArray\n}", "func (data *Data) Array(s ...string) []interface{} {\n\treturn data.Interface(s...).([]interface{})\n}", "func ValueArrayOf(items ...Value) ValueArray {\n\t// ValueArrayOf() with no parameters will pass nil rather than a zero-length slice; logically we\n\t// still want it to create a non-nil array.\n\tif items == nil {\n\t\treturn ValueArray{emptyArray}\n\t}\n\treturn CopyValueArray(items)\n}", "func (e *Expect) Array(value []interface{}) *Array {\n\topChain := e.chain.enter(\"Array()\")\n\tdefer opChain.leave()\n\n\treturn newArray(opChain, value)\n}", "func Array(k string, v valf.ValueArray) Field {\n\treturn Field{Key: k, Value: valf.Array(v)}\n}", "func (this *ExDomain) Values_asSlice() []int {\n\treturn Keys_MapIntToBool(this.GetValues())\n}", "func Values(values []interface{}) dgo.Array {\n\treturn &array{slice: valueSlice(values, true), frozen: true}\n}", "func AsArray(dt DataType) *Array {\n\tswitch t := dt.(type) {\n\tcase *UserTypeExpr:\n\t\treturn AsArray(t.Type)\n\tcase *ResultTypeExpr:\n\t\treturn AsArray(t.Type)\n\tcase *Array:\n\t\treturn t\n\tdefault:\n\t\treturn nil\n\t}\n}", "func (i GinBindType) ValueSlice() []GinBindType {\n\treturn _GinBindTypeValues\n}", "func Array(dest interface{}) interface {\n\tsql.Scanner\n\tdriver.Valuer\n} {\n\tswitch dest := dest.(type) {\n\tcase *[]GraphId:\n\t\treturn (*graphIdArray)(dest)\n\tcase []GraphId:\n\t\treturn (*graphIdArray)(&dest)\n\n\tcase *[]BasicVertex:\n\t\treturn (*basicVertexArray)(dest)\n\n\tcase *[]BasicEdge:\n\t\treturn (*basicEdgeArray)(dest)\n\t}\n\n\treturn elementArray{dest}\n}", "func Array(args ...interface{}) []interface{} {\n\treturn []interface{}{args}\n}", "func (a GenericArray) Value() (driver.Value, error) {\n\tif a.A == nil {\n\t\treturn nil, nil\n\t}\n\n\trv := reflect.ValueOf(a.A)\n\n\tswitch rv.Kind() {\n\tcase reflect.Slice:\n\t\tif rv.IsNil() {\n\t\t\treturn nil, nil\n\t\t}\n\tcase reflect.Array:\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"pq: Unable to convert %T to array\", a.A)\n\t}\n\n\tif n := rv.Len(); n > 0 {\n\t\t// There will be at least two curly brackets, N bytes of values,\n\t\t// and N-1 bytes of delimiters.\n\t\tb := make([]byte, 0, 1+2*n)\n\n\t\tb, _, err := appendArray(b, rv, n)\n\t\treturn string(b), err\n\t}\n\n\treturn \"{}\", nil\n}", "func (l *ListaXTienda) GetArray() []XTiendas{\n\ta := make([]XTiendas, l.len)\n\ti := 0\n\tAux := l.Inicio\n\tfor Aux != nil{\n\t\ta[i] = Aux.Dato\n\t\ti++\n\t\tAux = Aux.Siguiente\n\t}\n\treturn a\n}", "func Array() *A {\n\treturn &A{}\n}", "func (v AnnotationValue) AsSlice() []AnnotationValue {\n\treturn v.Value.([]AnnotationValue)\n}", "func (c *Container) array() []uint16 {\n\tif c == nil {\n\t\tpanic(\"attempt to read a nil container's array\")\n\t}\n\tif roaringParanoia {\n\t\tif c.typeID != ContainerArray {\n\t\t\tpanic(\"attempt to read non-array's array\")\n\t\t}\n\t}\n\treturn (*[1 << 16]uint16)(unsafe.Pointer(c.pointer))[:c.len:c.cap]\n}", "func ToArray(\n\tvalue *model.Value,\n) (*model.Value, error) {\n\tswitch {\n\tcase value == nil:\n\t\treturn nil, errors.New(\"unable to coerce null to array\")\n\tcase value.Array != nil:\n\t\treturn value, nil\n\tcase value.Boolean != nil:\n\t\treturn nil, fmt.Errorf(\"unable to coerce boolean to array: %w\", errIncompatibleTypes)\n\tcase value.Dir != nil:\n\t\treturn nil, fmt.Errorf(\"unable to coerce dir to array: %w\", errIncompatibleTypes)\n\tcase value.File != nil:\n\t\tfileBytes, err := os.ReadFile(*value.File)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to coerce file to array: %w\", err)\n\t\t}\n\t\tvalueArray := new([]interface{})\n\t\terr = json.Unmarshal([]byte(fileBytes), valueArray)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to coerce file to array: %w\", err)\n\t\t}\n\t\treturn &model.Value{Array: valueArray}, nil\n\tcase value.Number != nil:\n\t\treturn nil, fmt.Errorf(\"unable to coerce number to array: %w\", errIncompatibleTypes)\n\tcase value.Socket != nil:\n\t\treturn nil, fmt.Errorf(\"unable to coerce socket to array: %w\", errIncompatibleTypes)\n\tcase value.String != nil:\n\t\tvalueArray := new([]interface{})\n\t\terr := json.Unmarshal([]byte(*value.String), valueArray)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to coerce string to array: %w\", err)\n\t\t}\n\t\treturn &model.Value{Array: valueArray}, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unable to coerce '%+v' to array\", value)\n\t}\n}", "func (v *Value) Slice() []interface{} {\n\tsize := (int)(C.value_array_size(v.value))\n\tval := make([]interface{}, size)\n\n\tC.value_array_reset(v.value)\n\n\tfor i := 0; i < size; i++ {\n\t\tt := &Value{value: C.value_array_next_get(v.value)}\n\n\t\tval[i] = t.Interface()\n\t\tt.Destroy()\n\t}\n\n\treturn val\n}", "func NewValueArray(array []Value) *ValueArray {\n\t// return &ValueArray{*NewListerValue(valueList(array))}\n\tres := ValueArray(array)\n\treturn &res\n}", "func (a AttributeValue) ArrayVal() AnyValueArray {\n\tarr := a.orig.GetArrayValue()\n\tif arr == nil {\n\t\treturn NewAnyValueArray()\n\t}\n\treturn newAnyValueArray(&arr.Values)\n}", "func (this *ObjectInnerPairs) Type() value.Type { return value.ARRAY }", "func (this *ObjectPairs) Type() value.Type { return value.ARRAY }", "func (this *ObjectPairs) Type() value.Type { return value.ARRAY }", "func (j *JSONElement) Array() []string {\n\tvalues := make([]string, 0)\n\tresults := j.Result.Array() //gjson.GetBytes(j.Response.Body, jpath).Array()\n\tfor _, result := range results {\n\t\tvalues = append(values, result.String())\n\t}\n\treturn values\n}", "func (s Section) ValueAsSlice(keyword string) []string {\n\t// TODO Implement Value\n\treturn nil\n}", "func (l *Lista) GetArray() []Tiendas{\n\ta := make([]Tiendas, l.len)\n\ti := 0\n\tAux := l.Inicio\n\tfor Aux != nil{\n\t\ta[i] = Aux.Dato\n\t\ti++\n\t\tAux = Aux.Siguiente\n\t}\n\treturn a\n}", "func (i GinJwtSignAlgorithm) ValueSlice() []GinJwtSignAlgorithm {\n\treturn _GinJwtSignAlgorithmValues\n}", "func (list *ArrayList) Values() []interface{} {\n\tnewE := make([]interface{}, list.size, list.size)\n\tcopy(newE, list.elements[:list.size])\n\treturn newE\n}", "func (a *ArrayObject) Value() interface{} {\n\treturn a.Elements\n}", "func NewArray(values []*Value) *Value {\n\treturn &Value{values, Array}\n}", "func sliceToScalarArray(v []any) (*gnmipb.ScalarArray, error) {\n\tarr := &gnmipb.ScalarArray{}\n\tfor _, e := range v {\n\t\ttv, err := value.FromScalar(e)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tarr.Element = append(arr.Element, tv)\n\t}\n\treturn arr, nil\n}", "func (s *stack) ToArray() (arr []interface{}) {\n\tarr = make([]interface{}, s.length)\n\tnode := s.top\n\tfor index := s.length - 1; index >= 0; index-- {\n\t\tarr[index] = node.value\n\t\tnode = node.prev\n\t}\n\treturn\n}", "func (s *Store) Values() []interface{} {\n\ts.access.RLock()\n\tdefer s.access.RUnlock()\n\n\tcpy := make([]interface{}, len(s.data))\n\ti := 0\n\tfor _, value := range s.data {\n\t\tcpy[i] = value\n\t\ti++\n\t}\n\treturn cpy\n}", "func ArrayValue(v Value) (*Array, bool) {\n\tif v.Type() != ArrayType {\n\t\treturn nil, false\n\t}\n\tval, ok := v.(*Array)\n\treturn val, ok\n}", "func Valueize(values ...reflect.Value) []reflect.Value {\n\treturn values\n}", "func ArrayValueFromArray(value []interface{}, dataType DataType) (interface{}, error) {\n\tarrValue := NewArrayValue(dataType)\n\tfor _, item := range value {\n\t\tif item == nil {\n\t\t\tarrValue.AddItem(nil)\n\t\t} else {\n\t\t\tif s, ok := item.(string); ok && len(s) == 0 {\n\t\t\t\tarrValue.AddItem(nil)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tval, err := ConvertValueForType(dataType, item)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tarrValue.AddItem(val)\n\t\t}\n\t}\n\treturn arrValue, nil\n}", "func NewArray() *Value {\n\t// TODO: think about size and capacity defaults\n\treturn &Value{kind: kindArray, arrayContent: make([]Value, 0)}\n}", "func (this *ObjectNames) Type() value.Type { return value.ARRAY }", "func (this *ObjectNames) Type() value.Type { return value.ARRAY }", "func (m *Value) Values() []xmlrpc.Value { return m.ValuesMock() }", "func (r *Ring) Values() []interface{} {\n\tif r.head == -1 {\n\t\treturn []interface{}{}\n\t}\n\tarr := make([]interface{}, 0, r.Capacity())\n\tfor i := 0; i < r.Capacity(); i++ {\n\t\tidx := r.mod(i + r.tail)\n\t\tarr = append(arr, r.get(idx))\n\t\tif idx == r.head {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn arr\n}", "func ConvertToArrayValue(dataType DataType, value interface{}) (interface{}, error) {\n\tswitch v := value.(type) {\n\tcase []interface{}:\n\t\treturn ArrayValueFromArray(v, GetElementDataType(dataType))\n\tcase string:\n\t\treturn ArrayValueFromString(v, GetElementDataType(dataType))\n\t}\n\treturn nil, errors.New(fmt.Sprintf(\"unknown data type %T\", value))\n}", "func (r *Decoder) Array() []byte {\n\tlength := r.VarInt()\n\tdata := r.Bytes(int(length))\n\treturn data\n}", "func Array(slice []interface{}, buf []byte) ([]byte, error) {\n\tvar comma bool\n\tbuf = append(buf, '[')\n\tvar err error\n\tfor i := 0; i < len(slice); i++ {\n\t\tif comma {\n\t\t\tbuf = append(buf, ',')\n\t\t}\n\t\tcomma = true\n\t\tbuf, err = Value(slice[i], buf)\n\t\tif err != nil {\n\t\t\treturn buf, err\n\t\t}\n\t}\n\treturn append(buf, ']'), nil\n}", "func (bst *BST) ToArray() []interface{} {\n\tvar result = make([]interface{}, 0)\n\tbst.Traverse(func(n *Node) bool {\n\t\tresult = append(result, n.Key)\n\t\treturn true\n\t})\n\n\treturn result\n}", "func (f *StringSlice) Value() []string {\n\treturn *f\n}", "func (i SNSPlatformApplicationAttribute) ValueSlice() []SNSPlatformApplicationAttribute {\n\treturn _SNSPlatformApplicationAttributeValues\n}", "func (b *Buffer) Values() interface{} {\n return b.buffer.Slice(0, b.idx).Interface()\n}", "func (f *Int64Slice) Value() []int64 {\n\treturn *f\n}", "func (j *JSONData) Array(path ...interface{}) ([]interface{}, error) {\n\tjson, err := j.get(path...)\n\treturn json.MustArray(), err\n}", "func (i SNSProtocol) ValueSlice() []SNSProtocol {\n\treturn _SNSProtocolValues\n}", "func (m *DomainCollectionResponse) GetValue()([]Domainable) {\n return m.value\n}", "func (ao *Array) Type() ObjectType { return ARRAY_OBJ }", "func (m *ApplicationCollectionResponse) GetValue()([]Applicationable) {\n return m.value\n}", "func (e ValuesResultArrayHashEntry) Value() calculation.ResultArray {\n\treturn e.value\n}", "func typeToArray(args ...DataType) (DataType, error) {\n\tif len(args) != 1 {\n\t\treturn nil, fmt.Errorf(\"Type.toArray expects exactly 1 argument\")\n\t}\n\n\tswitch object := args[0].(type) {\n\tcase *StringType:\n\t\tresult := []DataType{}\n\t\tfor _, k := range object.Value {\n\t\t\tresult = append(result, &StringType{Value: string(k)})\n\t\t}\n\n\t\treturn &ArrayType{Elements: result}, nil\n\tcase *IntegerType, *FloatType:\n\t\treturn &ArrayType{Elements: []DataType{object}}, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Type.toArray can't convert '%s' to Array\", object.Type())\n\t}\n}", "func (mat *T) Array() *[9]float64 {\n\treturn &[...]float64{\n\t\tmat[0][0], mat[0][1], mat[0][2],\n\t\tmat[1][0], mat[1][1], mat[1][2],\n\t\tmat[2][0], mat[2][1], mat[2][2],\n\t}\n}", "func (d *decoder) array(childKey string, value reflect.Value) error {\n\tglobal := d.getGlobalProvider()\n\tar := global.Get(childKey)\n\ta := ar.Value()\n\tav := reflect.ValueOf(a)\n\tif err := checkCollections(av.Kind(), value.Kind()); err != nil && ar.Value() != nil {\n\t\treturn err\n\t}\n\n\tvalueType := value.Type()\n\n\t// start looking for child values.\n\telementType := derefType(valueType).Elem()\n\tchildKey = addSeparator(childKey)\n\n\tfor ai := 0; ai < value.Len(); ai++ {\n\t\tarrayKey := childKey + strconv.Itoa(ai)\n\n\t\t// Iterate until we find first missing value.\n\t\tif v2 := global.Get(arrayKey); v2.Value() != nil {\n\t\t\tif err := checkCollections(reflect.TypeOf(v2.value).Kind(), elementType.Kind()); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tval := reflect.New(elementType).Elem()\n\n\t\t\t// Unmarshal current element.\n\t\t\tif err := d.unmarshal(arrayKey, val, \"\"); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvalue.Index(ai).Set(val)\n\t\t} else if value.Index(ai).Kind() == reflect.Struct {\n\t\t\tif err := d.valueStruct(arrayKey, value.Index(ai).Addr().Interface()); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (a ValueArray) AsValue() Value {\n\tif a.data == nil {\n\t\treturn Null()\n\t}\n\treturn Value{valueType: ArrayType, arrayValue: a}\n}", "func (l *ListaPro) GetArray() []Producto{\n\ta := make([]Producto, l.len)\n\ti := 0\n\tAux := l.Inicio\n\tfor Aux != nil{\n\t\ta[i] = Aux.Dato\n\t\ti++\n\t\tAux = Aux.Siguiente\n\t}\n\treturn a\n}", "func (pb *PageBuffer) Values() interface{} {\n offset := pb.pageOffset(pb.page_no)\n return pb.buffer.Slice(offset, offset + pb.idx).Interface()\n}", "func (m *OpenTypeExtensionCollectionResponse) GetValue()([]OpenTypeExtensionable) {\n return m.value\n}", "func (s *Slice) Value() Type {\n\treturn s.basic\n}", "func (i SNSSubscribeAttribute) ValueSlice() []SNSSubscribeAttribute {\n\treturn _SNSSubscribeAttributeValues\n}", "func (a IntArray) Value() (driver.Value, error) {\n\tvar strs []string\n\tfor _, i := range a {\n\t\tstrs = append(strs, strconv.FormatInt(int64(i), 10))\n\t}\n\treturn \"{\" + strings.Join(strs, \",\") + \"}\", nil\n}", "func (ki *KernelInfo) ToArray() [][]float64 {\n\tvar values [][]float64\n\n\tcount := 0\n\tcValues := (*[1 << 10]C.double)(unsafe.Pointer(ki.info.values))\n\n\tfor y := C.size_t(0); y < ki.info.height; y++ {\n\t\trowValues := make([]float64, ki.info.width)\n\t\tfor x := C.size_t(0); x < ki.info.width; x++ {\n\t\t\trowValues[x] = float64(cValues[count])\n\t\t\tcount++\n\t\t}\n\t\tvalues = append(values, rowValues)\n\t}\n\n\truntime.KeepAlive(ki)\n\treturn values\n}", "func (nData *NaiveData) Value() []gotypes.Value {\n\treturn nData.Val\n}", "func (_ Always) Values() []int {\n\tvar answer []int\n\treturn answer\n}", "func Values(v interface{}) []interface{} {\n\treturn New(v).Values()\n}", "func toValueSlice(slice reflect.Value) []reflect.Value {\n\tsliceCopy := reflect.MakeSlice(slice.Type(), slice.Len(), slice.Len())\n\treflect.Copy(sliceCopy, slice)\n\tvalues := make([]reflect.Value, sliceCopy.Len())\n\tfor i := 0; i < sliceCopy.Len(); i++ {\n\t\tvalues[i] = sliceCopy.Index(i)\n\t}\n\treturn values\n}", "func (q *PriorityQueue) Values() []interface{} {\n\tsize := q.data.Size()\n\tvalues := q.data.Values()\n\tres := make([]interface{}, size)\n\tfor i := 0; i < size; i++ {\n\t\tres[i] = values[i].(*pqItem).value\n\t}\n\treturn res\n}", "func (c *AdapterMemory) Values(ctx context.Context) ([]interface{}, error) {\n\treturn c.data.Values()\n}", "func (a ArrayVal) ToSlice() []any {\n\tarr := make([]any, len(a))\n\tfor i, elem := range a {\n\t\tswitch actual := elem.(type) {\n\t\tcase ArrayVal:\n\t\t\tarr[i] = actual.ToSlice()\n\t\tcase MapVal:\n\t\t\tarr[i] = actual.ToMap()\n\t\tdefault:\n\t\t\tarr[i] = actual\n\t\t}\n\t}\n\treturn arr\n}", "func arrayOf(\n\tref ast.ResolvableTypeReference, bounds []int32,\n) (ast.ResolvableTypeReference, error) {\n\t// If the reference is a statically known type, then return an array type,\n\t// rather than an array type reference.\n\tif typ, ok := ast.GetStaticallyKnownType(ref); ok {\n\t\tif err := types.CheckArrayElementType(typ); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn types.MakeArray(typ), nil\n\t}\n\treturn &ast.ArrayTypeReference{ElementType: ref}, nil\n}", "func (m *IdentitySetCollectionResponse) GetValue()([]IdentitySetable) {\n val, err := m.GetBackingStore().Get(\"value\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]IdentitySetable)\n }\n return nil\n}", "func (c *ColDecimal256) Array() *ColArr[Decimal256] {\n\treturn &ColArr[Decimal256]{\n\t\tData: c,\n\t}\n}", "func (s SExp) Value() []Value {\n\treturn s.values\n}", "func (ArrayJobDependency) Values() []ArrayJobDependency {\n\treturn []ArrayJobDependency{\n\t\t\"N_TO_N\",\n\t\t\"SEQUENTIAL\",\n\t}\n}", "func (d *adapterMemoryData) Values() ([]interface{}, error) {\n\td.mu.RLock()\n\tvar (\n\t\tindex = 0\n\t\tvalues = make([]interface{}, len(d.data))\n\t)\n\tfor _, v := range d.data {\n\t\tif !v.IsExpired() {\n\t\t\tvalues[index] = v.v\n\t\t\tindex++\n\t\t}\n\t}\n\td.mu.RUnlock()\n\treturn values, nil\n}", "func (nvp *NameValues) ToInterfaceArray() []interface{} {\n\treturn NameValuesToInterfaceArray(*nvp)\n}", "func (c *Capture) Values() []interface{} {\n\tret := make([]interface{}, 8)\n\n\tret[0] = c.Timestamp\n\tret[1] = c.ColIP.String()\n\tret[2] = c.PeerIP.String()\n\tret[3] = pq.Array(c.ASPath)\n\tret[4] = c.NextHop.String()\n\tret[5] = c.Origin\n\n\tadvArr := util.PrefixesToPQArray(c.Advertised)\n\twdrArr := util.PrefixesToPQArray(c.Withdrawn)\n\tret[6] = advArr\n\tret[7] = wdrArr\n\n\treturn ret\n}", "func (c *ColDecimal64) Array() *ColArr[Decimal64] {\n\treturn &ColArr[Decimal64]{\n\t\tData: c,\n\t}\n}", "func ToArray(head *Node) (ret []int) {\n\tfor head != nil {\n\t\tret = append(ret, head.Val)\n\t\thead = head.Next\n\t}\n\treturn\n}", "func (c *ColDecimal32) Array() *ColArr[Decimal32] {\n\treturn &ColArr[Decimal32]{\n\t\tData: c,\n\t}\n}", "func AsSlice(v interface{}) []interface{} {\n\tif v == nil {\n\t\treturn []interface{}{}\n\t}\n\tr := AsValueRef(reflect.ValueOf(v))\n\tswitch r.Kind() {\n\tcase reflect.Slice, reflect.Array:\n\t\tres := make([]interface{}, r.Len())\n\t\tfor i := 0; i < r.Len(); i++ {\n\t\t\tres[i] = r.Index(i).Interface()\n\t\t}\n\t\treturn res\n\tcase reflect.Map:\n\t\tres := make([]interface{}, r.Len())\n\t\tfor i, k := range r.MapKeys() {\n\t\t\tres[i] = k.Interface()\n\t\t}\n\t\treturn res\n\tcase reflect.Struct:\n\t\tt := r.Type()\n\t\tres := make([]string, t.NumField())\n\t\tfor i := 0; i < t.NumField(); i++ {\n\t\t\tres[i] = t.Field(i).Name\n\t\t}\n\t}\n\treturn []interface{}{v}\n}", "func (d *Document) Array() Node {\n\tid := uint(len(d.nodes))\n\tn := d.grow()\n\tn.reset(vArray|infRoot, \"\", n.values[:0])\n\treturn d.Node(id)\n}", "func ValueArrayBuild() *ValueArrayBuilder {\n\treturn &ValueArrayBuilder{}\n}" ]
[ "0.7823361", "0.75855696", "0.74754494", "0.7281895", "0.7198584", "0.7157273", "0.7126476", "0.71061283", "0.7052501", "0.7034025", "0.7030175", "0.6983035", "0.68611586", "0.68397593", "0.6761906", "0.6658249", "0.6644863", "0.6622976", "0.66021454", "0.65110886", "0.6502923", "0.6497482", "0.64917517", "0.6440682", "0.6399739", "0.6383279", "0.6332408", "0.63267523", "0.6321993", "0.631796", "0.63142866", "0.630334", "0.62999636", "0.6274134", "0.6274134", "0.6259917", "0.6224701", "0.6208194", "0.6193965", "0.61874926", "0.6184298", "0.6181131", "0.61556363", "0.61488765", "0.6112015", "0.6106167", "0.6104074", "0.60886115", "0.6086518", "0.60708594", "0.60708594", "0.605923", "0.60546684", "0.60543704", "0.6044528", "0.6023555", "0.6006845", "0.5990869", "0.5989655", "0.5987084", "0.5986677", "0.5984226", "0.5976743", "0.5971418", "0.59704506", "0.5954092", "0.5942297", "0.59413683", "0.59379107", "0.59246665", "0.5908588", "0.59060395", "0.5875078", "0.58720607", "0.58556575", "0.5845624", "0.5845134", "0.5833531", "0.58241516", "0.5812028", "0.5804738", "0.5801126", "0.5799075", "0.5798379", "0.5796714", "0.5794648", "0.5766882", "0.5766353", "0.5757353", "0.57561874", "0.5754581", "0.5737061", "0.57363284", "0.5734828", "0.57343984", "0.5733569", "0.57221633", "0.57125825", "0.57102686" ]
0.7129963
7
/ Calls the Eval method for unary functions and passes in the receiver, current item and current context.
func (this *ObjectValues) Evaluate(item value.Value, context Context) (value.Value, error) { return this.UnaryEval(this, item, context) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (fn NoArgFunc) Eval(ctx *Context, r Row) (interface{}, error) {\n\treturn fn.Logic(ctx, r)\n}", "func (bp *BinaryPlus) Eval() float64 {\n\treturn bp.left.(Eval).Eval() + bp.right.(Eval).Eval()\n}", "func (ast *Unary) Eval(env *Env, ctx *Codegen, gen *ssa.Generator) (\n\tssa.Value, bool, error) {\n\texpr, ok, err := ast.Expr.Eval(env, ctx, gen)\n\tif err != nil || !ok {\n\t\treturn ssa.Undefined, ok, err\n\t}\n\tswitch val := expr.ConstValue.(type) {\n\tcase bool:\n\t\tswitch ast.Type {\n\t\tcase UnaryNot:\n\t\t\treturn gen.Constant(!val, types.Bool), true, nil\n\t\tdefault:\n\t\t\treturn ssa.Undefined, false, ctx.Errorf(ast.Expr,\n\t\t\t\t\"invalid unary expression: %s%T\", ast.Type, val)\n\t\t}\n\tcase int32:\n\t\tswitch ast.Type {\n\t\tcase UnaryMinus:\n\t\t\treturn gen.Constant(-val, types.Int32), true, nil\n\t\tdefault:\n\t\t\treturn ssa.Undefined, false, ctx.Errorf(ast.Expr,\n\t\t\t\t\"Unary.Eval: '%s%T' not implemented yet\", ast.Type, val)\n\t\t}\n\tdefault:\n\t\treturn ssa.Undefined, false, ctx.Errorf(ast.Expr,\n\t\t\t\"invalid value %s%T\", ast.Type, val)\n\t}\n}", "func Eval(ctx context.Context, e Expr, vs Values) (interface{}, error) {\r\n\tfn, err := FuncOf(ctx, e, vs)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\treturn fn.Call(ctx, vs)\r\n}", "func (f *function) Eval(a *Apl) (Value, error) {\n\tvar err error\n\tvar l, r Value\n\n\t// The right argument must be evaluated first.\n\t// Otherwise this A←1⋄A+(A←2) evaluates to 3,\n\t// but it should evaluate to 4.\n\tr, err = f.right.Eval(a)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif f.left != nil {\n\n\t\t// Special case for modified assignments.\n\t\t// Defer evaluation of the left argument.\n\t\tif d, ok := f.Function.(*derived); ok && d.op == \"←\" {\n\t\t\tl = assignment{f.left}\n\t\t} else {\n\t\t\tl, err = f.left.Eval(a)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Special case: the last function in a selective assignment uses Select instead of Call.\n\tif _, ok := f.right.(numVar); ok && f.selection {\n\t\tif d, ok := f.Function.(*derived); ok == true {\n\t\t\treturn d.Select(a, l, r)\n\t\t} else if p, ok := f.Function.(Primitive); ok == false {\n\t\t\treturn nil, fmt.Errorf(\"cannot use %T in selective assignment\", f.Function)\n\t\t} else {\n\t\t\treturn p.Select(a, l, r)\n\t\t}\n\t}\n\treturn f.Function.Call(a, l, r)\n}", "func Eval(txApp *sysl.Application, assign Scope, e *sysl.Expr) *sysl.Value {\n\tswitch x := e.Expr.(type) {\n\tcase *sysl.Expr_Transform_:\n\t\treturn evalTransform(txApp, assign, x, e)\n\tcase *sysl.Expr_Binexpr:\n\t\treturn evalBinExpr(txApp, assign, x.Binexpr)\n\tcase *sysl.Expr_Call_:\n\t\treturn evalCall(txApp, assign, x)\n\tcase *sysl.Expr_Name:\n\t\treturn evalName(assign, x)\n\tcase *sysl.Expr_GetAttr_:\n\t\treturn evalGetAttr(txApp, assign, x)\n\tcase *sysl.Expr_Ifelse:\n\t\treturn evalIfelse(txApp, assign, x)\n\tcase *sysl.Expr_Literal:\n\t\treturn x.Literal\n\tcase *sysl.Expr_Set:\n\t\treturn evalSet(txApp, assign, x)\n\tcase *sysl.Expr_List_:\n\t\treturn evalList(txApp, assign, x)\n\tcase *sysl.Expr_Unexpr:\n\t\treturn evalUnaryFunc(x.Unexpr.Op, Eval(txApp, assign, x.Unexpr.Arg))\n\tdefault:\n\t\tlogrus.Warnf(\"Skipping Expr of type %T\\n\", x)\n\t\treturn nil\n\t}\n}", "func (op *OpMinus) Eval(x, y float32) float32 {\n\treturn op.LeftChild.Eval(x, y) - op.RightChild.Eval(x, y)\n}", "func (op *OpPlus) Eval(x, y float32) float32 {\n\treturn op.LeftChild.Eval(x, y) + op.RightChild.Eval(x, y)\n}", "func (op *OpPlus) Eval(x, y float32) float32 {\n\treturn op.LeftChild.Eval(x, y) + op.RightChild.Eval(x, y)\n}", "func (e *Exp) Eval() float64 {\n\te.init()\n\tresult, _ := e.eval(e.opTree)\n\treturn result\n}", "func (f *FunctionLike) Eval(env types.Env) (types.Expr, error) {\n\treturn nil, fmt.Errorf(\"interpreterTypes.FunctionLike: cannot eval a function-like: %s\", f)\n}", "func (form *Form) Eval(scope Scope, args ...interface{}) interface{} {\n\treturn form.Fn(scope, args...)\n}", "func (op *OpX) Eval(x, y float32) float32 {\n\treturn x\n}", "func (op *OpX) Eval(x, y float32) float32 {\n\treturn x\n}", "func ExampleEval() {\n\tfmt.Println(Eval(\"5\"))\n\tfmt.Println(Eval(\"1 + 2\"))\n\tfmt.Println(Eval(\"1 - 2 + 3\"))\n\tfmt.Println(Eval(\"3 * ( 3 + 1 * 3 ) / 2\"))\n\tfmt.Println(Eval(\"3 * ( ( 3 + 1 ) * 3 ) / 2\"))\n\t//OutPut:\n\t//5\n\t//3\n\t//2\n\t//9\n\t//18\n}", "func (this *ObjectUnwrap) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (rt *invalidRuntime) Eval(vs parser.Scope, is map[string]interface{}, tid uint64) (interface{}, error) {\n\t_, err := rt.baseRuntime.Eval(vs, is, tid)\n\tif err == nil {\n\t\terr = rt.erp.NewRuntimeError(util.ErrInvalidConstruct, fmt.Sprintf(\"Unknown node: %s\", rt.node.Name), rt.node)\n\t}\n\treturn nil, err\n}", "func (this *Not) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (rt *voidRuntime) Eval(vs parser.Scope, is map[string]interface{}, tid uint64) (interface{}, error) {\n\treturn rt.baseRuntime.Eval(vs, is, tid)\n}", "func (le ListExpr) Eval(scope Scope) (interface{}, error) {\n\tif len(le.List) == 0 {\n\t\treturn le.List, nil\n\t}\n\n\tval, err := le.List[0].Eval(scope)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif macroFn, ok := val.(MacroFunc); ok {\n\t\tvar name string\n\t\tif sym, ok := le.List[0].(SymbolExpr); ok {\n\t\t\tname = sym.Symbol\n\t\t}\n\t\treturn macroFn(scope, name, le.List[1:])\n\t}\n\n\targs := []interface{}{}\n\tfor i := 1; i < len(le.List); i++ {\n\t\targ, err := le.List[i].Eval(scope)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\targs = append(args, arg)\n\t}\n\n\tif scopedFn, ok := val.(ScopedFunc); ok {\n\t\treturn scopedFn(scope, args...)\n\t}\n\n\treturn reflection.Call(val, args...)\n}", "func (o Nil) Eval(*Vm) (Object, error) { return o, nil }", "func Eval(node ast.Node, env *object.Environment, stop <-chan struct{}) object.Object {\n\tselect {\n\tcase <-stop:\n\t\treturn ConstNil\n\tdefault:\n\t}\n\n\tswitch node := node.(type) {\n\t// statements\n\tcase *ast.Program:\n\t\treturn evalProgram(node, env, stop)\n\tcase *ast.LetStatement:\n\t\tval := Eval(node.Value, env, stop)\n\t\tif isError(val) {\n\t\t\treturn val\n\t\t}\n\t\tenv.Set(node.Name.Value, val)\n\tcase *ast.ReturnStatement:\n\t\tval := Eval(node.Value, env, stop)\n\t\tif isError(val) {\n\t\t\treturn val\n\t\t}\n\t\treturn &object.ReturnValue{Value: val}\n\tcase *ast.BlockStatement:\n\t\treturn evalBlockStatement(node, env, stop)\n\tcase *ast.ExpressionStatement:\n\t\treturn Eval(node.Expression, env, stop)\n\n\t\t// expressions\n\tcase *ast.PrefixExpression:\n\t\tright := Eval(node.Right, env, stop)\n\t\tif isError(right) {\n\t\t\treturn right\n\t\t}\n\t\treturn evalPrefixExpr(node.Token, right)\n\tcase *ast.InfixExpression:\n\t\tif node.Operator == token.Assign {\n\t\t\treturn evalAssign(node, env, stop)\n\t\t}\n\n\t\tleft := Eval(node.Left, env, stop)\n\t\tif isError(left) {\n\t\t\treturn left\n\t\t}\n\t\tright := Eval(node.Right, env, stop)\n\t\tif isError(right) {\n\t\t\treturn right\n\t\t}\n\t\treturn evalInfixExpr(node.Token, left, right)\n\tcase *ast.IndexExpression:\n\t\tleft := Eval(node.Left, env, stop)\n\t\tif isError(left) {\n\t\t\treturn left\n\t\t}\n\n\t\tindex := Eval(node.Index, env, stop)\n\t\tif isError(index) {\n\t\t\treturn index\n\t\t}\n\t\treturn evalIndexExpr(node.Token, left, index)\n\tcase *ast.IfExpression:\n\t\treturn evalIfExpr(node, env, stop)\n\tcase *ast.WhileExpression:\n\t\treturn evalWhileExpr(node, env, stop)\n\tcase *ast.CallExpression:\n\t\tfunction := Eval(node.Func, env, stop)\n\t\tif isError(function) {\n\t\t\treturn function\n\t\t}\n\n\t\targs, err := evalExpressions(node.Args, env, stop)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn doFunction(node.Token, function, args, stop)\n\n\t\t// literals\n\tcase *ast.IntegerLiteral:\n\t\treturn &object.Integer{Value: node.Value}\n\tcase *ast.FloatLiteral:\n\t\treturn &object.Float{Value: node.Value}\n\tcase *ast.BooleanLiteral:\n\t\treturn boolToBoolean(node.Value)\n\tcase *ast.NilLiteral:\n\t\treturn ConstNil\n\tcase *ast.FunctionLiteral:\n\t\treturn &object.Function{Params: node.Params, Body: node.Body, Env: env}\n\tcase *ast.StringLiteral:\n\t\treturn &object.String{Value: node.Value}\n\tcase *ast.ArrayLiteral:\n\t\telems, err := evalExpressions(node.Elements, env, stop)\n\t\tif len(elems) == 1 && err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn &object.Array{Elements: elems}\n\tcase *ast.Identifier:\n\t\treturn evalIdentifier(node, env)\n\tcase *ast.AccessIdentifier:\n\t\treturn evalAccessIdentifier(node, env)\n\t}\n\treturn nil\n}", "func (inst *hiddenInstance) Eval(expr ast.Expr) Value {\n\tv := inst.Value()\n\treturn v.Context().BuildExpr(expr, Scope(v), InferBuiltins(true))\n}", "func (a *AddActivity) Eval(context activity.Context) (done bool, err error) {\n\n\t//mv := context.GetInput(ivMessage)\n\tnum1, _ := context.GetInput(ivNum1).(int)\n\tnum2, _ := context.GetInput(ivNum2).(int)\n\n\tactivityLog.Info(fmt.Sprintf(\"Num1: %d, Num2: %d\", num1, num2))\n\tactivityLog.Info(fmt.Sprintf(\"Addition is : %d\", num1+num2))\n\tcontext.SetOutput(ovAddition, num1+num2)\n\n\treturn true, nil\n}", "func (o Args) Eval(*Vm) (Object, error) { return o, nil }", "func (n *NotLikeOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tpanic(\"implement me\")\n}", "func eval(list []*Item) int {\n\n\tvar stack *Item\n\n\tfor _, node := range list {\n\n\t\tif node.Typ == Number {\n\t\t\tstack = stack.Push(node)\n\t\t\tcontinue\n\t\t}\n\n\t\tvar left, right *Item\n\n\t\tstack, right = stack.Pop()\n\t\tstack, left = stack.Pop()\n\n\t\tvar val int\n\t\tswitch node.Operation {\n\t\tcase \"+\":\n\t\t\tval = left.Value + right.Value\n\t\tcase \"-\":\n\t\t\tval = left.Value - right.Value\n\t\tcase \"/\":\n\t\t\t// Watch for div-by-zero\n\t\t\tval = left.Value / right.Value\n\t\tcase \"*\":\n\t\t\tval = left.Value * right.Value\n\t\t}\n\t\tstack = stack.Push(&Item{Typ: Number, Value: val})\n\t}\n\n\treturn stack.Value\n}", "func (e *BinExpr) Eval(ctx context.Context, local Scope) (_ Value, err error) {\n\ta, err := e.a.Eval(ctx, local)\n\tif err != nil {\n\t\treturn nil, WrapContextErr(err, e, local)\n\t}\n\n\tb, err := e.b.Eval(ctx, local)\n\tif err != nil {\n\t\treturn nil, WrapContextErr(err, e, local)\n\t}\n\tval, err := e.eval(ctx, a, b, local)\n\tif err != nil {\n\t\treturn nil, WrapContextErr(err, e, local)\n\t}\n\treturn val, nil\n}", "func (m *Message) Eval(vm *VM, locals Interface) (result Interface) {\n\treturn m.Send(vm, locals, locals)\n}", "func (p *Qlang) Eval(expr string) (err error) {\n\n\treturn p.Exec([]byte(expr), \"\")\n}", "func eval(sc *scope, e sexpr) sexpr {\n\te = transform(sc, e)\n\tswitch e := e.(type) {\n\tcase cons: // a function to evaluate\n\t\tcons := e\n\t\tcar := eval(sc, cons.car)\n\t\tif !isFunction(car) && !isPrimitive(car) {\n\t\t\tpanic(\"Attempted application on non-function\")\n\t\t}\n\t\tcdr := cons.cdr\n\t\targs := flatten(cdr)\n\t\tif isPrimitive(car) {\n\t\t\treturn (car.(primitive))(sc, args)\n\t\t}\n\t\tf := car.(function)\n\t\t// This is a function - evaluate all arguments\n\t\tfor i, a := range args {\n\t\t\targs[i] = eval(sc, a)\n\t\t}\n\t\treturn f(sc, args)\n\tcase sym:\n\t\treturn sc.lookup(e)\n\t}\n\treturn e\n}", "func (mr *MockExpressionNodeMockRecorder) Eval() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Eval\", reflect.TypeOf((*MockExpressionNode)(nil).Eval))\n}", "func (this *Self) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn item, nil\n}", "func (n *NotInOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tpanic(\"implement me\")\n}", "func (f *Function) Eval(inputs ...interface{}) (args.Const, error) {\n\tlenInputs := len(inputs)\n\tif lenInputs != f.numVars {\n\t\treturn nil, errors.New(\"Number of inputs is not equal to the number of variables in function\")\n\t}\n\n\tvar operand1 args.Const\n\tvar operand2 args.Const\n\tvar operandStack []args.Const\n\n\ti := 0\n\tfor i < len(f.Args) {\n\t\tif f.typeInput(i) == args.Constant || f.typeInput(i) == args.Variable {\n\t\t\tvariable, err := f.getVar(i)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif lenInputs != 0 {\n\t\t\t\toperand, err := variable.Eval(inputs[f.varNum[variable]])\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\toperandStack = append(operandStack, operand)\n\t\t\t} else {\n\t\t\t\t// If length inputs is 0, then all variables must be constant.\n\t\t\t\t// This code assumes variable is a constant and so uses 0 as an input\n\t\t\t\t// to MustEval as it will never fail as the input does not matter for constants\n\t\t\t\toperandStack = append(operandStack, variable.MustEval(0))\n\t\t\t}\n\t\t} else if f.typeInput(i) == args.Operation {\n\t\t\toperation, err := f.getOp(i)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif h, ok := unaryFuncs[operation]; ok {\n\t\t\t\tif len(operandStack) == 0 {\n\t\t\t\t\treturn nil, errors.New(\"Not enough operands\")\n\t\t\t\t}\n\n\t\t\t\toperand1, operandStack = operandStack[len(operandStack)-1], operandStack[:len(operandStack)-1]\n\t\t\t\tresult, err := h(operand1)\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\toperandStack = append(operandStack, result)\n\t\t\t} else if h, ok := binaryFuncs[operation]; ok {\n\t\t\t\tif len(operandStack) < 2 {\n\t\t\t\t\treturn nil, errors.New(\"Not enough operands\")\n\t\t\t\t}\n\n\t\t\t\toperand2, operandStack = operandStack[len(operandStack)-1], operandStack[:len(operandStack)-1]\n\t\t\t\toperand1, operandStack = operandStack[len(operandStack)-1], operandStack[:len(operandStack)-1]\n\t\t\t\tresult, err := h(operand1, operand2)\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\toperandStack = append(operandStack, result)\n\t\t\t} else {\n\t\t\t\treturn nil, errors.New(\"Operation not supported\")\n\t\t\t}\n\t\t}\n\t\ti++\n\t}\n\n\tif len(operandStack) > 1 {\n\t\treturn nil, errors.New(\"To many operands left over after calculation\")\n\t}\n\n\treturn operandStack[0], nil\n}", "func (op *OpSine) Eval(x, y float32) float32 {\n\treturn float32(math.Sin(float64(op.Child.Eval(x, y))))\n}", "func (b *Builder) Eval(desc string, f predicate.TransformFunc) *Builder {\n\tb.p.RegisterTransformation(impl.Eval(desc, f))\n\treturn b\n}", "func (e *Evaluator) Eval(expr string) (interface{}, error) {\n\tn := e.n.Copy()\n\t_expr, err := xpath.Compile(expr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"expr cannot compile: %w\", err)\n\t}\n\n\tv := _expr.Evaluate(n)\n\tswitch v := v.(type) {\n\tcase *xpath.NodeIterator:\n\t\tns := nodes(v)\n\t\tvs := make([]interface{}, 0, len(ns))\n\t\tfor i := range ns {\n\t\t\tswitch n := ns[i].(type) {\n\t\t\tcase attr:\n\t\t\t\tvs = append(vs, n.val)\n\t\t\t}\n\t\t}\n\t\tif len(vs) == len(ns) {\n\t\t\treturn vs, nil\n\t\t}\n\t\treturn ns, nil\n\t}\n\n\treturn v, nil\n}", "func (n *NotRegexpOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tpanic(\"implement me\")\n}", "func (rt *baseRuntime) Eval(vs parser.Scope, is map[string]interface{}, tid uint64) (interface{}, error) {\n\tvar err error\n\n\terrorutil.AssertTrue(rt.validated, \"Runtime component has not been validated - please call Validate() before Eval()\")\n\n\tif rt.erp.Debugger != nil {\n\t\terr = rt.erp.Debugger.VisitState(rt.node, vs, tid)\n\t\trt.erp.Debugger.SetLockingState(rt.erp.MutexeOwners, rt.erp.MutexLog)\n\t\trt.erp.Debugger.SetThreadPool(rt.erp.Processor.ThreadPool())\n\t}\n\n\treturn nil, err\n}", "func (s *Subtraction) Evaluate(left, right EvalResult) (EvalResult, error) {\n\treturn subtractNumericWithError(left, right)\n}", "func (c *Context) Eval(script string) (*Value, error) {\n\t// When PHP compiles code with a non-NULL return value expected, it simply\n\t// prepends a `return` call to the code, thus breaking simple scripts that\n\t// would otherwise work. Thus, we need to wrap the code in a closure, and\n\t// call it immediately.\n\ts := C.CString(\"call_user_func(function(){\" + script + \"});\")\n\tdefer C.free(unsafe.Pointer(s))\n\n\tvptr, err := C.context_eval(c.context, s)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error executing script '%s' in context\", script)\n\t}\n\n\tval, err := NewValueFromPtr(vptr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn val, nil\n}", "func (f *CallExpression) Evaluate(ctx *Context) Value {\n\tcallable := f.Callable.Evaluate(ctx)\n\n\tif callable.Type == vtVariable {\n\t\tcallable = callable.Evaluate(ctx)\n\t}\n\n\tif callable.isCallable() {\n\t\tnewCtx := NewContext(\"\", nil)\n\t\targs := f.Args.EvaluateAll(ctx)\n\t\treturn callable.callable().Execute(newCtx, &args)\n\t}\n\n\tpanic(NewNotCallableError(callable))\n}", "func (lscript *Scripting) Eval(luacmd string, arguments ...interface{}) (*ScriptingReturnValues, error) {\n\targs := asScriptingArgs(arguments...)\n\tlargs := forLua(args)\n\tfor _, larg := range largs {\n\t\tlscript.Push(larg)\n\t}\n\tvar r *ScriptingReturnValues\n\terr := lscript.DoString(luacmd)\n\tif err != nil {\n\t\tT().P(\"script\", \"lua\").Errorf(\"scripting error: %s\", err.Error())\n\t} else {\n\t\tif err == nil {\n\t\t\tT().P(\"lua\", \"eval\").Debugf(\"%d return values on the stack\", lscript.GetTop())\n\t\t\tr = lscript.returnFromScripting(lscript.GetTop()) // return all values on the stack\n\t\t}\n\t}\n\treturn r, err\n}", "func (e *binaryExprEvaluator) eval(lhs, rhs interface{}) interface{} {\n\tswitch e.op {\n\tcase ADD:\n\t\treturn lhs.(float64) + rhs.(float64)\n\tcase SUB:\n\t\treturn lhs.(float64) - rhs.(float64)\n\tcase MUL:\n\t\treturn lhs.(float64) * rhs.(float64)\n\tcase DIV:\n\t\trhs := rhs.(float64)\n\t\tif rhs == 0 {\n\t\t\treturn float64(0)\n\t\t}\n\t\treturn lhs.(float64) / rhs\n\tdefault:\n\t\t// TODO: Validate operation & data types.\n\t\tpanic(\"invalid operation: \" + e.op.String())\n\t}\n}", "func (p *Qlang) SafeEval(expr string) (err error) {\n\n\treturn p.SafeExec([]byte(expr), \"\")\n}", "func Eval(input string, context map[string]interface{}) float64 {\n\tnode, err := Parse(input)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\texpr := &expression{node, context}\n\treturn expr.eval(expr.ast)\n}", "func (op *OpAtan) Eval(x, y float32) float32 {\n\treturn float32(math.Atan(float64(op.Child.Eval(x, y))))\n}", "func (op *OpMult) Eval(x, y float32) float32 {\n\treturn op.LeftChild.Eval(x, y) * op.RightChild.Eval(x, y)\n}", "func (i *InOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tpanic(\"implement me\")\n}", "func prepareEvalInfixExp(opfStack, opftStack, opfdStack, argsStack *Stack) {\n\t// current token is function stop\n\tfor opftStack.Peek().(efp.Token) != opfStack.Peek().(efp.Token) {\n\t\t// calculate trigger\n\t\ttopOpt := opftStack.Peek().(efp.Token)\n\t\tif err := calculate(opfdStack, topOpt); err != nil {\n\t\t\targsStack.Peek().(*list.List).PushBack(newErrorFormulaArg(err.Error(), err.Error()))\n\t\t\topftStack.Pop()\n\t\t\tcontinue\n\t\t}\n\t\topftStack.Pop()\n\t}\n\targument := true\n\tif opftStack.Len() > 2 && opfdStack.Len() == 1 {\n\t\ttopOpt := opftStack.Pop()\n\t\tif opftStack.Peek().(efp.Token).TType == efp.TokenTypeOperatorInfix {\n\t\t\targument = false\n\t\t}\n\t\topftStack.Push(topOpt)\n\t}\n\t// push opfd to args\n\tif argument && opfdStack.Len() > 0 {\n\t\targsStack.Peek().(*list.List).PushBack(opfdStack.Pop().(formulaArg))\n\t}\n}", "func (e PackageExpr) Eval(_ rel.Scope) (rel.Value, error) {\n\treturn e.a.Eval(stdScope())\n}", "func (p *prog) Eval(input any) (v ref.Val, det *EvalDetails, err error) {\n\t// Configure error recovery for unexpected panics during evaluation. Note, the use of named\n\t// return values makes it possible to modify the error response during the recovery\n\t// function.\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tswitch t := r.(type) {\n\t\t\tcase interpreter.EvalCancelledError:\n\t\t\t\terr = t\n\t\t\tdefault:\n\t\t\t\terr = fmt.Errorf(\"internal error: %v\", r)\n\t\t\t}\n\t\t}\n\t}()\n\t// Build a hierarchical activation if there are default vars set.\n\tvar vars interpreter.Activation\n\tswitch v := input.(type) {\n\tcase interpreter.Activation:\n\t\tvars = v\n\tcase map[string]any:\n\t\tvars = activationPool.Setup(v)\n\t\tdefer activationPool.Put(vars)\n\tdefault:\n\t\treturn nil, nil, fmt.Errorf(\"invalid input, wanted Activation or map[string]any, got: (%T)%v\", input, input)\n\t}\n\tif p.defaultVars != nil {\n\t\tvars = interpreter.NewHierarchicalActivation(p.defaultVars, vars)\n\t}\n\tv = p.interpretable.Eval(vars)\n\t// The output of an internal Eval may have a value (`v`) that is a types.Err. This step\n\t// translates the CEL value to a Go error response. This interface does not quite match the\n\t// RPC signature which allows for multiple errors to be returned, but should be sufficient.\n\tif types.IsError(v) {\n\t\terr = v.(*types.Err)\n\t}\n\treturn\n}", "func (this *ObjectAdd) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.TernaryEval(this, item, context)\n}", "func (op *OpSin) Eval(x, y float32) float32 {\n\treturn float32(math.Sin(float64(op.Child.Eval(x, y))))\n}", "func (l *LikeOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tpanic(\"implement me\")\n}", "func (e *ExpressionAtom) Evaluate(dataContext IDataContext, memory *WorkingMemory) (reflect.Value, error) {\n\tif e.Evaluated == true {\n\t\treturn e.Value, nil\n\t}\n\tif e.Variable != nil {\n\t\tval, err := e.Variable.Evaluate(dataContext, memory)\n\t\tif err != nil {\n\t\t\treturn reflect.Value{}, err\n\t\t}\n\t\te.Value = val\n\t\te.Evaluated = true\n\t\treturn val, err\n\t}\n\tif e.FunctionCall != nil {\n\t\tvalueNode := dataContext.Get(\"DEFUNC\")\n\t\targs, err := e.FunctionCall.EvaluateArgumentList(dataContext, memory)\n\t\tif err != nil {\n\t\t\treturn reflect.Value{}, err\n\t\t}\n\t\tret, err := valueNode.CallFunction(e.FunctionCall.FunctionName, args...)\n\t\tif err != nil {\n\t\t\treturn reflect.Value{}, err\n\t\t}\n\t\te.Value = ret\n\t\te.Evaluated = true\n\t\treturn ret, err\n\t}\n\tpanic(\"should not be reached\")\n}", "func (this *ObjectRemove) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.BinaryEval(this, item, context)\n}", "func (s *ScriptReal) Eval(c Scripter, keys []string, args ...interface{}) *redis.Cmd {\n\treturn s.script.Eval(c, keys, args...)\n}", "func (this *ObjectInnerValues) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (p Primitive) Eval(a *Apl) (Value, error) {\n\treturn p, nil\n}", "func (this *Element) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.BinaryEval(this, item, context)\n}", "func (op *OpY) Eval(x, y float32) float32 {\n\treturn y\n}", "func (op *OpY) Eval(x, y float32) float32 {\n\treturn y\n}", "func (s *String) Eval(_, _ *Scope) (Value, error) {\n\treturn s, nil\n}", "func (ev *Evaler) Eval(name, text string, n *parse.Chunk, ports []*Port) error {\n\top, err := ev.Compile(n)\n\tif err != nil {\n\t\treturn err\n\t}\n\tec := NewTopEvalCtx(ev, name, text, ports)\n\treturn ec.PEval(op)\n}", "func TestEval(t *testing.T) {\n\tany := `.+`\n\ttestCases := []struct {\n\t\tname string\n\t\tquery string\n\t\twantErr string\n\t\twant []values.Value\n\t}{\n\t\t{\n\t\t\tname: \"string interpolation\",\n\t\t\tquery: `\n\t\t\t\tstr = \"str\"\n\t\t\t\ting = \"ing\"\n\t\t\t\t\"str + ing = ${str+ing}\"`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewString(\"str + ing = string\"),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"string interpolation missing field\",\n\t\t\tquery: `\n\t\t\t\tr = makeRecord(o: {a: \"foo\", b: 42})\n\t\t\t\t\"r._value = ${r._value}\"`,\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"string interpolation non-string type\",\n\t\t\tquery: `\n\t\t\t\tr = makeRecord(o: {a: \"foo\", b: 42})\n\t\t\t\t\"r._value = ${r.b}\"`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewString(\"r._value = 42\"),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"string interpolation wrong type\",\n\t\t\tquery: `\n\t\t\t\tr = makeRecord(o: {a: \"foo\", b: 42})\n\t\t\t\t\"r = ${r}\"`,\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"call builtin function\",\n\t\t\tquery: \"six()\",\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewFloat(6.0),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"call function with fail\",\n\t\t\tquery: \"fail()\",\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"call function with duplicate args\",\n\t\t\tquery: \"plusOne(x:1.0, x:2.0)\",\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"binary expressions\",\n\t\t\tquery: `\n\t\t\tsix_value = six()\n\t\t\tnine_value = nine()\n\n\t\t\tfortyTwo() == six_value * nine_value\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(false),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"logical expressions short circuit\",\n\t\t\tquery: `\n six_value = six()\n nine_value = nine()\n\n not (fortyTwo() == six_value * nine_value) or fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"function\",\n\t\t\tquery: `\n plusSix = (r) => r + six()\n plusSix(r:1.0) == 7.0 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"function block\",\n\t\t\tquery: `\n f = (r) => {\n r1 = 1.0 + r\n return (r + r1) / r\n }\n f(r:1.0) == 3.0 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"function block polymorphic\",\n\t\t\tquery: `\n f = (r) => {\n r2 = r * r\n return r2 / r\n }\n f(r:2.0) == 2.0 or fail()\n f(r:2) == 2 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"function with default param\",\n\t\t\tquery: `\n addN = (r,n=4) => r + n\n addN(r:2) == 6 or fail()\n addN(r:3,n:1) == 4 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"scope closing\",\n\t\t\tquery: `\n\t\t\tx = 5\n plusX = (r) => r + x\n plusX(r:2) == 7 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"nested scope mutations not visible outside\",\n\t\t\tquery: `\n\t\t\tx = 5\n xinc = () => {\n x = x + 1\n return x\n }\n xinc() == 6 or fail()\n x == 5 or fail()\n\t\t\t`,\n\t\t},\n\t\t// TODO(jsternberg): This test seems to not\n\t\t// infer the type constraints correctly for m.a,\n\t\t// but it doesn't fail.\n\t\t{\n\t\t\tname: \"return map from func\",\n\t\t\tquery: `\n toMap = (a,b) => ({\n a: a,\n b: b,\n })\n m = toMap(a:1, b:false)\n m.a == 1 or fail()\n not m.b or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"pipe expression\",\n\t\t\tquery: `\n\t\t\tadd = (a=<-,b) => a + b\n\t\t\tone = 1\n\t\t\tone |> add(b:2) == 3 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"ignore pipe default\",\n\t\t\tquery: `\n\t\t\tadd = (a=<-,b) => a + b\n\t\t\tadd(a:1, b:2) == 3 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"pipe expression function\",\n\t\t\tquery: `\n\t\t\tadd = (a=<-,b) => a + b\n\t\t\tsix() |> add(b:2.0) == 8.0 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"pipe builtin function\",\n\t\t\tquery: `\n\t\t\tsix() |> plusOne() == 7.0 or fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"regex match\",\n\t\t\tquery: `\n\t\t\t\"abba\" =~ /^a.*a$/ or fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"regex not match\",\n\t\t\tquery: `\n\t\t\t\"abc\" =~ /^a.*a$/ and fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(false),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"not regex match\",\n\t\t\tquery: `\n\t\t\t\"abc\" !~ /^a.*a$/ or fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"not regex not match\",\n\t\t\tquery: `\n\t\t\t\"abba\" !~ /^a.*a$/ and fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(false),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"options metadata\",\n\t\t\tquery: `\n\t\t\toption task = {\n\t\t\t\tname: \"foo\",\n\t\t\t\trepeat: 100,\n\t\t\t}\n\t\t\ttask.name == \"foo\" or fail()\n\t\t\ttask.repeat == 100 or fail()\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"query with side effects\",\n\t\t\tquery: `sideEffect() == 0 or fail()`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewInt(0),\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"array index expression\",\n\t\t\tquery: `\n\t\t\t\ta = [1, 2, 3]\n\t\t\t\tx = a[1]\n\t\t\t\tx == 2 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"dict expression\",\n\t\t\tquery: `\n\t\t\t\tm = [\"a\" + \"b\": 0, \"c\" + \"d\": 1]\n\t\t\t\tx = get(dict: m, key: \"ab\", default: 2)\n\t\t\t\ty = get(dict: m, key: \"cd\", default: 2)\n\t\t\t\tz = get(dict: m, key: \"ef\", default: 2)\n\t\t\t\tx == 0 and y == 1 and z == 2 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"empy dictionary\",\n\t\t\tquery: `\n\t\t\t\tm0 = [:]\n\t\t\t\tm1 = insert(dict: m0, key: \"a\", value: 0)\n\t\t\t\tm2 = insert(dict: m0, key: 0, value: \"a\")\n\t\t\t\tv1 = get(dict: m1, key: \"a\", default: -1)\n\t\t\t\tv2 = get(dict: m2, key: 0, default: \"b\")\n\t\t\t\tv1 == 0 and v2 == \"a\" or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"array index expression out of bounds low\",\n\t\t\tquery: `\n\t\t\t\ta = [1, 2, 3]\n\t\t\t\ti = -1\n\t\t\t\tx = a[i]\n\t\t\t`,\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"array index expression out of bounds high\",\n\t\t\tquery: `\n\t\t\t\ta = [1, 2, 3]\n\t\t\t\ti = 3\n\t\t\t\tx = a[i]\n\t\t\t`,\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"array with complex index expression\",\n\t\t\tquery: `\n\t\t\t\tf = () => ({l: 0, m: 1, n: 2})\n\t\t\t\ta = [1, 2, 3]\n\t\t\t\tx = a[f().l]\n\t\t\t\ty = a[f().m]\n\t\t\t\tz = a[f().n]\n\t\t\t\tx == 1 or fail()\n\t\t\t\ty == 2 or fail()\n\t\t\t\tz == 3 or fail()\n\t\t\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"short circuit logical and\",\n\t\t\tquery: `\n false and fail()\n `,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(false),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"short circuit logical or\",\n\t\t\tquery: `\n true or fail()\n `,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"no short circuit logical and\",\n\t\t\tquery: `\n true and fail()\n `,\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"no short circuit logical or\",\n\t\t\tquery: `\n false or fail()\n `,\n\t\t\twantErr: any,\n\t\t},\n\t\t{\n\t\t\tname: \"conditional true\",\n\t\t\tquery: `\n\t\t\t\tif 1 != 0 then 10 else 100\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewInt(10),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"conditional false\",\n\t\t\tquery: `\n\t\t\t\tif 1 == 0 then 10 else 100\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewInt(100),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"conditional in function\",\n\t\t\tquery: `\n\t\t\t\tf = (t, c, a) => if t then c else a\n\t\t\t\t{\n\t\t\t\t\tv1: f(t: false, c: 30, a: 300),\n\t\t\t\t\tv2: f(t: true, c: \"cats\", a: \"dogs\"),\n\t\t\t\t}\n\t\t\t`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewObjectWithValues(map[string]values.Value{\n\t\t\t\t\t\"v1\": values.NewInt(300),\n\t\t\t\t\t\"v2\": values.NewString(\"cats\"),\n\t\t\t\t}),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"exists\",\n\t\t\tquery: `hasValue(o: makeRecord(o: {value: 1}))`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(true),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"exists null\",\n\t\t\tquery: `hasValue(o: makeRecord(o: {val: 2}))`,\n\t\t\twant: []values.Value{\n\t\t\t\tvalues.NewBool(false),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"invalid function parameter\",\n\t\t\tquery: `from(bucket: \"telegraf\") |> window(every: 0s)`,\n\t\t\twantErr: `error calling function \"window\" @\\d+:\\d+-\\d+:\\d+: window function requires at least one of \"every\" or \"period\" to be set and non-zero`,\n\t\t},\n\t\t{\n\t\t\t// tests that we don't nest error messages when\n\t\t\t// a function call fails and gets piped into another\n\t\t\t// function.\n\t\t\tname: \"nested function error\",\n\t\t\tquery: `from(bucket: \"telegraf\") |> window(every: 0s) |> mean()`,\n\t\t\twantErr: `error calling function \"window\" @\\d+:\\d+-\\d+:\\d+: window function requires at least one of \"every\" or \"period\" to be set and non-zero`,\n\t\t},\n\t}\n\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\tsrc := prelude + tc.query\n\n\t\t\tctx, deps := dependency.Inject(context.Background(), dependenciestest.Default())\n\t\t\tdefer deps.Finish()\n\n\t\t\tsideEffects, _, err := runtime.Eval(ctx, src)\n\t\t\tif err != nil {\n\t\t\t\tif tc.wantErr == \"\" {\n\t\t\t\t\tt.Fatalf(\"unexpected error: %s\", err)\n\t\t\t\t}\n\n\t\t\t\t// We expect an error, so it should be a non-internal Flux error.\n\t\t\t\tif code := flux.ErrorCode(err); code == codes.Internal || code == codes.Unknown {\n\t\t\t\t\tt.Errorf(\"expected non-internal error code, got %s\", code)\n\t\t\t\t}\n\n\t\t\t\tre := regexp.MustCompile(tc.wantErr)\n\t\t\t\tif got := err.Error(); !re.MatchString(got) {\n\t\t\t\t\tt.Errorf(\"expected error to match pattern %q, but error was %q\", tc.wantErr, got)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t} else if tc.wantErr != \"\" {\n\t\t\t\tt.Fatal(\"expected error\")\n\t\t\t}\n\n\t\t\tvs := getSideEffectsValues(sideEffects)\n\t\t\tif tc.want != nil && !cmp.Equal(tc.want, vs, semantictest.CmpOptions...) {\n\t\t\t\tt.Fatalf(\"unexpected side effect values -want/+got: \\n%s\", cmp.Diff(tc.want, vs, semantictest.CmpOptions...))\n\t\t\t}\n\t\t})\n\t}\n}", "func (ev *Evaler) Eval(name, text string, n *parse.Chunk, ports []*Port) error {\n\top, err := ev.Compile(name, text, n)\n\tif err != nil {\n\t\treturn err\n\t}\n\tec := NewTopEvalCtx(ev, name, text, ports)\n\treturn ec.PEval(op)\n}", "func (e *Evaluator) Eval(expr *tipb.Expr) (types.Datum, error) {\n\tswitch expr.GetTp() {\n\tcase tipb.ExprType_Null:\n\t\treturn types.Datum{}, nil\n\tcase tipb.ExprType_Int64:\n\t\treturn e.evalInt(expr.Val)\n\tcase tipb.ExprType_Uint64:\n\t\treturn e.evalUint(expr.Val)\n\tcase tipb.ExprType_String:\n\t\treturn e.evalString(expr.Val)\n\tcase tipb.ExprType_Bytes:\n\t\treturn types.NewBytesDatum(expr.Val), nil\n\tcase tipb.ExprType_Float32:\n\t\treturn e.evalFloat(expr.Val, true)\n\tcase tipb.ExprType_Float64:\n\t\treturn e.evalFloat(expr.Val, false)\n\tcase tipb.ExprType_MysqlDecimal:\n\t\treturn e.evalDecimal(expr.Val)\n\tcase tipb.ExprType_MysqlDuration:\n\t\treturn e.evalDuration(expr.Val)\n\tcase tipb.ExprType_ColumnRef:\n\t\treturn e.evalColumnRef(expr.Val)\n\tcase tipb.ExprType_LT:\n\t\treturn e.evalLT(expr)\n\tcase tipb.ExprType_LE:\n\t\treturn e.evalLE(expr)\n\tcase tipb.ExprType_EQ:\n\t\treturn e.evalEQ(expr)\n\tcase tipb.ExprType_NE:\n\t\treturn e.evalNE(expr)\n\tcase tipb.ExprType_GE:\n\t\treturn e.evalGE(expr)\n\tcase tipb.ExprType_GT:\n\t\treturn e.evalGT(expr)\n\tcase tipb.ExprType_NullEQ:\n\t\treturn e.evalNullEQ(expr)\n\tcase tipb.ExprType_And:\n\t\treturn e.evalAnd(expr)\n\tcase tipb.ExprType_Or:\n\t\treturn e.evalOr(expr)\n\tcase tipb.ExprType_Like:\n\t\treturn e.evalLike(expr)\n\tcase tipb.ExprType_Not:\n\t\treturn e.evalNot(expr)\n\tcase tipb.ExprType_In:\n\t\treturn e.evalIn(expr)\n\tcase tipb.ExprType_Plus, tipb.ExprType_Div:\n\t\treturn e.evalArithmetic(expr)\n\t}\n\treturn types.Datum{}, nil\n}", "func (this *Mod) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.BinaryEval(this, item, context)\n}", "func (this *NowStr) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.Eval(this, item, context)\n}", "func (*Base) Unary(p ASTPass, node *ast.Unary, ctx Context) {\n\tp.Visit(p, &node.Expr, ctx)\n}", "func (i *IntNode) Eval(m memory.M) dragonscript.Value {\n\treturn dragonscript.Integer(i.value)\n}", "func (this *ObjectNames) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (this *ObjectNames) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (op *OpDiv) Eval(x, y float32) float32 {\n\treturn op.LeftChild.Eval(x, y) / op.RightChild.Eval(x, y)\n}", "func (e *Not) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {\n\tv, err := e.Child.Eval(ctx, row)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif v == nil {\n\t\treturn nil, nil\n\t}\n\n\treturn !v.(bool), nil\n}", "func (l *ListType) eval() Value {\n\treturn l\n}", "func eval(x interface{}, env map[string]interface{}) interface{} {\r\n if str, ok := isSymbol(x); ok { // variable reference\r\n\treturn env[str]\r\n }\r\n l, ok := isList(x)\r\n if !ok { // constant literal\r\n\treturn x\r\n }\r\n if len(l) == 0 {\r\n\tpanic(\"empty list\")\r\n }\r\n if str, ok := isSymbol(l[0]); ok {\r\n\tswitch (str) {\r\n\tcase \"quote\": // (quote exp)\r\n\t return l[1]\r\n\tcase \"if\": // (if test conseq alt)\r\n\t test := l[1]\r\n\t conseq := l[2]\r\n\t alt := l[3]\r\n\t r := eval(test, env)\r\n\t if b, ok := isFalse(r); ok && !b {\r\n\t\treturn eval(alt, env)\r\n\t } else {\r\n\t\treturn eval(conseq, env)\r\n\t }\r\n\tcase \"define\": // (define var exp)\r\n\t car := l[1]\r\n\t cdr := l[2]\r\n\t if str, ok = isSymbol(car); ok {\r\n\t\tenv[str] = eval(cdr, env)\r\n\t\treturn env[str]\r\n\t } else {\r\n\t\tpanic(\"define needs a symbol\")\r\n\t }\r\n\tdefault: // (proc arg...)\r\n\t car := eval(l[0], env)\r\n\t proc, ok := car.(func([]interface{})interface{})\r\n\t if !ok {\r\n\t\tpanic(\"not a procedure\")\r\n\t }\r\n args := makeArgs(l[1:], env)\r\n return proc(args)\r\n\t}\r\n }\r\n return nil\r\n}", "func (e *Not) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {\n\tv, err := e.Child.Eval(ctx, row)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif v == nil {\n\t\treturn nil, nil\n\t}\n\n\tb, ok := v.(bool)\n\tif !ok {\n\t\tb, err = types.ConvertToBool(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn !b, nil\n}", "func (op *OpCos) Eval(x, y float32) float32 {\n\treturn float32(math.Cos(float64(op.Child.Eval(x, y))))\n}", "func (da *DateArith) Eval(ctx context.Context, args map[interface{}]interface{}) (interface{}, error) {\n\tt, years, months, days, durations, err := da.evalArgs(ctx, args)\n\tif t.IsZero() || err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\tif !da.isAdd() {\n\t\tyears, months, days, durations = -years, -months, -days, -durations\n\t}\n\tt.Time = t.Time.Add(durations)\n\tt.Time = t.Time.AddDate(int(years), int(months), int(days))\n\n\t// \"2011-11-11 10:10:20.000000\" outputs \"2011-11-11 10:10:20\".\n\tif t.Time.Nanosecond() == 0 {\n\t\tt.Fsp = 0\n\t}\n\n\treturn t, nil\n}", "func evaluateExpression(c *Context, exp interface{}) interface{} {\r\n var val interface{}\r\n\r\n // fmt.Printf(\"Evaluating type %T, \\n\", exp)\r\n switch t := exp.(type) {\r\n case int:\r\n // fmt.Printf(\"Returning int %d\\n\", t)\r\n val = t\r\n case *Integer:\r\n val = t.Number\r\n case *StringPrimitive:\r\n val = t.str\r\n case string:\r\n val = t\r\n case []interface{}:\r\n val = t\r\n case *InfixExpression:\r\n // fmt.Printf(\"Evaluating infix expresison %T l: %T, r:%T\\n\", t,t.leftNode.Exp, t.rightNode.Exp)\r\n //Get the value of the left node and right\r\n lVal := evaluateExpression(c, t.leftNode.Exp)\r\n rVal := evaluateExpression(c, t.rightNode.Exp)\r\n\r\n\r\n //then apply the correct infix operator to the values\r\n val = evaluateInfixExpression(c, t.opType, lVal, rVal)\r\n\r\n case *Identifier:\r\n // fmt.Printf(\"Was identifier returning %v\\n\", t.id)\r\n if(t.id == \"nil\") {\r\n val = NewNil(0)\r\n } else {\r\n // fmt.Printf(\"Posssible indeitEifer %T\\n\", c.values[t.id])\r\n val = evaluateExpression(c, c.values[t.id])\r\n }\r\n case *CallExpression:\r\n // fmt.Printf(\"Evaluation call to %s\\n\",t.callee)\r\n\r\n //get declaration of call\r\n callDec := c.lookup(t.callee).(*FuncDeclaration)\r\n if(callDec.returnType == \"\") { //no rreturn type = unit\r\n val = &UnitType{}\r\n } else { //Evaluate the expression of the body for a value\r\n //This should produce a value and will execute all\r\n //of the code of the body as well\r\n for i, _ := range callDec.paramNodes {\r\n paramDec := callDec.paramNodes[i].Exp.(*Param)\r\n paramValue := t.paramNodes[i].Exp\r\n c.values[paramDec.id] = evaluateExpression(c, paramValue)\r\n val = c.values[paramDec.id]\r\n }\r\n\r\n }\r\n\r\n if(t.callee == \"printi\") {\r\n invokePrintI(c, t)\r\n } else if(t.callee == \"print\") {\r\n invokePrint(c, t)\r\n } else if(t.callee == \"not\") {\r\n invokeNot(c, t)\r\n } else { //Regular other user defined function do your thing!\r\n //invoke the body\r\n //Get the declaration of the calling function so we can execute it\r\n callDec := c.lookup(t.callee).(*FuncDeclaration)\r\n // fmt.Printf(\"Invoking random func \\n\")\r\n evaluateExpression(c, callDec.body.Exp)\r\n }\r\n case *IfThenElseExpression:\r\n condition := evaluateExpression(c, t.condNode.Exp).(bool)\r\n // fmt.Printf(\"Cond was %v \\n\", condition)\r\n //If else is nil then its an IfThen Exp\r\n if(t.elseNode == nil) {\r\n val = &UnitType{}\r\n if(condition) { //if the condition is true evaluatie the code inside\r\n evaluateExpression(c, t.thenNode.Exp)\r\n }\r\n } else { //otherwise its and ifThenElse\r\n if(condition) {\r\n val = evaluateExpression(c, t.thenNode.Exp)\r\n } else {\r\n val = evaluateExpression(c, t.elseNode.Exp)\r\n }\r\n }\r\n case *SeqExpression:\r\n // Value is equivalent to the last node of the seqence expression\r\n if(len(t.nodes) == 0) {\r\n val = &UnitType{}\r\n } else {\r\n // fmt.Printf(\"Seq type was %T\\n\", t.nodes[len(t.nodes)-1].Exp)\r\n val = evaluateExpression(c, t.nodes[len(t.nodes)-1].Exp)\r\n }\r\n case *Nil:\r\n val = NewNil(0)\r\n case *ArrayExp:\r\n arrType := getType(c, c.lookup(t.typeId)).(*Identifier)\r\n val = c.lookup(arrType.id)\r\n case *ForExpression:\r\n val = &UnitType{}\r\n case *LetExpression:\r\n if(len(t.exps) == 0) {\r\n val = &UnitType{}\r\n } else {\r\n // fmt.Printf(\"%T is last exp type\\n\", t.exps[len(t.exps)-1].Exp)\r\n // val = getType(c, t.exps[len(t.exps)-1].Exp)\r\n }\r\n case *Assignment:\r\n val = &UnitType{}\r\n case *RecordExp:\r\n var slc []interface{}\r\n for _, fcNode := range t.fieldCreateNodes {\r\n if b, isABinding := fcNode.Exp.(*Binding); isABinding {\r\n slc = append(slc, evaluateExpression(c, b.exp.Exp))\r\n }\r\n }\r\n val = slc\r\n default:\r\n fmt.Fprintf(os.Stderr, \"Could not evaluate exp %T\\n\", t)\r\n os.Exit(4)\r\n }\r\n\r\n return val\r\n}", "func Eval(node ast.Node, env *object.Environment) object.Object {\n\tswitch node := node.(type) {\n\n\t// Statements\n\tcase *ast.RootNode:\n\t\treturn evalRootNode(node, env)\n\n\tcase *ast.BlockStatement:\n\t\treturn evalBlockStmt(node, env)\n\n\tcase *ast.ExpressionStatement:\n\t\treturn Eval(node.Expression, env)\n\n\tcase *ast.ReturnStatement:\n\t\tval := Eval(node.ReturnValue, env)\n\t\tif isError(val) {\n\t\t\treturn val\n\t\t}\n\t\treturn &object.ReturnValue{Value: val}\n\n\tcase *ast.LetStatement:\n\t\tval := Eval(node.Value, env)\n\t\tif isError(val) {\n\t\t\treturn val\n\t\t}\n\t\tenv.Set(node.Name.Value, val)\n\n\tcase *ast.ConstStatement:\n\t\tval := Eval(node.Value, env)\n\t\tif isError(val) {\n\t\t\treturn val\n\t\t}\n\t\tenv.Set(node.Name.Value, val)\n\n\t// Expressions\n\tcase *ast.IntegerLiteral:\n\t\treturn &object.Integer{Value: node.Value}\n\n\tcase *ast.StringLiteral:\n\t\treturn &object.String{Value: node.Value}\n\n\tcase *ast.Boolean:\n\t\treturn nativeBoolToBooleanObj(node.Value)\n\n\tcase *ast.PrefixExpression:\n\t\tright := Eval(node.Right, env)\n\t\tif isError(right) {\n\t\t\treturn right\n\t\t}\n\t\treturn evalPrefixExpr(node.Operator, right, node.Token.Line)\n\n\tcase *ast.InfixExpression:\n\t\tleft := Eval(node.Left, env)\n\t\tif isError(left) {\n\t\t\treturn left\n\t\t}\n\t\tright := Eval(node.Right, env)\n\t\tif isError(right) {\n\t\t\treturn right\n\t\t}\n\t\treturn evalInfixExpr(node.Operator, left, right, node.Token.Line)\n\n\tcase *ast.PostfixExpression:\n\t\treturn evalPostfixExpr(env, node.Operator, node)\n\n\tcase *ast.IfExpression:\n\t\treturn evalIfExpr(node, env)\n\n\tcase *ast.Identifier:\n\t\treturn evalIdentifier(node, env)\n\n\tcase *ast.FunctionLiteral:\n\t\tparams := node.Parameters\n\t\tbody := node.Body\n\t\treturn &object.Function{\n\t\t\tParameters: params,\n\t\t\tBody: body,\n\t\t\tEnv: env,\n\t\t}\n\n\tcase *ast.CallExpression:\n\t\tfn := Eval(node.Function, env)\n\t\tif isError(fn) {\n\t\t\treturn fn\n\t\t}\n\t\targs := evalExprs(node.Arguments, env)\n\t\tif len(args) == 1 && isError(args[0]) {\n\t\t\treturn args[0]\n\t\t}\n\t\treturn applyFunction(fn, args, node.Token.Line)\n\n\tcase *ast.ArrayLiteral:\n\t\telements := evalExprs(node.Elements, env)\n\t\tif len(elements) == 1 && isError(elements[0]) {\n\t\t\treturn elements[0]\n\t\t}\n\t\treturn &object.Array{Elements: elements}\n\n\tcase *ast.IndexExpression:\n\t\tleft := Eval(node.Left, env)\n\t\tif isError(left) {\n\t\t\treturn left\n\t\t}\n\t\tindex := Eval(node.Index, env)\n\t\tif isError(index) {\n\t\t\treturn index\n\t\t}\n\t\treturn evalIndexExpr(left, index, node.Token.Line)\n\n\tcase *ast.HashLiteral:\n\t\treturn evalHashLiteral(node, env)\n\t}\n\n\treturn nil\n}", "func Evaluate(item interface{}, passedContext interface{}) map[string]float64 {\n\t//fmt.Fprintf(os.Stderr, \"eval:: %v %T\\n\", item, item)\n\n\tif item != nil {\n\t\tswitch passedContext.(type) {\n\t\tcase *DimContext:\n\t\t\t{\n\t\t\t\t//fmt.Fprintf(os.Stderr, \"here before processMember %v\\n\", item)\n\t\t\t\tprocessMember(item, passedContext)\n\t\t\t\t//fmt.Fprintf(os.Stderr, \"here after processMember %v %T\\n\", item, item)\n\t\t\t}\n\t\t}\n\t\tswitch v := item.(type) {\n\t\tcase hasResults:\n\t\t\t{\n\t\t\t\treturn v.Results()\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (sf *ScalarFunction) Eval(row chunk.Row) (d types.Datum, err error) {\n\tvar (\n\t\tres interface{}\n\t\tisNull bool\n\t)\n\tswitch tp, evalType := sf.GetType(), sf.GetType().EvalType(); evalType {\n\tcase types.ETInt:\n\t\tvar intRes int64\n\t\tintRes, isNull, err = sf.EvalInt(sf.GetCtx(), row)\n\t\tif mysql.HasUnsignedFlag(tp.Flag) {\n\t\t\tres = uint64(intRes)\n\t\t} else {\n\t\t\tres = intRes\n\t\t}\n\tcase types.ETString:\n\t\tres, isNull, err = sf.EvalString(sf.GetCtx(), row)\n\t}\n\n\tif isNull || err != nil {\n\t\td.SetNull()\n\t\treturn d, err\n\t}\n\td.SetValue(res, sf.RetType)\n\treturn\n}", "func (s server) Eval(ctx context.Context, req *entity.Request) (*entity.Result, error) {\n\tlog.Printf(\"Received a request: %+v\\n\", req)\n\tresult := &entity.Result{}\n\tres, err := s.usecase.Eval(req.Value)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\tresult.Value = strconv.FormatFloat(res, 'G', -1, 64)\n\treturn result, nil\n}", "func execEval(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\tret, ret1 := types.Eval(args[0].(*token.FileSet), args[1].(*types.Package), token.Pos(args[2].(int)), args[3].(string))\n\tp.Ret(4, ret, ret1)\n}", "func (p Polynomial) Eval(arg int) ed25519.Scalar {\n\tx := ed25519.New_scalar(*big.NewInt(int64(arg)))\n\tresult := p.coeffs[0].Add(p.coeffs[1].Mul(x))\n\tx_pow := x.Copy()\n\tfor i := 2; i < len(p.coeffs); i++ {\n\t\tx_pow = x_pow.Mul(x)\n\t\tresult = result.Add(p.coeffs[i].Mul(x_pow))\n\t}\n\treturn result\n}", "func (s Scope) Eval(ctx context.Context, local Scope) (Value, error) {\n\ttuple := NewTuple()\n\tfor e := s.Enumerator(); e.MoveNext(); {\n\t\tname, expr := e.Current()\n\t\tvalue, err := expr.Eval(ctx, local)\n\t\tif err != nil {\n\t\t\treturn nil, WrapContextErr(err, expr, local)\n\t\t}\n\t\ttuple = tuple.With(name, value)\n\t}\n\treturn tuple, nil\n}", "func (t *Check) Eval(r, s string) (bool, error) {\n\treturn false, errors.New(\"Not implemented\")\n}", "func (r *Rule) Eval(devices *devices.List, rules map[string]bool) (bool, error) {\n\treturn eval(r.Expression(), devices, rules, r.ast)\n}", "func lvalCall(e *LEnv, f *LVal, a *LVal) *LVal {\n\t//If it is a builtin function, return the result of running that function\n\tif f.Builtin != nil {\n\t\treturn f.Builtin(e, a)\n\t}\n\n\t//Bind the arguments that were passed into the function\n\tfor len(a.Cell) > 0 {\n\t\tif len(f.Formals.Cell) == 0 {\n\t\t\treturn lvalErr(\"Function passed too many arguments\")\n\t\t}\n\n\t\tsym := lvalPop(f.Formals, 0)\n\n\t\tif sym.Sym == \"&\" {\n\t\t\tif len(f.Formals.Cell) != 1 {\n\t\t\t\treturn lvalErr(\"Symbol & not followed by a single symbol.\")\n\t\t\t}\n\n\t\t\tnsym := lvalPop(f.Formals, 0)\n\t\t\tlenvPut(f.Env, nsym, builtinList(e, a))\n\t\t}\n\n\t\tval := lvalPop(a, 0)\n\n\t\tlenvPut(f.Env, sym, val)\n\t}\n\n\tif len(f.Formals.Cell) == 0 {\n\t\tf.Env.Par = e\n\n\t\treturn builtinEval(f.Env, lvalAdd(lvalSexpr(), lvalCopy(f.Body)))\n\t} else {\n\t\treturn lvalCopy(f)\n\t}\n}", "func unary(typ int, op string, od1 *expr) *expr {\n\treturn &expr{\n\t\tsexp: append(exprlist{atomic(typ, op)}, od1),\n\t}\n}", "func (f UnFunc) Apply(ctx context.Context, data interface{}) (interface{}, error) {\n\treturn f(ctx, data)\n}", "func (ev *evaluator) eval(expr Expr) model.Value {\n\t// This is the top-level evaluation method.\n\t// Thus, we check for timeout/cancellation here.\n\tif err := contextDone(ev.ctx, \"expression evaluation\"); err != nil {\n\t\tev.error(err)\n\t}\n\n\tswitch e := expr.(type) {\n\tcase *AggregateExpr:\n\t\tvector := ev.evalVector(e.Expr)\n\t\treturn ev.aggregation(e.Op, e.Grouping, e.Without, e.KeepCommonLabels, e.Param, vector)\n\n\tcase *BinaryExpr:\n\t\tlhs := ev.evalOneOf(e.LHS, model.ValScalar, model.ValVector)\n\t\trhs := ev.evalOneOf(e.RHS, model.ValScalar, model.ValVector)\n\n\t\tswitch lt, rt := lhs.Type(), rhs.Type(); {\n\t\tcase lt == model.ValScalar && rt == model.ValScalar:\n\t\t\treturn &model.Scalar{\n\t\t\t\tValue: scalarBinop(e.Op, lhs.(*model.Scalar).Value, rhs.(*model.Scalar).Value),\n\t\t\t\tTimestamp: ev.Timestamp,\n\t\t\t}\n\n\t\tcase lt == model.ValVector && rt == model.ValVector:\n\t\t\tswitch e.Op {\n\t\t\tcase itemLAND:\n\t\t\t\treturn ev.vectorAnd(lhs.(vector), rhs.(vector), e.VectorMatching)\n\t\t\tcase itemLOR:\n\t\t\t\treturn ev.vectorOr(lhs.(vector), rhs.(vector), e.VectorMatching)\n\t\t\tcase itemLUnless:\n\t\t\t\treturn ev.vectorUnless(lhs.(vector), rhs.(vector), e.VectorMatching)\n\t\t\tdefault:\n\t\t\t\treturn ev.vectorBinop(e.Op, lhs.(vector), rhs.(vector), e.VectorMatching, e.ReturnBool)\n\t\t\t}\n\t\tcase lt == model.ValVector && rt == model.ValScalar:\n\t\t\treturn ev.vectorScalarBinop(e.Op, lhs.(vector), rhs.(*model.Scalar), false, e.ReturnBool)\n\n\t\tcase lt == model.ValScalar && rt == model.ValVector:\n\t\t\treturn ev.vectorScalarBinop(e.Op, rhs.(vector), lhs.(*model.Scalar), true, e.ReturnBool)\n\t\t}\n\n\tcase *Call:\n\t\treturn e.Func.Call(ev, e.Args)\n\n\tcase *MatrixSelector:\n\t\treturn ev.matrixSelector(e)\n\n\tcase *NumberLiteral:\n\t\treturn &model.Scalar{Value: e.Val, Timestamp: ev.Timestamp}\n\n\tcase *ParenExpr:\n\t\treturn ev.eval(e.Expr)\n\n\tcase *StringLiteral:\n\t\treturn &model.String{Value: e.Val, Timestamp: ev.Timestamp}\n\n\tcase *UnaryExpr:\n\t\tse := ev.evalOneOf(e.Expr, model.ValScalar, model.ValVector)\n\t\t// Only + and - are possible operators.\n\t\tif e.Op == itemSUB {\n\t\t\tswitch v := se.(type) {\n\t\t\tcase *model.Scalar:\n\t\t\t\tv.Value = -v.Value\n\t\t\tcase vector:\n\t\t\t\tfor i, sv := range v {\n\t\t\t\t\tv[i].Value = -sv.Value\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn se\n\n\tcase *VectorSelector:\n\t\treturn ev.vectorSelector(e)\n\t}\n\tpanic(fmt.Errorf(\"unhandled expression of type: %T\", expr))\n}", "func (m *MockExpressionNode) Eval() func(backend.Row) (core.Value, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Eval\")\n\tret0, _ := ret[0].(func(backend.Row) (core.Value, error))\n\treturn ret0\n}", "func (o NotOperator) Evaluate(ctx interface{}) (bool, error) {\n\t// fmt.Println(\"Not.Evaluate()\")\n\tresult, err := o.Operand.Evaluate(ctx)\n\treturn !result, err\n}", "func evaluate(arg1 *vector.Vector, oper *vector.Vector, arg2 *vector.Vector) *vector.Vector {\n\t//Store the operator in a temp string, to save typing it out\n\tvar operS string\n\toperS = oper.At(0).(string)\n\tvar val1, val2 int \n\tvar err1, err2 os.Error\n\tval1, err1 = strconv.Atoi(arg1.At(0).(string))\n\tval2, err2 = strconv.Atoi(arg2.At(0).(string))\n\t//screens for consecutive operators\n\tif(err1 != nil || err2 != nil){\n\t\tfmt.Println(\"expr: syntax error\")\n\t\tos.Exit(-2)\n\t}\n\tvar result int = -1\n\t//Evaluate based on the operator\n\tif operS == \"+\" {\n\t\tresult = val1 + val2\n\t} else if operS == \"-\" {\n\t\tresult = val1 - val2\n\t} else if operS == \"/\" {\n\t\tresult = val1 / val2\n\t} else if operS == \"*\" {\n\t\tresult = val1 * val2\n\t} else if operS == \"%\" {\n\t\tresult = val1 % val2\n\t}\n\t//Clear the arg1 vector and add the result to it, then return\n\t//(saves memory by not creating a new vector)\n\targ1.Cut(0, arg1.Len())\n\targ1.Push(strconv.Itoa(result))\n\treturn arg1\n}" ]
[ "0.65595543", "0.62546283", "0.6108872", "0.6097263", "0.60695493", "0.6036691", "0.5988384", "0.59279025", "0.59279025", "0.5880389", "0.5870704", "0.5835574", "0.58030385", "0.58030385", "0.5791403", "0.5744493", "0.57420194", "0.573196", "0.57011765", "0.5694317", "0.5689354", "0.5674573", "0.5669151", "0.5619979", "0.5591362", "0.55852973", "0.5583008", "0.55749935", "0.55336136", "0.5526991", "0.5526954", "0.550571", "0.54969144", "0.5495889", "0.5473144", "0.5457676", "0.54540604", "0.5397223", "0.5373039", "0.537217", "0.536783", "0.5353833", "0.53533196", "0.53504956", "0.5349783", "0.53294647", "0.53083706", "0.5305044", "0.5287442", "0.5285157", "0.5282981", "0.5281684", "0.5277707", "0.52742606", "0.5263609", "0.5263155", "0.5258789", "0.52530026", "0.524969", "0.5244637", "0.52341306", "0.52311856", "0.5226741", "0.5226741", "0.522261", "0.5196474", "0.51939565", "0.5179526", "0.5176584", "0.51650256", "0.5158251", "0.5153515", "0.5136048", "0.51304144", "0.51304144", "0.5129726", "0.512609", "0.51231015", "0.51215166", "0.5112109", "0.51101106", "0.5107827", "0.5106561", "0.51064914", "0.5104398", "0.5097119", "0.50868475", "0.50603026", "0.5053217", "0.5049944", "0.5043144", "0.5029906", "0.50245243", "0.50226367", "0.50202715", "0.5012599", "0.50091726", "0.5006603", "0.5003481" ]
0.5362784
42
/ This method takes in an object and returns a slice that contains the attribute values. If the type of input is missing then return a missing value, and if not an object return a null value. Convert it to a valid Go type. Cast it to a map from string to interface. Range over this map and retrieve the keys. Sort it and then use it to save the corresponding values into a slice of interfaces. Return the slice.
func (this *ObjectValues) Apply(context Context, arg value.Value) (value.Value, error) { if arg.Type() == value.MISSING { return value.MISSING_VALUE, nil } else if arg.Type() != value.OBJECT { return value.NULL_VALUE, nil } oa := arg.Actual().(map[string]interface{}) keys := make(sort.StringSlice, 0, len(oa)) for key, _ := range oa { keys = append(keys, key) } sort.Sort(keys) ra := make([]interface{}, len(keys)) for i, k := range keys { ra[i] = oa[k] } return value.NewValue(ra), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (set *AppleSet) ToInterfaceSlice() []interface{} {\n\tset.s.RLock()\n\tdefer set.s.RUnlock()\n\n\ts := make([]interface{}, 0, len(set.m))\n\tfor v := range set.m {\n\t\ts = append(s, v)\n\t}\n\treturn s\n}", "func Values(i interface{}) ([]interface{}) {\n\tvar result []interface{}\n\tv := reflect.ValueOf(i)\n\n\tif v.Kind() != reflect.Map {\n\t\tfmt.Fprintf(os.Stderr, \"Input type is not a map type: %v\", v)\n\t\treturn nil\n\t}\n\n\tfor _,key := range (v.MapKeys()) {\n\t\tresult = append(result, v.MapIndex(key).Interface())\n\t}\n\n\treturn result\n}", "func (nvp *NameValues) ToInterfaceArray() []interface{} {\n\treturn NameValuesToInterfaceArray(*nvp)\n}", "func (claim Claim) ToAttributes() []*Attribute {\n\tvar attributes []*Attribute\n\n\tqueue := list.New()\n\tqueue.PushBack(&nestedObject{\n\t\tprefix: \"\",\n\t\tcontent: claim,\n\t})\n\t// go through every property of the claim, transform it into an int and put it into the attributes array\n\tfor queue.Len() > 0 {\n\t\telem := queue.Front()\n\t\tqueue.Remove(elem)\n\t\tjsonObj := elem.Value.(*nestedObject)\n\t\tfor n, v := range jsonObj.content {\n\t\t\tvar name string\n\t\t\tn = escape(n, []rune(Separator)[0])\n\t\t\tif jsonObj.prefix != \"\" {\n\t\t\t\tname = jsonObj.prefix + Separator + n\n\t\t\t} else {\n\t\t\t\tname = n\n\t\t\t}\n\t\t\treflected := reflect.ValueOf(v)\n\n\t\t\tswitch reflected.Kind() {\n\t\t\tcase reflect.Map:\n\t\t\t\tif m, ok := v.(Claim); ok {\n\t\t\t\t\tqueue.PushBack(&nestedObject{\n\t\t\t\t\t\tprefix: name,\n\t\t\t\t\t\tcontent: m,\n\t\t\t\t\t})\n\t\t\t\t} else if m, ok := v.(map[string]interface{}); ok {\n\t\t\t\t\tqueue.PushBack(&nestedObject{\n\t\t\t\t\t\tprefix: name,\n\t\t\t\t\t\tcontent: (Claim)(m),\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tpanic(fmt.Sprintf(\"unsupported map type %T\", v))\n\t\t\t\t}\n\t\t\tcase reflect.Slice, reflect.Array:\n\t\t\t\tmarshaledV, err := json.Marshal(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(\"could not marshal array\")\n\t\t\t\t}\n\t\t\t\t// for big ints prepend with non null byte\n\t\t\t\tmarshaledV = append([]byte{MagicByte}, marshaledV...)\n\t\t\t\tattributes = append(attributes, &Attribute{\n\t\t\t\t\tName: name,\n\t\t\t\t\tTypename: \"array\",\n\t\t\t\t\tValue: marshaledV,\n\t\t\t\t})\n\t\t\tcase reflect.String:\n\t\t\t\tattributes = append(attributes, &Attribute{\n\t\t\t\t\tName: name,\n\t\t\t\t\tTypename: \"string\",\n\t\t\t\t\tValue: []byte(reflected.String()),\n\t\t\t\t})\n\t\t\tcase reflect.Float32, reflect.Float64:\n\t\t\t\tvar buf [8]byte\n\t\t\t\tbinary.BigEndian.PutUint64(buf[:], math.Float64bits(reflected.Float()))\n\t\t\t\tattributes = append(attributes, &Attribute{\n\t\t\t\t\tName: name,\n\t\t\t\t\tTypename: \"float\",\n\t\t\t\t\tValue: buf[:],\n\t\t\t\t})\n\t\t\tcase reflect.Bool:\n\t\t\t\tvar value byte\n\t\t\t\tif reflected.Bool() {\n\t\t\t\t\tvalue = 1\n\t\t\t\t} else {\n\t\t\t\t\tvalue = 0\n\t\t\t\t}\n\t\t\t\tattributes = append(attributes, &Attribute{\n\t\t\t\t\tName: name,\n\t\t\t\t\tTypename: \"bool\",\n\t\t\t\t\tValue: []byte{value},\n\t\t\t\t})\n\t\t\tcase 0:\n\t\t\t\tattributes = append(attributes, &Attribute{\n\t\t\t\t\tName: name,\n\t\t\t\t\tTypename: \"\",\n\t\t\t\t\tValue: []byte{},\n\t\t\t\t})\n\t\t\tdefault:\n\t\t\t\tpanic(fmt.Sprintf(\"unknown type %T of property %s\", v, name))\n\t\t\t}\n\t\t}\n\t}\n\t// sort attributes by name\n\tsort.Slice(attributes[:], func(i, j int) bool {\n\t\treturn strings.Compare(attributes[i].Name, attributes[j].Name) < 0\n\t})\n\treturn attributes\n}", "func InterfaceToUveKeysTypeSlice(i interface{}) []*UveKeysType {\n\tlist := schema.InterfaceToInterfaceList(i)\n\tif list == nil {\n\t\treturn nil\n\t}\n\tresult := []*UveKeysType{}\n\tfor _, item := range list {\n\t\tresult = append(result, InterfaceToUveKeysType(item))\n\t}\n\treturn result\n}", "func ToInterface(v interface{}) ([]interface{}, error) {\n\tlist := []interface{}{}\n\ta := reflect.ValueOf(v)\n\tif !a.IsValid() {\n\t\treturn list, errors.New(\"failed to get reflection value\")\n\t}\n\tfor i := 0; i < a.NumField(); i++ {\n\t\tval := a.Field(i)\n\t\tswitch val.Kind() {\n\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\tlist = append(list, strconv.FormatInt(val.Int(), 10))\n\t\tcase reflect.String:\n\t\t\tlist = append(list, val.String())\n\t\tcase reflect.Float32, reflect.Float64:\n\t\t\tlist = append(list, val.Float())\n\t\tcase reflect.Bool:\n\t\t\tlist = append(list, val.Bool())\n\t\t}\n\t}\n\treturn list, nil\n}", "func IntegerFieldToSortedArray(m []interface{}, fieldName string) (vKeys []int) {\n\tif len(m) > 1000 {\n\t\tpanic(\"this uses reflection - not for large structs\")\n\t}\n\tvKeys = make([]int, len(m))\n\tfor i, iface := range m {\n\t\tvKeys[i] = GetIntField(iface, fieldName)\n\t}\n\tsort.Ints(vKeys)\n\treturn\n}", "func SortedValues(i interface{}) []interface{} {\n\tm, ok := i.(map[string]interface{})\n\tif !ok {\n\t\tFatalf(\"SortedValues: expected map[string]interface{}, didn't get it\")\n\t}\n\tmapping := map[string]string{} // sort key: original key\n\tfor name, element := range m {\n\t\tsubmap, ok := element.(map[string]interface{})\n\t\tif !ok {\n\t\t\tmapping[name] = name\n\t\t\tcontinue\n\t\t}\n\t\tsortkey, ok := submap[\"sortkey\"]\n\t\tif !ok {\n\t\t\tmapping[name] = name\n\t\t\tcontinue\n\t\t}\n\t\tsortkeyString, ok := sortkey.(string)\n\t\tif !ok {\n\t\t\tmapping[name] = name\n\t\t\tcontinue\n\t\t}\n\t\tmapping[sortkeyString] = name\n\t}\n\n\tsortkeys := stringSlice{}\n\tfor sortkey, _ := range mapping {\n\t\tsortkeys = append(sortkeys, sortkey)\n\t}\n\tsort.Sort(sortkeys)\n\n\torderedValues := []interface{}{}\n\tfor _, k := range sortkeys {\n\t\torderedValues = append(orderedValues, m[mapping[k]])\n\t}\n\treturn orderedValues\n}", "func InterfaceValues() []Interface {\n\treturn _InterfaceValues\n}", "func InterfaceValues() []Interface {\n\treturn _InterfaceValues\n}", "func (set Int64Set) ToInterfaceSlice() []interface{} {\n\tvar s []interface{}\n\tfor v, _ := range set {\n\t\ts = append(s, v)\n\t}\n\treturn s\n}", "func StringToInterface(i []string) []interface{} {\n\to := make([]interface{}, len(i))\n\tfor k, v := range i {\n\t\to[k] = v\n\t}\n\n\treturn o\n}", "func (*K8sObjectTag) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase k8sobjecttag.FieldID, k8sobjecttag.FieldK8sObjectId, k8sobjecttag.FieldK8sLabelId:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase k8sobjecttag.FieldCreatedAt, k8sobjecttag.FieldUpdatedAt, k8sobjecttag.FieldDeletedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type K8sObjectTag\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "func (NetworkInterfaceAttribute) Values() []NetworkInterfaceAttribute {\n\treturn []NetworkInterfaceAttribute{\n\t\t\"description\",\n\t\t\"groupSet\",\n\t\t\"sourceDestCheck\",\n\t\t\"attachment\",\n\t}\n}", "func (v AnnotationValue) AsSlice() []AnnotationValue {\n\treturn v.Value.([]AnnotationValue)\n}", "func (InterfacePermissionType) Values() []InterfacePermissionType {\n\treturn []InterfacePermissionType{\n\t\t\"INSTANCE-ATTACH\",\n\t\t\"EIP-ASSOCIATE\",\n\t}\n}", "func (SortAssociationsBy) Values() []SortAssociationsBy {\n\treturn []SortAssociationsBy{\n\t\t\"SourceArn\",\n\t\t\"DestinationArn\",\n\t\t\"SourceType\",\n\t\t\"DestinationType\",\n\t\t\"CreationTime\",\n\t}\n}", "func Values(a interface{}) interface{} {\n\tval := reflect.ValueOf(a)\n\tkeys := val.MapKeys()\n\ttyp := reflect.TypeOf(a).Elem()\n\n\t// Create result slice.\n\tresultValue := reflect.MakeSlice(reflect.SliceOf(typ),\n\t\tlen(keys), len(keys))\n\tfor i := range keys {\n\t\tresultValue.Index(i).Set(val.MapIndex(keys[i]))\n\t}\n\tresult := resultValue.Interface()\n\tsortSlice(result) // Sort result, for consistency.\n\treturn result\n}", "func (claim *Claim) ToAttributes() ([]*Attribute, []*big.Int) {\n\tvar attributes []*Attribute\n\tvar values []*big.Int\n\n\t// TODO: nested attributes, array might not be a wise choice here (many memcopy ops?)\n\tattributes = append(attributes, &Attribute{\n\t\t\"ctype\",\n\t\t\"string\",\n\t})\n\tvalues = append(values, new(big.Int).SetBytes([]byte(claim.CType)))\n\n\tqueue := list.New()\n\tqueue.PushBack(&nestedObject{\n\t\tprefix: \"contents\",\n\t\tcontent: claim.Contents,\n\t})\n\tfor queue.Len() > 0 {\n\t\telem := queue.Front()\n\t\tqueue.Remove(elem)\n\t\tjsonObj := elem.Value.(*nestedObject)\n\t\tfor n, v := range jsonObj.content {\n\t\t\tname := jsonObj.prefix + SEPARATOR + n\n\t\t\tif f, ok := v.(map[string]interface{}); ok {\n\t\t\t\tqueue.PushBack(&nestedObject{\n\t\t\t\t\tprefix: name,\n\t\t\t\t\tcontent: f,\n\t\t\t\t})\n\t\t\t} else if str, ok := v.(string); ok {\n\t\t\t\tattributes = append(attributes, &Attribute{\n\t\t\t\t\tname,\n\t\t\t\t\t\"string\",\n\t\t\t\t})\n\t\t\t\tvalues = append(values, new(big.Int).SetBytes([]byte(str)))\n\t\t\t} else if f, ok := v.(float64); ok {\n\t\t\t\tvar buf [8]byte\n\t\t\t\tbinary.BigEndian.PutUint64(buf[:], math.Float64bits(f))\n\t\t\t\tattributes = append(attributes, &Attribute{\n\t\t\t\t\tname,\n\t\t\t\t\t\"float\",\n\t\t\t\t})\n\t\t\t\tvalues = append(values, new(big.Int).SetBytes(buf[:]))\n\t\t\t} else if f, ok := v.(bool); ok {\n\t\t\t\tvar value *big.Int\n\t\t\t\tif f {\n\t\t\t\t\tvalue = new(big.Int).SetInt64(1)\n\t\t\t\t} else {\n\t\t\t\t\tvalue = new(big.Int).SetInt64(0)\n\t\t\t\t}\n\t\t\t\tattributes = append(attributes, &Attribute{\n\t\t\t\t\tname,\n\t\t\t\t\t\"bool\",\n\t\t\t\t})\n\t\t\t\tvalues = append(values, value)\n\t\t\t} else {\n\t\t\t\tpanic(\"Unknown type\")\n\t\t\t}\n\t\t}\n\t}\n\tsort.Sort(byName{attributes, values})\n\n\treturn attributes, values\n}", "func (attestedClaim *AttestedClaim) getAttributes() ([]*Attribute, error) {\n\tbInts := attestedClaim.getRawAttributes()\n\tattributes, err := BigIntsToAttributes(bInts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsorted := sort.SliceIsSorted(attributes, func(p, q int) bool {\n\t\treturn strings.Compare(attributes[p].Name, attributes[q].Name) < 0\n\t})\n\tif !sorted {\n\t\treturn nil, errors.New(\"expected attributes inside credential to be sorted\")\n\t}\n\treturn attributes, nil\n}", "func ToStringStringMap(tagName string, input interface{}, properties ...string) (map[string]string, error) {\n\tvmap := make(map[string]string)\n\ts := structs.New(input)\n\ts.TagName = tagName\n\tif len(properties) == 0 {\n\t\tproperties = s.Names()\n\t}\n\n\tfor _, field := range s.Fields() {\n\t\tif !field.IsExported() {\n\t\t\tcontinue\n\t\t}\n\n\t\tif !stringInSlice(field.Name(), properties) {\n\t\t\tcontinue\n\t\t}\n\n\t\tfieldName, opts := parseTag(field.Tag(tagName))\n\t\tif fieldName == \"\" || fieldName == \"-\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tval := field.Value()\n\n\t\tif opts.Has(\"omitempty\") {\n\t\t\tif field.IsZero() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif z, ok := val.(isZeroer); ok && z.IsZero() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif z, ok := val.(isEmptier); ok && z.IsEmpty() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tkind := field.Kind()\n\t\tif kind == reflect.Ptr {\n\t\t\tv := reflect.ValueOf(val)\n\t\t\tif v.IsNil() {\n\t\t\t\tvmap[fieldName] = \"\"\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\telem := v.Elem()\n\t\t\tkind = elem.Kind()\n\t\t\tval = elem.Interface()\n\t\t}\n\n\t\tif opts.Has(\"include\") && kind == reflect.Struct {\n\t\t\tvar newProperties []string\n\t\t\tfor _, prop := range properties {\n\t\t\t\tif strings.HasPrefix(prop, fieldName+\".\") {\n\t\t\t\t\tnewProperties = append(newProperties, strings.TrimPrefix(prop, fieldName+\".\"))\n\t\t\t\t}\n\t\t\t}\n\t\t\tm, err := ToStringStringMap(tagName, val, newProperties...)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tfor k, v := range m {\n\t\t\t\tvmap[fieldName+\".\"+k] = v\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif v, ok := val.(string); ok {\n\t\t\tvmap[fieldName] = v\n\t\t\tcontinue\n\t\t} else if v, ok := val.(*string); ok {\n\t\t\tvmap[fieldName] = *v\n\t\t\tcontinue\n\t\t}\n\n\t\tif !field.IsZero() {\n\t\t\tif m, ok := val.(encoding.TextMarshaler); ok {\n\t\t\t\ttxt, err := m.MarshalText()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tvmap[fieldName] = string(txt)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif m, ok := val.(json.Marshaler); ok {\n\t\t\t\ttxt, err := m.MarshalJSON()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tvmap[fieldName] = string(txt)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif kind == reflect.String {\n\t\t\tvmap[fieldName] = fmt.Sprint(val)\n\t\t\tcontinue\n\t\t}\n\n\t\tif txt, err := json.Marshal(val); err == nil {\n\t\t\tvmap[fieldName] = string(txt)\n\t\t\tif vmap[fieldName] == `\"\"` || vmap[fieldName] == \"null\" {\n\t\t\t\tvmap[fieldName] = \"\"\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tvmap[fieldName] = fmt.Sprintf(\"%v\", val)\n\t}\n\treturn vmap, nil\n}", "func (SortLineageGroupsBy) Values() []SortLineageGroupsBy {\n\treturn []SortLineageGroupsBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t}\n}", "func TransformSliceInterfaceToSliceValue(i []interface{}) (res []driver.Value) {\n\tfor _, v := range i {\n\t\tres = append(res, v)\n\t}\n\n\treturn\n}", "func ToI(slice interface{}) []interface{} {\n\ts := reflect.ValueOf(slice)\n\tif s.Kind() != reflect.Slice {\n\t\tpanic(\"ToInterface expects a slice type\")\n\t}\n\n\tret := make([]interface{}, s.Len())\n\n\tfor i := 0; i < s.Len(); i++ {\n\t\tret[i] = s.Index(i).Interface()\n\t}\n\treturn ret\n}", "func attributes(m interface{}) map[string]reflect.Type {\n\ttyp := reflect.TypeOf(m)\n\t// if a pointer to a struct is passed, get the type of the dereferenced object\n\tif typ.Kind() == reflect.Ptr {\n\t\ttyp = typ.Elem()\n\t}\n\n\t// create an attribute data structure as a map of types keyed by a string.\n\tattrs := make(map[string]reflect.Type)\n\t// Only structs are supported so return an empty result if the passed object\n\t// isn't a struct\n\tif typ.Kind() != reflect.Struct {\n\t\tfmt.Printf(\"%v type can't have attributes inspected\\n\", typ.Kind())\n\t\treturn attrs\n\t}\n\n\t// loop through the struct's fields and set the map\n\tfor i := 0; i < typ.NumField(); i++ {\n\t\tp := typ.Field(i)\n\t\tif !p.Anonymous {\n\t\t\tattrs[p.Name] = p.Type\n\t\t}\n\t}\n\n\treturn attrs\n}", "func objToValues(obj interface{}, vals []string) []string {\n\tvar val reflect.Value\n\n\tif rval, ok := obj.(reflect.Value); ok {\n\t\tval = rval\n\t} else {\n\t\tval = reflect.ValueOf(obj)\n\t\tif val.Kind() == reflect.Ptr {\n\t\t\tval = val.Elem()\n\t\t}\n\t}\n\n\tfor i := 0; i < val.NumField(); i++ {\n\t\tfield := val.Field(i)\n\n\t\tswitch field.Kind() {\n\t\tcase reflect.Struct:\n\t\t\tvals = objToValues(field, vals)\n\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\tvals = append(vals, strconv.FormatInt(field.Int(), 10))\n\t\tcase reflect.Float32, reflect.Float64:\n\t\t\tvals = append(vals, strconv.FormatFloat(field.Float(), 'f', 3, 32))\n\t\tcase reflect.String:\n\t\t\tvals = append(vals, field.String())\n\t\tdefault:\n\t\t\t// This is sample code, so this is fine.\n\t\t\t// As a best practice, we should really have an exhaustive list of cases to extract the field value.\n\t\t\tvals = append(vals, \"<Field type not supported>\")\n\t\t}\n\t}\n\n\treturn vals\n}", "func Keys(i interface{}) (keys []string) {\n\tv := reflect.ValueOf(i)\n\n\tif v.Kind() != reflect.Map {\n\t\tfmt.Fprintf(os.Stderr, \"Input type is not a map type: %v\", v)\n\t\treturn nil\n\t}\n\n\tfor _,key := range v.MapKeys() {\n\t\tkeys = append(keys, key.Interface().(string))\n\t}\n\n\treturn keys\n}", "func objFields(obj interface{}, skipKey bool) (interface{}, []interface{}) {\n\tval := reflect.ValueOf(obj)\n\tt := reflect.TypeOf(obj)\n\ta := make([]interface{}, 0, t.NumField())\n\tvar key interface{}\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tf := t.Field(i)\n\t\tif len(f.Tag.Get(\"sql\")) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif f.Tag.Get(\"key\") == \"true\" {\n\t\t\tkey = val.Field(i).Interface()\n\t\t\tif skipKey {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\ta = append(a, val.Field(i).Interface())\n\t}\n\treturn key, a\n}", "func (m OrderedMap[K, V]) ToSlice() []OrderedMapItem[K, V] {\n\treturn m.items\n}", "func Valueize(values ...reflect.Value) []reflect.Value {\n\treturn values\n}", "func Get(t Interface) []interface{} {\n\tvals := t.Get()\n\tvalsCopy := make([]interface{}, len(vals))\n\tcopy(valsCopy, vals)\n\n\tcmp := &comparables{valsCopy, t.IsLess}\n\tsort.Sort(sort.Reverse(cmp))\n\n\treturn cmp.values\n}", "func JSONSliceOfInterfaceToSliceOfMaps(input []any) ([]map[any]any, error) {\n\toutputMap := make([]map[any]any, 0)\n\tfor _, current := range input {\n\t\tdata, err := JSONToMapOfInterfaces(current.(string))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmap2 := map[any]any{}\n\n\t\tfor k, v := range data {\n\t\t\tmap2[k] = v\n\t\t}\n\n\t\toutputMap = append(outputMap, map2)\n\t}\n\treturn outputMap, nil\n}", "func (ModelPackageSortBy) Values() []ModelPackageSortBy {\n\treturn []ModelPackageSortBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t}\n}", "func (data *Data) Interface(s ...string) interface{} {\n\tx := *data\n\tvar y interface{}\n\n\tfor _, i := range s {\n\n\t\tif _, ok := x[i]; ok == false {\n\t\t\treturn nil\n\t\t}\n\n\t\tswitch x[i].(type) {\n\t\tdefault:\n\t\t\ty = x[i].(interface{})\n\n\t\tcase map[string]interface{}:\n\t\t\tx = x[i].(map[string]interface{})\n\t\t}\n\t}\n\treturn y\n}", "func (v AnnotationValue) AsMap() []AnnotationMapEntry {\n\treturn v.Value.([]AnnotationMapEntry)\n}", "func InterfaceToQosIdForwardingClassPairSlice(i interface{}) []*QosIdForwardingClassPair {\n\tlist := schema.InterfaceToInterfaceList(i)\n\tif list == nil {\n\t\treturn nil\n\t}\n\tresult := []*QosIdForwardingClassPair{}\n\tfor _, item := range list {\n\t\tresult = append(result, InterfaceToQosIdForwardingClassPair(item))\n\t}\n\treturn result\n}", "func getFields(s interface{}) []interface{} {\n\tv := reflect.ValueOf(s)\n\tv = dereference(v)\n\tfields := []interface{}{}\n\tfor i := 0; i < v.NumField(); i++ {\n\t\tfield := v.Field(i)\n\t\tif field.CanInterface() {\n\t\t\tfields = append(fields, field.Interface())\n\t\t}\n\t}\n\treturn fields\n}", "func (ModelSortKey) Values() []ModelSortKey {\n\treturn []ModelSortKey{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t}\n}", "func (SpaceSortKey) Values() []SpaceSortKey {\n\treturn []SpaceSortKey{\n\t\t\"CreationTime\",\n\t\t\"LastModifiedTime\",\n\t}\n}", "func (o *KeyValueOrdered) Slice() []KeyValueCapsule {\n\treturn o.s\n}", "func (SortArtifactsBy) Values() []SortArtifactsBy {\n\treturn []SortArtifactsBy{\n\t\t\"CreationTime\",\n\t}\n}", "func keys(dict interface{}) interface{} {\n var m = dict.(map[interface{}]interface{})\n var keys = make([]interface{}, 0, len(m))\n for k := range m {\n keys = append(keys, k)\n }\n return keys\n}", "func (*ObjectType) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // name\n\t\t&sql.NullString{}, // kind\n\t\t&sql.NullString{}, // description\n\t}\n}", "func SlotTypeSortAttribute_Values() []string {\n\treturn []string{\n\t\tSlotTypeSortAttributeSlotTypeName,\n\t\tSlotTypeSortAttributeLastUpdatedDateTime,\n\t}\n}", "func SortedKeys(i interface{}) []string {\n\tvMap := reflect.ValueOf(i)\n\tvKeys := vMap.MapKeys()\n\tkeys := make([]string, len(vKeys), len(vKeys))\n\tidx := 0\n\tfor _,vKey := range vKeys {\n\t\tkeys[idx] = vKey.String()\n\t\tidx++\n\t}\n\tsort.Strings(keys)\n\treturn keys\n}", "func (k2h *K2hash) GetAttrs(k string) ([]Attr, error) {\n\t// 1. retrieve an attribute using k2h_get_attrs\n\t// bool k2h_get_attrs(k2h_h handle, const unsigned char* pkey, size_t keylength, PK2HATTRPCK* ppattrspck, int* pattrspckcnt)\n\tcKey := C.CBytes([]byte(k))\n\tdefer C.free(unsafe.Pointer(cKey))\n\tvar attrpack C.PK2HATTRPCK\n\tvar attrpackCnt C.int\n\tok := C.k2h_get_attrs(\n\t\tk2h.handle,\n\t\t(*C.uchar)(cKey),\n\t\tC.size_t(len([]byte(k))+1), // plus one for a null termination\n\t\t&attrpack,\n\t\t&attrpackCnt,\n\t)\n\tdefer C.k2h_free_attrpack(attrpack, attrpackCnt) // free the memory for the keypack for myself(GC doesn't know the area)\n\n\tif ok == false {\n\t\tfmt.Println(\"C.k2h_get_attrs returns false\")\n\t\treturn []Attr{}, fmt.Errorf(\"C.k2h_get_attrs() = %v\", ok)\n\t} else if attrpackCnt == 0 {\n\t\tfmt.Printf(\"attrpackLen is zero\")\n\t\treturn []Attr{}, nil\n\t} else {\n\t\tfmt.Printf(\"attrpackLen is %v\\n\", attrpackCnt)\n\t}\n\t// 2. copy an attribute data to a slice\n\tvar CAttrs C.PK2HATTRPCK = attrpack\n\tcount := (int)(attrpackCnt)\n\tslice := (*[1 << 28]C.K2HATTRPCK)(unsafe.Pointer(CAttrs))[:count:count]\n\tfmt.Printf(\"slice size is %v\\n\", len(slice))\n\t//\n\tattrs := make([]Attr, count) // copy\n\tfor i, data := range slice {\n\t\t// copy the data with len-1 length, which exclude a null termination.\n\t\tattrkey := C.GoBytes(unsafe.Pointer(data.pkey), (C.int)(data.keylength-1))\n\t\tfmt.Printf(\"i %v data %T pkey %v length %v attrkey %v\\n\", i, data, data.pkey, data.keylength, string(attrkey))\n\t\tattrval := C.GoBytes(unsafe.Pointer(data.pval), (C.int)(data.vallength-1))\n\t\tfmt.Printf(\"i %v data %T pval %v length %v attrval %v\\n\", i, data, data.pval, data.vallength, string(attrval))\n\t\t// cast bytes to a string\n\t\tattrs[i].key = string(attrkey)\n\t\tattrs[i].val = string(attrval)\n\t}\n\treturn attrs, nil\n}", "func (c EntityObject) Attributes() map[string]interface{} {\n\treturn c.attributes\n}", "func (ModelCardSortBy) Values() []ModelCardSortBy {\n\treturn []ModelCardSortBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t}\n}", "func (SortTrialsBy) Values() []SortTrialsBy {\n\treturn []SortTrialsBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t}\n}", "func (SortTrialComponentsBy) Values() []SortTrialComponentsBy {\n\treturn []SortTrialComponentsBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t}\n}", "func (*Ecdict) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // word\n\t\t&sql.NullString{}, // sw\n\t\t&sql.NullString{}, // phonetic\n\t\t&sql.NullString{}, // definition\n\t\t&sql.NullString{}, // translation\n\t\t&sql.NullString{}, // pos\n\t\t&sql.NullInt64{}, // collins\n\t\t&sql.NullInt64{}, // oxford\n\t\t&sql.NullString{}, // tag\n\t\t&sql.NullInt64{}, // bnc\n\t\t&sql.NullInt64{}, // frq\n\t\t&sql.NullString{}, // exchange\n\t\t&sql.NullString{}, // detail\n\t\t&sql.NullString{}, // audio\n\t}\n}", "func (ResourceCatalogSortBy) Values() []ResourceCatalogSortBy {\n\treturn []ResourceCatalogSortBy{\n\t\t\"CreationTime\",\n\t}\n}", "func (e *Extractor) ValuesFromTag(tag string) (out []interface{}, err error) {\n\n\tif err := e.isValidStruct(); err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := reflect.ValueOf(e.StructAddr).Elem()\n\tfields := e.fields(s)\n\n\tfor _, field := range fields {\n\t\tif val, ok := field.tags.Lookup(tag); ok {\n\t\t\tif _, omit := e.parseOmitempty(val, field.value); omit {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tout = append(out, field.value.Interface())\n\t\t}\n\t}\n\n\treturn\n}", "func InterfaceToRbacRuleEntriesTypeSlice(i interface{}) []*RbacRuleEntriesType {\n\tlist := schema.InterfaceToInterfaceList(i)\n\tif list == nil {\n\t\treturn nil\n\t}\n\tresult := []*RbacRuleEntriesType{}\n\tfor _, item := range list {\n\t\tresult = append(result, InterfaceToRbacRuleEntriesType(item))\n\t}\n\treturn result\n}", "func (rm RowsMap) Interface() RowsMapInterface {\n\trmi := RowsMapInterface{}\n\tfor _, v := range rm {\n\t\trmi = append(rmi, v.Interface())\n\t}\n\treturn rmi\n}", "func (s *Set) ToSlice() []interface{} {\n\tvar slice []interface{}\n\tcurrElemNum := 0\n\tfor k := range s.vals {\n\t\tif currElemNum < cap(slice) {\n\t\t\tslice[currElemNum] = k\n\t\t} else {\n\t\t\tslice = append(slice, k)\n\t\t}\n\t\tcurrElemNum++\n\t}\n\treturn slice\n}", "func InterfaceToStringMap(i interface{}) map[string]string {\n\tstringMap := map[string]string{}\n\tfor key, value := range i.(map[interface{}]interface{}) {\n\t\tstringMap[key.(string)] = value.(string)\n\t}\n\treturn stringMap\n}", "func (set *SetThreadSafe) ToSlice() []interface{} {\n\tvar ret []interface{}\n\tset.Items.Range(func(k, v interface{}) bool {\n\t\tret = append(ret, k)\n\t\treturn true\n\t})\n\treturn ret\n}", "func (*Category) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase category.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase category.FieldName, category.FieldDescription:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase category.FieldCreatedAt, category.FieldModifiedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Category\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "func Values(mp any) (values []any) {\n\trv := reflect.Indirect(reflect.ValueOf(mp))\n\tif rv.Kind() != reflect.Map {\n\t\treturn\n\t}\n\n\tvalues = make([]any, 0, rv.Len())\n\tfor _, key := range rv.MapKeys() {\n\t\tvalues = append(values, rv.MapIndex(key).Interface())\n\t}\n\treturn\n}", "func BuiltInSlotTypeSortAttribute_Values() []string {\n\treturn []string{\n\t\tBuiltInSlotTypeSortAttributeSlotTypeSignature,\n\t}\n}", "func (ImageSortBy) Values() []ImageSortBy {\n\treturn []ImageSortBy{\n\t\t\"CREATION_TIME\",\n\t\t\"LAST_MODIFIED_TIME\",\n\t\t\"IMAGE_NAME\",\n\t}\n}", "func AsSlice(v interface{}) []interface{} {\n\tif v == nil {\n\t\treturn []interface{}{}\n\t}\n\tr := AsValueRef(reflect.ValueOf(v))\n\tswitch r.Kind() {\n\tcase reflect.Slice, reflect.Array:\n\t\tres := make([]interface{}, r.Len())\n\t\tfor i := 0; i < r.Len(); i++ {\n\t\t\tres[i] = r.Index(i).Interface()\n\t\t}\n\t\treturn res\n\tcase reflect.Map:\n\t\tres := make([]interface{}, r.Len())\n\t\tfor i, k := range r.MapKeys() {\n\t\t\tres[i] = k.Interface()\n\t\t}\n\t\treturn res\n\tcase reflect.Struct:\n\t\tt := r.Type()\n\t\tres := make([]string, t.NumField())\n\t\tfor i := 0; i < t.NumField(); i++ {\n\t\t\tres[i] = t.Field(i).Name\n\t\t}\n\t}\n\treturn []interface{}{v}\n}", "func (SortInferenceExperimentsBy) Values() []SortInferenceExperimentsBy {\n\treturn []SortInferenceExperimentsBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t\t\"Status\",\n\t}\n}", "func (o *IscsiInterfaceGetIterResponseResultAttributesList) values() []IscsiInterfaceListEntryInfoType {\n\tr := o.IscsiInterfaceListEntryInfoPtr\n\treturn r\n}", "func attributes(m interface{}) map[string]reflect.Type {\n\ttyp := reflect.TypeOf(m)\n\tif typ.Kind() == reflect.Ptr {\n\t\ttyp = typ.Elem()\n\t}\n\n\tattrs := make(map[string]reflect.Type)\n\tif typ.Kind() != reflect.Struct {\n\t\treturn nil\n\t}\n\n\tfor i := 0; i < typ.NumField(); i++ {\n\t\tp := typ.Field(i)\n\t\tif !p.Anonymous {\n\t\t\tattrs[p.Name] = p.Type\n\t\t}\n\t}\n\n\treturn attrs\n}", "func Values[K comparable, V any](in map[K]V) []V {\n\tresult := make([]V, 0, len(in))\n\n\tfor _, v := range in {\n\t\tresult = append(result, v)\n\t}\n\n\treturn result\n}", "func interfaceSlice(slice interface{}) []interface{} {\n\ts := reflect.ValueOf(slice)\n\tif s.Kind() != reflect.Slice {\n\t\tpanic(\"InterfaceSlice() given a non-slice type\")\n\t}\n\tret := make([]interface{}, s.Len())\n\tfor i := 0; i < s.Len(); i++ {\n\t\tret[i] = s.Index(i).Interface()\n\t}\n\treturn ret\n}", "func (SortExperimentsBy) Values() []SortExperimentsBy {\n\treturn []SortExperimentsBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t}\n}", "func (NotebookInstanceSortKey) Values() []NotebookInstanceSortKey {\n\treturn []NotebookInstanceSortKey{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t\t\"Status\",\n\t}\n}", "func (AutoMLSortBy) Values() []AutoMLSortBy {\n\treturn []AutoMLSortBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t\t\"Status\",\n\t}\n}", "func (s SliceOfBar) AsMap() map[string]*Bar {\n\tresult := make(map[string]*Bar)\n\tfor _, value := range s {\n\t\tresult[value.ID] = value\n\t}\n\treturn result\n}", "func sortedKeys(v any) []any {\n\tkeys := reflect.ValueOf(v).MapKeys()\n\tsort.Slice(keys, func(i, j int) bool {\n\t\ta := keys[i].Convert(u32).Interface().(uint32)\n\t\tb := keys[j].Convert(u32).Interface().(uint32)\n\t\treturn a < b\n\t})\n\tvals := make([]any, len(keys))\n\tfor i, key := range keys {\n\t\tvals[i] = key.Interface()\n\t}\n\treturn vals\n}", "func (i SNSSubscribeAttribute) ValueSlice() []SNSSubscribeAttribute {\n\treturn _SNSSubscribeAttributeValues\n}", "func (i SNSPlatformApplicationAttribute) ValueSlice() []SNSPlatformApplicationAttribute {\n\treturn _SNSPlatformApplicationAttributeValues\n}", "func (this *ObjectValues) Type() value.Type { return value.ARRAY }", "func (this *ObjectValues) Type() value.Type { return value.ARRAY }", "func ToMap(i interface{}) (map[string]interface{}, error) {\n\tvar stringInterfaceMap map[string]interface{}\n\titr, _ := bson.Marshal(i)\n\terr := bson.Unmarshal(itr, &stringInterfaceMap)\n\treturn stringInterfaceMap, err\n}", "func makeAttributes(tags map[string]interface{}) (map[string]pdata.AttributeValue, error) {\n\tm := make(map[string]pdata.AttributeValue, len(tags))\n\t// todo: attribute val as array?\n\tfor k, v := range tags {\n\t\tswitch val := v.(type) {\n\t\tcase int64:\n\t\t\tm[k] = pdata.NewAttributeValueInt(val)\n\t\tcase bool:\n\t\t\tm[k] = pdata.NewAttributeValueBool(val)\n\t\tcase string:\n\t\t\tm[k] = pdata.NewAttributeValueString(val)\n\t\tcase float64:\n\t\t\tm[k] = pdata.NewAttributeValueDouble(val)\n\t\tcase []byte:\n\t\t\tm[k] = pdata.NewAttributeValueBytes(val)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unknown tag type %T\", v)\n\t\t}\n\t}\n\treturn m, nil\n}", "func UseInterface() {\n\ti1 := map[string]interface{}{\n\t\t\"id\": 1111,\n\t\t\"name\": \"Toran\",\n\t\t\"interests\": []interface{}{\n\t\t\t\"technology\",\n\t\t\t\"trekking\",\n\t\t\t\"biking\",\n\t\t},\n\t\t\"extra\": map[string]interface{}{\n\t\t\t\"edu\": \"graduation\",\n\t\t},\n\t}\n\tfmt.Println(i1)\n\n\ti2 := []interface{}{\n\t\tmap[string]interface{}{\n\t\t\t\"id\": 1111,\n\t\t\t\"name\": \"Toran\",\n\t\t},\n\t\tmap[string]interface{}{\n\t\t\t\"id\": 1112,\n\t\t\t\"name\": \"Abhishek\",\n\t\t},\n\t}\n\tfmt.Println(i2)\n}", "func (*Dentalappointment) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase dentalappointment.FieldID, dentalappointment.FieldAmount, dentalappointment.FieldPrice:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase dentalappointment.FieldNote:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase dentalappointment.FieldAppointtime:\n\t\t\tvalues[i] = &sql.NullTime{}\n\t\tcase dentalappointment.ForeignKeys[0]: // kindname\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase dentalappointment.ForeignKeys[1]: // _Patient_id\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase dentalappointment.ForeignKeys[2]: // _Personnel_id\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Dentalappointment\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "func InterfaceToFlavorSlice(i interface{}) []*Flavor {\n\tlist := schema.InterfaceToInterfaceList(i)\n\tif list == nil {\n\t\treturn nil\n\t}\n\tresult := []*Flavor{}\n\tfor _, item := range list {\n\t\tresult = append(result, InterfaceToFlavor(item))\n\t}\n\treturn result\n}", "func istable(v interface{}) bool {\n\t_, ok := v.(map[string]interface{})\n\tif !ok {\n\t\t_, ok = v.(Values)\n\t}\n\treturn ok\n}", "func (v *array) InterfaceSlice() []interface{} {\n\ts := v.slice\n\tis := make([]interface{}, len(s))\n\tfor i := range s {\n\t\tis[i] = s[i]\n\t}\n\treturn is\n}", "func InterfaceToStringSlice(i interface{}) []string {\n\tstringSlice := []string{}\n\tfor _, v := range i.([]interface{}) {\n\t\tstringSlice = append(stringSlice, v.(string))\n\t}\n\treturn stringSlice\n}", "func UniqueInterfaces(input []interface{}) []interface{} {\n\tkeys := make(map[interface{}]bool)\n\tlist := []interface{}{}\n\tfor _, entry := range input {\n\t\tif _, value := keys[entry]; !value {\n\t\t\tkeys[entry] = true\n\t\t\tlist = append(list, entry)\n\t\t}\n\t}\n\treturn list\n}", "func (rm RowMap) Interface() RowMapInterface {\n\trmi := make(RowMapInterface, len(rm))\n\tfor k, v := range rm {\n\t\trmi[k] = v\n\t}\n\treturn rmi\n}", "func ArrToObjs(src interface{}) (des []interface{}) {\n\tdata := reflect.ValueOf(src)\n\tnum := data.Len()\n\tfor i := 0; i < num; i++ {\n\t\tdes = append(des, data.Index(i))\n\t}\n\treturn\n}", "func (*OutcomeCategory) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase outcomecategory.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase outcomecategory.FieldOutcomeCategoryTitle:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase outcomecategory.ForeignKeys[0]: // outcome_class_outcome_category_list\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type OutcomeCategory\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "func (*Bag) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase bag.FieldName, bag.FieldIcon:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase bag.FieldID, bag.FieldUserID:\n\t\t\tvalues[i] = &uuid.UUID{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Bag\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "func (jbobject *ServicesEc2ModelImageAttributeName) Values() []*ServicesEc2ModelImageAttributeName {\n\tjret, err := javabind.GetEnv().CallStaticMethod(\"com/amazonaws/services/ec2/model/ImageAttributeName\", \"values\", javabind.ObjectArrayType(\"com/amazonaws/services/ec2/model/ImageAttributeName\"))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tretconv := javabind.NewJavaToGoObjectArray(javabind.NewJavaToGoCallable(), \"com/amazonaws/services/ec2/model/ImageAttributeName\")\n\tdst := new([]*ServicesEc2ModelImageAttributeName)\n\tretconv.Dest(dst)\n\tif err := retconv.Convert(javabind.ObjectRef(jret)); err != nil {\n\t\tpanic(err)\n\t}\n\tretconv.CleanUp()\n\treturn *dst\n}", "func (ModelPackageGroupSortBy) Values() []ModelPackageGroupSortBy {\n\treturn []ModelPackageGroupSortBy{\n\t\t\"Name\",\n\t\t\"CreationTime\",\n\t}\n}", "func (*JobHistory) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase jobhistory.FieldID, jobhistory.FieldCreateByUser:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase jobhistory.FieldJobEntryLeaveType:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase jobhistory.FieldCreateTime, jobhistory.FieldDate:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tcase jobhistory.ForeignKeys[0]: // user_job_histories\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type JobHistory\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "func getSliceData[K comparable, V any](m map[K]V) []Data[K, V] {\n\t// define a slice with Data type passing K, V type parameters\n\td := make([]Data[K, V], len(m))\n\ti := 0\n\tfor k, v := range m {\n\t\t// creating value of generic type of Data\n\t\tnewData := Data[K, V]{}\n\t\tnewData.Key = k\n\t\tnewData.Value = v\n\t\td[i] = newData\n\t\ti++\n\t}\n\treturn d\n}", "func (m *IdentityUserFlowAttributeAssignment) GetUserAttributeValues()([]UserAttributeValuesItemable) {\n return m.userAttributeValues\n}", "func ConvertInterfaceArray(array []interface{}) []interface{} {\n\tnewArray := make([]interface{}, len(array))\n\tfor i, val := range array {\n\t\tswitch concreteVal := val.(type) {\n\t\tcase map[string]interface{}:\n\t\t\tstringMap := ConvertStringMap(concreteVal)\n\t\t\tnewArray[i] = stringMap\n\t\tcase map[interface{}]interface{}:\n\t\t\tinterfaceMap := ConvertInterfaceMap(concreteVal)\n\t\t\tnewArray[i] = interfaceMap\n\t\tcase []interface{}:\n\t\t\tinterfaceArray := ConvertInterfaceArray(concreteVal)\n\t\t\tnewArray[i] = interfaceArray\n\t\tdefault:\n\t\t\tnewArray[i] = concreteVal\n\n\t\t}\n\t}\n\treturn newArray\n}", "func convertMapI2MapS(i interface{}) interface{} {\n switch x := i.(type) {\n case map[interface{}]interface{}:\n m2 := map[string]interface{}{}\n for k, v := range x {\n m2[k.(string)] = convertMapI2MapS(v)\n }\n return m2\n case []interface{}:\n for i, v := range x {\n x[i] = convertMapI2MapS(v)\n }\n }\n return i\n}", "func (*History) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase history.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase history.FieldIP, history.FieldCity, history.FieldRegion:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase history.FieldLoginTime:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type History\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "func (KeyType) Values() []KeyType {\n\treturn []KeyType{\n\t\t\"HASH\",\n\t\t\"RANGE\",\n\t}\n}", "func (SortByEnum) Values() []SortByEnum {\n\treturn []SortByEnum{\n\t\t\"repositoryName\",\n\t\t\"lastModifiedDate\",\n\t}\n}", "func GetChildrenMap(input interface{}) []Child {\n\tvalueOf := GetBaseValue(input)\n\n\tvar children []Child\n\tchildren = make([]Child, 0)\n\n\tfor _, key := range valueOf.MapKeys() {\n\t\tvalue := valueOf.MapIndex(key)\n\t\tkind := value.Kind()\n\n\t\tname := Value2String(key)\n\t\tchildren = append(children, Child{Name: name, Value: value.Interface(), Kind: kind})\n\t}\n\treturn children\n}" ]
[ "0.5377597", "0.53151846", "0.52673537", "0.5089155", "0.50724846", "0.506726", "0.5065719", "0.506426", "0.5048821", "0.5048821", "0.5006157", "0.50016093", "0.49946824", "0.49070972", "0.49048558", "0.4893779", "0.48834392", "0.48525932", "0.4825139", "0.4813861", "0.48034588", "0.47932714", "0.47839487", "0.476879", "0.47610554", "0.47552043", "0.47354227", "0.4724918", "0.47223353", "0.47161755", "0.4711882", "0.47086334", "0.4700452", "0.47000453", "0.46879566", "0.46828577", "0.46673775", "0.46546885", "0.4648606", "0.46432573", "0.46357977", "0.46263024", "0.4619746", "0.45990247", "0.4594984", "0.4594863", "0.45900905", "0.458689", "0.45844218", "0.45804992", "0.45608178", "0.455875", "0.45583308", "0.45541957", "0.45418513", "0.45409998", "0.45401788", "0.45395187", "0.4520998", "0.45184013", "0.4518073", "0.45177773", "0.45127076", "0.45087945", "0.45071608", "0.45071197", "0.45037195", "0.4495075", "0.44932878", "0.44927382", "0.44891772", "0.44873258", "0.44830135", "0.44823948", "0.44822404", "0.44772476", "0.44772476", "0.44764155", "0.4472851", "0.44697052", "0.4469363", "0.4464687", "0.44620675", "0.44607294", "0.44535813", "0.4449974", "0.4448558", "0.44429722", "0.44417816", "0.44379154", "0.44373038", "0.44292435", "0.44271317", "0.4422129", "0.44206658", "0.44184604", "0.4418088", "0.44119728", "0.44119266", "0.44112688", "0.44099647" ]
0.0
-1
/ The constructor returns a NewObjectValues with the an operand cast to a Function as the FunctionConstructor.
func (this *ObjectValues) Constructor() FunctionConstructor { return func(operands ...Expression) Function { return NewObjectValues(operands[0]) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (this *ObjectInnerValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectInnerValues(operands[0])\n\t}\n}", "func (this *ObjectAdd) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectAdd(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *DateAddMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateAddMillis(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPairs(operands[0])\n\t}\n}", "func (this *ObjectPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPairs(operands[0])\n\t}\n}", "func (this *ObjectUnwrap) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectUnwrap(operands[0])\n\t}\n}", "func (this *ObjectPut) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPut(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *DateAddStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateAddStr(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectNames) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectNames(operands[0])\n\t}\n}", "func (this *ObjectNames) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectNames(operands[0])\n\t}\n}", "func (this *DateDiffMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateDiffMillis(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectRemove) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectRemove(operands[0], operands[1])\n\t}\n}", "func (this *ObjectInnerPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectInnerPairs(operands[0])\n\t}\n}", "func (this *ObjectLength) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectLength(operands[0])\n\t}\n}", "func (this *ObjectLength) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectLength(operands[0])\n\t}\n}", "func (this *DateDiffStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateDiffStr(operands[0], operands[1], operands[2])\n\t}\n}", "func Function(args ...Type) *Operator {\n\treturn &Operator{functionName, args}\n}", "func (this *DatePartMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDatePartMillis(operands[0], operands[1])\n\t}\n}", "func (this *DatePartStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDatePartStr(operands[0], operands[1])\n\t}\n}", "func (this *Mod) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewMod(operands[0], operands[1])\n\t}\n}", "func (this *NowMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function { return _NOW_MILLIS }\n}", "func (this *StrToMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToMillis(operands[0])\n\t}\n}", "func (this *StrToUTC) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToUTC(operands[0])\n\t}\n}", "func (this *Element) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewElement(operands[0], operands[1])\n\t}\n}", "func NewValuesFunc(ctx sessionctx.Context, offset int, retTp *types.FieldType) *ScalarFunction {\n\tfc := &valuesFunctionClass{baseFunctionClass{ast.Values, 0, 0}, offset, retTp}\n\tbt, err := fc.getFunction(ctx, nil)\n\tterror.Log(err)\n\treturn &ScalarFunction{\n\t\tFuncName: model.NewCIStr(ast.Values),\n\t\tRetType: retTp,\n\t\tFunction: bt,\n\t}\n}", "func (this *DateTruncStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateTruncStr(operands[0], operands[1])\n\t}\n}", "func (this *StrToZoneName) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToZoneName(operands[0], operands[1])\n\t}\n}", "func (this *DateTruncMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateTruncMillis(operands[0], operands[1])\n\t}\n}", "func NewConstructor(x interface{}) (*Constructor, error) {\n\tif x == nil {\n\t\treturn nil, kerror.New(kerror.EViolation, \"function expected, nil given\")\n\t}\n\tft := reflect.TypeOf(x)\n\tfv := reflect.ValueOf(x)\n\tif ft.Kind() != reflect.Func {\n\t\treturn nil, kerror.Newf(kerror.EViolation, \"function expected, %s given\", ft)\n\t}\n\tif fv.IsNil() {\n\t\treturn nil, kerror.New(kerror.EViolation, \"function expected, nil given\")\n\t}\n\tc := &Constructor{\n\t\tfunction: fv,\n\t}\n\tnumIn := ft.NumIn()\n\tif ft.IsVariadic() {\n\t\tnumIn--\n\t}\n\tc.inTypes = make([]reflect.Type, numIn)\n\tfor i := 0; i < numIn; i++ {\n\t\tc.inTypes[i] = ft.In(i)\n\t}\n\tswitch ft.NumOut() {\n\tdefault:\n\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\tcase 1:\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = -1\n\t\tc.errorOutIndex = -1\n\tcase 2:\n\t\tif ft.Out(1) != errorType {\n\t\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\t\t}\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = -1\n\t\tc.errorOutIndex = 1\n\tcase 3:\n\t\tif ft.Out(1) != destructorType || ft.Out(2) != errorType {\n\t\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\t\t}\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = 1\n\t\tc.errorOutIndex = 2\n\t}\n\treturn c, nil\n}", "func New(v interface{}) Value {\n\treturn Value{v}\n}", "func New(spec *Spec) Function {\n\tf := Function{\n\t\tspec: spec,\n\t}\n\treturn f\n}", "func NewFunction(retType types.WaccType, ident *Ident, params ParamList,\n\tstats Statement, pos errors.Position) *Function {\n\tfn := &Function{\n\t\tretType: retType,\n\t\tident: ident,\n\t\tparams: params,\n\t\tpos: pos,\n\t}\n\tswitch st := stats.(type) {\n\tcase StatMultiple:\n\t\tfn.stats = st\n\tdefault:\n\t\tfn.stats = StatMultiple{st}\n\t}\n\treturn fn\n}", "func (this *NowStr) Constructor() FunctionConstructor { return NewNowStr }", "func NewObjectValues(operand Expression) Function {\n\trv := &ObjectValues{\n\t\t*NewUnaryFunctionBase(\"object_values\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectValues(operand Expression) Function {\n\trv := &ObjectValues{\n\t\t*NewUnaryFunctionBase(\"object_values\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewFunction(name string, typ semantic.Type, call func(args Object) (Value, error), sideEffect bool) Function {\n\treturn &function{\n\t\tname: name,\n\t\tt: typ,\n\t\tcall: call,\n\t\thasSideEffect: sideEffect,\n\t}\n}", "func (f Function) New(ctx string) error {\n\treturn f.unsafeWrap(errors.New(ctx), ctx, \"\")\n}", "func (this *ClockMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function { return _CLOCK_MILLIS }\n}", "func (this *Not) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewNot(operands[0])\n\t}\n}", "func NewFunction(ctx sctx.Context, funcName string, retType *types.FieldType, args ...Expression) (Expression, error) {\n\treturn newFunctionImpl(ctx, true, funcName, retType, args...)\n}", "func NewFunction(ifunc IFunction, name string) IQueryField {\n\treturn &SFunctionFieldBase{\n\t\tIFunction: ifunc,\n\t\talias: name,\n\t}\n}", "func newFunction(p *Package, fl *File, f *ast.FuncDecl) *Function {\n\tres := &Function{\n\t\tpkg: p,\n\t\tfile: fl,\n\t\tfn: f,\n\t\tname: nameFromIdent(f.Name),\n\t\tdef: getFunc(p, fl, f.Type).(*FuncType),\n\t}\n\n\tif res.fn.Recv != nil {\n\t\tn := \"\"\n\t\tif res.fn.Recv.List[0].Names != nil {\n\t\t\tn = nameFromIdent(res.fn.Recv.List[0].Names[0])\n\t\t}\n\t\tres.receiver = newVariableFromExpr(res.pkg, res.file, n, res.fn.Recv.List[0].Type)\n\t\tvar def Definition\n\t\tvar def2 *StarType\n\t\tdef = res.receiver.def\n\t\tdef2, res.receiverPointer = def.(*StarType)\n\t\tif res.receiverPointer {\n\t\t\tdef = def2.Target()\n\t\t}\n\t\tres.receiverClass = def.String()\n\t}\n\treturn res\n}", "func (this *MillisToStr) Constructor() FunctionConstructor { return NewMillisToStr }", "func NewFunc(name string, typ Type) *Func {\n\treturn &Func{object: object{scope: nil, name: name, typ: typ}}\n}", "func tcNew(n *ir.UnaryExpr) ir.Node {\n\tif n.X == nil {\n\t\t// Fatalf because the OCALL above checked for us,\n\t\t// so this must be an internally-generated mistake.\n\t\tbase.Fatalf(\"missing argument to new\")\n\t}\n\tl := n.X\n\tl = typecheck(l, ctxType)\n\tt := l.Type()\n\tif t == nil {\n\t\tn.SetType(nil)\n\t\treturn n\n\t}\n\tn.X = l\n\tn.SetType(types.NewPtr(t))\n\treturn n\n}", "func NewFunction(config *truce.HTTP, function truce.Function) (*Function, error) {\n\tif function.Transports.HTTP == nil {\n\t\treturn nil, nil\n\t}\n\n\ttransport := *function.Transports.HTTP\n\n\tb := &Function{\n\t\tDefinition: function,\n\t\tQuery: map[string]QueryParam{},\n\t}\n\n\ttype argument struct {\n\t\tvariable string\n\t\tposVariable string\n\t\ttyp string\n\t}\n\n\tvar (\n\t\tpathMappings = map[string]string{}\n\t\targs = map[string]argument{}\n\t)\n\n\tfor i, field := range function.Arguments {\n\t\targs[field.Name] = argument{\n\t\t\ttyp: string(field.Type),\n\t\t\tposVariable: fmt.Sprintf(\"v%d\", i),\n\t\t\tvariable: field.Name,\n\t\t}\n\t}\n\n\tif function.Return.Present && function.Return.Name != \"\" {\n\t\tb.HasReturn = true\n\t\tb.ReturnType = string(function.Return.Type)\n\n\t\tif len(b.ReturnType) < 1 {\n\t\t\treturn nil, errors.New(\"return type cannot be empty\")\n\t\t}\n\n\t\tif b.ReturnType[0] == '*' {\n\t\t\tb.ReturnType = b.ReturnType[1:]\n\t\t\tb.ReturnIsPtr = true\n\t\t}\n\t}\n\n\tb.Method = transport.Method\n\n\t// Sort the arguments by name for consistent positional ordering.\n\tvar argVals []truce.ArgumentValue\n\tfor _, arg := range transport.Arguments {\n\t\targVals = append(argVals, arg)\n\t}\n\tsort.Slice(argVals, func(i, j int) bool {\n\t\treturn argVals[i].Name < argVals[j].Name\n\t})\n\n\tvar qpos int\n\tfor _, arg := range argVals {\n\t\ta, ok := args[arg.Name]\n\n\t\tswitch arg.From {\n\t\tcase \"body\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tb.BodyVar = a.posVariable\n\t\t\tb.BodyType = a.typ\n\t\tcase \"path\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpathMappings[arg.Var] = args[arg.Name].variable\n\t\tcase \"query\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tb.Query[arg.Var] = QueryParam{\n\t\t\t\tPos: qpos,\n\t\t\t\tQueryVar: arg.Var,\n\t\t\t\tGoVar: a.posVariable,\n\t\t\t\tType: a.typ,\n\t\t\t}\n\n\t\t\tqpos++\n\t\tcase \"static\":\n\t\t\t// TODO(georgemac)\n\t\t}\n\t}\n\n\tfor _, part := range strings.Split(config.Prefix, \"/\") {\n\t\tif part == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tb.Path = append(b.Path, Element{Type: \"static\", Value: part})\n\t}\n\n\tb.Path = append(b.Path, parsePath(pathMappings, transport.Path)...)\n\n\treturn b, nil\n}", "func NewLiteral(value Object) Expression {\n\treturn &literal{value: value}\n}", "func (this *MillisToUTC) Constructor() FunctionConstructor { return NewMillisToUTC }", "func NewFunction(ctx openedge.Context, cfg FunctionInfo) *Function {\n\tf := &Function{\n\t\tcfg: cfg,\n\t\tctx: ctx,\n\t\tids: make(chan string, cfg.Instance.Max),\n\t\tlog: logger.WithField(\"function\", cfg.Name),\n\t}\n\tfor index := 1; index <= cfg.Instance.Max; index++ {\n\t\tf.ids <- fmt.Sprintf(\"f%d\", index)\n\t}\n\tpc := pool.NewDefaultPoolConfig()\n\tpc.MinIdle = cfg.Instance.Min\n\tpc.MaxIdle = cfg.Instance.Max\n\tpc.MaxTotal = cfg.Instance.Max\n\tpc.MinEvictableIdleTime = cfg.Instance.IdleTime\n\tpc.TimeBetweenEvictionRuns = cfg.Instance.EvictTime\n\tf.pool = pool.NewObjectPool(context.Background(), newFactory(f), pc)\n\treturn f\n}", "func (sf *ScalarFunction) Clone() Expression {\n\tc := &ScalarFunction{\n\t\tFuncName: sf.FuncName,\n\t\tRetType: sf.RetType,\n\t\tFunction: sf.Function.Clone(),\n\t}\n\treturn c\n}", "func NewFunction(f func(float64) float64) *Function {\n\treturn &Function{\n\t\tF: f,\n\t\tSamples: 50,\n\t\tLineStyle: plotter.DefaultLineStyle,\n\t}\n}", "func NewFunction(fnLit *ast.FunctionLiteral, env *Environment) *Function {\n\treturn &Function{\n\t\tParameters: fnLit.Parameters,\n\t\tBody: fnLit.Body,\n\t\tEnv: env,\n\t}\n}", "func (c *Constructor) Create(a ...reflect.Value) (reflect.Value, kdone.Destructor, error) {\n\tif c == nil {\n\t\treturn reflect.Value{}, kdone.Noop, nil\n\t}\n\tif len(a) != len(c.inTypes) {\n\t\treturn reflect.Value{}, nil, kerror.Newf(kerror.EViolation,\n\t\t\t\"%s constructor expects %d argument(s), %d given\",\n\t\t\tc.t, len(c.inTypes), len(a))\n\t}\n\tfor i, v := range a {\n\t\tif v.Type() != c.inTypes[i] {\n\t\t\treturn reflect.Value{}, nil, kerror.Newf(kerror.EViolation,\n\t\t\t\t\"%s constructor expects argument %d to be of %s type, %s given\",\n\t\t\t\tc.t, i+1, c.inTypes[i], v.Type())\n\t\t}\n\t}\n\tout := c.function.Call(a)\n\tobj := out[c.objectOutIndex]\n\tvar dtor kdone.Destructor = kdone.Noop\n\tif c.destructorOutIndex >= 0 {\n\t\tif v := out[c.destructorOutIndex].Interface(); v != nil {\n\t\t\tdtor = v.(kdone.Destructor)\n\t\t}\n\t}\n\tvar err error\n\tif c.errorOutIndex >= 0 {\n\t\tif v := out[c.errorOutIndex].Interface(); v != nil {\n\t\t\terr = v.(error)\n\t\t}\n\t}\n\treturn obj, dtor, err\n}", "func (this *MillisToZoneName) Constructor() FunctionConstructor { return NewMillisToZoneName }", "func (c ValueColumn) FromFunction(fn func() interface{}) ValueColumn {\n\tc.fns[\"insert\"] = fn\n\treturn c\n}", "func ClosureNew(f interface{}) *C.GClosure {\n\tclosure := C._g_closure_new()\n\tclosures.Lock()\n\tclosures.m[closure] = reflect.ValueOf(f)\n\tclosures.Unlock()\n\treturn closure\n}", "func NewOperator(kind string, in, out reflect.Type, f func(ctx context.Context, field string, object interface{}) (interface{}, error)) Operator {\n\treturn &operator{\n\t\tkind: kind,\n\t\tin: in,\n\t\tout: out,\n\t\tf: f,\n\t}\n}", "func NewValue() *Value { return &Value{} }", "func (e *exprHelper) NewCall(function string, args ...ast.Expr) ast.Expr {\n\treturn e.exprFactory.NewCall(e.nextMacroID(), function, args...)\n}", "func newFunctionImpl(ctx sctx.Context, fold bool, funcName string, retType *types.FieldType, args ...Expression) (Expression, error) {\n\tif retType == nil {\n\t\treturn nil, errors.Errorf(\"RetType cannot be nil for ScalarFunction.\")\n\t}\n\tfc, ok := funcs[funcName]\n\tif !ok {\n\t\tdb := ctx.GetSessionVars().CurrentDB\n\t\tif db == \"\" {\n\t\t\treturn nil, errors.Trace(ErrNoDB)\n\t\t}\n\n\t\treturn nil, errFunctionNotExists.GenWithStackByArgs(\"FUNCTION\", db+\".\"+funcName)\n\t}\n\tfuncArgs := make([]Expression, len(args))\n\tcopy(funcArgs, args)\n\tf, err := fc.getFunction(ctx, funcArgs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif builtinRetTp := f.getRetTp(); builtinRetTp.Tp != mysql.TypeUnspecified || retType.Tp == mysql.TypeUnspecified {\n\t\tretType = builtinRetTp\n\t}\n\tsf := &ScalarFunction{\n\t\tFuncName: model.NewCIStr(funcName),\n\t\tRetType: retType,\n\t\tFunction: f,\n\t}\n\treturn sf, nil\n}", "func NewValues(col sql.Expression) sql.Expression {\n\treturn &Values{\n\t\tUnaryExpression: expression.UnaryExpression{Child: col},\n\t\tValue: nil,\n\t}\n}", "func NewFunctionCall(callee Expression, arguments []Expression, trailing *TrailingFunction, metadata *Metadata) *FunctionCall {\n\treturn &FunctionCall{callee, arguments, trailing, metadata}\n}", "func NewMeta(operands ...Expression) Function {\n\trv := &Meta{\n\t\t*NewFunctionBase(\"meta\", operands...),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewFunction(name, cname, comment, member string, typ Type) *Function {\n\tfunctionName := UpperFirstCharacter(name)\n\treceiverType := TrimLanguagePrefix(cname)\n\treceiverName := CommonReceiverName(receiverType)\n\n\tf := &Function{\n\t\tIncludeFiles: NewIncludeFiles(),\n\t\tName: functionName,\n\t\tCName: cname,\n\t\tComment: comment,\n\t\tParameters: []FunctionParameter{ // TODO(go-clang): this might not be needed if the receiver code is refactored: https://github.com/go-clang/gen/issues/52\n\t\t\t{\n\t\t\t\tName: receiverName,\n\t\t\t\tCName: cname,\n\t\t\t\tType: Type{\n\t\t\t\t\tGoName: receiverType,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tReturnType: typ,\n\t\tReceiver: Receiver{\n\t\t\tName: receiverName,\n\t\t\tType: Type{\n\t\t\t\tGoName: receiverType,\n\t\t\t},\n\t\t},\n\t\tMember: &FunctionParameter{\n\t\t\tName: member,\n\t\t\tType: typ,\n\t\t},\n\t}\n\n\treturn f\n}", "func NewConversion(from, to Unit, formula string) {\n\texpr, err := govaluate.NewEvaluableExpression(formula)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// create conversion function\n\tfn := func(x float64) float64 {\n\t\tparams := make(map[string]interface{})\n\t\tparams[\"x\"] = x\n\n\t\tres, err := expr.Evaluate(params)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\treturn res.(float64)\n\t}\n\n\tNewConversionFromFn(from, to, fn, formula)\n}", "func (this *ClockStr) Constructor() FunctionConstructor { return NewClockStr }", "func CreateNewExpr() Expr {\n\tc11 := Constant{value: 1.1}\n\tc22 := Constant{value: 2.2}\n\tc33 := Constant{value: 3.3}\n\tbp := BinaryPlus{left: &BinaryPlus{left: &c11, right: &c22}, right: &c33}\n\treturn &bp\n}", "func NewFunctionCall(name string, params []Expression, returnType Type) Expression {\n\treturn &functionCall{\n\t\tname: name,\n\t\tparams: params,\n\t\treturnType: returnType,\n\t}\n}", "func NewFunctionCall(name string, context string, args ...interface{}) FunctionCall {\n\treturn FunctionCall{name, context, args}\n}", "func (o *JS) New(args []interface{}) Object {\n\treturn &JS{o.object.New(args...)}\n}", "func (o *FakeObject) New(args ...interface{}) Object { return o.Invoke(args) }", "func NewObjectAdd(first, second, third Expression) Function {\n\trv := &ObjectAdd{\n\t\t*NewTernaryFunctionBase(\"object_add\", first, second, third),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func Constructor() MapSum {\n\treturn MapSum{}\n}", "func New(args ...float64) Tuple {\n\treturn args\n}", "func NewLiteral(arg interface{}) Expression {\n\treturn &Literal{Literal: NewDatum(arg)}\n}", "func Constructor() MapSum {\n \n}", "func ValueNew(typ Type) *Value {\n\tvar gvalue C.GValue\n\tvalue := ValueNewFromC(unsafe.Pointer(&gvalue))\n\tvalue.Init(typ)\n\n\treturn value\n}", "func execNewFunc(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\tret := types.NewFunc(token.Pos(args[0].(int)), args[1].(*types.Package), args[2].(string), args[3].(*types.Signature))\n\tp.Ret(4, ret)\n}", "func newFuncExpr(funcName FuncName, funcs ...Expr) (*funcExpr, error) {\n\tswitch funcName {\n\tcase Avg, Max, Min, Sum:\n\t\tif len(funcs) != 1 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly one argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errParseNonUnaryAgregateFunctionCall(err)\n\t\t}\n\n\t\tif !funcs[0].ReturnType().isNumberKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument %v evaluate to %v, not number\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase Count:\n\t\tif len(funcs) != 1 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly one argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errParseNonUnaryAgregateFunctionCall(err)\n\t\t}\n\n\t\tswitch funcs[0].ReturnType() {\n\t\tcase Null, Bool, Int, Float, String, Timestamp, column, record:\n\t\tdefault:\n\t\t\terr := fmt.Errorf(\"%v(): argument %v evaluate to %v is incompatible\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase CharLength, CharacterLength, Trim, Lower, Upper, ToTimestamp:\n\t\tif len(funcs) != 1 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly one argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\tif !funcs[0].ReturnType().isStringKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument %v evaluate to %v, not string\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase Coalesce:\n\t\tif len(funcs) < 1 {\n\t\t\terr := fmt.Errorf(\"%v(): one or more argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\tfor i := range funcs {\n\t\t\tif !funcs[i].ReturnType().isBaseKind() {\n\t\t\t\terr := fmt.Errorf(\"%v(): argument-%v %v evaluate to %v is incompatible\", funcName, i+1, funcs[i], funcs[i].ReturnType())\n\t\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t\t}\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase NullIf:\n\t\tif len(funcs) != 2 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly two arguments expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\tif !funcs[0].ReturnType().isBaseKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument-1 %v evaluate to %v is incompatible\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\tif !funcs[1].ReturnType().isBaseKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument-2 %v evaluate to %v is incompatible\", funcName, funcs[1], funcs[1].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase UTCNow:\n\t\tif len(funcs) != 0 {\n\t\t\terr := fmt.Errorf(\"%v(): no argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase Substring:\n\t\tif len(funcs) < 2 || len(funcs) > 3 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly two or three arguments expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\tif !funcs[0].ReturnType().isStringKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument-1 %v evaluate to %v, not string\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\tif !funcs[1].ReturnType().isIntKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument-2 %v evaluate to %v, not int\", funcName, funcs[1], funcs[1].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\tif len(funcs) > 2 {\n\t\t\tif !funcs[2].ReturnType().isIntKind() {\n\t\t\t\terr := fmt.Errorf(\"%v(): argument-3 %v evaluate to %v, not int\", funcName, funcs[2], funcs[2].ReturnType())\n\t\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t\t}\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\t}\n\n\treturn nil, errUnsupportedFunction(fmt.Errorf(\"unknown function name %v\", funcName))\n}", "func NewFunctionBase(ctx sctx.Context, funcName string, retType *types.FieldType, args ...Expression) (Expression, error) {\n\treturn newFunctionImpl(ctx, false, funcName, retType, args...)\n}", "func (v Value) New(args ...interface{}) Value {\n\tpanic(message)\n}", "func NewLambda(vs []Argument, u bool, as []Argument, e Expression, t types.Type) Lambda {\n\treturn Lambda{as, e, t, vs, u}\n}", "func FunctionVal(impl FunctionImpl) Value {\n\treturn Value{\n\t\tty: Function(impl.Signature),\n\t\tv: &impl,\n\t}\n}", "func FunctionValue(c Callable) Value {\n\treturn Value{iface: c}\n}", "func NewFunction(fn string) *JFunction {\n\t//stats := gctx.Value(EelTotalStats).(*ServiceStats)\n\tswitch fn {\n\tcase \"curl\":\n\t\t// hit external web service\n\t\t// method - POST, GET etc.\n\t\t// url - url of external service\n\t\t// payload - payload to be sent to external service\n\t\t// headers - headers to be sent to external service\n\t\t// retries - if true, applies retry policy as specified in config.json in case of failure, no retries if false\n\t\t// curl('<method>','<url>',['<payload>'],['<header-map>'],['<retries>'])\n\t\t// example curl('POST', 'http://foo.com/bar/json', 'foo-{{/content/bar}}')\n\t\treturn &JFunction{fnCurl, 2, 5}\n\tcase \"hmac\":\n\t\t// hmac(\"<hashFunc>\", '<input>', '<key>')\n\t\treturn &JFunction{fnHmac, 3, 3}\n\tcase \"oauth2\":\n\t\t// perform a HTTP request to a given url using 2-legged oauth2 authentication.\n\t\t// url - the url\n\t\t// oauth2Cred - the oauth2 credential in the custom property. It is expected to have the following 3 property\n\t\t// values - ClientId, ClientSecret, TokenURL.\n\t\t// method - optional. The http method. Default is GET\n\t\t// payload - optional. The body payload normally for POST or PUT method\n\t\t// oauth2(\"<url>\", '<oauth2Cred>')\n\t\treturn &JFunction{fnOauth2, 2, 4}\n\tcase \"loadfile\":\n\t\t// loadfile(\"<filename>')\n\t\treturn &JFunction{fnLoadFile, 1, 1}\n\tcase \"uuid\":\n\t\t// returns UUID string\n\t\t// uuid()\n\t\treturn &JFunction{fnUuid, 0, 0}\n\tcase \"header\":\n\t\t// returns a value given the http request header key, or all headers if no key is given\n\t\t// header('mykey')\n\t\treturn &JFunction{fnHeader, 0, 1}\n\tcase \"param\":\n\t\t// returns a value given the http request query string parameter key, or all headers if no key is given\n\t\t// param('mykey')\n\t\treturn &JFunction{fnParam, 0, 1}\n\tcase \"ident\":\n\t\t// returns input parameter unchanged, for debugging only\n\t\t// ident('foo')\n\t\treturn &JFunction{fnIdent, 1, 1}\n\tcase \"upper\":\n\t\t// upper case input string, example upper('foo')\n\t\treturn &JFunction{fnUpper, 1, 1}\n\tcase \"lower\":\n\t\t// lower case input string, example lower('foo')\n\t\treturn &JFunction{fnLower, 1, 1}\n\tcase \"base64decode\":\n\t\t// base64 decode input string, example base64decode('foo')\n\t\treturn &JFunction{fnBase64Decode, 1, 1}\n\tcase \"substr\":\n\t\t// substring by start and end index, example substr('foo', 0, 1)\n\t\treturn &JFunction{fnSubstr, 3, 3}\n\tcase \"eval\":\n\t\t// evaluates simple path expression on current document and returns result\n\t\treturn &JFunction{fnEval, 1, 2}\n\tcase \"prop\":\n\t\t// return property from CustomProperties section in config.json\n\t\treturn &JFunction{fnProp, 1, 1}\n\tcase \"propexists\":\n\t\t// check whether or not a property exists\n\t\treturn &JFunction{fnPropExists, 1, 1}\n\tcase \"js\":\n\t\t// execute arbitrary javascript and return result\n\t\treturn &JFunction{fnJs, 1, 100}\n\tcase \"alt\":\n\t\t// return first non blank parameter (alternative)\n\t\treturn &JFunction{fnAlt, 2, 100}\n\tcase \"case\":\n\t\t// simplification of nested ifte(equals(),'foo', ifte(equals(...),...)) cascade\n\t\t// case('<path_1>','<comparison_value_1>','<return_value_1>', '<path_2>','<comparison_value_2>','<return_value_2>,...,'<default>')\n\t\treturn &JFunction{fnCase, 3, 100}\n\tcase \"regex\":\n\t\t// apply regex to string value and return (first) result: regex('<string>', '<regex>')\n\t\treturn &JFunction{fnRegex, 2, 3}\n\tcase \"match\":\n\t\t// apply regex to string value and return true if matches: match('<string>', '<regex>')\n\t\treturn &JFunction{fnMatch, 2, 2}\n\tcase \"hassuffix\":\n\t\t// check whether or not a string has suffix: match('<string>', '<suffix>')\n\t\treturn &JFunction{fnHasSuffix, 2, 2}\n\tcase \"and\":\n\t\t// boolean and: and('<bool>', '<bool>', ...)\n\t\treturn &JFunction{fnAnd, 1, 100}\n\tcase \"or\":\n\t\t// boolean or: or('<bool>', '<bool>', ...)\n\t\treturn &JFunction{fnOr, 1, 100}\n\tcase \"not\":\n\t\t// boolean not: not('<bool>')\n\t\treturn &JFunction{fnNot, 1, 1}\n\tcase \"contains\":\n\t\t// checks if document contains another document: contains('<doc1>', ['<doc2>'])\n\t\treturn &JFunction{fnContains, 1, 2}\n\tcase \"equals\":\n\t\t// checks if document is equal to another json document or if two strings are equal: equals('<doc1>',['<doc2>'])\n\t\treturn &JFunction{fnEquals, 1, 2}\n\tcase \"join\":\n\t\t// merges two json documents into one, key conflicts are resolved at random\n\t\treturn &JFunction{fnJoin, 2, 2}\n\tcase \"stringtojson\":\n\t\t// input is a string and output is json object\n\t\t// input example:{\\\"timestamp\\\": 1602873483}\n\t\treturn &JFunction{fnStringToJson, 1, 1}\n\tcase \"format\":\n\t\t// formats time string: format('<ms>',['<layout>'],['<timezone>']), example: format('1439962298000','Mon Jan 2 15:04:05 2006','PST')\n\t\treturn &JFunction{fnFormat, 1, 3}\n\tcase \"ifte\":\n\t\t// if condition then this else that: ifte('<condition>','<then>',['<else>']), example: ifte('{{equals('{{/data/name}}','')}}','','by {{/data/name}}')\n\t\treturn &JFunction{fnIfte, 1, 3}\n\tcase \"transform\":\n\t\t// apply transformation: transform('<name_of_transformation>', '<doc>', ['<pattern>'], ['<join>']), example: transform('my_transformation', '{{/content}}')\n\t\t// - the transformation is selected by name from an optional transformation map in the handler config\n\t\t// - if the document is an array, the transformation will be iteratively applied to all array elements\n\t\t// - if a pattern is provided will only be applied if document is matching the pattern\n\t\t// - if a join is provided it will be joined with the document before applying the transformation\n\t\treturn &JFunction{fnTransform, 1, 4}\n\tcase \"itransform\":\n\t\t// apply transformation iteratively: transform('<name_of_transformation>', '<doc>', ['<pattern>'], ['<join>']), example: transform('my_transformation', '{{/content}}')\n\t\t// - the transformation is selected by name from an optional transformation map in the handler config\n\t\t// - if the document is an array, the transformation will be iteratively applied to all array elements\n\t\t// - if a pattern is provided will only be applied if document is matching the pattern\n\t\t// - if a join is provided it will be joined with the document before applying the transformation\n\t\treturn &JFunction{fnITransform, 1, 4}\n\tcase \"etransform\":\n\t\t// apply external transformation and return single result (efficient shortcut for and equivalent to curl http://localhost:8080/proc)\n\t\treturn &JFunction{fnETransform, 1, 1}\n\tcase \"ptransform\":\n\t\t// apply external transformation and execute publisher(s) (efficient shortcut for and equivalent to curl http://localhost:8080/proxy)\n\t\treturn &JFunction{fnPTransform, 1, 1}\n\tcase \"true\":\n\t\t// returns always true, shorthand for equals('1', '1')\n\t\treturn &JFunction{fnTrue, 0, 0}\n\tcase \"false\":\n\t\t// returns always false, shorthand for equals('1', '2')\n\t\treturn &JFunction{fnFalse, 0, 0}\n\tcase \"time\":\n\t\t// returns current time as timestamp\n\t\treturn &JFunction{fnTime, 0, 0}\n\tcase \"tenant\":\n\t\t// returns tenant of current handler\n\t\treturn &JFunction{fnTenant, 0, 0}\n\tcase \"partner\":\n\t\t// returns partner of current handler\n\t\treturn &JFunction{fnPartner, 0, 0}\n\tcase \"traceid\":\n\t\t// returns current trace id used for logging\n\t\treturn &JFunction{fnTraceId, 0, 0}\n\tcase \"choose\":\n\t\t// chooses elements for list or array based on pattern\n\t\treturn &JFunction{fnChoose, 2, 2}\n\tcase \"crush\":\n\t\t// collapse a JSON document into a flat array\n\t\treturn &JFunction{fnCrush, 1, 1}\n\tcase \"len\":\n\t\t// returns length of object (string, array, map)\n\t\treturn &JFunction{fnLen, 1, 1}\n\tcase \"string\":\n\t\t// returns length of object (string, array, map)\n\t\treturn &JFunction{fnString, 2, 2}\n\tcase \"exists\":\n\t\t// returns true if path exists in document\n\t\treturn &JFunction{fnExists, 1, 2}\n\tcase \"calc\":\n\t\t// evaluates simple arithmetic expressions in native go and returns result\n\t\treturn &JFunction{fnCalc, 1, 1}\n\tcase \"log\":\n\t\t// logs parameter for debuging\n\t\treturn &JFunction{fnLog, 1, 1}\n\tcase \"hash\":\n\t\t// hash a given string\n\t\treturn &JFunction{fnHash, 1, 1}\n\tcase \"hashmod\":\n\t\t// hash a given string and then mod it by the given divider\n\t\treturn &JFunction{fnHashMod, 2, 2}\n\tcase \"toTS\":\n\t\t//Take a timestamp string and convert it to unix ts in milliseconds\n\t\treturn &JFunction{fnToTS, 2, 2}\n\tdefault:\n\t\t//gctx.Log.Error(\"error_type\", \"func_\", \"op\", fn, \"cause\", \"not_implemented\")\n\t\t//stats.IncErrors()\n\t\treturn nil\n\t}\n}", "func New(value interface{}) interface{} {\n\trv := reflect.ValueOf(value)\n\tif rv.Type().Kind() == reflect.Ptr {\n\t\treturn value\n\t}\n\trp := reflect.New(rv.Type())\n\trp.Elem().Set(rv)\n\treturn rp.Interface()\n}", "func (l *Lifter) NewFunc(asmFunc *x86.Func) *Func {\n\tentry := asmFunc.Addr\n\tf, ok := l.Funcs[entry]\n\tif !ok {\n\t\t// TODO: Add proper support for type signatures once type analysis has\n\t\t// been conducted.\n\t\tname := fmt.Sprintf(\"f_%06X\", uint64(entry))\n\t\tsig := types.NewFunc(types.Void)\n\t\ttyp := types.NewPointer(sig)\n\t\tf = &Func{\n\t\t\tFunc: &ir.Func{\n\t\t\t\tTyp: typ,\n\t\t\t\tSig: sig,\n\t\t\t},\n\t\t}\n\t\tf.SetName(name)\n\t\tmd := &metadata.Attachment{\n\t\t\tName: \"addr\",\n\t\t\tNode: &metadata.Tuple{\n\t\t\t\tFields: []metadata.Field{&metadata.String{Value: entry.String()}},\n\t\t\t},\n\t\t}\n\t\tf.Metadata = append(f.Metadata, md)\n\t}\n\tf.AsmFunc = asmFunc\n\tf.blocks = make(map[bin.Address]*ir.Block)\n\tf.regs = make(map[x86asm.Reg]*ir.InstAlloca)\n\tf.statusFlags = make(map[StatusFlag]*ir.InstAlloca)\n\tf.fstatusFlags = make(map[FStatusFlag]*ir.InstAlloca)\n\tf.locals = make(map[string]*ir.InstAlloca)\n\tf.l = l\n\t// Prepare output LLVM IR basic blocks.\n\tfor addr := range asmFunc.Blocks {\n\t\tlabel := fmt.Sprintf(\"block_%06X\", uint64(addr))\n\t\tblock := ir.NewBlock(label)\n\t\tf.blocks[addr] = block\n\t}\n\t// Preprocess the function to assess if any instruction makes use of EDX:EAX\n\t// (e.g. IDIV).\n\tfor _, bb := range asmFunc.Blocks {\n\t\tfor _, inst := range bb.Insts {\n\t\t\tswitch inst.Op {\n\t\t\t// TODO: Identify more instructions which makes use of the FPU register\n\t\t\t// stack.\n\t\t\tcase x86asm.F2XM1, x86asm.FABS, x86asm.FADD, x86asm.FADDP, x86asm.FBLD,\n\t\t\t\tx86asm.FBSTP, x86asm.FCHS, x86asm.FCMOVB, x86asm.FCMOVBE,\n\t\t\t\tx86asm.FCMOVE, x86asm.FCMOVNB, x86asm.FCMOVNBE, x86asm.FCMOVNE,\n\t\t\t\tx86asm.FCMOVNU, x86asm.FCMOVU, x86asm.FCOM, x86asm.FCOMI,\n\t\t\t\tx86asm.FCOMIP, x86asm.FCOMP, x86asm.FCOMPP, x86asm.FCOS,\n\t\t\t\tx86asm.FDECSTP, x86asm.FDIV, x86asm.FDIVP, x86asm.FDIVR, x86asm.FDIVRP,\n\t\t\t\tx86asm.FFREE, x86asm.FFREEP, x86asm.FIADD, x86asm.FICOM, x86asm.FICOMP,\n\t\t\t\tx86asm.FIDIV, x86asm.FIDIVR, x86asm.FILD, x86asm.FIMUL, x86asm.FINCSTP,\n\t\t\t\tx86asm.FIST, x86asm.FISTP, x86asm.FISTTP, x86asm.FISUB, x86asm.FISUBR,\n\t\t\t\tx86asm.FLD, x86asm.FLD1, x86asm.FLDCW, x86asm.FLDENV, x86asm.FLDL2E,\n\t\t\t\tx86asm.FLDL2T, x86asm.FLDLG2, x86asm.FLDLN2, x86asm.FLDPI, x86asm.FLDZ,\n\t\t\t\tx86asm.FMUL, x86asm.FMULP, x86asm.FNCLEX, x86asm.FNINIT, x86asm.FNOP,\n\t\t\t\tx86asm.FNSAVE, x86asm.FNSTCW, x86asm.FNSTENV, x86asm.FNSTSW,\n\t\t\t\tx86asm.FPATAN, x86asm.FPREM, x86asm.FPREM1, x86asm.FPTAN,\n\t\t\t\tx86asm.FRNDINT, x86asm.FRSTOR, x86asm.FSCALE, x86asm.FSIN,\n\t\t\t\tx86asm.FSINCOS, x86asm.FSQRT, x86asm.FST, x86asm.FSTP, x86asm.FSUB,\n\t\t\t\tx86asm.FSUBP, x86asm.FSUBR, x86asm.FSUBRP, x86asm.FTST, x86asm.FUCOM,\n\t\t\t\tx86asm.FUCOMI, x86asm.FUCOMIP, x86asm.FUCOMP, x86asm.FUCOMPP,\n\t\t\t\tx86asm.FWAIT, x86asm.FXAM, x86asm.FXCH, x86asm.FXRSTOR,\n\t\t\t\tx86asm.FXRSTOR64, x86asm.FXSAVE, x86asm.FXSAVE64, x86asm.FXTRACT,\n\t\t\t\tx86asm.FYL2X, x86asm.FYL2XP1:\n\t\t\t\tf.usesFPU = true\n\t\t\t// TODO: Identify more instructions which makes use of EDX:EAX.\n\t\t\tcase x86asm.IDIV:\n\t\t\t\tf.usesEDX_EAX = true\n\t\t\t}\n\t\t}\n\t}\n\treturn f\n}", "func (n *TableValuedFunction) Clone() *TableValuedFunction {\n\tif n == nil {\n\t\treturn nil\n\t}\n\tother := *n\n\tother.Name = n.Name.Clone()\n\tother.Alias = n.Alias.Clone()\n\treturn &other\n}", "func New(fn interface{}, validateFunc func(*FunctionCache) error) (*GenericFunc, error) {\n\tcache := &FunctionCache{}\n\tcache.FnValue = reflect.ValueOf(fn)\n\n\tif cache.FnValue.Kind() != reflect.Func {\n\t\treturn nil, errors.New(\"GenericFunc.New: fn is not a function\")\n\t}\n\n\tcache.FnType = cache.FnValue.Type()\n\tnumTypesIn := cache.FnType.NumIn()\n\tcache.TypesIn = make([]reflect.Type, numTypesIn)\n\tfor i := 0; i < numTypesIn; i++ {\n\t\tcache.TypesIn[i] = cache.FnType.In(i)\n\t}\n\n\tnumTypesOut := cache.FnType.NumOut()\n\tcache.TypesOut = make([]reflect.Type, numTypesOut)\n\tfor i := 0; i < numTypesOut; i++ {\n\t\tcache.TypesOut[i] = cache.FnType.Out(i)\n\t}\n\tif err := validateFunc(cache); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &GenericFunc{Cache: cache}, nil\n}", "func NewValue(val interface{}) *Value {\n\tswitch val := val.(type) {\n\tcase nil:\n\t\treturn newNullValue()\n\tcase bool:\n\t\treturn newBooleanValue(val)\n\tcase float64:\n\t\treturn newNumberValue(val)\n\tcase string:\n\t\treturn newStringValue(val)\n\tcase []interface{}:\n\t\treturn newArrayValue(val)\n\tcase map[string]interface{}:\n\t\treturn newObjectValue(val)\n\tcase *Value:\n\t\treturn val\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Cannot create value for type %T\", val))\n\t}\n}", "func NewCallback(fnc func(v []Value)) Callback {\n\treturn CallbackOf(fnc)\n}", "func NewObjectInnerValues(operand Expression) Function {\n\trv := &ObjectInnerValues{\n\t\t*NewUnaryFunctionBase(\"object_innervalues\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func (er *expressionRewriter) newFunction(funcName string, retType *types.FieldType, args ...expression.Expression) (expression.Expression, error) {\n\ttrace_util_0.Count(_expression_rewriter_00000, 275)\n\tif er.disableFoldCounter > 0 {\n\t\ttrace_util_0.Count(_expression_rewriter_00000, 277)\n\t\treturn expression.NewFunctionBase(er.ctx, funcName, retType, args...)\n\t}\n\ttrace_util_0.Count(_expression_rewriter_00000, 276)\n\treturn expression.NewFunction(er.ctx, funcName, retType, args...)\n}", "func NewValues() *Values {\n\tv := &Values{\n\t\tm: map[string]interface{}{\n\t\t\tInputKey: map[string]interface{}{},\n\t\t\tResolverInputKey: map[string]interface{}{},\n\t\t\tStepKey: map[string]interface{}{},\n\t\t\tTaskKey: map[string]interface{}{},\n\t\t\tConfigKey: map[string]interface{}{},\n\t\t\tVarKey: map[string]*Variable{},\n\t\t\tIteratorKey: nil,\n\t\t},\n\t}\n\tv.funcMap = sprig.FuncMap()\n\tv.funcMap[\"field\"] = v.fieldTmpl\n\tv.funcMap[\"jsonfield\"] = v.jsonFieldTmpl\n\tv.funcMap[\"jsonmarshal\"] = v.jsonMarshal\n\tv.funcMap[\"eval\"] = v.varEval\n\treturn v\n}", "func NewSelf() Function {\n\trv := &Self{\n\t\t*NewNullaryFunctionBase(\"self\"),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func Constructor() TwoSum {\n\treturn TwoSum{data: map[int]int{}}\n}", "func NewFunctionCall(name string) *FunctionCall {\n\tfc := new(FunctionCall)\n\tfc.addr = C.LookupSymAddr(C.CString(name))\n\treturn fc\n}", "func New() *Compiler {\n\tmainScope := CompilationScope{\n\t\tinstructions: code.Instructions{},\n\t\tlastInstruction: EmittedInstruction{},\n\t\tpreviousInstruction: EmittedInstruction{},\n\t}\n\ttable := NewSymbolTable()\n\tfor i, fn := range object.GetBuiltins() {\n\t\ttable.DefineBuiltin(i, fn.Name)\n\t}\n\treturn &Compiler{\n\t\tconstants: []object.Object{},\n\t\tscopes: []CompilationScope{mainScope},\n\t\tscopeIndex: 0,\n\t\tsymbolTable: table,\n\t}\n}", "func NewMapper(m func(srcPtr interface{}, destPtr interface{}) error) Mapper {\n return funcMapper(m)\n}" ]
[ "0.73529464", "0.7189014", "0.6843478", "0.6823034", "0.6823034", "0.67909425", "0.67158616", "0.6683737", "0.66169643", "0.66169643", "0.65581906", "0.65378344", "0.6475921", "0.64629835", "0.64629835", "0.64201945", "0.63533115", "0.63398314", "0.6316713", "0.63069826", "0.6253961", "0.6219394", "0.6204833", "0.6179284", "0.6076211", "0.6047216", "0.60444695", "0.60120755", "0.5978478", "0.59101886", "0.5908223", "0.5906591", "0.59060675", "0.5885702", "0.5885702", "0.58703417", "0.5866278", "0.5864386", "0.5828599", "0.57983434", "0.5727054", "0.56855655", "0.56396276", "0.56370735", "0.5622132", "0.56082165", "0.5567968", "0.55559546", "0.55389684", "0.5534401", "0.55164576", "0.547767", "0.5435908", "0.5381186", "0.5373272", "0.53531337", "0.53404194", "0.5339884", "0.53394175", "0.53337073", "0.5332218", "0.5331294", "0.5322541", "0.53212875", "0.5314067", "0.53058827", "0.53013843", "0.52998775", "0.5280981", "0.5271829", "0.52665025", "0.52418345", "0.523326", "0.5224023", "0.5210567", "0.5197249", "0.5192305", "0.5187232", "0.51810205", "0.5168242", "0.5167752", "0.51560557", "0.5146329", "0.5144341", "0.5142319", "0.51359576", "0.51253015", "0.5097682", "0.50972664", "0.5096979", "0.5092192", "0.50838447", "0.5075114", "0.5074675", "0.50697786", "0.5066166", "0.50608003", "0.50601923", "0.5059925" ]
0.78348684
1
UnmarshalText fills structure fields from text data
func (t *Texture) UnmarshalText(text []byte) error { textureImage, _ := utils.Try2(ebitenutil.NewImageFromFile(string(text))) t.Image = textureImage return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Rat) UnmarshalText(text []byte) error {}", "func (record *Packed) UnmarshalText(s []byte) error {\n\tsize := hex.DecodedLen(len(s))\n\t*record = make([]byte, size)\n\t_, err := hex.Decode(*record, s)\n\treturn err\n}", "func (u tu) UnmarshalText(data []byte) error {\n\tu.Text = string(data)\n\treturn nil\n}", "func (f *Field) UnmarshalText(p []byte) error {\n\tr, err := Parse(string(p))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf.reference = r\n\treturn nil\n}", "func (f *Field) UnmarshalText(text []byte) error {\n\tfield, err := NewField(string(text))\n\t*f = field\n\treturn err\n}", "func (txt *txt) UnmarshalText(b []byte) error {\n\t(*txt).string = string(append(b, '_'))\n\treturn nil\n}", "func (dt *Dairytime) UnmarshalText(text []byte) (err error) {\n\tif text == nil {\n\t\treturn nil\n\t}\n\tif len(text) == 0 {\n\t\treturn nil\n\t}\n\n\tdt.Time, _ = time.Parse(timeLayout, string(text))\n\treturn nil\n}", "func (info *Info) UnmarshalText(text []byte) error {\n\tparts := strings.Split(string(text), \" \")\n\tif len(parts) == 0 {\n\t\treturn errors.New(\"uci: invalid info line \" + string(text))\n\t}\n\tif parts[0] != \"info\" {\n\t\treturn errors.New(\"uci: invalid info line \" + string(text))\n\t}\n\tref := \"\"\n\tfor i := 1; i < len(parts); i++ {\n\t\ts := parts[i]\n\t\tswitch s {\n\t\tcase \"score\":\n\t\t\tcontinue\n\t\tcase \"lowerbound\":\n\t\t\tinfo.Score.LowerBound = true\n\t\t\tcontinue\n\t\tcase \"upperbound\":\n\t\t\tinfo.Score.UpperBound = true\n\t\t\tcontinue\n\t\t}\n\t\tif ref == \"\" {\n\t\t\tref = s\n\t\t\tcontinue\n\t\t}\n\t\tswitch ref {\n\t\tcase \"depth\":\n\t\t\tv, err := strconv.Atoi(s)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tinfo.Depth = v\n\t\tcase \"seldepth\":\n\t\t\tv, err := strconv.Atoi(s)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tinfo.Seldepth = v\n\t\tcase \"multipv\":\n\t\t\tv, err := strconv.Atoi(s)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tinfo.Multipv = v\n\t\tcase \"cp\":\n\t\t\tv, err := strconv.Atoi(s)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tinfo.Score.CP = v\n\t\tcase \"nodes\":\n\t\t\tv, err := strconv.Atoi(s)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tinfo.Nodes = v\n\t\tcase \"mate\":\n\t\t\tv, err := strconv.Atoi(s)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tinfo.Score.Mate = v\n\t\tcase \"currmovenumber\":\n\t\t\tv, err := strconv.Atoi(s)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tinfo.CurrentMoveNumber = v\n\t\tcase \"currmove\":\n\t\t\tm, err := chess.UCINotation{}.Decode(nil, s)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tinfo.CurrentMove = m\n\t\tcase \"hashfull\":\n\t\t\tv, err := strconv.Atoi(s)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tinfo.Hashfull = v\n\t\tcase \"tbhits\":\n\t\t\tv, err := strconv.Atoi(s)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tinfo.TBHits = v\n\t\tcase \"time\":\n\t\t\tv, err := strconv.Atoi(s)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tinfo.Time = time.Millisecond * time.Duration(v)\n\t\tcase \"nps\":\n\t\t\tv, err := strconv.Atoi(s)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tinfo.NPS = v\n\t\tcase \"cpuload\":\n\t\t\tv, err := strconv.Atoi(s)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tinfo.CPULoad = v\n\t\tcase \"pv\":\n\t\t\tm, err := chess.UCINotation{}.Decode(nil, s)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tinfo.PV = append(info.PV, m)\n\t\t}\n\t\tif ref != \"pv\" {\n\t\t\tref = \"\"\n\t\t}\n\t}\n\treturn nil\n}", "func (t *Time) UnmarshalText(data []byte) error {}", "func (x *PackageType) UnmarshalText(text []byte) error {\n\tname := string(text)\n\ttmp, err := ParsePackageType(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = tmp\n\treturn nil\n}", "func (r *RootableField) UnmarshalText(text []byte) error {\n\tfield, err := newField(string(text), true)\n\t*r = RootableField{Field: field}\n\treturn err\n}", "func (i *Transform) UnmarshalText(text []byte) error {\n\tvar err error\n\t*i, err = ParseTransformString(string(text))\n\treturn err\n}", "func (b *Block) UnmarshalText(text []byte) error {\n\tdecoded := make([]byte, hex.DecodedLen(len(text)))\n\t_, err := hex.Decode(decoded, text)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn b.FromBytes(decoded)\n}", "func unmarshal(text []byte, fields *map[string]interface{}) error {\n\tdec := json.NewDecoder(bytes.NewReader(text))\n\tdec.UseNumber()\n\terr := dec.Decode(fields)\n\tif err != nil {\n\t\treturn err\n\t}\n\tjsontransform.TransformNumbers(*fields)\n\treturn nil\n}", "func (i *MessageType) UnmarshalText(text []byte) error {\n\tvar err error\n\t*i, err = MessageTypeString(string(text))\n\treturn err\n}", "func (i *TaskType) UnmarshalText(text []byte) error {\n\tvar err error\n\t*i, err = TaskTypeString(string(text))\n\treturn err\n}", "func (x *ComplexCommented) UnmarshalText(text []byte) error {\n\tname := string(text)\n\ttmp, err := ParseComplexCommented(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = tmp\n\treturn nil\n}", "func (x *Commented) UnmarshalText(text []byte) error {\n\tname := string(text)\n\ttmp, err := ParseCommented(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = tmp\n\treturn nil\n}", "func (key *Key) UnmarshalText(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\n\tparsedKey, err := parseKey(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*key = parsedKey\n\treturn nil\n}", "func (u *CreditCard) UnmarshalText(data []byte) error { // validation is performed later on\n\t*u = CreditCard(string(data))\n\treturn nil\n}", "func (f *Feature) UnmarshalText(b []byte) error {\n\tvar f0 int\n\tvar err error\n\tif len(b) > 0 {\n\t\tif b[0] >= '0' && b[0] <= '9' {\n\t\t\tf0, err = strconv.Atoi(string(b))\n\t\t} else {\n\t\tLoop:\n\t\t\tfor i := 0; i < len(b); i++ {\n\t\t\t\tswitch b[i] {\n\t\t\t\tcase 'V', 'v':\n\t\t\t\t\tf0 |= int(FeatureValidated)\n\t\t\t\tcase 'L', 'l':\n\t\t\t\t\tf0 |= int(FeatureNoLogin)\n\t\t\t\tdefault:\n\t\t\t\t\terr = errors.New(\"Feature: invalid character '\" + string(b[i]) + \"'\")\n\t\t\t\t\tbreak Loop\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t*f = Feature(f0)\n\n\treturn err\n}", "func (r *Resource) UnmarshalText(txt []byte) error {\n\telements := bytes.Split(txt, []byte(\" \"))\n\n\tif len(elements) < 3 {\n\t\treturn fmt.Errorf(\"invalid resource text\")\n\t}\n\n\ttmp := Resource{}\n\n\tif err := (&tmp.ID).UnmarshalText(elements[0]); err != nil {\n\t\treturn fmt.Errorf(\"parsing ID from text: %+v\", err)\n\t}\n\n\tif err := (&tmp.Status).UnmarshalText(elements[1]); err != nil {\n\t\treturn fmt.Errorf(\"parsing Status from text: %+v\", err)\n\t}\n\n\tif err := (&tmp.Since).UnmarshalText(elements[2]); err != nil {\n\t\treturn fmt.Errorf(\"parsing Since from text: %+v\", err)\n\t}\n\tif tmp.Since.IsZero() {\n\t\ttmp.Since = time.Time{}\n\t}\n\n\t*r = tmp\n\n\treturn nil\n}", "func (z *Float) UnmarshalText(text []byte) error {}", "func (x Group) UnmarshalText(text []byte) (Group, *Error) {\n\tname := string(text)\n\ttmp, err := ParseGroup(name)\n\tif err != nil {\n\t\treturn GroupUnknown, err\n\t}\n\tx = tmp\n\treturn tmp, nil\n}", "func (r *Record) UnmarshalText(b []byte) error {\n\treturn r.UnmarshalSAM(nil, b)\n}", "func (a *Vector3) UnmarshalText(b []byte) error {\n\tv, err := ParseVector3(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\ta.Set(v)\n\treturn nil\n}", "func (f *Filter) UnmarshalText(text []byte) error {\n\tf.lock.Lock()\n\tdefer f.lock.Unlock()\n\n\tf2, err := UnmarshalText(text)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf.m = f2.m\n\tf.n = f2.n\n\tcopy(f.bits, f2.bits)\n\tcopy(f.keys, f2.keys)\n\n\treturn nil\n}", "func (t *Topic) UnmarshalText(text []byte) error {\n\tparts := bytes.SplitN(text, []byte(\".\"), 2)\n\tif len(parts) != 2 {\n\t\treturn errors.New(\"unparsable topic representation\")\n\t}\n\tt.SigningPrivateKey = new([64]byte)\n\tvar spk []byte\n\t_, err := fmt.Sscanf(string(parts[0]), \"%x\", &spk)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcopy(t.SigningPrivateKey[:], spk)\n\treturn t.Handle.UnmarshalText(parts[1])\n}", "func (t *UniversalMytoken) UnmarshalText(data []byte) (err error) {\n\ts := string(data)\n\t*t, err = Parse(log.StandardLogger(), s)\n\treturn errors.WithStack(err)\n}", "func (t *Type) UnmarshalText(text []byte) error {\n\tswitch strings.ToLower(string(text)) {\n\tdefault:\n\t\t*t = Unsupported\n\tcase \"int32\", \"integer\", \"uint32\":\n\t\t*t = Int32\n\tcase \"int64\", \"bigint\", \"long\", \"uint64\":\n\t\t*t = Int64\n\tcase \"float64\", \"double\":\n\t\t*t = Float64\n\tcase \"string\", \"text\", \"varchar\":\n\t\t*t = String\n\tcase \"bool\", \"boolean\":\n\t\t*t = Bool\n\tcase \"timestamp\", \"time\":\n\t\t*t = Timestamp\n\tcase \"json\", \"map\":\n\t\t*t = JSON\n\t}\n\treturn nil\n}", "func (t *Time) UnmarshalText(data []byte) error {\n\ttt, err := time.Parse(time.RFC3339, string(data))\n\tif _, ok := err.(*time.ParseError); ok {\n\t\ttt, err = time.Parse(DeisDatetimeFormat, string(data))\n\t\tif _, ok := err.(*time.ParseError); ok {\n\t\t\ttt, err = time.Parse(PyOpenSSLTimeDateTimeFormat, string(data))\n\t\t}\n\t}\n\t*t = Time{&tt}\n\treturn err\n}", "func (v *Feature) UnmarshalText(value []byte) error {\n\tswitch s := string(value); s {\n\tcase \"SERVICE_GENERATOR\":\n\t\t*v = FeatureServiceGenerator\n\t\treturn nil\n\tdefault:\n\t\tval, err := strconv.ParseInt(s, 10, 32)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unknown enum value %q for %q: %v\", s, \"Feature\", err)\n\t\t}\n\t\t*v = Feature(val)\n\t\treturn nil\n\t}\n}", "func (d *Date) UnmarshalText(data []byte) error {\n\tparsed, err := time.Parse(DateFormat, string(data))\n\tif err != nil {\n\t\treturn err\n\t}\n\td.Time = parsed\n\treturn nil\n}", "func (t *TopicType) UnmarshalText(input []byte) error {\n\treturn hexutil.UnmarshalFixedText(\"Topic\", input, t[:])\n}", "func (t *Type) UnmarshalText(text []byte) error {\n\ts := Type(text)\n\tfor _, keyType := range []Type{PublicKey, PrivateKey, SymmetricKey} {\n\t\tif keyType == s {\n\t\t\t*t = keyType\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn serrors.WithCtx(ErrUnsupportedType, \"input\", string(text))\n}", "func (p *Pair) UnmarshalText(d []byte) error {\n\tpair, err := PairFromString(string(d))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*p = pair\n\n\treturn nil\n}", "func (i *UOM) UnmarshalText(text []byte) error {\n\tvar err error\n\t*i, err = UOMString(string(text))\n\treturn err\n}", "func (t *Time) UnmarshalText(data []byte) error {\n\tstr := string(data)\n\tif str == \"\" || str == \"null\" {\n\t\tt.Valid = false\n\t\treturn nil\n\t}\n\n\tvar epochMsec int64\n\tif err := json.Unmarshal(data, &epochMsec); err != nil {\n\t\tt.Valid = false\n\t\treturn nil\n\t}\n\n\tt.Time = t.timeFromEpochMsec(epochMsec)\n\n\treturn nil\n}", "func (x *Prefecture) UnmarshalText(text []byte) error {\n\tname := string(text)\n\ttmp, err := ParsePrefecture(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = tmp\n\treturn nil\n}", "func (e *Event) UnmarshalText(text []byte) error {\n\ts := strings.Split(string(text), \":\")\n\tif len(s) != 2 {\n\t\treturn ErrEventFormat\n\t}\n\tt, err := strconv.ParseFloat(s[0], 64)\n\tif err != nil {\n\t\treturn ErrEventFormat\n\t}\n\ttimestamp := time.Duration(int64(t*1000)) * time.Millisecond\n\tvalue, err := strconv.ParseInt(s[1], 10, 16)\n\tif err != nil || value < 0 || value > 4 {\n\t\treturn ErrEventFormat\n\t}\n\t*e = Event{\n\t\tTime: timestamp,\n\t\tValue: int(value),\n\t}\n\treturn nil\n}", "func (os *OS) UnmarshalText(b []byte) error {\n\tsplit := bytes.Split(b, []byte(\":\"))\n\tif len(split) != 2 {\n\t\treturn trace.BadParameter(\"OS should be in format vendor:version, got %q\", b)\n\t}\n\tos.Vendor = string(split[0])\n\tos.Version = string(split[1])\n\treturn nil\n}", "func (t *timeRFC3339) UnmarshalText(data []byte) (err error) {\n\tt.Time, err = time.Parse(rfc3339Format, string(data))\n\treturn\n}", "func (u *IPv4) UnmarshalText(data []byte) error { // validation is performed later on\n\t*u = IPv4(string(data))\n\treturn nil\n}", "func (l *List) UnmarshalText(text []byte) error {\n\tm := parse.Bytes(text)\n\tdefer m.Release()\n\tcapacity := len(m.List)\n\tif len(m.Text) == 0 {\n\t\tcapacity += 2\n\t}\n\tlist := make(List, 0, capacity)\n\n\tif len(m.Text) > 0 {\n\t\tlist = append(list, \"msg\", string(m.Text))\n\t}\n\tfor _, v := range m.List {\n\t\tlist = append(list, string(v))\n\t}\n\t*l = list\n\treturn nil\n}", "func (d *Date) UnmarshalText(data []byte) (err error) {\n\td.Time, err = time.Parse(fullDate, string(data))\n\treturn err\n}", "func (ot *OutputType) UnmarshalText(text []byte) error {\n\tswitch strings.ToLower(string(text)) {\n\tcase \"file\":\n\t\t*ot = OutputFile\n\tcase \"stderr\":\n\t\t*ot = OutputStdErr\n\tcase \"both\":\n\t\t*ot = OutputBoth\n\t}\n\n\treturn nil\n}", "func (a *KeyAlgorithm) UnmarshalText(text []byte) error {\n\tname := string(text)\n\ttmp, err := ParseKeyAlgorithm(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*a = tmp\n\treturn nil\n}", "func (u *SSN) UnmarshalText(data []byte) error { // validation is performed later on\n\t*u = SSN(string(data))\n\treturn nil\n}", "func (v *Value) UnmarshalText(text []byte) error {\n\tif err := json.Unmarshal(text, v); err == nil {\n\t\treturn nil\n\t}\n\t*v = String(string(text))\n\treturn nil\n}", "func (e *Eth) UnmarshalText(text []byte) error {\n\tif _, ok := e.SetString(string(text), 10); !ok {\n\t\treturn fmt.Errorf(\"assets: cannot unmarshal %q into a *assets.Eth\", text)\n\t}\n\treturn nil\n}", "func (id *ID) UnmarshalText(text []byte) error {\n\tif len(text) != encodedLen {\n\t\treturn ErrInvalidID\n\t}\n\tdecode(id, text)\n\treturn nil\n}", "func (a *ArchType) UnmarshalText(text []byte) error {\n\tif u, ok := archTypeMap[string(text)]; ok {\n\t\t*a = u\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"unknown ArchType %q\", text)\n}", "func (u *Usage) UnmarshalText(text []byte) error {\n\ts := Usage(text)\n\tif _, ok := usages[s]; !ok {\n\t\treturn serrors.WithCtx(ErrUnsupportedUsage, \"input\", string(text))\n\t}\n\t*u = s\n\treturn nil\n}", "func (ll *Level) UnmarshalText(text []byte) error {\n\tswitch strings.ToLower(string(text)) {\n\tcase \"debug\":\n\t\t*ll = DebugLevel\n\tcase \"info\", \"information\":\n\t\t*ll = InfoLevel\n\tcase \"warn\", \"warning\":\n\t\t*ll = WarnLevel\n\tcase \"error\":\n\t\t*ll = ErrorLevel\n\tcase \"fatal\":\n\t\t*ll = FatalLevel\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown level: %s\", string(text))\n\t}\n\treturn nil\n}", "func (n *NodesID) UnmarshalText(text []byte) error {\n\tid, err := HexID(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*n = id\n\treturn nil\n}", "func (ns *Float32) UnmarshalText(text []byte) error {\n\treturn ns.UnmarshalJSON(text)\n}", "func (d *DateTime) UnmarshalText(data []byte) (err error) {\n\treturn d.Time.UnmarshalText(data)\n}", "func (f *F128d16) UnmarshalText(text []byte) error {\n\tf1, err := F128d16FromString(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*f = f1\n\treturn nil\n}", "func (h *Hostname) UnmarshalText(data []byte) error { // validation is performed later on\n\t*h = Hostname(string(data))\n\treturn nil\n}", "func (u *UUID4) UnmarshalText(data []byte) error { // validation is performed later on\n\t*u = UUID4(string(data))\n\treturn nil\n}", "func (i *OrderState) UnmarshalText(text []byte) error {\n\tvar err error\n\t*i, err = OrderStateString(string(text))\n\treturn err\n}", "func (x *IntShop) UnmarshalText(text []byte) error {\n\tname := string(text)\n\ttmp, err := ParseIntShop(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = tmp\n\treturn nil\n}", "func (i *ChannelName) UnmarshalText(text []byte) error {\n\tvar err error\n\t*i, err = ChannelNameString(string(text))\n\treturn err\n}", "func (account *Account) UnmarshalText(s []byte) error {\n\ta, err := AccountFromBase58(string(s))\n\tif nil != err {\n\t\treturn err\n\t}\n\taccount.AccountInterface = a.AccountInterface\n\treturn nil\n}", "func (v *ShortCode) UnmarshalText(b []byte) error {\n\tvar err error\n\t*v, err = NewShortCode(string(b))\n\treturn err\n}", "func (b *Bytes) UnmarshalText(hex []byte) error {\n\tif len(hex) == 0 {\n\t\treturn nil\n\t}\n\n\tarrayByte, err := hexutil.HexToBytes(string(hex))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*b = arrayByte\n\treturn nil\n}", "func (x *MainMatchingStatus) UnmarshalText(text []byte) error {\n\tname := string(text)\n\ttmp, err := ParseMainMatchingStatus(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = tmp\n\treturn nil\n}", "func FloatUnmarshalText(z *big.Float, text []byte) error", "func (x EnvironmentType) UnmarshalText(text []byte) (EnvironmentType, *errorAVA.Error) {\n\tname := string(text)\n\ttmp, err := ParseEnvironmentType(name)\n\tif err != nil {\n\t\treturn EnvironmentTypeUnknown, err\n\t}\n\tx = tmp\n\treturn tmp, nil\n}", "func (data *AlertData) UnmarshalText(text []byte) error {\n\ttype x AlertData\n\treturn json.Unmarshal(text, (*x)(data))\n}", "func (dt *DateTime) UnmarshalText(text []byte) error {\n\treturn dt.src.UnmarshalText(text)\n}", "func (m *Money) UnmarshalText(text []byte) (err error) {\n\t*m, err = Parse(string(text))\n\treturn\n}", "func (u *UUID) UnmarshalText(text []byte) error {\n\tid, err := Parse(text)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*u = id\n\treturn nil\n}", "func (v *SimpleType) UnmarshalText(value []byte) error {\n\tswitch s := string(value); s {\n\tcase \"BOOL\":\n\t\t*v = SimpleTypeBool\n\t\treturn nil\n\tcase \"BYTE\":\n\t\t*v = SimpleTypeByte\n\t\treturn nil\n\tcase \"INT8\":\n\t\t*v = SimpleTypeInt8\n\t\treturn nil\n\tcase \"INT16\":\n\t\t*v = SimpleTypeInt16\n\t\treturn nil\n\tcase \"INT32\":\n\t\t*v = SimpleTypeInt32\n\t\treturn nil\n\tcase \"INT64\":\n\t\t*v = SimpleTypeInt64\n\t\treturn nil\n\tcase \"FLOAT64\":\n\t\t*v = SimpleTypeFloat64\n\t\treturn nil\n\tcase \"STRING\":\n\t\t*v = SimpleTypeString\n\t\treturn nil\n\tcase \"STRUCT_EMPTY\":\n\t\t*v = SimpleTypeStructEmpty\n\t\treturn nil\n\tdefault:\n\t\tval, err := strconv.ParseInt(s, 10, 32)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unknown enum value %q for %q: %v\", s, \"SimpleType\", err)\n\t\t}\n\t\t*v = SimpleType(val)\n\t\treturn nil\n\t}\n}", "func (i *State) UnmarshalText(text []byte) error {\n\tvar err error\n\t*i, err = StateString(string(text))\n\treturn err\n}", "func (i *Time) UnmarshalText(b []byte) error {\n\tni, err := parseDuration(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*i = *ni\n\treturn nil\n}", "func (x *ContextKey) UnmarshalText(text []byte) error {\n\tname := string(text)\n\ttmp, err := ParseContextKey(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = tmp\n\treturn nil\n}", "func (drv *StorageDriver) UnmarshalText(name []byte) error {\n\tswitch string(name) {\n\tcase constants.DeviceMapper, constants.Overlay, constants.Overlay2, constants.Loopback, constants.ManifestStorageDriver:\n\t\t*drv = StorageDriver(name)\n\t\treturn nil\n\tdefault:\n\t\treturn trace.BadParameter(\"unknown storage driver %s\", name)\n\t}\n}", "func (level *LogFormat) UnmarshalText(text []byte) error {\n\tswitch logFormat := string(text); logFormat {\n\tcase \"plain\":\n\t\t*level = FormatPlain\n\tcase \"json\":\n\t\t*level = FormatJSON\n\tcase \"\":\n\t\t*level = FormatPlain\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown log format %s\", logFormat)\n\t}\n\treturn nil\n}", "func (u *UUID3) UnmarshalText(data []byte) error { // validation is performed later on\n\t*u = UUID3(string(data))\n\treturn nil\n}", "func (i *EventType) UnmarshalText(text []byte) error {\n\tvar err error\n\t*i, err = EventTypeString(string(text))\n\treturn err\n}", "func (dt *DateTime) UnmarshalText(text []byte) error {\n\treturn dt.Set(string(text))\n}", "func (r *ToS) UnmarshalText(data []byte) error {\n\tif v, ok := _tosNameToValue[string(data)]; ok {\n\t\t*r = v\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"invalid ToS %q\", string(data))\n}", "func (l *Level) UnmarshalText(text []byte) error {\n\tswitch string(text) {\n\tcase \"debug\":\n\t\t*l = DebugLevel\n\tcase \"info\":\n\t\t*l = InfoLevel\n\tcase \"warn\":\n\t\t*l = WarnLevel\n\tcase \"error\":\n\t\t*l = ErrorLevel\n\tcase \"panic\":\n\t\t*l = PanicLevel\n\tcase \"fatal\":\n\t\t*l = FatalLevel\n\tdefault:\n\t\treturn fmt.Errorf(\"unrecognized level: %v\", string(text))\n\t}\n\treturn nil\n}", "func (l *Level) UnmarshalText(text []byte) error {\n\tswitch string(text) {\n\tcase \"debug\":\n\t\t*l = DebugLevel\n\tcase \"info\":\n\t\t*l = InfoLevel\n\tcase \"warn\":\n\t\t*l = WarnLevel\n\tcase \"error\":\n\t\t*l = ErrorLevel\n\tcase \"panic\":\n\t\t*l = PanicLevel\n\tcase \"fatal\":\n\t\t*l = FatalLevel\n\tdefault:\n\t\treturn fmt.Errorf(\"unrecognized level: %v\", string(text))\n\t}\n\treturn nil\n}", "func (b *Bytes) UnmarshalText(data []byte) error {\n\tdata = bytes.TrimSpace(data)\n\tval, err := ParseBytes(reflectx.BytesToString(data))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"fail to unmarshal bytes : %v\", err)\n\t}\n\t*(*int64)(b) = val\n\treturn nil\n}", "func (b *ByteSize) UnmarshalText(text []byte) error {\n\treturn b.UnmarshalFlag(string(text))\n}", "func (i *UserGroupAccess) UnmarshalText(text []byte) error {\n\tvar err error\n\t*i, err = UserGroupAccessString(string(text))\n\treturn err\n}", "func (i *Int8) UnmarshalText(text []byte) error {\n\tstr := string(text)\n\tif str == \"\" || str == \"null\" {\n\t\ti.Valid = false\n\t\treturn nil\n\t}\n\tvar err error\n\tres, err := strconv.ParseInt(string(text), 10, 8)\n\ti.Valid = err == nil\n\tif i.Valid {\n\t\ti.Int8 = int8(res)\n\t}\n\treturn err\n}", "func (b *Balance) UnmarshalText(text []byte) error {\n\ts := util.TrimQuotes(string(text))\n\tv, err := strconv.ParseInt(s, 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif b.Int != nil {\n\t\tb.Int = nil\n\t}\n\tb.Int = new(big.Int).SetInt64(v)\n\n\treturn nil\n}", "func (d *Date) UnmarshalText(data []byte) error {\n\tvar err error\n\t*d, err = ParseDate(string(data))\n\treturn err\n}", "func (k *PublicKey) UnmarshalText(text []byte) error {\n\tif err := k.SetFromHex(string(text)); err != nil {\n\t\treturn errors.Wrapf(err, \"while parsing %s as public key\", text)\n\t}\n\treturn nil\n}", "func (x *XID) UnmarshalText(text []byte) (err error) {\n\t*x, err = ParseXID(b2s(text))\n\treturn\n}", "func (mvt *ValueType) UnmarshalText(text []byte) error {\n\tswitch vtStr := string(text); vtStr {\n\tcase \"string\":\n\t\tmvt.ValueType = pcommon.ValueTypeStr\n\tcase \"int\":\n\t\tmvt.ValueType = pcommon.ValueTypeInt\n\tcase \"double\":\n\t\tmvt.ValueType = pcommon.ValueTypeDouble\n\tcase \"bool\":\n\t\tmvt.ValueType = pcommon.ValueTypeBool\n\tcase \"bytes\":\n\t\tmvt.ValueType = pcommon.ValueTypeBytes\n\tcase \"slice\":\n\t\tmvt.ValueType = pcommon.ValueTypeSlice\n\tcase \"map\":\n\t\tmvt.ValueType = pcommon.ValueTypeMap\n\tdefault:\n\t\treturn fmt.Errorf(\"invalid type: %q\", vtStr)\n\t}\n\treturn nil\n}", "func RatUnmarshalText(z *big.Rat, text []byte) error", "func UnmarshalText(text []byte) (f *Filter, err error) {\n\tr := bytes.NewBuffer(text)\n\tk, n, m, err := unmarshalTextHeader(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkeys, err := newKeysBlank(k)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = unmarshalTextKeys(r, keys)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbits, err := newBits(m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = unmarshalTextBits(r, bits)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tf, err = newWithKeysAndBits(m, keys, bits, n)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = unmarshalAndCheckTextHash(r, f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn f, nil\n}", "func (z *Int) UnmarshalText(text []byte) error {}", "func (u *UUID) UnmarshalText(data []byte) error { // validation is performed later on\n\t*u = UUID(string(data))\n\treturn nil\n}", "func (e *Wei) UnmarshalText(text []byte) error {\n\tre := regexp.MustCompile(`^(\\d+[\\.]?[\\d]*)[ ]?([\\w]*)$`)\n\tmatched := re.FindSubmatch(text)\n\n\tif len(matched) != 3 {\n\t\treturn fmt.Errorf(\"failed to parse value: [%s]\", text)\n\t}\n\n\tnumber, ok := new(big.Float).SetString(string(matched[1]))\n\tif !ok {\n\t\treturn fmt.Errorf(\n\t\t\t\"failed to set float value from string [%s]\",\n\t\t\tstring(matched[1]),\n\t\t)\n\t}\n\n\tunit := matched[2]\n\tif len(unit) == 0 {\n\t\tunit = []byte(\"wei\")\n\t}\n\n\tswitch strings.ToLower(string(unit)) {\n\tcase strings.ToLower(ether.String()):\n\t\tnumber.Mul(number, big.NewFloat(params.Ether))\n\t\te.Int, _ = number.Int(nil)\n\tcase strings.ToLower(gwei.String()):\n\t\tnumber.Mul(number, big.NewFloat(params.GWei))\n\t\te.Int, _ = number.Int(nil)\n\tcase strings.ToLower(wei.String()):\n\t\tnumber.Mul(number, big.NewFloat(params.Wei))\n\t\te.Int, _ = number.Int(nil)\n\tdefault:\n\t\treturn fmt.Errorf(\n\t\t\t\"invalid unit: %s; please use one of: wei, Gwei, ether\",\n\t\t\tunit,\n\t\t)\n\t}\n\n\treturn nil\n}", "func (p *Protocol) UnmarshalText(text []byte) error {\n\tprotocol, ok := ParseProtocol(string(text))\n\tif !ok {\n\t\treturn fmt.Errorf(\"failed to parse protocol string %s\", text)\n\t}\n\n\t*p = protocol\n\n\treturn nil\n}" ]
[ "0.6836672", "0.6598402", "0.65422213", "0.6540831", "0.6502182", "0.6487281", "0.64397895", "0.6400636", "0.6398449", "0.63800514", "0.6366616", "0.6342884", "0.63396364", "0.63101435", "0.62852067", "0.62751365", "0.6274501", "0.62648505", "0.62611896", "0.62392396", "0.6237416", "0.62294227", "0.62251264", "0.62153614", "0.6211697", "0.6210667", "0.6202918", "0.6192316", "0.61849314", "0.6179528", "0.6175578", "0.61590624", "0.6157786", "0.6149584", "0.6147997", "0.6146388", "0.6125146", "0.61233723", "0.6121871", "0.6116373", "0.6107926", "0.6098569", "0.60931545", "0.609184", "0.6081992", "0.6078818", "0.6065526", "0.60499203", "0.6047733", "0.6036579", "0.60245657", "0.6013675", "0.60058963", "0.6004587", "0.60013384", "0.6000999", "0.599873", "0.599237", "0.5987901", "0.5985991", "0.5983367", "0.5969355", "0.59628516", "0.5950289", "0.59500176", "0.5943382", "0.59390557", "0.593851", "0.59377515", "0.5936351", "0.59362936", "0.59346986", "0.592957", "0.5929458", "0.5928985", "0.5928848", "0.59236866", "0.59207094", "0.5919334", "0.5918426", "0.59102756", "0.59066087", "0.5904671", "0.58989465", "0.58989465", "0.587269", "0.58715636", "0.5871398", "0.58674794", "0.5860459", "0.58600974", "0.58569515", "0.5850636", "0.5844637", "0.58408546", "0.5838916", "0.58325285", "0.5831808", "0.58306247", "0.5816056" ]
0.63764447
10
NewTransform creates a new default transform, corresponding to identity.
func NewTransform() *Transform { return &Transform{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewTransform() *Transform {\n\treturn transformPool.Get().(*Transform)\n}", "func NewTransform() Transform {\n\tt := transform{\n\t\tmodelView: mgl32.Ident4(),\n\t\trotation: mgl32.Vec3{0, 0, 0},\n\t\ttranslation: mgl32.Vec3{0, 0, 0},\n\t}\n\treturn &t\n}", "func (t *Transform) New() *Transform {\n\tret := NewTransform()\n\tret.SetParent(t)\n\treturn ret\n}", "func NewTransform() *Transform {\n\treturn &Transform{\n\t\tPosition: NewVector(0, 0),\n\t\tRotation: 0,\n\t\tScale: NewVector(1, 1),\n\t\tDim: NewVector(0, 0),\n\t}\n}", "func NewTransform2DIdentity() *Transform2D {\n\tvar dest C.godot_transform2d\n\tC.go_godot_transform2d_new_identity(GDNative.api, &dest)\n\treturn &Transform2D{base: &dest}\n}", "func New() *Transformer {\n\treturn &Transformer{}\n}", "func NewTransform(cfg *viper.Viper) (interface{}, error) {\n\tgremlinClient, err := client.NewGremlinQueryHelperFromConfig(core.CfgAuthOpts(cfg))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &vpclogsFlowTransformer{\n\t\tinterfaceIpCache: cache.New(10*time.Minute, 10*time.Minute),\n\t\tgremlinClient: gremlinClient,\n\t}, nil\n}", "func (s *schema) NewTransform(name string, input io.Reader, ctx *transformctx.Ctx) (Transform, error) {\n\tbr, err := ios.StripBOM(s.header.ParserSettings.WrapEncoding(input))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif ctx.InputName != name {\n\t\tctx.InputName = name\n\t}\n\tingester, err := s.handler.NewIngester(ctx, br)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// If caller already specified a way to do context aware error formatting, use it;\n\t// otherwise (vast majority cases), use the Ingester (which implements CtxAwareErr\n\t// interface) created by the schema handler.\n\tif ctx.CtxAwareErr == nil {\n\t\tctx.CtxAwareErr = ingester\n\t}\n\treturn &transform{ingester: ingester}, nil\n}", "func NewTransformation(ctx *pulumi.Context,\n\tname string, args *TransformationArgs, opts ...pulumi.ResourceOption) (*Transformation, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.Path == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Path'\")\n\t}\n\tvar resource Transformation\n\terr := ctx.RegisterResource(\"vault:transform/transformation:Transformation\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (eval *evaluator) LinearTransformNew(ctIn *Ciphertext, linearTransform interface{}) (ctOut []*Ciphertext) {\n\n\tswitch element := linearTransform.(type) {\n\tcase []PtDiagMatrix:\n\t\tctOut = make([]*Ciphertext, len(element))\n\n\t\tvar maxLevel int\n\t\tfor _, matrix := range element {\n\t\t\tmaxLevel = utils.MaxInt(maxLevel, matrix.Level)\n\t\t}\n\n\t\tminLevel := utils.MinInt(maxLevel, ctIn.Level())\n\n\t\teval.DecomposeNTT(minLevel, eval.params.PCount()-1, eval.params.PCount(), ctIn.Value[1], eval.PoolDecompQP)\n\n\t\tfor i, matrix := range element {\n\t\t\tctOut[i] = NewCiphertext(eval.params, 1, minLevel, ctIn.Scale)\n\n\t\t\tif matrix.Naive {\n\t\t\t\teval.MultiplyByDiagMatrix(ctIn, matrix, eval.PoolDecompQP, ctOut[i])\n\t\t\t} else {\n\t\t\t\teval.MultiplyByDiagMatrixBSGS(ctIn, matrix, eval.PoolDecompQP, ctOut[i])\n\t\t\t}\n\t\t}\n\n\tcase PtDiagMatrix:\n\n\t\tminLevel := utils.MinInt(element.Level, ctIn.Level())\n\t\teval.DecomposeNTT(minLevel, eval.params.PCount()-1, eval.params.PCount(), ctIn.Value[1], eval.PoolDecompQP)\n\n\t\tctOut = []*Ciphertext{NewCiphertext(eval.params, 1, minLevel, ctIn.Scale)}\n\n\t\tif element.Naive {\n\t\t\teval.MultiplyByDiagMatrix(ctIn, element, eval.PoolDecompQP, ctOut[0])\n\t\t} else {\n\t\t\teval.MultiplyByDiagMatrixBSGS(ctIn, element, eval.PoolDecompQP, ctOut[0])\n\t\t}\n\t}\n\treturn\n}", "func NewTransformComponent(parent *Entity, position Vector3, size Vector3, origin Vector3, rotation float64) *TransformComponent {\n\ttransformComponent := &TransformComponent{\n\t\tID: \"transform\",\n\t\tParent: parent,\n\t\tPosition: position,\n\t\tSize: size,\n\t\tOrigin: origin,\n\t\tRotation: rotation,\n\t}\n\treturn transformComponent\n}", "func (t *Transform) Transform() *Transform {\n\treturn t\n}", "func CreateTransform(lowerLeft, upperRight *Point, width, height int,\n\tgd *GridDef) *PointTransform {\n\tworldNx := math.Abs(lowerLeft.X() - upperRight.X())\n\tworldNy := math.Abs(lowerLeft.Y() - upperRight.Y())\n\tdx := worldNx / float64(width)\n\tdy := worldNy / float64(height)\n\tmaxx := math.Max(lowerLeft.X(), upperRight.X())\n\tmaxy := math.Max(lowerLeft.Y(), upperRight.Y())\n\tmax := NewPoint2D(maxx, maxy)\n\treturn &PointTransform{dx, dy, max, width, height, gd}\n}", "func Transform() TRANSFORM {\n\treturn TRANSFORM{\n\t\ttags: []ONETRANSFORM{},\n\t}\n}", "func NewIdentity() (*Identity, error) {\n\tident := &Identity{}\n\terr := ident.Default()\n\treturn ident, err\n}", "func NewTransformable() *Transformable {\n\ttransformable := &Transformable{C.sfTransformable_create()}\n\truntime.SetFinalizer(transformable, (*Transformable).destroy)\n\n\treturn transformable\n}", "func NewDoubleTransform( /* TODO */ ) *DoubleTransform {\n\t// TODO\n\treturn nil\n}", "func Transform() TransformComponent {\n\treturn TransformComponent{\n\t\tLocal: Affine{Scale: vec3{1, 1, 1}},\n\t\tWorld: Affine{Scale: vec3{1, 1, 1}},\n\t}\n}", "func NewCfnMLTransform(scope constructs.Construct, id *string, props *CfnMLTransformProps) CfnMLTransform {\n\t_init_.Initialize()\n\n\tj := jsiiProxy_CfnMLTransform{}\n\n\t_jsii_.Create(\n\t\t\"aws-cdk-lib.aws_glue.CfnMLTransform\",\n\t\t[]interface{}{scope, id, props},\n\t\t&j,\n\t)\n\n\treturn &j\n}", "func NewTransformer() Transformer {\n\treturn &execFigletTransformer{}\n}", "func NewTransformer() *Transformer {\n\treturn &Transformer{\n\t\tprevReqs: NewPrevReqPool(5),\n\t}\n}", "func NewCfnMLTransform_Override(c CfnMLTransform, scope constructs.Construct, id *string, props *CfnMLTransformProps) {\n\t_init_.Initialize()\n\n\t_jsii_.Create(\n\t\t\"aws-cdk-lib.aws_glue.CfnMLTransform\",\n\t\t[]interface{}{scope, id, props},\n\t\tc,\n\t)\n}", "func New(e *eme.EMECipher, longNames bool, raw64 bool) *NameTransform {\n\tb64 := base64.URLEncoding\n\tif raw64 {\n\t\tb64 = base64.RawURLEncoding\n\t}\n\treturn &NameTransform{\n\t\temeCipher: e,\n\t\tlongNames: longNames,\n\t\tB64: b64,\n\t}\n}", "func NewTransformCmd() *TransformCmd {\n\n\ttc := &TransformCmd{\n\t\tfs: flag.NewFlagSet(\"transform\", flag.ContinueOnError),\n\t}\n\n\ttc.fs.StringVar(&tc.outDir, \"o\", \"\", \"The directory where output file are written to\")\n\ttc.fs.StringVar(&tc.transFile, \"t\", \"\", \"Transformation file (required)\")\n\n\treturn tc\n}", "func (tr *transform) newExpression(iVar interface{}) *expression {\n\tvar id string\n\n\tif iVar != nil {\n\t\tswitch tVar := iVar.(type) {\n\t\tcase *ast.Ident:\n\t\t\tid = tVar.Name\n\t\tcase string:\n\t\t\tid = tVar\n\t\t}\n\t}\n\n\treturn &expression{\n\t\ttr,\n\t\tnew(bytes.Buffer),\n\t\tid,\n\t\t\"\",\n\t\t\"\",\n\t\t\"\",\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tmake([]string, 0),\n\t\tmake([]string, 0),\n\t}\n}", "func NewMyTransformer() *myTransformer {\n\treturn &myTransformer{}\n}", "func NewAffine(c anyvec.Creator, scaler, bias float64) *Affine {\n\tscalerVec := c.MakeVector(1)\n\tbiasVec := c.MakeVector(1)\n\tscalerVec.AddScalar(c.MakeNumeric(scaler))\n\tbiasVec.AddScalar(c.MakeNumeric(bias))\n\treturn &Affine{\n\t\tScalers: anydiff.NewVar(scalerVec),\n\t\tBiases: anydiff.NewVar(biasVec),\n\t}\n}", "func NewTransformDataNodes() *transformDataNodes {\n\treturn &transformDataNodes{}\n}", "func MakeTransformFor(archiveID int64, transform transforms.RequestTransform) (*Transform, error) {\n\t// e.g. 'ConstantTransform' or 'HeaderInjectionTransform'\n\ttransformType := strings.Split(reflect.TypeOf(transform).String(), \".\")[1]\n\tmarshaled, err := json.MarshalIndent(transform, \"\", \" \")\n\treturn &Transform{\n\t\tArchiveID: archiveID,\n\t\tMarshaledJSON: string(marshaled),\n\t\tType: transformType,\n\t}, err\n}", "func NewIdentity(log *util.Logger) *Identity {\n\tv := &Identity{\n\t\tHelper: request.NewHelper(log),\n\t}\n\n\treturn v\n}", "func noTransformation(xs []string) (transform.Transformation, error) {\n\tif len(xs) != 0 {\n\t\treturn nil, ErrBadTransformation\n\t}\n\treturn transform.NoTransformation(), nil\n}", "func (self Text) Transform() Transform {\n\tt := C.sfText_getTransform(self.Cref)\n\treturn Transform{&t}\n}", "func (a *API) CreateTransformation(ctx context.Context, params CreateTransformationParams) (*TransformationResult, error) {\n\tres := &TransformationResult{}\n\t_, err := a.post(ctx, api.BuildPath(transformations), params, res)\n\n\treturn res, err\n}", "func (p Profile) NewTransformer() *Transformer {\n\tvar ts []transform.Transformer\n\n\tif p.options.allowwidechars {\n\t\tts = append(ts, width.Fold)\n\t}\n\n\tts = append(ts, checker{p: p})\n\n\tif p.options.width != nil {\n\t\tts = append(ts, width.Fold)\n\t}\n\n\tfor _, f := range p.options.additional {\n\t\tts = append(ts, f())\n\t}\n\n\tif p.options.cases != nil {\n\t\tts = append(ts, p.options.cases)\n\t}\n\n\tts = append(ts, p.options.norm)\n\n\t// TODO: Apply directionality rule (blocking on the Bidi package)\n\t// TODO: Add the disallow empty rule with a dummy transformer?\n\n\treturn &Transformer{transform.Chain(ts...)}\n}", "func NewIdentity(signer Signer, name string, metadata []byte) (*Identity, error) {\n\tqname, err := fields.NewQualifiedContent(fields.ContentTypeUTF8String, []byte(name))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to create qualified content of type %d from %s\", fields.ContentTypeUTF8String, name)\n\t}\n\tqmeta, err := fields.NewQualifiedContent(fields.ContentTypeTwig, metadata)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to create qualified content of type %d from %s\", fields.ContentTypeTwig, metadata)\n\t}\n\treturn NewIdentityQualified(signer, qname, qmeta)\n}", "func NewIdentity(log *util.Logger) *Identity {\n\treturn &Identity{\n\t\tHelper: request.NewHelper(log),\n\t}\n}", "func NewCameraWithTransform(horizontalSize int, verticalSize int, fieldOfView float64,\n\ttransform *matrix.Matrix) *Camera {\n\n\tc := &Camera{\n\t\thorizontalSizeInPixels: horizontalSize,\n\t\tverticalSizeInPixels: verticalSize,\n\t\tfieldOfView: fieldOfView,\n\t\ttransform: transform,\n\t}\n\tc.prepareWorldSpaceUnits()\n\n\t// Cache the inverse of the transform, which never\n\t// changes and is used in rendering routines often.\n\tinverseTransform, _ := matrix.Inverse(transform)\n\tc.inverseTransform = inverseTransform\n\n\treturn c\n}", "func (m Matrix) Transform(a vec.Vec) vec.Vec {\n\treturn vec.New(\n\t\ta.X*m[0]+a.Y*m[2]+m[4],\n\t\ta.X*m[1]+a.Y*m[3]+m[5])\n}", "func New(e *eme.EMECipher, longNames bool, longNameMax uint8, raw64 bool, badname []string, deterministicNames bool) *NameTransform {\n\ttlog.Debug.Printf(\"nametransform.New: longNameMax=%v, raw64=%v, badname=%q\",\n\t\tlongNameMax, raw64, badname)\n\tb64 := base64.URLEncoding\n\tif raw64 {\n\t\tb64 = base64.RawURLEncoding\n\t}\n\tvar effectiveLongNameMax int = math.MaxInt32\n\tif longNames {\n\t\tif longNameMax == 0 {\n\t\t\teffectiveLongNameMax = NameMax\n\t\t} else {\n\t\t\teffectiveLongNameMax = int(longNameMax)\n\t\t}\n\t}\n\treturn &NameTransform{\n\t\temeCipher: e,\n\t\tlongNameMax: effectiveLongNameMax,\n\t\tB64: b64,\n\t\tbadnamePatterns: badname,\n\t\tdeterministicNames: deterministicNames,\n\t}\n}", "func Transform(t transform.Transformer, filename string) error {\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\tw, err := Writer(filename, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer w.Close()\n\n\tif _, err := io.Copy(w, transform.NewReader(f, t)); err != nil {\n\t\treturn err\n\t}\n\treturn w.Commit()\n}", "func (entity *Base) Transform() *Transform {\n\treturn &entity.transform\n}", "func (self Text) InverseTransform() Transform {\n\tt := C.sfText_getInverseTransform(self.Cref)\n\treturn Transform{&t}\n}", "func NewTransformsRecord() *TransformsRecord {\n\tr := &TransformsRecord{}\n\n\treturn r\n}", "func (c *Curve) NewIdentityPoint() CurvePoint {\n\treturn CurvePoint{\n\t\tx: math.Inf(0),\n\t\ty: math.Inf(0),\n\t\tcurve: c,\n\t}\n}", "func (h *Headers) NoTransform() *Headers {\n\th.noTransform = true\n\treturn h\n}", "func (in *Transform) DeepCopy() *Transform {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Transform)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func Identity() *Pub {\n\treturn NewPub(IdentityMuxer())\n}", "func newSigningIdentity(id identity.Identity, sign identity.Sign, hash hash.Hash) (*signingIdentity, error) {\n\tserializedIdentity := &msp.SerializedIdentity{\n\t\tMspid: id.MspID(),\n\t\tIdBytes: id.Credentials(),\n\t}\n\tserializedID, err := proto.Marshal(serializedIdentity)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := &signingIdentity{\n\t\tserializedID: serializedID,\n\t\tsign: sign,\n\t\thash: hash,\n\t}\n\treturn result, nil\n}", "func (tt *TransformTable) NewComp(entity engi.Entity) (xf *Transform) {\n\tif size := len(tt.comps); tt.index >= size {\n\t\ttt.comps = transformResize(tt.comps, size + STEP)\n\t}\n\tei := entity.Index()\n\tif v, ok := tt._map[ei]; ok {\n\t\txf = &tt.comps[v]\n\t\treturn\n\t}\n\n\txf = &tt.comps[tt.index]\n\ttt._map[ei] = tt.index\n\txf.Entity = entity\n\txf.Scale = mgl32.Vec2{1, 1}\n\ttt.index += 1\n\treturn\n}", "func (canvas *Canvas) Transform(a, b, c, d, e, f float32) {\n\twriteCommand(canvas.contents, \"cm\", a, b, c, d, e, f)\n}", "func (t *Transform) Create(db *DB) error {\n\tif t.CreatedAt != nil {\n\t\treturn errors.New(\"Transform already appears to be persisted\")\n\t}\n\n\tnow := util.TimePtr(time.Now())\n\tt.CreatedAt = now\n\tt.UpdatedAt = now\n\terr := db.Insert(t)\n\treturn err\n}", "func TestSimplestTransform(t *testing.T) {\n\tassert := assert.New(t)\n\tmessage := map[string]interface{}{\n\t\t\"a\": \"b\",\n\t}\n\ttransform := map[string]interface{}{\n\t\t\"x\": \"y\",\n\t}\n\ttransformErr := Transform(&message, transform)\n\tassert.Nil(transformErr)\n\tassert.Equal(message[\"a\"], \"b\")\n\tassert.NotNil(message[\"x\"])\n\tassert.Equal(message[\"x\"], \"y\")\n}", "func Identity() *Mtx {\n\treturn NewMat(\n\t\t1, 0, 0, 0,\n\t\t0, 1, 0, 0,\n\t\t0, 0, 1, 0,\n\t\t0, 0, 0, 1,\n\t)\n}", "func (ir Range) TransformToNew(start, end time.Time) period.Period {\n\treturn Range{\n\t\tStartFrame: fromTimeAndFPS(start, ir.FPS),\n\t\tEndFrame: fromTimeAndFPS(end, ir.FPS),\n\t\tFPS: ir.FPS,\n\t}\n}", "func (g *Group) SetTransform(m *algebra.Matrix) {\n\tif len(m.Get()) != 4 || len(m.Get()[0]) != 4 {\n\t\tpanic(algebra.ExpectedDimension(4))\n\t}\n\tg.transform = m\n}", "func NewMatrixTranslate(x, y, z float32) Matrix {\n\treturn Matrix{\n\t\tM0: 1, M1: 0, M2: 0, M3: x,\n\t\tM4: 0, M5: 1, M6: 0, M7: y,\n\t\tM8: 0, M9: 0, M10: 1, M11: z,\n\t\tM12: 0, M13: 0, M14: 0, M15: 1,\n\t}\n}", "func NewMatrixIdentity() Matrix {\n\treturn Matrix{\n\t\tM0: 1, M1: 0, M2: 0, M3: 0,\n\t\tM4: 0, M5: 1, M6: 0, M7: 0,\n\t\tM8: 0, M9: 0, M10: 1, M11: 0,\n\t\tM12: 0, M13: 0, M14: 0, M15: 1,\n\t}\n}", "func (s *Surface) Transform(a, b, c, d, e, f float64) {\n\ts.Ctx.Call(\"transform\", a, b, c, d, e, f)\n}", "func (in *TransformInput) DeepCopy() *TransformInput {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TransformInput)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func New(mspID string, certPEM []byte) (ci *CertIdentity, err error) {\n\tcert, err := Certificate(certPEM)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &CertIdentity{mspID, cert}, nil\n}", "func (app *Configurable) Transform(parameters map[string]string) interfaces.AppFunction {\n\ttransformType, ok := parameters[TransformType]\n\tif !ok {\n\t\tapp.lc.Errorf(\"Could not find '%s' parameter for Transform\", TransformType)\n\t\treturn nil\n\t}\n\n\ttransform := transforms.Conversion{}\n\n\tswitch strings.ToLower(transformType) {\n\tcase TransformXml:\n\t\treturn transform.TransformToXML\n\tcase TransformJson:\n\t\treturn transform.TransformToJSON\n\tdefault:\n\t\tapp.lc.Errorf(\n\t\t\t\"Invalid transform type '%s'. Must be '%s' or '%s'\",\n\t\t\ttransformType,\n\t\t\tTransformXml,\n\t\t\tTransformJson)\n\t\treturn nil\n\t}\n}", "func NewIdentity(conn sshd.Connection) *Identity {\n\treturn &Identity{\n\t\tConnection: conn,\n\t\tid: sanitize.Name(conn.Name()),\n\t\tcreated: time.Now(),\n\t}\n}", "func newTask() task {\n\treturn task{}\n}", "func (t *Transform) Copy() *Transform {\n\tt.access.RLock()\n\tcpy := &Transform{\n\t\tparent: t.parent,\n\t\tpos: t.pos,\n\t\trot: t.rot,\n\t\tscale: t.scale,\n\t\tshear: t.shear,\n\t}\n\tif t.built != nil {\n\t\tbuiltCpy := *t.built\n\t\tcpy.built = &builtCpy\n\t}\n\tif t.localToWorld != nil {\n\t\tltwCpy := *t.localToWorld\n\t\tcpy.localToWorld = &ltwCpy\n\t}\n\tif t.worldToLocal != nil {\n\t\twtlCpy := *t.worldToLocal\n\t\tcpy.worldToLocal = &wtlCpy\n\t}\n\tif t.quat != nil {\n\t\tquatCpy := *t.quat\n\t\tcpy.quat = &quatCpy\n\t}\n\tt.access.RUnlock()\n\treturn cpy\n}", "func NewTransformations(tr ...*Transformation) (trs *Transformations) {\n\tif len(tr) != 3 {\n\t\ttrs = nil\n\t} else {\n\t\ttrc := make([]Transformation, len(tr))\n\n\t\t// Make a copy of the transformations.\n\t\tfor i := range tr {\n\t\t\tif tr[i] != nil {\n\t\t\t\ttrans := tr[i]\n\t\t\t\tfunction := trans.Function()\n\t\t\t\tparams := trans.Parameters()\n\t\t\t\tntr := NewTransformation(function, params...)\n\t\t\t\ttrc[i] = ntr\n\t\t\t} else {\n\t\t\t\ttrc[i] = Transformation{}\n\t\t\t}\n\t\t}\n\n\t\ttrs = &Transformations{Tmpl: trc[0], Mtch: trc[1], Rslt: trc[2]}\n\t}\n\n\treturn trs\n}", "func NewIdentity() *identity.X509Identity {\n\tcertificatePEM, err := ioutil.ReadFile(\"certificate.pem\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tcertificate, err := identity.CertificateFromPEM(certificatePEM)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tid, err := identity.NewX509Identity(\"mspID\", certificate)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn id\n}", "func (c *Client) CreateMLTransform(ctx context.Context, params *CreateMLTransformInput, optFns ...func(*Options)) (*CreateMLTransformOutput, error) {\n\tif params == nil {\n\t\tparams = &CreateMLTransformInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"CreateMLTransform\", params, optFns, addOperationCreateMLTransformMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*CreateMLTransformOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (a *Application) newTransformer(patches []*resource.Resource) (transformers.Transformer, error) {\n\tvar r []transformers.Transformer\n\tt, err := transformers.NewPatchTransformer(patches)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr = append(r, t)\n\tr = append(r, transformers.NewNamespaceTransformer(string(a.kustomization.Namespace)))\n\tt, err = transformers.NewDefaultingNamePrefixTransformer(string(a.kustomization.NamePrefix))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr = append(r, t)\n\tt, err = transformers.NewDefaultingLabelsMapTransformer(a.kustomization.CommonLabels)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr = append(r, t)\n\tt, err = transformers.NewDefaultingAnnotationsMapTransformer(a.kustomization.CommonAnnotations)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr = append(r, t)\n\treturn transformers.NewMultiTransformer(r), nil\n}", "func (geom Geometry) Transform(ct CoordinateTransform) error {\n\treturn C.OGR_G_Transform(geom.cval, ct.cval).Err()\n}", "func (p *Profile) NewTransformer() *Transformer {\n\tvar ts []transform.Transformer\n\n\t// These transforms are applied in the order defined in\n\t// https://tools.ietf.org/html/rfc7564#section-7\n\n\t// RFC 8266 §2.1:\n\t//\n\t// Implementation experience has shown that applying the rules for the\n\t// Nickname profile is not an idempotent procedure for all code points.\n\t// Therefore, an implementation SHOULD apply the rules repeatedly until\n\t// the output string is stable; if the output string does not stabilize\n\t// after reapplying the rules three (3) additional times after the first\n\t// application, the implementation SHOULD terminate application of the\n\t// rules and reject the input string as invalid.\n\t//\n\t// There is no known string that will change indefinitely, so repeat 4 times\n\t// and rely on the Span method to keep things relatively performant.\n\tr := 1\n\tif p.options.repeat {\n\t\tr = 4\n\t}\n\tfor ; r > 0; r-- {\n\t\tif p.options.foldWidth {\n\t\t\tts = append(ts, width.Fold)\n\t\t}\n\n\t\tfor _, f := range p.options.additional {\n\t\t\tts = append(ts, f())\n\t\t}\n\n\t\tif p.options.cases != nil {\n\t\t\tts = append(ts, p.options.cases)\n\t\t}\n\n\t\tts = append(ts, p.options.norm)\n\n\t\tif p.options.bidiRule {\n\t\t\tts = append(ts, bidirule.New())\n\t\t}\n\n\t\tts = append(ts, &checker{p: p, allowed: p.Allowed()})\n\t}\n\n\t// TODO: Add the disallow empty rule with a dummy transformer?\n\n\treturn &Transformer{transform.Chain(ts...)}\n}", "func Transformer(name string, f interface{}) Option {\n\tv := reflect.ValueOf(f)\n\tif !function.IsType(v.Type(), function.Transformer) || v.IsNil() {\n\t\tpanic(fmt.Sprintf(\"invalid transformer function: %T\", f))\n\t}\n\tif name == \"\" {\n\t\tname = function.NameOf(v)\n\t\tif !identsRx.MatchString(name) {\n\t\t\tname = \"λ\" // Lambda-symbol as placeholder name\n\t\t}\n\t} else if !identsRx.MatchString(name) {\n\t\tpanic(fmt.Sprintf(\"invalid name: %q\", name))\n\t}\n\ttr := &transformer{name: name, fnc: reflect.ValueOf(f)}\n\tif ti := v.Type().In(0); ti.Kind() != reflect.Interface || ti.NumMethod() > 0 {\n\t\ttr.typ = ti\n\t}\n\treturn tr\n}", "func (a *Add) New(key, value string) transformer.Transformer {\n\treturn &Add{\n\t\tPath: key,\n\t\tValue: value,\n\n\t\tvariables: a.variables,\n\t}\n}", "func (s *CreateTransformJobInput) SetTransformInput(v *TransformInput) *CreateTransformJobInput {\n\ts.TransformInput = v\n\treturn s\n}", "func (s *Surface) SetTransform(a, b, c, d, e, f float64) {\n\ts.Ctx.Call(\"setTransform\", a, b, c, d, e, f)\n}", "func (s *BaseSyslParserListener) EnterTransform(ctx *TransformContext) {}", "func NewIdentityQuaternion() Quaternion {\n\treturn NewQuaternion(0.0, 1.0, 0.0, 0.0)\n}", "func NewTransformer(feastClient feast.Client, config *transformer.StandardTransformerConfig, options *Options, logger *zap.Logger) (*Transformer, error) {\n\tdefaultValues := make(map[string]*types.Value)\n\t// populate default values\n\tfor _, ft := range config.TransformerConfig.Feast {\n\t\tfor _, f := range ft.Features {\n\t\t\tif len(f.DefaultValue) != 0 {\n\t\t\t\tfeastValType := types.ValueType_Enum(types.ValueType_Enum_value[f.ValueType])\n\t\t\t\tdefVal, err := getValue(f.DefaultValue, feastValType)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Warn(fmt.Sprintf(\"invalid default value for %s : %v, %v\", f.Name, f.DefaultValue, err))\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tdefaultValues[f.Name] = defVal\n\t\t\t}\n\t\t}\n\t}\n\n\tcompiledJsonPath := make(map[string]*jsonpath.Compiled)\n\tcompiledUdf := make(map[string]*vm.Program)\n\tfor _, ft := range config.TransformerConfig.Feast {\n\t\tfor _, configEntity := range ft.Entities {\n\t\t\tswitch configEntity.Extractor.(type) {\n\t\t\tcase *transformer.Entity_JsonPath:\n\t\t\t\tc, err := jsonpath.Compile(configEntity.GetJsonPath())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unable to compile jsonpath for entity %s: %s\", configEntity.Name, configEntity.GetJsonPath())\n\t\t\t\t}\n\t\t\t\tcompiledJsonPath[configEntity.GetJsonPath()] = c\n\t\t\tcase *transformer.Entity_Udf:\n\t\t\t\tc, err := expr.Compile(configEntity.GetUdf(), expr.Env(UdfEnv{}))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tcompiledUdf[configEntity.GetUdf()] = c\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn &Transformer{\n\t\tfeastClient: feastClient,\n\t\tconfig: config,\n\t\toptions: options,\n\t\tlogger: logger,\n\t\tdefaultValues: defaultValues,\n\t\tcompiledJsonPath: compiledJsonPath,\n\t\tcompiledUdf: compiledUdf,\n\t}, nil\n}", "func (s *DescribeTransformJobOutput) SetTransformInput(v *TransformInput) *DescribeTransformJobOutput {\n\ts.TransformInput = v\n\treturn s\n}", "func (me XAttrTypeTxsdAnimateTransformTypeTypeTranslate) TypeDefault() TxsdAnimateTransformTypeType {\n\treturn TxsdAnimateTransformTypeType(\"translate\")\n}", "func NewTranslator(name, namespace, secretsNamespace string, enforceHTTPs bool, hostNameSuffixMatch bool, idleTimeoutSeconds int) Translator {\n\treturn &defaultTranslator{\n\t\tname: name,\n\t\tnamespace: namespace,\n\t\tsecretsNamespace: secretsNamespace,\n\t\tenforceHTTPs: enforceHTTPs,\n\t\thostNameSuffixMatch: hostNameSuffixMatch,\n\t\tidleTimeoutSeconds: idleTimeoutSeconds,\n\t}\n}", "func NewPointAffine(x, y fr.Element) PointAffine {\n\treturn PointAffine{x, y}\n}", "func (in *Transformation) DeepCopy() *Transformation {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Transformation)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (t *Tuple) Transform(transformations ...Matrix) *Tuple {\n\n\tif len(transformations) < 1 {\n\t\treturn t\n\t}\n\n\tcurrent := transformations[0]\n\n\tfor i := 1; i < len(transformations); i++ {\n\t\tcurrent = transformations[i].MulMatrix(current)\n\t}\n\n\treturn current.MulTuple(t)\n\n}", "func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error) {\n\n\tif len(config.Path) == 0 || config.Path == \"\" {\n\t\tconfig.Path = \"/\"\n\t}\n\n\tif len(config.HeaderName) == 0 || config.HeaderName == \"\" {\n\t\tconfig.HeaderName = \"Authorization\"\n\t}\n\n\tif len(config.HeaderPrefix) == 0 || config.HeaderPrefix == \"\" {\n\t\tconfig.HeaderPrefix = \"\"\n\t}\n\n\tif len(config.ParamName) == 0 || config.ParamName == \"\" {\n\t\tconfig.ParamName = \"jwt\"\n\t}\n\n\treturn &JWTTransform{\n\t\tnext: next,\n\t\tname: name,\n\t\tconfig: config,\n\t}, nil\n}", "func (s *Stream) Transform(op api.UnOperation) *Stream {\n\toperator := unary.New(s.ctx)\n\toperator.SetOperation(op)\n\ts.ops = append(s.ops, operator)\n\treturn s\n}", "func (s *TransformJobDefinition) SetTransformInput(v *TransformInput) *TransformJobDefinition {\n\ts.TransformInput = v\n\treturn s\n}", "func Transform(ctx context.Context, input <-chan CrawlResult, worker TransformFunc, parallelism int) <-chan TransformResult {\n\tt := &transformer{\n\t\tinput: input,\n\t\toutput: make(chan TransformResult, 1000),\n\t\tworkerBody: worker,\n\t\tparallelism: parallelism,\n\t}\n\tgo t.runWorkersToCompletion(ctx)\n\treturn t.output\n}", "func NewDefaultTransactor(ds datastore.Datastorer) DefaultTransactor {\n\treturn DefaultTransactor{ds}\n}", "func NewDefaultTransactor(ds datastore.Datastorer) DefaultTransactor {\n\treturn DefaultTransactor{ds}\n}", "func (inv *ActionMailTemplateTranslationUpdateInvocation) NewInput() *ActionMailTemplateTranslationUpdateInput {\n\tinv.Input = &ActionMailTemplateTranslationUpdateInput{}\n\treturn inv.Input\n}", "func (s *TransformJob) SetTransformInput(v *TransformInput) *TransformJob {\n\ts.TransformInput = v\n\treturn s\n}", "func (a *Client) CreateInstanceTransformationByObjectName(params *CreateInstanceTransformationByObjectNameParams) (*CreateInstanceTransformationByObjectNameOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewCreateInstanceTransformationByObjectNameParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"createInstanceTransformationByObjectName\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/instances/transformations/{objectName}\",\n\t\tProducesMediaTypes: []string{\"\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &CreateInstanceTransformationByObjectNameReader{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.(*CreateInstanceTransformationByObjectNameOK), nil\n\n}", "func (m *PowerTransformer) InverseTransform(X, Y mat.Matrix) (Xout, Yout *mat.Dense) {\n\tnSamples, nFeatures := X.Dims()\n\tXout = mat.NewDense(nSamples, nFeatures, nil)\n\tYout = base.ToDense(Y)\n\n\tvar inverseTransformFunc func(out, x []float64, lmbda float64)\n\tswitch m.Method {\n\tcase \"yeo-johnson\":\n\t\tinverseTransformFunc = yeoJohnsonInverseTransform\n\tcase \"box-cox\":\n\t\tinverseTransformFunc = boxCoxInverseTransform\n\tdefault:\n\t\tpanic(fmt.Errorf(\"'method' must be one of ('box-cox', 'yeo-johnson'), got %s instead\", m.Method))\n\t}\n\tX1 := base.ToDense(X)\n\tif m.Standardize {\n\t\tX1, _ = m.Scaler.InverseTransform(X1, nil)\n\t}\n\tbase.Parallelize(-1, nFeatures, func(th, start, end int) {\n\t\tcol := make([]float64, nSamples)\n\t\tout := make([]float64, nSamples)\n\t\tfor c := start; c < end; c++ {\n\t\t\tmat.Col(col, c, X1)\n\t\t\tinverseTransformFunc(out, col, m.Lambdas[c])\n\t\t\tXout.SetCol(c, out)\n\t\t}\n\t})\n\treturn\n}", "func (r *Repository) Transform(from, to int) Func {\n\treturn Transform(r.Code(from), r.Code(to))\n}", "func newExecute(name string) *Instruction {\n\treturn &Instruction{\n\t\tType: ExecuteInst,\n\t\tName: name,\n\t}\n}", "func (c *Identity) ToPlain(provider identityprovider.Interface) (*identityprovider.Identity, error) {\n\tpublicKey, err := hex.DecodeString(c.PublicKey)\n\tif err != nil {\n\t\treturn nil, errmsg.ErrIdentityDeserialization.Wrap(err)\n\t}\n\n\tidSignatures, err := c.Signatures.ToPlain()\n\tif err != nil {\n\t\treturn nil, errmsg.ErrIdentityDeserialization.Wrap(err)\n\t}\n\n\treturn &identityprovider.Identity{\n\t\tSignatures: idSignatures,\n\t\tPublicKey: publicKey,\n\t\tType: c.Type,\n\t\tID: c.ID,\n\t\tProvider: provider,\n\t}, nil\n}", "func NewDefault(metaTemplates []string) (TemplateEngine, error) {\n\tt := TextTemplate{\n\t\tbeginToken: DefaultBeginToken,\n\t\tendToken: DefaultEndToken,\n\t\tseparator: DefaultSeparator,\n\t\tmetaTemplates: metaTemplates,\n\t\tdict: map[string]interface{}{},\n\t}\n\n\tif err := t.buildTemplateTree(); err != nil {\n\t\treturn DummyTemplate{}, err\n\t}\n\n\treturn t, nil\n}", "func New(name string, key *uuidpb.UUID) *Identity {\n\tx := &Identity{\n\t\tName: name,\n\t\tKey: key,\n\t}\n\n\tif err := x.Validate(); err != nil {\n\t\tpanic(x)\n\t}\n\n\treturn x\n}", "func New(qtumClient *qtum.Qtum, proxies []ETHProxy, opts ...Option) (*Transformer, error) {\n\tif qtumClient == nil {\n\t\treturn nil, errors.New(\"qtumClient cannot be nil\")\n\t}\n\n\tt := &Transformer{\n\t\tqtumClient: qtumClient,\n\t\tlogger: log.NewNopLogger(),\n\t}\n\n\tvar err error\n\tfor _, p := range proxies {\n\t\tif err = t.Register(p); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tfor _, opt := range opts {\n\t\tif err := opt(t); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn t, nil\n}", "func (inv *ActionExportCreateInvocation) NewInput() *ActionExportCreateInput {\n\tinv.Input = &ActionExportCreateInput{}\n\treturn inv.Input\n}" ]
[ "0.7560676", "0.7552853", "0.7524606", "0.72407454", "0.66244805", "0.6586805", "0.6541571", "0.64616334", "0.6403893", "0.6273406", "0.6072438", "0.6038543", "0.58727026", "0.5844496", "0.5673262", "0.5662089", "0.5576789", "0.55677426", "0.55498636", "0.55261695", "0.55217415", "0.55212605", "0.5409992", "0.53822106", "0.53605086", "0.53411514", "0.5327261", "0.5324441", "0.5253493", "0.52202594", "0.52019995", "0.5181892", "0.51816654", "0.51527184", "0.5149524", "0.51486516", "0.5129181", "0.512335", "0.51187956", "0.51043844", "0.5087263", "0.5066451", "0.50575227", "0.499973", "0.4998786", "0.49965027", "0.4963325", "0.49632058", "0.49623686", "0.49616775", "0.49351707", "0.4935086", "0.49254557", "0.49219653", "0.49055982", "0.48873395", "0.4873703", "0.48634785", "0.48609284", "0.48312458", "0.4828498", "0.4819921", "0.48143348", "0.48078057", "0.48075795", "0.48030314", "0.47984898", "0.4781533", "0.47758248", "0.47673917", "0.4754305", "0.4753689", "0.47376892", "0.47313783", "0.47275737", "0.4727564", "0.47265515", "0.4716263", "0.47157702", "0.4706355", "0.47000355", "0.46917036", "0.4684395", "0.46835032", "0.46827972", "0.46791705", "0.46789977", "0.4670661", "0.4670661", "0.46688148", "0.46549317", "0.4613056", "0.46125305", "0.4602827", "0.45982933", "0.45962858", "0.4588089", "0.4586528", "0.45846337", "0.4580744" ]
0.7824815
0
SetScale sets transform scale.
func (t *Transform) SetScale(sx, sy float64) *Transform { t.Scale1.X = sx - 1 t.Scale1.Y = sy - 1 return t }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (xf *Transform) SetScale(scale float32) {\n\txf.Scale = mgl32.Vec2{scale, scale}\n}", "func (t *Transform) SetScale(v *Vector) ITransform {\n\tt.Scale = v\n\treturn t\n}", "func (this *Transformable) SetScale(scale Vector2f) {\n\tC.sfTransformable_setScale(this.cptr, scale.toC())\n}", "func (g *GameObject) SetScale(scale float64) {\r\n\tg.Hitbox.maxX *= scale / g.Scale\r\n\tg.Hitbox.maxY *= scale / g.Scale\r\n\tg.Scale = scale\r\n}", "func (self Transform) Scale(scaleX, scaleY float32) {\n\tC.sfTransform_scale(self.Cref, C.float(scaleX), C.float(scaleY))\n}", "func (t *Transform) Scale(sx, sy float64) {\n\tout := fmt.Sprintf(\"scale(%g,%g)\", sx, sy)\n\n\tt.transforms = append(t.transforms, out)\n}", "func (s *UpdateTaskSetInput) SetScale(v *Scale) *UpdateTaskSetInput {\n\ts.Scale = v\n\treturn s\n}", "func (s *CreateTaskSetInput) SetScale(v *Scale) *CreateTaskSetInput {\n\ts.Scale = v\n\treturn s\n}", "func (tr *trooper) setScale(scale float64) { tr.part.SetScale(scale, scale, scale) }", "func (this *RectangleShape) SetScale(scale Vector2f) {\n\tC.sfRectangleShape_setScale(this.cptr, scale.toC())\n}", "func (self Text) SetScale(x, y float32) {\n\tv := C.sfVector2f{C.float(x), C.float(y)}\n\tC.sfText_setScale(self.Cref, v)\n}", "func (p *Part) SetScale(scale vector.Vector) {\n\tif scale.Len() != 3 && scale.Kind() != reflect.Float32 {\n\t\tlog.Fatalf(\"Part.SetScale: expects 3D-Float32 vector, got %dD-%v\", scale.Len(), scale.Kind())\n\t}\n\t// Create scaling matrix\n\tp.scaling = matrix.NewMatrix([][]float32{\n\t\t{scale.Get(0).(float32), 0.0, 0.0},\n\t\t{0.0, scale.Get(1).(float32), 0.0},\n\t\t{0.0, 0.0, scale.Get(2).(float32)},\n\t})\n}", "func (s *TaskSet) SetScale(v *Scale) *TaskSet {\n\ts.Scale = v\n\treturn s\n}", "func (a *ReplaySnapshotArgs) SetScale(scale float64) *ReplaySnapshotArgs {\n\ta.Scale = &scale\n\treturn a\n}", "func (z *Big) SetScale(scale int) *Big {\n\tz.exp = -scale\n\treturn z\n}", "func (sprite *Sprite) SetScaling(xScale, yScale float64) {\n\n\tsprite.shape.SetScaling(xScale, yScale)\n}", "func (s *Surface) Scale(x, y float64) {\n\ts.Ctx.Call(\"scale\", x, y)\n}", "func (canvas *Canvas) Scale(x, y float32) {\n\twriteCommand(canvas.contents, \"cm\", x, 0, 0, y, 0, 0)\n}", "func (this *Transformable) Scale(factor Vector2f) {\n\tC.sfTransformable_scale(this.cptr, factor.toC())\n}", "func (dw *DrawingWand) Scale(x, y float64) {\n\tC.MagickDrawScale(dw.dw, C.double(x), C.double(y))\n}", "func (t *Transform) SetScaleXY(x float64, y float64) ITransform {\n\treturn t.SetScale(NewVector(x, y))\n}", "func (tfs *tiflashScaler) Scale(tc *v1alpha1.TidbCluster, oldSet *apps.StatefulSet, newSet *apps.StatefulSet) error {\n\tscaling, _, _, _ := scaleOne(oldSet, newSet)\n\tif scaling > 0 {\n\t\treturn tfs.ScaleOut(tc, oldSet, newSet)\n\t} else if scaling < 0 {\n\t\treturn tfs.ScaleIn(tc, oldSet, newSet)\n\t}\n\t// we only sync auto scaler annotations when we are finishing syncing scaling\n\treturn tfs.SyncAutoScalerAnn(tc, oldSet)\n}", "func (t *Transform) Scale() lmath.Vec3 {\n\tt.access.RLock()\n\ts := t.scale\n\tt.access.RUnlock()\n\treturn s\n}", "func (ki *KernelInfo) Scale(scale float64, normalizeType KernelNormalizeType) {\n\tC.ScaleKernelInfo(ki.info, C.double(scale), C.GeometryFlags(normalizeType))\n\truntime.KeepAlive(ki)\n}", "func (c2d *C2DMatrix) Scale(xScale, yScale float64) {\n\tvar mat Matrix\n\n\tmat.m11 = xScale\n\tmat.m12 = 0\n\tmat.m13 = 0\n\n\tmat.m21 = 0\n\tmat.m22 = yScale\n\tmat.m23 = 0\n\n\tmat.m31 = 0\n\tmat.m32 = 0\n\tmat.m33 = 1\n\n\t//and multiply\n\tc2d.MatrixMultiply(mat)\n}", "func (z *Big) SetMantScale(value int64, scale int) *Big {\n\tz.SetUint64(arith.Abs(value))\n\tz.exp = -scale // compiler should optimize out z.exp = 0 in SetUint64\n\tif value < 0 {\n\t\tz.form |= signbit\n\t}\n\treturn z\n}", "func (p *Point) Scale(v float64) {\n\tp.x *= v\n\tp.y *= v\n}", "func (p *Plane) Scale(scaleVec mgl32.Vec3) {\n\tp.model.Scale = scaleVec\n\tp.centroid = CalculateCentroid(p.vertexValues.Vertices, p.model.Scale)\n\tp.boundingBox = ScaleBoundingBox(p.boundingBox, scaleVec)\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * 1\n\tv.Y = v.Y * 1\n}", "func (k *kubectlContext) Scale(resource string, scale uint) error {\n\tout, err := k.do(\"scale\", fmt.Sprintf(\"--replicas=%d\", scale), resource)\n\tk.t.Log(string(out))\n\treturn err\n}", "func (w *windowImpl) Scale(dr image.Rectangle, src screen.Texture, sr image.Rectangle, op draw.Op, opts *screen.DrawOptions) {\n\tpanic(\"not implemented\") // TODO: Implement\n}", "func (m Matrix) Scale(scale vec32.Vector) Matrix {\n\treturn Mul(m, Matrix{\n\t\t{scale[0], 0, 0, 0},\n\t\t{0, scale[1], 0, 0},\n\t\t{0, 0, scale[2], 0},\n\t\t{0, 0, 0, 1},\n\t})\n}", "func (self *T) Scale(f float64) *T {\n\tself[0] *= f\n\tself[1] *= f\n\treturn self\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (c *canvasRenderer) Scale(amount sprec.Vec2) {\n\tc.currentLayer.Transform = sprec.Mat4Prod(\n\t\tc.currentLayer.Transform,\n\t\tsprec.ScaleMat4(amount.X, amount.Y, 1.0),\n\t)\n}", "func (v *Vertex) Scale(f float64) {\r\n\tv.X = v.X * f\r\n\tv.Y = v.Y * f\r\n}", "func (self *Tween) SetTimeScaleA(member int) {\n self.Object.Set(\"timeScale\", member)\n}", "func Scale(v *Vertex, f float64) {\n\tv.X *= f\n\tv.Y *= f\n}", "func (p *Proc) Scale(x, y float64) {\n\tp.stk.scale(x, y)\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X *= f\n\tv.Y *= f\n}", "func (s *Surface) SetTransform(a, b, c, d, e, f float64) {\n\ts.Ctx.Call(\"setTransform\", a, b, c, d, e, f)\n}", "func (mw *MagickWand) Scale(cols, rows uint) error {\n\treturn mw.ScaleImage(cols, rows)\n}", "func (m *Matrix3) Scale(s float64) {\n\tfor i, x := range m {\n\t\tm[i] = x * s\n\t}\n}", "func (v *Vertex) Scale(f float64) {\n\tv.x = v.x * f\n\tv.y = v.y * f\n}", "func (self *TileSprite) SetTileScaleA(member *Point) {\n self.Object.Set(\"tileScale\", member)\n}", "func Scale(v *Vertex, f float64) {\n\tv.x *= f\n\tv.y *= f\n}", "func (v *Vertex) scale(factor float64) {\n\tv.X = v.X * factor\n\tv.Y = v.Y * factor\n}", "func (v *vertex) Scale(f float64) {\n\tv.x = v.x * f\n\tv.y = v.y * f\n}", "func (v *Vertex) Scale(f float64) {\n v.X = v.X * f\n v.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n v.X = v.X * f\n v.Y = v.Y * f\n}", "func Scale(value float64) *SimpleElement { return newSEFloat(\"scale\", value) }", "func (v Vertex) Scale(f int) {\n\tv.x = v.x * f\n\tv.y = v.y * f\n}", "func (self *T) Scale(f float32) *T {\n\tself[0][0] *= f\n\tself[1][1] *= f\n\treturn self\n}", "func (v *Vector) ScaleTo(s float64) {\n\tv.X = s * v.X\n\tv.Y = s * v.Y\n\tv.Z = s * v.Z\n}", "func (ct *Ciphertext) SetScalingFactor(scale float64) {\n\tct.Scale = scale\n}", "func (z *Big) SetBigMantScale(value *big.Int, scale int) *Big {\n\t// Do this first in case value == z.unscaled. Don't want to clobber the sign.\n\tz.form = finite\n\tif value.Sign() < 0 {\n\t\tz.form |= signbit\n\t}\n\n\tz.unscaled.Abs(value)\n\tz.compact = c.Inflated\n\tz.precision = arith.BigLength(value)\n\n\tif z.unscaled.IsUint64() {\n\t\tif v := z.unscaled.Uint64(); v != c.Inflated {\n\t\t\tz.compact = v\n\t\t}\n\t}\n\n\tz.exp = -scale\n\treturn z\n}", "func (this *RectangleShape) Scale(factor Vector2f) {\n\tC.sfRectangleShape_scale(this.cptr, factor.toC())\n}", "func (b *IconButton) Scale(scale float32) *IconButton {\n\tb.size = b.th.TextSize.Scale(scale * 0.72)\n\treturn b\n}", "func (nt nodeTasks) setScale(node *Node, scale, buffer int) {\n\tst := nt[node]\n\tst.Lock()\n\tdefer st.RUnlock()\n\n\tcurrScale := len(st.buffers)\n\n\t// Increase the number of tasks for the given node.\n\t// a scale of 1 only adds a buffer with no scale.\n\tif scale > currScale {\n\t\tfor ; scale > currScale; currScale++ {\n\t\t\ttask := make(chan Record, buffer)\n\t\t\tst.buffers = append(st.buffers, task)\n\t\t\tgo func() {\n\t\t\t\tfor record := range task {\n\t\t\t\t\tnode.forward(record)\n\t\t\t\t}\n\t\t\t}()\n\t\t}\n\t}\n\n\tif scale < currScale {\n\t\tfor ; scale < currScale; currScale-- {\n\t\t\tclose(st.buffers[currScale-1])\n\t\t\tst.buffers = st.buffers[:currScale-1]\n\t\t}\n\t}\n}", "func (self Transform) ScaleWithCenter(scaleX, scaleY, centerX, centerY float32) {\n\tC.sfTransform_scaleWithCenter(self.Cref, C.float(scaleX), C.float(scaleY), C.float(centerX), C.float(centerY))\n}", "func (blk *Block) Scale(sx, sy float64) {\n\tops := contentstream.NewContentCreator().\n\t\tScale(sx, sy).\n\t\tOperations()\n\n\t*blk.contents = append(*ops, *blk.contents...)\n\tblk.contents.WrapIfNeeded()\n\n\tblk.width *= sx\n\tblk.height *= sy\n}", "func (v *Pixbuf) Scale(dst *Pixbuf, x, y, width, height int, offsetX, offsetY, scaleX, scaleY float64, interp InterpType) {\n\tC.gdk_pixbuf_scale(v.Native(), dst.Native(), C.int(x), C.int(y), C.int(width), C.int(height), C.double(offsetX), C.double(offsetY), C.double(scaleX), C.double(scaleY), C.GdkInterpType(interp))\n}", "func (c *ProcessClient) Scale(ctx context.Context, guid string, scale *resource.ProcessScale) (*resource.Process, error) {\n\tvar process resource.Process\n\t_, err := c.client.post(ctx, path.Format(\"/v3/processes/%s/actions/scale\", guid), scale, &process)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &process, nil\n}", "func (m *NOCWidget) SetTimescale(val string) {\n\tm.timescaleField = val\n}", "func Scale(A float64, x *Matrix) (*Matrix, error) {\n\tout, _ := New(x.RowCount, x.ColCount, nil)\n\n\tfor rowID := 0; rowID < x.RowCount; rowID++ {\n\t\tfor colID := 0; colID < x.ColCount; colID++ {\n\t\t\tout.Matrix[rowID][colID] = A * x.Matrix[rowID][colID]\n\t\t}\n\t}\n\n\treturn out, nil\n}", "func (in *Scale) DeepCopy() *Scale {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Scale)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (v *Vec4) Scale(s float32) {\n\tv.X *= s\n\tv.Y *= s\n\tv.Z *= s\n\tv.W *= s\n}", "func (v *Vertex) Scale(l float64) {\n\tv.x *= l\n\tv.y *= l\n}", "func (self Text) Scale(x, y float32) {\n\tv := C.sfVector2f{C.float(x), C.float(y)}\n\tC.sfText_scale(self.Cref, v)\n}", "func (p *P1D) Scale(factor float64) {\n\tp.bng.scaleW(factor)\n}", "func Scale(X *mat.Dense) *mat.Dense {\n\tXout, _ := NewStandardScaler().FitTransform(X, nil)\n\treturn Xout\n}", "func (b *IconButton) Scale(scale float32) *IconButton {\n\tb.size = b.Theme.TextSize.Scale(scale * 0.72)\n\treturn b\n}", "func (b *Base) Scale(w http.ResponseWriter, r *http.Request) {\n\tb.log.Printf(\"%s %s -> %s\", r.Method, r.URL.Path, r.RemoteAddr)\n\n\tsOptions, pOptions, kOptions, oOptions := render.SetDefaultScaleOptions()\n\n\tpv := render.PageVars{\n\t\tTitle: \"Practice Scales and Arpeggios\", // default scale initially displayed is A Major\n\t\tScalearp: \"Scale\",\n\t\tPitch: \"Major\",\n\t\tKey: \"A\",\n\t\tScaleImgPath: \"img/scale/major/a1.png\",\n\t\tGifPath: \"\",\n\t\tAudioPath: \"mp3/scale/major/a1.mp3\",\n\t\tAudioPath2: \"mp3/drone/a1.mp3\",\n\t\tLeftLabel: \"Listen to Major scale\",\n\t\tRightLabel: \"Listen to Drone\",\n\t\tScaleOptions: sOptions,\n\t\tPitchOptions: pOptions,\n\t\tKeyOptions: kOptions,\n\t\tOctaveOptions: oOptions,\n\t}\n\n\tif err := render.Render(w, \"scale.html\", pv); err != nil {\n\t\tb.log.Printf(\"%s %s -> %s : ERROR : %v\", r.Method, r.URL.Path, r.RemoteAddr, err)\n\t\treturn\n\t}\n}", "func (t *Tree) Scale(s float32) {\n\tif t.Leaf != nil {\n\t\tfor i, x := range t.Leaf.OutputDelta {\n\t\t\tt.Leaf.OutputDelta[i] = x * s\n\t\t}\n\t} else {\n\t\tt.Branch.FalseBranch.Scale(s)\n\t\tt.Branch.TrueBranch.Scale(s)\n\t}\n}", "func (c *Circle) Scale(f float64) {\n\tc.radius *= f\n}", "func Scale(s float64) Matrix {\n\treturn Matrix{s, 0, 0, s, 0, 0}\n}", "func (fpsc *FloorPlanScaleCreate) SetScaleInMeters(f float64) *FloorPlanScaleCreate {\n\tfpsc.mutation.SetScaleInMeters(f)\n\treturn fpsc\n}", "func (c Charset) Scale(factor int) {\n\tif factor <= 1 {\n\t\t// A factor of zero results in zero-sized glyphs and\n\t\t// is therefore not valid. A factor of 1 does not change\n\t\t// the glyphs, so we can ignore it.\n\t\treturn\n\t}\n\n\t// Multiply each glyph field by the given factor\n\t// to scale them up to the new size.\n\tfor i := range c {\n\t\tc[i].X *= factor\n\t\tc[i].Y *= factor\n\t\tc[i].Width *= factor\n\t\tc[i].Height *= factor\n\t\tc[i].Advance *= factor\n\t}\n}", "func (wv *Spectrum) Scale(s float32) {\n\twv.C[0] *= s\n\twv.C[1] *= s\n\twv.C[2] *= s\n\twv.C[3] *= s\n}", "func (p Point) Scale(s Length) Point {\n\treturn Point{p.X * s, p.Y * s}\n}", "func (p Point) Scale(s float64) Point {\n\treturn NewPoint(p.X*s, p.Y*s)\n}", "func Scale(zoom float64) float64 {\n\treturn 256 * math.Pow(2, zoom)\n}", "func (q *Quaternion) Scale(factor float64) {\n\tq.Q0 = factor * q.Q0\n\tq.Q1 = factor * q.Q1\n\tq.Q2 = factor * q.Q2\n\tq.Q3 = factor * q.Q3\n}", "func (this *Transformable) GetScale() (scale Vector2f) {\n\tscale.fromC(C.sfTransformable_getScale(this.cptr))\n\treturn\n}", "func Scale(p point, factor int) point {\n\treturn point{p.x * factor, p.y * factor, p.z * factor}\n}", "func (c *LinehaulCostComputation) Scale(factor float64) {\n\tc.BaseLinehaul = c.BaseLinehaul.MultiplyFloat64(factor)\n\tc.OriginLinehaulFactor = c.OriginLinehaulFactor.MultiplyFloat64(factor)\n\tc.DestinationLinehaulFactor = c.DestinationLinehaulFactor.MultiplyFloat64(factor)\n\tc.ShorthaulCharge = c.ShorthaulCharge.MultiplyFloat64(factor)\n\tc.LinehaulChargeTotal = c.LinehaulChargeTotal.MultiplyFloat64(factor)\n}", "func (g *Group) SetTransform(m *algebra.Matrix) {\n\tif len(m.Get()) != 4 || len(m.Get()[0]) != 4 {\n\t\tpanic(algebra.ExpectedDimension(4))\n\t}\n\tg.transform = m\n}", "func (q Quat) Scale(scalar float64) Quat {\n\n\treturn Quat{q.W * scalar,\n\t\tq.X * scalar,\n\t\tq.Y * scalar,\n\t\tq.Z * scalar}\n}", "func (dev *pwm_context) Scale(value int) error {\n\tif dev.period == -1 {\n\t\tif err := dev.ReadPeriod(); err != nil {\n\t\t\treturn fmt.Errorf(\"pwm: error running Scale: %s\", err)\n\t\t}\n\t}\n\n\tduty := (float64(value) - dev.min) / dev.span\n\tfmt.Printf(\"pwm: Scaling pin[%d] from value: %d to duty: %f\\n\", dev.pin, value, duty)\n\treturn dev.WriteDuty(int(float64(dev.period) * duty))\n}", "func (c *canvasRenderer) SetTransform(transform sprec.Mat4) {\n\tif c.currentLayer == c.topLayer {\n\t\tc.currentLayer.Transform = transform\n\t} else {\n\t\tc.currentLayer.Transform = sprec.Mat4Prod(\n\t\t\tc.currentLayer.previous.Transform,\n\t\t\ttransform,\n\t\t)\n\t}\n}", "func (t *Transform) GetScale() *Vector {\n\treturn t.Scale\n}", "func ScaleFunc(v *Vertex, f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v Vec3) Scale(t float64) Vec3 {\n\treturn Vec3{X: v.X * t, Y: v.Y * t, Z: v.Z * t}\n}", "func (me TxsdAnimateTransformTypeType) IsScale() bool { return me.String() == \"scale\" }" ]
[ "0.82044643", "0.82026076", "0.8044438", "0.80010784", "0.738389", "0.73492926", "0.72787267", "0.7259887", "0.72031957", "0.71859896", "0.7162448", "0.71623427", "0.714276", "0.7092354", "0.7020097", "0.6801338", "0.65981305", "0.65689886", "0.65219027", "0.64675266", "0.64614767", "0.6361633", "0.6273564", "0.6270893", "0.61856204", "0.616847", "0.6126616", "0.61034936", "0.6048174", "0.60185546", "0.600596", "0.600518", "0.598788", "0.59684926", "0.59684926", "0.59684926", "0.59684926", "0.59684926", "0.59684926", "0.59684926", "0.59562904", "0.5951669", "0.595013", "0.5946237", "0.59423316", "0.5934794", "0.59291834", "0.59273636", "0.5926921", "0.5887774", "0.5864662", "0.5841725", "0.5841353", "0.58402926", "0.5838771", "0.5833896", "0.5830673", "0.5809072", "0.57709265", "0.5764065", "0.57638705", "0.5753886", "0.57504076", "0.5747996", "0.57240385", "0.5659796", "0.5653644", "0.56534797", "0.5647223", "0.56357026", "0.5633477", "0.563024", "0.5629556", "0.5629159", "0.5626737", "0.5616686", "0.56124014", "0.5609202", "0.56001467", "0.5598247", "0.558476", "0.5576161", "0.5557903", "0.55308497", "0.55218816", "0.5500874", "0.5479571", "0.5475519", "0.5474892", "0.5471038", "0.54131", "0.5396248", "0.5395988", "0.5392518", "0.5361842", "0.535773", "0.53545266", "0.5337189", "0.53371626", "0.533627" ]
0.8562481
0
SetRotation sets transform rotation.
func (t *Transform) SetRotation(angle float64) *Transform { t.Rotation = angle return t }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t *Transform) SetRotation(r float64) ITransform {\n\tt.Rotation = r\n\treturn t\n}", "func (this *Transformable) SetRotation(rot float32) {\n\tC.sfTransformable_setRotation(this.cptr, C.float(rot))\n}", "func (p *Plane) SetRotation(rot mgl32.Mat4) {\n\tp.model.Rotation = rot\n}", "func (d *Device) SetRotation(rotation Rotation) error {\n\td.rotation = rotation\n\td.startWrite()\n\terr := d.setRotation(rotation)\n\td.endWrite()\n\treturn err\n}", "func (s *AppServerV3) SetRotation(r Rotation) {\n\ts.Spec.Rotation = r\n}", "func (s *DatabaseServerV3) SetRotation(r Rotation) {\n\ts.Spec.Rotation = r\n}", "func (t *Transform) SetRot(r lmath.Vec3) {\n\tt.access.Lock()\n\tif t.rot != r {\n\t\tt.built = nil\n\t\tt.quat = nil\n\t\tt.rot = r\n\t}\n\tt.access.Unlock()\n}", "func (self Text) SetRotation(angle float32) {\n\tC.sfText_setRotation(self.Cref, C.float(angle))\n}", "func (this *RectangleShape) SetRotation(rot float32) {\n\tC.sfRectangleShape_setRotation(this.cptr, C.float(rot))\n}", "func (p *Part) SetRotation(rotation vector.Vector) {\n\tif rotation.Len() != 3 && rotation.Kind() != reflect.Float32 {\n\t\tlog.Fatalf(\"Part.SetRotation: expects 3D-Float32 vector, got %dD-%v\", rotation.Len(), rotation.Kind())\n\t}\n\t// Make float64 values in Radians for math\n\txAngle := float64(rotation.Get(0).(float32)) * math.Pi / 180.0\n\tyAngle := float64(rotation.Get(1).(float32)) * math.Pi / 180.0\n\tzAngle := float64(rotation.Get(2).(float32)) * math.Pi / 180.0\n\t// Create a rotation matrix for each axis\n\txRotation := matrix.NewMatrix([][]float32{\n\t\t{1.0, 0.0, 0.0},\n\t\t{0.0, float32(math.Cos(xAngle)), float32(-math.Sin(xAngle))},\n\t\t{0.0, float32(math.Sin(xAngle)), float32(math.Cos(xAngle))},\n\t})\n\tyRotation := matrix.NewMatrix([][]float32{\n\t\t{float32(math.Cos(yAngle)), 0.0, float32(math.Sin(yAngle))},\n\t\t{0.0, 1.0, 0.0},\n\t\t{float32(-math.Sin(yAngle)), 0.0, float32(math.Cos(yAngle))},\n\t})\n\tzRotation := matrix.NewMatrix([][]float32{\n\t\t{float32(math.Cos(zAngle)), float32(-math.Sin(zAngle)), 0.0},\n\t\t{float32(math.Sin(zAngle)), float32(math.Cos(zAngle)), 0.0},\n\t\t{0.0, 0.0, 1.0},\n\t})\n\t// Combine the rotations\n\tp.rotation = zRotation.Mulm(yRotation.Mulm(xRotation))\n}", "func (w *Writer) SetRotate(rotate bool) *Writer {\n\t//fmt.Fprintf(os.Stderr, \"Writer.SetRotate: %v\\n\", rotate)\n\tw.rotate = rotate\n\treturn w\n}", "func (w *FileLogWriter) SetRotate(rotate bool) *FileLogWriter {\n\t//fmt.Fprintf(os.Stderr, \"FileLogWriter.SetRotate: %v\\n\", rotate)\n\tw.rotate = rotate\n\treturn w\n}", "func (t *Transform) Rotate(angle, cx, cy float64) {\n\tout := fmt.Sprintf(\"rotate(%g,%g,%g)\", angle, cx, cy)\n\n\tt.transforms = append(t.transforms, out)\n}", "func (transform *Transform) Rotate(angle float32, axis mgl32.Vec3) {\n\ttransform.objMatrix = mgl32.HomogRotate3D(angle, axis)\n}", "func (s *CreateJobOutput) SetRotate(v string) *CreateJobOutput {\n\ts.Rotate = &v\n\treturn s\n}", "func (t *transform) Rotate(rotate mgl32.Vec3) {\n\tt.dataLock.Lock()\n\tdefer t.dataLock.Unlock()\n\n\tt.rotation = t.rotation.Add(rotate)\n\ttotal := t.rotation\n\trotX := mgl32.HomogRotate3DX(total.X())\n\trotY := mgl32.HomogRotate3DY(total.Y())\n\trotZ := mgl32.HomogRotate3DZ(total.Z())\n\trotMatrix := rotZ.Mul4(rotY).Mul4(rotX)\n\ttrans := t.translation\n\tt.modelView = mgl32.Ident4().Mul4(mgl32.Translate3D(trans.X(), trans.Y(), trans.Z())).Mul4(rotMatrix)\n}", "func (s *JobOutput) SetRotate(v string) *JobOutput {\n\ts.Rotate = &v\n\treturn s\n}", "func (lo *LogOption) SetRotate(rt RotateType) *LogOption {\n\tlo.RotateType = filelog.RotateType(rt)\n\treturn lo\n}", "func (self Transform) Rotate(angle float32) {\n\tC.sfTransform_rotate(self.Cref, C.float(angle))\n}", "func (hook *StackHook) SetRotationTime(rotationTime time.Duration) {\n\thook.lock.Lock()\n\tdefer hook.lock.Unlock()\n\thook.rotationTime = rotationTime\n\thook.lastRotate = time.Now()\n}", "func (this *Transformable) Rotate(angle float32) {\n\tC.sfTransformable_rotate(this.cptr, C.float(angle))\n}", "func (l *Logger) SetRotateInterval(duration time.Duration) (err error) {\n\tvar wasUnset bool\n\t// Ensure duration isn't set to zero\n\tif duration == 0 {\n\t\t// We do not like rotation intervals of zero, return\n\t\terr = ErrInvalidRotationInterval\n\t\treturn\n\t}\n\n\t// Acquire lock\n\tl.mu.Lock()\n\t// Defer the release of our lock\n\tdefer l.mu.Unlock()\n\n\t// Ensure the logger has not been closed\n\tif l.isClosed() {\n\t\t// Instance of logger has been closed, return\n\t\treturn errors.ErrIsClosed\n\t}\n\n\t// Set unset to true if rotate interval is currently zero\n\twasUnset = l.rotateInterval == 0\n\t// Set rotate interval to the provided duration\n\tl.rotateInterval = duration\n\n\tif wasUnset {\n\t\t// Rotate interval was previously unset, initialize rotation loop\n\t\tgo l.rotationLoop()\n\t}\n\n\treturn\n}", "func (t *Transform) GetRotation() float64 {\n\treturn t.Rotation\n}", "func (t *Transform) Rot() lmath.Vec3 {\n\tvar r lmath.Vec3\n\tt.access.RLock()\n\tif t.quat == nil {\n\t\tr = t.rot\n\t} else {\n\t\t// Convert quaternion rotation to euler rotation.\n\t\tr = (*t.quat).Hpr(lmath.CoordSysZUpRight).HprToXyz().Degrees()\n\t}\n\tt.access.RUnlock()\n\treturn r\n}", "func (device *Device) SetTiltAngle(degrees float64) error {\n\n\terrCode := C.freenect_set_tilt_degs(device.device, C.double(degrees))\n\n\tif errCode < 0 {\n\t\treturn fmt.Errorf(\"could not set tilt to \", degrees)\n\t}\n\n\treturn nil\n}", "func (l *Logger) SetRotateFn(fn RotateFn) {\n\t// Acquire lock\n\tl.mu.Lock()\n\t// Defer the release of our lock\n\tdefer l.mu.Unlock()\n\t// Set onRotation value as provided fn\n\tl.onRotate = fn\n}", "func (dw *DrawingWand) Rotate(degrees float64) {\n\tC.MagickDrawRotate(dw.dw, C.double(degrees))\n}", "func (c *canvasRenderer) Rotate(angle sprec.Angle) {\n\tc.currentLayer.Transform = sprec.Mat4Prod(\n\t\tc.currentLayer.Transform,\n\t\tsprec.RotationMat4(angle, 0.0, 0.0, 1.0),\n\t)\n}", "func (s *Surface) SetTransform(a, b, c, d, e, f float64) {\n\ts.Ctx.Call(\"setTransform\", a, b, c, d, e, f)\n}", "func Rotation(value float64) *SimpleElement { return newSEFloat(\"rotation\", value) }", "func Rotation(r float64) Matrix {\n\ts, c := math.Sin(r), math.Cos(r)\n\treturn Matrix{c, s, -s, c, 0, 0}\n}", "func (w *Writer) Rotate() {\n\tw.rot <- true\n}", "func (d *Device) Rotation() drivers.Rotation {\n\treturn d.rotation\n}", "func (self Text) Rotation() float32 {\n\treturn float32(C.sfText_getRotation(self.Cref))\n}", "func (r *ImageRef) SetOrientation(orientation int) error {\n\tout, err := vipsCopyImage(r.image)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvipsSetMetaOrientation(out, orientation)\n\n\tr.setImage(out)\n\treturn nil\n}", "func (t *Transform) SetQuat(q lmath.Quat) {\n\tt.access.Lock()\n\tif t.quat == nil || (*t.quat) != q {\n\t\tt.built = nil\n\t\tt.quat = &q\n\t}\n\tt.access.Unlock()\n}", "func (c *Clac) Rot() error {\n\treturn c.rot(true)\n}", "func (w *Writer) SetRotateDaily(daily bool) *Writer {\n\t//fmt.Fprintf(os.Stderr, \"Writer.SetRotateDaily: %v\\n\", daily)\n\tw.daily = daily\n\treturn w\n}", "func (this *Transformable) GetRotation() float32 {\n\treturn float32(C.sfTransformable_getRotation(this.cptr))\n}", "func (c2d *C2DMatrix) Rotate(rot float64) {\n\tvar mat Matrix\n\n\tvar Sin float64 = math.Sin(rot)\n\tvar Cos float64 = math.Cos(rot)\n\n\tmat.m11 = Cos\n\tmat.m12 = Sin\n\tmat.m13 = 0\n\n\tmat.m21 = -Sin\n\tmat.m22 = Cos\n\tmat.m23 = 0\n\n\tmat.m31 = 0\n\tmat.m32 = 0\n\tmat.m33 = 1\n\n\t//and multiply\n\tc2d.MatrixMultiply(mat)\n}", "func rotation(xs []string) (transform.Transformation, error) {\n\tif len(xs) != 2 {\n\t\treturn nil, ErrBadTransformation\n\t}\n\tp, err := Point(xs[0])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trads, err := Angle(xs[1])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn transform.Rotation(p, rads), nil\n}", "func (text *TEXT) Rotate(r ...float64) *TEXT {\n\ttext.rotate = r\n\treturn text\n}", "func (canvas *Canvas) Rotate(theta float32) {\n\ts, c := math.Sin(float64(theta)), math.Cos(float64(theta))\n\twriteCommand(canvas.contents, \"cm\", c, s, -s, c, 0, 0)\n}", "func (this *RectangleShape) Rotate(angle float32) {\n\tC.sfRectangleShape_rotate(this.cptr, C.float(angle))\n}", "func (l *Line) SetAngle(angle float64) float64 {\n\treturn l.Rotate(angle - l.angle)\n}", "func (e *Enigma) SetRotor(position, name string, ringPosition int, startPosition rune) error {\r\n\trotor, check := availableRotors[name]\r\n\tif !check {\r\n\t\treturn fmt.Errorf(\"no such rotor: %s\", name)\r\n\t}\r\n\r\n\tindex, check := rotorPositions[strings.ToUpper(position)]\r\n\tif !check {\r\n\t\treturn fmt.Errorf(\"no such position: %s\", position)\r\n\t}\r\n\r\n\tif ringPosition < 1 || ringPosition > 26 {\r\n\t\treturn fmt.Errorf(\"invalid ring position: %d\", ringPosition)\r\n\t}\r\n\r\n\tstart := unicode.ToUpper(startPosition)\r\n\tif start < 'A' || start > 'Z' {\r\n\t\treturn fmt.Errorf(\"invalid start position: %c\", start)\r\n\t}\r\n\r\n\trotor.setRingPosition(ringPosition)\r\n\r\n\trotor.setStartPosition(start)\r\n\r\n\te.rotors[index] = &rotor\r\n\r\n\treturn nil\r\n}", "func (s *Surface) Rotate(radians float64) {\n\ts.Ctx.Call(\"rotate\", 2*math.Pi-radians)\n}", "func (obj *Device) SetTransform(state TRANSFORMSTATETYPE, matrix MATRIX) Error {\n\tret, _, _ := syscall.Syscall(\n\t\tobj.vtbl.SetTransform,\n\t\t3,\n\t\tuintptr(unsafe.Pointer(obj)),\n\t\tuintptr(state),\n\t\tuintptr(unsafe.Pointer(&matrix[0])),\n\t)\n\treturn toErr(ret)\n}", "func (g *Group) SetTransform(m *algebra.Matrix) {\n\tif len(m.Get()) != 4 || len(m.Get()[0]) != 4 {\n\t\tpanic(algebra.ExpectedDimension(4))\n\t}\n\tg.transform = m\n}", "func (w *RotateWriter) Rotate() (err error) {\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\treturn w.rotate()\n}", "func (self Text) Rotate(angle float32) {\n\tC.sfText_rotate(self.Cref, C.float(angle))\n}", "func (m Matrix) Rotate(angle float32, axis vec32.Vector) Matrix {\n\taxis = axis.Normalize()\n\tx, y, z := axis[0], axis[1], axis[2]\n\tsin, cos := float32(math.Sin(float64(angle))), float32(math.Cos(float64(angle)))\n\treturn Mul(m, Matrix{\n\t\t{cos + x*x*(1-cos), y*x*(1-cos) + z*sin, z*x*(1-cos) - y*sin, 0},\n\t\t{x*y*(1-cos) - z*sin, cos + y*y*(1-cos), z*y*(1-cos) + x*sin, 0},\n\t\t{x*z*(1-cos) + y*sin, y*z*(1-cos) - x*sin, cos + z*z*(1-cos), 0},\n\t\t{0, 0, 0, 1},\n\t})\n}", "func (me XsdGoPkgHasElem_Rotation) RotationDefault() Tangle180Type {\r\n\tvar x = new(Tangle180Type)\r\n\tx.Set(\"0.0\")\r\n\treturn *x\r\n}", "func (self *Graphics) SetPreviousRotationA(member int) {\n self.Object.Set(\"previousRotation\", member)\n}", "func (blk *Block) SetAngle(angleDeg float64) {\n\tblk.angle = angleDeg\n}", "func (w *FileLogWriter) SetRotateDaily(daily bool) *FileLogWriter {\n\t//fmt.Fprintf(os.Stderr, \"FileLogWriter.SetRotateDaily: %v\\n\", daily)\n\tw.daily = daily\n\treturn w\n}", "func Rotate(vec *mat.VecDense, angle float64, axis Axis) *mat.VecDense {\n\trot := RotationMatrix(angle, axis)\n\tvec.MulVec(rot, vec)\n\treturn vec\n}", "func (t *Transform) SetTranslation(tx, ty float64) *Transform {\n\tt.Translation.X = tx\n\tt.Translation.Y = ty\n\treturn t\n}", "func (me XsdGoPkgHasElems_Rotation) RotationDefault() Tangle180Type {\r\n\tvar x = new(Tangle180Type)\r\n\tx.Set(\"0.0\")\r\n\treturn *x\r\n}", "func (w *Writer) SetRotateSize(maxsize int) *Writer {\n\t//fmt.Fprintf(os.Stderr, \"Writer.SetRotateSize: %v\\n\", maxsize)\n\tw.maxsize = maxsize\n\treturn w\n}", "func RotationMatrix(angle float64, axis Axis) *mat.Dense {\n\tc := math.Cos(angle)\n\ts := math.Sin(angle)\n\n\tswitch axis {\n\tcase AxisX:\n\t\treturn mat.NewDense(3, 3, []float64{\n\t\t\t1, 0, 0,\n\t\t\t0, c, -s,\n\t\t\t0, s, c,\n\t\t})\n\tcase AxisY:\n\t\treturn mat.NewDense(3, 3, []float64{\n\t\t\tc, 0, s,\n\t\t\t0, 1, 0,\n\t\t\ts, 0, c,\n\t\t})\n\tcase AxisZ:\n\t\treturn mat.NewDense(3, 3, []float64{\n\t\t\tc, -s, 0,\n\t\t\ts, c, 0,\n\t\t\t0, 0, 1,\n\t\t})\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Unknown axis %v\", axis))\n\t}\n\n}", "func (player *Player) Rotation(f func(rotation float64)) {\n\tplayer.Exec(command.QueryTargetRequest(mctype.Target(player.name)), func(response *command.QueryTarget) {\n\t\tif len(*response.Details) == 1 {\n\t\t\tf((*response.Details)[0].YRotation)\n\t\t}\n\t})\n}", "func (s *DatabaseServerV3) GetRotation() Rotation {\n\treturn s.Spec.Rotation\n}", "func WithRotationTime(d time.Duration) Option {\n\treturn OptionFn(func(rl *RotateLogs) error {\n\t\trl.rotationTime = d\n\t\treturn nil\n\t})\n}", "func (h *Hook) SetRotateLog(typeName string) *Hook {\n\n\th.rotateType = typeName\n\treturn h\n}", "func (me *XsdGoPkgHasElem_Rotation) Walk() (err error) {\r\n\tif fn := WalkHandlers.XsdGoPkgHasElem_Rotation; me != nil {\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "func (self *TileSprite) SetPreviousRotationA(member int) {\n self.Object.Set(\"previousRotation\", member)\n}", "func (xs *Sheet) SetLandscape(landscape int) {\n\txs.xb.lib.NewProc(\"xlSheetSetLandscapeW\").\n\t\tCall(xs.self, I(landscape))\n}", "func (s *AppServerV3) GetRotation() Rotation {\n\treturn s.Spec.Rotation\n}", "func (w *FileLogWriter) Rotate() {\n\tw.rot <- true\n}", "func QuatRotate(angle float32, axis Vec3) Quat {\n\t// angle = (float32(math.Pi) * angle) / 180.0\n\n\tc, s := float32(math.Cos(float64(angle/2))), float32(math.Sin(float64(angle/2)))\n\n\treturn Quat{c, axis.Mul(s)}\n}", "func (mw *MagickWand) Rotate(degree float64) error {\n\tbackground := gmagick.NewPixelWand()\n\tbackground.SetColor(\"#000000\")\n\treturn mw.RotateImage(background, degree)\n}", "func (l *Line) Rotate(angle float64) float64 {\n\tcenter := l.Center()\n\tpv := l.p.Subtract(center)\n\tqv := l.q.Subtract(center)\n\n\tpv = pv.Rotate(angle)\n\tqv = qv.Rotate(angle)\n\n\tl.p = center.Add(pv)\n\tl.q = center.Add(qv)\n\n\tl.angle += angle\n\tl.angle = AdjustAngle(l.angle)\n\n\treturn l.angle\n}", "func (o CryptoKeyOutput) RotationPeriod() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *CryptoKey) pulumi.StringPtrOutput { return v.RotationPeriod }).(pulumi.StringPtrOutput)\n}", "func (c *canvasRenderer) SetTransform(transform sprec.Mat4) {\n\tif c.currentLayer == c.topLayer {\n\t\tc.currentLayer.Transform = transform\n\t} else {\n\t\tc.currentLayer.Transform = sprec.Mat4Prod(\n\t\t\tc.currentLayer.previous.Transform,\n\t\t\ttransform,\n\t\t)\n\t}\n}", "func (v Vector) Rotate(degrees float64, axis Vector) (Vector, error) {\n\tvar ok bool\n\tif axis, ok = axis.Normalize(); !ok {\n\t\treturn Vector{}, fmt.Errorf(\"the zero vector cannot be used as an axis of rotation\")\n\t}\n\n\tangle := degrees / 180.0 * math.Pi\n\n\trotationMatrix := [][]float64{\n\t\t{\n\t\t\tmath.Cos(angle) + axis.X*axis.X*(1-math.Cos(angle)),\n\t\t\taxis.X*axis.Y*(1-math.Cos(angle)) - axis.Z*math.Sin(angle),\n\t\t\taxis.X*axis.Z*(1-math.Cos(angle)) + axis.Y*math.Sin(angle),\n\t\t}, {\n\t\t\taxis.Y*axis.X*(1-math.Cos(angle)) + axis.Z*math.Sin(angle),\n\t\t\tmath.Cos(angle) + axis.Y*axis.Y*(1-math.Cos(angle)),\n\t\t\taxis.Y*axis.Z*(1-math.Cos(angle)) - axis.X*math.Sin(angle),\n\t\t}, {\n\t\t\taxis.Z*axis.X*(1-math.Cos(angle)) - axis.Y*math.Sin(angle),\n\t\t\taxis.Z*axis.Y*(1-math.Cos(angle)) + axis.X*math.Sin(angle),\n\t\t\tmath.Cos(angle) + axis.Z*axis.Z*(1-math.Cos(angle)),\n\t\t},\n\t}\n\n\treturn Multiply(rotationMatrix, v), nil\n}", "func (ag *Agent) Rotate(v float32) {\n\tag.R += v\n}", "func (q Quat) AxisRotation() (Vec3f, float32) {\n\t// Based on: http://glmatrix.net/docs/module-quat.html\n\trad := q.Angle()\n\ts := math32.Sin(rad * 0.5)\n\tif s < Epsilon { // no rotation\n\t\treturn Vec3f{1, 0, 0}, rad\n\t}\n\treturn Vec3f{q.X / s, q.Y / s, q.Z / s}, rad\n}", "func RotationX(theta float64) *Gate {\n\t// R_x(theta) = cos(theta/2)I - i sin(theta/2)X\n\tt := theta/2\n\tcos := complex(math.Cos(t), 0)\n\tnisin := complex(0, -1 * math.Sin(t))\n\treturn newOneQubitGate([4]complex128{\n\t\tcos, nisin,\n\t\tnisin, cos})\n}", "func (l *Line) SetAngleRadians(angle float64) float64 {\n\treturn l.RotateRadians(angle - l.angle)\n}", "func (me TxsdAnimateTransformTypeType) IsRotate() bool { return me.String() == \"rotate\" }", "func (m *PrinterDefaults) SetOrientation(value *PrintOrientation)() {\n err := m.GetBackingStore().Set(\"orientation\", value)\n if err != nil {\n panic(err)\n }\n}", "func (me *XsdGoPkgHasElems_Rotation) Walk() (err error) {\r\n\tif fn := WalkHandlers.XsdGoPkgHasElems_Rotation; me != nil {\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "func RotationZ(theta float64) *Gate {\n\t// R_z(theta) = cos(theta/2)I - i sin(theta/2)Z\n\tt := theta/2\n\tnexp := cmplx.Exp(complex(0, -1 * t))\n\texp := cmplx.Exp(complex(0, t))\n\treturn newOneQubitGate([4]complex128{\n\t\tnexp, 0,\n\t\t0, exp})\n}", "func (this *RectangleShape) GetRotation() float32 {\n\treturn float32(C.sfRectangleShape_getRotation(this.cptr))\n}", "func (rx *RotationX) SetMaterial(m material.Material) {\r\n\trx.Primitive.SetMaterial(m)\r\n}", "func (self Transform) RotateWithCenter(angle, centerX, centerY float32) {\n\tC.sfTransform_rotateWithCenter(self.Cref, C.float(angle), C.float(centerX), C.float(centerY))\n}", "func (r *RotatingFile) Rotate() error {\n\tnewFile, err := r.reopen()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer r.lock.Unlock()\n\tr.lock.Lock()\n\toldFile := r.file\n\tr.file = newFile\n\toldFile.Close()\n\treturn nil\n}", "func (self *TileSprite) SetAngleA(member int) {\n self.Object.Set(\"angle\", member)\n}", "func (r *GrayRotator) Rotate90() {\n\tsrc := r.Img\n\tsrcB := src.Bounds()\n\tsrcWidth := srcB.Dx()\n\tsrcHeight := srcB.Dy()\n\n\tdst := image.NewGray(image.Rect(0, 0, srcHeight, srcWidth))\n\n\tvar x, y, srcIdx, dstIdx int64\n\tmaxX, maxY := int64(srcWidth), int64(srcHeight)\n\tsrcStride, dstStride := int64(src.Stride), int64(dst.Stride)\n\tsrcPix := src.Pix\n\tdstPix := dst.Pix\n\tfor y = 0; y < maxY; y++ {\n\t\tfor x = 0; x < maxX; x++ {\n\t\t\tsrcIdx = y*srcStride + x\n\t\t\tdstIdx = x*dstStride + (maxY - 1 - y)\n\t\t\tdstPix[dstIdx] = srcPix[srcIdx]\n\t\t}\n\t}\n\n\tr.Img = dst\n}", "func (m Mat4) Rotation() Quat {\n\t// This is calculated by inversing the equations for\n\t// quat.OrientationX, quat.OrientationY and quat.OrientationZ.\n\n\tsqrX := (1.0 + m.M11 - m.M22 - m.M33) / 4.0\n\tsqrY := (1.0 - m.M11 + m.M22 - m.M33) / 4.0\n\tsqrZ := (1.0 - m.M11 - m.M22 + m.M33) / 4.0\n\n\tvar x, y, z, w float32\n\tif sqrZ > sqrX && sqrZ > sqrY { // Z is largest\n\t\tif Abs(sqrZ) < Epsilon {\n\t\t\treturn IdentityQuat()\n\t\t}\n\t\tz = Sqrt(sqrZ)\n\t\tx = (m.M31 + m.M13) / (4 * z)\n\t\ty = (m.M32 + m.M23) / (4 * z)\n\t\tw = (m.M21 - m.M12) / (4 * z)\n\t} else if sqrY > sqrX { // Y is largest\n\t\tif Abs(sqrY) < Epsilon {\n\t\t\treturn IdentityQuat()\n\t\t}\n\t\ty = Sqrt(sqrY)\n\t\tx = (m.M21 + m.M12) / (4 * y)\n\t\tz = (m.M32 + m.M23) / (4 * y)\n\t\tw = (m.M13 - m.M31) / (4 * y)\n\t} else { // X is largest\n\t\tif Abs(sqrX) < Epsilon {\n\t\t\treturn IdentityQuat()\n\t\t}\n\t\tx = Sqrt(sqrX)\n\t\ty = (m.M21 + m.M12) / (4 * x)\n\t\tz = (m.M31 + m.M13) / (4 * x)\n\t\tw = (m.M32 - m.M23) / (4 * x)\n\t}\n\treturn UnitQuat(NewQuat(w, x, y, z))\n}", "func (o *CanvasItem) X_EditGetRotation() gdnative.Real {\n\t//log.Println(\"Calling CanvasItem.X_EditGetRotation()\")\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(\"CanvasItem\", \"_edit_get_rotation\")\n\n\t// Call the parent method.\n\t// float\n\tretPtr := gdnative.NewEmptyReal()\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.NewRealFromPointer(retPtr)\n\treturn ret\n}", "func (r *ImageRef) Rotate(angle Angle) error {\n\twidth := r.Width()\n\n\tif r.Pages() > 1 && (angle == Angle90 || angle == Angle270) {\n\t\tif angle == Angle270 {\n\t\t\tif err := r.Flip(DirectionHorizontal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif err := r.Grid(r.GetPageHeight(), r.Pages(), 1); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif angle == Angle270 {\n\t\t\tif err := r.Flip(DirectionHorizontal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tout, err := vipsRotate(r.image, angle)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.setImage(out)\n\n\tif r.Pages() > 1 && (angle == Angle90 || angle == Angle270) {\n\t\tif err := r.SetPageHeight(width); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (s *Scene) SetGravity(gravity dprec.Vec3) {\n\ts.gravity = gravity\n}", "func (self *Graphics) SetAngleA(member int) {\n self.Object.Set(\"angle\", member)\n}", "func (o *CanvasItem) X_EditUseRotation() gdnative.Bool {\n\t//log.Println(\"Calling CanvasItem.X_EditUseRotation()\")\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(\"CanvasItem\", \"_edit_use_rotation\")\n\n\t// Call the parent method.\n\t// bool\n\tretPtr := gdnative.NewEmptyBool()\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.NewBoolFromPointer(retPtr)\n\treturn ret\n}", "func (tr *RotateTransformation) Transform(ctx context.Context, im image.Image) (image.Image, error) {\n\treturn RotateImageWithOrientation(ctx, im, tr.orientation)\n}", "func Rotate(v *Vec, angle float64) *Vec {\n\tsin, cos := math.Sincos(angle)\n\treturn &Vec{\n\t\tv.X*cos - v.Y*sin,\n\t\tv.X*sin + v.Y*cos,\n\t}\n}", "func (r *RGBARotator) Rotate90() {\n\tsrc := r.Img\n\tsrcB := src.Bounds()\n\tsrcWidth := srcB.Dx()\n\tsrcHeight := srcB.Dy()\n\n\tdst := image.NewRGBA(image.Rect(0, 0, srcHeight, srcWidth))\n\n\tvar x, y, srcIdx, dstIdx int64\n\tmaxX, maxY := int64(srcWidth), int64(srcHeight)\n\tsrcStride, dstStride := int64(src.Stride), int64(dst.Stride)\n\tsrcPix := src.Pix\n\tdstPix := dst.Pix\n\tfor y = 0; y < maxY; y++ {\n\t\tfor x = 0; x < maxX; x++ {\n\t\t\tsrcIdx = y*srcStride + (x << 2)\n\t\t\tdstIdx = x*dstStride + ((maxY - 1 - y) << 2)\n\t\t\tcopy(dstPix[dstIdx:dstIdx+4], srcPix[srcIdx:srcIdx+4])\n\t\t}\n\t}\n\n\tr.Img = dst\n}", "func (w *FileLogWriter) SetRotateSize(maxsize int) *FileLogWriter {\n\t//fmt.Fprintf(os.Stderr, \"FileLogWriter.SetRotateSize: %v\\n\", maxsize)\n\tw.maxsize = maxsize\n\treturn w\n}" ]
[ "0.8625573", "0.8057875", "0.8017207", "0.77256304", "0.7505977", "0.74746484", "0.74095", "0.7240528", "0.7185497", "0.7154693", "0.6705631", "0.6337583", "0.6166817", "0.602419", "0.6017595", "0.59994197", "0.59966457", "0.5940456", "0.5913534", "0.5878609", "0.5819131", "0.57854635", "0.564823", "0.5597285", "0.5563502", "0.55405444", "0.55341613", "0.5525975", "0.5476779", "0.5465202", "0.5441467", "0.5418305", "0.54138577", "0.536219", "0.5341043", "0.52764624", "0.5269768", "0.52674115", "0.5250213", "0.52081776", "0.5192098", "0.5186578", "0.5147287", "0.51378703", "0.51311994", "0.5103847", "0.50917786", "0.5039657", "0.5031884", "0.50246054", "0.5022989", "0.4984123", "0.49702302", "0.49563965", "0.49358764", "0.49332753", "0.49222943", "0.49154803", "0.49138814", "0.48885223", "0.48870623", "0.48481017", "0.4844001", "0.48360625", "0.48265162", "0.48185006", "0.47697997", "0.47581697", "0.47430778", "0.47379458", "0.47343725", "0.47023755", "0.46957165", "0.46850333", "0.46818212", "0.4668588", "0.46669418", "0.46654946", "0.4664351", "0.46546188", "0.46545458", "0.4615579", "0.46117184", "0.46097", "0.45775238", "0.4563774", "0.45621932", "0.45612207", "0.45557225", "0.45023498", "0.4497925", "0.44932166", "0.44693863", "0.4463818", "0.4445872", "0.44326976", "0.44022414", "0.43917432", "0.43833047", "0.4367569" ]
0.85688853
1
SetTranslation sets transform translation.
func (t *Transform) SetTranslation(tx, ty float64) *Transform { t.Translation.X = tx t.Translation.Y = ty return t }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *Surface) SetTransform(a, b, c, d, e, f float64) {\n\ts.Ctx.Call(\"setTransform\", a, b, c, d, e, f)\n}", "func (g *Group) SetTransform(m *algebra.Matrix) {\n\tif len(m.Get()) != 4 || len(m.Get()[0]) != 4 {\n\t\tpanic(algebra.ExpectedDimension(4))\n\t}\n\tg.transform = m\n}", "func (c *canvasRenderer) SetTransform(transform sprec.Mat4) {\n\tif c.currentLayer == c.topLayer {\n\t\tc.currentLayer.Transform = transform\n\t} else {\n\t\tc.currentLayer.Transform = sprec.Mat4Prod(\n\t\t\tc.currentLayer.previous.Transform,\n\t\t\ttransform,\n\t\t)\n\t}\n}", "func (t *Transform) Translate(tx, ty float64) {\n\tout := fmt.Sprintf(\"translate(%g,%g)\", tx, ty)\n\n\tt.transforms = append(t.transforms, out)\n}", "func (ts *TextState) Translate(tx, ty float64) {\n\tts.Tm = transform.TranslationMatrix(tx, ty).Mult(ts.Tm)\n}", "func (obj *Device) SetTransform(state TRANSFORMSTATETYPE, matrix MATRIX) Error {\n\tret, _, _ := syscall.Syscall(\n\t\tobj.vtbl.SetTransform,\n\t\t3,\n\t\tuintptr(unsafe.Pointer(obj)),\n\t\tuintptr(state),\n\t\tuintptr(unsafe.Pointer(&matrix[0])),\n\t)\n\treturn toErr(ret)\n}", "func SetLanguage(language string) {\n\tif _, ok := supportedTranslations[language]; ok {\n\t\tgotext.SetLanguage(language)\n\t\treturn\n\t}\n\tgotext.SetLanguage(defaultLanguage)\n}", "func (t *transform) Translate(translate mgl32.Vec3) {\n\tt.dataLock.Lock()\n\tdefer t.dataLock.Unlock()\n\tt.translation = t.translation.Add(translate)\n\ttrans := t.translation\n\tt.modelView = t.modelView.Mul4(mgl32.Translate3D(trans.X(), trans.Y(), trans.Z()))\n}", "func (self Text) SetRotation(angle float32) {\n\tC.sfText_setRotation(self.Cref, C.float(angle))\n}", "func (st *SetTranslation) Set(db XODB) (*Set, error) {\n\treturn SetByCode(db, st.Setcode.String)\n}", "func (il *IL) Translation(source string, context ...string) string {\n\tfor _, locale := range il.locales {\n\t\tif sourceKey2Trans, ok := il.locale2SourceKey2Trans[locale]; ok {\n\t\t\tif trans, ok := sourceKey2Trans[sourceKey(source, context)]; ok {\n\t\t\t\treturn trans\n\t\t\t}\n\t\t}\n\t}\n\n\treturn source\n}", "func (self Transform) Translate(x, y float32) {\n\tC.sfTransform_translate(self.Cref, C.float(x), C.float(y))\n}", "func SetTranslationByID(db XODB, id NullInt64) (*SetTranslation, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`id, language, setCode, translation ` +\n\t\t`FROM set_translations ` +\n\t\t`WHERE id = ?`\n\n\t// run query\n\tXOLog(sqlstr, id)\n\tst := SetTranslation{\n\t\t_exists: true,\n\t}\n\n\terr = db.QueryRow(sqlstr, id).Scan(&st.ID, &st.Language, &st.Setcode, &st.Translation)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &st, nil\n}", "func (t *Translator) SetLocale(l string) error {\n\terr := t.AssertValidLocale(l)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = t.loadResource(l)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tt.locale = l\n\n\treturn nil\n}", "func (canvas *Canvas) Translate(x, y Unit) {\n\twriteCommand(canvas.contents, \"cm\", 1, 0, 0, 1, x, y)\n}", "func Translation(t vec.Vec) Matrix {\n\treturn Matrix{1, 0, 0, 1, t.X, t.Y}\n}", "func (this *Transformable) SetRotation(rot float32) {\n\tC.sfTransformable_setRotation(this.cptr, C.float(rot))\n}", "func (e *HTMLApplet) Translate(v bool) *HTMLApplet {\n\tif v {\n\t\te.a[\"translate\"] = \"\"\n\t} else {\n\t\tdelete(e.a, \"translate\")\n\t}\n\treturn e\n}", "func (l *Localizer) SetLanguage(tag language.Tag) {\n\tif l.isUnd(tag) {\n\t\ttag = DefaultLanguage\n\t}\n\n\tl.LanguageTag = tag\n\tl.LoadTranslations()\n}", "func (st *SetTranslation) Update(db XODB) error {\n\tvar err error\n\n\t// if doesn't exist, bail\n\tif !st._exists {\n\t\treturn errors.New(\"update failed: does not exist\")\n\t}\n\n\t// if deleted, bail\n\tif st._deleted {\n\t\treturn errors.New(\"update failed: marked for deletion\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `UPDATE set_translations SET (` +\n\t\t`language, setCode, translation` +\n\t\t`) = ( ` +\n\t\t`?, ?, ?` +\n\t\t`) WHERE id = $4`\n\n\t// run query\n\tXOLog(sqlstr, st.Language, st.Setcode, st.Translation, st.ID)\n\t_, err = db.Exec(sqlstr, st.Language, st.Setcode, st.Translation, st.ID)\n\treturn err\n}", "func (t *transform) Set(modelView mgl32.Mat4) {\n\tt.dataLock.Lock()\n\tdefer t.dataLock.Unlock()\n\tt.modelView = modelView\n}", "func SetLocale(locale string) error {\n\tif matched, _ := regexp.MatchString(localeRegexp, locale); !matched {\n\t\treturn fmt.Errorf(\"Malformated locale string %s\", locale)\n\t}\n\tlocale = strings.Replace(locale, \"-\", \"_\", -1)\n\tparts := strings.Split(locale, \"_\")\n\tlang := parts[0]\n\tlog.Debugf(\"Setting locale %v\", locale)\n\tnewTrMap := make(map[string]string)\n\tmergeLocaleToMap(newTrMap, defaultLang)\n\tmergeLocaleToMap(newTrMap, defaultLocale)\n\tmergeLocaleToMap(newTrMap, lang)\n\tmergeLocaleToMap(newTrMap, locale)\n\tif len(newTrMap) == 0 {\n\t\treturn fmt.Errorf(\"Not found any translations, locale not set\")\n\t}\n\tlog.Tracef(\"Translations: %v\", newTrMap)\n\ttrMutex.Lock()\n\tdefer trMutex.Unlock()\n\ttrMap = newTrMap\n\treturn nil\n}", "func (trans *JSONTranslater) Translate(sl, tl language.Tag) error {\n\tvar err error\n\ttrans.Translation, err = convert(trans.Client, trans.Original, sl, tl)\n\treturn err\n}", "func (t *Transform) SetRot(r lmath.Vec3) {\n\tt.access.Lock()\n\tif t.rot != r {\n\t\tt.built = nil\n\t\tt.quat = nil\n\t\tt.rot = r\n\t}\n\tt.access.Unlock()\n}", "func (p *Page) Translate(x, y float64) {\n\tfmt.Fprintf(p.contents, \"1 0 0 1 %g %g cm \", x, y)\n}", "func SetLanguage(language string) {\r\n\tcurrentLanguage = language\r\n}", "func (trans *HTMLTranslater) Translate(sl, tl language.Tag) error {\n\tif trans.Client == nil {\n\t\treturn errors.New(\"translate client is nil\")\n\t}\n\n\tvar original = []string{\n\t\ttrans.Original,\n\t}\n\n\ttranslations, err := trans.Client.Translate(context.Background(), original, tl, &translate.Options{\n\t\tSource: sl,\n\t\tFormat: translate.HTML,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttrans.Translation = translations[0].Text\n\n\treturn nil\n}", "func (o *SmsPreviewRequest) SetTransliteration(v string) {\n\to.Transliteration = &v\n}", "func (_Contract *ContractTransactor) SetText(opts *bind.TransactOpts, node [32]byte, key string, value string) (*types.Transaction, error) {\n\treturn _Contract.contract.Transact(opts, \"setText\", node, key, value)\n}", "func translation(xs []string) (transform.Transformation, error) {\n\tif len(xs) != 1 {\n\t\treturn nil, ErrBadTransformation\n\t}\n\tv, err := Vector(xs[0])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn transform.Translation(v), nil\n}", "func SetViewTransform(viewID ViewID, view, proj [16]float32) {\n\tC.bgfx_set_view_transform(\n\t\tC.ushort(viewID),\n\t\tunsafe.Pointer(&view[0]),\n\t\tunsafe.Pointer(&proj[0]),\n\t)\n}", "func (v *IADsNameTranslate) Set(adsPath string, setType uint32) (err error) {\n\treturn ole.NewError(ole.E_NOTIMPL)\n}", "func (_ResolverContract *ResolverContractTransactor) SetText(opts *bind.TransactOpts, node [32]byte, key string, value string) (*types.Transaction, error) {\n\treturn _ResolverContract.contract.Transact(opts, \"setText\", node, key, value)\n}", "func (self Text) SetScale(x, y float32) {\n\tv := C.sfVector2f{C.float(x), C.float(y)}\n\tC.sfText_setScale(self.Cref, v)\n}", "func (e *HTMLTableRow) Translate(v bool) *HTMLTableRow {\n\tif v {\n\t\te.a[\"translate\"] = \"\"\n\t} else {\n\t\tdelete(e.a, \"translate\")\n\t}\n\treturn e\n}", "func (r Rectangle) Translation() Transform {\n\treturn Identity().Translate(float32(r.X)+float32(r.Width)/2.0,\n\t\tfloat32(r.Y)+float32(r.Height)/2.0)\n}", "func (p *Proc) Translate(x, y float64) {\n\tp.stk.translate(x, y)\n}", "func (s *RegexMatchTuple) SetTextTransformation(v string) *RegexMatchTuple {\n\ts.TextTransformation = &v\n\treturn s\n}", "func SetDefaultLocale(newLocale string) error {\n\tif trans == nil {\n\t\treturn errors.New(\"translations are not initialized\")\n\t}\n\tif checkLocale(newLocale) {\n\t\ttrans.defaultLocale = newLocale\n\t\treturn nil\n\t}\n\treturn errors.New(\"locale is not found\")\n}", "func (t *Transform) SetParent(p Transformable) {\n\tt.access.Lock()\n\tif t.parent != p {\n\t\tt.built = nil\n\t\tt.parent = p\n\t}\n\tt.access.Unlock()\n}", "func (s *XssMatchTuple) SetTextTransformation(v string) *XssMatchTuple {\n\ts.TextTransformation = &v\n\treturn s\n}", "func SetLocale(o orm.Ormer, lang, code, message string) error {\n\tvar it Locale\n\terr := o.QueryTable(&it).\n\t\tFilter(\"lang\", lang).\n\t\tFilter(\"code\", code).\n\t\tOne(&it, \"id\")\n\n\tif err == nil {\n\t\t_, err = o.QueryTable(&it).Filter(\"id\", it.ID).Update(orm.Params{\n\t\t\t\"message\": message,\n\t\t\t\"updated_at\": time.Now(),\n\t\t})\n\t} else if err == orm.ErrNoRows {\n\t\tit.Lang = lang\n\t\tit.Code = code\n\t\tit.Message = message\n\t\t_, err = o.Insert(&it)\n\t}\n\treturn err\n}", "func (y *Handler) translation(ctx context.Context) (result.Translation, error) {\n\tif y.isDictionary {\n\t\trequest := &dictionary.Request{\n\t\t\tKey: y.config.Dictionary,\n\t\t\tText: y.text,\n\t\t\tTargetLanguageCode: y.toLanguage,\n\t\t\tSourceLanguageCode: y.fromLanguage,\n\t\t}\n\t\treturn dictionary.Translate(ctx, y.client, y.config, request)\n\t}\n\n\trequest := &translation.Request{\n\t\tFolderID: y.config.Translation.FolderID,\n\t\tTexts: []string{y.text},\n\t\tSourceLanguageCode: y.fromLanguage,\n\t\tTargetLanguageCode: y.toLanguage,\n\t}\n\treturn translation.Translate(ctx, y.client, y.config, request)\n}", "func SetLocale(locale string) {\n\tcurrentLocale = locale\n}", "func (st *SetTranslation) Save(db XODB) error {\n\tif st.Exists() {\n\t\treturn st.Update(db)\n\t}\n\n\treturn st.Insert(db)\n}", "func (r *Resolver) SetText(opts *bind.TransactOpts, name string, value string) (*types.Transaction, error) {\n\tnameHash, err := NameHash(r.domain)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn r.Contract.SetText(opts, nameHash, name, value)\n}", "func (s *ByteMatchTuple) SetTextTransformation(v string) *ByteMatchTuple {\n\ts.TextTransformation = &v\n\treturn s\n}", "func (dw *DrawingWand) Translate(x, y float64) {\n\tC.MagickDrawTranslate(dw.dw, C.double(x), C.double(y))\n}", "func (l *Localizer) SetLocale(al string) {\n\tl.SetLanguage(l.matchByString(al))\n}", "func (s *Surface) Translate(x, y float64) {\n\ts.Ctx.Call(\"translate\", math.Floor(x), math.Floor(y))\n}", "func (s *SqlInjectionMatchTuple) SetTextTransformation(v string) *SqlInjectionMatchTuple {\n\ts.TextTransformation = &v\n\treturn s\n}", "func SetLanguage(chatId string, lang string) error {\n\tchat, err := GetChatWithId(chatId)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttag, _ := language.MatchStrings(i18n.Matcher, lang)\n\tif tag.String() == lang { // if the language is supported, update the chat\n\t\tchat.Language = tag.String()\n\t\treturn updateChat(chat)\n\t}\n\n\treturn fmt.Errorf(\"unsupported language\")\n}", "func (_ResolverContract *ResolverContractTransactorSession) SetText(node [32]byte, key string, value string) (*types.Transaction, error) {\n\treturn _ResolverContract.Contract.SetText(&_ResolverContract.TransactOpts, node, key, value)\n}", "func (c2d *C2DMatrix) Translate(x, y float64) {\n\tvar mat Matrix\n\n\tmat.m11 = 1\n\tmat.m12 = 0\n\tmat.m13 = 0\n\n\tmat.m21 = 0\n\tmat.m22 = 1\n\tmat.m23 = 0\n\n\tmat.m31 = x\n\tmat.m32 = y\n\tmat.m33 = 1\n\n\t//and multiply\n\tc2d.MatrixMultiply(mat)\n}", "func (i *Internationalization) Translate(lang, key string) string {\n\tt, err := language.Parse(lang)\n\tif err != nil {\n\t\tt = i.fallback\n\t}\n\treturn i.translate(t, key)\n}", "func (t *Transform) SetScale(sx, sy float64) *Transform {\n\tt.Scale1.X = sx - 1\n\tt.Scale1.Y = sy - 1\n\treturn t\n}", "func (t *Transform) SetPos(p lmath.Vec3) {\n\tt.access.Lock()\n\tif t.pos != p {\n\t\tt.built = nil\n\t\tt.pos = p\n\t}\n\tt.access.Unlock()\n}", "func (s *SizeConstraint) SetTextTransformation(v string) *SizeConstraint {\n\ts.TextTransformation = &v\n\treturn s\n}", "func (s *Surface) Transform(a, b, c, d, e, f float64) {\n\ts.Ctx.Call(\"transform\", a, b, c, d, e, f)\n}", "func (me *TxsdAnimateTransformTypeType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (t Translation) Translate(s, lang string) string {\n\tif val, ok := t.Phrases[s]; ok {\n\t\treturn val[t.Languages[lang]]\n\t}\n\n\treturn \"Phrase can't be translated\"\n}", "func (canvas *Canvas) Transform(a, b, c, d, e, f float32) {\n\twriteCommand(canvas.contents, \"cm\", a, b, c, d, e, f)\n}", "func (_Contract *ContractTransactorSession) SetText(node [32]byte, key string, value string) (*types.Transaction, error) {\n\treturn _Contract.Contract.SetText(&_Contract.TransactOpts, node, key, value)\n}", "func (_ResolverContract *ResolverContractSession) SetText(node [32]byte, key string, value string) (*types.Transaction, error) {\n\treturn _ResolverContract.Contract.SetText(&_ResolverContract.TransactOpts, node, key, value)\n}", "func (in *ActionMailTemplateTranslationUpdateInput) SetLanguage(value int64) *ActionMailTemplateTranslationUpdateInput {\n\tin.Language = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin.SetLanguageNil(false)\n\tin._selectedParameters[\"Language\"] = nil\n\treturn in\n}", "func (ts *TranslationService) Translate(key string, defaultLabel string, localeCode string, count int, translationArguments map[string]interface{}) string {\n\tts.reloadFilesIfNecessary()\n\tlabel, err := ts.translateWithLib(localeCode, key, count, translationArguments)\n\n\tif err != nil {\n\t\t//default to key (=untranslated) on error\n\t\tlabel = key\n\t}\n\n\t//Fallback if label was not translated\n\tif label == key && defaultLabel != \"\" {\n\t\treturn ts.parseDefaultLabel(defaultLabel, key, translationArguments)\n\t}\n\treturn label\n\n}", "func (t *Transform) SetRotation(r float64) ITransform {\n\tt.Rotation = r\n\treturn t\n}", "func (xf *Transform) SetScale(scale float32) {\n\txf.Scale = mgl32.Vec2{scale, scale}\n}", "func SetLanguage(language string) {\n\tif constants.GetAvailableSelectionID(language, constants.AvailableLangs, -1) < 0 {\n\t\tsetValue(\"common\", \"language\", getDefault(\"common\", \"language\"))\n\t} else {\n\t\tsetValue(\"common\", \"language\", language)\n\t}\n}", "func (p *Path) Translate(x, y float64) *Path {\n\treturn p.Transform(Identity.Translate(x, y))\n}", "func (g *Goi18n) SetLanguage(lang string, desc string) bool {\n\tif g.IsExist(lang) {\n\t\tg.langDescs[lang] = desc\n\t\tif err := g.Reload(lang); err != nil {\n\t\t\tfmt.Printf(\"Goi18n.SetLanguage: %v\\n\", err)\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t} else {\n\t\treturn g.add(&locale{lang: lang, langDesc: desc})\n\t}\n}", "func (transform *Transform) SetPosition(newPos mgl32.Vec3) {\n\ttransform.objMatrix.SetRow(3, mgl32.Vec4{newPos.X(), newPos.Y(), newPos.Z()})\n}", "func (self *Geometry) Translate(tx float32, ty float32, tz float32) *Geometry {\n\tfor i := 0; i < len(self.verts); i++ {\n\t\tself.verts[i][0] += tx\n\t\tself.verts[i][1] += ty\n\t\tself.verts[i][2] += tz\n\t}\n\tself.Clear(false, true, true)\n\treturn self\n}", "func (p *Part) SetScale(scale vector.Vector) {\n\tif scale.Len() != 3 && scale.Kind() != reflect.Float32 {\n\t\tlog.Fatalf(\"Part.SetScale: expects 3D-Float32 vector, got %dD-%v\", scale.Len(), scale.Kind())\n\t}\n\t// Create scaling matrix\n\tp.scaling = matrix.NewMatrix([][]float32{\n\t\t{scale.Get(0).(float32), 0.0, 0.0},\n\t\t{0.0, scale.Get(1).(float32), 0.0},\n\t\t{0.0, 0.0, scale.Get(2).(float32)},\n\t})\n}", "func (self Text) SetUnicodeString(s string) {\n\t/* Go string are encoded in UTF-8, whereas SFML unicode\n\tstrings are encoded in UTF-32, so we have to make the\n\tconversion */\n\tbs := []byte(s)\n\tn := utf8.RuneCount(bs)\n\trunes := make([]rune, n+1)\n\tvar size int\n\ti := 0\n\tj := 0\n\tfor ; i < n; i += 1 {\n\t\trunes[i], size = utf8.DecodeRune(bs[j:])\n\t\tj += size\n\t}\n\trunes[i] = 0 /* don't forget the null terminator */\n\tC.sfText_setUnicodeString(self.Cref, (*C.sfUint32)(unsafe.Pointer(&runes[0])))\n}", "func (client *Client) SetLanguage(langs ...string) error {\n\tif len(langs) == 0 {\n\t\treturn fmt.Errorf(\"languages cannot be empty\")\n\t}\n\n\tclient.Languages = langs\n\n\tclient.flagForInit()\n\n\treturn nil\n}", "func (r *AWSAutoScalingPlansScalingPlan_ScalingInstruction) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (p *Plane) SetRotation(rot mgl32.Mat4) {\n\tp.model.Rotation = rot\n}", "func NewTransform() Transform {\n\tt := transform{\n\t\tmodelView: mgl32.Ident4(),\n\t\trotation: mgl32.Vec3{0, 0, 0},\n\t\ttranslation: mgl32.Vec3{0, 0, 0},\n\t}\n\treturn &t\n}", "func (_BaseContentSpace *BaseContentSpaceTransactor) SetDescription(opts *bind.TransactOpts, content_space_description string) (*types.Transaction, error) {\n\treturn _BaseContentSpace.contract.Transact(opts, \"setDescription\", content_space_description)\n}", "func (t *Transform) SetQuat(q lmath.Quat) {\n\tt.access.Lock()\n\tif t.quat == nil || (*t.quat) != q {\n\t\tt.built = nil\n\t\tt.quat = &q\n\t}\n\tt.access.Unlock()\n}", "func (_Contract *ContractSession) SetText(node [32]byte, key string, value string) (*types.Transaction, error) {\n\treturn _Contract.Contract.SetText(&_Contract.TransactOpts, node, key, value)\n}", "func (n *Mod) SetLang(lang Lang) *Mod {\n\tn.Target.Lang = lang\n\treturn n\n}", "func SetLang(newLang string) error {\n\tfound := false\n\tfor _, l := range availLangs {\n\t\tif newLang == l {\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !found {\n\t\treturn ErrNoLanguageFn(newLang)\n\t}\n\tlang = newLang\n\treturn nil\n}", "func (this *Transformable) SetScale(scale Vector2f) {\n\tC.sfTransformable_setScale(this.cptr, scale.toC())\n}", "func (m *MailboxSettings) SetLanguage(value LocaleInfoable)() {\n err := m.GetBackingStore().Set(\"language\", value)\n if err != nil {\n panic(err)\n }\n}", "func (context *context) SetLanguage(lang string) error {\n\tif context.model.ctx == nil {\n\t\treturn ErrInternalAppError\n\t}\n\tif !context.model.IsMultilingual() {\n\t\treturn ErrModelNotMultilingual\n\t}\n\n\tif lang == \"auto\" {\n\t\tcontext.params.SetLanguage(-1)\n\t} else if id := context.model.ctx.Whisper_lang_id(lang); id < 0 {\n\t\treturn ErrUnsupportedLanguage\n\t} else if err := context.params.SetLanguage(id); err != nil {\n\t\treturn err\n\t}\n\t// Return success\n\treturn nil\n}", "func (t *Text) SetText(text string) {\n\tt.Content = str.NString(text)\n\tt.Dirty()\n}", "func (self Text) SetOrigin(x, y float32) {\n\tv := C.sfVector2f{C.float(x), C.float(y)}\n\tC.sfText_setOrigin(self.Cref, v)\n}", "func (c *Client) TranslateText(ctx context.Context, params *params.TranslateTextParams) (*types.TranslateTextResponse, *types.ErrorResponse, error) {\n\tvar res types.TranslateTextResponse\n\n\tendpoint := c.EndpointBase + types.EndpointTranslateText\n\tparams.SetAuthnKey(c.AuthenticationKey)\n\trequester := NewRequester(endpoint, params)\n\n\terrRes, err := requester.Exec(&res)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif errRes != nil {\n\t\treturn nil, errRes, nil\n\t}\n\n\treturn &res, nil, nil\n}", "func (o *ServerName) SetTransformations(v []TransformationBase) {\n\to.Transformations = &v\n}", "func (t *Text) Set(k string, v string) {\n\tif err := ValidateTextKey(k); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := ValidateTextValue(v); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif t.m == nil {\n\t\tt.m = map[string]string{k: v}\n\t} else {\n\t\tt.m[k] = v\n\t}\n}", "func (p *PipelineBuild) Translate(lang string) {\n\tfor ks := range p.Stages {\n\t\tfor kj := range p.Stages[ks].PipelineBuildJobs {\n\t\t\tp.Stages[ks].PipelineBuildJobs[kj].Translate(lang)\n\t\t}\n\t}\n}", "func (tb *PrincipalVariationTable) Set(p *position.Position, mv position.Movekey) {\n\t(*tb)[p.GetPosKey()] = mv\n}", "func Transform(t transform.Transformer, filename string) error {\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\tw, err := Writer(filename, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer w.Close()\n\n\tif _, err := io.Copy(w, transform.NewReader(f, t)); err != nil {\n\t\treturn err\n\t}\n\treturn w.Commit()\n}", "func (ed *Editor) SetText(text string) {\n\tif ed.getTextarea() == nil {\n\t\tconsole.Log(\"editor.SetText() getTextarea() is nil\")\n\t\treturn\n\t}\n\ted.ta.SetValue(text)\n\ted.onChange(nil)\n}", "func (self Text) SetPosition(x, y float32) {\n\tv := C.sfVector2f{C.float(x), C.float(y)}\n\tC.sfText_setPosition(self.Cref, v)\n}", "func (m Matrix) Translate(v vec32.Vector) Matrix {\n\treturn Mul(m, Matrix{\n\t\t{1, 0, 0, 0},\n\t\t{0, 1, 0, 0},\n\t\t{0, 0, 1, 0},\n\t\t{v[0], v[1], v[2], 1},\n\t})\n}", "func Translate(sl string, tl string, q string) (AutoGenerated, error) {\n\tlink := getURL(tl)\n\ta, err := obtenerTraduccion(link, q, tl, sl)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn a, nil\n}", "func (w *TextWidget) SetText(text string) {\n\tw.text = text\n\tw.render()\n}" ]
[ "0.6251086", "0.59690094", "0.58699065", "0.5786746", "0.57243615", "0.5712761", "0.5690545", "0.5640491", "0.54449964", "0.5348975", "0.5331226", "0.5321163", "0.53097576", "0.5235144", "0.50976515", "0.5094021", "0.5056659", "0.5056363", "0.50562334", "0.50424784", "0.50373125", "0.503255", "0.50042295", "0.4964323", "0.4957486", "0.4952747", "0.49351826", "0.49292257", "0.490583", "0.48677427", "0.48645493", "0.48558372", "0.48511478", "0.4848541", "0.48162013", "0.4798986", "0.4797919", "0.47147384", "0.46988368", "0.46943843", "0.4686351", "0.46790242", "0.46444383", "0.46207196", "0.46186793", "0.46121415", "0.46086887", "0.45846558", "0.45810318", "0.45763937", "0.4556566", "0.45328304", "0.45140004", "0.45027536", "0.4497353", "0.4480298", "0.44660106", "0.44650295", "0.44611922", "0.44562247", "0.44486898", "0.4431777", "0.4423506", "0.44119817", "0.44101942", "0.4408876", "0.4389125", "0.43833837", "0.43829533", "0.4363078", "0.43584844", "0.43535367", "0.4343496", "0.43375129", "0.43343002", "0.4322469", "0.43193117", "0.4317133", "0.430837", "0.4284779", "0.42838457", "0.42715624", "0.42683533", "0.42617464", "0.42570996", "0.4235256", "0.4227029", "0.42247263", "0.4224662", "0.42161947", "0.42147076", "0.42124602", "0.42059824", "0.41940597", "0.41835296", "0.41810188", "0.41792262", "0.4178084", "0.41770452", "0.41658664" ]
0.822304
0
SetDepth sets transform depth.
func (t *Transform) SetDepth(depth float64) *Transform { t.Depth = depth return t }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *Dig) SetDepth(v int32) {\n\to.Depth = v\n}", "func (a *GetFlattenedDocumentArgs) SetDepth(depth int) *GetFlattenedDocumentArgs {\n\ta.Depth = &depth\n\treturn a\n}", "func (dev *Device) SetDepthMode(mode FrameMode) int {\n\treturn int(C.freenect_set_depth_mode(dev.ptr(), *mode.ptr()))\n}", "func (a *DescribeNodeArgs) SetDepth(depth int) *DescribeNodeArgs {\n\ta.Depth = &depth\n\treturn a\n}", "func (dev *Device) SetDepthBuffer(buf unsafe.Pointer) int {\n\treturn int(C.freenect_set_depth_buffer(dev.ptr(), buf))\n}", "func (a *GetDocumentArgs) SetDepth(depth int) *GetDocumentArgs {\n\ta.Depth = &depth\n\treturn a\n}", "func SetCallDepth(callDepth int) {\n\tstd.mu.Lock()\n\tdefer std.mu.Unlock()\n\tstd.callDepth = callDepth\n}", "func (a *RequestChildNodesArgs) SetDepth(depth int) *RequestChildNodesArgs {\n\ta.Depth = &depth\n\treturn a\n}", "func (buf *CommandBuffer) SetDepthBias(constantFactor, clamp, slopeFactor float32) {\n\tC.domVkCmdSetDepthBias(buf.fps[vkCmdSetDepthBias], buf.hnd, C.float(constantFactor), C.float(clamp), C.float(slopeFactor))\n}", "func SetDepthFunc(_func Enum) {\n\tc_func, _ := (C.GLenum)(_func), cgoAllocsUnknown\n\tC.glDepthFunc(c_func)\n}", "func (t *T) SetMaxDepth(d int) {\n\tt.maxDepth = d\n}", "func (l *Logger) SetCallDepth(d int) {\n\tl.calldepth = d\n}", "func (im *Image) SetChannelDepth(ch Channel, depth uint) error {\n\tif C.SetImageChannelDepth(im.image, C.ChannelType(ch), magickUint(depth)) == 0 {\n\t\treturn errors.New(\"error setting channel\")\n\t}\n\treturn nil\n}", "func (c *canvasRenderer) SetTransform(transform sprec.Mat4) {\n\tif c.currentLayer == c.topLayer {\n\t\tc.currentLayer.Transform = transform\n\t} else {\n\t\tc.currentLayer.Transform = sprec.Mat4Prod(\n\t\t\tc.currentLayer.previous.Transform,\n\t\t\ttransform,\n\t\t)\n\t}\n}", "func SetCallStackDepth(stackDepth int) {\n\tcallStackDepth = stackDepth\n}", "func (o *CatalogCategoryManagementV1GetTreeGetParams) SetDepth(depth *int64) {\n\to.Depth = depth\n}", "func ClearDepth(depth float64) {\n\tsyscall.Syscall(gpClearDepth, 1, uintptr(math.Float64bits(depth)), 0, 0)\n}", "func MakeDepth(width, height int) Texture {\n\ttex := Make(width, height, gl.DEPTH_COMPONENT, gl.DEPTH_COMPONENT,\n\t\tgl.UNSIGNED_BYTE, nil, gl.LINEAR, gl.LINEAR, gl.CLAMP_TO_BORDER,\n\t\tgl.CLAMP_TO_BORDER)\n\treturn tex\n}", "func WithDepth(depth int) Option {\n\treturn func(o *outputOpts) (*outputOpts, error) {\n\t\tif depth < 0 {\n\t\t\treturn nil, fmt.Errorf(\"invalid depth value %d, value must be >= 0\", depth)\n\t\t}\n\t\tc := o.copy()\n\t\tc.depth = depth\n\t\treturn c, nil\n\t}\n}", "func (s *SSL) SetVerifyDepth(depth int) {\n\tC.SSL_set_verify_depth(s.ssl, C.int(depth))\n}", "func (mParams *EncodingMatrixLiteral) Depth(actual bool) (depth int) {\n\tif actual {\n\t\tdepth = len(mParams.ScalingFactor)\n\t} else {\n\t\tfor i := range mParams.ScalingFactor {\n\t\t\tfor range mParams.ScalingFactor[i] {\n\t\t\t\tdepth++\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func (device *Device) SetDepthCallback(callback DepthCallback) {\n\n\tif _, ok := devices[device.device]; !ok {\n\t\tdevices[device.device] = device\n\t}\n\n\tC.freenect_set_depth_callback(device.device, (*[0]byte)(C.depthCallback))\n\tdevice.depthCallback = callback\n}", "func DepthMask(flag bool) {\n\tsyscall.Syscall(gpDepthMask, 1, boolToUintptr(flag), 0, 0)\n}", "func (s *Surface) SetTransform(a, b, c, d, e, f float64) {\n\ts.Ctx.Call(\"setTransform\", a, b, c, d, e, f)\n}", "func SetLevel(level Level) {\n\troot.SetLevel(level)\n}", "func (svc *batchService) UpdateDepth(id []byte, depth uint8, normalisedBalance *big.Int) error {\n\tb, err := svc.storer.Get(id)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"get: %w\", err)\n\t}\n\terr = svc.storer.Put(b, normalisedBalance, depth)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"put: %w\", err)\n\t}\n\n\tsvc.logger.Debugf(\"batch service: updated depth of batch id %s from %d to %d\", hex.EncodeToString(b.ID), b.Depth, depth)\n\treturn nil\n}", "func (c *Camera) SetPerspective(angle, ratio, zNear, zFar float32) {\n\tglm.PerspectiveIn(angle, ratio, zNear, zFar, &c.Projection)\n}", "func (c *Camera) SetZoom(z float64) {\n\tif z == 0.0 {\n\t\treturn\n\t}\n\tc.zoom = z\n\tc.zoomInv = 1 / z\n\tc.sTop = c.lookAtY + float64(c.screenH/2)*c.zoomInv\n\tc.sBottom = c.lookAtY - float64(c.screenH/2)*c.zoomInv\n\tc.sLeft = c.lookAtX - float64(c.screenW/2)*c.zoomInv\n\tc.sRight = c.lookAtX + float64(c.screenW/2)*c.zoomInv\n}", "func DepthMask(flag bool) {\n\tgl.DepthMask(flag)\n}", "func (native *OpenGL) DepthMask(mask bool) {\n\tgl.DepthMask(mask)\n}", "func (gl *WebGL) ClearDepth(depth float64) {\n\tgl.context.Call(\"clearDepth\", float32(depth))\n}", "func (rl *RevelLogger) SetStackDepth(amount int) MultiLogger {\n\trl.Logger.SetStackDepth(amount) // Ignore the logger returned\n\treturn rl\n}", "func (rl *RevelLogger) SetStackDepth(amount int) MultiLogger {\n\trl.Logger.SetStackDepth(amount) // Ignore the logger returned\n\treturn rl\n}", "func (n *FnDeclNode) SetTree(t *Tree) {\n\tn.tree = t\n}", "func (o *Options) SetMaxDepth(v int) *Options {\n\topts := *o\n\topts.maxDepth = v\n\treturn &opts\n}", "func DepthMask(flag bool) {\n\tC.glDepthMask(glBool(flag))\n}", "func (f *Fuzzer) MaxDepth(d int) *Fuzzer {\n\tf.maxDepth = d\n\treturn f\n}", "func setDepth(p0 int, pool []huffmanTree, depth []byte, max_depth int) bool {\n\tvar stack [16]int\n\tvar level int = 0\n\tvar p int = p0\n\tassert(max_depth <= 15)\n\tstack[0] = -1\n\tfor {\n\t\tif pool[p].index_left_ >= 0 {\n\t\t\tlevel++\n\t\t\tif level > max_depth {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tstack[level] = int(pool[p].index_right_or_value_)\n\t\t\tp = int(pool[p].index_left_)\n\t\t\tcontinue\n\t\t} else {\n\t\t\tdepth[pool[p].index_right_or_value_] = byte(level)\n\t\t}\n\n\t\tfor level >= 0 && stack[level] == -1 {\n\t\t\tlevel--\n\t\t}\n\t\tif level < 0 {\n\t\t\treturn true\n\t\t}\n\t\tp = stack[level]\n\t\tstack[level] = -1\n\t}\n}", "func ClearDepth(depth float64) {\n C.glowClearDepth(gpClearDepth, (C.GLdouble)(depth))\n}", "func DepthMask(flag Boolean) {\n\tcflag, _ := (C.GLboolean)(flag), cgoAllocsUnknown\n\tC.glDepthMask(cflag)\n}", "func (gl *WebGL) DepthFunc(function GLEnum) {\n\tgl.context.Call(\"depthFunc\", function)\n}", "func (c *Debugger) SetAsyncCallStackDepth(maxDepth int) (*gcdmessage.ChromeResponse, error) {\n\tparamRequest := make(map[string]interface{}, 1)\n\tparamRequest[\"maxDepth\"] = maxDepth\n\treturn gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: \"Debugger.setAsyncCallStackDepth\", Params: paramRequest})\n}", "func (w *WrapperChannel) UpdateMktDepth(reqID int64, position int64, operation int64, side int64, price float64, size int64) {\n\tlog.Fatal(\"WRAPPER FUNCTION NOT IMPLEMENTED\")\n}", "func (doDebugger Debugger) SetAsyncCallStackDepth(maxDepth int64) (err error) {\n\tb := debugger.SetAsyncCallStackDepth(maxDepth)\n\treturn b.Do(doDebugger.ctxWithExecutor)\n}", "func (c *Clac) Depth() error {\n\treturn c.Push(value.Int(len(c.Stack())))\n}", "func SetLevel(level Level) {\n\tgolevel = level\n}", "func Depth(index uint) (depth uint) {\n\tindex++\n\tfor (index & 1) == 0 {\n\t\tdepth++\n\t\tindex = rightShift(index)\n\t}\n\treturn\n}", "func (cc *ConstructionCreate) SetLevel(i int) *ConstructionCreate {\n\tcc.mutation.SetLevel(i)\n\treturn cc\n}", "func (n *Node) SetTreeSize(ctx context.Context, ts uint64) (err error) {\n\treturn n.SetXattrString(ctx, prefixes.TreesizeAttr, strconv.FormatUint(ts, 10))\n}", "func ClearDepthf(d float32) {\n\tsyscall.Syscall(gpClearDepthf, 1, uintptr(math.Float32bits(d)), 0, 0)\n}", "func SetLevel(lvs ...Level) {\n\tl.SetLevel(lvs...)\n}", "func (level *DepthOfMarketLevel) Set(price, volume float64, isBid bool) {\n\t(*level)[0] = price\n\tif isBid {\n\t\t(*level)[0] *= -1\n\t}\n\t(*level)[1] = volume\n}", "func (native *OpenGL) DepthFunc(xfunc uint32) {\n\tgl.DepthFunc(xfunc)\n}", "func (obj *Device) SetDepthStencilSurface(newZStencil *Surface) (err Error) {\n\tret, _, _ := syscall.Syscall(\n\t\tobj.vtbl.SetDepthStencilSurface,\n\t\t2,\n\t\tuintptr(unsafe.Pointer(obj)),\n\t\tuintptr(unsafe.Pointer(newZStencil)),\n\t\t0,\n\t)\n\treturn toErr(ret)\n}", "func DepthMask(flag bool) {\n\tC.glowDepthMask(gpDepthMask, (C.GLboolean)(boolToInt(flag)))\n}", "func DepthMask(flag bool) {\n\tC.glowDepthMask(gpDepthMask, (C.GLboolean)(boolToInt(flag)))\n}", "func (c *canvasRenderer) ResetTransform() {\n\tif c.currentLayer == c.topLayer {\n\t\tc.currentLayer.Transform = sprec.IdentityMat4()\n\t} else {\n\t\tc.currentLayer.Transform = c.currentLayer.previous.Transform\n\t}\n}", "func DepthFunc(fn Enum) {\n\tgl.DepthFunc(uint32(fn))\n}", "func (_Votes *VotesTransactor) SetLevel(opts *bind.TransactOpts, level uint8) (*types.Transaction, error) {\n\treturn _Votes.contract.Transact(opts, \"setLevel\", level)\n}", "func (n *RforkNode) SetTree(t *Tree) {\n\tn.tree = t\n}", "func (n *Node) SetTreeSize(ts uint64) (err error) {\n\treturn xattr.Set(n.InternalPath(), xattrs.TreesizeAttr, []byte(strconv.FormatUint(ts, 10)))\n}", "func ClearDepth(depth float64) {\n\tC.glowClearDepth(gpClearDepth, (C.GLdouble)(depth))\n}", "func ClearDepth(depth float64) {\n\tC.glowClearDepth(gpClearDepth, (C.GLdouble)(depth))\n}", "func DepthFunc(xfunc uint32) {\n\tsyscall.Syscall(gpDepthFunc, 1, uintptr(xfunc), 0, 0)\n}", "func (d *Detector) SetMode(x int) error {\n\terrno := C.fvad_set_mode(d.fvad, C.int(x))\n\tif errno != 0 {\n\t\treturn fmt.Errorf(\"invalid mode: %v\", x)\n\t}\n\treturn nil\n}", "func (kt KeyToken) MatchDepth(okt KeyToken) bool {\n\tif kt.Depth != okt.Depth {\n\t\treturn false\n\t}\n\treturn kt.Match(okt)\n}", "func (db *DB) UpdateMaxDepth(newDepth uint64) error {\n\tvar updatedParams core.Params\n\tupdatedParams.MaxDepth = newDepth\n\tif err := db.Instance.Table(\"params\").Assign(core.Params{MaxDepth: newDepth}).FirstOrCreate(&updatedParams).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (dev *Device) SetTiltDegs(angle float64) int {\n\treturn int(C.freenect_set_tilt_degs(dev.ptr(), C.double(angle)))\n}", "func SetLevel(l int) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tlevel = l\n}", "func (s *stencilOverdraw) storeNewDepthValues(ctx context.Context,\n\tcb CommandBuilder,\n\tgs *api.GlobalState,\n\tst *State,\n\ta arena.Arena,\n\tdevice VkDevice,\n\tqueue VkQueue,\n\tcmdBuffer VkCommandBuffer,\n\trenderInfo renderInfo,\n\talloc func(v ...interface{}) api.AllocResult,\n\taddCleanup func(func()),\n\tout transform.Writer,\n) error {\n\tif renderInfo.depthIdx == ^uint32(0) {\n\t\treturn nil\n\t}\n\trpInfo := st.RenderPasses().Get(renderInfo.renderPass)\n\tdaInfo := rpInfo.AttachmentDescriptions().Get(renderInfo.depthIdx)\n\n\tif daInfo.StoreOp() != VkAttachmentStoreOp_VK_ATTACHMENT_STORE_OP_STORE {\n\t\treturn nil\n\t}\n\n\tfbInfo := st.Framebuffers().Get(renderInfo.framebuffer)\n\n\toldImageView := fbInfo.ImageAttachments().Get(uint32(fbInfo.ImageAttachments().Len() - 1))\n\tnewImageView := fbInfo.ImageAttachments().Get(renderInfo.depthIdx)\n\n\toldImageDesc := imageDesc{\n\t\toldImageView.Image(),\n\t\toldImageView.SubresourceRange(),\n\t\trpInfo.AttachmentDescriptions().Get(uint32(fbInfo.ImageAttachments().Len() - 1)).FinalLayout(),\n\t\tVkImageAspectFlagBits_VK_IMAGE_ASPECT_DEPTH_BIT,\n\t}\n\tnewImageDesc := imageDesc{\n\t\tnewImageView.Image(),\n\t\tnewImageView.SubresourceRange(),\n\t\tdaInfo.FinalLayout(),\n\t\tVkImageAspectFlagBits_VK_IMAGE_ASPECT_DEPTH_BIT,\n\t}\n\treturn s.transferDepthValues(ctx, cb, gs, st, a,\n\t\tdevice, queue, cmdBuffer,\n\t\tfbInfo.Width(), fbInfo.Height(),\n\t\toldImageDesc, newImageDesc,\n\t\talloc, addCleanup, out)\n}", "func SetLevel(l int) {\n\tlevel = l\n}", "func SetLevel(l int) {\n\tlevel = l\n}", "func (o *Options) MaxDepth() int { return o.maxDepth }", "func FileDepth(d int) Option {\n\treturn func(opts *logOptions) {\n\t\topts.skipFrameCount = d\n\t}\n}", "func SetLevel(level Level) {\n\tdefaultLevel = int(level)\n}", "func (d *ModeDiff) setMode(mode rune) {\n\td.pos.setMode(mode)\n\td.neg.unsetMode(mode)\n}", "func (n *Node) Depth() int {\n\treturn n.depth\n}", "func DepthMask(flag bool) {\n C.glowDepthMask(gpDepthMask, (C.GLboolean)(boolToInt(flag)))\n}", "func (w *LevelWriter) SetLevel(s string) bool {\n\t// levels contains the first character of the levels in descending order\n\tconst levels = \"TDIWEF\"\n\tswitch strings.ToUpper(s) {\n\tcase \"TRACE\":\n\t\tw.level.Store(levels[0:])\n\t\treturn true\n\tcase \"DEBUG\":\n\t\tw.level.Store(levels[1:])\n\t\treturn true\n\tcase \"INFO\":\n\t\tw.level.Store(levels[2:])\n\t\treturn true\n\tcase \"WARN\":\n\t\tw.level.Store(levels[3:])\n\t\treturn true\n\tcase \"ERROR\":\n\t\tw.level.Store(levels[4:])\n\t\treturn true\n\tcase \"FATAL\":\n\t\tw.level.Store(levels[5:])\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "func SetLevel(lv Level) {\n\tcurrentLevel = lv\n\tcfg.Level.SetLevel(lv)\n}", "func SetDebugLevel() {\n\tlogLevel = logrus.DebugLevel\n}", "func (rr *OPT) SetZ(z uint16) {\n\trr.Hdr.Ttl = rr.Hdr.Ttl&^0x7FFF | uint32(z&0x7FFF)\n}", "func (oupu *OrgUnitPositionUpdate) SetLevel(i int) *OrgUnitPositionUpdate {\n\toupu.mutation.ResetLevel()\n\toupu.mutation.SetLevel(i)\n\treturn oupu\n}", "func (f *Framebuffer) ClearDepth(depth float64) gfx.FramebufferStateValue {\n\treturn s.CSV{\n\t\tValue: depth,\n\t\tDefaultValue: 0, // TODO(slimsag): verify\n\t\tKey: csClearDepth,\n\t\tGLCall: f.ctx.glClearDepth,\n\t}\n}", "func SetLevel(level Level) {\n\tstd.mu.Lock()\n\tdefer std.mu.Unlock()\n\tstd.level = level\n}", "func (m Meta) SetLevel(lvl Level) {\n\tm.lvl.Store(int32(lvl))\n}", "func (c *ProjectsLogServicesIndexesListCall) Depth(depth int64) *ProjectsLogServicesIndexesListCall {\n\tc.params_.Set(\"depth\", fmt.Sprintf(\"%v\", depth))\n\treturn c\n}", "func (transform *Transform) SetPosition(newPos mgl32.Vec3) {\n\ttransform.objMatrix.SetRow(3, mgl32.Vec4{newPos.X(), newPos.Y(), newPos.Z()})\n}", "func (n *ForNode) SetTree(a *Tree) {\n\tn.tree = a\n}", "func (oupuo *OrgUnitPositionUpdateOne) SetLevel(i int) *OrgUnitPositionUpdateOne {\n\toupuo.mutation.ResetLevel()\n\toupuo.mutation.SetLevel(i)\n\treturn oupuo\n}", "func (g *Group) SetTransform(m *algebra.Matrix) {\n\tif len(m.Get()) != 4 || len(m.Get()[0]) != 4 {\n\t\tpanic(algebra.ExpectedDimension(4))\n\t}\n\tg.transform = m\n}", "func SetMaxDepthDifference(maxDifference float64) {\n\tHeightMininum = maxDifference\n}", "func DepthFunc(func_ GLenum) {\n\tC.glDepthFunc(C.GLenum(func_))\n}", "func (o *TagModelStore) SetZoomLevel(v int32) {\n\to.ZoomLevel.Set(&v)\n}", "func (e *Env) SetTraceMode(b bool) { e.traceMode = b }", "func SetLogLevel(level zapcore.Level) {\n\tif level == TraceLevel {\n\t\tIsTraceLevel = true\n\t\tlevel = zapcore.DebugLevel\n\t}\n\tatom.SetLevel(level)\n}", "func (s *QueryLineageInput) SetMaxDepth(v int64) *QueryLineageInput {\n\ts.MaxDepth = &v\n\treturn s\n}", "func SetMode(flag int) (reset func()) {\n\tMustTestMode()\n\told := mode\n\treset = func() {\n\t\tmode = old\n\t}\n\tmode = flag\n\treturn\n}", "func (device *Device) StartDepthStream(resolution Resolution, format DepthFormat) error {\n\n\terrCode := C.freenect_set_depth_mode(device.device,\n\t\tC.freenect_find_depth_mode(C.freenect_resolution(resolution), C.freenect_depth_format(format)))\n\n\tif errCode != 0 {\n\t\treturn errors.New(\"could not find depth mode\")\n\t}\n\n\terrCode = C.freenect_start_depth(device.device)\n\n\tif errCode != 0 {\n\t\treturn errors.New(\"could not start depth stream\")\n\t}\n\n\treturn nil\n}", "func (r *Factory) SetLevel(name string, l Level) {\n\tr.Lock()\n\tdefer r.Unlock()\n\tr.setLevel(name, l)\n\tr.refreshLoggers()\n}" ]
[ "0.72426546", "0.66944337", "0.6489197", "0.64702225", "0.63566595", "0.63047695", "0.62911135", "0.6192278", "0.6161013", "0.60781723", "0.6054071", "0.5927159", "0.580917", "0.5697966", "0.56346196", "0.5625042", "0.54987735", "0.5410169", "0.53793144", "0.535777", "0.53403527", "0.52544856", "0.50957197", "0.50869507", "0.50756055", "0.50063527", "0.49944204", "0.4980019", "0.49795035", "0.49226826", "0.48766497", "0.48552296", "0.48552296", "0.4853564", "0.4844877", "0.4842187", "0.4832359", "0.48295847", "0.47158247", "0.47105035", "0.4701438", "0.46652982", "0.46467143", "0.46407813", "0.46324784", "0.46236888", "0.46201396", "0.4616436", "0.4608336", "0.46045387", "0.4601503", "0.4598649", "0.45736223", "0.45729613", "0.4568692", "0.4568692", "0.45578218", "0.45556626", "0.45394635", "0.45215696", "0.45199752", "0.4516093", "0.4516093", "0.45153263", "0.45105588", "0.45090422", "0.44964793", "0.44946858", "0.4490466", "0.4487136", "0.44851497", "0.44851497", "0.44742757", "0.44723693", "0.44700867", "0.4465641", "0.444332", "0.44367445", "0.4424385", "0.44198117", "0.4417476", "0.4406907", "0.43935296", "0.43926182", "0.4374365", "0.43719387", "0.43699282", "0.43594944", "0.43541738", "0.4347808", "0.4344097", "0.43359178", "0.4330127", "0.4314481", "0.4314044", "0.43092537", "0.42981994", "0.42969567", "0.4290699", "0.42859718" ]
0.8295805
0
SetOrigin sets transform origin.
func (t *Transform) SetOrigin(origin string) *Transform { t.Origin = origin return t }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (this *Transformable) SetOrigin(orig Vector2f) {\n\tC.sfTransformable_setOrigin(this.cptr, orig.toC())\n}", "func SetOrigin(\n\tctx context.Context,\n\tcallOrigin string,\n) context.Context {\n\treturn setIncomingMD(ctx, map[string]string{callOriginHeaderName: callOrigin})\n}", "func (a *SetPermissionArgs) SetOrigin(origin string) *SetPermissionArgs {\n\ta.Origin = &origin\n\treturn a\n}", "func (p *ProvisionTokenV2) SetOrigin(origin string) {\n\tp.Metadata.SetOrigin(origin)\n}", "func (s *DatabaseServerV3) SetOrigin(origin string) {\n\ts.Metadata.SetOrigin(origin)\n}", "func (s *AppServerV3) SetOrigin(origin string) {\n\ts.Metadata.SetOrigin(origin)\n}", "func (s *GetDataSetOutput) SetOrigin(v string) *GetDataSetOutput {\n\ts.Origin = &v\n\treturn s\n}", "func (s *ListDataSetsInput) SetOrigin(v string) *ListDataSetsInput {\n\ts.Origin = &v\n\treturn s\n}", "func (a *GrantPermissionsArgs) SetOrigin(origin string) *GrantPermissionsArgs {\n\ta.Origin = &origin\n\treturn a\n}", "func (s *UpdateDataSetOutput) SetOrigin(v string) *UpdateDataSetOutput {\n\ts.Origin = &v\n\treturn s\n}", "func (s *CreateDataSetOutput) SetOrigin(v string) *CreateDataSetOutput {\n\ts.Origin = &v\n\treturn s\n}", "func (mr *MockProcessOptionsMockRecorder) SetOrigin(value interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetOrigin\", reflect.TypeOf((*MockProcessOptions)(nil).SetOrigin), value)\n}", "func (s *DataSetEntry) SetOrigin(v string) *DataSetEntry {\n\ts.Origin = &v\n\treturn s\n}", "func (s *DisassociateApprovedOriginInput) SetOrigin(v string) *DisassociateApprovedOriginInput {\n\ts.Origin = &v\n\treturn s\n}", "func (m *Headers) SetOrigin(value *string)() {\n err := m.GetBackingStore().Set(\"origin\", value)\n if err != nil {\n panic(err)\n }\n}", "func (s *AssociateApprovedOriginInput) SetOrigin(v string) *AssociateApprovedOriginInput {\n\ts.Origin = &v\n\treturn s\n}", "func (self Text) SetOrigin(x, y float32) {\n\tv := C.sfVector2f{C.float(x), C.float(y)}\n\tC.sfText_setOrigin(self.Cref, v)\n}", "func (s *Surface) SetTransform(a, b, c, d, e, f float64) {\n\ts.Ctx.Call(\"setTransform\", a, b, c, d, e, f)\n}", "func (this *RectangleShape) SetOrigin(orig Vector2f) {\n\tC.sfRectangleShape_setOrigin(this.cptr, orig.toC())\n}", "func (o *Origin) SetOriginOM(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginMember) error {\n\tquery := \"update \\\"origin_members\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err := exec.ExecContext(ctx, query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove relationships before set\")\n\t}\n\n\tif o.R != nil {\n\t\tfor _, rel := range o.R.OriginOM {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOM = nil\n\t}\n\treturn o.AddOriginOM(ctx, exec, insert, related...)\n}", "func (transform *Transform) SetPosition(newPos mgl32.Vec3) {\n\ttransform.objMatrix.SetRow(3, mgl32.Vec4{newPos.X(), newPos.Y(), newPos.Z()})\n}", "func (m *MockProcessOptions) SetOrigin(value topology.Host) ProcessOptions {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetOrigin\", value)\n\tret0, _ := ret[0].(ProcessOptions)\n\treturn ret0\n}", "func SetOrigin(ctx context.Context, cluster *kubernetes.Cluster, app models.AppRef, origin models.ApplicationOrigin) error {\n\tclient, err := cluster.ClientApp()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpatch, err := buildBodyPatch(origin)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error building body patch\")\n\t}\n\n\t_, err = client.Namespace(app.Namespace).Patch(ctx,\n\t\tapp.Name,\n\t\ttypes.JSONPatchType,\n\t\tpatch,\n\t\tmetav1.PatchOptions{})\n\n\treturn err\n}", "func (g *Group) SetTransform(m *algebra.Matrix) {\n\tif len(m.Get()) != 4 || len(m.Get()[0]) != 4 {\n\t\tpanic(algebra.ExpectedDimension(4))\n\t}\n\tg.transform = m\n}", "func Origin(value string) Option {\n\treturn setHeader(\"Origin\", value)\n}", "func (c *canvasRenderer) SetTransform(transform sprec.Mat4) {\n\tif c.currentLayer == c.topLayer {\n\t\tc.currentLayer.Transform = transform\n\t} else {\n\t\tc.currentLayer.Transform = sprec.Mat4Prod(\n\t\t\tc.currentLayer.previous.Transform,\n\t\t\ttransform,\n\t\t)\n\t}\n}", "func (t *Transform) SetPos(p lmath.Vec3) {\n\tt.access.Lock()\n\tif t.pos != p {\n\t\tt.built = nil\n\t\tt.pos = p\n\t}\n\tt.access.Unlock()\n}", "func (obj *Device) SetTransform(state TRANSFORMSTATETYPE, matrix MATRIX) Error {\n\tret, _, _ := syscall.Syscall(\n\t\tobj.vtbl.SetTransform,\n\t\t3,\n\t\tuintptr(unsafe.Pointer(obj)),\n\t\tuintptr(state),\n\t\tuintptr(unsafe.Pointer(&matrix[0])),\n\t)\n\treturn toErr(ret)\n}", "func (o *Origin) SetOriginOPR(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginProject) error {\n\tquery := \"update \\\"origin_projects\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err := exec.ExecContext(ctx, query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove relationships before set\")\n\t}\n\n\tif o.R != nil {\n\t\tfor _, rel := range o.R.OriginOPR {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOPR = nil\n\t}\n\treturn o.AddOriginOPR(ctx, exec, insert, related...)\n}", "func (this *Transformable) SetPosition(pos Vector2f) {\n\tC.sfTransformable_setPosition(this.cptr, pos.toC())\n}", "func (o *Origin) SetOriginOPK(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginPublicKey) error {\n\tquery := \"update \\\"origin_public_keys\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err := exec.ExecContext(ctx, query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove relationships before set\")\n\t}\n\n\tif o.R != nil {\n\t\tfor _, rel := range o.R.OriginOPK {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOPK = nil\n\t}\n\treturn o.AddOriginOPK(ctx, exec, insert, related...)\n}", "func (mr *MockProcessOptionsMockRecorder) Origin() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Origin\", reflect.TypeOf((*MockProcessOptions)(nil).Origin))\n}", "func (o *Origin) SetOriginOS(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginSecret) error {\n\tquery := \"update \\\"origin_secrets\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err := exec.ExecContext(ctx, query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove relationships before set\")\n\t}\n\n\tif o.R != nil {\n\t\tfor _, rel := range o.R.OriginOS {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOS = nil\n\t}\n\treturn o.AddOriginOS(ctx, exec, insert, related...)\n}", "func NewOriginHeader() *OriginHeader {\n\treturn &OriginHeader{}\n}", "func WithOrigin(origin Point) HasCaptureOption {\n\treturn func(configuration *HasCaptureConfiguration) {\n\t\tconfiguration.FilterByOrigin = true\n\t\tconfiguration.Origin = origin\n\t}\n}", "func (t *Transform) SetQuat(q lmath.Quat) {\n\tt.access.Lock()\n\tif t.quat == nil || (*t.quat) != q {\n\t\tt.built = nil\n\t\tt.quat = &q\n\t}\n\tt.access.Unlock()\n}", "func (t *Transform) SetPosition(v *Vector) ITransform {\n\tt.Position = v\n\treturn t\n}", "func (pt *PointTransform) TransformCoord(c []float64) *image.Point {\n\treturn pt.TransformXY(c[0], c[1])\n}", "func (o *Origin) SetOriginOPA(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginPackage) error {\n\tquery := \"update \\\"origin_packages\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err := exec.ExecContext(ctx, query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove relationships before set\")\n\t}\n\n\tif o.R != nil {\n\t\tfor _, rel := range o.R.OriginOPA {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOPA = nil\n\t}\n\treturn o.AddOriginOPA(ctx, exec, insert, related...)\n}", "func (o *Origin) SetOriginOPUEK(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginPublicEncryptionKey) error {\n\tquery := \"update \\\"origin_public_encryption_keys\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err := exec.ExecContext(ctx, query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove relationships before set\")\n\t}\n\n\tif o.R != nil {\n\t\tfor _, rel := range o.R.OriginOPUEK {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOPUEK = nil\n\t}\n\treturn o.AddOriginOPUEK(ctx, exec, insert, related...)\n}", "func (o *Origin) SetOriginOI(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginInvitation) error {\n\tquery := \"update \\\"origin_invitations\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err := exec.ExecContext(ctx, query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove relationships before set\")\n\t}\n\n\tif o.R != nil {\n\t\tfor _, rel := range o.R.OriginOI {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOI = nil\n\t}\n\treturn o.AddOriginOI(ctx, exec, insert, related...)\n}", "func (o *Origin) SetOriginOSK(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginSecretKey) error {\n\tquery := \"update \\\"origin_secret_keys\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err := exec.ExecContext(ctx, query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove relationships before set\")\n\t}\n\n\tif o.R != nil {\n\t\tfor _, rel := range o.R.OriginOSK {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOSK = nil\n\t}\n\treturn o.AddOriginOSK(ctx, exec, insert, related...)\n}", "func (q *DistanceFeatureQuery) Origin(origin interface{}) *DistanceFeatureQuery {\n\tq.origin = origin\n\treturn q\n}", "func (o *Origin) SetOriginOC(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginChannel) error {\n\tquery := \"update \\\"origin_channels\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err := exec.ExecContext(ctx, query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove relationships before set\")\n\t}\n\n\tif o.R != nil {\n\t\tfor _, rel := range o.R.OriginOC {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOC = nil\n\t}\n\treturn o.AddOriginOC(ctx, exec, insert, related...)\n}", "func (self Source) SetPosition(vector *Vector) {\n\tself.Set3f(AlPosition, vector[x], vector[y], vector[z])\n}", "func (object Object) Origin(value interface{}) Object {\n\treturn object.Property(as.PropertyOrigin, value)\n}", "func (o *Origin) SetOriginAPG(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*AuditPackageGroup) error {\n\tquery := \"update \\\"audit_package_group\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err := exec.ExecContext(ctx, query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove relationships before set\")\n\t}\n\n\tif o.R != nil {\n\t\tfor _, rel := range o.R.OriginAPG {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginAPG = nil\n\t}\n\treturn o.AddOriginAPG(ctx, exec, insert, related...)\n}", "func (o *Origin) SetOriginAP(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*AuditPackage) error {\n\tquery := \"update \\\"audit_package\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err := exec.ExecContext(ctx, query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove relationships before set\")\n\t}\n\n\tif o.R != nil {\n\t\tfor _, rel := range o.R.OriginAP {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginAP = nil\n\t}\n\treturn o.AddOriginAP(ctx, exec, insert, related...)\n}", "func SetCrtcTransform(c *xgb.Conn, Crtc Crtc, Transform render.Transform, FilterLen uint16, FilterName string, FilterParams []render.Fixed) SetCrtcTransformCookie {\n\tc.ExtLock.RLock()\n\tdefer c.ExtLock.RUnlock()\n\tif _, ok := c.Extensions[\"RANDR\"]; !ok {\n\t\tpanic(\"Cannot issue request 'SetCrtcTransform' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.\")\n\t}\n\tcookie := c.NewCookie(false, false)\n\tc.NewRequest(setCrtcTransformRequest(c, Crtc, Transform, FilterLen, FilterName, FilterParams), cookie)\n\treturn SetCrtcTransformCookie{cookie}\n}", "func (this *Transformable) GetOrigin() (origin Vector2f) {\n\torigin.fromC(C.sfTransformable_getOrigin(this.cptr))\n\treturn\n}", "func (o *Origin) SetOriginOPREK(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginPrivateEncryptionKey) error {\n\tquery := \"update \\\"origin_private_encryption_keys\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err := exec.ExecContext(ctx, query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove relationships before set\")\n\t}\n\n\tif o.R != nil {\n\t\tfor _, rel := range o.R.OriginOPREK {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOPREK = nil\n\t}\n\treturn o.AddOriginOPREK(ctx, exec, insert, related...)\n}", "func (t *transform) Set(modelView mgl32.Mat4) {\n\tt.dataLock.Lock()\n\tdefer t.dataLock.Unlock()\n\tt.modelView = modelView\n}", "func (a *Actor) SetPosition(x float64, y float64) {\n\ta.x = x\n\ta.y = y\n}", "func (c *Camera) SetPos(pos mgl32.Vec3) {\n\tc.pos = pos\n}", "func (t *Transform) SetRot(r lmath.Vec3) {\n\tt.access.Lock()\n\tif t.rot != r {\n\t\tt.built = nil\n\t\tt.quat = nil\n\t\tt.rot = r\n\t}\n\tt.access.Unlock()\n}", "func (s *DashConfiguration) SetOriginManifestType(v string) *DashConfiguration {\n\ts.OriginManifestType = &v\n\treturn s\n}", "func (a *Client) UpdateOrigin(params *UpdateOriginParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateOriginOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUpdateOriginParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"UpdateOrigin\",\n\t\tMethod: \"PATCH\",\n\t\tPathPattern: \"/cdn/v1/stacks/{stack_id}/origins/{origin_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: &UpdateOriginReader{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.(*UpdateOriginOK), nil\n\n}", "func (s *DashConfigurationForPut) SetOriginManifestType(v string) *DashConfigurationForPut {\n\ts.OriginManifestType = &v\n\treturn s\n}", "func (r *AWSCloudFrontDistribution_Origin) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (t *Transform) SetPositionXY(x float64, y float64) ITransform {\n\treturn t.SetPosition(NewVector(x, y))\n}", "func (sprite *Sprite) SetPosition(x, y float64) {\n\n\tsprite.shape.SetPosition(x, y)\n}", "func (p *PointsSgMutator) SetCoord(val []any) bool { //nolint:dupl false positive\n\tp.mutations = append(p.mutations, A.X{`=`, 1, val})\n\tp.Coord = val\n\treturn true\n}", "func (o RouteOutput) Origin() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Route) pulumi.StringOutput { return v.Origin }).(pulumi.StringOutput)\n}", "func (s *DescribeTransformJobOutput) SetTransformInput(v *TransformInput) *DescribeTransformJobOutput {\n\ts.TransformInput = v\n\treturn s\n}", "func (s *CreateTransformJobInput) SetTransformInput(v *TransformInput) *CreateTransformJobInput {\n\ts.TransformInput = v\n\treturn s\n}", "func SetViewTransform(viewID ViewID, view, proj [16]float32) {\n\tC.bgfx_set_view_transform(\n\t\tC.ushort(viewID),\n\t\tunsafe.Pointer(&view[0]),\n\t\tunsafe.Pointer(&proj[0]),\n\t)\n}", "func SetCheckOriginFunc(fn func(*http.Request) bool) {\n\tcheckOrigin = fn\n}", "func (in *Origin) DeepCopy() *Origin {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Origin)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *SessionSpecification) SetOriginatingRequestId(v string) *SessionSpecification {\n\ts.OriginatingRequestId = &v\n\treturn s\n}", "func (b *BaseDevice) Origin() Point {\n\treturn b.origin\n}", "func (e *Enigma) SetRotor(position, name string, ringPosition int, startPosition rune) error {\r\n\trotor, check := availableRotors[name]\r\n\tif !check {\r\n\t\treturn fmt.Errorf(\"no such rotor: %s\", name)\r\n\t}\r\n\r\n\tindex, check := rotorPositions[strings.ToUpper(position)]\r\n\tif !check {\r\n\t\treturn fmt.Errorf(\"no such position: %s\", position)\r\n\t}\r\n\r\n\tif ringPosition < 1 || ringPosition > 26 {\r\n\t\treturn fmt.Errorf(\"invalid ring position: %d\", ringPosition)\r\n\t}\r\n\r\n\tstart := unicode.ToUpper(startPosition)\r\n\tif start < 'A' || start > 'Z' {\r\n\t\treturn fmt.Errorf(\"invalid start position: %c\", start)\r\n\t}\r\n\r\n\trotor.setRingPosition(ringPosition)\r\n\r\n\trotor.setStartPosition(start)\r\n\r\n\te.rotors[index] = &rotor\r\n\r\n\treturn nil\r\n}", "func (o LienOutput) Origin() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Lien) pulumi.StringOutput { return v.Origin }).(pulumi.StringOutput)\n}", "func (s *TransformJob) SetTransformInput(v *TransformInput) *TransformJob {\n\ts.TransformInput = v\n\treturn s\n}", "func (s *Servo) SetPosition(position float64) {\n\tif s.Flags.is(Normalized) {\n\t\tposition *= 90\n\t}\n\tif s.Flags.is(Centered) {\n\t\tposition += 90\n\t}\n\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\ts.position = clamp(position, 0, 180)\n\ts.target = s.position\n\ts.idle = false\n}", "func NewTransform2DAxisOrigin(xAxis Vector2, yAxis Vector2, origin Vector2) *Transform2D {\n\tvar dest C.godot_transform2d\n\targ1 := xAxis.getBase()\n\targ2 := yAxis.getBase()\n\targ3 := origin.getBase()\n\tC.go_godot_transform2d_new_axis_origin(GDNative.api, &dest, arg1, arg2, arg3)\n\treturn &Transform2D{base: &dest}\n}", "func (xf *Transform) SetScale(scale float32) {\n\txf.Scale = mgl32.Vec2{scale, scale}\n}", "func (t *Transform) SetScale(sx, sy float64) *Transform {\n\tt.Scale1.X = sx - 1\n\tt.Scale1.Y = sy - 1\n\treturn t\n}", "func (c *Catalog) Origin(originName string) (*Origin, error) {\n\torigin, ok := c.Origins[originName]\n\tif !ok {\n\t\treturn nil, ErrUnknownOrigin\n\t}\n\n\treturn origin, nil\n}", "func NewTransform() Transform {\n\tt := transform{\n\t\tmodelView: mgl32.Ident4(),\n\t\trotation: mgl32.Vec3{0, 0, 0},\n\t\ttranslation: mgl32.Vec3{0, 0, 0},\n\t}\n\treturn &t\n}", "func (p *Part) SetPosition(position vector.Vector) {\n\tif position.Len() != 3 && position.Kind() != reflect.Float32 {\n\t\tlog.Fatalf(\"Part.SetPosition: expects 3D-Float32 vector, got %dD-%v\", position.Len(), position.Kind())\n\t}\n\tp.position = position\n}", "func (s *TransformJobDefinition) SetTransformInput(v *TransformInput) *TransformJobDefinition {\n\ts.TransformInput = v\n\treturn s\n}", "func (s *Surface) Transform(a, b, c, d, e, f float64) {\n\ts.Ctx.Call(\"transform\", a, b, c, d, e, f)\n}", "func WithRequestOrigin(origin string) ConfigOption {\n\treturn func(s *WebAuthn) {\n\t\ts.requestOrigin = origin\n\t}\n}", "func (s *GetDataSetOutput) SetOriginDetails(v *OriginDetails) *GetDataSetOutput {\n\ts.OriginDetails = v\n\treturn s\n}", "func WithDataOrigin(dataOrigin string) WriterOption {\n\treturn func(ms *ManagedStream) {\n\t\tms.streamSettings.dataOrigin = dataOrigin\n\t}\n}", "func (w *WidgetImplement) SetPosition(x, y int) {\n\tw.x = x\n\tw.y = y\n}", "func (ps *ParticleSystem) SetPosition(x, y float64) {\n\tps.epiCenter.SetByComp(x, y)\n}", "func (o *Origin1) SetOrigins(v []Origin3) {\n\to.Origins = v\n}", "func (p *Point) SetPosition(pos vector.Vector) {\n\tp.position = pos\n}", "func (s *CreateDataSetOutput) SetOriginDetails(v *OriginDetails) *CreateDataSetOutput {\n\ts.OriginDetails = v\n\treturn s\n}", "func (o BucketCorsItemOutput) Origin() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v BucketCorsItem) []string { return v.Origin }).(pulumi.StringArrayOutput)\n}", "func (c *NestedTargetsBuilder) WithOrigin(origin string) *NestedTargetsBuilder {\n\tc.TargetsBuilder.WithOrigin(origin)\n\treturn c\n}", "func (m *Metric) Origin() *Origin {\n\treturn m.source.origin\n}", "func (s *UpdateDataSetOutput) SetOriginDetails(v *OriginDetails) *UpdateDataSetOutput {\n\ts.OriginDetails = v\n\treturn s\n}", "func (to *Session) UpdateOrigin(id int, origin tc.Origin, opts RequestOptions) (tc.OriginDetailResponse, toclientlib.ReqInf, error) {\n\tvar originResp tc.OriginDetailResponse\n\tvar remoteAddr net.Addr\n\treqInf := toclientlib.ReqInf{CacheHitStatus: toclientlib.CacheHitStatusMiss, RemoteAddr: remoteAddr}\n\n\terr := to.originIDs(&origin)\n\tif err != nil {\n\t\treturn originResp, reqInf, err\n\t}\n\tif opts.QueryParameters == nil {\n\t\topts.QueryParameters = url.Values{}\n\t}\n\topts.QueryParameters.Set(\"id\", strconv.Itoa(id))\n\treqInf, err = to.put(apiOrigins, opts, origin, &originResp)\n\treturn originResp, reqInf, err\n}", "func (obj Player) SetPos(xf, yf, zf float64) error {\n\ts := fmt.Sprintf(\"player.setPos(%s,%f,%f,%f)\",obj.name, xf, yf, zf)\n\treturn object(obj.obj).send(s)\n}", "func (b *Base) SetPosition(x, y, z float64) {\n\tb.messageChan <- &proto.Update{\n\t\tPosition: &proto.Position{\n\t\t\tX: x,\n\t\t\tY: y,\n\t\t\tZ: z,\n\t\t},\n\t}\n}", "func NewTransform() *Transform {\n\treturn &Transform{\n\t\tPosition: NewVector(0, 0),\n\t\tRotation: 0,\n\t\tScale: NewVector(1, 1),\n\t\tDim: NewVector(0, 0),\n\t}\n}", "func (p *ProvisionTokenV2) Origin() string {\n\treturn p.Metadata.Origin()\n}", "func (this *Transformable) SetRotation(rot float32) {\n\tC.sfTransformable_setRotation(this.cptr, C.float(rot))\n}" ]
[ "0.80196726", "0.7189707", "0.7154953", "0.7088292", "0.6934476", "0.68809646", "0.6803109", "0.67791086", "0.6698489", "0.6690764", "0.66876876", "0.66319853", "0.65280163", "0.6461048", "0.6432481", "0.6425079", "0.6382391", "0.6347609", "0.6234449", "0.6170806", "0.61677593", "0.6069137", "0.6047484", "0.59993756", "0.5946202", "0.5885523", "0.57690614", "0.57612103", "0.55365413", "0.5502958", "0.54714435", "0.5432496", "0.5366094", "0.53600794", "0.52932715", "0.52400774", "0.52257884", "0.52121055", "0.52008337", "0.5174318", "0.51693857", "0.5168657", "0.516274", "0.5146857", "0.51415586", "0.51405656", "0.5133817", "0.5115359", "0.51088846", "0.5107847", "0.5105198", "0.50924945", "0.50887036", "0.5076931", "0.5069258", "0.5023892", "0.50129604", "0.50024384", "0.49843898", "0.49557525", "0.49325117", "0.4909411", "0.4873028", "0.48461962", "0.4841269", "0.4834621", "0.4832632", "0.48286414", "0.48164052", "0.4809741", "0.47997472", "0.47674763", "0.47492605", "0.4746802", "0.47377187", "0.47250953", "0.47247848", "0.47144383", "0.47008312", "0.46850407", "0.46838987", "0.46744436", "0.46297452", "0.4629362", "0.4622521", "0.46136174", "0.46064547", "0.45800453", "0.4572818", "0.45553797", "0.45528683", "0.4548368", "0.45282578", "0.45271358", "0.45201424", "0.4512348", "0.44991764", "0.44920686", "0.44864988", "0.44753388" ]
0.79898334
1
ComputeOriginOffset returns the transform origin offset.
func (t *Transform) ComputeOriginOffset(screenWidth, screenHeight float64) (offsetX, offsetY float64) { switch t.Origin { case TransformOriginTopLeft: offsetX, offsetY = 0, screenHeight case TransformOriginTopMiddle: offsetX, offsetY = screenWidth/2, screenHeight case TransformOriginTopRight: offsetX, offsetY = screenWidth, screenHeight case TransformOriginMiddleLeft: offsetX, offsetY = 0, screenHeight/2 case TransformOriginMiddle: offsetX, offsetY = screenWidth/2, screenHeight/2 case TransformOriginMiddleRight: offsetX, offsetY = screenWidth, screenHeight/2 case TransformOriginBottomLeft: offsetX, offsetY = 0, 0 case TransformOriginBottomMiddle: offsetX, offsetY = screenWidth/2, 0 case TransformOriginBottomRight: offsetX, offsetY = screenWidth, 0 case "": // TransformOriginBottomLeft offsetX, offsetY = 0, 0 default: utils.LogError(fmt.Errorf("unknown transform origin value: %s", t.Origin)) } return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (this *Transformable) GetOrigin() (origin Vector2f) {\n\torigin.fromC(C.sfTransformable_getOrigin(this.cptr))\n\treturn\n}", "func (p point) distanceToOrigin() int {\n\treturn p.distanceToPoint(point{x: 0, y: 0})\n}", "func (tlc *TLCMessage) GetOrigin() string {\n\treturn tlc.Origin\n}", "func calcCoordinateStartingPoint(wm *WatermarkImage, oh OverheadImage, position int, offsetX int, offsetY int) image.Point {\n\n\treturn image.Point{0, 0}\n}", "func (r *RumorMessage) GetOrigin() string {\n\treturn r.Origin\n}", "func (b *BaseDevice) Origin() Point {\n\treturn b.origin\n}", "func (m *Metric) Origin() *Origin {\n\treturn m.source.origin\n}", "func (p Pos) Offset() int {\n\treturn p.Position().Offset\n}", "func (self Text) Origin() (x, y float32) {\n\tv := C.sfText_getOrigin(self.Cref)\n\treturn float32(v.x), float32(v.y)\n}", "func (this *RectangleShape) GetOrigin() (origin Vector2f) {\n\torigin.fromC(C.sfRectangleShape_getOrigin(this.cptr))\n\treturn\n}", "func (s UserSet) ComputeTZOffset() m.UserData {\n\tres := s.Collection().Call(\"ComputeTZOffset\")\n\tresTyped, _ := res.(m.UserData)\n\treturn resTyped\n}", "func (s *Structured) GetOffset() int {\n\treturn s.cloudEvent.Offset\n}", "func (c *Container) Offset() (float64, float64) {\n\treturn c.x, c.y\n}", "func (g *GetSupergroupMembersRequest) GetOffset() (value int32) {\n\tif g == nil {\n\t\treturn\n\t}\n\treturn g.Offset\n}", "func (s *GetDataSetOutput) SetOrigin(v string) *GetDataSetOutput {\n\ts.Origin = &v\n\treturn s\n}", "func (p Point) Offset() int {\n\treturn p.offset\n}", "func (c MethodsCollection) ComputeTZOffset() pComputeTZOffset {\n\treturn pComputeTZOffset{\n\t\tMethod: c.MustGet(\"ComputeTZOffset\"),\n\t}\n}", "func (s *Scheduler) Offset() time.Duration {\n\ts.lock.RLock()\n\tdefer s.lock.RUnlock()\n\n\treturn s.timeOffset\n}", "func (y City) Offset() int {\n\tif y.parent == nil {\n\t\treturn -1\n\t}\n\n\treturn y.parent.Offset()\n}", "func (r *RoleList) GetOffset() uint {\n\treturn r.Offset\n}", "func (s *CreateDataSetOutput) SetOrigin(v string) *CreateDataSetOutput {\n\ts.Origin = &v\n\treturn s\n}", "func (r *Reader) Offset() Offset {\n\treturn NewOffset(r.fileSequence, r.position)\n}", "func (s *SearchChatMessagesRequest) GetOffset() (value int32) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.Offset\n}", "func (o RouteOutput) Origin() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Route) pulumi.StringOutput { return v.Origin }).(pulumi.StringOutput)\n}", "func (coord MapCoordinate) Offset() byte {\n\treturn byte(coord & 0x00FF)\n}", "func (s *UpdateDataSetOutput) SetOrigin(v string) *UpdateDataSetOutput {\n\ts.Origin = &v\n\treturn s\n}", "func (g *ChannelsGetLeftChannelsRequest) GetOffset() (value int) {\n\tif g == nil {\n\t\treturn\n\t}\n\treturn g.Offset\n}", "func (e *Element) Offset() int64 {\n\treturn e.offset\n}", "func (s *DataSetEntry) SetOrigin(v string) *DataSetEntry {\n\ts.Origin = &v\n\treturn s\n}", "func (o AccessPointOutput) NetworkOrigin() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *AccessPoint) pulumi.StringOutput { return v.NetworkOrigin }).(pulumi.StringOutput)\n}", "func (p Pos) Offset() int64 {\n\tn := p.FrozenCount()\n\treturn int64(n) * LabelSize\n}", "func (w *Writer) Offset() uint64 {\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\treturn w.offset\n}", "func (f *Font) getGlyphOriginForDirection(glyph fonts.GID, direction Direction) (x, y Position) {\n\tif direction.isHorizontal() {\n\t\treturn f.getGlyphHOriginWithFallback(glyph)\n\t}\n\treturn f.getGlyphVOriginWithFallback(glyph)\n}", "func (r *ImageRef) OffsetX() int {\n\treturn int(r.image.Xoffset)\n}", "func (c *Client) RemoteOffset() proto.RemoteOffset {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\treturn c.offset\n}", "func (t *Transform) Pos() lmath.Vec3 {\n\tt.access.RLock()\n\tp := t.pos\n\tt.access.RUnlock()\n\treturn p\n}", "func (profile *mobilityProfile) computeOffset(referenceTimestamp int64, lastRead int64) float64 {\n\t// y = mx + b\n\toffset := (profile.slope * float64(referenceTimestamp-lastRead)) + profile.yIntercept\n\n\t// check if offset needs to be capped at threshold ceiling\n\tif offset > profile.threshold {\n\t\toffset = profile.threshold\n\t}\n\treturn offset\n}", "func (s *SearchFileDownloadsRequest) GetOffset() (value string) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.Offset\n}", "func (o EnterpriseProxyAccessOutput) OriginInfo() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *EnterpriseProxyAccess) pulumi.StringOutput { return v.OriginInfo }).(pulumi.StringOutput)\n}", "func (a *chunkBasedAtlas) chunkOriginInWorldSpace(chunk int) maths.Vector {\n\t// Calculate the width\n\twidth := a.UpperBound.X - a.LowerBound.X\n\twidthInChunks := width / a.ChunkSize\n\n\t// Reverse the along the corridor and up the stairs\n\tv := maths.Vector{\n\t\tX: chunk % widthInChunks,\n\t\tY: chunk / widthInChunks,\n\t}\n\t// Multiply up to world scale\n\tv = v.Multiplied(a.ChunkSize)\n\t// Shift by the lower bound\n\treturn v.Added(a.LowerBound)\n}", "func (o LienOutput) Origin() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Lien) pulumi.StringOutput { return v.Origin }).(pulumi.StringOutput)\n}", "func (t *Transform) SetOrigin(origin string) *Transform {\n\tt.Origin = origin\n\treturn t\n}", "func (b *Base) GetOffset() int64 {\n\treturn b.Offset\n}", "func (m *Model) Offset() (float64, float64) {\n\treturn m.x, m.y\n}", "func (i Ivar) Offset() uintptr {\n\treturn ivar_getOffset(i)\n}", "func (pt *PointTransform) TransformCoord(c []float64) *image.Point {\n\treturn pt.TransformXY(c[0], c[1])\n}", "func (p *PdfiumImplementation) FPDFText_GetCharOrigin(request *requests.FPDFText_GetCharOrigin) (*responses.FPDFText_GetCharOrigin, error) {\n\tp.Lock()\n\tdefer p.Unlock()\n\n\ttextPageHandle, err := p.getTextPageHandle(request.TextPage)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tx := C.double(0)\n\ty := C.double(0)\n\tsuccess := C.FPDFText_GetCharOrigin(textPageHandle.handle, C.int(request.Index), &x, &y)\n\tif int(success) == 0 {\n\t\treturn nil, errors.New(\"could not get char origin\")\n\t}\n\n\treturn &responses.FPDFText_GetCharOrigin{\n\t\tIndex: request.Index,\n\t\tX: float64(x),\n\t\tY: float64(y),\n\t}, nil\n}", "func (r *Reader) Offset() Offset {\n\treturn r.offset\n}", "func (b *batch) GetOffset() *events.Offset {\n\treturn b.offset\n}", "func (p *YCbCr) COffset(x, y int) int {\n\treturn ((*image.YCbCr)(p)).COffset(x, y)\n}", "func (m *_TimeZoneDataType) GetOffset() int16 {\n\treturn m.Offset\n}", "func (o *StyleBox) GetOffset() gdnative.Vector2 {\n\t//log.Println(\"Calling StyleBox.GetOffset()\")\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(\"StyleBox\", \"get_offset\")\n\n\t// Call the parent method.\n\t// Vector2\n\tretPtr := gdnative.NewEmptyVector2()\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.NewVector2FromPointer(retPtr)\n\treturn ret\n}", "func (s *ListDataSetsInput) SetOrigin(v string) *ListDataSetsInput {\n\ts.Origin = &v\n\treturn s\n}", "func (d *Decoder) InputOffset() int {\n\treturn d.n\n}", "func (i ISCInstance) PortOffset() (offset int64, err error) {\n\tvar ss, web, hc int64\n\tif ss, err = getOffset(i.Name, \"SuperServer\", i.Ports.SuperServer, PortExternalSS); err != nil {\n\t\treturn -1, err\n\t}\n\n\tif web, err = getOffset(i.Name, \"Web\", i.Ports.Web, PortExternalWeb); err != nil {\n\t\treturn -1, err\n\t}\n\n\tif hc, err = getOffset(i.Name, \"HealthCheck\", i.Ports.Web, PortExternalWeb); err != nil {\n\t\treturn -1, err\n\t}\n\n\tif web != ss || web != hc {\n\t\treturn -1, fmt.Errorf(\"Port offsets do not match, instance: %s, SuperServer: %d, Web: %d, HealthCheck: %d\", i.Name, ss, web, hc)\n\t}\n\n\treturn ss, nil\n}", "func (q *BasicQuery) GetOffset() uint64 {\n\treturn q.Offset\n}", "func (s *AppServerV3) Origin() string {\n\treturn s.Metadata.Origin()\n}", "func (s UserSet) TZOffset() string {\n\tres, _ := s.RecordCollection.Get(models.NewFieldName(\"TZOffset\", \"tz_offset\")).(string)\n\treturn res\n}", "func (p *ProvisionTokenV2) Origin() string {\n\treturn p.Metadata.Origin()\n}", "func (d UserData) TZOffset() string {\n\tval := d.ModelData.Get(models.NewFieldName(\"TZOffset\", \"tz_offset\"))\n\tif !d.Has(models.NewFieldName(\"TZOffset\", \"tz_offset\")) {\n\t\treturn *new(string)\n\t}\n\treturn val.(string)\n}", "func (p *IPv4) Offset() uint16 {\n\treturn p.offset\n}", "func (s *DatabaseServerV3) Origin() string {\n\treturn s.Metadata.Origin()\n}", "func (e *exprHelper) OffsetLocation(exprID int64) common.Location {\n\treturn e.parserHelper.sourceInfo.GetStartLocation(exprID)\n}", "func Origin(app *unstructured.Unstructured) (models.ApplicationOrigin, error) {\n\tresult := models.ApplicationOrigin{}\n\n\torigin, found, err := unstructured.NestedMap(app.Object, \"spec\", \"origin\")\n\n\tif !found {\n\t\treturn result, nil\n\t}\n\tif err != nil {\n\t\treturn result, err\n\t}\n\n\t// Check, in order, for `path`, `container`, and `git` origins\n\t// Notes:\n\t// - Only one of path, container, or git may be present.\n\t// If more than one is present the first found is taken\n\t// (See above for the order)\n\t// - If a value is present it must not be empty.\n\t// IOW spec.origin.path == \"\", etc. are rejected.\n\n\tpath, found, err := unstructured.NestedString(origin, \"path\")\n\tif found {\n\t\tif err != nil {\n\t\t\treturn result, err\n\t\t}\n\t\tif path == \"\" {\n\t\t\treturn result, errors.New(\"bad path origin, empty string\")\n\t\t}\n\n\t\t// For path check the archive flag as well\n\t\tisarchive, found, err := unstructured.NestedBool(origin, \"archive\")\n\t\tif found {\n\t\t\tif err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\n\t\t\tresult.Archive = isarchive\n\t\t}\n\n\t\tresult.Kind = models.OriginPath\n\t\tresult.Path = path\n\t\treturn result, nil\n\t}\n\n\tcontainer, found, err := unstructured.NestedString(origin, \"container\")\n\tif found {\n\t\tif err != nil {\n\t\t\treturn result, err\n\t\t}\n\t\tif container == \"\" {\n\t\t\treturn result, errors.New(\"bad container origin, empty string\")\n\t\t}\n\n\t\tresult.Kind = models.OriginContainer\n\t\tresult.Container = container\n\t\treturn result, nil\n\t}\n\n\trepository, found, err := unstructured.NestedString(origin, \"git\", \"repository\")\n\tif found {\n\t\tif err != nil {\n\t\t\treturn result, err\n\t\t}\n\t\tif repository == \"\" {\n\t\t\treturn result, errors.New(\"bad git origin, url is empty string\")\n\t\t}\n\n\t\tresult.Git = &models.GitRef{}\n\n\t\t// For git check for the optional revision as well.\n\t\trevision, found, err := unstructured.NestedString(origin, \"git\", \"revision\")\n\t\tif found {\n\t\t\tif err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\t\t\tif revision == \"\" {\n\t\t\t\treturn result, errors.New(\"bad git origin, revision is empty string\")\n\t\t\t}\n\t\t\tresult.Git.Revision = revision\n\t\t}\n\n\t\t// For git check for the optional provider as well.\n\t\tprovider, found, err := unstructured.NestedString(origin, \"git\", \"provider\")\n\t\tif found {\n\t\t\tif err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\t\t\tif provider == \"\" {\n\t\t\t\treturn result, errors.New(\"bad git origin, provider is empty string\")\n\t\t\t}\n\t\t\tgitProvider, err := models.GitProviderFromString(provider)\n\t\t\tif err != nil {\n\t\t\t\treturn result, errors.New(\"bad git origin, illegal provider\")\n\t\t\t}\n\t\t\tresult.Git.Provider = gitProvider\n\t\t}\n\n\t\t// For git check for the optional branch as well.\n\t\tbranch, found, err := unstructured.NestedString(origin, \"git\", \"branch\")\n\t\tif found {\n\t\t\tif err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\t\t\tif branch == \"\" {\n\t\t\t\treturn result, errors.New(\"bad git origin, branch is empty string\")\n\t\t\t}\n\t\t\tresult.Git.Branch = branch\n\t\t}\n\n\t\tresult.Kind = models.OriginGit\n\t\tresult.Git.URL = repository\n\t\treturn result, nil\n\t}\n\n\t// Nothing found. Return as is, undefined origin. This can\n\t// happen for applications which were created, but not pushed\n\t// yet.\n\n\treturn result, nil\n}", "func (m *Headers) GetOrigin()(*string) {\n val, err := m.GetBackingStore().Get(\"origin\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (p Point) Offset(toward Point, by float32) Point {\n\treturn p.Add(p.DirTo(toward).Mul(by))\n}", "func (r *Scanner) Offset() uint64 {\n\treturn r.offset\n}", "func (*offsetPageInfoImpl) PreviousOffset(p graphql.ResolveParams) (int, error) {\n\tpage := p.Source.(offsetPageInfo)\n\tif page.offset > 0 {\n\t\tprevOffset := page.offset - page.limit\n\t\treturn clampInt(prevOffset, 0, math.MaxInt32), nil\n\t}\n\treturn 0, nil\n}", "func (p *Peer) TimeOffset() int64 {\n\tp.statsMtx.RLock()\n\ttimeOffset := p.timeOffset\n\tp.statsMtx.RUnlock()\n\n\treturn timeOffset\n}", "func (c *CPU) Offset() int {\n\treturn 1\n}", "func (cr *ClientResponse) Offset() uint64 {\n\treturn cr.offset\n}", "func (m NoMDEntries) GetMDEntryOriginator() (v string, err quickfix.MessageRejectError) {\n\tvar f field.MDEntryOriginatorField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "func (c FieldsCollection) TZOffset() *models.Field {\n\treturn c.MustGet(\"TZOffset\")\n}", "func (p Point2D) Offset(toward Point2D, by float32) Point2D {\n\treturn p.Add(p.DirTo(toward).Mul(by))\n}", "func (o TemplateAxisDisplayOptionsPtrOutput) AxisOffset() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TemplateAxisDisplayOptions) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.AxisOffset\n\t}).(pulumi.StringPtrOutput)\n}", "func (o BucketCorsItemOutput) Origin() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v BucketCorsItem) []string { return v.Origin }).(pulumi.StringArrayOutput)\n}", "func (o *WObj) GetTopLeft() (float64, float64) {\n\tpnt := o.Hitbox.Min()\n\treturn pnt.X, pnt.Y\n}", "func (p PageRequest) Offset() int64 {\n\treturn p.PerPage * (p.Page - 1)\n}", "func (o BucketCorsItemResponseOutput) Origin() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v BucketCorsItemResponse) []string { return v.Origin }).(pulumi.StringArrayOutput)\n}", "func (f *Font) subtractGlyphOriginForDirection(glyph fonts.GID, direction Direction,\n\tx, y Position) (Position, Position) {\n\toriginX, originY := f.getGlyphOriginForDirection(glyph, direction)\n\n\treturn x - originX, y - originY\n}", "func (r Ruler) Offset(p Point, dx float64, dy float64) Point {\n\treturn Point{p[0] + dx/r.kx, p[1] + dy/r.ky}\n}", "func (s *DisassociateApprovedOriginInput) SetOrigin(v string) *DisassociateApprovedOriginInput {\n\ts.Origin = &v\n\treturn s\n}", "func (o *InvestmentsTransactionsGetRequestOptions) GetOffset() int32 {\n\tif o == nil || o.Offset == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Offset\n}", "func NewTransform2DAxisOrigin(xAxis Vector2, yAxis Vector2, origin Vector2) *Transform2D {\n\tvar dest C.godot_transform2d\n\targ1 := xAxis.getBase()\n\targ2 := yAxis.getBase()\n\targ3 := origin.getBase()\n\tC.go_godot_transform2d_new_axis_origin(GDNative.api, &dest, arg1, arg2, arg3)\n\treturn &Transform2D{base: &dest}\n}", "func (l *LocalService) GetOrigin() string {\n\treturn \"local\"\n}", "func (r *Reader) AdjustedOffset(br *bufio.Reader) int64 {\n\treturn r.Request.Offset - int64(br.Buffered())\n}", "func (o EmailIdentityDkimSigningAttributesPtrOutput) SigningAttributesOrigin() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *EmailIdentityDkimSigningAttributes) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SigningAttributesOrigin\n\t}).(pulumi.StringPtrOutput)\n}", "func (s *Scanner) Offset() int {\n\treturn s.offset\n}", "func (g Object) CalculatedPoint() Position {\n\tp := g.bridge().CalculatedPoint()\n\treturn Position{p.X, p.Y, p.Z}\n}", "func Offset() time.Duration {\n\treturn DefaultScheduler.Offset()\n}", "func getNodeOrigin(node graph.Node) kvs.ValueOrigin {\n\tflag := node.GetFlag(OriginFlagName)\n\tif flag != nil {\n\t\treturn flag.(*OriginFlag).origin\n\t}\n\treturn kvs.UnknownOrigin\n}", "func (lex *ExprLexer) Offset() int {\n\treturn lex.scan.Pos().Offset\n}", "func (p *Pagination) Offset() uint {\n\toffset := (p.Page - 1) * p.PerPage\n\t// a couple reasonable boundaries\n\toffset = minuint(offset, p.total)\n\toffset = maxuint(offset, 0)\n\treturn offset\n}", "func FetchOffset() int {\n\toffset := intFromEnvVar(\"FETCH_OFFSET\", -1)\n\tif offset < 0 {\n\t\tpanic(errors.New(\"FETCH_OFFSET could not be parsed or is a negative number\"))\n\t}\n\treturn offset\n}", "func (b Bounds3) Offset(p Point3) Vec3 {\n\to := p.SubtractP(b.pMin)\n\tif b.pMax.X > b.pMin.X {\n\t\to.X /= b.pMax.X - b.pMin.X\n\t}\n\tif b.pMax.Y > b.pMin.Y {\n\t\to.Y /= b.pMax.Y - b.pMin.Y\n\t}\n\tif b.pMax.Z > b.pMin.Z {\n\t\to.Z /= b.pMax.Z - b.pMin.Z\n\t}\n\treturn o\n}", "func CalcOffset() int {\n\tvar offset int\n\tweekday := time.Now().Weekday()\n\n\tswitch weekday {\n\tcase time.Sunday:\n\t\toffset = 7\n\tcase time.Monday:\n\t\toffset = 6\n\tcase time.Tuesday:\n\t\toffset = 5\n\tcase time.Wednesday:\n\t\toffset = 4\n\tcase time.Thursday:\n\t\toffset = 3\n\tcase time.Friday:\n\t\toffset = 2\n\tcase time.Saturday:\n\t\toffset = 1\n\t}\n\n\treturn offset\n}", "func (f *File) Offset(p Pos) int {\n\tx := p.index()\n\tif x < f.base || x > f.base+index(f.size) {\n\t\tpanic(\"illegal Pos value\")\n\t}\n\treturn int(x - f.base)\n}", "func (l *Line) Offset() int {\n\treturn l.offsets[0]\n}", "func (o OpenZfsVolumeOutput) OriginSnapshot() OpenZfsVolumeOriginSnapshotPtrOutput {\n\treturn o.ApplyT(func(v *OpenZfsVolume) OpenZfsVolumeOriginSnapshotPtrOutput { return v.OriginSnapshot }).(OpenZfsVolumeOriginSnapshotPtrOutput)\n}", "func ExamplePdfMaroto_GetCurrentOffset() {\n\tm := pdf.NewMaroto(consts.Portrait, consts.A4)\n\n\t// Offset here will be 0.\n\t_ = m.GetCurrentOffset()\n\n\t// Add Rows, Cols and Components until maroto add a new page.\n\n\t// Offset here will not be 0.\n\t_ = m.GetCurrentOffset()\n\n\t// Add Rows, Cols and Components to maroto add a new page.\n\n\t// Offset here will be 0.\n\t_ = m.GetCurrentOffset()\n\n\t// Do more things and save...\n}" ]
[ "0.5914239", "0.53744346", "0.5362208", "0.53457284", "0.5273407", "0.5206835", "0.51678556", "0.51544935", "0.513803", "0.5098593", "0.50667167", "0.49152374", "0.49146998", "0.49081457", "0.48933637", "0.48863855", "0.4874854", "0.48649567", "0.4814246", "0.481144", "0.47824776", "0.4759705", "0.47484967", "0.47476938", "0.47470304", "0.47442433", "0.4720422", "0.47183004", "0.46985132", "0.46885204", "0.46836895", "0.46673343", "0.4644397", "0.4603541", "0.45851442", "0.45821506", "0.45774463", "0.45689437", "0.45629278", "0.4562026", "0.4547541", "0.45374075", "0.452613", "0.45167017", "0.45148882", "0.44918212", "0.44826937", "0.44817704", "0.44768065", "0.44705784", "0.4466191", "0.44627956", "0.44575173", "0.44494864", "0.44480357", "0.4447075", "0.4446545", "0.44459823", "0.44439495", "0.44410762", "0.44243488", "0.44035512", "0.43849787", "0.43835297", "0.43800667", "0.43610594", "0.43525013", "0.43389487", "0.4337887", "0.4335689", "0.43313777", "0.4325086", "0.43238178", "0.43230948", "0.43230414", "0.43225977", "0.43221787", "0.43132752", "0.42988008", "0.4290477", "0.4288777", "0.42879087", "0.4280997", "0.42772257", "0.4275515", "0.42739266", "0.42650723", "0.42623237", "0.42558444", "0.42542452", "0.4248455", "0.42479074", "0.42461124", "0.42435443", "0.42428845", "0.42416456", "0.42380038", "0.42355382", "0.42344546", "0.42309955" ]
0.7910798
0
RunExampleResolver shows how you would setup one resolver to use this pattern The resolver would typically be a mutation, as queries have their own implementation The GraphQL server acts as a thin proxy that maps and passes requests onto the handler Initialise request structs Pass in the writer and reader Add in the middleware Execute with context
func (r *RootResolver) RunExampleResolver(ctx context.Context) { // Prepare args req := handlers.MustNewReader(&OnboardStartRequest{}) resp := &bytes.Buffer{} // Prepare func fn := handlers.WithLogging(handlers.WithMetrics("start", r.Calls, r.Errors, r.Saturation, r.Duration, OnboardStart(r.userStore, r.accountStore))) // Execute func and handle errors err := fn(ctx, resp, req) var userErr *handlers.UserError var sysErr *handlers.SystemError if errors.As(err, &userErr) { fmt.Println("Input Error:", userErr.Message) return } if errors.As(err, &sysErr) { fmt.Println("Internal Error") return } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewResolver(\n\tlogger logger.Logger,\n\tshortLinkRetriever shortlink.Retriever,\n\tshortLinkCreator shortlink.Creator,\n\tshortLinkUpdater shortlink.Updater,\n\tchangeLog changelog.ChangeLog,\n\trequesterVerifier requester.Verifier,\n\tauthenticator authenticator.Authenticator,\n\tuserRepo repository.User,\n\tuserShortLinkRepo repository.UserShortLink,\n\tkeyGen keygen.KeyGenerator,\n) Resolver {\n\treturn Resolver{\n\t\tQuery: newQuery(logger, authenticator, changeLog, shortLinkRetriever, userShortLinkRepo),\n\t\tMutation: newMutation(\n\t\t\tlogger,\n\t\t\tchangeLog,\n\t\t\tshortLinkCreator,\n\t\t\tshortLinkUpdater,\n\t\t\trequesterVerifier,\n\t\t\tauthenticator,\n\t\t\tuserRepo,\n\t\t\tkeyGen,\n\t\t),\n\t}\n}", "func NewMockResolver() *MockResolver {\n\treturn &MockResolver{\n\t\tCommitGraphFunc: &ResolverCommitGraphFunc{\n\t\t\tdefaultHook: func(context.Context, int) (graphqlbackend.CodeIntelligenceCommitGraphResolver, error) {\n\t\t\t\treturn nil, nil\n\t\t\t},\n\t\t},\n\t\tDeleteIndexByIDFunc: &ResolverDeleteIndexByIDFunc{\n\t\t\tdefaultHook: func(context.Context, int) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t\tDeleteUploadByIDFunc: &ResolverDeleteUploadByIDFunc{\n\t\t\tdefaultHook: func(context.Context, int) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t\tGetIndexByIDFunc: &ResolverGetIndexByIDFunc{\n\t\t\tdefaultHook: func(context.Context, int) (dbstore.Index, bool, error) {\n\t\t\t\treturn dbstore.Index{}, false, nil\n\t\t\t},\n\t\t},\n\t\tGetIndexesByIDsFunc: &ResolverGetIndexesByIDsFunc{\n\t\t\tdefaultHook: func(context.Context, ...int) ([]dbstore.Index, error) {\n\t\t\t\treturn nil, nil\n\t\t\t},\n\t\t},\n\t\tGetUploadByIDFunc: &ResolverGetUploadByIDFunc{\n\t\t\tdefaultHook: func(context.Context, int) (dbstore.Upload, bool, error) {\n\t\t\t\treturn dbstore.Upload{}, false, nil\n\t\t\t},\n\t\t},\n\t\tGetUploadsByIDsFunc: &ResolverGetUploadsByIDsFunc{\n\t\t\tdefaultHook: func(context.Context, ...int) ([]dbstore.Upload, error) {\n\t\t\t\treturn nil, nil\n\t\t\t},\n\t\t},\n\t\tIndexConfigurationFunc: &ResolverIndexConfigurationFunc{\n\t\t\tdefaultHook: func(context.Context, int) ([]byte, error) {\n\t\t\t\treturn nil, nil\n\t\t\t},\n\t\t},\n\t\tIndexConnectionResolverFunc: &ResolverIndexConnectionResolverFunc{\n\t\t\tdefaultHook: func(dbstore.GetIndexesOptions) *resolvers.IndexesResolver {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t\tQueryResolverFunc: &ResolverQueryResolverFunc{\n\t\t\tdefaultHook: func(context.Context, *graphqlbackend.GitBlobLSIFDataArgs) (resolvers.QueryResolver, error) {\n\t\t\t\treturn nil, nil\n\t\t\t},\n\t\t},\n\t\tQueueAutoIndexJobForRepoFunc: &ResolverQueueAutoIndexJobForRepoFunc{\n\t\t\tdefaultHook: func(context.Context, int) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t\tUpdateIndexConfigurationByRepositoryIDFunc: &ResolverUpdateIndexConfigurationByRepositoryIDFunc{\n\t\t\tdefaultHook: func(context.Context, int, string) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t\tUploadConnectionResolverFunc: &ResolverUploadConnectionResolverFunc{\n\t\t\tdefaultHook: func(dbstore.GetUploadsOptions) *resolvers.UploadsResolver {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t}\n}", "func NewResolver(\n\tlogger fw.Logger,\n\ttracer fw.Tracer,\n\tchangeLog changelog.ChangeLog,\n\turlRetriever url.Retriever,\n\turlCreator url.Creator,\n\trequesterVerifier requester.Verifier,\n\tauthenticator authenticator.Authenticator,\n) Resolver {\n\treturn Resolver{\n\t\tQuery: newQuery(logger, tracer, authenticator, changeLog, urlRetriever),\n\t\tMutation: newMutation(\n\t\t\tlogger,\n\t\t\ttracer,\n\t\t\tchangeLog,\n\t\t\turlCreator,\n\t\t\trequesterVerifier,\n\t\t\tauthenticator,\n\t\t),\n\t}\n}", "func (m *MockResolver) QueryResolver(v0 context.Context, v1 *graphqlbackend.GitBlobLSIFDataArgs) (resolvers.QueryResolver, error) {\n\tr0, r1 := m.QueryResolverFunc.nextHook()(v0, v1)\n\tm.QueryResolverFunc.appendCall(ResolverQueryResolverFuncCall{v0, v1, r0, r1})\n\treturn r0, r1\n}", "func NewResolver(db driver.Database, stellarDriver *stellar.Driver, txSourceDriver txsource.Driver) Resolver {\n\tr := new(resolver)\n\tr.db = db\n\tr.txSourceDriver = txSourceDriver\n\tr.stellarDriver = stellarDriver\n\tr.approveReqRes = approveReqResolver{r}\n\tr.docRes = docResolver{r}\n\tr.mutationRes = mutationResolver{r}\n\tr.queryRes = queryResolver{r}\n\tr.tradeRes = tradeResolver{r}\n\tr.tradeStageAddReqRes = tradeStageAddReqResolver{r}\n\tr.tradeStageDocRes = tradeStageDocResolver{r}\n\tr.userRes = userResolver{r}\n\tr.accessApprovalRes = accessApprovalResolver{r}\n\tr.tradeOfferRes = tradeOfferRes{r}\n\tr.moderatorRes = stageModeratorResolver{r}\n\tr.notificationRes = notificationResolver{r}\n\treturn r\n}", "func NewResolver(args map[string]interface{}) Resolver {\n\treturn &concreteResolver{args: args}\n}", "func RegisterResolver(scheme string, consulConf *consulapi.Config, srvName string) {\n\tzlogger, _ := utils.ZapLoggerInit(srvName)\n\tconsul_resovler := &ConsulResolver{\n\t\tscheme: scheme, //grpc-dial\n\t\tServiceName: srvName, //监听哪个service\n\t\tConsulConf: consulConf, //consul-agent配置\n\t\tLogger: zlogger,\n\t}\n\tresolver.Register(consul_resovler)\n}", "func NewResolver(config *config.Config, statsdClient statsd.ClientInterface, e *erpc.ERPC) (*Resolver, error) {\n\thitsCounters := make(map[counterEntry]*atomic.Int64)\n\tmissCounters := make(map[counterEntry]*atomic.Int64)\n\tfor _, resolution := range metrics.AllResolutionsTags {\n\t\tfor _, resolutionType := range metrics.AllTypesTags {\n\t\t\t// procfs resolution doesn't exist in the dentry resolver\n\t\t\tif resolutionType == metrics.ProcFSTag {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tentry := counterEntry{\n\t\t\t\tresolutionType: resolutionType,\n\t\t\t\tresolution: resolution,\n\t\t\t}\n\t\t\thitsCounters[entry] = atomic.NewInt64(0)\n\t\t\tmissCounters[entry] = atomic.NewInt64(0)\n\t\t}\n\t}\n\n\tnumCPU, err := utils.NumCPU()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't fetch the host CPU count: %w\", err)\n\t}\n\n\treturn &Resolver{\n\t\tconfig: config,\n\t\tstatsdClient: statsdClient,\n\t\tcache: make(map[uint32]*lru.Cache[model.PathKey, *PathEntry]),\n\t\terpc: e,\n\t\terpcRequest: erpc.ERPCRequest{},\n\t\terpcStatsZero: make([]eRPCStats, numCPU),\n\t\thitsCounters: hitsCounters,\n\t\tmissCounters: missCounters,\n\t\tnumCPU: numCPU,\n\t\tchallenge: rand.Uint32(),\n\t}, nil\n}", "func NewResolver(interpreter *Interpreter) *Resolver {\n\treturn &Resolver{\n\t\tscopes: NewScopes(),\n\t\tinterpreter: interpreter,\n\t\tcurFunc: FuncNone,\n\t\tinLoop: false,\n\t\tinClass: false,\n\t\tinSubClass: false,\n\t\tinInit: false,\n\t\thadError: false,\n\t}\n}", "func NewResolver(db *sql.DB) graphqlbackend.CampaignsResolver {\n\treturn &Resolver{store: ee.NewStore(db)}\n}", "func main() {\n\tscma, restRoutes := LoadSchemaFile(\"schema.graphql\", schema.ObjectFieldResolvers{\n\t\t\"Query\": schema.FieldResolvers{\n\t\t\t\"person\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\tif person, ok := testdata.People[p.Args[\"id\"].(string)]; ok {\n\t\t\t\t\treturn person, nil\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, api.NewErrorWithRestStatus(\n\t\t\t\t\t\thttp.StatusNotFound,\n\t\t\t\t\t\tfmt.Errorf(\"no person found with ID '%s'\", p.Args[\"id\"]),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"account\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\tif account, ok := testdata.Accounts[p.Args[\"id\"].(string)]; ok {\n\t\t\t\t\treturn account, nil\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, api.NewErrorWithRestStatus(\n\t\t\t\t\t\thttp.StatusNotFound,\n\t\t\t\t\t\tfmt.Errorf(\"no account found with ID '%s'\", p.Args[\"id\"]),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"user\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\tif user, ok := testdata.Users[p.Args[\"id\"].(string)]; ok {\n\t\t\t\t\treturn user, nil\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, api.NewErrorWithRestStatus(\n\t\t\t\t\t\thttp.StatusNotFound,\n\t\t\t\t\t\tfmt.Errorf(\"no user found with ID '%s'\", p.Args[\"id\"]),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t\"Person\": schema.FieldResolvers{\n\t\t\t// TODO: Need some way to easily return plain old JSON fields\n\t\t\t\"id\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\treturn p.Source.(testdata.Person).ID, nil\n\t\t\t},\n\t\t\t\"users\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\tvar users []testdata.User\n\t\t\t\tfor _, user := range testdata.Users {\n\t\t\t\t\tif user.PersonID == p.Source.(testdata.Person).ID {\n\t\t\t\t\t\tusers = append(users, user)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn users, nil\n\t\t\t},\n\t\t},\n\t\t\"Account\": schema.FieldResolvers{\n\t\t\t\"id\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\treturn p.Source.(testdata.Account).ID, nil\n\t\t\t},\n\t\t\t\"plan\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\tid := p.Source.(testdata.Account).PlanID\n\t\t\t\tif plan, ok := testdata.Plans[id]; ok {\n\t\t\t\t\treturn plan, nil\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, fmt.Errorf(\"no plan found with ID '%s'\", id)\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"users\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\tvar users []testdata.User\n\t\t\t\tfor _, user := range testdata.Users {\n\t\t\t\t\tif user.AccountID == p.Source.(testdata.Account).ID {\n\t\t\t\t\t\tusers = append(users, user)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn users, nil\n\t\t\t},\n\t\t\t\"usersByType\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\tusers := []testdata.User{}\n\t\t\t\tfor _, user := range testdata.Users {\n\t\t\t\t\tif user.AccountID == p.Source.(testdata.Account).ID && user.Type == p.Args[\"type\"] {\n\t\t\t\t\t\tusers = append(users, user)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn users, nil\n\t\t\t},\n\t\t},\n\t\t\"Plan\": schema.FieldResolvers{\n\t\t\t\"id\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\treturn p.Source.(testdata.Plan).ID, nil\n\t\t\t},\n\t\t\t\"name\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\treturn p.Source.(testdata.Plan).Name, nil\n\t\t\t},\n\t\t},\n\t\t\"User\": schema.FieldResolvers{\n\t\t\t\"id\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\treturn p.Source.(testdata.User).ID, nil\n\t\t\t},\n\t\t\t\"person\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\tid := p.Source.(testdata.User).PersonID\n\t\t\t\tif person, ok := testdata.People[id]; ok {\n\t\t\t\t\treturn person, nil\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, fmt.Errorf(\"no person found with ID '%s'\", id)\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"account\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\tid := p.Source.(testdata.User).AccountID\n\t\t\t\tif account, ok := testdata.Accounts[id]; ok {\n\t\t\t\t\treturn account, nil\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, fmt.Errorf(\"no account found with ID '%s'\", id)\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"type\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\treturn p.Source.(testdata.User).Type, nil\n\t\t\t},\n\t\t},\n\t})\n\n\tserver := gin.Default()\n\tserver.Use(\n\t\tcors.New(cors.Config{\n\t\t\tAllowAllOrigins: true,\n\t\t\tAllowMethods: []string{\"POST\", \"OPTIONS\"},\n\t\t\tAllowHeaders: []string{\n\t\t\t\t\"Origin\",\n\t\t\t\t\"Authorization\",\n\t\t\t\t\"X-Requested-With\",\n\t\t\t\t\"Content-Type\",\n\t\t\t\t\"Accept\",\n\t\t\t\t\"W-Token\",\n\t\t\t\t\"W-UserId\",\n\t\t\t},\n\t\t}),\n\t\tapi.ErrorMiddleware(),\n\t)\n\tserver.OPTIONS(\"/\", func(c *gin.Context) {\n\t\tc.String(http.StatusOK, \"Hello!\")\n\t})\n\tserver.GET(\"/graphql\", GinHandlerForGraphQLSchema(scma))\n\tfor _, route := range restRoutes {\n\t\tserver.GET(route.Route, route.Handler)\n\t}\n\n\tlog.Fatal(server.Run())\n}", "func NewResolver() exec.Resolver {\n\treturn &resolver{}\n}", "func (c *Client) Resolver(_ context.Context, client *http.Client, plainHTTP bool) (remotes.Resolver, error) {\n\treturn docker.NewResolver(docker.ResolverOptions{\n\t\tCredentials: c.Credential,\n\t\tClient: client,\n\t\tPlainHTTP: plainHTTP,\n\t}), nil\n}", "func (v *Venom) RegisterResolver(level ConfigLevel, r Resolver) {\n\tv.Store.RegisterResolver(level, r)\n}", "func (mf MiddlewareFunc) Run(req *Request, handler Handler) (*Response, error) {\n\treturn mf(req, handler)\n}", "func NewResolver(opts ...Option) resolver.Interface {\n\tr := &Resolver{}\n\n\t// Apply all options.\n\tfor _, o := range opts {\n\t\to(r)\n\t}\n\n\treturn r\n}", "func NewResolver(config *config.Config) Resolver {\n\tif config.RemoteTaggerEnabled {\n\t\toptions, err := remote.NodeAgentOptions()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"unable to configure the remote tagger: %s\", err)\n\t\t} else {\n\t\t\treturn &DefaultResolver{\n\t\t\t\ttagger: remote.NewTagger(options),\n\t\t\t}\n\t\t}\n\t}\n\treturn &DefaultResolver{\n\t\ttagger: &nullTagger{},\n\t}\n}", "func NewResolver(userExists existsFn) *Resolver {\n\treturn &Resolver{\n\t\tfiles: map[string][]string{},\n\t\tdomains: map[string]bool{},\n\t\taliases: map[string][]Recipient{},\n\n\t\tuserExistsInDB: userExists,\n\t}\n}", "func NewResolver() peerresolver.Provider {\n\treturn func(ed service.Dispatcher, context context.Client, channelID string, opts ...options.Opt) peerresolver.Resolver {\n\t\treturn New(ed, context, channelID, opts...)\n\t}\n}", "func InitializeResolver() generated.Config {\n\tresolver := Resolver{}\n\n\tresolver.dbClient = postgres.Connect()\n\tresolver.redisClient = redis.Connect()\n\n\treturn generated.Config{\n\t\tResolvers: &resolver,\n\t}\n}", "func GraphqlHandler() gin.HandlerFunc {\n // NewExecutableSchema and Config are in the generated.go file\n // Resolver is in the resolver.go file\n h := handler.NewDefaultServer(generated.NewExecutableSchema(generated.Config{Resolvers: &resolvers.Resolver{}}))\n\n return func(c *gin.Context) {\n h.ServeHTTP(c.Writer, c.Request)\n }\n}", "func NewResolver(cln *client.Client, mw *progress.MultiWriter) (Resolver, error) {\n\troot, exist, err := modulesPathExist()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !exist {\n\t\treturn &remoteResolver{cln, mw, root}, nil\n\t}\n\n\treturn &vendorResolver{root}, nil\n}", "func Handler(service e2e.Service, hooks *twirp.ServerHooks) *handler.Server {\n\tes := NewExecutableSchema(Config{Resolvers: &Resolver{service}})\n\tsrv := handler.New(es)\n\tsrv.AddTransport(transport.POST{})\n\tsrv.Use(extension.Introspection{})\n\tif hooks == nil {\n\t\treturn srv\n\t}\n\tsrv.AroundFields(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) {\n\t\tf := graphql.GetFieldContext(ctx)\n\t\tparent := f.Parent.Path().String()\n\t\tif parent != \"\" {\n\t\t\treturn next(ctx)\n\t\t}\n\t\tctx = ctxsetters.WithMethodName(ctx, f.Field.Name)\n\t\tif hooks.RequestRouted != nil {\n\t\t\tctx, err = hooks.RequestRouted(ctx)\n\t\t\tif err != nil {\n\t\t\t\tif terr, ok := err.(twirp.Error); ok && hooks.Error != nil {\n\t\t\t\t\tctx = hooks.Error(ctx, terr)\n\t\t\t\t}\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tres, err = next(ctx)\n\t\tif terr, ok := err.(twirp.Error); ok && hooks.Error != nil {\n\t\t\tctx = hooks.Error(ctx, terr)\n\t\t}\n\t\treturn res, err\n\t})\n\treturn srv\n}", "func NewResolver(manager *manager.Manager, config *config.Config, statsdClient statsd.ClientInterface,\n\tscrubber *procutil.DataScrubber, containerResolver *container.Resolver, mountResolver *mount.Resolver,\n\tcgroupResolver *cgroup.Resolver, userGroupResolver *usergroup.Resolver, timeResolver *stime.Resolver,\n\tpathResolver spath.ResolverInterface, opts *ResolverOpts) (*Resolver, error) {\n\targsEnvsCache, err := simplelru.NewLRU[uint32, *argsEnvsCacheEntry](maxParallelArgsEnvs, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp := &Resolver{\n\t\tmanager: manager,\n\t\tconfig: config,\n\t\tstatsdClient: statsdClient,\n\t\tscrubber: scrubber,\n\t\tentryCache: make(map[uint32]*model.ProcessCacheEntry),\n\t\topts: *opts,\n\t\targsEnvsCache: argsEnvsCache,\n\t\tstate: atomic.NewInt64(Snapshotting),\n\t\thitsStats: map[string]*atomic.Int64{},\n\t\tcacheSize: atomic.NewInt64(0),\n\t\tmissStats: atomic.NewInt64(0),\n\t\taddedEntriesFromEvent: atomic.NewInt64(0),\n\t\taddedEntriesFromKernelMap: atomic.NewInt64(0),\n\t\taddedEntriesFromProcFS: atomic.NewInt64(0),\n\t\tflushedEntries: atomic.NewInt64(0),\n\t\tpathErrStats: atomic.NewInt64(0),\n\t\targsTruncated: atomic.NewInt64(0),\n\t\targsSize: atomic.NewInt64(0),\n\t\tenvsTruncated: atomic.NewInt64(0),\n\t\tenvsSize: atomic.NewInt64(0),\n\t\tbrokenLineage: atomic.NewInt64(0),\n\t\tcontainerResolver: containerResolver,\n\t\tmountResolver: mountResolver,\n\t\tcgroupResolver: cgroupResolver,\n\t\tuserGroupResolver: userGroupResolver,\n\t\ttimeResolver: timeResolver,\n\t\tpathResolver: pathResolver,\n\t\tenvVarsResolver: envvars.NewEnvVarsResolver(config),\n\t}\n\tfor _, t := range metrics.AllTypesTags {\n\t\tp.hitsStats[t] = atomic.NewInt64(0)\n\t}\n\tp.processCacheEntryPool = NewProcessCacheEntryPool(p)\n\n\t// Create rate limiter that allows for 128 pids\n\tlimiter, err := utils.NewLimiter[uint32](128, numAllowedPIDsToResolvePerPeriod, procFallbackLimiterPeriod)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp.procFallbackLimiter = limiter\n\n\treturn p, nil\n}", "func main() {\n\t defaultPort := \"4040\"\n\tport := os.Getenv(\"PORT\")\n\tif port == \"\" {\n\t\tport = defaultPort\n\t}\n\n\tDatabase := db.Connect()\n\n\tDatabase.AddQueryHook(db.Logs{})\n\n\troute := chi.NewRouter()\n\n\troute.Use(cors.New(cors.Options{\n\t\tAllowedOrigins: []string{\"http://localhost:4040\"},\n\t\tAllowCredentials: true,\n\t\tDebug: true,\n\t}).Handler)\n\troute.Use(middleware.Logger,\n\t\t\tmiddleware.RequestID,\n\t\t\tInternalMiddleWare.AuthMiddleware())\n\n\troute.Route(\"/graphql\", func(route chi.Router){\n\t\troute.Use(dataloaders.NewMiddleware(Database)...)\n\n\t\tschema := generated.NewExecutableSchema( generated.Config{\n\t\t\t\tResolvers: &resolvers.Resolver{\n\t\t\t\t\tDB: Database,\n\t\t\t\t},\n\t\t\t\tDirectives:generated.DirectiveRoot{},\n\t\t\t\tComplexity:generated.ComplexityRoot{},\n\t\t })\n\n\t\tvar serve = handler.NewDefaultServer(schema)\n\t\tserve.Use(extension.FixedComplexityLimit(300))\n\t\troute.Handle(\"/\", serve)\n\t})\n\n\tgraphiql := playground.Handler(\"api-gateway\" , \"/graphql\")\n\troute.Get(\"/\" , graphiql)\n\n\tlog.Printf(\"connect to http://localhost:%s/ for GraphQL playground\", port)\n\tlog.Fatal(http.ListenAndServe(\":\"+port, route))\n}", "func WithResolver(resolver string) Option {\n\treturn func(p *proxy) {\n\t\tp.resolver = resolver\n\t}\n}", "func NewResolver(fileDescriptorProtos ...*descriptorpb.FileDescriptorProto) (Resolver, error) {\n\treturn newResolver(fileDescriptorProtos...)\n}", "func (r *Resolver) Query() _graphql.QueryResolver { return &queryResolver{r} }", "func (a *API) RegisterQuerier(\n\tqueryable storage.SampleAndChunkQueryable,\n\tengine *promql.Engine,\n\tdistributor *distributor.Distributor,\n\tregisterRoutesExternally bool,\n\ttombstonesLoader *purger.TombstonesLoader,\n\tquerierRequestDuration *prometheus.HistogramVec,\n) http.Handler {\n\tapi := v1.NewAPI(\n\t\tengine,\n\t\tqueryable,\n\t\tfunc(context.Context) v1.TargetRetriever { return &querier.DummyTargetRetriever{} },\n\t\tfunc(context.Context) v1.AlertmanagerRetriever { return &querier.DummyAlertmanagerRetriever{} },\n\t\tfunc() config.Config { return config.Config{} },\n\t\tmap[string]string{}, // TODO: include configuration flags\n\t\tv1.GlobalURLOptions{},\n\t\tfunc(f http.HandlerFunc) http.HandlerFunc { return f },\n\t\tnil, // Only needed for admin APIs.\n\t\t\"\", // This is for snapshots, which is disabled when admin APIs are disabled. Hence empty.\n\t\tfalse, // Disable admin APIs.\n\t\ta.logger,\n\t\tfunc(context.Context) v1.RulesRetriever { return &querier.DummyRulesRetriever{} },\n\t\t0, 0, 0, // Remote read samples and concurrency limit.\n\t\tregexp.MustCompile(\".*\"),\n\t\tfunc() (v1.RuntimeInfo, error) { return v1.RuntimeInfo{}, errors.New(\"not implemented\") },\n\t\t&v1.PrometheusVersion{},\n\t)\n\n\t// these routes are always registered to the default server\n\ta.RegisterRoute(\"/api/v1/user_stats\", http.HandlerFunc(distributor.UserStatsHandler), true)\n\ta.RegisterRoute(\"/api/v1/chunks\", querier.ChunksHandler(queryable), true)\n\n\ta.RegisterRoute(a.cfg.LegacyHTTPPrefix+\"/user_stats\", http.HandlerFunc(distributor.UserStatsHandler), true)\n\ta.RegisterRoute(a.cfg.LegacyHTTPPrefix+\"/chunks\", querier.ChunksHandler(queryable), true)\n\n\t// these routes are either registered the default server OR to an internal mux. The internal mux is\n\t// for use in a single binary mode when both the query frontend and the querier would attempt to claim these routes\n\t// TODO: Add support to expose querier paths with a configurable prefix in single binary mode.\n\trouter := mux.NewRouter()\n\tif registerRoutesExternally {\n\t\trouter = a.server.HTTP\n\t}\n\n\t// Use a separate metric for the querier in order to differentiate requests from the query-frontend when\n\t// running Cortex as a single binary.\n\tinst := middleware.Instrument{\n\t\tDuration: querierRequestDuration,\n\t\tRouteMatcher: router,\n\t}\n\n\tpromRouter := route.New().WithPrefix(a.cfg.ServerPrefix + a.cfg.PrometheusHTTPPrefix + \"/api/v1\")\n\tapi.Register(promRouter)\n\tcacheGenHeaderMiddleware := getHTTPCacheGenNumberHeaderSetterMiddleware(tombstonesLoader)\n\tpromHandler := fakeRemoteAddr(inst.Wrap(cacheGenHeaderMiddleware.Wrap(promRouter)))\n\n\ta.registerRouteWithRouter(router, a.cfg.PrometheusHTTPPrefix+\"/api/v1/read\", querier.RemoteReadHandler(queryable), true, \"POST\")\n\ta.registerRouteWithRouter(router, a.cfg.PrometheusHTTPPrefix+\"/api/v1/query\", promHandler, true, \"GET\", \"POST\")\n\ta.registerRouteWithRouter(router, a.cfg.PrometheusHTTPPrefix+\"/api/v1/query_range\", promHandler, true, \"GET\", \"POST\")\n\ta.registerRouteWithRouter(router, a.cfg.PrometheusHTTPPrefix+\"/api/v1/labels\", promHandler, true, \"GET\", \"POST\")\n\ta.registerRouteWithRouter(router, a.cfg.PrometheusHTTPPrefix+\"/api/v1/label/{name}/values\", promHandler, true, \"GET\")\n\ta.registerRouteWithRouter(router, a.cfg.PrometheusHTTPPrefix+\"/api/v1/series\", promHandler, true, \"GET\", \"POST\", \"DELETE\")\n\t//TODO(gotjosh): This custom handler is temporary until we're able to vendor the changes in:\n\t// https://github.com/prometheus/prometheus/pull/7125/files\n\ta.registerRouteWithRouter(router, a.cfg.PrometheusHTTPPrefix+\"/api/v1/metadata\", querier.MetadataHandler(distributor), true, \"GET\")\n\n\tlegacyPromRouter := route.New().WithPrefix(a.cfg.ServerPrefix + a.cfg.LegacyHTTPPrefix + \"/api/v1\")\n\tapi.Register(legacyPromRouter)\n\tlegacyPromHandler := fakeRemoteAddr(inst.Wrap(cacheGenHeaderMiddleware.Wrap(legacyPromRouter)))\n\n\ta.registerRouteWithRouter(router, a.cfg.LegacyHTTPPrefix+\"/api/v1/read\", querier.RemoteReadHandler(queryable), true, \"POST\")\n\ta.registerRouteWithRouter(router, a.cfg.LegacyHTTPPrefix+\"/api/v1/query\", legacyPromHandler, true, \"GET\", \"POST\")\n\ta.registerRouteWithRouter(router, a.cfg.LegacyHTTPPrefix+\"/api/v1/query_range\", legacyPromHandler, true, \"GET\", \"POST\")\n\ta.registerRouteWithRouter(router, a.cfg.LegacyHTTPPrefix+\"/api/v1/labels\", legacyPromHandler, true, \"GET\", \"POST\")\n\ta.registerRouteWithRouter(router, a.cfg.LegacyHTTPPrefix+\"/api/v1/label/{name}/values\", legacyPromHandler, true, \"GET\")\n\ta.registerRouteWithRouter(router, a.cfg.LegacyHTTPPrefix+\"/api/v1/series\", legacyPromHandler, true, \"GET\", \"POST\", \"DELETE\")\n\t//TODO(gotjosh): This custom handler is temporary until we're able to vendor the changes in:\n\t// https://github.com/prometheus/prometheus/pull/7125/files\n\ta.registerRouteWithRouter(router, a.cfg.LegacyHTTPPrefix+\"/api/v1/metadata\", querier.MetadataHandler(distributor), true, \"GET\")\n\n\t// if we have externally registered routes then we need to return the server handler\n\t// so that we continue to use all standard middleware\n\tif registerRoutesExternally {\n\t\treturn a.server.HTTPServer.Handler\n\t}\n\n\t// Since we have a new router and the request will not go trough the default server\n\t// HTTP middleware stack, we need to add a middleware to extract the trace context\n\t// from the HTTP headers and inject it into the Go context.\n\treturn nethttp.MiddlewareFunc(opentracing.GlobalTracer(), router.ServeHTTP, nethttp.OperationNameFunc(func(r *http.Request) string {\n\t\treturn \"internalQuerier\"\n\t}))\n}", "func NewResolver(entries []*spb.Entry) (*Resolver, error) {\n\tr := &Resolver{\n\t\tnodes: make(map[string]*cpb.MarkedSource),\n\t\tparams: make(map[string][]string),\n\t\ttparams: make(map[string][]string),\n\t\ttyped: make(map[string]string),\n\t}\n\tfor _, e := range entries {\n\t\tif e.GetFactName() == facts.Code {\n\t\t\tticket := kytheuri.ToString(e.GetSource())\n\t\t\tvar ms cpb.MarkedSource\n\t\t\tif err := proto.Unmarshal(e.GetFactValue(), &ms); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error unmarshalling code for %s: %v\", ticket, err)\n\t\t\t}\n\t\t\tr.nodes[ticket] = &ms\n\t\t} else if e.GetEdgeKind() != \"\" {\n\t\t\tticket := kytheuri.ToString(e.GetSource())\n\t\t\tkind, ord, _ := edges.ParseOrdinal(e.GetEdgeKind())\n\t\t\tif ord < 0 {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid ordinal: %d\", ord)\n\t\t\t}\n\t\t\tswitch kind {\n\t\t\tcase edges.Typed:\n\t\t\t\tr.typed[ticket] = kytheuri.ToString(e.GetTarget())\n\t\t\tcase edges.Param:\n\t\t\t\tparams := r.params[ticket]\n\t\t\t\tif len(params)-1 < ord {\n\t\t\t\t\tn := make([]string, ord+1)\n\t\t\t\t\tcopy(n, params)\n\t\t\t\t\tparams = n\n\t\t\t\t\tr.params[ticket] = params\n\t\t\t\t}\n\t\t\t\tparams[ord] = kytheuri.ToString(e.GetTarget())\n\t\t\tcase edges.TParam:\n\t\t\t\ttparams := r.tparams[ticket]\n\t\t\t\tif len(tparams)-1 < ord {\n\t\t\t\t\tn := make([]string, ord+1)\n\t\t\t\t\tcopy(n, tparams)\n\t\t\t\t\ttparams = n\n\t\t\t\t\tr.tparams[ticket] = tparams\n\t\t\t\t}\n\t\t\t\ttparams[ord] = kytheuri.ToString(e.GetTarget())\n\t\t\t}\n\t\t}\n\t}\n\treturn r, nil\n}", "func (r *Resolver) Mutation() MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() MutationResolver { return &mutationResolver{r} }", "func (s) TestResolverWRR(t *testing.T) {\n\tdefer func(oldNewWRR func() wrr.WRR) { newWRR = oldNewWRR }(newWRR)\n\tnewWRR = testutils.NewTestWRR\n\n\tmgmtServer, err := e2e.StartManagementServer(e2e.ManagementServerOptions{})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer mgmtServer.Stop()\n\n\t// Create a bootstrap configuration specifying the above management server.\n\tnodeID := uuid.New().String()\n\tcleanup, err := xdsbootstrap.CreateFile(xdsbootstrap.Options{\n\t\tNodeID: nodeID,\n\t\tServerURI: mgmtServer.Address,\n\t})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer cleanup()\n\n\tconst serviceName = \"my-service-client-side-xds\"\n\ttcc, rClose := buildResolverForTarget(t, resolver.Target{URL: *testutils.MustParseURL(\"xds:///\" + serviceName)})\n\tdefer rClose()\n\n\tldsName := serviceName\n\trdsName := \"route-\" + serviceName\n\t// Configure the management server with a good listener resource and a\n\t// route configuration resource.\n\tresources := e2e.UpdateOptions{\n\t\tNodeID: nodeID,\n\t\tListeners: []*v3listenerpb.Listener{e2e.DefaultClientListener(ldsName, rdsName)},\n\t\tRoutes: []*v3routepb.RouteConfiguration{e2e.RouteConfigResourceWithOptions(e2e.RouteConfigOptions{\n\t\t\tRouteConfigName: rdsName,\n\t\t\tListenerName: ldsName,\n\t\t\tClusterSpecifierType: e2e.RouteConfigClusterSpecifierTypeWeightedCluster,\n\t\t\tWeightedClusters: map[string]int{\"A\": 75, \"B\": 25},\n\t\t})},\n\t\tSkipValidation: true,\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)\n\tdefer cancel()\n\tif err := mgmtServer.Update(ctx, resources); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Read the update pushed by the resolver to the ClientConn.\n\tgotState, err := tcc.stateCh.Receive(ctx)\n\tif err != nil {\n\t\tt.Fatalf(\"Timeout waiting for an update from the resolver: %v\", err)\n\t}\n\trState := gotState.(resolver.State)\n\tif err := rState.ServiceConfig.Err; err != nil {\n\t\tt.Fatalf(\"Received error in service config: %v\", rState.ServiceConfig.Err)\n\t}\n\tcs := iresolver.GetConfigSelector(rState)\n\tif cs == nil {\n\t\tt.Fatal(\"Received nil config selector in update from resolver\")\n\t}\n\n\t// Make RPCs are verify WRR behavior in the cluster specifier.\n\tpicks := map[string]int{}\n\tfor i := 0; i < 100; i++ {\n\t\tres, err := cs.SelectConfig(iresolver.RPCInfo{Context: ctx, Method: \"/service/method\"})\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"cs.SelectConfig(): %v\", err)\n\t\t}\n\t\tpicks[clustermanager.GetPickedClusterForTesting(res.Context)]++\n\t\tres.OnCommitted()\n\t}\n\twant := map[string]int{\"cluster:A\": 75, \"cluster:B\": 25}\n\tif !cmp.Equal(picks, want) {\n\t\tt.Errorf(\"Picked clusters: %v; want: %v\", picks, want)\n\t}\n}", "func Setup(\n\tapiMux *mux.Router, cfg config.Dendrite, // nolint: unparam\n\tqueryAPI api.RoomserverQueryAPI, aliasAPI api.RoomserverAliasAPI, // nolint: unparam\n\taccountDB *accounts.Database, // nolint: unparam\n\tfederation *gomatrixserverlib.FederationClient, // nolint: unparam\n\ttransactionsCache *transactions.Cache, // nolint: unparam\n) {\n\tappMux := apiMux.PathPrefix(pathPrefixApp).Subrouter()\n\n\tappMux.Handle(\"/alias\",\n\t\tcommon.MakeExternalAPI(\"alias\", func(req *http.Request) util.JSONResponse {\n\t\t\t// TODO: Implement\n\t\t\treturn util.JSONResponse{\n\t\t\t\tCode: http.StatusOK,\n\t\t\t\tJSON: nil,\n\t\t\t}\n\t\t}),\n\t).Methods(http.MethodGet, http.MethodOptions)\n\tappMux.Handle(\"/user\",\n\t\tcommon.MakeExternalAPI(\"user\", func(req *http.Request) util.JSONResponse {\n\t\t\t// TODO: Implement\n\t\t\treturn util.JSONResponse{\n\t\t\t\tCode: http.StatusOK,\n\t\t\t\tJSON: nil,\n\t\t\t}\n\t\t}),\n\t).Methods(http.MethodGet, http.MethodOptions)\n}", "func NewResolverResolveInvocation(name string, ident1 []string, ident2 merry.Error) *ResolverResolveInvocation {\n\tinvocation := new(ResolverResolveInvocation)\n\n\tinvocation.Parameters.Name = name\n\n\tinvocation.Results.Ident1 = ident1\n\tinvocation.Results.Ident2 = ident2\n\n\treturn invocation\n}", "func New(ctx context.Context) *Resolver {\n\treturn &Resolver{\n\t\tctx: ctx,\n\t\tresultSetPool: sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\treturn &resultSet{\n\t\t\t\t\tbuffers: make(map[int]*BufPair, 8),\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tbyteSlicesPool: sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\tslice := make([][]byte, 0, 24)\n\t\t\t\treturn &slice\n\t\t\t},\n\t\t},\n\t\twaitGroupPool: sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\treturn &sync.WaitGroup{}\n\t\t\t},\n\t\t},\n\t\tbufPairPool: sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\tpair := BufPair{\n\t\t\t\t\tData: fastbuffer.New(),\n\t\t\t\t\tErrors: fastbuffer.New(),\n\t\t\t\t}\n\t\t\t\treturn &pair\n\t\t\t},\n\t\t},\n\t\tbufPairSlicePool: sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\tslice := make([]*BufPair, 0, 24)\n\t\t\t\treturn &slice\n\t\t\t},\n\t\t},\n\t\terrChanPool: sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\treturn make(chan error, 1)\n\t\t\t},\n\t\t},\n\t\thash64Pool: sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\treturn xxhash.New()\n\t\t\t},\n\t\t},\n\t\tinflightFetchPool: sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\treturn &inflightFetch{\n\t\t\t\t\tbufPair: BufPair{\n\t\t\t\t\t\tData: fastbuffer.New(),\n\t\t\t\t\t\tErrors: fastbuffer.New(),\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tinflightFetches: map[uint64]*inflightFetch{},\n\t}\n}", "func NewResolver(urlMapLoader IURLMapLoader) *Resolver {\n\treturn &Resolver{\n\t\turlMapLoader: urlMapLoader,\n\t}\n}", "func NewResolver(fileDescriptors ...protodescriptor.FileDescriptor) (Resolver, error) {\n\treturn newResolver(fileDescriptors...)\n}", "func graphqlHandler() gin.HandlerFunc {\n\t// NewExecutableSchema and Config are in the generated.go file\n\t// Resolver is in the resolver.go file\n\th := handler.NewDefaultServer(generated.NewExecutableSchema(generated.Config{Resolvers: &graph.Resolver{}}))\n\n\treturn func(c *gin.Context) {\n\t\th.ServeHTTP(c.Writer, c.Request)\n\t}\n}", "func (r *Resolver) Mutation() exec.MutationResolver { return &mutationResolver{r} }", "func (q *Query) Register(r *route.Router, ins extpromhttp.InstrumentationMiddleware) {\n\tinstrf := func(name string, next func(w http.ResponseWriter, r *http.Request)) http.HandlerFunc {\n\t\treturn ins.NewHandler(name, http.HandlerFunc(next))\n\t}\n\n\tr.Get(\"/\", instrf(\"root\", q.root))\n\tr.Get(\"/graph\", instrf(\"graph\", q.graph))\n\tr.Get(\"/stores\", instrf(\"stores\", q.stores))\n\tr.Get(\"/status\", instrf(\"status\", q.status))\n\n\tr.Get(\"/static/*filepath\", instrf(\"static\", q.serveStaticAsset))\n\t// Make sure that \"<path-prefix>/new\" is redirected to \"<path-prefix>/new/\" and\n\t// not just the naked \"/new/\", which would be the default behavior of the router\n\t// with the \"RedirectTrailingSlash\" option (https://godoc.org/github.com/julienschmidt/httprouter#Router.RedirectTrailingSlash),\n\t// and which breaks users with a --web.route-prefix that deviates from the path derived\n\t// from the external URL.\n\tr.Get(\"/new\", func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.Redirect(w, r, path.Join(GetWebPrefix(q.logger, q.externalPrefix, q.prefixHeader, r), \"new\")+\"/graph\", http.StatusFound)\n\t})\n\tr.Get(\"/new/*filepath\", instrf(\"react-static\", q.serveReactUI))\n\n\t// TODO(bplotka): Consider adding more Thanos related data e.g:\n\t// - What store nodes we see currently.\n\t// - What sidecars we see currently.\n}", "func (r *Resolver) Post() generated.PostResolver { return &postResolver{r} }", "func (r *Resolver) Post() generated.PostResolver { return &postResolver{r} }", "func (r *Resolver) Query() graphql2.QueryResolver { return &queryResolver{r} }", "func initCreateResolver(db *sql.DB) v1.CreateResolver {\n\treturn v1.CreateResolver{\n\t\tUserService: userService.ServiceImpl{\n\t\t\tCreateRepo: userRepo.RepositoryImpl{DB: db},\n\t\t\tRetrieveRepo: userRepo.RepositoryImpl{DB: db},\n\t\t},\n\t\tRelationshipService: relationshipService.ServiceImpl{\n\t\t\tCreateRepo: relationshipRepo.RepositoryImpl{DB: db},\n\t\t\tRetrieveRepo: relationshipRepo.RepositoryImpl{DB: db},\n\t\t\tUserRetrieverRepo: userService.ServiceImpl{\n\t\t\t\tCreateRepo: userRepo.RepositoryImpl{DB: db},\n\t\t\t\tRetrieveRepo: userRepo.RepositoryImpl{DB: db},\n\t\t\t},\n\t\t},\n\t}\n}", "func Resolver(r resolve.Resolver) Option {\n\treturn func(p *proxy) { p.resolver = r }\n}", "func instantiateResolver(id string, r resolver, resolvers map[string]rdns.Resolver) error {\n\tvar err error\n\tswitch r.Protocol {\n\n\tcase \"doq\":\n\t\tr.Address = rdns.AddressWithDefault(r.Address, rdns.DoQPort)\n\n\t\ttlsConfig, err := rdns.TLSClientConfig(r.CA, r.ClientCrt, r.ClientKey, r.ServerName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\topt := rdns.DoQClientOptions{\n\t\t\tBootstrapAddr: r.BootstrapAddr,\n\t\t\tLocalAddr: net.ParseIP(r.LocalAddr),\n\t\t\tTLSConfig: tlsConfig,\n\t\t\tQueryTimeout: time.Duration(r.QueryTimeout) * time.Second,\n\t\t}\n\t\tresolvers[id], err = rdns.NewDoQClient(id, r.Address, opt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tcase \"dot\":\n\t\tr.Address = rdns.AddressWithDefault(r.Address, rdns.DoTPort)\n\n\t\ttlsConfig, err := rdns.TLSClientConfig(r.CA, r.ClientCrt, r.ClientKey, r.ServerName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\topt := rdns.DoTClientOptions{\n\t\t\tBootstrapAddr: r.BootstrapAddr,\n\t\t\tLocalAddr: net.ParseIP(r.LocalAddr),\n\t\t\tTLSConfig: tlsConfig,\n\t\t\tQueryTimeout: time.Duration(r.QueryTimeout) * time.Second,\n\t\t}\n\t\tresolvers[id], err = rdns.NewDoTClient(id, r.Address, opt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tcase \"dtls\":\n\t\tr.Address = rdns.AddressWithDefault(r.Address, rdns.DTLSPort)\n\n\t\tdtlsConfig, err := rdns.DTLSClientConfig(r.CA, r.ClientCrt, r.ClientKey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\topt := rdns.DTLSClientOptions{\n\t\t\tBootstrapAddr: r.BootstrapAddr,\n\t\t\tLocalAddr: net.ParseIP(r.LocalAddr),\n\t\t\tDTLSConfig: dtlsConfig,\n\t\t\tUDPSize: r.EDNS0UDPSize,\n\t\t\tQueryTimeout: time.Duration(r.QueryTimeout) * time.Second,\n\t\t}\n\t\tresolvers[id], err = rdns.NewDTLSClient(id, r.Address, opt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tcase \"doh\":\n\t\tr.Address = rdns.AddressWithDefault(r.Address, rdns.DoHPort)\n\n\t\ttlsConfig, err := rdns.TLSClientConfig(r.CA, r.ClientCrt, r.ClientKey, r.ServerName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\topt := rdns.DoHClientOptions{\n\t\t\tMethod: r.DoH.Method,\n\t\t\tTLSConfig: tlsConfig,\n\t\t\tBootstrapAddr: r.BootstrapAddr,\n\t\t\tTransport: r.Transport,\n\t\t\tLocalAddr: net.ParseIP(r.LocalAddr),\n\t\t\tQueryTimeout: time.Duration(r.QueryTimeout) * time.Second,\n\t\t}\n\t\tresolvers[id], err = rdns.NewDoHClient(id, r.Address, opt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tcase \"tcp\", \"udp\":\n\t\tr.Address = rdns.AddressWithDefault(r.Address, rdns.PlainDNSPort)\n\n\t\topt := rdns.DNSClientOptions{\n\t\t\tLocalAddr: net.ParseIP(r.LocalAddr),\n\t\t\tUDPSize: r.EDNS0UDPSize,\n\t\t\tQueryTimeout: time.Duration(r.QueryTimeout) * time.Second,\n\t\t}\n\t\tresolvers[id], err = rdns.NewDNSClient(id, r.Address, r.Protocol, opt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported protocol '%s' for resolver '%s'\", r.Protocol, id)\n\t}\n\treturn nil\n}", "func NewResolver() *Resolver {\n\tclient := http.Client{\n\t\tTimeout: time.Second * 3,\n\t}\n\n\treturn &Resolver{\n\t\tClient: client,\n\t}\n}", "func (r *Resolver) Visitor() generated.VisitorResolver { return &visitorResolver{r} }", "func GetHTTPHandler(r ResolverRoot, db *DB, migrations []*gormigrate.Migration, res http.ResponseWriter, req *http.Request) {\n\tif os.Getenv(\"DEBUG\") == \"true\" {\n\t\tlog.Debug().Msgf(\"Path base: %s\", path.Base(req.URL.Path))\n\t}\n\texecutableSchema := NewExecutableSchema(Config{Resolvers: r})\n\tgqlHandler := handler.New(executableSchema)\n\tgqlHandler.AddTransport(transport.Websocket{\n\t\tKeepAlivePingInterval: 10 * time.Second,\n\t})\n\tgqlHandler.AddTransport(transport.Options{})\n\tgqlHandler.AddTransport(transport.GET{})\n\tgqlHandler.AddTransport(transport.POST{})\n\tgqlHandler.AddTransport(transport.MultipartForm{})\n\tgqlHandler.Use(extension.FixedComplexityLimit(300))\n\tif os.Getenv(\"DEBUG\") == \"true\" {\n\t\tgqlHandler.Use(extension.Introspection{})\n\t}\n\tgqlHandler.Use(apollotracing.Tracer{})\n\tgqlHandler.Use(extension.AutomaticPersistedQuery{\n\t\tCache: lru.New(100),\n\t})\n\tloaders := GetLoaders(db)\n\tif os.Getenv(\"EXPOSE_MIGRATION_ENDPOINT\") == \"true\" {\n\t\tif path.Base(req.URL.Path) == \"migrate\" {\n\t\t\terr := db.Migrate(migrations)\n\t\t\tif err != nil {\n\t\t\t\thttp.Error(res, err.Error(), 400)\n\t\t\t}\n\t\t\tfmt.Fprintf(res, \"OK\")\n\t\t}\n\t\tif path.Base(req.URL.Path) == \"automigrate\" {\n\t\t\terr := db.AutoMigrate()\n\t\t\tif err != nil {\n\t\t\t\thttp.Error(res, err.Error(), 400)\n\t\t\t}\n\t\t\tfmt.Fprintf(res, \"OK\")\n\t\t}\n\t}\n\tgqlBasePath := os.Getenv(\"API_GRAPHQL_BASE_RESOURCE\")\n\tif gqlBasePath == \"\" {\n\t\tgqlBasePath = \"graphql\"\n\t}\n\tif path.Base(req.URL.Path) == gqlBasePath {\n\t\tctx := initContextWithJWTClaims(req)\n\t\tctx = context.WithValue(ctx, KeyLoaders, loaders)\n\t\tctx = context.WithValue(ctx, KeyExecutableSchema, executableSchema)\n\t\treq = req.WithContext(ctx)\n\t\tgqlHandler.ServeHTTP(res, req)\n\t}\n\n\tif os.Getenv(\"EXPOSE_PLAYGROUND_ENDPOINT\") == \"true\" && path.Base(req.URL.Path) == \"playground\" {\n\t\tplaygroundHandler := playground.Handler(\"GraphQL playground\", gqlBasePath)\n\t\tctx := initContextWithJWTClaims(req)\n\t\tctx = context.WithValue(ctx, KeyLoaders, loaders)\n\t\tctx = context.WithValue(ctx, KeyExecutableSchema, executableSchema)\n\t\treq = req.WithContext(ctx)\n\t\tif req.Method == \"GET\" {\n\t\t\tplaygroundHandler(res, req)\n\t\t}\n\t}\n}", "func NewResolver(serviceName string) *resolver {\n\treturn &resolver{serviceName: serviceName}\n}", "func NewResolver(serviceName string) *resolver {\n\treturn &resolver{serviceName: serviceName}\n}", "func NewResolver(baseConfig config.Config, client kubectl.Client, configOptions *loader.ConfigOptions, log log.Logger) ResolverInterface {\n\tvar id string\n\n\tvar kubeLoader kubeconfig.Loader\n\tif client == nil {\n\t\tkubeLoader = kubeconfig.NewLoader()\n\t} else {\n\t\tkubeLoader = client.KubeConfigLoader()\n\t}\n\n\tbasePath, err := filepath.Abs(\".\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tremote, err := git.GetRemote(basePath)\n\tif err == nil {\n\t\tid = remote\n\t} else {\n\t\tid = basePath\n\t}\n\n\treturn &resolver{\n\t\tRootID: id,\n\t\tDependencyGraph: newGraph(newNode(id, nil)),\n\n\t\tBaseConfig: baseConfig.Config(),\n\t\tBaseCache: baseConfig.Generated(),\n\t\tBaseVars: baseConfig.Variables(),\n\n\t\tConfigOptions: configOptions,\n\n\t\t// We only need that for saving\n\t\tkubeLoader: kubeLoader,\n\t\tclient: client,\n\t\tgeneratedSaver: generated.NewConfigLoaderFromDevSpacePath(\"\", baseConfig.Path()),\n\t\tlog: log,\n\t}\n}", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }", "func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }" ]
[ "0.5636411", "0.54876155", "0.5424582", "0.54115343", "0.53352714", "0.5161797", "0.50907403", "0.5038632", "0.5028125", "0.4968094", "0.495937", "0.49110553", "0.49010876", "0.48503396", "0.48065484", "0.47772992", "0.4776931", "0.4754101", "0.47482422", "0.47311452", "0.47260728", "0.46874908", "0.46640894", "0.46595854", "0.46556124", "0.46283042", "0.46276525", "0.46276036", "0.461642", "0.46155715", "0.46130666", "0.46130666", "0.46118996", "0.4604286", "0.46038586", "0.4596445", "0.4587791", "0.4587219", "0.4585922", "0.45823574", "0.45817858", "0.4566183", "0.4566183", "0.45483813", "0.45465106", "0.45459396", "0.45387372", "0.45351303", "0.45296377", "0.45253307", "0.45239228", "0.45239228", "0.45229533", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025", "0.45219025" ]
0.67912567
0
OnboardStart holds the business logic in a signature agnostic way, allowing for middlewares to be applied It returns a func, allowing for additional data to be passed via closures
func OnboardStart(userStore UserStore, accountStore AccountStore) handlers.Handler { fn := func(ctx context.Context, w handlers.Writer, r handlers.Reader) error { req := &OnboardStartRequest{} handlers.MustDecode(r, req) // Handle validations if true { return &handlers.UserError{"3c157e31-0a63-4f96-9c9c-19353024ce34", "wrong username", errors.New("example error")} } // Handle logic if true { return &handlers.SystemError{"8c24c633-1bba-4990-813c-b21d24d6e7f5", "database connection failure", errors.New("example error")} } // Handle response resp := &OnboardStartResponse{} handlers.MustEncode(w, resp) // Return user errors and system errors return nil } return fn }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (b *Bot) addStartFunc(fn server.Component) {\n\tb.server.RunComponent(fn)\n}", "func Start(handler fn) error {\n\tlog.Println(\"starting lambda handler...\")\n\n\tlambda.Start(handler)\n\treturn nil\n}", "func (*GenericFramework) Startup(ctx *NetworkContext) {}", "func (s *BasejossListener) EnterFunction_(ctx *Function_Context) {}", "func Start(h http.Handler) {\n\tlambda.Start(apiGatewayHandler(h))\n}", "func (_m *IProvider) Start(_a0 map[string]*model.WorkerConfig, _a1 []*message.Message) {\n\t_m.Called(_a0, _a1)\n}", "func Start(port int, funcs *formation.Functions) error {\n\tfunctions = funcs\n\n\tsrvr := http.NewServeMux()\n\tsrvr.Handle(\"/invoke\", jsonHandler(invokeHandler))\n\n\treturn http.ListenAndServe(fmt.Sprintf(\":%d\", port), srvr)\n}", "func (o *Onboarder) DoOnboard(ce cloudevents.Event, loggingDone chan bool) error {\n\n\tdefer func() { loggingDone <- true }()\n\n\tevent := &keptnevents.ServiceCreateEventData{}\n\tif err := ce.DataAs(event); err != nil {\n\t\to.logger.Error(fmt.Sprintf(\"Got Data Error: %s\", err.Error()))\n\t\treturn err\n\t}\n\n\tif _, ok := event.DeploymentStrategies[\"*\"]; ok {\n\t\tdeplStrategies, err := FixDeploymentStrategies(event.Project, event.DeploymentStrategies[\"*\"])\n\t\tif err != nil {\n\t\t\to.logger.Error(fmt.Sprintf(\"Error when getting deployment strategies: %s\" + err.Error()))\n\t\t\treturn err\n\t\t}\n\t\tevent.DeploymentStrategies = deplStrategies\n\t} else if os.Getenv(\"PRE_WORKFLOW_ENGINE\") == \"true\" && (event.DeploymentStrategies == nil || len(event.DeploymentStrategies) == 0) {\n\t\tdeplStrategies, err := GetDeploymentStrategies(event.Project)\n\t\tif err != nil {\n\t\t\to.logger.Error(fmt.Sprintf(\"Error when getting deployment strategies: %s\" + err.Error()))\n\t\t\treturn err\n\t\t}\n\t\tevent.DeploymentStrategies = deplStrategies\n\t}\n\n\to.logger.Info(fmt.Sprintf(\"Start creating service %s in project %s\", event.Service, event.Project))\n\n\turl, err := serviceutils.GetConfigServiceURL()\n\tif err != nil {\n\t\to.logger.Error(fmt.Sprintf(\"Error when getting config service url: %s\", err.Error()))\n\t\treturn err\n\t}\n\n\tstageHandler := keptnutils.NewStageHandler(url.String())\n\tstages, err := stageHandler.GetAllStages(event.Project)\n\tif err != nil {\n\t\to.logger.Error(\"Error when getting all stages: \" + err.Error())\n\t\treturn err\n\t}\n\n\tfirstService, err := o.isFirstServiceOfProject(event, stages)\n\tif err != nil {\n\t\to.logger.Error(\"Error when checking whether any service was created before: \" + err.Error())\n\t\treturn err\n\t}\n\tif firstService {\n\t\to.logger.Info(\"Create Helm umbrella charts\")\n\t\tumbrellaChartHandler := helm.NewUmbrellaChartHandler(o.mesh)\n\t\tif err := o.initAndApplyUmbrellaChart(event, umbrellaChartHandler, stages); err != nil {\n\t\t\to.logger.Error(fmt.Sprintf(\"Error when initalizing and applying umbrella charts for project %s: %s\", event.Project, err.Error()))\n\t\t\treturn err\n\t\t}\n\t}\n\n\tfor _, stage := range stages {\n\t\tif err := o.onboardService(stage.StageName, event, url.String()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\to.logger.Info(fmt.Sprintf(\"Finished creating service %s in project %s\", event.Service, event.Project))\n\treturn nil\n}", "func Start(handler Handler) {\n\th := GetLambdaHandler(handler)\n\tlambda.Start(h)\n}", "func OnStart() {\n}", "func main() {\n\tlambda.Start(handleRequest)\n}", "func (s *BaseConcertoListener) EnterFuncSpec(ctx *FuncSpecContext) {}", "func (s *BasejossListener) EnterFuncLog(ctx *FuncLogContext) {}", "func (s *BasejossListener) EnterFuncSin(ctx *FuncSinContext) {}", "func (s *BasemumpsListener) EnterFunction_(ctx *Function_Context) {}", "func OnStart(ecb EventCallbackFunc, priority ...int) {\n\tAppEventStore().Subscribe(EventOnStart, EventCallback{\n\t\tCallback: ecb,\n\t\tCallOnce: true,\n\t\tpriority: parsePriority(priority...),\n\t})\n}", "func (s *BaselimboListener) EnterFunction_name_part(ctx *Function_name_partContext) {}", "func chainStarted(service moleculer.Service, mixin *moleculer.Mixin) moleculer.Service {\n\tif mixin.Started != nil {\n\t\tsvcHook := service.Started\n\t\tservice.Started = func(ctx moleculer.BrokerContext, svc moleculer.Service) {\n\t\t\tif svcHook != nil {\n\t\t\t\tsvcHook(ctx, svc)\n\t\t\t}\n\t\t\tmixin.Started(ctx, svc)\n\t\t}\n\t}\n\treturn service\n}", "func main() {\n\tlambda.Start(handler)\n}", "func main() {\n\tlambda.Start(handler)\n}", "func MilestoneCaller(handler interface{}, params ...interface{}) {\n\thandler.(func(index milestone.Index, tailTxHash aingle.Hash))(params[0].(milestone.Index), params[1].(aingle.Hash))\n}", "func main() {\n\tlambda.Start(wflambda.Wrapper(handler))\n}", "func main() {\n\tlambda.Start(wflambda.Wrapper(handler))\n}", "func main() {\n\tlambda.Start(wflambda.Wrapper(handler))\n}", "func (s *BasejossListener) EnterFuncMin(ctx *FuncMinContext) {}", "func (c *MockController) Start() error {\n\tc.StartFuncCalled++\n\n\treturn c.StartFunc()\n}", "func (fn genericResourceInformerFunc) Start(stopCh <-chan struct{}) {}", "func HandleStart(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tname := p.ByName(\"name\")\n\n\t// Nothing to respond with here\n\tfmt.Println(\"START: \" + name)\n\n\treq := GameRequest{}\n\tb, _ := io.ReadAll(r.Body)\n\tdefer r.Body.Close()\n\n\terr := json.Unmarshal(b, &req)\n\tif err != nil {\n\t\tfmt.Println(\"ERROR: start parse: \" + err.Error() + \", \" + string(b))\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tfn := snakes[name].Start\n\tif fn == nil {\n\t\treturn\n\t}\n\n\terr = fn(r.Context(), req)\n\tif err != nil {\n\t\tfmt.Println(\"ERROR: start handle: \" + err.Error())\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func (s *BasejossListener) EnterFuncIp(ctx *FuncIpContext) {}", "func (lr *LogicRunner) Start(ctx context.Context) error {\n\tlr.ArtifactManager = lr.Ledger.GetArtifactManager()\n\n\tif lr.Cfg.BuiltIn != nil {\n\t\tbi := builtin.NewBuiltIn(lr.MessageBus, lr.ArtifactManager)\n\t\tif err := lr.RegisterExecutor(core.MachineTypeBuiltin, bi); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlr.machinePrefs = append(lr.machinePrefs, core.MachineTypeBuiltin)\n\t}\n\n\tif lr.Cfg.GoPlugin != nil {\n\t\tif lr.Cfg.RPCListen != \"\" {\n\t\t\tStartRPC(ctx, lr)\n\t\t}\n\n\t\tgp, err := goplugin.NewGoPlugin(lr.Cfg, lr.MessageBus, lr.ArtifactManager)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := lr.RegisterExecutor(core.MachineTypeGoPlugin, gp); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlr.machinePrefs = append(lr.machinePrefs, core.MachineTypeGoPlugin)\n\t}\n\n\t// TODO: use separate handlers\n\tif err := lr.MessageBus.Register(core.TypeCallMethod, lr.Execute); err != nil {\n\t\treturn err\n\t}\n\tif err := lr.MessageBus.Register(core.TypeCallConstructor, lr.Execute); err != nil {\n\t\treturn err\n\t}\n\n\tif err := lr.MessageBus.Register(core.TypeExecutorResults, lr.ExecutorResults); err != nil {\n\t\treturn err\n\t}\n\tif err := lr.MessageBus.Register(core.TypeValidateCaseBind, lr.ValidateCaseBind); err != nil {\n\t\treturn err\n\t}\n\tif err := lr.MessageBus.Register(core.TypeValidationResults, lr.ProcessValidationResults); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func MilestoneCaller(handler interface{}, params ...interface{}) {\n\thandler.(func(index milestone.Index, tailTxHash hornet.Hash))(params[0].(milestone.Index), params[1].(hornet.Hash))\n}", "func (s *BaseConcertoListener) EnterFuncCallSpec(ctx *FuncCallSpecContext) {}", "func (c *Board) OnStart() {\n\tengosdl.Logger.Trace().Str(\"component\", \"Board\").Str(\"Board\", c.GetName()).Msg(\"OnStart\")\n\tc.Component.OnStart()\n}", "func (m controller) OnStart(ctx cli.Flags, inj node.Injector) error {\n\tvar no mino.Mino\n\terr := inj.Resolve(&no)\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"failed to resolve mino: %v\", err)\n\t}\n\n\tdkg, pubkey := pedersen.NewPedersen(no, true)\n\n\tinj.Inject(dkg)\n\tinj.Inject(pubkey)\n\n\tpubkeyBuf, err := pubkey.MarshalBinary()\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"failed to encode pubkey: %v\", err)\n\t}\n\n\tdela.Logger.Info().\n\t\tHex(\"public key\", pubkeyBuf).\n\t\tMsg(\"perdersen public key\")\n\n\treturn nil\n}", "func (m *Meow) Start() {}", "func OnAppStart(f func()) {\n\tstartupHooks = append(startupHooks, f)\n}", "func main() {\n\t/* Run shellscript: `$ sh create-lambda.sh` for docker deploy */\n\tlambda.Start(HandleRequest)\n\t// HandleRequest() // \ttesting:\n}", "func (s *BaseConcertoListener) EnterFuncArg(ctx *FuncArgContext) {}", "func middleware(ctx iris.Context) {\n\tctx.SetFunc(\"greet\", hello)\n\tctx.Next()\n}", "func (s *BaseDiceListener) EnterStart(ctx *StartContext) {}", "func (c MockDockerClient) ContainerStart(ctx context.Context, containerID string) error {\n\tif c.ContainerStartFn != nil {\n\t\tfmt.Println(\"[MockDockerClient] In \", utils.CurrentFunctionName())\n\t\tfmt.Println(\"[MockDockerClient] - ctx: \", ctx)\n\t\tfmt.Println(\"[MockDockerClient] - containerID: \", containerID)\n\t\treturn c.ContainerStartFn(ctx, containerID)\n\t}\n\tpanic(fmt.Sprintf(\"No function defined for: %s\", utils.CurrentFunctionName()))\n}", "func (t *SimpleChaincode) Init(stub shim.ChaincodeStubInterface) pb.Response {\n\tfmt.Println(\"Marbles Is Starting Up\")\n\tfuncName, args := stub.GetFunctionAndParameters()\n\ttxId := stub.GetTxID()\n\n\tfmt.Println(\"Init() is running\")\n\tfmt.Println(\"Transaction ID:\", txId)\n\tfmt.Println(\" GetFunctionAndParameters() function:\", funcName)\n\tfmt.Println(\" GetFunctionAndParameters() args count:\", len(args))\n\tfmt.Println(\" GetFunctionAndParameters() args found:\", args)\n\n\tt.enroll_donor(stub, []string{\"d1\", \"김현욱\", \"010-1234-5678\"})\n\tt.enroll_npo(stub, []string{\"n1\",\"프리즈밍\"})\n\tt.enroll_npo(stub, []string{\"n2\",\"비영리스타트업\"})\n\tt.enroll_npo(stub, []string{\"n3\",\"서울시NPO지원센터\"})\n\tt.enroll_npo(stub, []string{\"n4\",\"아름다운가게\"})\n\tt.enroll_recipient(stub, []string{\"r1\",\"윤지성\",\"Permanent\"})\n\n\n\n\tfmt.Println(\"Ready for action\") //self-test pass\n\treturn shim.Success(nil)\n}", "func (client *Client) Start() {\n\n}", "func (h *Handler) OnLaunch(ctx context.Context, request *alexa.Request, session *alexa.Session, ctxPtr *alexa.Context, response *alexa.Response) error {\n\tlog.Printf(\"OnLaunch requestId=%s, sessionId=%s\", request.RequestID, session.SessionID)\n\treturn nil\n}", "func startHandler(r *http.Request) (interface{}, HTTPError) {\n\t// Spin up a container\n\tinfo, err := startContainer(image)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn StartResponse{\n\t\tEndpoint: info.IP + \":\" + servicePort,\n\t\tContainerID: info.ID,\n\t}, nil\n}", "func (s *BasejossListener) EnterFuncFp(ctx *FuncFpContext) {}", "func (a *appsec) start() error {\n\t// Register the WAF operation event listener\n\ta.limiter = NewTokenTicker(int64(a.cfg.traceRateLimit), int64(a.cfg.traceRateLimit))\n\ta.limiter.Start()\n\tunregisterWAF, err := registerWAF(a.cfg.rules, a.cfg.wafTimeout, a.limiter, &a.cfg.obfuscator)\n\tif err != nil {\n\t\treturn err\n\t}\n\ta.unregisterWAF = unregisterWAF\n\treturn nil\n}", "func startTimer(name string) func() {\n\tt := time.Now()\n\tlog.Println(name, \"started\")\n\treturn func() {\n\t\td := time.Now().Sub(t)\n\t\tlog.Println(name, \"took\", d)\n\t}\n}", "func (s *BasejossListener) EnterFuncCos(ctx *FuncCosContext) {}", "func (s *BaselimboListener) EnterFunction_type(ctx *Function_typeContext) {}", "func (u *Umbrella) OnStart() error {\n\tu.BaseService.OnStart()\n\n\tu.API = u.System().Config().GetAPIKey(u.String())\n\tif u.API == nil || u.API.Key == \"\" {\n\t\tu.System().Config().Log.Printf(\"%s: API key data was not provided\", u.String())\n\t}\n\n\tu.SetRateLimit(500 * time.Millisecond)\n\treturn nil\n}", "func startupRoutine(ctx context.Context) *state.State {\n\tappState := &state.State{}\n\n\tlogger := logger()\n\tappState.Logger = logger\n\n\tlogger.WithField(\"action\", \"startup\").WithField(\"startup_time_left\", timeTillDeadline(ctx)).\n\t\tDebug(\"created startup context, nothing done so far\")\n\n\t// Load the config using the flags\n\tserverConfig := &config.WeaviateConfig{}\n\tappState.ServerConfig = serverConfig\n\terr := serverConfig.LoadConfig(connectorOptionGroup, logger)\n\tif err != nil {\n\t\tlogger.WithField(\"action\", \"startup\").WithError(err).Error(\"could not load config\")\n\t\tlogger.Exit(1)\n\t}\n\n\tmonitoring.InitConfig(serverConfig.Config.Monitoring)\n\n\tif serverConfig.Config.DisableGraphQL {\n\t\tlogger.WithFields(logrus.Fields{\n\t\t\t\"action\": \"startup\",\n\t\t\t\"disable_graphql\": true,\n\t\t}).Warnf(\"GraphQL API disabled, relying only on gRPC API for querying. \" +\n\t\t\t\"This is considered experimental and will likely experience breaking changes \" +\n\t\t\t\"before reaching general availability\")\n\t}\n\n\tlogger.WithFields(logrus.Fields{\n\t\t\"action\": \"startup\",\n\t\t\"default_vectorizer_module\": serverConfig.Config.DefaultVectorizerModule,\n\t}).Infof(\"the default vectorizer modules is set to %q, as a result all new \"+\n\t\t\"schema classes without an explicit vectorizer setting, will use this \"+\n\t\t\"vectorizer\", serverConfig.Config.DefaultVectorizerModule)\n\n\tlogger.WithFields(logrus.Fields{\n\t\t\"action\": \"startup\",\n\t\t\"auto_schema_enabled\": serverConfig.Config.AutoSchema.Enabled,\n\t}).Infof(\"auto schema enabled setting is set to \\\"%v\\\"\", serverConfig.Config.AutoSchema.Enabled)\n\n\tlogger.WithField(\"action\", \"startup\").WithField(\"startup_time_left\", timeTillDeadline(ctx)).\n\t\tDebug(\"config loaded\")\n\n\tappState.OIDC = configureOIDC(appState)\n\tappState.APIKey = configureAPIKey(appState)\n\tappState.AnonymousAccess = configureAnonymousAccess(appState)\n\tappState.Authorizer = configureAuthorizer(appState)\n\n\tlogger.WithField(\"action\", \"startup\").WithField(\"startup_time_left\", timeTillDeadline(ctx)).\n\t\tDebug(\"configured OIDC and anonymous access client\")\n\n\tappState.Locks = &dummyLock{}\n\n\tlogger.WithField(\"action\", \"startup\").WithField(\"startup_time_left\", timeTillDeadline(ctx)).\n\t\tDebug(\"initialized schema\")\n\n\tclusterState, err := cluster.Init(serverConfig.Config.Cluster, serverConfig.Config.Persistence.DataPath, logger)\n\tif err != nil {\n\t\tlogger.WithField(\"action\", \"startup\").WithError(err).\n\t\t\tError(\"could not init cluster state\")\n\t\tlogger.Exit(1)\n\t}\n\n\tappState.Cluster = clusterState\n\n\tappState.Logger.\n\t\tWithField(\"action\", \"startup\").\n\t\tDebug(\"startup routine complete\")\n\n\treturn appState\n}", "func OnOperationStart(handler startHandler) {\n\tregisterdStartHandler = handler\n}", "func (t *SelfTester) Start() {}", "func callMeOnStart(routine int, task *pooler.Task) {\n\t// Get pointer to custom data, then change some value in it\n\tcd := task.CustomData().(*myCustomData)\n\tfmt.Printf(\">> Goroutine %d is starting task %s with CustomData %d\\n\", routine, task.ID(), cd.Amount)\n\t// After displaying amount, change it!\n\tcd.Amount = 128\n}", "func startDashboardController(ns string, cfg *rest.Config, signalHandler <-chan struct{}, autodetectChannel chan schema.GroupVersionKind) {\n\t// Create a new Cmd to provide shared dependencies and start components\n\tdashboardMgr, err := manager.New(cfg, manager.Options{\n\t\tMetricsBindAddress: \"0\",\n\t\tNamespace: ns,\n\t})\n\tif err != nil {\n\t\tlog.Error(err, \"\")\n\t\tos.Exit(1)\n\t}\n\n\t// Setup Scheme for the dashboard resource\n\tif err := apis.AddToScheme(dashboardMgr.GetScheme()); err != nil {\n\t\tlog.Error(err, \"\")\n\t\tos.Exit(1)\n\t}\n\n\t// Use a separate manager for the dashboard controller\n\tgrafanadashboard.Add(dashboardMgr, ns)\n\n\tgo func() {\n\t\tif err := dashboardMgr.Start(signalHandler); err != nil {\n\t\t\tlog.Error(err, \"dashboard manager exited non-zero\")\n\t\t\tos.Exit(1)\n\t\t}\n\t}()\n}", "func MilestoneCaller(handler interface{}, params ...interface{}) {\n\thandler.(func(index milestone.Index, messageID hornet.MessageID))(params[0].(milestone.Index), params[1].(hornet.MessageID))\n}", "func (s *BasejossListener) EnterFuncSgn(ctx *FuncSgnContext) {}", "func main() {\n\n\tlambda.Start(LambdaHandler)\n}", "func MakePowerOnEndpoint(sess *session.Session, svc ec2stateservice.Ec2StateSvc) endpoint.Endpoint {\n return func(ctx context.Context, request interface{}) (response interface{}, err error) {\n req := request.(PowerOnRequest)\n res, err := svc.PowerOn(ctx, sess, req.InstanceId)\n return PowerOnResponse{Status: res, Err: err}, nil\n }\n}", "func Auto(c *rux.Context, i interface{}) {\n\n}", "func (is *Service) OnStart(ctx context.Context) error {\n\t// If the event sinks support indexing, register an observer to capture\n\t// block header data for the indexer.\n\tif IndexingEnabled(is.eventSinks) {\n\t\terr := is.eventBus.Observe(ctx, is.publish,\n\t\t\ttypes.EventQueryNewBlockHeader, types.EventQueryTx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (runner *MockRunner) Start(runnable runner.Runnable) {\n\trunner.Called(runnable)\n}", "func (h *rawContainerHandler) Start() {}", "func (s *kataBuiltInShim) start(sandbox *Sandbox, params ShimParams) (int, error) {\n\treturn -1, nil\n}", "func (f *FakeInstance) Start(_ context.Context, _ string) error {\n\tpanic(\"implement me\")\n}", "func main() {\n\tcfg, err := config.Load()\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to load config: %v\\n\", err)\n\t}\n\n\tdb, err := database.SetUp(cfg)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to connect to database: %v\\n\", err)\n\t}\n\n\tjwtManager, err := auth.NewJWTManager(cfg.SecretKey, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create JWT manager: %v\\n\", err)\n\t}\n\n\ts := services.SetUp(db, jwtManager)\n\tr := router.SetUp(s, cfg)\n\tl = chiadapter.New(r)\n\n\tlambda.Start(lambdaHandler)\n}", "func StartHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"startHandler, jobid = %d\", services.JobId)\n\tservices.ChannelMap[services.JobId] = make(chan struct{})\n\tgo services.TaskMock(services.JobId, 0)\n\tservices.JobId++\n}", "func BeforeMiddlewareZap() func(ctx *context.Context) {\n\treturn func(ctx *context.Context) {\n\t\tctx.Request().SetFlash(\"start_timer\", time.Now())\n\t}\n}", "func Start(host string, username string, password string, activeSeconds int, inactiveSeconds int, actionLevel string) {\n\tif !communication.TestConnectivity(host) {\n\t\tlog.Panic(\"The URL \" + host + \" is not the API Endpoint\")\n\t}\n\tvar login = authenticate.HandleLogin(username, password, host)\n\ttrigger.Run(login.Value, host, activeSeconds, inactiveSeconds, actionLevel)\n}", "func StartServer(servers []*labrpc.ClientEnd, me int, persister *raft.Persister, maxraftstate int, gid int, masters []*labrpc.ClientEnd, make_end func(string) *labrpc.ClientEnd) *ShardKV {\n // call labgob.Register on structures you want\n // Go's RPC library to marshall/unmarshall.\n labgob.Register(Op{})\n\n kv := new(ShardKV)\n kv.me = me\n kv.maxraftstate = maxraftstate\n kv.make_end = make_end\n kv.gid = gid\n kv.masters = masters\n\n // Your initialization code here.\n kv.db = make(map[string]string)\n kv.session = Session{LastApplied: make(map[int64]int64)}\n kv.replyMap = make(map[Info]chan chan OpReply)\n kv.shardToRecv = ShardToRecv{Gid: kv.gid, ConfigNum:-1, Unfinished:make(map[int]int)}\n kv.opCh = make(chan Op)\n\n // Use something like this to talk to the shardmaster:\n kv.config = shardmaster.Config{Num:-1}\n kv.mck = shardmaster.MakeClerk(kv.masters)\n\n kv.applyCh = make(chan raft.ApplyMsg)\n kv.rf = raft.Make(servers, me, persister, kv.applyCh)\n\n go kv.PollingApplyCh()\n go kv.PollingShardConfig()\n\n return kv\n}", "func (w *Webman) StartWebhook(endpoint, listenAddr string, fn func(*http.Request) error) error {\n\tw.webhook = &Webhook{\n\t\twebman: w,\n\t\tfn: fn,\n\t}\n\n\tr := mux.NewRouter()\n\tr.HandleFunc(endpoint, w.webhook.handler).Methods(\"POST\")\n\n\tserver := &graceful.Server{\n\t\tTimeout: w.timeout,\n\t\tServer: &http.Server{\n\t\t\tAddr: listenAddr,\n\t\t\tHandler: r,\n\t\t},\n\t}\n\tw.mw.Lock()\n\tw.webhook.server = server\n\tw.mw.Unlock()\n\n\tw.log.Printf(\"webhook server started at: %s:\", listenAddr)\n\treturn w.webhook.server.ListenAndServe()\n}", "func main() {\n\tlambda.Start(Scraper)\n}", "func (locator *ServiceLocatorImpl) InstallBeginCallBack(f func(Worker)) {\n\tlocator.beginCallBack = append(locator.beginCallBack, f)\n}", "func Init(logger *logrus.Logger) echo.MiddlewareFunc {\n\treturn func(next echo.HandlerFunc) echo.HandlerFunc {\n\t\treturn func(rc echo.Context) error {\n\t\t\t// now := time.Now()\n\n\t\t\t// TODO: I think it's better to change the name of this function, it's no clear.\n\n\t\t\t// TODO: I have no idea for what reason we need this...\n\t\t\t// rc.Response = &access.LogResponseWriter{\n\t\t\t// \tResponseWriter: rc.Response(),\n\t\t\t// \tStatus: http.StatusOK,\n\t\t\t// \tBytesWritten: 0,\n\t\t\t// }\n\n\t\t\t// ac := newRequestScope(now, logger, rc.Request())\n\n\t\t\t// TODO: we dont need this... we should use the context scope way of the echo lib...\n\t\t\t// https://echo.labstack.com/guide/context\n\t\t\t// rc.Set(\"Context\", ac)\n\n\t\t\t// TODO: improve this error handler\n\t\t\tif err := next(rc); err != nil {\n\t\t\t\terr = convertError(rc, err)\n\t\t\t\t// TODO: validate if is this an json, text, xml, etc... probably there is something already made\n\t\t\t\tif httpErr, ok := err.(*errors.APIError); ok {\n\t\t\t\t\treturn rc.JSON(httpErr.StatusCode(), httpErr)\n\t\t\t\t}\n\t\t\t\t// return rc.JSON(http.StatusInternalServerError, errors.New(\"text\"))\n\t\t\t\treturn rc.HTML(http.StatusInternalServerError, \"Internal Server Error...\")\n\t\t\t}\n\t\t\treturn nil\n\n\t\t\t// // TODO: handling handler panic here... checl where is the best place to put this\n\t\t\t// // fault.Recovery(ac.Errorf, convertError)(rc)\n\t\t\t// // logAccess(rc, ac.Infof, ac.Now())\n\t\t\t//\n\t\t\t// return next(rc)\n\t\t}\n\t}\n}", "func (s *BaseConcertoListener) EnterFuncCallArg(ctx *FuncCallArgContext) {}", "func (a *RedisAction) On() func(event interface{}) {\n\n\tf := func(e interface{}) {\n\t\ta.out <- e.(*docker.APIEvents)\n\t}\n\n\treturn f\n}", "func (p *Platform) startMiddleware() {\n\tif p.LogMiddleware == nil {\n\t\treturn\n\t}\n\tif !p.LogMiddleware.IsEnabled() {\n\t\tp.LogMiddleware.Start()\n\t}\n}", "func (cc *Coordinator) Start() error {\n\tcc.Log.Info(\"starting\")\n\n\t// Start Consumer modules\n\terr := helpers.StartCoordinatorModules(cc.modules)\n\tif err != nil {\n\t\treturn errors.New(\"Error starting consumer module: \" + err.Error())\n\t}\n\t// All consumers started, Burrow is ready to serve requests\n\t// set the readiness probe\n\tcc.App.AppReady = true\n\treturn nil\n}", "func Start(entryPoint interface{}) {\n\tapp := &App{\n\t\tEntryPoint: entryPoint,\n\t\tCtors: GetCtors(),\n\t\tDtors: GetDtors(),\n\t}\n\tif err := app.Run(); err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n}", "func (fc *appendFlowControl) start(res *resolution, recv func() (*pb.AppendRequest, error)) func() (*pb.AppendRequest, error) {\n\tfc.reset(res, timeNow().UnixNano()/1e6)\n\tfc.ticker = time.NewTicker(flowControlQuantum)\n\n\t// Pump calls to |recv| in a goroutine, as they may block indefinitely.\n\t// We expect that |recv| is tied to a Context which will be cancelled\n\t// upon the returned closure returning an error, so these don't actually\n\t// hang around indefinitely.\n\tgo func(ch chan<- appendChunk) {\n\t\tfor {\n\t\t\tvar req, err = recv()\n\t\t\tch <- appendChunk{req: req, err: err}\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}(fc.chunkCh)\n\n\treturn fc.recv\n}", "func legacyLeaderElectionStart(id, name string, leased *plug.Leased, lock rl.Interface, ttl time.Duration) func() {\n\treturn func() {\n\t\tglog.V(2).Infof(\"Verifying no controller manager is running for %s\", id)\n\t\twait.PollInfinite(ttl/2, func() (bool, error) {\n\t\t\t_, err := lock.Get()\n\t\t\tif err == nil {\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\tif kapierrors.IsNotFound(err) {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"unable to confirm %s lease exists: %v\", name, err))\n\t\t\treturn false, nil\n\t\t})\n\t\tglog.V(2).Infof(\"Attempting to acquire controller lease as %s, renewing every %s\", id, ttl)\n\t\tgo leased.Run()\n\t\tgo wait.PollInfinite(ttl/2, func() (bool, error) {\n\t\t\t_, err := lock.Get()\n\t\t\tif err == nil {\n\t\t\t\tglog.V(2).Infof(\"%s lease has been taken, %s is exiting\", name, id)\n\t\t\t\tleased.Stop(nil)\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\t// NotFound indicates the endpoint is missing and the etcd lease should continue to be held\n\t\t\tif !kapierrors.IsNotFound(err) {\n\t\t\t\tutilruntime.HandleError(fmt.Errorf(\"unable to confirm %s lease exists: %v\", name, err))\n\t\t\t}\n\t\t\treturn false, nil\n\t\t})\n\t}\n}", "func (s *BaselimboListener) EnterFunction_definition(ctx *Function_definitionContext) {}", "func (t *Transporter) startHandler(server *Server) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\terr := server.Start()\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(w, \"error to start server %s\", server.config.Host)\n\t\t} else {\n\t\t\tfmt.Fprintf(w, \"success to start server %s\", server.config.Host)\n\t\t}\n\t}\n}", "func (h *HookbotTrigger) Start() error {\n\tfinishCh := make(chan struct{})\n\tmsgCh, errCh := listen.RetryingWatch(h.Endpoint, http.Header{}, finishCh)\n\tgo h.errorHandler(errCh)\n\tgo h.msgHandler(msgCh)\n\treturn nil\n}", "func (p *Provider) Start(ctx context.Context) error {\n\tgo func() {\n\t\terr := p.migrateStateMachines(ctx)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Migrating retrieval provider state machines: %s\", err.Error())\n\t\t}\n\t\terr = p.readyMgr.FireReady(err)\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"Publish retrieval provider ready event: %s\", err.Error())\n\t\t}\n\t}()\n\treturn p.network.SetDelegate(p)\n}", "func (c ContainerLifecycleHooks) Started(ctx context.Context) func(container Container) error {\n\treturn containerHookFn(ctx, c.PostStarts)\n}", "func Start(f CloseFunc, data ...*core.ModuleParam) {\n\tStartWithName(\"\", f, nil, data...)\n}", "func (s *Basegff3Listener) EnterStart(ctx *StartContext) {}", "func (a adapter) Init(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\n\tlogger.Infof(\"A chaincode [%v] is deployed\", a.Chaincode)\n\treturn []byte(\"ok\"), nil\n}", "func (c ContainerLifecycleHooks) Starting(ctx context.Context) func(container Container) error {\n\treturn containerHookFn(ctx, c.PreStarts)\n}", "func (rs *ReactorShim) OnStart() error {\n\tif rs.Switch == nil {\n\t\treturn errors.New(\"proxyPeerEnvelopes: reactor shim switch is nil\")\n\t}\n\n\t// start envelope proxying and peer error handling in separate go routines\n\trs.proxyPeerEnvelopes()\n\trs.handlePeerErrors()\n\n\treturn nil\n}", "func Create(middleware interface{}) func(handler interface{}) HandlerT {\n\tmw := reflect.ValueOf(middleware)\n\tmwT := mw.Type()\n\tmwNumIn := mwT.NumIn()\n\tnextT := mwT.In(mwNumIn - 1) // next is always the last argument\n\n\treturn func(handler interface{}) HandlerT {\n\t\th := reflect.ValueOf(handler)\n\t\thT := h.Type()\n\n\t\twrapper := reflect.MakeFunc(hT, func(in []reflect.Value) []reflect.Value {\n\t\t\tnext := reflect.MakeFunc(nextT, func([]reflect.Value) []reflect.Value {\n\t\t\t\tres := reflect.ValueOf(handler).Call(in)\n\t\t\t\treturn res[:nextT.NumOut()]\n\t\t\t})\n\n\t\t\tmwParams := make([]reflect.Value, mwNumIn-1)\n\t\t\tfor i := range mwParams {\n\t\t\t\tif i < len(in) {\n\t\t\t\t\tmwParams[i] = in[i]\n\t\t\t\t}\n\t\t\t}\n\t\t\tmwParams = append(mwParams, next)\n\n\t\t\treturn mw.Call(mwParams)\n\t\t})\n\n\t\treturn wrapper.Interface().(HandlerT)\n\t}\n}", "func (cracker *Firecracker) Start() error {\n\treturn cracker.action(\"InstanceStart\", \"\")\n}", "func (m *MockCgroupNotifier) Start(a0 chan<- struct{}) {\n\tm.Called(a0)\n}", "func BeforeStart(fn func(context.Context) error) Option {\n\treturn func(o *options) {\n\t\to.beforeStart = append(o.beforeStart, fn)\n\t}\n}", "func (middleware *Middleware) Build() controller.HandlerFunc {\n\treturn func(c controller.MContext) {\n\n\t\tclaims, err := middleware.CheckIfTokenExpire(c)\n\t\tif err != nil {\n\t\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, UnauthorizedMessage{\n\t\t\t\tCode: -1,\n\t\t\t\tMsg: err.Error(),\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\t// then make yourself the custom validation\n\t\t// e.g. claims.CustomField.IP == req.IP\n\t\tif err = middleware.validFunction(c, claims); err != nil {\n\t\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, UnauthorizedMessage{\n\t\t\t\tCode: -1,\n\t\t\t\tMsg: err.Error(),\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\t// store the context for stateful session\n\t\tc.Set(\"claims\", claims)\n\t}\n}", "func (c App) Smth() {\n}", "func (s *BaseAspidaListener) EnterMain(ctx *MainContext) {}", "func Start(port string) error {\n\t// If FUNCTION_TARGET, try to start with that registered function\n\t// If not set, assume non-declarative functions.\n\ttarget := os.Getenv(\"FUNCTION_TARGET\")\n\n\t// Check if we have a function resource set, and if so, log progress.\n\tif os.Getenv(\"K_SERVICE\") == \"\" {\n\t\tfmt.Printf(\"Serving function: %s\\n\", target)\n\t}\n\n\t// Check if there's a registered function, and use if possible\n\tif fn, ok := registry.Default().GetRegisteredFunction(target); ok {\n\t\tctx := context.Background()\n\t\tif fn.HTTPFn != nil {\n\t\t\tserver, err := wrapHTTPFunction(\"/\", fn.HTTPFn)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unexpected error in registerHTTPFunction: %v\", err)\n\t\t\t}\n\t\t\thandler = server\n\t\t} else if fn.CloudEventFn != nil {\n\t\t\tserver, err := wrapCloudEventFunction(ctx, \"/\", fn.CloudEventFn)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unexpected error in registerCloudEventFunction: %v\", err)\n\t\t\t}\n\t\t\thandler = server\n\t\t}\n\t}\n\n\treturn http.ListenAndServe(\":\"+port, handler)\n}" ]
[ "0.5348516", "0.5344849", "0.5320611", "0.5279906", "0.5275717", "0.52645797", "0.5166758", "0.5149979", "0.51414245", "0.50449175", "0.4997565", "0.49922016", "0.49668092", "0.49571022", "0.49519426", "0.49445203", "0.4919629", "0.4913685", "0.48777905", "0.48777905", "0.48675275", "0.48580247", "0.48580247", "0.48580247", "0.48298496", "0.48266807", "0.48186213", "0.48085782", "0.48009527", "0.47924763", "0.47820562", "0.47780842", "0.477012", "0.47532904", "0.47487393", "0.47406906", "0.47377104", "0.47245553", "0.4719821", "0.4719515", "0.47109082", "0.46936646", "0.46903655", "0.46881002", "0.4671841", "0.46636626", "0.46618703", "0.46538818", "0.46524984", "0.465003", "0.4647625", "0.4647033", "0.46433267", "0.46353537", "0.46242213", "0.46158746", "0.46143302", "0.46101725", "0.4599768", "0.4596751", "0.4591588", "0.458772", "0.45814574", "0.45803666", "0.4573662", "0.4567237", "0.45668066", "0.4542725", "0.45385867", "0.45359588", "0.45311937", "0.45180526", "0.45174834", "0.45136592", "0.4509955", "0.45038435", "0.44941542", "0.44910467", "0.44906613", "0.4490094", "0.44878277", "0.44822708", "0.44791543", "0.44789368", "0.44744557", "0.4458584", "0.44523147", "0.44441286", "0.44434634", "0.4436813", "0.44352457", "0.44342214", "0.4432994", "0.44297028", "0.44280955", "0.44256192", "0.4423609", "0.44201916", "0.44156176", "0.4415097" ]
0.69999826
0
Log ... Log message to Console
func Log(format string, a ...interface{}) { s := fmt.Sprintf(format, a...) s = fmt.Sprintf("%v: %s", time.Now().Format("2006-01-02T15:04:05.000"), s) fmt.Println(s) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ConsoleLog(msg string) {\n\tconsoleLog(stringToPointer(msg), uint32(len(msg)))\n}", "func (c *Canvas) Log(args ...interface{}) {\n\tc.window.Get(\"console\").Call(\"log\", args...)\n}", "func (c *Canvas) Log(args ...interface{}) {\n\tc.window.Get(\"console\").Call(\"log\", args...)\n}", "func Log(message string) {\n\tlog.Println(message)\n}", "func Log(msg string) {\n\tdebug(msg)\n}", "func (lc StdoutLogger) Log(text string) {\n\tlc(text)\n}", "func Log(fmt string, args ...interface{}) {}", "func (s *Service) log(msg string) {\n\ts.lastLog = msg\n\ts.logwin.Clear()\n\ts.logwin.ColorOn(2)\n\ts.logwin.Box(0, 0)\n\ts.logwin.ColorOff(2)\n\ts.logwin.ColorOn(1)\n\ts.logwin.MovePrint(0, 0, msg)\n\ts.logwin.ColorOff(1)\n\ts.logwin.Refresh()\n}", "func (c *Console) Log(str String) *Console {\n\tPrint(str)\n\tPrint(\"\\n\")\n\treturn c\n}", "func ConsoleLog(txn *cheshire.Txn) {\n\tmsgChan := make(chan clog.LoggerEvent, 10)\n\tServs.Logger.Listen(msgChan)\n\tdefer Servs.Logger.Unlisten(msgChan)\n\tlog.Println(\"Log Listener Registered\")\n\tfor {\n\t\tmsg := <-msgChan\n\t\tres := cheshire.NewResponse(txn)\n\t\tres.SetTxnStatus(\"continue\")\n\t\tres.PutWithDot(\"event.type\", msg.Type)\n\t\tres.PutWithDot(\"event.message\", msg.Message)\n\t\t_, err := txn.Write(res)\n\t\tif err != nil {\n\t\t\t//try and write an error response\n\t\t\tcheshire.SendError(txn, 510, fmt.Sprintf(\"%s\", err))\n\t\t\tbreak\n\t\t}\n\t}\n\tlog.Println(\"Log Listener unregistered\")\n}", "func (s *kabuta) log(str string, args ...interface{}) {\n\tmsg := f(str+\"\\n\", args...)\n\t_, err = s.logFile.WriteString(msg)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// Send info to debug stream too:\n\t// https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Stream-Records.html#GDB_002fMI-Stream-Records\n\ts.writeToFrontend(\"&\" + msg)\n}", "func Log(t *testing.T, args ...interface{}) {\n\tDoLog(t, 2, os.Stdout, args...)\n}", "func (p StdPrinter) Log(s string) {\n\tp.StdoutPrint(s)\n}", "func Debug(msg string) {\n log.Debug(msg)\n}", "func (f Freckle) log(msg string, data ...interface{}) {\n\tif f.debug {\n\t\tlog.Printf(\"DEBUG: %s\", fmt.Sprintf(msg, data...))\n\t}\n}", "func Log(msg string, err error) {\n\n}", "func Log(s string) {\n\tL.Println(s)\n}", "func (bl BoringLogger) Log(msg string) {\n\tbl.logger.Println(msg)\n}", "func Log(message string) {\n\tlogLock.RLock()\n\tdefer logLock.RUnlock()\n\tok := logLevel <= 1\n\n\tif ok {\n\t\tprint(message)\n\t}\n}", "func Log(title interface{}, content interface{}) {\n\tlogger.Printf(\"%s: %s\", title, content)\n}", "func (c *Channel) Log(l string) {\n\tlog.Printf(\"Channel <%s>: %s\", c.GetName(), l)\n}", "func (t t) Log(args ...interface{}) {\n\tfmt.Println(args...)\n}", "func Log(msg string, a ...interface{}) {\n formatted := fmt.Sprintf(msg, a...)\n logger.Println(fmt.Sprintf(\"\\033[34;1mINFO:\\033[0m %s\", formatted))\n}", "func debugLog(msg interface{}) {\n fmt.Fprintln(os.Stderr, msg)\n}", "func (i *Interactor) Log(msg string, args ...interface{}) {\n\ti.Logger.Log(msg, args...)\n}", "func Log(msg string) {\n\tfmt.Println(color.BlueString(\"Builder:\") + \" \" + msg)\n}", "func (l *Logger) Log(message string) {\n\tt := time.Now()\n\tl.LogChannel <- fmt.Sprintf(\"[%s]\\t%s\", t.Format(\"2006-01-02 15:04:05\"), message)\n}", "func (w *Window) Log(str string) {\n\tstr = time.Now().Format(\"[15:04:05.000] \") + str\n\tw.logField.Append(str)\n\tw.logField.EnsureCursorVisible()\n}", "func Log(v ...interface{}) {\n\tlogger.Print(v...)\n}", "func ExampleLog() {\n\tsetup()\n\tlog.Log().Msg(\"hello world\")\n\n\t// Output: {\"time\":1199811905,\"message\":\"hello world\"}\n}", "func Info(msg string) {\n log.Info(msg)\n}", "func ConsoleLog(ctx *quickjs.Context, value []quickjs.Value) quickjs.Value {\n\tdata := value[2]\n\t// dataType is the JavaScript type of the data => `typeof arg`\n\tdataType := value[1].String()\n\tvar result interface{}\n\tswitch dataType {\n\tcase \"string\":\n\t\t// Prints a string (without color)\n\t\tfmt.Println(data.String())\n\tcase \"function\":\n\t\t// Prints String(myFunction)\n\t\tfmt.Fprintln(color.Output, color.New(color.FgCyan).SprintFunc()(data.String()))\n\tcase \"bigint\":\n\t\t// Prints bigint corresponding to number\n\t\tfmt.Fprintln(color.Output, color.New(color.FgYellow).SprintFunc()(data.BigInt()))\n\tcase \"number\":\n\t\t// Prints a number\n\t\tfmt.Fprintln(color.Output, color.New(color.FgYellow).SprintFunc()(data.Int32()))\n\tdefault:\n\t\t// Hands over the data as string to console util for parsing arrays and objects\n\t\tjson.Unmarshal([]byte(data.String()), &result)\n\t\tprty, _ := f.Marshal(result)\n\t\t// Prints the formatted result\n\t\tfmt.Fprintln(color.Output, string(prty))\n\t}\n\n\treturn ctx.Null()\n}", "func (b *Board) Log(content string) {\n\tif b.LogFunc != nil {\n\t\tb.LogFunc(content)\n\t} else {\n\t\tfmt.Println(content)\n\t}\n}", "func (s *session) log(info ...interface{}) {\n\tpreamble := fmt.Sprintf(\"IMAP (%s) \", s.id)\n\tmessage := []interface{}{preamble}\n\tmessage = append(message, info...)\n\tlog.Print(message...)\n}", "func Log(params ...string) {\n\tif len(params) == 1 {\n\t\tfmt.Printf(\"[%s]\\t%s\\n\", \"SoulWorker\", params[0])\n\t} else {\n\t\tfmt.Printf(\"[%s]\\t%s\\n\", params[0], params[1])\n\t}\n}", "func Log(s string, v ...interface{}) {\n\tif debug {\n\t\tlog.Debug().Msgf(s, v...)\n\t}\n}", "func (s *SimpleTask) Log(str string) {\n\ts.Logf(str)\n}", "func (s *Step) Log(message string) {\n\tif s.verbose {\n\t\tfmt.Fprintf(writer, \" %s %s %s\\n\", time.Now().Format(time.RFC3339), s.test, message)\n\t}\n}", "func logging() {\n\tfmt.Println(\"Selesai memanggil function\")\n\tfmt.Println(\"\")\n}", "func (logger *Logger) Println(args ...interface{}) {\n\tlogger.std.Log(args...)\n}", "func (a *Adapter) log(ctx context.Context, logLevel string, message string, options ...interface{}) {\n\n\t// check whether the message should be logged\n\tif !a.isLoggable(logLevel) {\n\t\treturn\n\t}\n\n\tm := a.formatMessage(ctx, logLevel, message, options...)\n\n\ta.toConsole(m)\n\ta.toFile(m)\n}", "func Log(v ...interface{}) {\n\tlog.Output(2, prefix+fmt.Sprint(v...))\n}", "func (s *Server) Log(a ...interface{}) {\n\tif s.logger == nil {\n\t\treturn\n\t}\n\t_, _ = fmt.Fprintln(*s.logger, a...)\n}", "func (l Logger) Log(msg string) {\n\tl.J.Print(msg)\n}", "func Println(args ...interface{}) {\n\tlogger.Println(args...)\n}", "func (c *T) Log(args ...interface{})", "func Log(message, priority string) {\n\tswitch {\n\tcase priority == \"debug\":\n\t\tif os.Getenv(\"ENVOY_DEBUG\") != \"\" {\n\t\t\tlog.Print(message)\n\t\t}\n\tdefault:\n\t\tlog.Print(message)\n\t}\n}", "func (l *comLogger) Log(verbosity Verbosity, msg string) {\n\tserial.COM1().Write(string(verbosity))\n\tserial.COM1().Write(msg)\n\tserial.COM1().Write(_newline)\n}", "func (l Logger) Log(args ...interface{}) {\n\tlog.SetOutput(os.Stdout)\n\tlog.Println(args...)\n}", "func Println(args ...interface{}) {\n\tLogger.Println(args...)\n}", "func (logger *Logger) Print(args ...interface{}) {\n\tlogger.std.Log(args...)\n}", "func (hm *HM) Log(f string, a ...interface{}) {\n\ts := fmt.Sprintf(\"[%d]-\", hm.pid) + fmt.Sprintf(f, a...) + \"\\n\"\n\tLogChan <- s\n}", "func (d *dispatcher) log(fmt string, v ...interface{}) {\n\tif d.logger != nil {\n\t\td.logger.Printf(fmt, v...)\n\t}\n}", "func Log() {\n\n}", "func (l *StdoutLogger) Log(event *Event) {\n\tfmt.Println(event.String())\n}", "func (l *Logger) log(level int64, v string) { l.doMsg(level, v) }", "func (log *Log) println(level int, a ...interface{}) {\n\tif level > log.cfg.LogLevel() { // suppress event\n\t\treturn\n\t}\n\n\tlog.output(level, fmt.Sprint(a...))\n}", "func (this *Log) AccessLog(msg interface{}) { /*{{{*/\n\tif this.AccessLogger != nil {\n\t\tthis.AccessLogger.Println(msg)\n\t}\n}", "func message(str string, a ...interface{}) {\n\tlog.Printf(str, a...)\n}", "func Println(v ...interface{}) {\n\tLogger.Info(v...)\n}", "func log(args ...Any) {\n\tfmt.Println(args...)\n}", "func Println(args ...interface{}) {\n\tgLogger.Println(args...)\n}", "func logMsg(format string, a ...interface{}) {\n\tmsg := fmt.Sprintf(format, a...)\n\tlog.Println(msg)\n\tdiscord.ChannelMessageSend(logChannel, msg)\n}", "func (c *Client) println(v ...interface{}) {\n\tif c.verbose {\n\t\tlog.Println(v...)\n\t}\n}", "func (lx *LXRHash) Log(msg string) {\n\tif lx.verbose {\n\t\tfmt.Println(msg)\n\t}\n}", "func Log(verbose bool, format string, a ...interface{}) {\n\tif !verbose {\n\t\treturn\n\t}\n\tformat = format + \"\\n\"\n\tfmt.Printf(format, a...)\n}", "func Log(args ...interface{}) {\n\tpanic(msg{Default, fmt.Sprintln(args...)})\n}", "func Print(args ...interface{}) {\n\tlogger.Print(args...)\n}", "func Print(args ...interface{}) {\n\tlogger.Print(args...)\n}", "func (self *GameHeart) Logs(msg *HeartMessageType) {\n\n}", "func (rf *Raft) Log(level LogLevel, a ...interface{}) {\n\tif !rf.killed() && level >= SetLogLevel {\n\t\tpc, _, ln, _ := runtime.Caller(1)\n\t\trp := regexp.MustCompile(\".+\\\\.([a-zA-Z]+)\")\n\t\tfuncName := rp.FindStringSubmatch(runtime.FuncForPC(pc).Name())[1]\n\t\tst := \"F\"\n\t\tif rf.state == Leader {\n\t\t\tst = \"L\"\n\t\t} else if rf.state == Candidate {\n\t\t\tst = \"C\"\n\t\t}\n\t\tdata := append([]interface{}{level, \"[ Server\", rf.me, \"- term\", rf.currentTerm, st, \"]\", \"[\", funcName, ln, \"]\"}, a...)\n\t\tfmt.Println(data...)\n\t}\n}", "func (r *reporter) Log(args ...interface{}) {\n\tr.logs.log(fmt.Sprint(args...))\n}", "func Print(args ...interface{}) {\n\tLogger.Print(args...)\n}", "func (kv *KVServer) Log(level LogLevel, a ...interface{}) {\n\tif !kv.killed() && level >= SetLogLevel {\n\t\tpc, _, ln, _ := runtime.Caller(1)\n\t\trp := regexp.MustCompile(\".+\\\\.([a-zA-Z]+)\")\n\t\tfuncName := rp.FindStringSubmatch(runtime.FuncForPC(pc).Name())[1]\n\t\tdata := append([]interface{}{level, \"[ KV\", kv.me, \"]\", \"[\", funcName, ln, \"]\"}, a...)\n\t\tfmt.Println(data...)\n\t}\n}", "func (z *Logger) Println(args ...interface{}) {\n\tz.SugaredLogger.Info(args...)\n}", "func (l *Logger) Print(v ...interface{}) { l.Output(2, fmt.Sprint(v...)) }", "func LogInfo(message string) {\n\tgetLogger().Printf(\"[Info]: %s\", message)\n}", "func printLog(logType string, message string) {\n\tvar buf bytes.Buffer\n\t// matching by type\n\tswitch logType {\n\t\tcase \"notice\":\t// Color is GREEN\n\t\t\tbuf.WriteString(\"\\x1b[32m[NOTICE] \")\n\t\t\tbuf.WriteString(message)\n\t\t\tbuf.WriteString(\"\\x1b[0m\")\n\t\tcase \"debug\":\t\t\t// Color is MAGENTA\n\t\t\tbuf.WriteString(\"\\x1b[35m[DEBUG] \")\n\t\t\tbuf.WriteString(message)\n\t\t\tbuf.WriteString(\"\\x1b[0m\")\n\t\tcase \"error\":\t\t// Color is RED\n\t\t\tbuf.WriteString(\"\\x1b[31m[ERROR] \")\n\t\t\tbuf.WriteString(message)\n\t\t\tbuf.WriteString(\"\\x1b[0m\")\n\t\tdefault:\t\t\t\t// Color is DEFAULT (WHITE)\n\t\t\tbuf.WriteString(\"\\x1b[0m[ERROR] \")\n\t\t\tbuf.WriteString(message)\n\t\t\tbuf.WriteString(\"\\x1b[0m\")\n\t}\n\t// Print\n\tlog.Print(buf.String())\n}", "func logStdOut(s string) {\n\tlog.Printf(\"%s\\n\", string(s))\n}", "func (l *Logger) Println(v ...interface{}) { l.lprintln(INFO, v...) }", "func (l StdLogger) Log(s string) {\n\tif l.Logger != nil {\n\t\tl.Logger.Println(s)\n\t} else {\n\t\tlog.Println(s)\n\t}\n}", "func (rc *RediCrypt) log(input string) {\n\tif input == \"\" {\n\t\treturn\n\t}\n\toutput := fmt.Sprintf(\"redicrypt: %s\", input)\n\tif rc == nil || rc.Logger == nil {\n\t\tfmt.Println(output)\n\t\treturn\n\t}\n\trc.Logger.Write([]byte(output))\n}", "func (l *SyncLog) Log(v ...interface{}) {\n\tl.mu.Lock()\n\tfmt.Fprintln(l.w, v...)\n\tl.mu.Unlock()\n}", "func (dl DevLogger) Println(args ...interface{}) {\n\tlog.Println(args...)\n}", "func (pl ProdLogger) Println(args ...interface{}) {\n\n}", "func (t *Throne) Log() string {\n\treturn \"There is a handsome jewel encrusted throne\"\n}", "func Log(level Level, v ...interface{}) {\n\tstdLogger.Log(level, fmt.Sprint(v...))\n}", "func print(message string, err error) {\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Println(message)\n}", "func (c *Context) Log(msg string, args ...interface{}) {\n\tc.M.log(msg, args...)\n}", "func Log(prefix, message string) {\n\tlogger.Log(prefix, message)\n}", "func (s *peerRESTServer) ConsoleLogHandler(w http.ResponseWriter, r *http.Request) {\n\tif !s.IsValid(w, r) {\n\t\ts.writeErrorResponse(w, errors.New(\"Invalid request\"))\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Connection\", \"close\")\n\tw.WriteHeader(http.StatusOK)\n\tw.(http.Flusher).Flush()\n\n\tdoneCh := make(chan struct{})\n\tdefer close(doneCh)\n\n\tch := make(chan interface{}, 2000)\n\tglobalConsoleSys.Subscribe(ch, doneCh, \"\", 0, nil)\n\n\tenc := gob.NewEncoder(w)\n\tfor {\n\t\tselect {\n\t\tcase entry := <-ch:\n\t\t\tlog := entry.(madmin.LogInfo)\n\t\t\tif err := enc.Encode(log); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.(http.Flusher).Flush()\n\t\tcase <-r.Context().Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "func ConsoleOutput(message string, logger *log.Logger) {\r\n\tlogger.Println(message)\r\n}", "func (l *sdkLogger) Print(v ...interface{}) {\n\tl.Info(v)\n}", "func (l *MessageLogger) Debug(msg string) { l.logger.Debug(msg) }", "func (_m *StdLogger) Println(args ...interface{}) {\n\tvar _ca []interface{}\n\t_ca = append(_ca, args...)\n\t_m.Called(_ca...)\n}", "func (ps *PubSub) Log(msg string) {\n\tcontent := []byte(fmt.Sprintf(\"\\n%s\", msg))\n\ttopicMsg := &broker.Message{\n\t\tBody: content,\n\t}\n\tif err := broker.Publish(logTopic, topicMsg); err != nil {\n\t\tlog.Printf(\"[pub] failed: %v\", err)\n\t} else {\n\t\tfmt.Println(\"[pub] pubbed message:\", string(topicMsg.Body))\n\t}\n\n}", "func logLine(message LiveLoggerMessage) {\n\tvar line string\n\tswitch message.eventType {\n\tcase \"NEW\":\n\t\tline = fmt.Sprintf(\"[ NEW ] - %s : %s\", message.source, message.message)\n\tcase \"DROP\":\n\t\tline = fmt.Sprintf(\"[ DROP ] - %s : %s\", message.source, message.message)\n\tcase \"START\":\n\t\tline = fmt.Sprintf(\"[ START ] - %s : %s\", message.source, message.message)\n\tcase \"UPDATE\":\n\t\tline = fmt.Sprintf(\"[ UPDATE ] - %s ( %6.2f %% ) : %s\", message.source, message.progress, message.message)\n\tcase \"END\":\n\t\tline = fmt.Sprintf(\"[ DONE ] - %s : %s\", message.source, message.message)\n\tdefault:\n\t\tline = fmt.Sprintf(\"%s : %s\", message.source, message.message)\n\t}\n\tfmt.Fprintln(os.Stdout, line)\n}", "func Log(logType, content interface{}) {\n\t_time := getTime()\n\tfmt.Printf(\"\\n%v [%v] %v\", _time, logType, content)\n}", "func (e *Huobi) Log(msgs ...interface{}) {\n\te.logger.Log(constant.INFO, \"\", 0.0, 0.0, msgs...)\n}", "func (s *SilentLogger) Log(v ...interface{}) {}", "func Info(msg string) {\n\tlock.Lock()\n\tlogger.Println(msg)\n\tlock.Unlock()\n}" ]
[ "0.7198924", "0.70782137", "0.70782137", "0.69335264", "0.6820805", "0.6767752", "0.6740621", "0.67047006", "0.66775966", "0.66761005", "0.6645149", "0.6567815", "0.65659356", "0.65493184", "0.6532021", "0.65160286", "0.65047544", "0.64814675", "0.6448005", "0.6447785", "0.64163125", "0.64093167", "0.64056796", "0.63869107", "0.63847226", "0.637875", "0.6372979", "0.63490295", "0.6333835", "0.6309495", "0.6306836", "0.6306428", "0.6303632", "0.6302955", "0.62984437", "0.6282461", "0.6271148", "0.6267791", "0.6265946", "0.62532246", "0.6248149", "0.62451017", "0.62384933", "0.6213237", "0.62108856", "0.6210125", "0.6208402", "0.6192558", "0.61903834", "0.618552", "0.6177981", "0.61769193", "0.617079", "0.6150494", "0.61221844", "0.6115438", "0.6114654", "0.6109117", "0.60832995", "0.6075801", "0.60739684", "0.60539204", "0.60460335", "0.6044288", "0.6041786", "0.60395515", "0.6030629", "0.6025275", "0.6025275", "0.6013156", "0.60106164", "0.6009896", "0.60098535", "0.6006442", "0.5998014", "0.59975314", "0.5996083", "0.5995039", "0.59943074", "0.5993521", "0.59901446", "0.5983401", "0.5977549", "0.59759474", "0.59627193", "0.59556216", "0.5953043", "0.5952636", "0.59495145", "0.59424937", "0.5935691", "0.59248996", "0.59224445", "0.5918886", "0.59175164", "0.59167725", "0.5915853", "0.5912067", "0.5911946", "0.59095985", "0.59075594" ]
0.0
-1
Deprecated: Use TopicSubmissionMessage.ProtoReflect.Descriptor instead.
func (*TopicSubmissionMessage) Descriptor() ([]byte, []int) { return file_topic_submission_message_proto_rawDescGZIP(), []int{0} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*Topic) Descriptor() ([]byte, []int) {\n\treturn file_feedbackreq_proto_rawDescGZIP(), []int{2}\n}", "func (*Topic) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_resources_topic_proto_rawDescGZIP(), []int{0}\n}", "func (*TopicMessage) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_routing_v2_service_proto_rawDescGZIP(), []int{9}\n}", "func (*Topic) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_pubsub_topic_proto_rawDescGZIP(), []int{0}\n}", "func (*Topic) Descriptor() ([]byte, []int) {\n\treturn file_topic_proto_rawDescGZIP(), []int{0}\n}", "func (*TopicGroup) Descriptor() ([]byte, []int) {\n\treturn file_topic_proto_rawDescGZIP(), []int{1}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{2}\n}", "func (*Topic_Parameters) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_pubsub_topic_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*Topic) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{1}\n}", "func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFieldDescriptor(d)\n\tcase protoreflect.OneofDescriptor:\n\t\treturn ProtoFromOneofDescriptor(d)\n\tcase protoreflect.EnumDescriptor:\n\t\treturn ProtoFromEnumDescriptor(d)\n\tcase protoreflect.EnumValueDescriptor:\n\t\treturn ProtoFromEnumValueDescriptor(d)\n\tcase protoreflect.ServiceDescriptor:\n\t\treturn ProtoFromServiceDescriptor(d)\n\tcase protoreflect.MethodDescriptor:\n\t\treturn ProtoFromMethodDescriptor(d)\n\tdefault:\n\t\t// WTF??\n\t\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\t\treturn res.AsProto()\n\t\t}\n\t\treturn nil\n\t}\n}", "func (TopicType) EnumDescriptor() ([]byte, []int) {\n\treturn file_toit_model_pubsub_topic_proto_rawDescGZIP(), []int{0}\n}", "func ProtoFromMessageDescriptor(d protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {\n\ttype canProto interface {\n\t\tMessageDescriptorProto() *descriptorpb.DescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.MessageDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif md, ok := res.AsProto().(*descriptorpb.DescriptorProto); ok {\n\t\t\treturn md\n\t\t}\n\t}\n\treturn protodesc.ToDescriptorProto(d)\n}", "func (*RecentMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{16}\n}", "func (*GenerateMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgGCPlayerInfoSubmit) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{118}\n}", "func (*TopicSubscription) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_routing_v2_service_proto_rawDescGZIP(), []int{6}\n}", "func (*Topic_ResourceTrigger) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_resources_topic_proto_rawDescGZIP(), []int{0, 1}\n}", "func (*CreateMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{12}\n}", "func (*AnalysisMessageWeakSchema) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1}\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*Messages) Descriptor() ([]byte, []int) {\n\treturn file_Forum_proto_rawDescGZIP(), []int{3}\n}", "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_pubsub_message_proto_rawDescGZIP(), []int{2}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_Forum_proto_rawDescGZIP(), []int{2}\n}", "func (*TopicSubscriptionsChange) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_routing_v2_service_proto_rawDescGZIP(), []int{8}\n}", "func (*TopicList) Descriptor() ([]byte, []int) {\n\treturn file_topic_proto_rawDescGZIP(), []int{2}\n}", "func (*Message12818) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{5}\n}", "func (*DeleteMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{13}\n}", "func (*GlobalTopic) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{5}\n}", "func (*Message6127) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{24}\n}", "func (*TopicWise) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{4}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{1}\n}", "func (*Message7511) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{16}\n}", "func (*Topic_StatusCode) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_resources_topic_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*Message6578) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{7}\n}", "func (*DeleteFeedbackRequest) Descriptor() ([]byte, []int) {\n\treturn file_feedbackreq_proto_rawDescGZIP(), []int{6}\n}", "func (*Example) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{4}\n}", "func (*Message12817) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{22}\n}", "func (*SafetyFeedback) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_safety_proto_rawDescGZIP(), []int{1}\n}", "func (*DeleteConversationRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{10}\n}", "func (*Embed) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2}\n}", "func (*Message6108) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{31}\n}", "func (*Message12796) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{1}\n}", "func (*Message7865) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{15}\n}", "func (*ListMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{14}\n}", "func (*GenerateMessageResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{1}\n}", "func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {\n\tp := &descriptorpb.DescriptorProto{\n\t\tName: proto.String(string(message.Name())),\n\t\tOptions: proto.Clone(message.Options()).(*descriptorpb.MessageOptions),\n\t}\n\tfor i, fields := 0, message.Fields(); i < fields.Len(); i++ {\n\t\tp.Field = append(p.Field, ToFieldDescriptorProto(fields.Get(i)))\n\t}\n\tfor i, exts := 0, message.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tfor i, messages := 0, message.Messages(); i < messages.Len(); i++ {\n\t\tp.NestedType = append(p.NestedType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, message.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, xranges := 0, message.ExtensionRanges(); i < xranges.Len(); i++ {\n\t\txrange := xranges.Get(i)\n\t\tp.ExtensionRange = append(p.ExtensionRange, &descriptorpb.DescriptorProto_ExtensionRange{\n\t\t\tStart: proto.Int32(int32(xrange[0])),\n\t\t\tEnd: proto.Int32(int32(xrange[1])),\n\t\t\tOptions: proto.Clone(message.ExtensionRangeOptions(i)).(*descriptorpb.ExtensionRangeOptions),\n\t\t})\n\t}\n\tfor i, oneofs := 0, message.Oneofs(); i < oneofs.Len(); i++ {\n\t\tp.OneofDecl = append(p.OneofDecl, ToOneofDescriptorProto(oneofs.Get(i)))\n\t}\n\tfor i, ranges := 0, message.ReservedRanges(); i < ranges.Len(); i++ {\n\t\trrange := ranges.Get(i)\n\t\tp.ReservedRange = append(p.ReservedRange, &descriptorpb.DescriptorProto_ReservedRange{\n\t\t\tStart: proto.Int32(int32(rrange[0])),\n\t\t\tEnd: proto.Int32(int32(rrange[1])),\n\t\t})\n\t}\n\tfor i, names := 0, message.ReservedNames(); i < names.Len(); i++ {\n\t\tp.ReservedName = append(p.ReservedName, string(names.Get(i)))\n\t}\n\treturn p\n}", "func (*PublishRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_v1_task_task_proto_rawDescGZIP(), []int{4}\n}", "func (*Publisher_External) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_pubsub_message_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*PublishMessageParameters) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateConversationRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{8}\n}", "func (*Message6107) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{11}\n}", "func (*AnalysisMessageWeakSchema_ArgType) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*Message12821) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{2}\n}", "func (*UpdateTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{5}\n}", "func (*Message5907) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{32}\n}", "func (*ExternalPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{53}\n}", "func (*Message5867) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{29}\n}", "func (*UpdateMessageTextRequest) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{19}\n}", "func (*Embed_EmbedField) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2, 1}\n}", "func (*Message7921) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{19}\n}", "func (*Message7928) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{18}\n}", "func (*DownlinkQueueRequest) Descriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_messages_proto_rawDescGZIP(), []int{17}\n}", "func (*TopicSubscriptions) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_routing_v2_service_proto_rawDescGZIP(), []int{7}\n}", "func (*Message6126) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{8}\n}", "func (*Message5908) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{13}\n}", "func (*CreateConversationRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{2}\n}", "func (*MessageWithComponents) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{61}\n}", "func (*Message12819) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{4}\n}", "func (*Message5903) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{34}\n}", "func ProtoFromFieldDescriptor(d protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {\n\ttype canProto interface {\n\t\tFieldDescriptorProto() *descriptorpb.FieldDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FieldDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FieldDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFieldDescriptorProto(d)\n}", "func LegacyLoadMessageDesc(t reflect.Type) protoreflect.MessageDescriptor {\n\treturn legacyLoadMessageDesc(t, \"\")\n}", "func (*DeleteMessageTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_message_task_proto_rawDescGZIP(), []int{5}\n}", "func (*Message7919) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{21}\n}", "func ProtoFromMethodDescriptor(d protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto {\n\ttype canProto interface {\n\t\tMethodDescriptorProto() *descriptorpb.MethodDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.MethodDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif md, ok := res.AsProto().(*descriptorpb.MethodDescriptorProto); ok {\n\t\t\treturn md\n\t\t}\n\t}\n\treturn protodesc.ToMethodDescriptorProto(d)\n}", "func (*GroupRemoveRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{34}\n}", "func (x *fastReflection_Evidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Evidence\n}", "func (*Message3920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{17}\n}", "func (*Message6052) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{25}\n}", "func (*Message3850) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{14}\n}", "func (*Message6129) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{12}\n}", "func (*PublishDiagnosticsRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{100}\n}", "func (*TriggerActionRequest) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{15}\n}", "func convertKafkaToSubmission(msg *kafka.Message) (interface{}, error) {\n\tsubmission := &rpb.RedditSubmission{}\n\tif err := proto.Unmarshal(msg.Value, submission); err != nil {\n\t\treturn nil, fmt.Errorf(\"protobuf.Unmarshal: %v\", err)\n\t}\n\n\treturn submission, nil\n}", "func (*FeedbackMetrics) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{12}\n}", "func (*MsgWithRequired) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{9}\n}", "func (*MsgWithRequiredBytes) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{11}\n}", "func (*RecentMessagesResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{17}\n}", "func (*AddProducerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{2}\n}", "func (*GetChannelMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{9}\n}", "func (application *Application) sendServiceDescriptorMessage(topic string, message interface{}) {\n application.SendMessageToTopic(topic, message, application.DefaultSubscriptionClientOptions(), false)\n}", "func (*WatchRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{25}\n}", "func (*Message12774) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{0}\n}", "func (*Publisher) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_pubsub_message_proto_rawDescGZIP(), []int{1}\n}", "func (*GetMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{11}\n}", "func (*Message4016) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{30}\n}", "func (*Message6054) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{23}\n}", "func (*SubscribeParameters) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{3}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{7}\n}" ]
[ "0.68175507", "0.67892355", "0.67468566", "0.6635227", "0.6584398", "0.6502781", "0.64011806", "0.6390371", "0.6389811", "0.63250625", "0.629232", "0.6287109", "0.6235323", "0.62342507", "0.61407334", "0.6138201", "0.612377", "0.6117275", "0.6095283", "0.60721815", "0.60713434", "0.60339755", "0.60202646", "0.6013821", "0.6009027", "0.59868175", "0.59863895", "0.597843", "0.5974462", "0.5971528", "0.5961411", "0.5956878", "0.5954177", "0.59517777", "0.595036", "0.59424174", "0.593105", "0.59276396", "0.59243923", "0.5916593", "0.5909192", "0.5908123", "0.590325", "0.5901293", "0.59000546", "0.5898736", "0.58929485", "0.5890234", "0.58833164", "0.5880771", "0.58774245", "0.58755124", "0.5869331", "0.58585966", "0.5855439", "0.5848317", "0.5845669", "0.5843919", "0.58430094", "0.5837941", "0.58377105", "0.5837121", "0.583552", "0.5832588", "0.5827303", "0.5823212", "0.5818079", "0.5815868", "0.5810909", "0.57997596", "0.5796568", "0.57901424", "0.57876796", "0.5778764", "0.57748157", "0.5772305", "0.5772102", "0.5769731", "0.5769384", "0.57672256", "0.57607925", "0.574708", "0.57381356", "0.5737602", "0.5737015", "0.5735064", "0.5731025", "0.57307893", "0.57243377", "0.5719194", "0.5719099", "0.5718977", "0.57161766", "0.5713471", "0.5712263", "0.5711936", "0.57116055", "0.5711239", "0.57064754", "0.57053554" ]
0.72706485
0
NewVvolBindingDeleteParams creates a new VvolBindingDeleteParams object, with the default timeout for this client. Default values are not hydrated, since defaults are normally applied by the API server side. To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewVvolBindingDeleteParams() *VvolBindingDeleteParams { return &VvolBindingDeleteParams{ timeout: cr.DefaultTimeout, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewVvolBindingDeleteParamsWithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithDefaults() *VvolBindingDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WithContext(ctx context.Context) *VvolBindingDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WithDeleteAllReferences(deleteAllReferences *bool) *VvolBindingDeleteParams {\n\to.SetDeleteAllReferences(deleteAllReferences)\n\treturn o\n}", "func NewVolumeDeleteParams() *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (s *VPCService) NewDeleteVPCOfferingParams(id string) *DeleteVPCOfferingParams {\n\tp := &DeleteVPCOfferingParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func NewVvolBindingDeleteParamsWithContext(ctx context.Context) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteSubnetParams() *DeleteSubnetParams {\n\tvar ()\n\treturn &DeleteSubnetParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeletePackageVersionParams() *DeletePackageVersionParams {\n\tvar ()\n\treturn &DeletePackageVersionParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewVolumeDeleteParamsWithTimeout(timeout time.Duration) *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteLoadBalancerPoolParams() *DeleteLoadBalancerPoolParams {\n\tvar ()\n\treturn &DeleteLoadBalancerPoolParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteTagParams() *DeleteTagParams {\n\tvar ()\n\treturn &DeleteTagParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteProtocolUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithProtocolEndpointUUID(protocolEndpointUUID string) *VvolBindingDeleteParams {\n\to.SetProtocolEndpointUUID(protocolEndpointUUID)\n\treturn o\n}", "func NewDeleteProtocolUsingDELETEParams() *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewLedgerVoucherAttachmentDeleteAttachmentParams() *LedgerVoucherAttachmentDeleteAttachmentParams {\n\tvar (\n\t\tsendToInboxDefault = bool(false)\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherAttachmentDeleteAttachmentParams{\n\t\tSendToInbox: &sendToInboxDefault,\n\t\tSplit: &splitDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) SetDefaults() {\n\tvar (\n\t\tdeleteAllReferencesDefault = bool(false)\n\t)\n\n\tval := VvolBindingDeleteParams{\n\t\tDeleteAllReferences: &deleteAllReferencesDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *VvolBindingDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewLedgerVoucherAttachmentDeleteAttachmentParamsWithTimeout(timeout time.Duration) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\tvar (\n\t\tsendToInboxDefault = bool(false)\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherAttachmentDeleteAttachmentParams{\n\t\tSendToInbox: &sendToInboxDefault,\n\t\tSplit: &splitDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteConnectionParams() *DeleteConnectionParams {\n\tvar ()\n\treturn &DeleteConnectionParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteConditionParams() *DeleteConditionParams {\n\tvar ()\n\treturn &DeleteConditionParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteDataSourceParams() *DeleteDataSourceParams {\n\treturn &DeleteDataSourceParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewComponentDeleteParams() *ComponentDeleteParams {\n\treturn &ComponentDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeletePackageVersionParamsWithTimeout(timeout time.Duration) *DeletePackageVersionParams {\n\tvar ()\n\treturn &DeletePackageVersionParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteSubnetParamsWithTimeout(timeout time.Duration) *DeleteSubnetParams {\n\tvar ()\n\treturn &DeleteSubnetParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteLoadBalancerPoolParamsWithTimeout(timeout time.Duration) *DeleteLoadBalancerPoolParams {\n\tvar ()\n\treturn &DeleteLoadBalancerPoolParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeletePoolProjectParams() *DeletePoolProjectParams {\n\tvar ()\n\treturn &DeletePoolProjectParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (r *ProjectsBrokersV2ServiceInstancesServiceBindingsService) Delete(parent string, instanceId string, bindingId string) *ProjectsBrokersV2ServiceInstancesServiceBindingsDeleteCall {\n\tc := &ProjectsBrokersV2ServiceInstancesServiceBindingsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\tc.instanceId = instanceId\n\tc.bindingId = bindingId\n\treturn c\n}", "func (o *VvolBindingDeleteParams) WithVvolUUID(vvolUUID string) *VvolBindingDeleteParams {\n\to.SetVvolUUID(vvolUUID)\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DeleteAllReferences != nil {\n\n\t\t// query param delete_all_references\n\t\tvar qrDeleteAllReferences bool\n\n\t\tif o.DeleteAllReferences != nil {\n\t\t\tqrDeleteAllReferences = *o.DeleteAllReferences\n\t\t}\n\t\tqDeleteAllReferences := swag.FormatBool(qrDeleteAllReferences)\n\t\tif qDeleteAllReferences != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"delete_all_references\", qDeleteAllReferences); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param protocol_endpoint.uuid\n\tif err := r.SetPathParam(\"protocol_endpoint.uuid\", o.ProtocolEndpointUUID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vvol.uuid\n\tif err := r.SetPathParam(\"vvol.uuid\", o.VvolUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func NewComponentDeleteParamsWithTimeout(timeout time.Duration) *ComponentDeleteParams {\n\treturn &ComponentDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (s *VPCService) NewDeleteVPCParams(id string) *DeleteVPCParams {\n\tp := &DeleteVPCParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func NewReposDeleteParams() *ReposDeleteParams {\n\tvar ()\n\treturn &ReposDeleteParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteSubnetsSubnetPoolParams() *DeleteSubnetsSubnetPoolParams {\n\tvar ()\n\treturn &DeleteSubnetsSubnetPoolParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteConditionParamsWithTimeout(timeout time.Duration) *DeleteConditionParams {\n\tvar ()\n\treturn &DeleteConditionParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewRevokeDeviceCertificateUsingDELETEParamsWithTimeout(timeout time.Duration) *RevokeDeviceCertificateUsingDELETEParams {\n\tvar ()\n\treturn &RevokeDeviceCertificateUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewRevokeDeviceCertificateUsingDELETEParams() *RevokeDeviceCertificateUsingDELETEParams {\n\tvar ()\n\treturn &RevokeDeviceCertificateUsingDELETEParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteDataSourceParamsWithTimeout(timeout time.Duration) *DeleteDataSourceParams {\n\treturn &DeleteDataSourceParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteNamespaceParams() *DeleteNamespaceParams {\n\tvar ()\n\treturn &DeleteNamespaceParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteKeyPairsParams() *DeleteKeyPairsParams {\n\tvar ()\n\treturn &DeleteKeyPairsParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *VolumeDeleteParams) WithTimeout(timeout time.Duration) *VolumeDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteVersionControlRequestParamsWithTimeout(timeout time.Duration) *DeleteVersionControlRequestParams {\n\treturn &DeleteVersionControlRequestParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewVolumeDeleteParamsWithHTTPClient(client *http.Client) *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteNetworkGroupPolicyParams() *DeleteNetworkGroupPolicyParams {\n\tvar ()\n\treturn &DeleteNetworkGroupPolicyParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteTagParamsWithTimeout(timeout time.Duration) *DeleteTagParams {\n\tvar ()\n\treturn &DeleteTagParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteDeviceUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteDeviceUsingDELETEParams {\n\tvar ()\n\treturn &DeleteDeviceUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteConnectionParamsWithTimeout(timeout time.Duration) *DeleteConnectionParams {\n\tvar ()\n\treturn &DeleteConnectionParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (c *IPSecVPNClient) NewDeleteVPNTunnelRequest() *DeleteVPNTunnelRequest {\n\treq := &DeleteVPNTunnelRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "func NewLedgerVoucherAttachmentDeleteAttachmentParamsWithHTTPClient(client *http.Client) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\tvar (\n\t\tsendToInboxDefault = bool(false)\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherAttachmentDeleteAttachmentParams{\n\t\tSendToInbox: &sendToInboxDefault,\n\t\tSplit: &splitDefault,\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteCwfNetworkIDParams() *DeleteCwfNetworkIDParams {\n\tvar ()\n\treturn &DeleteCwfNetworkIDParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteSubscribedEventParams() *DeleteSubscribedEventParams {\n\tvar ()\n\treturn &DeleteSubscribedEventParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteScheduleParams() *DeleteScheduleParams {\n\tvar ()\n\treturn &DeleteScheduleParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteVersionControlRequestParams() *DeleteVersionControlRequestParams {\n\treturn &DeleteVersionControlRequestParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *DeleteProtocolUsingDELETEParams) WithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteSubnetsSubnetPoolParamsWithTimeout(timeout time.Duration) *DeleteSubnetsSubnetPoolParams {\n\tvar ()\n\treturn &DeleteSubnetsSubnetPoolParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeletePoolProjectParamsWithTimeout(timeout time.Duration) *DeletePoolProjectParams {\n\tvar ()\n\treturn &DeletePoolProjectParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteDeviceUsingDELETEParams() *DeleteDeviceUsingDELETEParams {\n\tvar ()\n\treturn &DeleteDeviceUsingDELETEParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteSubscribedEventParamsWithTimeout(timeout time.Duration) *DeleteSubscribedEventParams {\n\tvar ()\n\treturn &DeleteSubscribedEventParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteKeyPairsParamsWithTimeout(timeout time.Duration) *DeleteKeyPairsParams {\n\tvar ()\n\treturn &DeleteKeyPairsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteProtocolUsingDELETEParamsWithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeletePackageVersionParamsWithHTTPClient(client *http.Client) *DeletePackageVersionParams {\n\tvar ()\n\treturn &DeletePackageVersionParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteNodeParams() *DeleteNodeParams {\n\tvar ()\n\treturn &DeleteNodeParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteLoadBalancerPoolParamsWithHTTPClient(client *http.Client) *DeleteLoadBalancerPoolParams {\n\tvar ()\n\treturn &DeleteLoadBalancerPoolParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteNetworkGroupPolicyParamsWithTimeout(timeout time.Duration) *DeleteNetworkGroupPolicyParams {\n\tvar ()\n\treturn &DeleteNetworkGroupPolicyParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (l *Libvirt) NwfilterBindingDelete(OptNwfilter NwfilterBinding) (err error) {\n\tvar buf []byte\n\n\targs := NwfilterBindingDeleteArgs {\n\t\tOptNwfilter: OptNwfilter,\n\t}\n\n\tbuf, err = encode(&args)\n\tif err != nil {\n\t\treturn\n\t}\n\n\n\t_, err = l.requestStream(400, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func NewDeleteSubnetParamsWithHTTPClient(client *http.Client) *DeleteSubnetParams {\n\tvar ()\n\treturn &DeleteSubnetParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (a *DeprecatedBusManagementRouterApiService) DeleteBindingUsingDELETE(ctx _context.Context, routingKeyFilter string, fifoName string) ApiDeleteBindingUsingDELETERequest {\n\treturn ApiDeleteBindingUsingDELETERequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\troutingKeyFilter: routingKeyFilter,\n\t\tfifoName: fifoName,\n\t}\n}", "func NewReposDeleteParamsWithTimeout(timeout time.Duration) *ReposDeleteParams {\n\tvar ()\n\treturn &ReposDeleteParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteBlueprintRequestUsingDELETE1ParamsWithTimeout(timeout time.Duration) *DeleteBlueprintRequestUsingDELETE1Params {\n\treturn &DeleteBlueprintRequestUsingDELETE1Params{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteAlertingProfileParams() *DeleteAlertingProfileParams {\n\tvar ()\n\treturn &DeleteAlertingProfileParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteBlueprintsInWorkspaceParams() *DeleteBlueprintsInWorkspaceParams {\n\tvar ()\n\treturn &DeleteBlueprintsInWorkspaceParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewRevokeDeviceCertificateUsingDELETEParamsWithHTTPClient(client *http.Client) *RevokeDeviceCertificateUsingDELETEParams {\n\tvar ()\n\treturn &RevokeDeviceCertificateUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteNamespaceParamsWithTimeout(timeout time.Duration) *DeleteNamespaceParams {\n\tvar ()\n\treturn &DeleteNamespaceParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteGerritListenerByIDUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteGerritListenerByIDUsingDELETEParams {\n\treturn &DeleteGerritListenerByIDUsingDELETEParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteScriptDataParams() DeleteScriptDataParams {\n\n\treturn DeleteScriptDataParams{}\n}", "func NewDeleteScheduleParamsWithTimeout(timeout time.Duration) *DeleteScheduleParams {\n\tvar ()\n\treturn &DeleteScheduleParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *VolumeDeleteParams) WithContext(ctx context.Context) *VolumeDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewDeleteAttributeParams() *DeleteAttributeParams {\n\tvar ()\n\treturn &DeleteAttributeParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewComponentDeleteParamsWithHTTPClient(client *http.Client) *ComponentDeleteParams {\n\treturn &ComponentDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewStreamsDeleteParams() *StreamsDeleteParams {\n\tvar ()\n\treturn &StreamsDeleteParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteGerritListenerByIDUsingDELETEParams() *DeleteGerritListenerByIDUsingDELETEParams {\n\treturn &DeleteGerritListenerByIDUsingDELETEParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteRequestBody(p *inventory.DeletePayload) *DeleteRequestBody {\n\tbody := &DeleteRequestBody{}\n\tif p.Ids != nil {\n\t\tbody.Ids = make([]string, len(p.Ids))\n\t\tfor i, val := range p.Ids {\n\t\t\tbody.Ids[i] = val\n\t\t}\n\t}\n\treturn body\n}", "func NewEntryServiceDeleteParams() *EntryServiceDeleteParams {\n\tvar ()\n\treturn &EntryServiceDeleteParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteRolesParams() *DeleteRolesParams {\n\tvar ()\n\treturn &DeleteRolesParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteAlertingProfileParamsWithTimeout(timeout time.Duration) *DeleteAlertingProfileParams {\n\tvar ()\n\treturn &DeleteAlertingProfileParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteKeyPairsParams) WithBody(body *models.OpenpitrixDeleteKeyPairsRequest) *DeleteKeyPairsParams {\n\to.SetBody(body)\n\treturn o\n}", "func (s *VPCService) NewDeletePrivateGatewayParams(id string) *DeletePrivateGatewayParams {\n\tp := &DeletePrivateGatewayParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func NewAPIDeleteUserParams() *APIDeleteUserParams {\n\tvar ()\n\treturn &APIDeleteUserParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteCwfNetworkIDParamsWithTimeout(timeout time.Duration) *DeleteCwfNetworkIDParams {\n\tvar ()\n\treturn &DeleteCwfNetworkIDParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (c *UDBClient) NewDeleteUDBParamGroupRequest() *DeleteUDBParamGroupRequest {\n\treq := &DeleteUDBParamGroupRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "func (c *UDBClient) NewDeleteUDBParamGroupRequest() *DeleteUDBParamGroupRequest {\n\treq := &DeleteUDBParamGroupRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "func NewStorageVolumesDeleteRequestBody(p *spinregistry.StorageVolumesDeletePayload) *StorageVolumesDeleteRequestBody {\n\tbody := &StorageVolumesDeleteRequestBody{\n\t\tName: p.Name,\n\t}\n\treturn body\n}", "func NewOrderDeleteParams() *OrderDeleteParams {\n\treturn &OrderDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (s *ProjectService) NewDeleteProjectInvitationParams(id string) *DeleteProjectInvitationParams {\n\tp := &DeleteProjectInvitationParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func NewEntryServiceDeleteParamsWithTimeout(timeout time.Duration) *EntryServiceDeleteParams {\n\tvar ()\n\treturn &EntryServiceDeleteParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteNodeParamsWithTimeout(timeout time.Duration) *DeleteNodeParams {\n\tvar ()\n\treturn &DeleteNodeParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *ComponentDeleteParams) WithTimeout(timeout time.Duration) *ComponentDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}" ]
[ "0.8443394", "0.80488086", "0.79342115", "0.7605265", "0.73258764", "0.71807414", "0.66015834", "0.656757", "0.6386962", "0.6290172", "0.624446", "0.62381047", "0.61957663", "0.61885685", "0.61526823", "0.6124373", "0.6017747", "0.6001432", "0.5993086", "0.5975276", "0.59619576", "0.5920571", "0.5899723", "0.5898739", "0.58104837", "0.57858866", "0.5783528", "0.57319623", "0.5731894", "0.5720407", "0.5695943", "0.56915694", "0.5680454", "0.5637523", "0.5599144", "0.5588753", "0.55724853", "0.55671316", "0.5566718", "0.5563194", "0.5555212", "0.552324", "0.54914016", "0.54869205", "0.54819274", "0.5461057", "0.54590386", "0.5423771", "0.54173136", "0.538978", "0.5388258", "0.538207", "0.53719133", "0.53558433", "0.534948", "0.53306174", "0.53110605", "0.5307899", "0.52949464", "0.52758723", "0.5272912", "0.5257975", "0.5252578", "0.52364534", "0.5196358", "0.5189118", "0.5185938", "0.5178873", "0.51677734", "0.5148082", "0.51248294", "0.5117575", "0.5116993", "0.5113344", "0.51127607", "0.51057225", "0.5101026", "0.5095589", "0.5087535", "0.50841016", "0.50737536", "0.50684756", "0.50105596", "0.5009059", "0.5001125", "0.49856505", "0.49819764", "0.49745783", "0.4974002", "0.49526763", "0.49508944", "0.4950568", "0.4949228", "0.4949228", "0.4936675", "0.49267295", "0.49198043", "0.4919606", "0.49171132", "0.4900814" ]
0.89485335
0
NewVvolBindingDeleteParamsWithTimeout creates a new VvolBindingDeleteParams object with the ability to set a timeout on a request.
func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams { return &VvolBindingDeleteParams{ timeout: timeout, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewVvolBindingDeleteParams() *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewVolumeDeleteParamsWithTimeout(timeout time.Duration) *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteSubnetParamsWithTimeout(timeout time.Duration) *DeleteSubnetParams {\n\tvar ()\n\treturn &DeleteSubnetParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeletePackageVersionParamsWithTimeout(timeout time.Duration) *DeletePackageVersionParams {\n\tvar ()\n\treturn &DeletePackageVersionParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewComponentDeleteParamsWithTimeout(timeout time.Duration) *ComponentDeleteParams {\n\treturn &ComponentDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteTagParamsWithTimeout(timeout time.Duration) *DeleteTagParams {\n\tvar ()\n\treturn &DeleteTagParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteProtocolUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewLedgerVoucherAttachmentDeleteAttachmentParamsWithTimeout(timeout time.Duration) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\tvar (\n\t\tsendToInboxDefault = bool(false)\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherAttachmentDeleteAttachmentParams{\n\t\tSendToInbox: &sendToInboxDefault,\n\t\tSplit: &splitDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteVersionControlRequestParamsWithTimeout(timeout time.Duration) *DeleteVersionControlRequestParams {\n\treturn &DeleteVersionControlRequestParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteConnectionParamsWithTimeout(timeout time.Duration) *DeleteConnectionParams {\n\tvar ()\n\treturn &DeleteConnectionParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteConditionParamsWithTimeout(timeout time.Duration) *DeleteConditionParams {\n\tvar ()\n\treturn &DeleteConditionParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteLoadBalancerPoolParamsWithTimeout(timeout time.Duration) *DeleteLoadBalancerPoolParams {\n\tvar ()\n\treturn &DeleteLoadBalancerPoolParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *VolumeDeleteParams) WithTimeout(timeout time.Duration) *VolumeDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewRevokeDeviceCertificateUsingDELETEParamsWithTimeout(timeout time.Duration) *RevokeDeviceCertificateUsingDELETEParams {\n\tvar ()\n\treturn &RevokeDeviceCertificateUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteKeyPairsParamsWithTimeout(timeout time.Duration) *DeleteKeyPairsParams {\n\tvar ()\n\treturn &DeleteKeyPairsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteDataSourceParamsWithTimeout(timeout time.Duration) *DeleteDataSourceParams {\n\treturn &DeleteDataSourceParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteProtocolUsingDELETEParams) WithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewVvolBindingDeleteParamsWithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteNodeParamsWithTimeout(timeout time.Duration) *DeleteNodeParams {\n\tvar ()\n\treturn &DeleteNodeParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteNamespaceParamsWithTimeout(timeout time.Duration) *DeleteNamespaceParams {\n\tvar ()\n\treturn &DeleteNamespaceParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeletePoolProjectParamsWithTimeout(timeout time.Duration) *DeletePoolProjectParams {\n\tvar ()\n\treturn &DeletePoolProjectParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteAttributeParamsWithTimeout(timeout time.Duration) *DeleteAttributeParams {\n\tvar ()\n\treturn &DeleteAttributeParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteProtocolUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewDeleteSubnetsSubnetPoolParamsWithTimeout(timeout time.Duration) *DeleteSubnetsSubnetPoolParams {\n\tvar ()\n\treturn &DeleteSubnetsSubnetPoolParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteSubscribedEventParamsWithTimeout(timeout time.Duration) *DeleteSubscribedEventParams {\n\tvar ()\n\treturn &DeleteSubscribedEventParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteNetworkGroupPolicyParamsWithTimeout(timeout time.Duration) *DeleteNetworkGroupPolicyParams {\n\tvar ()\n\treturn &DeleteNetworkGroupPolicyParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteScheduleParamsWithTimeout(timeout time.Duration) *DeleteScheduleParams {\n\tvar ()\n\treturn &DeleteScheduleParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteBlueprintsInWorkspaceParamsWithTimeout(timeout time.Duration) *DeleteBlueprintsInWorkspaceParams {\n\tvar ()\n\treturn &DeleteBlueprintsInWorkspaceParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *VolumeDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ComponentDeleteParams) WithTimeout(timeout time.Duration) *ComponentDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteDeviceUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteDeviceUsingDELETEParams {\n\tvar ()\n\treturn &DeleteDeviceUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeletePacketCapturesParamsWithTimeout(timeout time.Duration) *DeletePacketCapturesParams {\n\treturn &DeletePacketCapturesParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteCwfNetworkIDParamsWithTimeout(timeout time.Duration) *DeleteCwfNetworkIDParams {\n\tvar ()\n\treturn &DeleteCwfNetworkIDParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewNvmeNamespaceDeleteParamsWithTimeout(timeout time.Duration) *NvmeNamespaceDeleteParams {\n\treturn &NvmeNamespaceDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteNtpServerParamsWithTimeout(timeout time.Duration) *DeleteNtpServerParams {\n\tvar ()\n\treturn &DeleteNtpServerParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteDebugRequestParamsWithTimeout(timeout time.Duration) *DeleteDebugRequestParams {\n\tvar ()\n\treturn &DeleteDebugRequestParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteVersionControlRequestParams) WithTimeout(timeout time.Duration) *DeleteVersionControlRequestParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteTagParams() *DeleteTagParams {\n\tvar ()\n\treturn &DeleteTagParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewEntryServiceDeleteParamsWithTimeout(timeout time.Duration) *EntryServiceDeleteParams {\n\tvar ()\n\treturn &EntryServiceDeleteParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewVolumeDeleteParams() *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *DeleteKeyPairsParams) WithTimeout(timeout time.Duration) *DeleteKeyPairsParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewReposDeleteParamsWithTimeout(timeout time.Duration) *ReposDeleteParams {\n\tvar ()\n\treturn &ReposDeleteParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteDebugRequestParams) WithTimeout(timeout time.Duration) *DeleteDebugRequestParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteGerritListenerByIDUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteGerritListenerByIDUsingDELETEParams {\n\treturn &DeleteGerritListenerByIDUsingDELETEParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *ComponentDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewStreamsDeleteParamsWithTimeout(timeout time.Duration) *StreamsDeleteParams {\n\tvar ()\n\treturn &StreamsDeleteParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewAPIDeleteUserParamsWithTimeout(timeout time.Duration) *APIDeleteUserParams {\n\tvar ()\n\treturn &APIDeleteUserParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithContext(ctx context.Context) *VvolBindingDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *DeleteConditionParams) WithTimeout(timeout time.Duration) *DeleteConditionParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteSubnetParams() *DeleteSubnetParams {\n\tvar ()\n\treturn &DeleteSubnetParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *DeleteTagParams) WithTimeout(timeout time.Duration) *DeleteTagParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteRolesParamsWithTimeout(timeout time.Duration) *DeleteRolesParams {\n\tvar ()\n\treturn &DeleteRolesParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteSubnetParams) WithTimeout(timeout time.Duration) *DeleteSubnetParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeletePoolProjectParams) WithTimeout(timeout time.Duration) *DeletePoolProjectParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteConnectionParams() *DeleteConnectionParams {\n\tvar ()\n\treturn &DeleteConnectionParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *DeletePackageVersionParams) WithTimeout(timeout time.Duration) *DeletePackageVersionParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewServiceBindingBindingParamsWithTimeout(timeout time.Duration) *ServiceBindingBindingParams {\n\treturn &ServiceBindingBindingParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteLoadBalancerPoolParams) WithTimeout(timeout time.Duration) *DeleteLoadBalancerPoolParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDecryptParamsWithTimeout(timeout time.Duration) *DecryptParams {\n\tvar ()\n\treturn &DecryptParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteConditionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewRemoveGKECredentialParamsWithTimeout(timeout time.Duration) *RemoveGKECredentialParams {\n\tvar ()\n\treturn &RemoveGKECredentialParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteLoadBalancerPoolParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewDeleteClusterParamsWithTimeout(timeout time.Duration) *DeleteClusterParams {\n\tvar ()\n\treturn &DeleteClusterParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteDeviceUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (s *VPCService) NewDeleteVPCOfferingParams(id string) *DeleteVPCOfferingParams {\n\tp := &DeleteVPCOfferingParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func NewDeleteProtectedEntityParamsWithTimeout(timeout time.Duration) *DeleteProtectedEntityParams {\n\treturn &DeleteProtectedEntityParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteAlertingProfileParamsWithTimeout(timeout time.Duration) *DeleteAlertingProfileParams {\n\tvar ()\n\treturn &DeleteAlertingProfileParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithDefaults() *VvolBindingDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteVersionControlRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewOrderDeleteParamsWithTimeout(timeout time.Duration) *OrderDeleteParams {\n\treturn &OrderDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteConditionParams() *DeleteConditionParams {\n\tvar ()\n\treturn &DeleteConditionParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeletePackageVersionParams() *DeletePackageVersionParams {\n\tvar ()\n\treturn &DeletePackageVersionParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeletePrincipalIdentityParamsWithTimeout(timeout time.Duration) *DeletePrincipalIdentityParams {\n\tvar ()\n\treturn &DeletePrincipalIdentityParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewRemoveReceiverParamsWithTimeout(timeout time.Duration) *RemoveReceiverParams {\n\tvar ()\n\treturn &RemoveReceiverParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteUserAttributeParamsWithTimeout(timeout time.Duration) *DeleteUserAttributeParams {\n\tvar ()\n\treturn &DeleteUserAttributeParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewPcloudPlacementgroupsMembersDeleteParamsWithTimeout(timeout time.Duration) *PcloudPlacementgroupsMembersDeleteParams {\n\treturn &PcloudPlacementgroupsMembersDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) WithTimeout(timeout time.Duration) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewComponentDeleteParams() *ComponentDeleteParams {\n\treturn &ComponentDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *DeleteKeyPairsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) WithTimeout(timeout time.Duration) *RevokeDeviceCertificateUsingDELETEParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteDebugRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewEmsDestinationDeleteParamsWithTimeout(timeout time.Duration) *EmsDestinationDeleteParams {\n\treturn &EmsDestinationDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteProtocolUsingDELETEParams() *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewServiceInstanceDeprovisionParamsWithTimeout(timeout time.Duration) *ServiceInstanceDeprovisionParams {\n\treturn &ServiceInstanceDeprovisionParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *EntryServiceDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSubnetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteTagParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *OrderDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewDeleteBlueprintRequestUsingDELETE1ParamsWithTimeout(timeout time.Duration) *DeleteBlueprintRequestUsingDELETE1Params {\n\treturn &DeleteBlueprintRequestUsingDELETE1Params{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteSupportUserParamsWithTimeout(timeout time.Duration) *DeleteSupportUserParams {\n\tvar ()\n\treturn &DeleteSupportUserParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeletePoolProjectParams() *DeletePoolProjectParams {\n\tvar ()\n\treturn &DeletePoolProjectParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteLifecycleSpacesParamsWithTimeout(timeout time.Duration) *DeleteLifecycleSpacesParams {\n\tvar ()\n\treturn &DeleteLifecycleSpacesParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteAPI24ProtectionGroupSnapshotsParamsWithTimeout(timeout time.Duration) *DeleteAPI24ProtectionGroupSnapshotsParams {\n\tvar ()\n\treturn &DeleteAPI24ProtectionGroupSnapshotsParams{\n\n\t\ttimeout: timeout,\n\t}\n}" ]
[ "0.833041", "0.75770617", "0.75299597", "0.75071734", "0.7177665", "0.71717817", "0.7094056", "0.7027132", "0.69987446", "0.6997985", "0.6857217", "0.68130285", "0.6753555", "0.67476237", "0.67308384", "0.6725506", "0.6687974", "0.66241753", "0.65718096", "0.65705854", "0.65351385", "0.64943665", "0.6477535", "0.64680654", "0.64539886", "0.64370227", "0.63885933", "0.634305", "0.6337674", "0.6276346", "0.62429184", "0.6240647", "0.6212345", "0.6203376", "0.6147234", "0.6137001", "0.6133759", "0.6121305", "0.6115823", "0.6111048", "0.60869676", "0.6073598", "0.6048644", "0.6033159", "0.6008066", "0.6006792", "0.5999292", "0.5992947", "0.5988538", "0.5985604", "0.59681165", "0.59452266", "0.59340376", "0.5924503", "0.5913127", "0.5901739", "0.58993894", "0.5891964", "0.58875", "0.5872197", "0.58652073", "0.58635104", "0.5861905", "0.58604664", "0.5849651", "0.5845878", "0.5831884", "0.58314645", "0.5827535", "0.58218044", "0.5813774", "0.58116984", "0.58061904", "0.5795154", "0.5780861", "0.57730824", "0.5756823", "0.57557744", "0.5754876", "0.5735047", "0.57298833", "0.5729114", "0.57198614", "0.57150435", "0.56979764", "0.568907", "0.56878936", "0.5682498", "0.56766623", "0.567659", "0.56657696", "0.566385", "0.5649012", "0.5644881", "0.5644043", "0.564352", "0.56387323", "0.5623245", "0.5618066", "0.5607321" ]
0.89275056
0
NewVvolBindingDeleteParamsWithContext creates a new VvolBindingDeleteParams object with the ability to set a context for a request.
func NewVvolBindingDeleteParamsWithContext(ctx context.Context) *VvolBindingDeleteParams { return &VvolBindingDeleteParams{ Context: ctx, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewVvolBindingDeleteParams() *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewVvolBindingDeleteParamsWithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithContext(ctx context.Context) *VvolBindingDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithDefaults() *VvolBindingDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewVolumeDeleteParamsWithContext(ctx context.Context) *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\tContext: ctx,\n\t}\n}", "func NewLedgerVoucherAttachmentDeleteAttachmentParamsWithContext(ctx context.Context) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\tvar (\n\t\tsendToInboxDefault = bool(false)\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherAttachmentDeleteAttachmentParams{\n\t\tSendToInbox: &sendToInboxDefault,\n\t\tSplit: &splitDefault,\n\n\t\tContext: ctx,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteLoadBalancerPoolParamsWithContext(ctx context.Context) *DeleteLoadBalancerPoolParams {\n\tvar ()\n\treturn &DeleteLoadBalancerPoolParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteSubnetParamsWithContext(ctx context.Context) *DeleteSubnetParams {\n\tvar ()\n\treturn &DeleteSubnetParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteProtocolUsingDELETEParamsWithContext(ctx context.Context) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithVvolUUID(vvolUUID string) *VvolBindingDeleteParams {\n\to.SetVvolUUID(vvolUUID)\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WithDeleteAllReferences(deleteAllReferences *bool) *VvolBindingDeleteParams {\n\to.SetDeleteAllReferences(deleteAllReferences)\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WithProtocolEndpointUUID(protocolEndpointUUID string) *VvolBindingDeleteParams {\n\to.SetProtocolEndpointUUID(protocolEndpointUUID)\n\treturn o\n}", "func NewDeletePackageVersionParamsWithContext(ctx context.Context) *DeletePackageVersionParams {\n\tvar ()\n\treturn &DeletePackageVersionParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteTagParamsWithContext(ctx context.Context) *DeleteTagParams {\n\tvar ()\n\treturn &DeleteTagParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteAlertingProfileParamsWithContext(ctx context.Context) *DeleteAlertingProfileParams {\n\tvar ()\n\treturn &DeleteAlertingProfileParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteSiteSnippetParamsWithContext(ctx context.Context) *DeleteSiteSnippetParams {\n\tvar ()\n\treturn &DeleteSiteSnippetParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewRevokeDeviceCertificateUsingDELETEParamsWithContext(ctx context.Context) *RevokeDeviceCertificateUsingDELETEParams {\n\tvar ()\n\treturn &RevokeDeviceCertificateUsingDELETEParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteSubnetsSubnetPoolParamsWithContext(ctx context.Context) *DeleteSubnetsSubnetPoolParams {\n\tvar ()\n\treturn &DeleteSubnetsSubnetPoolParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteCwfNetworkIDParamsWithContext(ctx context.Context) *DeleteCwfNetworkIDParams {\n\tvar ()\n\treturn &DeleteCwfNetworkIDParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewLedgerVoucherAttachmentDeleteAttachmentParams() *LedgerVoucherAttachmentDeleteAttachmentParams {\n\tvar (\n\t\tsendToInboxDefault = bool(false)\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherAttachmentDeleteAttachmentParams{\n\t\tSendToInbox: &sendToInboxDefault,\n\t\tSplit: &splitDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteNetworkGroupPolicyParamsWithContext(ctx context.Context) *DeleteNetworkGroupPolicyParams {\n\tvar ()\n\treturn &DeleteNetworkGroupPolicyParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteSubscribedEventParamsWithContext(ctx context.Context) *DeleteSubscribedEventParams {\n\tvar ()\n\treturn &DeleteSubscribedEventParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewReposDeleteParamsWithContext(ctx context.Context) *ReposDeleteParams {\n\tvar ()\n\treturn &ReposDeleteParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteDeviceUsingDELETEParamsWithContext(ctx context.Context) *DeleteDeviceUsingDELETEParams {\n\tvar ()\n\treturn &DeleteDeviceUsingDELETEParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteLoadBalancerPoolParams() *DeleteLoadBalancerPoolParams {\n\tvar ()\n\treturn &DeleteLoadBalancerPoolParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (s *VPCService) NewDeleteVPCOfferingParams(id string) *DeleteVPCOfferingParams {\n\tp := &DeleteVPCOfferingParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func NewComponentDeleteParamsWithContext(ctx context.Context) *ComponentDeleteParams {\n\treturn &ComponentDeleteParams{\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteNamespaceParamsWithContext(ctx context.Context) *DeleteNamespaceParams {\n\tvar ()\n\treturn &DeleteNamespaceParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (c *Krds) DeleteDBParameterGroupWithContext(ctx aws.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {\n\treq, out := c.DeleteDBParameterGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (o *VolumeDeleteParams) WithContext(ctx context.Context) *VolumeDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewBundleProductOptionRepositoryV1DeleteByIDDeleteParamsWithContext(ctx context.Context) *BundleProductOptionRepositoryV1DeleteByIDDeleteParams {\n\tvar ()\n\treturn &BundleProductOptionRepositoryV1DeleteByIDDeleteParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeletePoolProjectParamsWithContext(ctx context.Context) *DeletePoolProjectParams {\n\tvar ()\n\treturn &DeletePoolProjectParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteDataSourceParamsWithContext(ctx context.Context) *DeleteDataSourceParams {\n\treturn &DeleteDataSourceParams{\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteConditionParamsWithContext(ctx context.Context) *DeleteConditionParams {\n\tvar ()\n\treturn &DeleteConditionParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (c *SageMaker) DeleteImageVersionWithContext(ctx aws.Context, input *DeleteImageVersionInput, opts ...request.Option) (*DeleteImageVersionOutput, error) {\n\treq, out := c.DeleteImageVersionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewDeleteKeyPairsParamsWithContext(ctx context.Context) *DeleteKeyPairsParams {\n\tvar ()\n\treturn &DeleteKeyPairsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (c *Connect) DeletePromptWithContext(ctx aws.Context, input *DeletePromptInput, opts ...request.Option) (*DeletePromptOutput, error) {\n\treq, out := c.DeletePromptRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewDeleteVersionControlRequestParamsWithContext(ctx context.Context) *DeleteVersionControlRequestParams {\n\treturn &DeleteVersionControlRequestParams{\n\t\tContext: ctx,\n\t}\n}", "func (secretsManager *SecretsManagerV2) DeleteSecretWithContext(ctx context.Context, deleteSecretOptions *DeleteSecretOptions) (response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(deleteSecretOptions, \"deleteSecretOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(deleteSecretOptions, \"deleteSecretOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"id\": *deleteSecretOptions.ID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.DELETE)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = secretsManager.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(secretsManager.Service.Options.URL, `/api/v2/secrets/{id}`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range deleteSecretOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"secrets_manager\", \"V2\", \"DeleteSecret\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tresponse, err = secretsManager.Service.Request(request, nil)\n\n\treturn\n}", "func NewDeleteGerritListenerByIDUsingDELETEParamsWithContext(ctx context.Context) *DeleteGerritListenerByIDUsingDELETEParams {\n\treturn &DeleteGerritListenerByIDUsingDELETEParams{\n\t\tContext: ctx,\n\t}\n}", "func NewNvmeNamespaceDeleteParamsWithContext(ctx context.Context) *NvmeNamespaceDeleteParams {\n\treturn &NvmeNamespaceDeleteParams{\n\t\tContext: ctx,\n\t}\n}", "func (c *Budgets) DeleteBudgetWithContext(ctx aws.Context, input *DeleteBudgetInput, opts ...request.Option) (*DeleteBudgetOutput, error) {\n\treq, out := c.DeleteBudgetRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewEntryServiceDeleteParamsWithContext(ctx context.Context) *EntryServiceDeleteParams {\n\tvar ()\n\treturn &EntryServiceDeleteParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) WithContext(ctx context.Context) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewVolumeDeleteParams() *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteLoadBalancerPoolParamsWithHTTPClient(client *http.Client) *DeleteLoadBalancerPoolParams {\n\tvar ()\n\treturn &DeleteLoadBalancerPoolParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteNodeParamsWithContext(ctx context.Context) *DeleteNodeParams {\n\tvar ()\n\treturn &DeleteNodeParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (c *Connect) DeleteVocabularyWithContext(ctx aws.Context, input *DeleteVocabularyInput, opts ...request.Option) (*DeleteVocabularyOutput, error) {\n\treq, out := c.DeleteVocabularyRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewDeleteScheduleParamsWithContext(ctx context.Context) *DeleteScheduleParams {\n\tvar ()\n\treturn &DeleteScheduleParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewLedgerVoucherAttachmentDeleteAttachmentParamsWithHTTPClient(client *http.Client) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\tvar (\n\t\tsendToInboxDefault = bool(false)\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherAttachmentDeleteAttachmentParams{\n\t\tSendToInbox: &sendToInboxDefault,\n\t\tSplit: &splitDefault,\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteNtpServerParamsWithContext(ctx context.Context) *DeleteNtpServerParams {\n\tvar ()\n\treturn &DeleteNtpServerParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (c *SageMaker) DeleteEdgeDeploymentStageWithContext(ctx aws.Context, input *DeleteEdgeDeploymentStageInput, opts ...request.Option) (*DeleteEdgeDeploymentStageOutput, error) {\n\treq, out := c.DeleteEdgeDeploymentStageRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (c *LexModelsV2) DeleteBotVersionWithContext(ctx aws.Context, input *DeleteBotVersionInput, opts ...request.Option) (*DeleteBotVersionOutput, error) {\n\treq, out := c.DeleteBotVersionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (c *LexModelsV2) DeleteBotWithContext(ctx aws.Context, input *DeleteBotInput, opts ...request.Option) (*DeleteBotOutput, error) {\n\treq, out := c.DeleteBotRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (o *DeleteLoadBalancerPoolParams) WithContext(ctx context.Context) *DeleteLoadBalancerPoolParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (s *VPCService) NewDeleteVPCParams(id string) *DeleteVPCParams {\n\tp := &DeleteVPCParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func (c *Organizations) DeletePolicyWithContext(ctx aws.Context, input *DeletePolicyInput, opts ...request.Option) (*DeletePolicyOutput, error) {\n\treq, out := c.DeletePolicyRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (c *Proton) DeleteEnvironmentTemplateVersionWithContext(ctx aws.Context, input *DeleteEnvironmentTemplateVersionInput, opts ...request.Option) (*DeleteEnvironmentTemplateVersionOutput, error) {\n\treq, out := c.DeleteEnvironmentTemplateVersionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewDeleteBlueprintRequestUsingDELETE1ParamsWithContext(ctx context.Context) *DeleteBlueprintRequestUsingDELETE1Params {\n\treturn &DeleteBlueprintRequestUsingDELETE1Params{\n\t\tContext: ctx,\n\t}\n}", "func (o *DeleteProtocolUsingDELETEParams) WithContext(ctx context.Context) *DeleteProtocolUsingDELETEParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewDeletePrincipalIdentityParamsWithContext(ctx context.Context) *DeletePrincipalIdentityParams {\n\tvar ()\n\treturn &DeletePrincipalIdentityParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewPcloudPlacementgroupsMembersDeleteParamsWithContext(ctx context.Context) *PcloudPlacementgroupsMembersDeleteParams {\n\treturn &PcloudPlacementgroupsMembersDeleteParams{\n\t\tContext: ctx,\n\t}\n}", "func (c *SageMaker) DeleteEndpointWithContext(ctx aws.Context, input *DeleteEndpointInput, opts ...request.Option) (*DeleteEndpointOutput, error) {\n\treq, out := c.DeleteEndpointRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (c *Proton) DeleteServiceTemplateVersionWithContext(ctx aws.Context, input *DeleteServiceTemplateVersionInput, opts ...request.Option) (*DeleteServiceTemplateVersionOutput, error) {\n\treq, out := c.DeleteServiceTemplateVersionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (o *ReposDeleteParams) WithContext(ctx context.Context) *ReposDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewDeleteTagParams() *DeleteTagParams {\n\tvar ()\n\treturn &DeleteTagParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteSubnetParams() *DeleteSubnetParams {\n\tvar ()\n\treturn &DeleteSubnetParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteSupportUserParamsWithContext(ctx context.Context) *DeleteSupportUserParams {\n\tvar ()\n\treturn &DeleteSupportUserParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteProtocolUsingDELETEParams() *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteProtectedEntityParamsWithContext(ctx context.Context) *DeleteProtectedEntityParams {\n\treturn &DeleteProtectedEntityParams{\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteFreeIpaByEnvironmentV1ParamsWithContext(ctx context.Context) *DeleteFreeIpaByEnvironmentV1Params {\n\tvar (\n\t\tforcedDefault = bool(false)\n\t)\n\treturn &DeleteFreeIpaByEnvironmentV1Params{\n\t\tForced: &forcedDefault,\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteChartrepoRepoChartsNameVersionLabelsIDParamsWithContext(ctx context.Context) *DeleteChartrepoRepoChartsNameVersionLabelsIDParams {\n\tvar ()\n\treturn &DeleteChartrepoRepoChartsNameVersionLabelsIDParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (c *ManagedBlockchain) DeleteMemberWithContext(ctx aws.Context, input *DeleteMemberInput, opts ...request.Option) (*DeleteMemberOutput, error) {\n\treq, out := c.DeleteMemberRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewDeleteBlueprintsInWorkspaceParamsWithContext(ctx context.Context) *DeleteBlueprintsInWorkspaceParams {\n\tvar ()\n\treturn &DeleteBlueprintsInWorkspaceParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (c *Krds) DeleteDBInstanceWithContext(ctx aws.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {\n\treq, out := c.DeleteDBInstanceRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) WithContext(ctx context.Context) *DeleteGerritListenerByIDUsingDELETEParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (c *DataExchange) DeleteRevisionWithContext(ctx aws.Context, input *DeleteRevisionInput, opts ...request.Option) (*DeleteRevisionOutput, error) {\n\treq, out := c.DeleteRevisionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (c *Proton) DeleteDeploymentWithContext(ctx aws.Context, input *DeleteDeploymentInput, opts ...request.Option) (*DeleteDeploymentOutput, error) {\n\treq, out := c.DeleteDeploymentRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewDeleteSiteDeployParamsWithContext(ctx context.Context) *DeleteSiteDeployParams {\n\tvar ()\n\treturn &DeleteSiteDeployParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteAttributeParamsWithContext(ctx context.Context) *DeleteAttributeParams {\n\tvar ()\n\treturn &DeleteAttributeParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (c *SMS) DeleteAppValidationConfigurationWithContext(ctx aws.Context, input *DeleteAppValidationConfigurationInput, opts ...request.Option) (*DeleteAppValidationConfigurationOutput, error) {\n\treq, out := c.DeleteAppValidationConfigurationRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (c *EFS) DeleteAccessPointWithContext(ctx aws.Context, input *DeleteAccessPointInput, opts ...request.Option) (*DeleteAccessPointOutput, error) {\n\treq, out := c.DeleteAccessPointRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (s *ProjectService) NewDeleteProjectInvitationParams(id string) *DeleteProjectInvitationParams {\n\tp := &DeleteProjectInvitationParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func NewServiceInstanceDeprovisionParamsWithContext(ctx context.Context) *ServiceInstanceDeprovisionParams {\n\treturn &ServiceInstanceDeprovisionParams{\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteUsingDELETE1ParamsWithContext(ctx context.Context) *DeleteUsingDELETE1Params {\n\treturn &DeleteUsingDELETE1Params{\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteDataSourceParams() *DeleteDataSourceParams {\n\treturn &DeleteDataSourceParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (c *MediaTailor) DeleteVodSourceWithContext(ctx aws.Context, input *DeleteVodSourceInput, opts ...request.Option) (*DeleteVodSourceOutput, error) {\n\treq, out := c.DeleteVodSourceRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewDeleteClusterParamsWithContext(ctx context.Context) *DeleteClusterParams {\n\tvar ()\n\treturn &DeleteClusterParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (l *Libvirt) NwfilterBindingDelete(OptNwfilter NwfilterBinding) (err error) {\n\tvar buf []byte\n\n\targs := NwfilterBindingDeleteArgs {\n\t\tOptNwfilter: OptNwfilter,\n\t}\n\n\tbuf, err = encode(&args)\n\tif err != nil {\n\t\treturn\n\t}\n\n\n\t_, err = l.requestStream(400, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func NewDeletePacketCapturesParamsWithContext(ctx context.Context) *DeletePacketCapturesParams {\n\treturn &DeletePacketCapturesParams{\n\t\tContext: ctx,\n\t}\n}", "func (c *MediaTailor) DeleteProgramWithContext(ctx aws.Context, input *DeleteProgramInput, opts ...request.Option) (*DeleteProgramOutput, error) {\n\treq, out := c.DeleteProgramRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewAPIDeleteUserParamsWithContext(ctx context.Context) *APIDeleteUserParams {\n\tvar ()\n\treturn &APIDeleteUserParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (c *SageMaker) DeleteHubWithContext(ctx aws.Context, input *DeleteHubInput, opts ...request.Option) (*DeleteHubOutput, error) {\n\treq, out := c.DeleteHubRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewDeleteAlertingProfileParams() *DeleteAlertingProfileParams {\n\tvar ()\n\treturn &DeleteAlertingProfileParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *ComponentDeleteParams) WithContext(ctx context.Context) *ComponentDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (a *AgentApplications) AgentApplicationDeleteWithContext(\n\tctx context.Context,\n\tgUID common.EntityGUID,\n) (*AgentApplicationDeleteResult, error) {\n\n\tresp := AgentApplicationDeleteQueryResponse{}\n\tvars := map[string]interface{}{\n\t\t\"guid\": gUID,\n\t}\n\n\tif err := a.client.NerdGraphQueryWithContext(ctx, AgentApplicationDeleteMutation, vars, &resp); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &resp.AgentApplicationDeleteResult, nil\n}", "func NewDeleteGerritListenerByIDUsingDELETEParams() *DeleteGerritListenerByIDUsingDELETEParams {\n\treturn &DeleteGerritListenerByIDUsingDELETEParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}" ]
[ "0.7681622", "0.74235815", "0.72549915", "0.64245224", "0.64204115", "0.6269961", "0.6203132", "0.6025189", "0.5897464", "0.58345693", "0.5770824", "0.56995344", "0.5696491", "0.5662892", "0.5658423", "0.56506205", "0.5478355", "0.5402012", "0.52876925", "0.5245509", "0.52265286", "0.52099", "0.51830506", "0.517366", "0.51692003", "0.5150724", "0.50877887", "0.5074468", "0.49866664", "0.49864656", "0.49839363", "0.49492243", "0.49415523", "0.4917708", "0.49026346", "0.48878482", "0.48812044", "0.48761833", "0.48604572", "0.48478448", "0.483371", "0.48116073", "0.47898918", "0.47713333", "0.47653925", "0.47573015", "0.47454938", "0.47359416", "0.47353134", "0.47332257", "0.4732282", "0.47276148", "0.47193727", "0.47078702", "0.47001445", "0.46989414", "0.46978793", "0.46884125", "0.46883407", "0.4671885", "0.46530566", "0.46422774", "0.46236676", "0.46154645", "0.45949158", "0.45919162", "0.45625895", "0.45496508", "0.45482358", "0.45429456", "0.4541815", "0.4531058", "0.45200184", "0.45087072", "0.45006028", "0.44920585", "0.44817433", "0.44759876", "0.44746917", "0.44725296", "0.44719264", "0.44547108", "0.44529408", "0.44512987", "0.44483542", "0.443887", "0.44350678", "0.4434614", "0.44330522", "0.44279858", "0.44226983", "0.4419553", "0.44194242", "0.44177222", "0.44144952", "0.44137713", "0.44114158", "0.440286", "0.44008464", "0.43984833" ]
0.883239
0
NewVvolBindingDeleteParamsWithHTTPClient creates a new VvolBindingDeleteParams object with the ability to set a custom HTTPClient for a request.
func NewVvolBindingDeleteParamsWithHTTPClient(client *http.Client) *VvolBindingDeleteParams { return &VvolBindingDeleteParams{ HTTPClient: client, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewVvolBindingDeleteParams() *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewVolumeDeleteParamsWithHTTPClient(client *http.Client) *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\t\tHTTPClient: client,\n\t}\n}", "func (o *VvolBindingDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewDeleteTagParamsWithHTTPClient(client *http.Client) *DeleteTagParams {\n\tvar ()\n\treturn &DeleteTagParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeletePackageVersionParamsWithHTTPClient(client *http.Client) *DeletePackageVersionParams {\n\tvar ()\n\treturn &DeletePackageVersionParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *VolumeDeleteParams) WithHTTPClient(client *http.Client) *VolumeDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewComponentDeleteParamsWithHTTPClient(client *http.Client) *ComponentDeleteParams {\n\treturn &ComponentDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteLoadBalancerPoolParamsWithHTTPClient(client *http.Client) *DeleteLoadBalancerPoolParams {\n\tvar ()\n\treturn &DeleteLoadBalancerPoolParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteProtocolUsingDELETEParams) WithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteProtocolUsingDELETEParamsWithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteDataSourceParamsWithHTTPClient(client *http.Client) *DeleteDataSourceParams {\n\treturn &DeleteDataSourceParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithContext(ctx context.Context) *VvolBindingDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewDeleteConditionParamsWithHTTPClient(client *http.Client) *DeleteConditionParams {\n\tvar ()\n\treturn &DeleteConditionParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteSubnetParamsWithHTTPClient(client *http.Client) *DeleteSubnetParams {\n\tvar ()\n\treturn &DeleteSubnetParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteVersionControlRequestParamsWithHTTPClient(client *http.Client) *DeleteVersionControlRequestParams {\n\treturn &DeleteVersionControlRequestParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteLoadBalancerPoolParams) WithHTTPClient(client *http.Client) *DeleteLoadBalancerPoolParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteNodeParamsWithHTTPClient(client *http.Client) *DeleteNodeParams {\n\tvar ()\n\treturn &DeleteNodeParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteSubscribedEventParamsWithHTTPClient(client *http.Client) *DeleteSubscribedEventParams {\n\tvar ()\n\treturn &DeleteSubscribedEventParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *ComponentDeleteParams) WithHTTPClient(client *http.Client) *ComponentDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *ReposDeleteParams) WithHTTPClient(client *http.Client) *ReposDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewRevokeDeviceCertificateUsingDELETEParamsWithHTTPClient(client *http.Client) *RevokeDeviceCertificateUsingDELETEParams {\n\tvar ()\n\treturn &RevokeDeviceCertificateUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteVersionControlRequestParams) WithHTTPClient(client *http.Client) *DeleteVersionControlRequestParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteKeyPairsParams) WithHTTPClient(client *http.Client) *DeleteKeyPairsParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewLedgerVoucherAttachmentDeleteAttachmentParamsWithHTTPClient(client *http.Client) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\tvar (\n\t\tsendToInboxDefault = bool(false)\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherAttachmentDeleteAttachmentParams{\n\t\tSendToInbox: &sendToInboxDefault,\n\t\tSplit: &splitDefault,\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeletePoolProjectParamsWithHTTPClient(client *http.Client) *DeletePoolProjectParams {\n\tvar ()\n\treturn &DeletePoolProjectParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteDebugRequestParams) WithHTTPClient(client *http.Client) *DeleteDebugRequestParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteTagParams) WithHTTPClient(client *http.Client) *DeleteTagParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewReposDeleteParamsWithHTTPClient(client *http.Client) *ReposDeleteParams {\n\tvar ()\n\treturn &ReposDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteNamespaceParamsWithHTTPClient(client *http.Client) *DeleteNamespaceParams {\n\tvar ()\n\treturn &DeleteNamespaceParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteAttributeParamsWithHTTPClient(client *http.Client) *DeleteAttributeParams {\n\tvar ()\n\treturn &DeleteAttributeParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteConditionParams) WithHTTPClient(client *http.Client) *DeleteConditionParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteNetworkGroupPolicyParamsWithHTTPClient(client *http.Client) *DeleteNetworkGroupPolicyParams {\n\tvar ()\n\treturn &DeleteNetworkGroupPolicyParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeletePoolProjectParams) WithHTTPClient(client *http.Client) *DeletePoolProjectParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteKeyPairsParamsWithHTTPClient(client *http.Client) *DeleteKeyPairsParams {\n\tvar ()\n\treturn &DeleteKeyPairsParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithDefaults() *VvolBindingDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func NewEntryServiceDeleteParamsWithHTTPClient(client *http.Client) *EntryServiceDeleteParams {\n\tvar ()\n\treturn &EntryServiceDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteCwfNetworkIDParamsWithHTTPClient(client *http.Client) *DeleteCwfNetworkIDParams {\n\tvar ()\n\treturn &DeleteCwfNetworkIDParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteDeviceUsingDELETEParamsWithHTTPClient(client *http.Client) *DeleteDeviceUsingDELETEParams {\n\tvar ()\n\treturn &DeleteDeviceUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeletePackageVersionParams) WithHTTPClient(client *http.Client) *DeletePackageVersionParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) WithHTTPClient(client *http.Client) *DeleteBlueprintRequestUsingDELETE1Params {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteClusterParamsWithHTTPClient(client *http.Client) *DeleteClusterParams {\n\tvar ()\n\treturn &DeleteClusterParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *VolumeDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteProtocolUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) WithHTTPClient(client *http.Client) *DeleteGerritListenerByIDUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewAPIDeleteUserParamsWithHTTPClient(client *http.Client) *APIDeleteUserParams {\n\tvar ()\n\treturn &APIDeleteUserParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteBlueprintsInWorkspaceParamsWithHTTPClient(client *http.Client) *DeleteBlueprintsInWorkspaceParams {\n\tvar ()\n\treturn &DeleteBlueprintsInWorkspaceParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteDebugRequestParamsWithHTTPClient(client *http.Client) *DeleteDebugRequestParams {\n\tvar ()\n\treturn &DeleteDebugRequestParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) WithHTTPClient(client *http.Client) *RevokeDeviceCertificateUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteSubscribedEventParams) WithHTTPClient(client *http.Client) *DeleteSubscribedEventParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteScheduleParamsWithHTTPClient(client *http.Client) *DeleteScheduleParams {\n\tvar ()\n\treturn &DeleteScheduleParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteUserAttributeParamsWithHTTPClient(client *http.Client) *DeleteUserAttributeParams {\n\tvar ()\n\treturn &DeleteUserAttributeParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteDeviceUsingDELETEParams) WithHTTPClient(client *http.Client) *DeleteDeviceUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteSubnetsSubnetPoolParamsWithHTTPClient(client *http.Client) *DeleteSubnetsSubnetPoolParams {\n\tvar ()\n\treturn &DeleteSubnetsSubnetPoolParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteDataSourceParams) WithHTTPClient(client *http.Client) *DeleteDataSourceParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteNetworkGroupPolicyParams) WithHTTPClient(client *http.Client) *DeleteNetworkGroupPolicyParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteCwfNetworkIDParams) WithHTTPClient(client *http.Client) *DeleteCwfNetworkIDParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) WithHTTPClient(client *http.Client) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewOrderDeleteParamsWithHTTPClient(client *http.Client) *OrderDeleteParams {\n\treturn &OrderDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *BundleProductOptionRepositoryV1DeleteByIDDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewDeletePacketCapturesParamsWithHTTPClient(client *http.Client) *DeletePacketCapturesParams {\n\treturn &DeletePacketCapturesParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteNodeParams) WithHTTPClient(client *http.Client) *DeleteNodeParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteSubnetParams) WithHTTPClient(client *http.Client) *DeleteSubnetParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *EntryServiceDeleteParams) WithHTTPClient(client *http.Client) *EntryServiceDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *OrderDeleteParams) WithHTTPClient(client *http.Client) *OrderDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteSupportUserParamsWithHTTPClient(client *http.Client) *DeleteSupportUserParams {\n\tvar ()\n\treturn &DeleteSupportUserParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteGerritListenerByIDUsingDELETEParamsWithHTTPClient(client *http.Client) *DeleteGerritListenerByIDUsingDELETEParams {\n\treturn &DeleteGerritListenerByIDUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteProtocolUsingDELETEParams() *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewStreamsDeleteParamsWithHTTPClient(client *http.Client) *StreamsDeleteParams {\n\tvar ()\n\treturn &StreamsDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteDeviceUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteAttributeParams) WithHTTPClient(client *http.Client) *DeleteAttributeParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteProtocolUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewNvmeNamespaceDeleteParamsWithHTTPClient(client *http.Client) *NvmeNamespaceDeleteParams {\n\treturn &NvmeNamespaceDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewRemoveGKECredentialParamsWithHTTPClient(client *http.Client) *RemoveGKECredentialParams {\n\tvar ()\n\treturn &RemoveGKECredentialParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteSiteSnippetParamsWithHTTPClient(client *http.Client) *DeleteSiteSnippetParams {\n\tvar ()\n\treturn &DeleteSiteSnippetParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeletePacketCapturesParams) WithHTTPClient(client *http.Client) *DeletePacketCapturesParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewVolumeDeleteParams() *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteBlueprintRequestUsingDELETE1ParamsWithHTTPClient(client *http.Client) *DeleteBlueprintRequestUsingDELETE1Params {\n\treturn &DeleteBlueprintRequestUsingDELETE1Params{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteUsingDELETE1ParamsWithHTTPClient(client *http.Client) *DeleteUsingDELETE1Params {\n\treturn &DeleteUsingDELETE1Params{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteProtectedEntityParamsWithHTTPClient(client *http.Client) *DeleteProtectedEntityParams {\n\treturn &DeleteProtectedEntityParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *APIDeleteUserParams) WithHTTPClient(client *http.Client) *APIDeleteUserParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteNtpServerParamsWithHTTPClient(client *http.Client) *DeleteNtpServerParams {\n\tvar ()\n\treturn &DeleteNtpServerParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteUsingDELETE1Params) WithHTTPClient(client *http.Client) *DeleteUsingDELETE1Params {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteAlertingProfileParams) WithHTTPClient(client *http.Client) *DeleteAlertingProfileParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteBlueprintsInWorkspaceParams) WithHTTPClient(client *http.Client) *DeleteBlueprintsInWorkspaceParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteRolesParamsWithHTTPClient(client *http.Client) *DeleteRolesParams {\n\tvar ()\n\treturn &DeleteRolesParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteSubnetsSubnetPoolParams) WithHTTPClient(client *http.Client) *DeleteSubnetsSubnetPoolParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *PcloudPlacementgroupsMembersDeleteParams) WithHTTPClient(client *http.Client) *PcloudPlacementgroupsMembersDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *SalesRuleCouponRepositoryV1DeleteByIDDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteScheduleParams) WithHTTPClient(client *http.Client) *DeleteScheduleParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *ComponentDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteClusterParams) WithHTTPClient(client *http.Client) *DeleteClusterParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteLoadBalancerPoolParams() *DeleteLoadBalancerPoolParams {\n\tvar ()\n\treturn &DeleteLoadBalancerPoolParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *ReposDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteV1WebhooksWebhookIDParams) WithHTTPClient(client *http.Client) *DeleteV1WebhooksWebhookIDParams {\n\to.SetHTTPClient(client)\n\treturn o\n}" ]
[ "0.8671437", "0.7384527", "0.7372792", "0.73189396", "0.7087894", "0.7058488", "0.6999345", "0.6938914", "0.69215393", "0.68205565", "0.68110675", "0.66864115", "0.66708326", "0.6662493", "0.6658155", "0.6491086", "0.647839", "0.6460584", "0.6460478", "0.6459379", "0.6436317", "0.63970274", "0.63960826", "0.63942814", "0.6389403", "0.63448125", "0.6336681", "0.6322259", "0.6316526", "0.6315967", "0.63104373", "0.6297815", "0.6293162", "0.62880415", "0.62824136", "0.6279546", "0.62461835", "0.62439364", "0.6092158", "0.6086753", "0.6066708", "0.6059862", "0.6046913", "0.60341376", "0.60134166", "0.6012363", "0.6008188", "0.6001543", "0.5980709", "0.5971419", "0.59650445", "0.5950939", "0.5920226", "0.5898683", "0.58887684", "0.5881838", "0.5873334", "0.5862811", "0.58543694", "0.5834226", "0.5830794", "0.5808356", "0.57878876", "0.5776445", "0.57745576", "0.57618535", "0.5760971", "0.5758706", "0.5749976", "0.5735061", "0.5731118", "0.5730668", "0.5714963", "0.5682656", "0.56826276", "0.56816417", "0.56755346", "0.5668115", "0.5667705", "0.56593746", "0.56554055", "0.56552356", "0.56537586", "0.56036776", "0.5600982", "0.5597073", "0.55906636", "0.55878353", "0.55858535", "0.556664", "0.55384696", "0.5536385", "0.55346876", "0.55235815", "0.55163616", "0.5515517", "0.5511289", "0.5508245", "0.5505844", "0.54983914" ]
0.85762304
1
WithDefaults hydrates default values in the vvol binding delete params (not the query body). All values with no default are reset to their zero value.
func (o *VvolBindingDeleteParams) WithDefaults() *VvolBindingDeleteParams { o.SetDefaults() return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) SetDefaults() {\n\tvar (\n\t\tdeleteAllReferencesDefault = bool(false)\n\t)\n\n\tval := VvolBindingDeleteParams{\n\t\tDeleteAllReferences: &deleteAllReferencesDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *DeleteUsingDELETE1Params) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ComponentDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *OrderDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *NvmeNamespaceDeleteParams) SetDefaults() {\n\tvar (\n\t\tallowDeleteWhileMappedDefault = bool(false)\n\t)\n\n\tval := NvmeNamespaceDeleteParams{\n\t\tAllowDeleteWhileMapped: &allowDeleteWhileMappedDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *DeleteVersionControlRequestParams) SetDefaults() {\n\tvar (\n\t\tdisconnectedNodeAcknowledgedDefault = bool(false)\n\t)\n\n\tval := DeleteVersionControlRequestParams{\n\t\tDisconnectedNodeAcknowledged: &disconnectedNodeAcknowledgedDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) WithDefaults() *DeleteBlueprintRequestUsingDELETE1Params {\n\to.SetDefaults()\n\treturn o\n}", "func (o *DeleteV1WebhooksWebhookIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteProtectedEntityParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteDataSourceParams) SetDefaults() {\n\tvar (\n\t\tencryptionModeDefault = string(\"CLEAR\")\n\n\t\tstorageTypeDefault = string(\"LOCAL\")\n\t)\n\n\tval := DeleteDataSourceParams{\n\t\tEncryptionMode: &encryptionModeDefault,\n\t\tStorageType: &storageTypeDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *DeleteUsingDELETE1Params) WithDefaults() *DeleteUsingDELETE1Params {\n\to.SetDefaults()\n\treturn o\n}", "func (o *DeleteVersionControlRequestParams) WithDefaults() *DeleteVersionControlRequestParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *DeletePacketCapturesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ServiceInstanceDeprovisionParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *EmsDestinationDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostHostStorageSectorsDeleteMerklerootParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *RemoveDropRequestParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteReadonlyClusterParams) SetDefaults() {\n\tvar (\n\t\tisForceDeleteDefault = bool(false)\n\t)\n\n\tval := DeleteReadonlyClusterParams{\n\t\tIsForceDelete: &isForceDeleteDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (config *DeleteConfig) Default() {\r\n\tconfig.CaseName = \"*\" // default: delete from all cases\r\n\tconfig.Endpoint = \"\" // default detele single endpoint\r\n\tconfig.EndpointList = nil // Used if need to delete more than one endpoint\r\n}", "func (o *ComponentDeleteParams) WithDefaults() *ComponentDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *DeleteDataSourceParams) WithDefaults() *DeleteDataSourceParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *DeletePacketCapturesParams) WithDefaults() *DeletePacketCapturesParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *DeleteProtectedEntityParams) WithDefaults() *DeleteProtectedEntityParams {\n\to.SetDefaults()\n\treturn o\n}", "func (client IdentityClient) deleteTagDefault(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodDelete, \"/tagDefaults/{tagDefaultId}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response DeleteTagDefaultResponse\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}", "func (o *PcloudPlacementgroupsMembersDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteDevicesDeviceidInterfacesInterfacenameParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ServiceBindingBindingParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *UsersGroupsBulkDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *NvmeNamespaceDeleteParams) WithDefaults() *NvmeNamespaceDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *FreezeParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetIngredientVersionRevisionParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *QueryFirewallFieldsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *QuerySensorUpdateKernelsDistinctParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetGdprClientsIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetPropertyDescriptorParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteV1WebhooksWebhookIDParams) WithDefaults() *DeleteV1WebhooksWebhookIDParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *QueryChangesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetGCParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func DeleteOptionDefaults() DeleteOptions {\n\treturn DeleteOptions{\n\t\tWithDeleteNamespace(\"default\"),\n\t}\n}", "func (o *GetBundleByKeyParams) SetDefaults() {\n\tvar (\n\t\tauditDefault = string(\"NONE\")\n\n\t\tincludedDeletedDefault = bool(false)\n\t)\n\n\tval := GetBundleByKeyParams{\n\t\tAudit: &auditDefault,\n\t\tIncludedDeleted: &includedDeletedDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *OrderDeleteParams) WithDefaults() *OrderDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *BudgetAddParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PcloudCloudinstancesVolumesGetallParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *TestEndpointParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) WithDefaults() *DeleteGerritListenerByIDUsingDELETEParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *GetGatewaysParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *RemoveUserGroupParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *StorageServiceOwnershipGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PetListParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *CapacityPoolGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ServiceInstanceGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteUserMetaTagsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ConfigurationBackupGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetRelationTuplesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ListHetznerSizesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *SearchIngredientsParams) SetDefaults() {\n\tvar (\n\t\tallowDeletedDefault = bool(false)\n\n\t\tallowUnstableDefault = bool(false)\n\n\t\texactOnlyDefault = bool(false)\n\n\t\tlimitDefault = int64(50)\n\n\t\toffsetDefault = int64(0)\n\n\t\tqDefault = string(\"\")\n\t)\n\n\tval := SearchIngredientsParams{\n\t\tAllowDeleted: &allowDeletedDefault,\n\t\tAllowUnstable: &allowUnstableDefault,\n\t\tExactOnly: &exactOnlyDefault,\n\t\tLimit: &limitDefault,\n\t\tOffset: &offsetDefault,\n\t\tQ: &qDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *ConfigGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteAPIRootDomainsDeleteSubdomiansTargetNameRootDomainNameParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (table *Table) DefaultDelete(c Context) (Result, error) {\n\tquery, args, err := table.WherePrimaryKey(false, false, c.Record)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tquery = fmt.Sprintf(\"DELETE FROM %s WHERE %s\", table.Name, query)\n\trst, err := c.DB.Exec(query, args...)\n\treturn NewResult(Context{StateDelete, c.DB, c.DataSet, table, c.Record, Field{}}, rst), err\n}", "func (o *PostDeviceUpsertParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetRouteByIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteAddressesDefault) WithPayload(payload *models.ErrorResponse) *DeleteAddressesDefault {\n\to.Payload = payload\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DeleteAllReferences != nil {\n\n\t\t// query param delete_all_references\n\t\tvar qrDeleteAllReferences bool\n\n\t\tif o.DeleteAllReferences != nil {\n\t\t\tqrDeleteAllReferences = *o.DeleteAllReferences\n\t\t}\n\t\tqDeleteAllReferences := swag.FormatBool(qrDeleteAllReferences)\n\t\tif qDeleteAllReferences != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"delete_all_references\", qDeleteAllReferences); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param protocol_endpoint.uuid\n\tif err := r.SetPathParam(\"protocol_endpoint.uuid\", o.ProtocolEndpointUUID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vvol.uuid\n\tif err := r.SetPathParam(\"vvol.uuid\", o.VvolUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *EditParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func DefaultParams() Params {\n\treturn NewParams(\n\t\tDefaultCreateWhoisPrice,\n\t\tDefaultUpdateWhoisPrice,\n\t\tDefaultDeleteWhoisPrice,\n\t)\n}", "func (o *VectorThumbnailParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ServiceInstanceDeprovisionParams) WithDefaults() *ServiceInstanceDeprovisionParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *GetComponentByIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostAlertsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteConsulDefault) WithPayload(payload *models.Error) *DeleteConsulDefault {\n\to.Payload = payload\n\treturn o\n}", "func (o *GetDeploymentByIDV3UsingGETParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetProxiesHealthParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *SyncStatusUsingGETParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *SendJobCommandParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetDevicesUnknownParams) SetDefaults() {\n\tvar (\n\t\tminTrafficDefault = float64(102400)\n\t)\n\n\tval := GetDevicesUnknownParams{\n\t\tMinTraffic: &minTrafficDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *DeleteV1SeverityMatrixImpactsImpactIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (xdc *XxxDemoCreate) defaults() {\n\tif _, ok := xdc.mutation.IsDel(); !ok {\n\t\tv := xxxdemo.DefaultIsDel\n\t\txdc.mutation.SetIsDel(v)\n\t}\n\tif _, ok := xdc.mutation.Memo(); !ok {\n\t\tv := xxxdemo.DefaultMemo\n\t\txdc.mutation.SetMemo(v)\n\t}\n\tif _, ok := xdc.mutation.Sort(); !ok {\n\t\tv := xxxdemo.DefaultSort\n\t\txdc.mutation.SetSort(v)\n\t}\n\tif _, ok := xdc.mutation.CreatedAt(); !ok {\n\t\tv := xxxdemo.DefaultCreatedAt()\n\t\txdc.mutation.SetCreatedAt(v)\n\t}\n\tif _, ok := xdc.mutation.UpdatedAt(); !ok {\n\t\tv := xxxdemo.DefaultUpdatedAt()\n\t\txdc.mutation.SetUpdatedAt(v)\n\t}\n\tif _, ok := xdc.mutation.Status(); !ok {\n\t\tv := xxxdemo.DefaultStatus\n\t\txdc.mutation.SetStatus(v)\n\t}\n\tif _, ok := xdc.mutation.ID(); !ok {\n\t\tv := xxxdemo.DefaultID()\n\t\txdc.mutation.SetID(v)\n\t}\n}", "func (o *ToggleNetworkGeneratorsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DcimRacksListParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *RemoveDropRequestParams) WithDefaults() *RemoveDropRequestParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *PetCreateParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ServiceBrokerOpenstacksHostsGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostHostStorageSectorsDeleteMerklerootParams) WithDefaults() *PostHostStorageSectorsDeleteMerklerootParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *GetDistrictForSchoolParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ListSSHKeysParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (kcu *K8sContainerUpdate) defaults() {\n\tif _, ok := kcu.mutation.UpdatedAt(); !ok {\n\t\tv := k8scontainer.UpdateDefaultUpdatedAt()\n\t\tkcu.mutation.SetUpdatedAt(v)\n\t}\n\tif _, ok := kcu.mutation.DeletedAt(); !ok {\n\t\tv := k8scontainer.UpdateDefaultDeletedAt()\n\t\tkcu.mutation.SetDeletedAt(v)\n\t}\n}", "func (o *UpdateFlowParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PcloudSapGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PredictParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetCatalogXMLParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (client IdentityClient) DeleteTagDefault(ctx context.Context, request DeleteTagDefaultRequest) (response DeleteTagDefaultResponse, 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.deleteTagDefault, 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 = DeleteTagDefaultResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = DeleteTagDefaultResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(DeleteTagDefaultResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into DeleteTagDefaultResponse\")\n\t}\n\treturn\n}", "func (kcuo *K8sContainerUpdateOne) defaults() {\n\tif _, ok := kcuo.mutation.UpdatedAt(); !ok {\n\t\tv := k8scontainer.UpdateDefaultUpdatedAt()\n\t\tkcuo.mutation.SetUpdatedAt(v)\n\t}\n\tif _, ok := kcuo.mutation.DeletedAt(); !ok {\n\t\tv := k8scontainer.UpdateDefaultDeletedAt()\n\t\tkcuo.mutation.SetDeletedAt(v)\n\t}\n}", "func (o *RTRExecuteActiveResponderCommandParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *BucketsCollectionGetParams) SetDefaults() {\n\tvar (\n\t\treturnRecordsDefault = bool(true)\n\n\t\treturnTimeoutDefault = int64(15)\n\t)\n\n\tval := BucketsCollectionGetParams{\n\t\tReturnRecords: &returnRecordsDefault,\n\t\tReturnTimeout: &returnTimeoutDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func DefaultParams() Params {\n\tacl := ACL(make([]ACLPair, 0))\n\tu := NewUpgrade(0, \"\")\n\treturn Params{\n\t\tACL: acl,\n\t\tDAOOwner: sdk.Address{},\n\t\tUpgrade: u,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithDeleteAllReferences(deleteAllReferences *bool) *VvolBindingDeleteParams {\n\to.SetDeleteAllReferences(deleteAllReferences)\n\treturn o\n}", "func (o *V2DeregisterClusterParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *CreateMigrationInvoiceParams) SetDefaults() {\n\t// no default values defined for this parameter\n}" ]
[ "0.8024694", "0.69307846", "0.6919275", "0.68561697", "0.68067634", "0.6789882", "0.6783438", "0.6654979", "0.65403056", "0.64354616", "0.6425076", "0.6423718", "0.63207895", "0.6310937", "0.62996227", "0.6297419", "0.6264217", "0.6254231", "0.624768", "0.6148051", "0.60388494", "0.6012384", "0.5956311", "0.59305555", "0.58641547", "0.58582264", "0.5846466", "0.58085257", "0.57567585", "0.5746949", "0.57467264", "0.57295346", "0.5717134", "0.57142735", "0.5706435", "0.5659719", "0.5657857", "0.5609161", "0.55923116", "0.5590901", "0.5586508", "0.55653846", "0.55530757", "0.55310476", "0.5485754", "0.5470397", "0.5431576", "0.5428443", "0.5426604", "0.5414084", "0.5412581", "0.5404402", "0.5403203", "0.5400778", "0.53993726", "0.5383455", "0.53698677", "0.53668857", "0.53653777", "0.53583443", "0.5357834", "0.5351725", "0.5351045", "0.5350642", "0.53472704", "0.5342387", "0.53358227", "0.53302574", "0.5329718", "0.53236544", "0.53046924", "0.5300839", "0.5299261", "0.5288364", "0.527947", "0.5258427", "0.5254454", "0.52418596", "0.5235531", "0.52354777", "0.5233771", "0.52337676", "0.523081", "0.52288467", "0.5227181", "0.5224047", "0.5222722", "0.5212543", "0.52108693", "0.52094275", "0.5207534", "0.51987344", "0.5193591", "0.5182554", "0.5178325", "0.5171396", "0.5171165", "0.5169184", "0.51648587", "0.5162138" ]
0.7161946
1
SetDefaults hydrates default values in the vvol binding delete params (not the query body). All values with no default are reset to their zero value.
func (o *VvolBindingDeleteParams) SetDefaults() { var ( deleteAllReferencesDefault = bool(false) ) val := VvolBindingDeleteParams{ DeleteAllReferences: &deleteAllReferencesDefault, } val.timeout = o.timeout val.Context = o.Context val.HTTPClient = o.HTTPClient *o = val }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *DeleteBlueprintRequestUsingDELETE1Params) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ComponentDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteUsingDELETE1Params) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *OrderDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *NvmeNamespaceDeleteParams) SetDefaults() {\n\tvar (\n\t\tallowDeleteWhileMappedDefault = bool(false)\n\t)\n\n\tval := NvmeNamespaceDeleteParams{\n\t\tAllowDeleteWhileMapped: &allowDeleteWhileMappedDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *DeleteVersionControlRequestParams) SetDefaults() {\n\tvar (\n\t\tdisconnectedNodeAcknowledgedDefault = bool(false)\n\t)\n\n\tval := DeleteVersionControlRequestParams{\n\t\tDisconnectedNodeAcknowledged: &disconnectedNodeAcknowledgedDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *DeleteDataSourceParams) SetDefaults() {\n\tvar (\n\t\tencryptionModeDefault = string(\"CLEAR\")\n\n\t\tstorageTypeDefault = string(\"LOCAL\")\n\t)\n\n\tval := DeleteDataSourceParams{\n\t\tEncryptionMode: &encryptionModeDefault,\n\t\tStorageType: &storageTypeDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *DeleteProtectedEntityParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteV1WebhooksWebhookIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeletePacketCapturesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ServiceInstanceDeprovisionParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostHostStorageSectorsDeleteMerklerootParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *RemoveDropRequestParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *EmsDestinationDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteReadonlyClusterParams) SetDefaults() {\n\tvar (\n\t\tisForceDeleteDefault = bool(false)\n\t)\n\n\tval := DeleteReadonlyClusterParams{\n\t\tIsForceDelete: &isForceDeleteDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *UsersGroupsBulkDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *FreezeParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetPropertyDescriptorParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ServiceBindingBindingParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetIngredientVersionRevisionParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *VvolBindingDeleteParams) WithDefaults() *VvolBindingDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *DeleteDevicesDeviceidInterfacesInterfacenameParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *QueryFirewallFieldsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) WithDefaults() *DeleteBlueprintRequestUsingDELETE1Params {\n\to.SetDefaults()\n\treturn o\n}", "func (o *GetGCParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ConfigurationBackupGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (tb *TriggerBinding) SetDefaults(ctx context.Context) {}", "func (o *ListHetznerSizesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetGatewaysParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PcloudPlacementgroupsMembersDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *QuerySensorUpdateKernelsDistinctParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *EditParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteUserMetaTagsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *BudgetAddParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *RemoveUserGroupParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetBundleByKeyParams) SetDefaults() {\n\tvar (\n\t\tauditDefault = string(\"NONE\")\n\n\t\tincludedDeletedDefault = bool(false)\n\t)\n\n\tval := GetBundleByKeyParams{\n\t\tAudit: &auditDefault,\n\t\tIncludedDeleted: &includedDeletedDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *TestEndpointParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *SetUniverseBackupFlagParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetGdprClientsIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ConfigGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *QueryChangesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *CreateMigrationInvoiceParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetProxiesHealthParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ToggleNetworkGeneratorsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostAlertsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ConfigurationBackupModifyParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *UpdateFlowParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PutGatewaysIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *SendJobCommandParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *VectorThumbnailParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostDeviceUpsertParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *RTRExecuteActiveResponderCommandParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *StorageServiceOwnershipGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostV1ServicesServiceLinksParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ListEtcdRestoreParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ListSSHKeysParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PredictParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteV1SeverityMatrixImpactsImpactIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetCatalogXMLParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PetListParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostReplicationPoliciesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetRelationTuplesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DcimRacksListParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ServiceInstanceGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetBackupLocationsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetRouteByIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteAPIRootDomainsDeleteSubdomiansTargetNameRootDomainNameParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *RegenerateDeployKeyParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetComponentByIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *UpdateComparisonReportParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *UpdateFolderParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *CapacityPoolGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *BatchUpsertCatalogObjectsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteUsingDELETE1Params) WithDefaults() *DeleteUsingDELETE1Params {\n\to.SetDefaults()\n\treturn o\n}", "func (o *PostDevicesDeviceidBackupsBackupidApplyParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetFqdnCacheParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ExtrasSavedFiltersListParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetOutagesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PetCreateParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ValidateParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteVersionControlRequestParams) WithDefaults() *DeleteVersionControlRequestParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *SearchIngredientsParams) SetDefaults() {\n\tvar (\n\t\tallowDeletedDefault = bool(false)\n\n\t\tallowUnstableDefault = bool(false)\n\n\t\texactOnlyDefault = bool(false)\n\n\t\tlimitDefault = int64(50)\n\n\t\toffsetDefault = int64(0)\n\n\t\tqDefault = string(\"\")\n\t)\n\n\tval := SearchIngredientsParams{\n\t\tAllowDeleted: &allowDeletedDefault,\n\t\tAllowUnstable: &allowUnstableDefault,\n\t\tExactOnly: &exactOnlyDefault,\n\t\tLimit: &limitDefault,\n\t\tOffset: &offsetDefault,\n\t\tQ: &qDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *GetDistrictForSchoolParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *V2DeregisterClusterParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ServiceBrokerOpenstacksHostsGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetDevicesUnknownParams) SetDefaults() {\n\tvar (\n\t\tminTrafficDefault = float64(102400)\n\t)\n\n\tval := GetDevicesUnknownParams{\n\t\tMinTraffic: &minTrafficDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *GetCurrentGenerationParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostV1CatalogsCatalogIDIngestParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *FetchIntegrationFormParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PcloudSapGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *WaitListParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostContextsAddPhpParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PutNmsUpdateParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (config *DeleteConfig) Default() {\r\n\tconfig.CaseName = \"*\" // default: delete from all cases\r\n\tconfig.Endpoint = \"\" // default detele single endpoint\r\n\tconfig.EndpointList = nil // Used if need to delete more than one endpoint\r\n}", "func (o *GetTasksGetPhpParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *RTRCheckAdminCommandStatusParams) SetDefaults() {\n\tvar (\n\t\tsequenceIDDefault = int64(0)\n\t)\n\n\tval := RTRCheckAdminCommandStatusParams{\n\t\tSequenceID: sequenceIDDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (kcu *K8sContainerUpdate) defaults() {\n\tif _, ok := kcu.mutation.UpdatedAt(); !ok {\n\t\tv := k8scontainer.UpdateDefaultUpdatedAt()\n\t\tkcu.mutation.SetUpdatedAt(v)\n\t}\n\tif _, ok := kcu.mutation.DeletedAt(); !ok {\n\t\tv := k8scontainer.UpdateDefaultDeletedAt()\n\t\tkcu.mutation.SetDeletedAt(v)\n\t}\n}" ]
[ "0.75364006", "0.75100535", "0.7508836", "0.74438876", "0.7425384", "0.729681", "0.7260536", "0.72358084", "0.7212591", "0.71349096", "0.71285725", "0.7104628", "0.7054597", "0.7035304", "0.697078", "0.6863822", "0.67509896", "0.6714793", "0.67139083", "0.6703411", "0.66607034", "0.6623859", "0.66021234", "0.65921557", "0.6572527", "0.6521013", "0.65193015", "0.65039045", "0.6495045", "0.6491504", "0.6487894", "0.6468901", "0.6467066", "0.6460907", "0.6454707", "0.6442284", "0.64396435", "0.6420461", "0.64119095", "0.6401026", "0.63962585", "0.6381976", "0.63818043", "0.6372911", "0.63682705", "0.63598377", "0.6359107", "0.6352658", "0.63448656", "0.6317265", "0.6315751", "0.63139856", "0.63030815", "0.62954146", "0.6277245", "0.62736607", "0.6267421", "0.62609166", "0.62594646", "0.6257717", "0.6257233", "0.62449193", "0.6236483", "0.6234443", "0.6229176", "0.62250406", "0.6220144", "0.6212632", "0.6211171", "0.6210533", "0.62082314", "0.62040067", "0.6202852", "0.6193654", "0.6173255", "0.6158375", "0.6157157", "0.61546177", "0.61363393", "0.6135296", "0.6126472", "0.6119994", "0.61066306", "0.6103761", "0.60918474", "0.6078725", "0.60731566", "0.60723615", "0.60564595", "0.60529476", "0.60517085", "0.60488623", "0.6046046", "0.60314435", "0.6017388", "0.60170895", "0.60166365", "0.6009942", "0.60007155", "0.599688" ]
0.84096485
0
WithTimeout adds the timeout to the vvol binding delete params
func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams { o.SetTimeout(timeout) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *VolumeDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *VolumeDeleteParams) WithTimeout(timeout time.Duration) *VolumeDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteProtocolUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (builder *TsDeleteRowCommandBuilder) WithTimeout(timeout time.Duration) *TsDeleteRowCommandBuilder {\n\ttimeoutMilliseconds := uint32(timeout / time.Millisecond)\n\tbuilder.timeout = timeout\n\tbuilder.protobuf.Timeout = &timeoutMilliseconds\n\treturn builder\n}", "func (o *DeletePackageVersionParams) WithTimeout(timeout time.Duration) *DeletePackageVersionParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewVolumeDeleteParamsWithTimeout(timeout time.Duration) *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteProtocolUsingDELETEParams) WithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteDeviceUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePackageVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewDeletePackageVersionParamsWithTimeout(timeout time.Duration) *DeletePackageVersionParams {\n\tvar ()\n\treturn &DeletePackageVersionParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *ComponentDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteUsingDELETE1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteVersionControlRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteTagParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteLoadBalancerPoolParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteDebugRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSubnetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteVersionControlRequestParams) WithTimeout(timeout time.Duration) *DeleteVersionControlRequestParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteConditionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteDataSourceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteTagParams) WithTimeout(timeout time.Duration) *DeleteTagParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteKeyPairsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePoolProjectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteBlueprintsInWorkspaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteKeyPairsParams) WithTimeout(timeout time.Duration) *DeleteKeyPairsParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteDebugRequestParams) WithTimeout(timeout time.Duration) *DeleteDebugRequestParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *BundleProductOptionRepositoryV1DeleteByIDDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteProtectedEntityParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *NodesDelTagByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EntryServiceDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteFreeIpaByEnvironmentV1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ReposDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ServiceInstanceDeprovisionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNodeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ComponentDeleteParams) WithTimeout(timeout time.Duration) *ComponentDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *OrderDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) WithTimeout(timeout time.Duration) *DeleteBlueprintRequestUsingDELETE1Params {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeletePoolProjectParams) WithTimeout(timeout time.Duration) *DeletePoolProjectParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteUsingDELETE1Params) WithTimeout(timeout time.Duration) *DeleteUsingDELETE1Params {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteMsgVpnRestDeliveryPointRestConsumerTLSTrustedCommonNameParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSubscribedEventParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePacketCapturesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteCwfNetworkIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RemoveGKECredentialParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteAttributeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *NvmeNamespaceDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePrincipalIdentityParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePacketCapturesParams) WithTimeout(timeout time.Duration) *DeletePacketCapturesParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteSubnetParams) WithTimeout(timeout time.Duration) *DeleteSubnetParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteAttributeParams) WithTimeout(timeout time.Duration) *DeleteAttributeParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteProtectedEntityParams) WithTimeout(timeout time.Duration) *DeleteProtectedEntityParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *EmsDestinationDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteConditionParams) WithTimeout(timeout time.Duration) *DeleteConditionParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteProtocolUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewComponentDeleteParamsWithTimeout(timeout time.Duration) *ComponentDeleteParams {\n\treturn &ComponentDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteSubnetParamsWithTimeout(timeout time.Duration) *DeleteSubnetParams {\n\tvar ()\n\treturn &DeleteSubnetParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func WithTimeout(timeout time.Duration) Option {\n\treturn func(opts *VDRI) {\n\t\topts.client.Timeout = timeout\n\t}\n}", "func (o *PostHostStorageSectorsDeleteMerklerootParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSubnetsSubnetPoolParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteV1WebhooksWebhookIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewLedgerVoucherAttachmentDeleteAttachmentParamsWithTimeout(timeout time.Duration) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\tvar (\n\t\tsendToInboxDefault = bool(false)\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherAttachmentDeleteAttachmentParams{\n\t\tSendToInbox: &sendToInboxDefault,\n\t\tSplit: &splitDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) WithTimeout(timeout time.Duration) *RevokeDeviceCertificateUsingDELETEParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteTagParamsWithTimeout(timeout time.Duration) *DeleteTagParams {\n\tvar ()\n\treturn &DeleteTagParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *PublicRemoveTrustedDeviceV4Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ActionsRemoveParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNtpServerParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteScheduleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteCatalogsByIDSharedVariationAttributesByIDValuesByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CompanyCompanyRepositoryV1DeleteByIDDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *NegotiableQuoteCouponManagementV1RemoveDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNetworkGroupPolicyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewDeleteNodeParamsWithTimeout(timeout time.Duration) *DeleteNodeParams {\n\tvar ()\n\treturn &DeleteNodeParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteClusterParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNodeParams) WithTimeout(timeout time.Duration) *DeleteNodeParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *PublicRemoveTrustedDeviceV4Params) WithTimeout(timeout time.Duration) *PublicRemoveTrustedDeviceV4Params {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteDeviceUsingDELETEParams) WithTimeout(timeout time.Duration) *DeleteDeviceUsingDELETEParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteBlueprintsInWorkspaceParams) WithTimeout(timeout time.Duration) *DeleteBlueprintsInWorkspaceParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteLoadBalancerPoolParams) WithTimeout(timeout time.Duration) *DeleteLoadBalancerPoolParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteDataSourceParams) WithTimeout(timeout time.Duration) *DeleteDataSourceParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *NodesDelTagByIDParams) WithTimeout(timeout time.Duration) *NodesDelTagByIDParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func DeleteVNet(vNetName string, rgroupName string) {\n\ta := wow.New(os.Stdout, spin.Get(spin.Dots), \"Deleting virtual network : \"+vNetName)\n\ta.Start()\n\ttime.Sleep(2 * time.Second)\n\ta.Text(\"This would take a few minutes...\").Spinner(spin.Get(spin.Dots))\n\tcmd := exec.Command(\"az\", \"network\", \"vnet\", \"delete\", \"--name\",\n\t\tvNetName, \"--resource-group\", rgroupName)\n\tvar out bytes.Buffer\n\tvar stderr bytes.Buffer\n\tcmd.Stdout = &out\n\tcmd.Stderr = &stderr\n\terr := cmd.Run()\n\tif err != nil {\n\t\tfmt.Println(fmt.Sprint(err) + \": \" + stderr.String())\n\t\treturn\n\t}\n\ta.PersistWith(spin.Spinner{}, \"....\")\n\tfmt.Println(\"Result: \" + out.String())\n}", "func (o *RemoveDropRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSiteDeployParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (c *HTTPClient) Delete(q *Query, timeout time.Duration) error {\n if q == nil {\n return fmt.Errorf(\"kairosdb: nil query passed\")\n }\n payload, err := json.Marshal(q)\n if err != nil {\n return fmt.Errorf(\"error unmarshalling query:%v :: %v\", q, err)\n }\n\n glog.Infof(\"deleting datapoints payload: %v\", string(payload))\n reader := ioutil.NopCloser(bytes.NewReader(payload))\n err = c.backend.Call(\"POST\", c.url+\"/api/v1/datapoints/delete\", reader,\n timeout, http.StatusNoContent, nil)\n if err != nil {\n return fmt.Errorf(\"error deleting datapoints for query: %v :: %v\",\n string(payload), err)\n }\n\n glog.Infof(\"datapoints deleted successfully for query: %+v\", q)\n return nil\n}", "func NewDeleteDataSourceParamsWithTimeout(timeout time.Duration) *DeleteDataSourceParams {\n\treturn &DeleteDataSourceParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteAlertingProfileParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ServiceInstanceDeprovisionParams) WithTimeout(timeout time.Duration) *ServiceInstanceDeprovisionParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteReadonlyClusterParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PcloudPlacementgroupsMembersDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNamespaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RemoveAPIKeyPrivilegeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *StreamsDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteCwfNetworkIDParams) WithTimeout(timeout time.Duration) *DeleteCwfNetworkIDParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) WithTimeout(timeout time.Duration) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\to.SetTimeout(timeout)\n\treturn o\n}" ]
[ "0.7468831", "0.67573833", "0.6754353", "0.66252846", "0.6508116", "0.6367591", "0.6355736", "0.63485533", "0.6238335", "0.6232378", "0.62192976", "0.621058", "0.6202076", "0.6191659", "0.61659044", "0.616456", "0.6153679", "0.60536504", "0.5998588", "0.5980925", "0.597944", "0.59703755", "0.5935428", "0.5929296", "0.5912495", "0.59029806", "0.5894181", "0.58854914", "0.5881308", "0.5875906", "0.58734554", "0.58504975", "0.5826565", "0.58203435", "0.58185273", "0.58160657", "0.58130604", "0.5809414", "0.58068055", "0.58035344", "0.5780497", "0.5775577", "0.5745523", "0.5728427", "0.5727984", "0.57045275", "0.5693936", "0.5669721", "0.5658738", "0.56555134", "0.56368816", "0.5636105", "0.5631534", "0.56267315", "0.56246364", "0.5611716", "0.5607365", "0.55987734", "0.5592739", "0.558584", "0.55679536", "0.5566606", "0.55655193", "0.55597365", "0.5558777", "0.5558448", "0.5557868", "0.5555495", "0.5549898", "0.5549356", "0.55472034", "0.5538442", "0.55300516", "0.5516755", "0.55120164", "0.5509365", "0.55015504", "0.5500991", "0.54960126", "0.5490992", "0.548088", "0.54640263", "0.54582775", "0.54512477", "0.5445996", "0.5442495", "0.5414057", "0.53913385", "0.5389217", "0.5386954", "0.5382966", "0.53787875", "0.53709054", "0.5364477", "0.5360831", "0.5360458", "0.5357815", "0.53524077", "0.53519464", "0.53494716" ]
0.751193
0
SetTimeout adds the timeout to the vvol binding delete params
func (o *VvolBindingDeleteParams) SetTimeout(timeout time.Duration) { o.timeout = timeout }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VolumeDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteProtocolUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteDebugRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePackageVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteDeviceUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteVersionControlRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ComponentDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteUsingDELETE1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteLoadBalancerPoolParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePoolProjectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSubnetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteTagParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteDataSourceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteConditionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EntryServiceDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteKeyPairsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNodeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteCwfNetworkIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteBlueprintsInWorkspaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteFreeIpaByEnvironmentV1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *NodesDelTagByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteProtectedEntityParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ServiceInstanceDeprovisionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePacketCapturesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ReposDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNtpServerParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteMsgVpnRestDeliveryPointRestConsumerTLSTrustedCommonNameParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *BundleProductOptionRepositoryV1DeleteByIDDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RemoveGKECredentialParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostHostStorageSectorsDeleteMerklerootParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSubscribedEventParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *OrderDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSubnetsSubnetPoolParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PublicRemoveTrustedDeviceV4Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteAttributeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteCatalogsByIDSharedVariationAttributesByIDValuesByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *NvmeNamespaceDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteV1WebhooksWebhookIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ActionsRemoveParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteLTENetworkIDNetworkProbeTasksTaskIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNetworkGroupPolicyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePrincipalIdentityParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteScheduleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RemoveDropRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EmsDestinationDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RemoveAPIKeyPrivilegeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteClusterParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *MonitorDeleteMaintenancePeriodFromMonitorParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteDevicesDeviceidInterfacesInterfacenameParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteGroupConfigurationAdminV1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteLifecycleSpacesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSiteDeployParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *VolumeDeleteParams) WithTimeout(timeout time.Duration) *VolumeDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *NegotiableQuoteCouponManagementV1RemoveDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteChartrepoRepoChartsNameVersionLabelsIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ReadStorageV1alpha1VolumeAttachmentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteReadonlyClusterParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNamespaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *TokenDeleteOrgParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *FreezeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteaspecificEmergencyMappingContainerParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteBasketsByIDPaymentInstrumentsByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetVrackServiceNameDedicatedCloudDedicatedCloudParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ServiceBindingBindingParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CompanyCompanyRepositoryV1DeleteByIDDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSyslogPoliciesMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PcloudPlacementgroupsMembersDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSiteSnippetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteActionTemplateSpacesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetIngredientVersionRevisionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePackageVersionParams) WithTimeout(timeout time.Duration) *DeletePackageVersionParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *GetBootVolumeAttachmentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNetworksNetworkIDTiersTierIDImagesImageNameParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteKubeClusterParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PatchSepainstantIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RemoveControlFromGroupParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteAlertingProfileParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSystemObjectDefinitionsByIDAttributeGroupsByIDAttributeDefinitionsByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteClusterClusterIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetNetworkAppliancePortParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RemoveReceiverParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *AdminDeleteProfanityFilterParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateDrgAttachmentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RTRExecuteActiveResponderCommandParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SalesRuleCouponRepositoryV1DeleteByIDDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetPurgeStatusParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *RevertProductSnapshotRequestUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSupportUserParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetNdmpSettingsVariableParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *StreamsDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetGCParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ViewsGetByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetContainersUUIDVolumesVolumeUUIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PatchStorageVirtualDriveExtensionsMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}" ]
[ "0.7573724", "0.7207692", "0.7046025", "0.7044389", "0.70108753", "0.7000114", "0.6995935", "0.6985808", "0.6983977", "0.69346863", "0.6927923", "0.68983376", "0.68788433", "0.6873153", "0.68369544", "0.68284047", "0.6817396", "0.6802894", "0.6794395", "0.67751145", "0.67681706", "0.67668825", "0.6759894", "0.6757143", "0.6750158", "0.6744437", "0.67424077", "0.67227346", "0.66763014", "0.66705173", "0.6668354", "0.6648364", "0.66477716", "0.6632924", "0.66299635", "0.6620888", "0.65999866", "0.6595887", "0.65710115", "0.6533902", "0.6533491", "0.652609", "0.65201336", "0.6509709", "0.6493237", "0.6487399", "0.64850545", "0.6464736", "0.6453436", "0.6449628", "0.6441235", "0.64181376", "0.64173007", "0.637364", "0.63710725", "0.6362126", "0.6329201", "0.6326512", "0.6324322", "0.6323399", "0.63233083", "0.6322812", "0.63121855", "0.6310189", "0.62969565", "0.6281542", "0.6281247", "0.62785923", "0.62761176", "0.6268588", "0.62662953", "0.62594545", "0.62567544", "0.6250593", "0.62477493", "0.6217439", "0.6214416", "0.6208767", "0.6207442", "0.62049836", "0.62047017", "0.618918", "0.61873525", "0.61871016", "0.61855537", "0.61811393", "0.61749965", "0.61657274", "0.61652994", "0.6163747", "0.61590475", "0.61527085", "0.61519593", "0.6148325", "0.61476624", "0.61459875", "0.6135266", "0.6133013", "0.6129995", "0.61268073" ]
0.81471366
0
WithContext adds the context to the vvol binding delete params
func (o *VvolBindingDeleteParams) WithContext(ctx context.Context) *VvolBindingDeleteParams { o.SetContext(ctx) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (_obj *DataService) DeleteApplyWithContext(tarsCtx context.Context, wx_id string, club_id string, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(wx_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(club_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"deleteApply\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _is.Read_int32(&(*affectRows), 3, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (_obj *Apichannels) Channels_deleteChannelWithContext(tarsCtx context.Context, params *TLchannels_deleteChannel, _opt ...map[string]string) (ret Updates, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"channels_deleteChannel\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (_obj *DataService) DeleteActivityRecordWithContext(tarsCtx context.Context, activity_id string, wx_id string, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(activity_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(wx_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"deleteActivityRecord\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _is.Read_int32(&(*affectRows), 3, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (_obj *DataService) DeleteApplyOneWayWithContext(tarsCtx context.Context, wx_id string, club_id string, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(wx_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(club_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"deleteApply\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (_obj *WebApiAuth) SysConfig_DeleteWithContext(tarsCtx context.Context, req *SysConfig, res *bool, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = req.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_bool((*res), 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"SysConfig_Delete\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_bool(&(*res), 2, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func (t *TrudyPipe) DeleteContext(key string) {\n\tt.pipeMutex.Lock()\n\tdelete(t.KV, key)\n\tt.pipeMutex.Unlock()\n}", "func (_obj *DataService) DeleteActivityWithContext(tarsCtx context.Context, activity_id string, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(activity_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"deleteActivity\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _is.Read_int32(&(*affectRows), 2, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (o *VolumeDeleteParams) WithContext(ctx context.Context) *VolumeDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (_obj *Apichannels) Channels_deleteChannelOneWayWithContext(tarsCtx context.Context, params *TLchannels_deleteChannel, _opt ...map[string]string) (ret Updates, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"channels_deleteChannel\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (o *VvolBindingDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *ProjectsBrokersV2ServiceInstancesServiceBindingsDeleteCall) Context(ctx context.Context) *ProjectsBrokersV2ServiceInstancesServiceBindingsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteProtocolUsingDELETEParams) WithContext(ctx context.Context) *DeleteProtocolUsingDELETEParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (_obj *WebApiAuth) SysConfig_DeleteOneWayWithContext(tarsCtx context.Context, req *SysConfig, res *bool, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = req.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_bool((*res), 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"SysConfig_Delete\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func (_obj *Apichannels) Channels_deleteHistoryWithContext(tarsCtx context.Context, params *TLchannels_deleteHistory, _opt ...map[string]string) (ret Bool, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"channels_deleteHistory\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (h *Creator) DeleteWith(model interface{}) *EndpointHandler {\n\treturn &EndpointHandler{\n\t\tmodel: h.c.MustGetModelStruct(model),\n\t\thandler: h.handleDelete,\n\t}\n}", "func (req *DeleteRequest) Context(ctx context.Context) *DeleteRequest {\n\treq.impl = req.impl.Context(ctx)\n\n\treturn req\n}", "func (_obj *DataService) DeleteActivityRecordOneWayWithContext(tarsCtx context.Context, activity_id string, wx_id string, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(activity_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(wx_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"deleteActivityRecord\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewVvolBindingDeleteParamsWithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (a *DeprecatedBusManagementRouterApiService) DeleteBindingUsingDELETE(ctx _context.Context, routingKeyFilter string, fifoName string) ApiDeleteBindingUsingDELETERequest {\n\treturn ApiDeleteBindingUsingDELETERequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\troutingKeyFilter: routingKeyFilter,\n\t\tfifoName: fifoName,\n\t}\n}", "func (_obj *WebApiAuth) SysUser_BatchDeleteWithContext(tarsCtx context.Context, id []int32, req *SysUser, res *bool, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.WriteHead(codec.LIST, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(int32(len(id)), 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range id {\n\n\t\terr = _os.Write_int32(v, 0)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\terr = req.WriteBlock(_os, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_bool((*res), 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"SysUser_BatchDelete\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_bool(&(*res), 3, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func (_obj *Apichannels) Channels_deleteMessagesWithContext(tarsCtx context.Context, params *TLchannels_deleteMessages, _opt ...map[string]string) (ret Messages_AffectedMessages, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"channels_deleteMessages\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (c *Client) DeleteVersionContext(ctx context.Context, projectIDOrKey interface{}, versionID int) (*Version, error) {\n\tu := fmt.Sprintf(\"/api/v2/projects/%v/versions/%v\", projectIDOrKey, versionID)\n\n\treq, err := c.NewRequest(\"DELETE\", u, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tversion := new(Version)\n\tif err := c.Do(ctx, req, &version); err != nil {\n\t\treturn nil, err\n\t}\n\treturn version, nil\n}", "func NewVvolBindingDeleteParams() *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (mr *MockRDSAPIMockRecorder) DeleteDBParameterGroupWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteDBParameterGroupWithContext\", reflect.TypeOf((*MockRDSAPI)(nil).DeleteDBParameterGroupWithContext), varargs...)\n}", "func (mr *MockRDSAPIMockRecorder) RevokeDBSecurityGroupIngressWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RevokeDBSecurityGroupIngressWithContext\", reflect.TypeOf((*MockRDSAPI)(nil).RevokeDBSecurityGroupIngressWithContext), varargs...)\n}", "func (o *DeleteVersionControlRequestParams) WithContext(ctx context.Context) *DeleteVersionControlRequestParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (w *Webhook) DeleteContext(ctx context.Context) error {\n\treturn globalClient.DeleteWebhookContext(ctx, w.ID)\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) WithContext(ctx context.Context) *DeleteBlueprintRequestUsingDELETE1Params {\n\to.SetContext(ctx)\n\treturn o\n}", "func (_obj *WebApiAuth) SysConfig_BatchDeleteWithContext(tarsCtx context.Context, id []int32, req *SysConfig, res *bool, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.WriteHead(codec.LIST, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(int32(len(id)), 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range id {\n\n\t\terr = _os.Write_int32(v, 0)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\terr = req.WriteBlock(_os, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_bool((*res), 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"SysConfig_BatchDelete\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_bool(&(*res), 3, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func (l *Lidarr) DeleteAlbumContext(ctx context.Context, albumID int64, deleteFiles, addImportExclusion bool) error {\n\treq := starr.Request{URI: path.Join(bpAlbum, fmt.Sprint(albumID)), Query: make(url.Values)}\n\treq.Query.Set(\"deleteFiles\", fmt.Sprint(deleteFiles))\n\treq.Query.Set(\"addImportListExclusion\", fmt.Sprint(addImportExclusion))\n\n\tif err := l.DeleteAny(ctx, req); err != nil {\n\t\treturn fmt.Errorf(\"api.Delete(%s): %w\", &req, err)\n\t}\n\n\treturn nil\n}", "func (_obj *DataService) DeleteActivityOneWayWithContext(tarsCtx context.Context, activity_id string, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(activity_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"deleteActivity\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (m *MockRDSAPI) DeleteDBParameterGroupWithContext(arg0 aws.Context, arg1 *rds.DeleteDBParameterGroupInput, arg2 ...request.Option) (*rds.DeleteDBParameterGroupOutput, error) {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DeleteDBParameterGroupWithContext\", varargs...)\n\tret0, _ := ret[0].(*rds.DeleteDBParameterGroupOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) WithContext(ctx context.Context) *DeleteGerritListenerByIDUsingDELETEParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *PublicRemoveTrustedDeviceV4Params) WithContext(ctx context.Context) *PublicRemoveTrustedDeviceV4Params {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DeleteAllReferences != nil {\n\n\t\t// query param delete_all_references\n\t\tvar qrDeleteAllReferences bool\n\n\t\tif o.DeleteAllReferences != nil {\n\t\t\tqrDeleteAllReferences = *o.DeleteAllReferences\n\t\t}\n\t\tqDeleteAllReferences := swag.FormatBool(qrDeleteAllReferences)\n\t\tif qDeleteAllReferences != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"delete_all_references\", qDeleteAllReferences); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param protocol_endpoint.uuid\n\tif err := r.SetPathParam(\"protocol_endpoint.uuid\", o.ProtocolEndpointUUID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vvol.uuid\n\tif err := r.SetPathParam(\"vvol.uuid\", o.VvolUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *DeletePackageVersionParams) WithContext(ctx context.Context) *DeletePackageVersionParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (c *ComputingProviderController) Del(ctx *app.DelComputingProviderContext) error {\n\t// check arguments\n\tif checkArguments(ctx.Hash, ctx.ETHKey) == false {\n\t\tfmt.Println(\"ctx.Hash===========>\", ctx.Hash)\n\t\treturn ctx.BadRequest(\n\t\t\tgoa.ErrBadRequest(\"Invalid arguments!\"))\n\t}\n\n\t// read config\n\tconfig := readConfig()\n\tif config == nil {\n\t\tfmt.Println(\"readConfig config===========>\", config)\n\t\tgoa.LogInfo(context.Background(), \"Config of computing provider error\")\n\t\treturn ctx.InternalServerError(\n\t\t\tgoa.ErrInternal(\"Config of computing provider error\"))\n\t}\n\n\t// operate transaction\n\t// transactionHash, err := operateTrasaction(DEL, ctx.Hash, ctx.PrivateKey, config)\n\ttransactionHash, err := transaction.OperateTransaction(transaction.DEL, ctx.Hash, ctx.ETHKey, config)\n\tif err != nil {\n\t\tfmt.Println(\"err===========>\", err)\n\t\treturn ctx.InternalServerError(\n\t\t\tgoa.ErrInternal(\"operateTrasaction failure\"))\n\t}\n\treturn ctx.OK([]byte(transactionHash))\n}", "func (o *DeleteProtectedEntityParams) WithContext(ctx context.Context) *DeleteProtectedEntityParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (r *ManagedServiceDeleteRequest) SendContext(ctx context.Context) (result *ManagedServiceDeleteResponse, err error) {\n\tquery := helpers.CopyQuery(r.query)\n\theader := helpers.CopyHeader(r.header)\n\turi := &url.URL{\n\t\tPath: r.path,\n\t\tRawQuery: query.Encode(),\n\t}\n\trequest := &http.Request{\n\t\tMethod: \"DELETE\",\n\t\tURL: uri,\n\t\tHeader: header,\n\t}\n\tif ctx != nil {\n\t\trequest = request.WithContext(ctx)\n\t}\n\tresponse, err := r.transport.RoundTrip(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer response.Body.Close()\n\tresult = &ManagedServiceDeleteResponse{}\n\tresult.status = response.StatusCode\n\tresult.header = response.Header\n\treader := bufio.NewReader(response.Body)\n\t_, err = reader.Peek(1)\n\tif err == io.EOF {\n\t\terr = nil\n\t\treturn\n\t}\n\tif result.status >= 400 {\n\t\tresult.err, err = errors.UnmarshalErrorStatus(reader, result.status)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\terr = result.err\n\t\treturn\n\t}\n\treturn\n}", "func (c *OrganizationsEnvironmentsApisRevisionsDebugsessionsDeleteDataCall) Context(ctx context.Context) *OrganizationsEnvironmentsApisRevisionsDebugsessionsDeleteDataCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (s *Service) deleteExperiment(c *gin.Context) {}", "func (_obj *Apichannels) Channels_deleteUserHistoryWithContext(tarsCtx context.Context, params *TLchannels_deleteUserHistory, _opt ...map[string]string) (ret Messages_AffectedHistory, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"channels_deleteUserHistory\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (l *Libvirt) NwfilterBindingDelete(OptNwfilter NwfilterBinding) (err error) {\n\tvar buf []byte\n\n\targs := NwfilterBindingDeleteArgs {\n\t\tOptNwfilter: OptNwfilter,\n\t}\n\n\tbuf, err = encode(&args)\n\tif err != nil {\n\t\treturn\n\t}\n\n\n\t_, err = l.requestStream(400, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (o *DeleteUsingDELETE1Params) WithContext(ctx context.Context) *DeleteUsingDELETE1Params {\n\to.SetContext(ctx)\n\treturn o\n}", "func (dt *DynaTable) DeleteWithContext(ctx context.Context, partitionKey, sortKey string) error {\n\tctx = setOperationName(ctx, \"Delete\")\n\n\tdeleteItem := &dynamodb.DeleteItemInput{\n\t\tTableName: aws.String(dt.GetTableName()),\n\t\tKey: buildKeys(partitionKey, sortKey),\n\t}\n\n\tctx = dt.session.storeHooks.RequestBuilt(ctx, deleteItem)\n\n\t_, err := dt.session.DeleteItemWithContext(ctx, deleteItem)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to delete item: %w\", err)\n\t}\n\n\treturn nil\n}", "func (_obj *Apichannels) Channels_deleteHistoryOneWayWithContext(tarsCtx context.Context, params *TLchannels_deleteHistory, _opt ...map[string]string) (ret Bool, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"channels_deleteHistory\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (o *DeleteSubscribedEventParams) WithContext(ctx context.Context) *DeleteSubscribedEventParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *ComponentDeleteParams) WithContext(ctx context.Context) *ComponentDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (c *OrganizationsSharedflowsRevisionsDeleteCall) Context(ctx context.Context) *OrganizationsSharedflowsRevisionsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteOrgOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "func DeleteGift(ctx context.Context, pk int) {\n\tdeleteGift(ctx, pk)\n}", "func (r *Readarr) DeleteImportListContext(ctx context.Context, importListID int64) error {\n\treq := starr.Request{URI: path.Join(bpImportList, fmt.Sprint(importListID))}\n\tif err := r.DeleteAny(ctx, req); err != nil {\n\t\treturn fmt.Errorf(\"api.Delete(%s): %w\", &req, err)\n\t}\n\n\treturn nil\n}", "func (material *Material) DeleteInContext(ctx *aero.Context) error {\n\treturn material.Delete()\n}", "func (o *ReposDeleteParams) WithContext(ctx context.Context) *ReposDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (c *DynamicTargetingKeysDeleteCall) Context(ctx context.Context) *DynamicTargetingKeysDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (_obj *WebApiAuth) SysUser_BatchDeleteOneWayWithContext(tarsCtx context.Context, id []int32, req *SysUser, res *bool, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.WriteHead(codec.LIST, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(int32(len(id)), 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range id {\n\n\t\terr = _os.Write_int32(v, 0)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\terr = req.WriteBlock(_os, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_bool((*res), 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"SysUser_BatchDelete\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func (c *OrganizationsApisRevisionsDeleteCall) Context(ctx context.Context) *OrganizationsApisRevisionsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (c *OrganizationsDevelopersAppsAttributesDeleteCall) Context(ctx context.Context) *OrganizationsDevelopersAppsAttributesDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteKeyPairsParams) WithContext(ctx context.Context) *DeleteKeyPairsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (_obj *Apipayments) Payments_clearSavedInfoWithContext(tarsCtx context.Context, params *TLpayments_clearSavedInfo, _opt ...map[string]string) (ret Bool, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"payments_clearSavedInfo\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (mr *MockRDSAPIMockRecorder) DeleteDBSnapshotWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteDBSnapshotWithContext\", reflect.TypeOf((*MockRDSAPI)(nil).DeleteDBSnapshotWithContext), varargs...)\n}", "func (m *MockRDSAPI) WaitUntilDBInstanceDeletedWithContext(arg0 aws.Context, arg1 *rds.DescribeDBInstancesInput, arg2 ...request.WaiterOption) error {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"WaitUntilDBInstanceDeletedWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (o *DeleteBlueprintsInWorkspaceParams) WithContext(ctx context.Context) *DeleteBlueprintsInWorkspaceParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (c *OrganizationsApiproductsAttributesDeleteCall) Context(ctx context.Context) *OrganizationsApiproductsAttributesDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (k *K8S) DeleteContext() map[string]string {\n\treturn k8sContext(k.ns)\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (a *Client) DeleteBind(params *DeleteBindParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteBindAccepted, *DeleteBindNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteBindParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"deleteBind\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/services/haproxy/configuration/binds/{name}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &DeleteBindReader{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, nil, err\n\t}\n\tswitch value := result.(type) {\n\tcase *DeleteBindAccepted:\n\t\treturn value, nil, nil\n\tcase *DeleteBindNoContent:\n\t\treturn nil, value, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*DeleteBindDefault)\n\treturn nil, nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "func (_obj *WebApiAuth) SysConfig_BatchDeleteOneWayWithContext(tarsCtx context.Context, id []int32, req *SysConfig, res *bool, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.WriteHead(codec.LIST, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(int32(len(id)), 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range id {\n\n\t\terr = _os.Write_int32(v, 0)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\terr = req.WriteBlock(_os, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_bool((*res), 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"SysConfig_BatchDelete\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func (r *Radarr) DeleteReleaseProfileContext(ctx context.Context, profileID int64) error {\n\treq := starr.Request{URI: path.Join(bpReleaseProfile, fmt.Sprint(profileID))}\n\tif err := r.DeleteAny(ctx, req); err != nil {\n\t\treturn fmt.Errorf(\"api.Delete(%s): %w\", &req, err)\n\t}\n\n\treturn nil\n}", "func (_obj *WebApiAuth) LoginLog_BatchDeleteWithContext(tarsCtx context.Context, id []int32, req *LoginLog, res *bool, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.WriteHead(codec.LIST, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(int32(len(id)), 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range id {\n\n\t\terr = _os.Write_int32(v, 0)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\terr = req.WriteBlock(_os, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_bool((*res), 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"LoginLog_BatchDelete\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_bool(&(*res), 3, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func (o *DeleteSupportUserParams) WithContext(ctx context.Context) *DeleteSupportUserParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (m *MockRDSAPI) RevokeDBSecurityGroupIngressWithContext(arg0 aws.Context, arg1 *rds.RevokeDBSecurityGroupIngressInput, arg2 ...request.Option) (*rds.RevokeDBSecurityGroupIngressOutput, error) {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"RevokeDBSecurityGroupIngressWithContext\", varargs...)\n\tret0, _ := ret[0].(*rds.RevokeDBSecurityGroupIngressOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (client *ConnectedEnvironmentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}\"\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\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 connectedEnvironmentName == \"\" {\n\t\treturn nil, errors.New(\"parameter connectedEnvironmentName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{connectedEnvironmentName}\", url.PathEscape(connectedEnvironmentName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, 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\", \"2022-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func (sp *serviceProposal) delete(ctx *gin.Context) {\n\tuuid := ctx.Param(\"uuid\")\n\terr := sp.db.DeleteProposal(uuid)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tctx.JSON(http.StatusNoContent, nil)\n\t\treturn\n\t}\n\tctx.JSON(http.StatusOK, nil)\n}", "func (mr *MockRDSAPIMockRecorder) DeleteDBSubnetGroupWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteDBSubnetGroupWithContext\", reflect.TypeOf((*MockRDSAPI)(nil).DeleteDBSubnetGroupWithContext), varargs...)\n}", "func (c *PropertiesIosAppDataStreamsMeasurementProtocolSecretsDeleteCall) Context(ctx context.Context) *PropertiesIosAppDataStreamsMeasurementProtocolSecretsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (s *Sonarr) DeleteImportListContext(ctx context.Context, importListID int64) error {\n\treq := starr.Request{URI: path.Join(bpImportList, fmt.Sprint(importListID))}\n\tif err := s.DeleteAny(ctx, req); err != nil {\n\t\treturn fmt.Errorf(\"api.Delete(%s): %w\", &req, err)\n\t}\n\n\treturn nil\n}", "func (mr *MockRDSAPIMockRecorder) DeleteDBClusterParameterGroupWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteDBClusterParameterGroupWithContext\", reflect.TypeOf((*MockRDSAPI)(nil).DeleteDBClusterParameterGroupWithContext), varargs...)\n}", "func (o *RemovePolicyOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "func (o *DeleteDebugRequestParams) WithContext(ctx context.Context) *DeleteDebugRequestParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteConditionParams) WithContext(ctx context.Context) *DeleteConditionParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (_obj *Apichannels) Channels_deleteMessagesOneWayWithContext(tarsCtx context.Context, params *TLchannels_deleteMessages, _opt ...map[string]string) (ret Messages_AffectedMessages, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"channels_deleteMessages\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (o *DeleteLoadBalancerPoolParams) WithContext(ctx context.Context) *DeleteLoadBalancerPoolParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func DeleteContext(oldContext unsafe.Pointer) unsafe.Pointer {\n\tret, _, _ := syscall.Syscall(gpDeleteContext, 1, uintptr(oldContext), 0, 0)\n\treturn (unsafe.Pointer)(ret)\n}", "func (c *ProjectsLocationsVolumesSnapshotsDeleteCall) Context(ctx context.Context) *ProjectsLocationsVolumesSnapshotsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (c *ProjectsLocationsDataExchangesListingsDeleteCall) Context(ctx context.Context) *ProjectsLocationsDataExchangesListingsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func VisualisationDeleteParams(dbOwner, dbFolder, dbName, visName string) (err error) {\n\tvar commandTag pgx.CommandTag\n\tdbQuery := `\n\t\tWITH u AS (\n\t\t\tSELECT user_id\n\t\t\tFROM users\n\t\t\tWHERE lower(user_name) = lower($1)\n\t\t), d AS (\n\t\t\tSELECT db.db_id\n\t\t\tFROM sqlite_databases AS db, u\n\t\t\tWHERE db.user_id = u.user_id\n\t\t\t\tAND folder = $2\n\t\t\t\tAND db_name = $3\n\t\t)\n\t\tDELETE FROM vis_params WHERE user_id = (SELECT user_id FROM u) AND db_id = (SELECT db_id FROM d) AND name = $4`\n\tcommandTag, err = pdb.Exec(dbQuery, dbOwner, dbFolder, dbName, visName)\n\tif err != nil {\n\t\tlog.Printf(\"Deleting visualisation '%s' for database '%s%s%s' failed: %v\\n\", visName, dbOwner, dbFolder, dbName, err)\n\t\treturn err\n\t}\n\tif numRows := commandTag.RowsAffected(); numRows != 1 {\n\t\tlog.Printf(\"Wrong number of rows (%v) affected while deleting visualisation '%s' for database '%s%s%s'\\n\", numRows, visName, dbOwner, dbFolder, dbName)\n\t}\n\treturn\n}", "func (_obj *Apichannels) Channels_editAdminWithContext(tarsCtx context.Context, params *TLchannels_editAdmin, _opt ...map[string]string) (ret Updates, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"channels_editAdmin\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (h *handler) DeleteServiceBinding(sb *servicecatalog.Binding) error {\n\t// this logic to set and update the timestamp is TPR specific. to be moved to the API server\n\tdts := metav1.Now()\n\tsb.DeletionTimestamp = &dts\n\tif _, err := h.apiClient.Bindings(sb.Namespace).Update(sb); err != nil {\n\t\treturn err\n\t}\n\n\t// uninject\n\tif err := h.injector.Uninject(sb); err != nil {\n\t\t// if 0 conditions, uninject and drop condition for uninject\n\t\t// TODO: add failure condition (https://github.com/kubernetes-incubator/service-catalog/issues/305)\n\t\treturn err\n\t}\n\t// TODO: add success condition (https://github.com/kubernetes-incubator/service-catalog/issues/305)\n\tif _, err := h.apiClient.Bindings(sb.Namespace).Update(sb); err != nil {\n\t\treturn err\n\t}\n\n\t// TODO: unbind && add conditions (https://github.com/kubernetes-incubator/service-catalog/issues/305)\n\tif err := h.unbind(sb); err != nil {\n\t\t// TODO: add failure condition (https://github.com/kubernetes-incubator/service-catalog/issues/305)\n\t\treturn err\n\t}\n\t// TODO: add success condition (https://github.com/kubernetes-incubator/service-catalog/issues/305)\n\n\tif _, err := h.apiClient.Bindings(sb.Namespace).Update(sb); err != nil {\n\t\treturn err\n\t}\n\n\t// This is where the binding is _actually_ deleted after all necessary actions have been taken\n\tif err := h.apiClient.Bindings(sb.Namespace).Delete(sb.Name); err != nil {\n\t\t// TODO: add deletion error condition (https://github.com/kubernetes-incubator/service-catalog/issues/305)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *OrganizationsDevelopersAttributesDeleteCall) Context(ctx context.Context) *OrganizationsDevelopersAttributesDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) WithContext(ctx context.Context) *RevokeDeviceCertificateUsingDELETEParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (client *WANPPPConnection1) DeletePortMappingCtx(\n\tctx context.Context,\n\tNewRemoteHost string,\n\tNewExternalPort uint16,\n\tNewProtocol string,\n) (err error) {\n\t// Request structure.\n\trequest := &struct {\n\t\tNewRemoteHost string\n\t\tNewExternalPort string\n\t\tNewProtocol string\n\t}{}\n\t// BEGIN Marshal arguments into request.\n\n\tif request.NewRemoteHost, err = soap.MarshalString(NewRemoteHost); err != nil {\n\t\treturn\n\t}\n\tif request.NewExternalPort, err = soap.MarshalUi2(NewExternalPort); err != nil {\n\t\treturn\n\t}\n\tif request.NewProtocol, err = soap.MarshalString(NewProtocol); err != nil {\n\t\treturn\n\t}\n\t// END Marshal arguments into request.\n\n\t// Response structure.\n\tresponse := interface{}(nil)\n\n\t// Perform the SOAP call.\n\tif err = client.SOAPClient.PerformActionCtx(ctx, URN_WANPPPConnection_1, \"DeletePortMapping\", request, response); err != nil {\n\t\treturn\n\t}\n\n\t// BEGIN Unmarshal arguments from response.\n\n\t// END Unmarshal arguments from response.\n\treturn\n}", "func (o *DeletePacketCapturesParams) WithContext(ctx context.Context) *DeletePacketCapturesParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *DeleteAttributeParams) WithContext(ctx context.Context) *DeleteAttributeParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (s *Sonarr) DeleteIndexerContext(ctx context.Context, indexerID int64) error {\n\treq := starr.Request{URI: path.Join(bpIndexer, fmt.Sprint(indexerID))}\n\tif err := s.DeleteAny(ctx, req); err != nil {\n\t\treturn fmt.Errorf(\"api.Delete(%s): %w\", &req, err)\n\t}\n\n\treturn nil\n}", "func (client *PermissionBindingsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, permissionBindingName string, options *PermissionBindingsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName}\"\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\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 namespaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter namespaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{namespaceName}\", url.PathEscape(namespaceName))\n\tif permissionBindingName == \"\" {\n\t\treturn nil, errors.New(\"parameter permissionBindingName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{permissionBindingName}\", url.PathEscape(permissionBindingName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, 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-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func (filters *FiltersV1) DeleteFiltersWithContext(ctx context.Context, deleteFiltersOptions *DeleteFiltersOptions) (result *DeleteFiltersResp, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(deleteFiltersOptions, \"deleteFiltersOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(deleteFiltersOptions, \"deleteFiltersOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"crn\": *deleteFiltersOptions.Crn,\n\t\t\"zone_identifier\": *deleteFiltersOptions.ZoneIdentifier,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.DELETE)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = filters.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(filters.Service.Options.URL, `/v1/{crn}/zones/{zone_identifier}/filters`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range deleteFiltersOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"filters\", \"V1\", \"DeleteFilters\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\tif deleteFiltersOptions.XAuthUserToken != nil {\n\t\tbuilder.AddHeader(\"X-Auth-User-Token\", fmt.Sprint(*deleteFiltersOptions.XAuthUserToken))\n\t}\n\n\tbuilder.AddQuery(\"id\", fmt.Sprint(*deleteFiltersOptions.ID))\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 = filters.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalDeleteFiltersResp)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}" ]
[ "0.64454263", "0.60833406", "0.58650833", "0.58637446", "0.58177453", "0.5742704", "0.5684418", "0.5624618", "0.5609532", "0.5564796", "0.554032", "0.547962", "0.54498094", "0.540922", "0.53513414", "0.53345364", "0.5332606", "0.5327155", "0.5310653", "0.52597976", "0.52037853", "0.52014285", "0.51979256", "0.5189571", "0.51563287", "0.5148427", "0.5146962", "0.51343113", "0.51320314", "0.512208", "0.51155263", "0.51107", "0.5103221", "0.5094377", "0.50927246", "0.50899804", "0.5086339", "0.5075263", "0.50573015", "0.505446", "0.50444937", "0.50352657", "0.50102156", "0.5004265", "0.49993026", "0.49912673", "0.49900183", "0.4982467", "0.4982062", "0.4963375", "0.49419725", "0.4937576", "0.49351", "0.4931341", "0.49288702", "0.49281", "0.4924416", "0.49194375", "0.49182785", "0.49109098", "0.4900669", "0.48957726", "0.4893896", "0.48885202", "0.48860022", "0.48820347", "0.48790056", "0.48770577", "0.48706567", "0.48686987", "0.4855024", "0.48549145", "0.48515868", "0.4851469", "0.48478028", "0.4847654", "0.4847225", "0.4843092", "0.48425484", "0.48377836", "0.48328185", "0.48218653", "0.48137796", "0.4813439", "0.48123035", "0.48108417", "0.47927824", "0.47914746", "0.47876355", "0.47841683", "0.47813457", "0.47812402", "0.47782737", "0.4776862", "0.47695792", "0.47571176", "0.4752374", "0.47500333", "0.47486588", "0.47472516" ]
0.6696297
0
SetContext adds the context to the vvol binding delete params
func (o *VvolBindingDeleteParams) SetContext(ctx context.Context) { o.Context = ctx }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) WithContext(ctx context.Context) *VvolBindingDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (t *TrudyPipe) DeleteContext(key string) {\n\tt.pipeMutex.Lock()\n\tdelete(t.KV, key)\n\tt.pipeMutex.Unlock()\n}", "func (o *VolumeDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteProtocolUsingDELETEParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *ProjectsBrokersV2ServiceInstancesServiceBindingsDeleteCall) Context(ctx context.Context) *ProjectsBrokersV2ServiceInstancesServiceBindingsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ComponentDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *NegotiableQuoteCouponManagementV1RemoveDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteProtocolUsingDELETEParams) WithContext(ctx context.Context) *DeleteProtocolUsingDELETEParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func DeleteContext(oldContext unsafe.Pointer) unsafe.Pointer {\n\tret, _, _ := syscall.Syscall(gpDeleteContext, 1, uintptr(oldContext), 0, 0)\n\treturn (unsafe.Pointer)(ret)\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ReposDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (r *ManagedServiceDeleteRequest) SendContext(ctx context.Context) (result *ManagedServiceDeleteResponse, err error) {\n\tquery := helpers.CopyQuery(r.query)\n\theader := helpers.CopyHeader(r.header)\n\turi := &url.URL{\n\t\tPath: r.path,\n\t\tRawQuery: query.Encode(),\n\t}\n\trequest := &http.Request{\n\t\tMethod: \"DELETE\",\n\t\tURL: uri,\n\t\tHeader: header,\n\t}\n\tif ctx != nil {\n\t\trequest = request.WithContext(ctx)\n\t}\n\tresponse, err := r.transport.RoundTrip(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer response.Body.Close()\n\tresult = &ManagedServiceDeleteResponse{}\n\tresult.status = response.StatusCode\n\tresult.header = response.Header\n\treader := bufio.NewReader(response.Body)\n\t_, err = reader.Peek(1)\n\tif err == io.EOF {\n\t\terr = nil\n\t\treturn\n\t}\n\tif result.status >= 400 {\n\t\tresult.err, err = errors.UnmarshalErrorStatus(reader, result.status)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\terr = result.err\n\t\treturn\n\t}\n\treturn\n}", "func (o *VolumeDeleteParams) WithContext(ctx context.Context) *VolumeDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (_obj *DataService) DeleteApplyWithContext(tarsCtx context.Context, wx_id string, club_id string, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(wx_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(club_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"deleteApply\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _is.Read_int32(&(*affectRows), 3, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (o *NvmeNamespaceDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteVersionControlRequestParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (_obj *Apichannels) Channels_deleteChannelWithContext(tarsCtx context.Context, params *TLchannels_deleteChannel, _opt ...map[string]string) (ret Updates, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"channels_deleteChannel\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (c *DynamicTargetingKeysDeleteCall) Context(ctx context.Context) *DynamicTargetingKeysDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteSubscribedEventParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *NodesDelTagByIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ServiceInstanceDeprovisionParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *BundleProductOptionRepositoryV1DeleteByIDDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PcloudPlacementgroupsMembersDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (w *Webhook) DeleteContext(ctx context.Context) error {\n\treturn globalClient.DeleteWebhookContext(ctx, w.ID)\n}", "func (o *DeleteDeviceUsingDELETEParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostHostStorageSectorsDeleteMerklerootParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeletePacketCapturesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteDataSourceParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (req *DeleteRequest) Context(ctx context.Context) *DeleteRequest {\n\treq.impl = req.impl.Context(ctx)\n\n\treturn req\n}", "func (o *DeleteUsingDELETE1Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *RevertProductSnapshotRequestUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *RemoveGKECredentialParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *Client) DeleteVersionContext(ctx context.Context, projectIDOrKey interface{}, versionID int) (*Version, error) {\n\tu := fmt.Sprintf(\"/api/v2/projects/%v/versions/%v\", projectIDOrKey, versionID)\n\n\treq, err := c.NewRequest(\"DELETE\", u, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tversion := new(Version)\n\tif err := c.Do(ctx, req, &version); err != nil {\n\t\treturn nil, err\n\t}\n\treturn version, nil\n}", "func (r *Readarr) DeleteImportListContext(ctx context.Context, importListID int64) error {\n\treq := starr.Request{URI: path.Join(bpImportList, fmt.Sprint(importListID))}\n\tif err := r.DeleteAny(ctx, req); err != nil {\n\t\treturn fmt.Errorf(\"api.Delete(%s): %w\", &req, err)\n\t}\n\n\treturn nil\n}", "func (o *PublicRemoveTrustedDeviceV4Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (_obj *Apichannels) Channels_deleteChannelOneWayWithContext(tarsCtx context.Context, params *TLchannels_deleteChannel, _opt ...map[string]string) (ret Updates, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"channels_deleteChannel\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (o *RemoveReceiverParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *VariantsetsDeleteCall) Context(ctx context.Context) *VariantsetsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *RemoveDropRequestParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteDebugRequestParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *EntryServiceDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *OrganizationsEnvironmentsApisRevisionsDebugsessionsDeleteDataCall) Context(ctx context.Context) *OrganizationsEnvironmentsApisRevisionsDebugsessionsDeleteDataCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteCatalogsByIDSharedVariationAttributesByIDValuesByIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteKeyPairsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (k *K8S) DeleteContext() map[string]string {\n\treturn k8sContext(k.ns)\n}", "func (o *DeleteUsingDELETE1Params) WithContext(ctx context.Context) *DeleteUsingDELETE1Params {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *DeleteMsgVpnRestDeliveryPointRestConsumerTLSTrustedCommonNameParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (_obj *DataService) DeleteApplyOneWayWithContext(tarsCtx context.Context, wx_id string, club_id string, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(wx_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(club_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"deleteApply\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (o *DeleteProtectedEntityParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *PropertiesIosAppDataStreamsMeasurementProtocolSecretsDeleteCall) Context(ctx context.Context) *PropertiesIosAppDataStreamsMeasurementProtocolSecretsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *ServiceBindingBindingParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (_obj *DataService) DeleteActivityRecordWithContext(tarsCtx context.Context, activity_id string, wx_id string, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(activity_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(wx_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"deleteActivityRecord\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _is.Read_int32(&(*affectRows), 3, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (s *Sonarr) DeleteImportListContext(ctx context.Context, importListID int64) error {\n\treq := starr.Request{URI: path.Join(bpImportList, fmt.Sprint(importListID))}\n\tif err := s.DeleteAny(ctx, req); err != nil {\n\t\treturn fmt.Errorf(\"api.Delete(%s): %w\", &req, err)\n\t}\n\n\treturn nil\n}", "func (o *DeletePackageVersionParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ActionsRemoveParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteKeyPairsParams) WithContext(ctx context.Context) *DeleteKeyPairsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *DeleteNodeParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeletePackageVersionParams) WithContext(ctx context.Context) *DeletePackageVersionParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *DeleteProtectedEntityParams) WithContext(ctx context.Context) *DeleteProtectedEntityParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (c *PropertiesAndroidAppDataStreamsMeasurementProtocolSecretsDeleteCall) Context(ctx context.Context) *PropertiesAndroidAppDataStreamsMeasurementProtocolSecretsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (r *ClusterDeleteRequest) SendContext(ctx context.Context) (result *ClusterDeleteResponse, err error) {\n\tquery := helpers.CopyQuery(r.query)\n\tif r.deprovision != nil {\n\t\thelpers.AddValue(&query, \"deprovision\", *r.deprovision)\n\t}\n\theader := helpers.CopyHeader(r.header)\n\turi := &url.URL{\n\t\tPath: r.path,\n\t\tRawQuery: query.Encode(),\n\t}\n\trequest := &http.Request{\n\t\tMethod: \"DELETE\",\n\t\tURL: uri,\n\t\tHeader: header,\n\t}\n\tif ctx != nil {\n\t\trequest = request.WithContext(ctx)\n\t}\n\tresponse, err := r.transport.RoundTrip(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer response.Body.Close()\n\tresult = &ClusterDeleteResponse{}\n\tresult.status = response.StatusCode\n\tresult.header = response.Header\n\tif result.status >= 400 {\n\t\tresult.err, err = errors.UnmarshalError(response.Body)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\terr = result.err\n\t\treturn\n\t}\n\treturn\n}", "func SetDeleteSessionFlagInContext(ctx context.Context) {\n\t// create a header that the gateway will watch for\n\theader := metadata.Pairs(\"gateway-session-delete\", \"true\")\n\t// send the header back to the gateway\n\tgrpc.SendHeader(ctx, header)\n}", "func (o *GetaspecificPbxDeviceFirmwareBinaryParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *OrganizationsSharedflowsRevisionsDeleteCall) Context(ctx context.Context) *OrganizationsSharedflowsRevisionsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteLoadBalancerPoolParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (client *WANPPPConnection1) DeletePortMappingCtx(\n\tctx context.Context,\n\tNewRemoteHost string,\n\tNewExternalPort uint16,\n\tNewProtocol string,\n) (err error) {\n\t// Request structure.\n\trequest := &struct {\n\t\tNewRemoteHost string\n\t\tNewExternalPort string\n\t\tNewProtocol string\n\t}{}\n\t// BEGIN Marshal arguments into request.\n\n\tif request.NewRemoteHost, err = soap.MarshalString(NewRemoteHost); err != nil {\n\t\treturn\n\t}\n\tif request.NewExternalPort, err = soap.MarshalUi2(NewExternalPort); err != nil {\n\t\treturn\n\t}\n\tif request.NewProtocol, err = soap.MarshalString(NewProtocol); err != nil {\n\t\treturn\n\t}\n\t// END Marshal arguments into request.\n\n\t// Response structure.\n\tresponse := interface{}(nil)\n\n\t// Perform the SOAP call.\n\tif err = client.SOAPClient.PerformActionCtx(ctx, URN_WANPPPConnection_1, \"DeletePortMapping\", request, response); err != nil {\n\t\treturn\n\t}\n\n\t// BEGIN Unmarshal arguments from response.\n\n\t// END Unmarshal arguments from response.\n\treturn\n}", "func (c *Client) DeleteTagContext(ctx context.Context, t string) error {\n\treq := &api.TagsDeleteRequest{\n\t\tTag: t,\n\t}\n\tresp := &api.TagsDeleteResponse{}\n\terr := c.postContext(ctx, \"tags/delete\", req, resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (o *SalesRuleCouponRepositoryV1DeleteByIDDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *CallsetsDeleteCall) Context(ctx context.Context) *CallsetsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) WithContext(ctx context.Context) *DeleteBlueprintRequestUsingDELETE1Params {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *DeleteAPI24ProtectionGroupSnapshotsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteCwfNetworkIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (a *DeprecatedBusManagementRouterApiService) DeleteBindingUsingDELETE(ctx _context.Context, routingKeyFilter string, fifoName string) ApiDeleteBindingUsingDELETERequest {\n\treturn ApiDeleteBindingUsingDELETERequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\troutingKeyFilter: routingKeyFilter,\n\t\tfifoName: fifoName,\n\t}\n}", "func (o *StopGatewayBundleUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (l *Lidarr) DeleteAlbumContext(ctx context.Context, albumID int64, deleteFiles, addImportExclusion bool) error {\n\treq := starr.Request{URI: path.Join(bpAlbum, fmt.Sprint(albumID)), Query: make(url.Values)}\n\treq.Query.Set(\"deleteFiles\", fmt.Sprint(deleteFiles))\n\treq.Query.Set(\"addImportListExclusion\", fmt.Sprint(addImportExclusion))\n\n\tif err := l.DeleteAny(ctx, req); err != nil {\n\t\treturn fmt.Errorf(\"api.Delete(%s): %w\", &req, err)\n\t}\n\n\treturn nil\n}", "func (o *EmsDestinationDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (b *Bucket) DeleteContext(ctx context.Context, fileID interface{}) error {\n\t// If no deadline is set on the passed-in context, Timeout is set on the Client, and context is\n\t// not already a Timeout context, honor Timeout in new Timeout context for operation execution to\n\t// be shared by both delete operations.\n\tif _, deadlineSet := ctx.Deadline(); !deadlineSet && b.db.Client().Timeout() != nil && !csot.IsTimeoutContext(ctx) {\n\t\tnewCtx, cancelFunc := csot.MakeTimeoutContext(ctx, *b.db.Client().Timeout())\n\t\t// Redefine ctx to be the new timeout-derived context.\n\t\tctx = newCtx\n\t\t// Cancel the timeout-derived context at the end of Execute to avoid a context leak.\n\t\tdefer cancelFunc()\n\t}\n\n\t// Delete document in files collection and then chunks to minimize race conditions.\n\tres, err := b.filesColl.DeleteOne(ctx, bson.D{{\"_id\", fileID}})\n\tif err == nil && res.DeletedCount == 0 {\n\t\terr = ErrFileNotFound\n\t}\n\tif err != nil {\n\t\t_ = b.deleteChunks(ctx, fileID) // Can attempt to delete chunks even if no docs in files collection matched.\n\t\treturn err\n\t}\n\n\treturn b.deleteChunks(ctx, fileID)\n}", "func (material *Material) DeleteInContext(ctx *aero.Context) error {\n\treturn material.Delete()\n}", "func (c *OrganizationsApisRevisionsDeleteCall) Context(ctx context.Context) *OrganizationsApisRevisionsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteV1WebhooksWebhookIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteRestapiV10AccountAccountIDExtensionExtensionIDMessageStoreMessageIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *ProjectsPatchDeploymentsDeleteCall) Context(ctx context.Context) *ProjectsPatchDeploymentsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteTagParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *AppsModulesVersionsDeleteCall) Context(ctx context.Context) *AppsModulesVersionsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteVersionControlRequestParams) WithContext(ctx context.Context) *DeleteVersionControlRequestParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *AdminDeleteProfanityFilterParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteConditionParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteBlueprintsInWorkspaceParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *Client) DeleteContext(keyname string) error {\n\n\tc.m.Lock()\n\tdefer c.m.Unlock()\n\n\tctx, ok := c.ctx[keyname]\n\tif !ok {\n\t\treturn errors.New(\"No such context\")\n\t}\n\n\tctx.client.Destroy()\n\n\tdelete(c.ctx, keyname)\n\n\treturn nil\n}", "func (o *DeleteNetworkGroupPolicyParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PatchStorageVirtualDriveExtensionsMoidParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *OrganizationsApiproductsAttributesDeleteCall) Context(ctx context.Context) *OrganizationsApiproductsAttributesDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteNtpServerParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteChartrepoRepoChartsNameVersionLabelsIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeletePoolProjectParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (_obj *DataService) DeleteActivityRecordOneWayWithContext(tarsCtx context.Context, activity_id string, wx_id string, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(activity_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(wx_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"deleteActivityRecord\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (c *PropertiesWebDataStreamsMeasurementProtocolSecretsDeleteCall) Context(ctx context.Context) *PropertiesWebDataStreamsMeasurementProtocolSecretsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}" ]
[ "0.66318446", "0.6619967", "0.61802596", "0.6071842", "0.6011937", "0.59528744", "0.57643175", "0.56513625", "0.56484604", "0.56130177", "0.5583455", "0.5573217", "0.5562416", "0.5535417", "0.5529479", "0.5527358", "0.55204093", "0.5519037", "0.55094343", "0.5493999", "0.54924464", "0.5465449", "0.5453682", "0.54522926", "0.54501975", "0.5446419", "0.5425906", "0.5425195", "0.54180413", "0.5413311", "0.5396725", "0.5395351", "0.5388578", "0.5385555", "0.5376396", "0.5351098", "0.53356975", "0.5335197", "0.53338104", "0.53298783", "0.5322833", "0.53042626", "0.5301756", "0.53012216", "0.5296832", "0.528788", "0.52835554", "0.527684", "0.5273054", "0.5272508", "0.52721876", "0.5267541", "0.52644914", "0.52533036", "0.5248373", "0.5246007", "0.52446085", "0.52371764", "0.5231704", "0.5221293", "0.5221091", "0.52174884", "0.5217239", "0.5216747", "0.5213936", "0.52133566", "0.52097595", "0.5207813", "0.51912105", "0.51857585", "0.5180597", "0.51734287", "0.51708394", "0.51604396", "0.5154539", "0.51477414", "0.51470846", "0.5145743", "0.5135102", "0.5134207", "0.5130057", "0.51281214", "0.5116972", "0.51149523", "0.51097685", "0.5107155", "0.5097996", "0.5095432", "0.5093356", "0.50932574", "0.50922567", "0.50896305", "0.5084938", "0.50820744", "0.5081215", "0.50805444", "0.5077397", "0.50676805", "0.50616527", "0.5058" ]
0.70238644
0
WithHTTPClient adds the HTTPClient to the vvol binding delete params
func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams { o.SetHTTPClient(client) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *VolumeDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *VolumeDeleteParams) WithHTTPClient(client *http.Client) *VolumeDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteProtocolUsingDELETEParams) WithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteProtocolUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteDebugRequestParams) WithHTTPClient(client *http.Client) *DeleteDebugRequestParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewVolumeDeleteParamsWithHTTPClient(client *http.Client) *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteKeyPairsParams) WithHTTPClient(client *http.Client) *DeleteKeyPairsParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteTagParams) WithHTTPClient(client *http.Client) *DeleteTagParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteDeviceUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteVersionControlRequestParams) WithHTTPClient(client *http.Client) *DeleteVersionControlRequestParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewVvolBindingDeleteParamsWithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func DeleteClient(nbmaster string, httpClient *http.Client, jwt string) {\r\n fmt.Printf(\"\\nSending a DELETE request to delete client %s from policy %s...\\n\", testClientName, testPolicyName)\r\n\r\n uri := \"https://\" + nbmaster + \":\" + port + \"/netbackup/\" + policiesUri + testPolicyName + \"/clients/\" + testClientName\r\n\r\n request, _ := http.NewRequest(http.MethodDelete, uri, nil)\r\n request.Header.Add(\"Authorization\", jwt);\r\n\r\n response, err := httpClient.Do(request)\r\n\r\n if err != nil {\r\n fmt.Printf(\"The HTTP request failed with error: %s\\n\", err)\r\n panic(\"Unable to delete client.\\n\")\r\n } else {\r\n if response.StatusCode != 204 {\r\n printErrorResponse(response)\r\n } else {\r\n fmt.Printf(\"%s deleted successfully.\\n\", testClientName);\r\n }\r\n }\r\n}", "func (o *BundleProductOptionRepositoryV1DeleteByIDDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ComponentDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewDeleteTagParamsWithHTTPClient(client *http.Client) *DeleteTagParams {\n\tvar ()\n\treturn &DeleteTagParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteDebugRequestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CompanyCompanyRepositoryV1DeleteByIDDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteTagParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteKeyPairsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteVersionControlRequestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteUsingDELETE1Params) WithHTTPClient(client *http.Client) *DeleteUsingDELETE1Params {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeletePacketCapturesParams) WithHTTPClient(client *http.Client) *DeletePacketCapturesParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *NegotiableQuoteCouponManagementV1RemoveDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteAttributeParams) WithHTTPClient(client *http.Client) *DeleteAttributeParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *ComponentDeleteParams) WithHTTPClient(client *http.Client) *ComponentDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *NodesDelTagByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteDataSourceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ReposDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) WithHTTPClient(client *http.Client) *DeleteGerritListenerByIDUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeletePacketCapturesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePoolProjectParams) WithHTTPClient(client *http.Client) *DeletePoolProjectParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteConditionParams) WithHTTPClient(client *http.Client) *DeleteConditionParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteLoadBalancerPoolParams) WithHTTPClient(client *http.Client) *DeleteLoadBalancerPoolParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) WithHTTPClient(client *http.Client) *DeleteBlueprintRequestUsingDELETE1Params {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *SalesRuleCouponRepositoryV1DeleteByIDDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteProtectedEntityParams) WithHTTPClient(client *http.Client) *DeleteProtectedEntityParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteDataSourceParams) WithHTTPClient(client *http.Client) *DeleteDataSourceParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteUsingDELETE1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteLoadBalancerPoolParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EntryServiceDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePackageVersionParams) WithHTTPClient(client *http.Client) *DeletePackageVersionParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *NvmeNamespaceDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteFreeIpaByEnvironmentV1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *OrderDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePoolProjectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteConditionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteCwfNetworkIDParams) WithHTTPClient(client *http.Client) *DeleteCwfNetworkIDParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteSubscribedEventParams) WithHTTPClient(client *http.Client) *DeleteSubscribedEventParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeletePackageVersionParamsWithHTTPClient(client *http.Client) *DeletePackageVersionParams {\n\tvar ()\n\treturn &DeletePackageVersionParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteProtectedEntityParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteSubscribedEventParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EmsDestinationDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteCwfNetworkIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RemoveGKECredentialParams) WithHTTPClient(client *http.Client) *RemoveGKECredentialParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteAttributeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewDeleteDataSourceParamsWithHTTPClient(client *http.Client) *DeleteDataSourceParams {\n\treturn &DeleteDataSourceParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteNodeParams) WithHTTPClient(client *http.Client) *DeleteNodeParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteNodeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePackageVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RemoveDropRequestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewComponentDeleteParamsWithHTTPClient(client *http.Client) *ComponentDeleteParams {\n\treturn &ComponentDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteDeviceUsingDELETEParams) WithHTTPClient(client *http.Client) *DeleteDeviceUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteBlueprintsInWorkspaceParams) WithHTTPClient(client *http.Client) *DeleteBlueprintsInWorkspaceParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) WithHTTPClient(client *http.Client) *RevokeDeviceCertificateUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *PostHostStorageSectorsDeleteMerklerootParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewDeleteProtocolUsingDELETEParamsWithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *TokenDeleteOrgParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ActionsRemoveParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ReposDeleteParams) WithHTTPClient(client *http.Client) *ReposDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteV1WebhooksWebhookIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteUserAttributeParams) WithHTTPClient(client *http.Client) *DeleteUserAttributeParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteNodeParamsWithHTTPClient(client *http.Client) *DeleteNodeParams {\n\tvar ()\n\treturn &DeleteNodeParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteSubnetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePrincipalIdentityParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteNetworkGroupPolicyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PcloudPlacementgroupsMembersDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ServiceInstanceDeprovisionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RemoveGKECredentialParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteCatalogsByIDSharedVariationAttributesByIDValuesByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteSiteDeployParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteMsgVpnRestDeliveryPointRestConsumerTLSTrustedCommonNameParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewDeleteAttributeParamsWithHTTPClient(client *http.Client) *DeleteAttributeParams {\n\tvar ()\n\treturn &DeleteAttributeParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *RemoveDropRequestParams) WithHTTPClient(client *http.Client) *RemoveDropRequestParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *PublicRemoveTrustedDeviceV4Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteBlueprintsInWorkspaceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *OrderDeleteParams) WithHTTPClient(client *http.Client) *OrderDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteBasketsByIDPaymentInstrumentsByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *NodesDelTagByIDParams) WithHTTPClient(client *http.Client) *NodesDelTagByIDParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *APIDeleteUserParams) WithHTTPClient(client *http.Client) *APIDeleteUserParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *EntryServiceDeleteParams) WithHTTPClient(client *http.Client) *EntryServiceDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteSubnetParams) WithHTTPClient(client *http.Client) *DeleteSubnetParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteSupportUserParams) WithHTTPClient(client *http.Client) *DeleteSupportUserParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) WithHTTPClient(client *http.Client) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteVersionControlRequestParamsWithHTTPClient(client *http.Client) *DeleteVersionControlRequestParams {\n\treturn &DeleteVersionControlRequestParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *AdminDeleteProfanityFilterParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}" ]
[ "0.7519185", "0.6756765", "0.66501546", "0.6649163", "0.66412854", "0.65906143", "0.65437907", "0.6530756", "0.64375067", "0.64069736", "0.64000154", "0.6371847", "0.63688064", "0.6310587", "0.62990755", "0.6244727", "0.62355083", "0.61710334", "0.6162737", "0.6149288", "0.6124617", "0.6099622", "0.6095701", "0.60792255", "0.6073321", "0.60731953", "0.60722715", "0.607167", "0.6051747", "0.6039121", "0.60351044", "0.602792", "0.6015688", "0.6011999", "0.60102373", "0.60049194", "0.6002282", "0.5998462", "0.5997563", "0.59890014", "0.5980168", "0.59741044", "0.59740126", "0.59712255", "0.59516275", "0.5940537", "0.59201705", "0.5900349", "0.58977515", "0.5897701", "0.58871865", "0.58869845", "0.5886361", "0.5874923", "0.5874241", "0.5853086", "0.5848485", "0.58394015", "0.5837704", "0.5835981", "0.5816008", "0.5808681", "0.5793267", "0.5786067", "0.5774887", "0.5774071", "0.57693535", "0.57693464", "0.57652014", "0.57605183", "0.57596934", "0.5758972", "0.5738742", "0.573758", "0.57207066", "0.5714043", "0.5705986", "0.56940764", "0.56900084", "0.56825185", "0.5669456", "0.56672347", "0.56573594", "0.5655325", "0.56513137", "0.5647913", "0.5646679", "0.56392246", "0.56356466", "0.5608155", "0.5589216", "0.55823267", "0.5566009", "0.55597425", "0.55384594", "0.55297995", "0.55294704", "0.55235916", "0.5521578", "0.55038387" ]
0.7508446
1
SetHTTPClient adds the HTTPClient to the vvol binding delete params
func (o *VvolBindingDeleteParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VolumeDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteProtocolUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteDeviceUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ComponentDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteDebugRequestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteVersionControlRequestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteTagParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *BundleProductOptionRepositoryV1DeleteByIDDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteDataSourceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteKeyPairsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *NodesDelTagByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteLoadBalancerPoolParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ReposDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePacketCapturesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePoolProjectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CompanyCompanyRepositoryV1DeleteByIDDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *NegotiableQuoteCouponManagementV1RemoveDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EntryServiceDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteProtectedEntityParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteUsingDELETE1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *NvmeNamespaceDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteConditionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteCwfNetworkIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SalesRuleCouponRepositoryV1DeleteByIDDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RemoveDropRequestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteAttributeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePackageVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteNodeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ActionsRemoveParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *OrderDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteFreeIpaByEnvironmentV1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteNetworkGroupPolicyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteSubscribedEventParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostHostStorageSectorsDeleteMerklerootParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EmsDestinationDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RemoveGKECredentialParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePrincipalIdentityParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *TokenDeleteOrgParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PublicRemoveTrustedDeviceV4Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteV1WebhooksWebhookIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteProtocolUsingDELETEParams) WithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteBlueprintsInWorkspaceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteCatalogsByIDSharedVariationAttributesByIDValuesByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ServiceInstanceDeprovisionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteSiteDeployParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteMsgVpnRestDeliveryPointRestConsumerTLSTrustedCommonNameParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteSubnetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteBasketsByIDPaymentInstrumentsByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteNtpServerParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteChartrepoRepoChartsNameVersionLabelsIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteNamespaceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteDevicesDeviceidInterfacesInterfacenameParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AdminDeleteProfanityFilterParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RemoveAPIKeyPrivilegeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PcloudPlacementgroupsMembersDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteSiteSnippetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteActionTemplateSpacesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *MonitorDeleteMaintenancePeriodFromMonitorParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteClusterParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *APIDeleteUserParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteGroupConfigurationAdminV1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteSystemObjectDefinitionsByIDAttributeGroupsByIDAttributeDefinitionsByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteDebugRequestParams) WithHTTPClient(client *http.Client) *DeleteDebugRequestParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteSupportUserParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteLTENetworkIDNetworkProbeTasksTaskIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *VolumeDeleteParams) WithHTTPClient(client *http.Client) *VolumeDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteLifecycleSpacesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteTagParams) WithHTTPClient(client *http.Client) *DeleteTagParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteRequestsRequestNameParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RemoveControlFromGroupParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteUserAttributeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UsersGroupsBulkDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *StreamsDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteReadonlyClusterParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RemoveReceiverParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteScheduleParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteRestapiV10AccountAccountIDExtensionExtensionIDMessageStoreMessageIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteAlertingProfileParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteVersionControlRequestParams) WithHTTPClient(client *http.Client) *DeleteVersionControlRequestParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteSubnetsSubnetPoolParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteClusterClusterIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteaspecificEmergencyMappingContainerParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteKubeClusterParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteKeyPairsParams) WithHTTPClient(client *http.Client) *DeleteKeyPairsParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteSyslogPoliciesMoidParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *MultiDeleteIssueAttachmentOfIssueParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func DeleteClient(nbmaster string, httpClient *http.Client, jwt string) {\r\n fmt.Printf(\"\\nSending a DELETE request to delete client %s from policy %s...\\n\", testClientName, testPolicyName)\r\n\r\n uri := \"https://\" + nbmaster + \":\" + port + \"/netbackup/\" + policiesUri + testPolicyName + \"/clients/\" + testClientName\r\n\r\n request, _ := http.NewRequest(http.MethodDelete, uri, nil)\r\n request.Header.Add(\"Authorization\", jwt);\r\n\r\n response, err := httpClient.Do(request)\r\n\r\n if err != nil {\r\n fmt.Printf(\"The HTTP request failed with error: %s\\n\", err)\r\n panic(\"Unable to delete client.\\n\")\r\n } else {\r\n if response.StatusCode != 204 {\r\n printErrorResponse(response)\r\n } else {\r\n fmt.Printf(\"%s deleted successfully.\\n\", testClientName);\r\n }\r\n }\r\n}", "func (o *DeleteAPI24ProtectionGroupSnapshotsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RevertProductSnapshotRequestUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteDataSourceParams) WithHTTPClient(client *http.Client) *DeleteDataSourceParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DecryptParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteUserMetaTagsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteV1PostMortemsReportsReportIDReasonsReasonIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *StopGatewayBundleUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *NetworkPruneParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}" ]
[ "0.75474316", "0.74891007", "0.7454922", "0.73563224", "0.7226734", "0.719675", "0.71747655", "0.7127238", "0.7110341", "0.7092532", "0.70717365", "0.70638525", "0.70218146", "0.701651", "0.70134234", "0.70107466", "0.7001641", "0.6992659", "0.69905186", "0.69791144", "0.69666094", "0.6936348", "0.6934794", "0.6921718", "0.6883253", "0.6843424", "0.6826944", "0.6823938", "0.6820961", "0.681292", "0.6797056", "0.679551", "0.67817193", "0.6775884", "0.6767493", "0.6746643", "0.6740402", "0.67390674", "0.6736343", "0.6734648", "0.6732908", "0.66911703", "0.6689478", "0.66867274", "0.6676347", "0.6627396", "0.6619128", "0.6614608", "0.66074866", "0.6604125", "0.6573731", "0.657266", "0.65417963", "0.6533266", "0.6506494", "0.64928627", "0.6489005", "0.64884555", "0.64872116", "0.64795405", "0.64763904", "0.64732283", "0.6457858", "0.64534056", "0.6434753", "0.64323324", "0.6423375", "0.64133716", "0.6404281", "0.64030844", "0.6402742", "0.6391938", "0.63850725", "0.63717854", "0.6370852", "0.63635993", "0.6359136", "0.63415945", "0.6341302", "0.6332653", "0.63308567", "0.63296926", "0.63282895", "0.63199985", "0.6313481", "0.6299464", "0.6285556", "0.62852895", "0.6270187", "0.62681746", "0.6236154", "0.6230363", "0.6216558", "0.6195851", "0.6147913", "0.6147406", "0.61458576", "0.6129118", "0.61205155", "0.61129344" ]
0.81960213
0
WithDeleteAllReferences adds the deleteAllReferences to the vvol binding delete params
func (o *VvolBindingDeleteParams) WithDeleteAllReferences(deleteAllReferences *bool) *VvolBindingDeleteParams { o.SetDeleteAllReferences(deleteAllReferences) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) SetDeleteAllReferences(deleteAllReferences *bool) {\n\to.DeleteAllReferences = deleteAllReferences\n}", "func (o *VvolBindingDeleteParams) SetDefaults() {\n\tvar (\n\t\tdeleteAllReferencesDefault = bool(false)\n\t)\n\n\tval := VvolBindingDeleteParams{\n\t\tDeleteAllReferences: &deleteAllReferencesDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o FeatureCvtermDbxrefSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no FeatureCvtermDbxref slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(featureCvtermDbxrefBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), featureCvtermDbxrefPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"feature_cvterm_dbxref\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, featureCvtermDbxrefPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(featureCvtermDbxrefPrimaryKeyColumns), 1, len(featureCvtermDbxrefPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from featureCvtermDbxref slice\")\n\t}\n\n\tif len(featureCvtermDbxrefAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o *VvolBindingDeleteParams) WithDefaults() *VvolBindingDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o FeatureCvtermDbxrefSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o FeatureCvtermDbxrefSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no FeatureCvtermDbxref slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (q featureCvtermDbxrefQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q featureCvtermDbxrefQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"chado: no featureCvtermDbxrefQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from feature_cvterm_dbxref\")\n\t}\n\n\treturn nil\n}", "func (o VoteSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Vote slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(voteBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), votePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `vote` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, votePrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from vote slice\")\n\t}\n\n\tif len(voteAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o PeerSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(peerBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), peerPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `peers` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, peerPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: unable to delete all from peer slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: failed to get rows affected by deleteall for peers\")\n\t}\n\n\tif len(peerAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o BraceletPhotoSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no BraceletPhoto slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), braceletPhotoPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM `bracelet_photo` WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, braceletPhotoPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(braceletPhotoPrimaryKeyColumns), 1, len(braceletPhotoPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from braceletPhoto slice\")\n\t}\n\n\treturn nil\n}", "func (fkw *FakeClientWrapper) DeleteAllOf(ctx context.Context, obj runtime.Object, opts ...k8sCl.DeleteAllOfOption) error {\n\treturn fkw.client.DeleteAllOf(ctx, obj, opts...)\n}", "func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o AddressSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"sqlboiler: no Address slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(addressBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), addressPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `address` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, addressPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sqlboiler: unable to delete all from address slice\")\n\t}\n\n\tif len(addressAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o PeerPropertySlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(peerPropertyBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), peerPropertyPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"peer_properties\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, peerPropertyPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from peerProperty slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for peer_properties\")\n\t}\n\n\tif len(peerPropertyAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (q braceletPhotoQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"models: no braceletPhotoQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from bracelet_photo\")\n\t}\n\n\treturn nil\n}", "func (o VoteSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), votePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"vote\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, votePrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from vote slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for vote\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o FeatureCvtermDbxrefSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o BraceletPhotoSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no BraceletPhoto slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (q assetRevisionQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o APIKeySlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no APIKey slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(apiKeyBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), apiKeyPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"api_keys\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, apiKeyPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from apiKey slice\")\n\t}\n\n\tif len(apiKeyAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o VSPSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), vspPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"vsp\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, vspPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from vsp slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for vsp\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (d *Demo) DeleteAll(g *gom.Gom) {\n\ttoolkit.Println(\"===== Delete All =====\")\n\n\tvar err error\n\tif d.useParams {\n\t\t_, err = g.Set(&gom.SetParams{\n\t\t\tTableName: \"hero\",\n\t\t\tFilter: gom.EndWith(\"Name\", \"man\"),\n\t\t\tTimeout: 10,\n\t\t}).Cmd().DeleteAll()\n\t} else {\n\t\t_, err = g.Set(nil).Table(\"hero\").Timeout(10).Filter(gom.EndWith(\"Name\", \"man\")).Cmd().DeleteAll()\n\t}\n\n\tif err != nil {\n\t\ttoolkit.Println(err.Error())\n\t\treturn\n\t}\n}", "func (o HoldenAtSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), holdenAtPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"HoldenAt\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, holdenAtPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from holdenAt slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for HoldenAt\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o AssetRevisionSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"public: no AssetRevision slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(assetRevisionBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), assetRevisionPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tquery := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"asset_revision\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, assetRevisionPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(assetRevisionPrimaryKeyColumns), 1, len(assetRevisionPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, query)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(query, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"public: unable to delete all from assetRevision slice\")\n\t}\n\n\tif len(assetRevisionAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (q holdenAtQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no holdenAtQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from HoldenAt\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for HoldenAt\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o AddressSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"sqlboiler: no Address slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func NewVvolBindingDeleteParams() *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o AddressSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o DocSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(docBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), docPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `doc` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, docPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from doc slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for doc\")\n\t}\n\n\tif len(docAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o VoteSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Vote slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o CMFBalanceChargeAdminSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cmfBalanceChargeAdminBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cmfBalanceChargeAdminPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `cmf_balance_charge_admin` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, cmfBalanceChargeAdminPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from cmfBalanceChargeAdmin slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for cmf_balance_charge_admin\")\n\t}\n\n\tif len(cmfBalanceChargeAdminAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (m *MockVirtualMeshCertificateSigningRequestClient) DeleteAllOfVirtualMeshCertificateSigningRequest(ctx context.Context, opts ...client.DeleteAllOfOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DeleteAllOfVirtualMeshCertificateSigningRequest\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (o BuildingSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif o == nil {\n\t\treturn 0, errors.New(\"record: no Building slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(buildingBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), buildingPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"buildings\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, buildingPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: unable to delete all from building slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: failed to get rows affected by deleteall for buildings\")\n\t}\n\n\tif len(buildingAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (r *FakeClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error {\n\t// TODO (covariance) implement me!\n\tpanic(\"not implemented\")\n}", "func (q assetRevisionQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"public: no assetRevisionQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"public: unable to delete all from asset_revision\")\n\t}\n\n\treturn nil\n}", "func (m *MockVirtualMeshCertificateSigningRequestWriter) DeleteAllOfVirtualMeshCertificateSigningRequest(ctx context.Context, opts ...client.DeleteAllOfOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DeleteAllOfVirtualMeshCertificateSigningRequest\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (o FeatureRelationshipSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no FeatureRelationship slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(featureRelationshipBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), featureRelationshipPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"feature_relationship\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, featureRelationshipPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(featureRelationshipPrimaryKeyColumns), 1, len(featureRelationshipPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from featureRelationship slice\")\n\t}\n\n\tif len(featureRelationshipAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (g *Group) DeleteAll() {\n\tg.Equivalents = list.New()\n\tg.Fingerprints = make(map[string]*list.Element)\n\tg.FirstExpr = make(map[Operand]*list.Element)\n\tg.SelfFingerprint = \"\"\n}", "func (o AssetRevisionSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"public: no AssetRevision slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o AssetRevisionSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o ContentUnitDerivationSlice) DeleteAll(exec boil.Executor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), contentUnitDerivationPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"content_unit_derivations\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, contentUnitDerivationPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\tresult, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"mdbmodels: unable to delete all from contentUnitDerivation slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"mdbmodels: failed to get rows affected by deleteall for content_unit_derivations\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o *VvolBindingDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DeleteAllReferences != nil {\n\n\t\t// query param delete_all_references\n\t\tvar qrDeleteAllReferences bool\n\n\t\tif o.DeleteAllReferences != nil {\n\t\t\tqrDeleteAllReferences = *o.DeleteAllReferences\n\t\t}\n\t\tqDeleteAllReferences := swag.FormatBool(qrDeleteAllReferences)\n\t\tif qDeleteAllReferences != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"delete_all_references\", qDeleteAllReferences); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param protocol_endpoint.uuid\n\tif err := r.SetPathParam(\"protocol_endpoint.uuid\", o.ProtocolEndpointUUID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vvol.uuid\n\tif err := r.SetPathParam(\"vvol.uuid\", o.VvolUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (q vspQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no vspQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from vsp\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for vsp\")\n\t}\n\n\treturn rowsAff, nil\n}", "func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o ForeignLegalResourceSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), foreignLegalResourcePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"ForeignLegalResources\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, foreignLegalResourcePrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from foreignLegalResource slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for ForeignLegalResources\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (mr *MockVirtualMeshCertificateSigningRequestClientMockRecorder) DeleteAllOfVirtualMeshCertificateSigningRequest(ctx interface{}, opts ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{ctx}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteAllOfVirtualMeshCertificateSigningRequest\", reflect.TypeOf((*MockVirtualMeshCertificateSigningRequestClient)(nil).DeleteAllOfVirtualMeshCertificateSigningRequest), varargs...)\n}", "func (o BlockSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), blockPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"block\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, blockPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from block slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for block\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o AuthorSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"mdbmdbmodels: no Author slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), authorPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"authors\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, authorPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mdbmdbmodels: unable to delete all from author slice\")\n\t}\n\n\treturn nil\n}", "func (o FeatureRelationshipSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q buildingQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"record: no buildingQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: unable to delete all from buildings\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: failed to get rows affected by deleteall for buildings\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o ChannelSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(channelBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), channelPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"channels\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, channelPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from channel slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for channels\")\n\t}\n\n\tif len(channelAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o MempoolBinSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), mempoolBinPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"mempool_bin\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, mempoolBinPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from mempoolBin slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for mempool_bin\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o APIKeySlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no APIKey slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o RSSAnnouncementSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), rssAnnouncementPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"rss_announcements\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, rssAnnouncementPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from rssAnnouncement slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for rss_announcements\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o RecipeAdditiveSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(recipeAdditiveBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), recipeAdditivePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"recipe_additive\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, recipeAdditivePrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from recipeAdditive slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for recipe_additive\")\n\t}\n\n\tif len(recipeAdditiveAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (q peerQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"model: no peerQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: unable to delete all from peers\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: failed to get rows affected by deleteall for peers\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o RentalSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"sqlboiler: no Rental slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(rentalBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), rentalPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `rental` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, rentalPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sqlboiler: unable to delete all from rental slice\")\n\t}\n\n\tif len(rentalAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (q featureRelationshipQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o CvtermsynonymSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no Cvtermsynonym slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(cvtermsynonymBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cvtermsynonymPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"cvtermsynonym\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, cvtermsynonymPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(cvtermsynonymPrimaryKeyColumns), 1, len(cvtermsynonymPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from cvtermsynonym slice\")\n\t}\n\n\tif len(cvtermsynonymAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o KvstoreSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(kvstoreBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), kvstorePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"kvstore\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, kvstorePrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from kvstore slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for kvstore\")\n\t}\n\n\tif len(kvstoreAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o AssetRevisionSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (s *service) DeleteAll(ctx context.Context, req *pb.Request, res *pb.Response) error {\n\tdone, err := s.repo.DeleteAll(\"\")\n\tif err != nil {\n\t\ttheerror := fmt.Sprintf(\"%v --from souscription_service\", err)\n\t\treturn errors.New(theerror)\n\t}\n\tres.Done = done\n\treturn nil\n}", "func (o PublisherSearchIdxSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(publisherSearchIdxBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), publisherSearchIdxPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"publisher_search_idx\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, publisherSearchIdxPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from publisherSearchIdx slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for publisher_search_idx\")\n\t}\n\n\tif len(publisherSearchIdxAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (mr *MockVirtualMeshCertificateSigningRequestWriterMockRecorder) DeleteAllOfVirtualMeshCertificateSigningRequest(ctx interface{}, opts ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{ctx}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteAllOfVirtualMeshCertificateSigningRequest\", reflect.TypeOf((*MockVirtualMeshCertificateSigningRequestWriter)(nil).DeleteAllOfVirtualMeshCertificateSigningRequest), varargs...)\n}", "func (q publisherSearchIdxQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no publisherSearchIdxQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from publisher_search_idx\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for publisher_search_idx\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o DMessageEmbedSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no DMessageEmbed slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), dMessageEmbedPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"d_message_embeds\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, dMessageEmbedPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(dMessageEmbedPrimaryKeyColumns), 1, len(dMessageEmbedPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from dMessageEmbed slice\")\n\t}\n\n\treturn nil\n}", "func (o AddressSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o RecipeLipidSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(recipeLipidBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), recipeLipidPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"recipe_lipid\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, recipeLipidPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from recipeLipid slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for recipe_lipid\")\n\t}\n\n\tif len(recipeLipidAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (q voteQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no voteQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from vote\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for vote\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q braceletPhotoQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q mempoolBinQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no mempoolBinQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from mempool_bin\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for mempool_bin\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o SegmentSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(segmentBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), segmentPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"segment\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, segmentPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"boiler: unable to delete all from segment slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"boiler: failed to get rows affected by deleteall for segment\")\n\t}\n\n\tif len(segmentAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o FriendshipSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(friendshipBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), friendshipPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `friendship` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, friendshipPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from friendship slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for friendship\")\n\t}\n\n\tif len(friendshipAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o FeatureRelationshipSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no FeatureRelationship slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o PhenotypepropSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no Phenotypeprop slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o AuthorSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o CommentSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Comment slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(commentBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), commentPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `comment` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, commentPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from comment slice\")\n\t}\n\n\tif len(commentAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (q voteQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"models: no voteQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from vote\")\n\t}\n\n\treturn nil\n}", "func (q peerPropertyQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no peerPropertyQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from peer_properties\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for peer_properties\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q addressQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o CurrencySlice) DeleteAll(exec boil.Executor) (int64, error) {\n\tif o == nil {\n\t\treturn 0, errors.New(\"models: no Currency slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(currencyBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), currencyPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"currency\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, currencyPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\tresult, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from currency slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for currency\")\n\t}\n\n\tif len(currencyAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o JetSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Jet slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (q foreignLegalResourceQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no foreignLegalResourceQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from ForeignLegalResources\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for ForeignLegalResources\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o AuthSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Auth slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(authBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), authPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"auths\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, authPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from auth slice\")\n\t}\n\n\tif len(authAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (b *Builder) Delete(conds ...Cond) *Builder {\r\n\tb.cond = b.cond.And(conds...)\r\n\tb.optype = deleteType\r\n\treturn b\r\n}", "func (o AuthorSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q stockCvtermQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o VoteSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q voteQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o AuthorSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"mdbmdbmodels: no Author slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o PhenotypepropSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no Phenotypeprop slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(phenotypepropBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), phenotypepropPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"phenotypeprop\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, phenotypepropPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(phenotypepropPrimaryKeyColumns), 1, len(phenotypepropPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from phenotypeprop slice\")\n\t}\n\n\tif len(phenotypepropAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o RawVisitSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(rawVisitBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), rawVisitPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"raw_visits\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, rawVisitPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from rawVisit slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for raw_visits\")\n\t}\n\n\tif len(rawVisitAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (q recipeLipidQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no recipeLipidQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from recipe_lipid\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for recipe_lipid\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q apiKeyQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"models: no apiKeyQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from api_keys\")\n\t}\n\n\treturn nil\n}", "func (o PaymentObjectSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(paymentObjectBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), paymentObjectPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `payment_objects` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, paymentObjectPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from paymentObject slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for payment_objects\")\n\t}\n\n\tif len(paymentObjectAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (q apiKeyQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func DeleteAll(db *sqlx.DB) error {\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := tx.Exec(deleteDoc); err != nil {\n\t\tif err := tx.Rollback(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn err\n\t}\n\n\treturn tx.Commit()\n}", "func (o SourceSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"mdbmdbmodels: no Source slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), sourcePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"sources\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, sourcePrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mdbmdbmodels: unable to delete all from source slice\")\n\t}\n\n\treturn nil\n}", "func (o AuthSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}" ]
[ "0.7380496", "0.6893267", "0.6104744", "0.604309", "0.58674455", "0.58534765", "0.5822575", "0.5779294", "0.5631722", "0.5625062", "0.5582434", "0.5573762", "0.5568083", "0.5548098", "0.55454016", "0.5544827", "0.5540688", "0.55064595", "0.54958194", "0.5486631", "0.54630715", "0.54456955", "0.543123", "0.5427109", "0.54192597", "0.5415218", "0.5412514", "0.5410719", "0.53949773", "0.53911966", "0.5384627", "0.53730714", "0.5372073", "0.53622913", "0.5362068", "0.53532857", "0.5351997", "0.53513104", "0.5338415", "0.5333983", "0.5332838", "0.53021896", "0.52997804", "0.5298733", "0.5296856", "0.5296471", "0.5293705", "0.5290165", "0.52885944", "0.52841526", "0.5281965", "0.52813613", "0.5280715", "0.5279059", "0.52729934", "0.5266435", "0.5264655", "0.5263149", "0.5252919", "0.5249838", "0.52486634", "0.52483773", "0.52451324", "0.5244675", "0.5243209", "0.524306", "0.5235687", "0.52353287", "0.5235217", "0.5232034", "0.5231531", "0.5227261", "0.5221335", "0.521504", "0.5209455", "0.5207776", "0.5207694", "0.5204492", "0.51984006", "0.5184591", "0.51834935", "0.5179698", "0.51788753", "0.51758915", "0.5167884", "0.51661557", "0.51661277", "0.51581264", "0.5157769", "0.51544553", "0.51517045", "0.5149557", "0.51366556", "0.51347935", "0.51256335", "0.5125593", "0.5125022", "0.5122161", "0.5121196", "0.5114483" ]
0.74422747
0
SetDeleteAllReferences adds the deleteAllReferences to the vvol binding delete params
func (o *VvolBindingDeleteParams) SetDeleteAllReferences(deleteAllReferences *bool) { o.DeleteAllReferences = deleteAllReferences }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) WithDeleteAllReferences(deleteAllReferences *bool) *VvolBindingDeleteParams {\n\to.SetDeleteAllReferences(deleteAllReferences)\n\treturn o\n}", "func (o *VvolBindingDeleteParams) SetDefaults() {\n\tvar (\n\t\tdeleteAllReferencesDefault = bool(false)\n\t)\n\n\tval := VvolBindingDeleteParams{\n\t\tDeleteAllReferences: &deleteAllReferencesDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o FeatureCvtermDbxrefSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no FeatureCvtermDbxref slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(featureCvtermDbxrefBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), featureCvtermDbxrefPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"feature_cvterm_dbxref\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, featureCvtermDbxrefPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(featureCvtermDbxrefPrimaryKeyColumns), 1, len(featureCvtermDbxrefPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from featureCvtermDbxref slice\")\n\t}\n\n\tif len(featureCvtermDbxrefAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o FeatureCvtermDbxrefSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q featureCvtermDbxrefQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q featureCvtermDbxrefQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"chado: no featureCvtermDbxrefQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from feature_cvterm_dbxref\")\n\t}\n\n\treturn nil\n}", "func (o FeatureCvtermDbxrefSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no FeatureCvtermDbxref slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o FeatureCvtermDbxrefSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o PeerPropertySlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(peerPropertyBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), peerPropertyPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"peer_properties\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, peerPropertyPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from peerProperty slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for peer_properties\")\n\t}\n\n\tif len(peerPropertyAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (q braceletPhotoQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"models: no braceletPhotoQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from bracelet_photo\")\n\t}\n\n\treturn nil\n}", "func (q assetRevisionQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o PeerSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(peerBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), peerPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `peers` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, peerPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: unable to delete all from peer slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: failed to get rows affected by deleteall for peers\")\n\t}\n\n\tif len(peerAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o BraceletPhotoSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no BraceletPhoto slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), braceletPhotoPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM `bracelet_photo` WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, braceletPhotoPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(braceletPhotoPrimaryKeyColumns), 1, len(braceletPhotoPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from braceletPhoto slice\")\n\t}\n\n\treturn nil\n}", "func (o AddressSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"sqlboiler: no Address slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(addressBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), addressPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `address` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, addressPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sqlboiler: unable to delete all from address slice\")\n\t}\n\n\tif len(addressAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o VoteSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Vote slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(voteBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), votePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `vote` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, votePrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from vote slice\")\n\t}\n\n\tif len(voteAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o CvtermsynonymSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no Cvtermsynonym slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(cvtermsynonymBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cvtermsynonymPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"cvtermsynonym\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, cvtermsynonymPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(cvtermsynonymPrimaryKeyColumns), 1, len(cvtermsynonymPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from cvtermsynonym slice\")\n\t}\n\n\tif len(cvtermsynonymAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o *VvolBindingDeleteParams) WithDefaults() *VvolBindingDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func (g *Group) DeleteAll() {\n\tg.Equivalents = list.New()\n\tg.Fingerprints = make(map[string]*list.Element)\n\tg.FirstExpr = make(map[Operand]*list.Element)\n\tg.SelfFingerprint = \"\"\n}", "func (o AddressSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (d *Demo) DeleteAll(g *gom.Gom) {\n\ttoolkit.Println(\"===== Delete All =====\")\n\n\tvar err error\n\tif d.useParams {\n\t\t_, err = g.Set(&gom.SetParams{\n\t\t\tTableName: \"hero\",\n\t\t\tFilter: gom.EndWith(\"Name\", \"man\"),\n\t\t\tTimeout: 10,\n\t\t}).Cmd().DeleteAll()\n\t} else {\n\t\t_, err = g.Set(nil).Table(\"hero\").Timeout(10).Filter(gom.EndWith(\"Name\", \"man\")).Cmd().DeleteAll()\n\t}\n\n\tif err != nil {\n\t\ttoolkit.Println(err.Error())\n\t\treturn\n\t}\n}", "func (o AssetRevisionSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o BraceletPhotoSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no BraceletPhoto slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o AssetRevisionSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"public: no AssetRevision slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(assetRevisionBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), assetRevisionPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tquery := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"asset_revision\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, assetRevisionPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(assetRevisionPrimaryKeyColumns), 1, len(assetRevisionPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, query)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(query, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"public: unable to delete all from assetRevision slice\")\n\t}\n\n\tif len(assetRevisionAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o FeatureRelationshipSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q assetRevisionQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"public: no assetRevisionQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"public: unable to delete all from asset_revision\")\n\t}\n\n\treturn nil\n}", "func (q featureRelationshipQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q cvtermsynonymQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (fkw *FakeClientWrapper) DeleteAllOf(ctx context.Context, obj runtime.Object, opts ...k8sCl.DeleteAllOfOption) error {\n\treturn fkw.client.DeleteAllOf(ctx, obj, opts...)\n}", "func (q braceletPhotoQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q multiAddressesSetQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no multiAddressesSetQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from multi_addresses_sets\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for multi_addresses_sets\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o FeatureRelationshipSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no FeatureRelationship slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(featureRelationshipBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), featureRelationshipPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"feature_relationship\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, featureRelationshipPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(featureRelationshipPrimaryKeyColumns), 1, len(featureRelationshipPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from featureRelationship slice\")\n\t}\n\n\tif len(featureRelationshipAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o VoteSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), votePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"vote\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, votePrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from vote slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for vote\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q peerPropertyQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no peerPropertyQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from peer_properties\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for peer_properties\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o ContentUnitDerivationSlice) DeleteAll(exec boil.Executor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), contentUnitDerivationPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"content_unit_derivations\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, contentUnitDerivationPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\tresult, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"mdbmodels: unable to delete all from contentUnitDerivation slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"mdbmodels: failed to get rows affected by deleteall for content_unit_derivations\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o AddressSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"sqlboiler: no Address slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o AssetRevisionSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o CMFBalanceChargeAdminSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cmfBalanceChargeAdminBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cmfBalanceChargeAdminPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `cmf_balance_charge_admin` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, cmfBalanceChargeAdminPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from cmfBalanceChargeAdmin slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for cmf_balance_charge_admin\")\n\t}\n\n\tif len(cmfBalanceChargeAdminAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o PhenotypepropSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no Phenotypeprop slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(phenotypepropBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), phenotypepropPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"phenotypeprop\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, phenotypepropPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(phenotypepropPrimaryKeyColumns), 1, len(phenotypepropPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from phenotypeprop slice\")\n\t}\n\n\tif len(phenotypepropAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (q mempoolBinQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no mempoolBinQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from mempool_bin\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for mempool_bin\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o MempoolBinSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), mempoolBinPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"mempool_bin\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, mempoolBinPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from mempoolBin slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for mempool_bin\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q peerQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"model: no peerQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: unable to delete all from peers\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: failed to get rows affected by deleteall for peers\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o AddressSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o AuthorSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"mdbmdbmodels: no Author slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), authorPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"authors\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, authorPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mdbmdbmodels: unable to delete all from author slice\")\n\t}\n\n\treturn nil\n}", "func (o APIKeySlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no APIKey slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(apiKeyBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), apiKeyPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"api_keys\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, apiKeyPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from apiKey slice\")\n\t}\n\n\tif len(apiKeyAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (q addressQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (s *service) DeleteAll(ctx context.Context, req *pb.Request, res *pb.Response) error {\n\tdone, err := s.repo.DeleteAll(\"\")\n\tif err != nil {\n\t\ttheerror := fmt.Sprintf(\"%v --from souscription_service\", err)\n\t\treturn errors.New(theerror)\n\t}\n\tres.Done = done\n\treturn nil\n}", "func (q buildingQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"record: no buildingQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: unable to delete all from buildings\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: failed to get rows affected by deleteall for buildings\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q cvtermsynonymQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"chado: no cvtermsynonymQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from cvtermsynonym\")\n\t}\n\n\treturn nil\n}", "func (q holdenAtQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no holdenAtQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from HoldenAt\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for HoldenAt\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o VoteSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Vote slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o DocSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(docBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), docPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `doc` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, docPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from doc slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for doc\")\n\t}\n\n\tif len(docAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (q stockCvtermQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o AssetRevisionSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"public: no AssetRevision slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o CvtermsynonymSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o PhenotypepropSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no Phenotypeprop slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o AuthorSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o MultiAddressesSetSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(multiAddressesSetBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), multiAddressesSetPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"multi_addresses_sets\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, multiAddressesSetPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from multiAddressesSet slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for multi_addresses_sets\")\n\t}\n\n\tif len(multiAddressesSetAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o BuildingSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif o == nil {\n\t\treturn 0, errors.New(\"record: no Building slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(buildingBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), buildingPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"buildings\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, buildingPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: unable to delete all from building slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: failed to get rows affected by deleteall for buildings\")\n\t}\n\n\tif len(buildingAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o AuthorSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (m *MemBook) deleteAll() {\n\n\t// Reassign the Book data so it's take by the garbage collector.\n\tm.books = make(map[string]*models.Book)\n}", "func (o ForeignLegalResourceSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), foreignLegalResourcePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"ForeignLegalResources\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, foreignLegalResourcePrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from foreignLegalResource slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for ForeignLegalResources\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o RentalSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"sqlboiler: no Rental slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(rentalBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), rentalPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `rental` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, rentalPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sqlboiler: unable to delete all from rental slice\")\n\t}\n\n\tif len(rentalAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o FeatureRelationshipSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no FeatureRelationship slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (q publisherSearchIdxQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no publisherSearchIdxQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from publisher_search_idx\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for publisher_search_idx\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o HoldenAtSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), holdenAtPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"HoldenAt\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, holdenAtPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from holdenAt slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for HoldenAt\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o VoteSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (r *FakeClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error {\n\t// TODO (covariance) implement me!\n\tpanic(\"not implemented\")\n}", "func (q voteQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o VSPSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), vspPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"vsp\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, vspPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from vsp slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for vsp\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (c *Command) DeleteAll() (int64, error) {\n\tclient := c.set.gom.GetClient()\n\n\tcollection := client.Database(c.set.gom.GetDatabase()).Collection(c.set.tableName)\n\n\tctx, cancelFunc := c.set.GetContext()\n\tdefer cancelFunc()\n\n\tres, err := collection.DeleteMany(ctx, c.set.filter)\n\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn res.DeletedCount, nil\n}", "func (o CvtermsynonymSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no Cvtermsynonym slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (a *apiServer) DeleteAll(ctx context.Context, request *emptypb.Empty) (response *emptypb.Empty, retErr error) {\n\tif _, err := a.DeletePipelines(ctx, &pps.DeletePipelinesRequest{All: true, Force: true}); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := a.env.KubeClient.CoreV1().Secrets(a.namespace).DeleteCollection(ctx, metav1.DeleteOptions{}, metav1.ListOptions{\n\t\tLabelSelector: \"secret-source=pachyderm-user\",\n\t}); err != nil {\n\t\treturn nil, errors.EnsureStack(err)\n\t}\n\treturn &emptypb.Empty{}, nil\n}", "func (o CommentSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Comment slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(commentBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), commentPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `comment` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, commentPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from comment slice\")\n\t}\n\n\tif len(commentAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (m *MockVirtualMeshCertificateSigningRequestClient) DeleteAllOfVirtualMeshCertificateSigningRequest(ctx context.Context, opts ...client.DeleteAllOfOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DeleteAllOfVirtualMeshCertificateSigningRequest\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (o PhenotypepropSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q recipeLipidQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no recipeLipidQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from recipe_lipid\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for recipe_lipid\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o RecipeLipidSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(recipeLipidBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), recipeLipidPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"recipe_lipid\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, recipeLipidPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from recipeLipid slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for recipe_lipid\")\n\t}\n\n\tif len(recipeLipidAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o BraceletPhotoSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q foreignLegalResourceQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no foreignLegalResourceQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from ForeignLegalResources\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for ForeignLegalResources\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o *FeatureCvtermDbxrefSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tfeatureCvtermDbxrefs := FeatureCvtermDbxrefSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), featureCvtermDbxrefPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"SELECT \\\"feature_cvterm_dbxref\\\".* FROM \\\"feature_cvterm_dbxref\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, featureCvtermDbxrefPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(*o)*len(featureCvtermDbxrefPrimaryKeyColumns), 1, len(featureCvtermDbxrefPrimaryKeyColumns)),\n\t)\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&featureCvtermDbxrefs)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to reload all in FeatureCvtermDbxrefSlice\")\n\t}\n\n\t*o = featureCvtermDbxrefs\n\n\treturn nil\n}", "func (m *MockVirtualMeshCertificateSigningRequestWriter) DeleteAllOfVirtualMeshCertificateSigningRequest(ctx context.Context, opts ...client.DeleteAllOfOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DeleteAllOfVirtualMeshCertificateSigningRequest\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (o VoteSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o RecipeAdditiveSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(recipeAdditiveBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), recipeAdditivePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"recipe_additive\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, recipeAdditivePrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from recipeAdditive slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for recipe_additive\")\n\t}\n\n\tif len(recipeAdditiveAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o PublisherSearchIdxSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(publisherSearchIdxBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), publisherSearchIdxPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"publisher_search_idx\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, publisherSearchIdxPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from publisherSearchIdx slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for publisher_search_idx\")\n\t}\n\n\tif len(publisherSearchIdxAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o AuthSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Auth slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(authBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), authPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"auths\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, authPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from auth slice\")\n\t}\n\n\tif len(authAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o AuthSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q apiKeyQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o BraceletPhotoSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func DeleteAll(db *sqlx.DB) error {\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := tx.Exec(deleteDoc); err != nil {\n\t\tif err := tx.Rollback(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn err\n\t}\n\n\treturn tx.Commit()\n}", "func (q voteQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"models: no voteQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from vote\")\n\t}\n\n\treturn nil\n}", "func (q voteQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no voteQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from vote\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for vote\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o BlockSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), blockPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"block\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, blockPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from block slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for block\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o StockCvtermSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o FriendshipSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(friendshipBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), friendshipPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `friendship` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, friendshipPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from friendship slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for friendship\")\n\t}\n\n\tif len(friendshipAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o RSSAnnouncementSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), rssAnnouncementPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"rss_announcements\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, rssAnnouncementPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from rssAnnouncement slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for rss_announcements\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q vspQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no vspQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from vsp\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for vsp\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q phenotypepropQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q featureRelationshipQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"chado: no featureRelationshipQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from feature_relationship\")\n\t}\n\n\treturn nil\n}", "func (q recipeAdditiveQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no recipeAdditiveQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from recipe_additive\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for recipe_additive\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o SegmentSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(segmentBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), segmentPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"segment\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, segmentPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"boiler: unable to delete all from segment slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"boiler: failed to get rows affected by deleteall for segment\")\n\t}\n\n\tif len(segmentAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}" ]
[ "0.70774865", "0.69914395", "0.6261222", "0.61479115", "0.6081627", "0.6005739", "0.5977111", "0.57168645", "0.56603426", "0.56408215", "0.5606522", "0.56003577", "0.5594191", "0.55833054", "0.55614084", "0.5522759", "0.55059785", "0.55058986", "0.5471875", "0.5471104", "0.5460233", "0.54585487", "0.54329056", "0.54320425", "0.5426304", "0.54170984", "0.5412243", "0.5409081", "0.5404681", "0.5403552", "0.54015166", "0.5397619", "0.5390557", "0.53854465", "0.5357829", "0.5345695", "0.5338313", "0.53376395", "0.5335536", "0.53289694", "0.53170943", "0.5315947", "0.5314089", "0.5312351", "0.5311932", "0.52979285", "0.5296225", "0.5296201", "0.5292483", "0.5287427", "0.52872235", "0.52829194", "0.52808905", "0.52769065", "0.526347", "0.5254746", "0.52503693", "0.5243819", "0.52324325", "0.5231488", "0.52314216", "0.52304894", "0.5216888", "0.52159715", "0.52133644", "0.5210891", "0.52102613", "0.5209858", "0.52091783", "0.5205611", "0.5200044", "0.51990175", "0.51941913", "0.519087", "0.5187823", "0.51872253", "0.51868623", "0.5186809", "0.518461", "0.5176878", "0.51761204", "0.5166142", "0.5163484", "0.51621294", "0.5160185", "0.51595616", "0.5158223", "0.5151658", "0.51453424", "0.51442873", "0.5141219", "0.5138828", "0.51356393", "0.51319164", "0.5131204", "0.51264614", "0.5123876", "0.5118587", "0.51166826", "0.51154023" ]
0.7569814
0
WithProtocolEndpointUUID adds the protocolEndpointUUID to the vvol binding delete params
func (o *VvolBindingDeleteParams) WithProtocolEndpointUUID(protocolEndpointUUID string) *VvolBindingDeleteParams { o.SetProtocolEndpointUUID(protocolEndpointUUID) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) SetProtocolEndpointUUID(protocolEndpointUUID string) {\n\to.ProtocolEndpointUUID = protocolEndpointUUID\n}", "func (a *DeprecatedBusManagementRouterApiService) DeleteBindingUsingDELETE(ctx _context.Context, routingKeyFilter string, fifoName string) ApiDeleteBindingUsingDELETERequest {\n\treturn ApiDeleteBindingUsingDELETERequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\troutingKeyFilter: routingKeyFilter,\n\t\tfifoName: fifoName,\n\t}\n}", "func (o *DeleteProtocolUsingDELETEParams) WithProtocolID(protocolID string) *DeleteProtocolUsingDELETEParams {\n\to.SetProtocolID(protocolID)\n\treturn o\n}", "func NewDeleteProtocolUsingDELETEParams() *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithVvolUUID(vvolUUID string) *VvolBindingDeleteParams {\n\to.SetVvolUUID(vvolUUID)\n\treturn o\n}", "func (o *DeleteProtocolUsingDELETEParams) WithContext(ctx context.Context) *DeleteProtocolUsingDELETEParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (ec *ExtensionClient) DeleteEndpoint(extensionID, serviceID, URL string) error {\n\n\turl := url.QueryEscape(URL)\n\trequest, err := extensionc.BuildDeleteEndpointPayload(extensionID, serviceID, url)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = ec.c.DeleteEndpoint()(context.Background(), request)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func NewDeleteProtocolUsingDELETEParamsWithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (a *DefaultApiService) DeleteEndpoint(ctx _context.Context, id string) ApiDeleteEndpointRequest {\n\treturn ApiDeleteEndpointRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "func (o *DeleteProtocolUsingDELETEParams) WithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteProtocolUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func DeleteEndpoint(serviceAccountProvider provider.ServiceAccountProvider, projectProvider provider.ProjectProvider, userInfoGetter provider.UserInfoGetter) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq, ok := request.(deleteReq)\n\t\tif !ok {\n\t\t\treturn nil, errors.NewBadRequest(\"invalid request\")\n\t\t}\n\t\terr := req.Validate()\n\t\tif err != nil {\n\t\t\treturn nil, errors.NewBadRequest(err.Error())\n\t\t}\n\t\tuserInfo, err := userInfoGetter(ctx, req.ProjectID)\n\t\tif err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\t\t// check if project exist\n\t\tif _, err := projectProvider.Get(userInfo, req.ProjectID, &provider.ProjectGetOptions{}); err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\t// check if service account exist before deleting it\n\t\tif _, err := serviceAccountProvider.Get(userInfo, req.ServiceAccountID, nil); err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\tif err := serviceAccountProvider.Delete(userInfo, req.ServiceAccountID); err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\treturn nil, nil\n\t}\n}", "func DeleteEndpoint(w http.ResponseWriter, r *http.Request) {\r\n\tr.Header.Set(\"Content-Type\", \"application/json, charset=UTF-8\")\r\n\tvar dc DeleteConfig\r\n\r\n\tswitch r.Method {\r\n\tcase \"GET\":\r\n\t\tparams := mux.Vars(r)\r\n\t\tdc.Default()\r\n\t\tdc.Endpoint = params[\"endpoint_name\"]\r\n\t\tdc.EndpointList = append(dc.EndpointList, dc.Endpoint)\r\n\tcase \"POST\":\r\n\t\tbody, err := ioutil.ReadAll(r.Body)\r\n\t\tif err != nil {\r\n\t\t\tapi.LogDebug(api.DEBUG, \"[+] POST /delete/endpoint, failed to read request\")\r\n\t\t\tfmt.Fprintln(w, api.HttpFailureMessage(\"Failed to read HTTP request\"))\r\n\t\t\treturn\r\n\t\t}\r\n\t\tdc.LoadParams(body)\r\n\t}\r\n\r\n\t// Verify Endpoint is provided in request body\r\n\tif len(dc.EndpointList) == 0 {\r\n\t\tapi.LogDebug(api.DEBUG, \"[+] POST /delete/endpoint - endpoint is required\")\r\n\t\tfmt.Fprintln(w, api.HttpFailureMessage(\"Endpoint required\"))\r\n\t\treturn\r\n\t}\r\n\r\n\tvar query elastic.Query\r\n\r\n\t// Convert EndpointList to interface{} slice\r\n\tendpoints := make([]interface{}, len(dc.EndpointList))\r\n\tfor i, v := range dc.EndpointList {\r\n\t\tendpoints[i] = v\r\n\t}\r\n\r\n\tquery = elastic.NewBoolQuery().\r\n\t\tMust(elastic.NewWildcardQuery(\"CaseInfo.CaseName\", dc.CaseName),\r\n\t\t\telastic.NewTermsQuery(\"ComputerName.keyword\", endpoints...))\r\n\r\n\tdeleteEndpointByQuery(w, r, query, \"DeleteEndpoint\")\r\n\r\n}", "func (a *DeprecatedBusManagementRouterApiService) DeleteBindingUsingDELETEExecute(r ApiDeleteBindingUsingDELETERequest) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DeprecatedBusManagementRouterApiService.DeleteBindingUsingDELETE\")\n\tif err != nil {\n\t\treturn nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v0/bindings/{routingKeyFilter}/{fifoName}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"routingKeyFilter\"+\"}\", _neturl.PathEscape(parameterToString(r.routingKeyFilter, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"fifoName\"+\"}\", _neturl.PathEscape(parameterToString(r.fifoName, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.xAPIKEY == nil {\n\t\treturn 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 nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v ErrorResponseWeb\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ErrorResponseWeb\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "func (a AppblueprintApi) AppBlueprintsUuidDelete(uuid string) (*APIResponse, error) {\n\n\tvar httpMethod = \"Delete\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/app_blueprints/{uuid}\"\n\tpath = strings.Replace(path, \"{\"+\"uuid\"+\"}\", fmt.Sprintf(\"%v\", uuid), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication (basicAuth) required\n\n\t// http basic authentication required\n\tif a.Configuration.Username != \"\" || a.Configuration.Password != \"\" {\n\t\theaderParams[\"Authorization\"] = \"Basic \" + a.Configuration.GetBasicAuthEncodedString()\n\t}\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\theaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\n\thttpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tif err != nil {\n\t\treturn NewAPIResponse(httpResponse.RawResponse), err\n\t}\n\n\treturn NewAPIResponse(httpResponse.RawResponse), err\n}", "func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewVvolBindingDeleteParams() *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DeleteAllReferences != nil {\n\n\t\t// query param delete_all_references\n\t\tvar qrDeleteAllReferences bool\n\n\t\tif o.DeleteAllReferences != nil {\n\t\t\tqrDeleteAllReferences = *o.DeleteAllReferences\n\t\t}\n\t\tqDeleteAllReferences := swag.FormatBool(qrDeleteAllReferences)\n\t\tif qDeleteAllReferences != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"delete_all_references\", qDeleteAllReferences); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param protocol_endpoint.uuid\n\tif err := r.SetPathParam(\"protocol_endpoint.uuid\", o.ProtocolEndpointUUID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vvol.uuid\n\tif err := r.SetPathParam(\"vvol.uuid\", o.VvolUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (m *peerMap) deleteEndpoint(ep *endpoint) {\n\tif ep == nil {\n\t\treturn\n\t}\n\tep.stopAndReset()\n\n\tepDisco := ep.disco.Load()\n\n\tpi := m.byNodeKey[ep.publicKey]\n\tif epDisco != nil {\n\t\tdelete(m.nodesOfDisco[epDisco.key], ep.publicKey)\n\t}\n\tdelete(m.byNodeKey, ep.publicKey)\n\tif pi == nil {\n\t\t// Kneejerk paranoia from earlier issue 2801.\n\t\t// Unexpected. But no logger plumbed here to log so.\n\t\treturn\n\t}\n\tfor ip := range pi.ipPorts {\n\t\tdelete(m.byIPPort, ip)\n\t}\n}", "func NewDeleteEndpoint(s Service) goa.Endpoint {\n\treturn func(ctx context.Context, req interface{}) (interface{}, error) {\n\t\tp := req.(*DeletePayload)\n\t\treturn nil, s.Delete(ctx, p)\n\t}\n}", "func (j *Jsonnet) DeleteParam(path []string) error {\n\t// TODO: make this work at the env level too\n\tparamsData, err := j.readParams(\"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tupdatedParams, err := params.DeleteFromObject(path, paramsData, j.Name(false), paramsComponentRoot)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = j.writeParams(updatedParams); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (o *DeleteProtocolUsingDELETEParams) WithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (client *WebAppsClient) deletePrivateEndpointConnectionCreateRequest(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, options *WebAppsBeginDeletePrivateEndpointConnectionOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}\"\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 name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif privateEndpointConnectionName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateEndpointConnectionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateEndpointConnectionName}\", url.PathEscape(privateEndpointConnectionName))\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.MethodDelete, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (o *DeleteProtocolUsingDELETEParams) SetProtocolID(protocolID string) {\n\to.ProtocolID = protocolID\n}", "func NewVvolBindingDeleteParamsWithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (client *NpmClient) EndpointDeleteReq(epinfo *netproto.Endpoint) (*netproto.Endpoint, error) {\n\treturn nil, nil\n}", "func (nb *NetBuilder) DeleteEndpoint(nw *Network, ep *Endpoint) error {\n\t// Generate network name here as endpoint name is dependent upon network name.\n\tnw.Name = nb.generateHNSNetworkName(nw)\n\t// Query the namespace identifier.\n\tnsType, namespaceIdentifier := nb.getNamespaceIdentifier(ep)\n\n\t// Find the HNS endpoint ID.\n\tendpointName := nb.generateHNSEndpointName(nw.Name, namespaceIdentifier)\n\thnsEndpoint, err := hcsshim.GetHNSEndpointByName(endpointName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Detach the HNS endpoint from the container's network namespace.\n\tlog.Infof(\"Detaching HNS endpoint %s from container %s netns.\", hnsEndpoint.Id, ep.ContainerID)\n\tif nsType == hcsNamespace {\n\t\t// Detach the HNS endpoint from the namespace, if we can.\n\t\t// HCN Namespace and HNS Endpoint have a 1-1 relationship, therefore,\n\t\t// even if detachment of endpoint from namespace fails, we can still proceed to delete it.\n\t\terr = hcn.RemoveNamespaceEndpoint(namespaceIdentifier, hnsEndpoint.Id)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to detach endpoint, ignoring: %v\", err)\n\t\t}\n\t} else {\n\t\terr = hcsshim.HotDetachEndpoint(ep.ContainerID, hnsEndpoint.Id)\n\t\tif err != nil && err != hcsshim.ErrComputeSystemDoesNotExist {\n\t\t\treturn err\n\t\t}\n\n\t\t// The rest of the delete logic applies to infrastructure container only.\n\t\tif nsType == nonInfraContainerNS {\n\t\t\t// For non-infra containers, the network must not be deleted.\n\t\t\tnw.UseExisting = true\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// Delete the HNS endpoint.\n\tlog.Infof(\"Deleting HNS endpoint name: %s ID: %s\", endpointName, hnsEndpoint.Id)\n\t_, err = hnsEndpoint.Delete()\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to delete HNS endpoint: %v.\", err)\n\t}\n\n\treturn err\n}", "func decodeDeleteKeyPersonRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.DeleteKeyPersonRequest)\n\treturn endpoints.DeleteKeyPersonRequest{ID: req.Id}, nil\n}", "func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (do *DeleteOptions) DevfileComponentDelete() error {\n\t// Parse devfile\n\tdevObj, err := devfileParser.Parse(do.devfilePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcomponentName, err := getComponentName()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tkc := kubernetes.KubernetesContext{\n\t\tNamespace: do.namespace,\n\t}\n\n\tlabels := map[string]string{\n\t\t\"component\": componentName,\n\t}\n\tdevfileHandler, err := adapters.NewPlatformAdapter(componentName, devObj, kc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tspinner := log.Spinner(fmt.Sprintf(\"Deleting devfile component %s\", componentName))\n\tdefer spinner.End(false)\n\n\terr = devfileHandler.Delete(labels)\n\tif err != nil {\n\t\treturn err\n\t}\n\tspinner.End(true)\n\tlog.Successf(\"Successfully deleted component\")\n\treturn nil\n}", "func MakeDeleteEndpoint(s service.DepartmentService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(DeleteRequest)\n\t\terror := s.Delete(ctx, req.Id)\n\t\treturn DeleteResponse{Error: error}, nil\n\t}\n}", "func (l *Libvirt) NwfilterBindingDelete(OptNwfilter NwfilterBinding) (err error) {\n\tvar buf []byte\n\n\targs := NwfilterBindingDeleteArgs {\n\t\tOptNwfilter: OptNwfilter,\n\t}\n\n\tbuf, err = encode(&args)\n\tif err != nil {\n\t\treturn\n\t}\n\n\n\t_, err = l.requestStream(400, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (r *RuntimeServer) DelThirdPartyEndpoint(ctx context.Context, re *pb.DelThirdPartyEndpointsReq) (*pb.Empty, error) {\n\tas := r.store.GetAppService(re.Sid)\n\tif as == nil {\n\t\treturn new(pb.Empty), nil\n\t}\n\tr.updateCh.In() <- discovery.Event{\n\t\tType: discovery.DeleteEvent,\n\t\tObj: &v1.RbdEndpoint{\n\t\t\tUUID: re.Uuid,\n\t\t\tSid: re.Sid,\n\t\t\tIP: re.Ip,\n\t\t\tPort: int(re.Port),\n\t\t},\n\t}\n\treturn new(pb.Empty), nil\n}", "func (a *SvmApiService) SvmPeerDelete(ctx _context.Context, peerUuid string) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/svm/peers/{peer.uuid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"peer.uuid\"+\"}\", _neturl.QueryEscape(parameterToString(peerUuid, \"\")), -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\", \"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, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tvar v ErrorResponse\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "func NewRevokeDeviceCertificateUsingDELETEParamsWithHTTPClient(client *http.Client) *RevokeDeviceCertificateUsingDELETEParams {\n\tvar ()\n\treturn &RevokeDeviceCertificateUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (s *EndpointServer) DeleteVertexaiEndpoint(ctx context.Context, request *vertexaipb.DeleteVertexaiEndpointRequest) (*emptypb.Empty, error) {\n\n\tcl, err := createConfigEndpoint(ctx, request.GetServiceAccountFile())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &emptypb.Empty{}, cl.DeleteEndpoint(ctx, ProtoToEndpoint(request.GetResource()))\n\n}", "func (client *WebAppsClient) deletePrivateEndpointConnectionSlotCreateRequest(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, slot string, options *WebAppsBeginDeletePrivateEndpointConnectionSlotOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateEndpointConnections/{privateEndpointConnectionName}\"\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 name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif privateEndpointConnectionName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateEndpointConnectionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateEndpointConnectionName}\", url.PathEscape(privateEndpointConnectionName))\n\tif slot == \"\" {\n\t\treturn nil, errors.New(\"parameter slot cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{slot}\", url.PathEscape(slot))\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.MethodDelete, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (d *ABFToInterfaceDescriptor) Delete(key string, emptyVal proto.Message, metadata api.Metadata) (err error) {\n\t// validate and get all required values\n\tisIPv6, abfIdx, ifIdx, priority, err := d.process(key)\n\tif err != nil {\n\t\td.log.Error(err)\n\t\treturn err\n\t}\n\n\t// detach interface to ABF policy\n\tif isIPv6 {\n\t\treturn d.abfHandler.AbfDetachInterfaceIPv6(abfIdx, ifIdx, priority)\n\t}\n\treturn d.abfHandler.AbfDetachInterfaceIPv4(abfIdx, ifIdx, priority)\n}", "func NewDeleteConnectorUsingDELETEMethodNotAllowed() *DeleteConnectorUsingDELETEMethodNotAllowed {\n\treturn &DeleteConnectorUsingDELETEMethodNotAllowed{}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalLspBitAttachedBit(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:lsp-bit/frinx-openconfig-network-instance:attached-bit/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (o *VvolBindingDeleteParams) WithContext(ctx context.Context) *VvolBindingDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocol(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolBgpPeerGroupsPeerGroupTransport(ctx context.Context, name string, identifier string, protocolName string, peerGroupName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:bgp/frinx-openconfig-network-instance:peer-groups/frinx-openconfig-network-instance:peer-group/{peer-group-name}/frinx-openconfig-network-instance:transport/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"peer-group-name\"+\"}\", fmt.Sprintf(\"%v\", peerGroupName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func deleteEndpoint(endpointId string) (string, error) {\n\tvar ret string\n\n\turi := fmt.Sprintf(\"%s/%s\", endpointURI, id)\n\turl, err := client.GetURL(uri)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\treq, err := client.BuildReq(nil, url, http.MethodDelete, true)\n\trawResp, err := client.HTTPClient().Do(req)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\tif _, err := client.ParseReq(rawResp); err != nil {\n\t\treturn ret, err\n\t}\n\n\t// Confirm the node was deleted.\n\tif rawResp.StatusCode != 204 {\n\t\treturn ret, errors.New(\"Endpoint was not able to be deleted\")\n\t}\n\tret = \"Endpoint deleted\\n\"\n\n\treturn ret, nil\n}", "func (vl *VlanBridge) RemoveEndpoint(endpoint *OfnetEndpoint) error {\n\tlog.Infof(\"Received DELETE endpoint: %+v\", endpoint)\n\n\t// Remove the endpoint from policy tables\n\terr := vl.policyAgent.DelEndpoint(endpoint)\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleting endpoint to policy agent{%+v}. Err: %v\", endpoint, err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalTransport(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:transport/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *EventProcessingMatchingApiService) DeleteUsingDELETE18(ctx _context.Context, matchingRuleId string) ApiDeleteUsingDELETE18Request {\n\treturn ApiDeleteUsingDELETE18Request{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmatchingRuleId: matchingRuleId,\n\t}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalLspBitOverloadBit(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:lsp-bit/frinx-openconfig-network-instance:overload-bit/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaVirtualLinksVirtualLinkConfig(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, remoteRouterId string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:virtual-links/frinx-openconfig-network-instance:virtual-link/{remote-router-id}/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"remote-router-id\"+\"}\", fmt.Sprintf(\"%v\", remoteRouterId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func Delete(c *drycc.Client, appID string, name string, port int, protocol string) error {\n\tu := fmt.Sprintf(\"/v2/apps/%s/gateways/\", appID)\n\n\treq := api.GatewayRemoveRequest{Name: name, Port: port, Protocol: protocol}\n\n\tbody, err := json.Marshal(req)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, err := c.Request(\"DELETE\", u, body)\n\tif err == nil {\n\t\tres.Body.Close()\n\t}\n\treturn err\n}", "func addIDToDeleteRequest(r *resource,\n\tinput *svcsdk.DeleteVpcEndpointsInput) error {\n\tif r.ko.Status.VPCEndpointID == nil {\n\t\treturn errors.New(\"unable to extract VPCEndpointID from resource\")\n\t}\n\tinput.VpcEndpointIds = []*string{r.ko.Status.VPCEndpointID}\n\treturn nil\n}", "func (d *InterfaceVrfDescriptor) Delete(key string, emptyVal proto.Message, metadata kvs.Metadata) (err error) {\n\tswIfIndex, vrf, inheritedVrf, ipv4, ipv6, err := d.getParametersFromKey(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !inheritedVrf && vrf > 0 && ipv4 {\n\t\terr = d.ifHandler.SetInterfaceVrf(swIfIndex, uint32(0))\n\t\tif err != nil {\n\t\t\td.log.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\tif !inheritedVrf && vrf > 0 && ipv6 {\n\t\terr = d.ifHandler.SetInterfaceVrfIPv6(swIfIndex, uint32(0))\n\t\tif err != nil {\n\t\t\td.log.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func makeDeleteBookEndpoint(svc BookService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\t// convert request into a bookRequest\n\t\treq := request.(deleteBookRequest)\n\n\t\t// call actual service with data from the req\n\t\terr := svc.DeleteBook(req.BookId)\n\t\treturn deleteBookResponse{\n\t\t\tErr: err,\n\t\t}, nil\n\t}\n}", "func (r *ProjectsBrokersV2ServiceInstancesServiceBindingsService) Delete(parent string, instanceId string, bindingId string) *ProjectsBrokersV2ServiceInstancesServiceBindingsDeleteCall {\n\tc := &ProjectsBrokersV2ServiceInstancesServiceBindingsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\tc.instanceId = instanceId\n\tc.bindingId = bindingId\n\treturn c\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalLspBitAttachedBitConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:lsp-bit/frinx-openconfig-network-instance:attached-bit/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaVirtualLinksVirtualLink(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, remoteRouterId string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:virtual-links/frinx-openconfig-network-instance:virtual-link/{remote-router-id}/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"remote-router-id\"+\"}\", fmt.Sprintf(\"%v\", remoteRouterId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (p *fullEndpoint) delete(expectedOldValue *Endpoint) {\n\tatomic.CompareAndSwapPointer(&p.endpoint, unsafe.Pointer(expectedOldValue), nil)\n}", "func NewRevokeDeviceCertificateUsingDELETEParams() *RevokeDeviceCertificateUsingDELETEParams {\n\tvar ()\n\treturn &RevokeDeviceCertificateUsingDELETEParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (h *descriptorHandler) delete(key string, value proto.Message, metadata kvs.Metadata) error {\n\tif h.descriptor == nil {\n\t\treturn nil\n\t}\n\tif h.descriptor.Delete == nil {\n\t\treturn kvs.ErrUnimplementedDelete\n\t}\n\tdefer trackDescMethod(h.descriptor.Name, \"Delete\")()\n\terr := h.descriptor.Delete(key, value, metadata)\n\tif nsErr := checkNetNs(); nsErr != nil {\n\t\terr = nsErr\n\t}\n\treturn err\n}", "func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolBgpPeerGroupsPeerGroupTransportConfig(ctx context.Context, name string, identifier string, protocolName string, peerGroupName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:bgp/frinx-openconfig-network-instance:peer-groups/frinx-openconfig-network-instance:peer-group/{peer-group-name}/frinx-openconfig-network-instance:transport/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"peer-group-name\"+\"}\", fmt.Sprintf(\"%v\", peerGroupName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalTransportConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:transport/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalLspBitOverloadBitConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:lsp-bit/frinx-openconfig-network-instance:overload-bit/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalReferenceBandwidth(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:reference-bandwidth/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func DeleteHCNEndpoint(ctx context.Context, i *Endpoint, netns string) (string, error) {\n\tif netns == \"\" ||\n\t\t!i.isValid() {\n\t\treturn \"\", nil\n\t}\n\n\t// get endpoint\n\tvar ep *hcn.HostComputeEndpoint\n\tif i.ID != \"\" {\n\t\tvar err error\n\t\tep, err = hcn.GetEndpointByID(i.ID)\n\t\tif err != nil {\n\t\t\tif hcn.IsNotFoundError(err) {\n\t\t\t\treturn \"\", nil\n\t\t\t}\n\t\t\treturn \"\", errors.Wrapf(err, \"failed to get HostComputeEndpoint %s\", i.ID)\n\t\t}\n\t} else {\n\t\tvar err error\n\t\tep, err = hcn.GetEndpointByName(i.Name)\n\t\tif err != nil {\n\t\t\tif hcn.IsNotFoundError(err) {\n\t\t\t\treturn \"\", nil\n\t\t\t}\n\t\t\treturn \"\", errors.Wrapf(err, \"failed to get HostComputeEndpoint %s\", i.Name)\n\t\t}\n\t}\n\n\t// delete\n\treturn deleteHCNEndpoint(ep, netns)\n}", "func (d *Driver) DeleteEndpoint(r *sdk.DeleteEndpointRequest) error {\n\tlog.Debugf(\"Delete endpoint request: %+v\", &r)\n\t//TODO: null check cidr in case driver restarted and doesn't know the network to avoid panic\n\tlog.Debugf(\"Delete endpoint %s\", r.EndpointID)\n\n\tnid := r.NetworkID\n\teid := r.EndpointID\n\n\t// Get the network handler and make sure it exists\n\td.Lock()\n\tn, ok := d.networks[nid]\n\td.Unlock()\n\n\tif !ok {\n\t\treturn types.InternalMaskableErrorf(\"network %s does not exist\", nid)\n\t}\n\tif n == nil {\n\t\treturn driverapi.ErrNoNetwork(nid)\n\t}\n\n\t// Sanity Check\n\tn.Lock()\n\tif n.id != nid {\n\t\tn.Unlock()\n\t\treturn InvalidNetworkIDError(nid)\n\t}\n\tn.Unlock()\n\n\t// Check endpoint id and if an endpoint is actually there\n\tep, err := n.getEndpoint(eid)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif ep == nil {\n\t\treturn EndpointNotFoundError(eid)\n\t}\n\n\t// Remove it\n\tn.Lock()\n\tdelete(n.endpoints, eid)\n\tn.Unlock()\n\n\t// On failure make sure to set back ep in n.endpoints, but only\n\t// if it hasn't been taken over already by some other thread.\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tn.Lock()\n\t\t\tif _, ok := n.endpoints[eid]; !ok {\n\t\t\t\tn.endpoints[eid] = ep\n\t\t\t}\n\t\t\tn.Unlock()\n\t\t}\n\t}()\n\n\t// Try removal of link. Discard error: it is a best effort.\n\t// Also make sure defer does not see this error either.\n\tif link, err := d.nlh.LinkByName(ep.srcName); err == nil {\n\t\td.nlh.LinkDel(link)\n\t}\n\n\treturn nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceInterfaceRefConfig(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:interface-ref/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceLsaFilterConfig(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:lsa-filter/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceMplsSignalingProtocols(ctx context.Context, name string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:signaling-protocols/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceMplsIgpLdpSync(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:igp-ldp-sync/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceMplsIgpLdpSyncConfig(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:igp-ldp-sync/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (self *PolicyAgent) DelEndpoint(endpoint *OfnetEndpoint) error {\n\n\t// find the dst group flow\n\tself.mutex.RLock()\n\tdstGrp := self.dstGrpFlow[endpoint.EndpointID]\n\tself.mutex.RUnlock()\n\tif dstGrp == nil {\n\t\treturn errors.New(\"Dst Group not found\")\n\t}\n\n\t// delete the Flow\n\terr := dstGrp.Delete()\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleting dst group for endpoint: %+v. Err: %v\", endpoint, err)\n\t}\n\n\t// delete the cache\n\tself.mutex.Lock()\n\tdelete(self.dstGrpFlow, endpoint.EndpointID)\n\tself.mutex.Unlock()\n\treturn nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalReferenceBandwidthConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:reference-bandwidth/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (s *InterconnectAttachmentServer) DeleteComputeBetaInterconnectAttachment(ctx context.Context, request *betapb.DeleteComputeBetaInterconnectAttachmentRequest) (*emptypb.Empty, error) {\n\n\tcl, err := createConfigInterconnectAttachment(ctx, request.GetServiceAccountFile())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &emptypb.Empty{}, cl.DeleteInterconnectAttachment(ctx, ProtoToInterconnectAttachment(request.GetResource()))\n\n}", "func DeleteProductEndPoint(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintln(w, \"not implemented yet !\")\n}", "func NewDelSubDeviceWithCoreRequestWithoutParam() *DelSubDeviceWithCoreRequest {\n\n return &DelSubDeviceWithCoreRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/instances/{instanceId}/products/{productKey}/edges/{edgeName}:delSubDevice\",\n Method: \"POST\",\n Header: nil,\n Version: \"v2\",\n },\n }\n}", "func deletePerson(w http.ResponseWriter, r *http.Request) {\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\r\n\tparams := mux.Vars(r)\r\n\tuuid, err := primitive.ObjectIDFromHex(params[\"uuid\"])\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\r\n\tcollection := models.ConnectDB()\r\n\tobjectToDelete, err := collection.DeleteOne(context.TODO(), bson.M{\"_id\": uuid})\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\tjson.NewEncoder(w).Encode(objectToDelete.DeletedCount)\r\n\r\n}", "func DeleteEndpointInfo(ctx iris.Context) {\n\turi := ctx.Request().RequestURI\n\tfabricID := ctx.Params().Get(\"id\")\n\tif _, ok := capdata.FabricDataStore.Data[fabricID]; !ok {\n\t\terrMsg := fmt.Sprintf(\"Fabric data for uri %s not found\", uri)\n\t\tlog.Error(errMsg)\n\t\tresp := updateErrorResponse(response.ResourceNotFound, errMsg, []interface{}{\"Fabric\", fabricID})\n\t\tctx.StatusCode(http.StatusNotFound)\n\t\tctx.JSON(resp)\n\t\treturn\n\t}\n\tendpointData, ok := capdata.EndpointDataStore[uri]\n\tif !ok {\n\t\terrMsg := fmt.Sprintf(\"Endpoint data for uri %s not found\", uri)\n\t\tlog.Error(errMsg)\n\t\tresp := updateErrorResponse(response.ResourceNotFound, errMsg, []interface{}{\"Endpoint\", fabricID})\n\t\tctx.StatusCode(http.StatusNotFound)\n\t\tctx.JSON(resp)\n\t\treturn\n\t}\n\tif endpointData.Endpoint.Links != nil && len(endpointData.Endpoint.Links.AddressPools) > 0 {\n\t\terrMsg := fmt.Sprintf(\"Endpoint cannot be deleted as there are dependent upon AddressPool\")\n\t\tlog.Error(errMsg)\n\t\tresp := updateErrorResponse(response.ResourceCannotBeDeleted, errMsg, []interface{}{uri, \"Endpoint\"})\n\t\tctx.StatusCode(http.StatusNotAcceptable)\n\t\tctx.JSON(resp)\n\t\treturn\n\t}\n\t// Todo:Add the validation to verify the links\n\tdelete(capdata.EndpointDataStore, uri)\n\tctx.StatusCode(http.StatusNoContent)\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalLspBit(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:lsp-bit/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func NewDeleteProtocolUsingDELETEParamsWithContext(ctx context.Context) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceMplsLspsUnconstrainedPathPathSetupProtocol(ctx context.Context, name string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:lsps/frinx-openconfig-network-instance:unconstrained-path/frinx-openconfig-network-instance:path-setup-protocol/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobal(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2GlobalMplsIgpLdpSyncConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:igp-ldp-sync/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (client *WebAppsClient) deleteHostNameBindingSlotCreateRequest(ctx context.Context, resourceGroupName string, name string, slot string, hostName string, options *WebAppsDeleteHostNameBindingSlotOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}\"\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 name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif slot == \"\" {\n\t\treturn nil, errors.New(\"parameter slot cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{slot}\", url.PathEscape(slot))\n\tif hostName == \"\" {\n\t\treturn nil, errors.New(\"parameter hostName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{hostName}\", url.PathEscape(hostName))\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.MethodDelete, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2Global(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:global/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2GlobalMplsIgpLdpSync(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:igp-ldp-sync/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (mm *Manager) OnBcsEndpointDelete(obj interface{}) {\n\tbcsendpoint, ok := obj.(*v2.BcsEndpoint)\n\tif !ok {\n\t\tmesosCritical.WithLabelValues(typeBcsEndpoint, eventDelete).Inc()\n\t\tblog.Errorf(\"[Critical]MesosManager BcsEndpoint event handler get unknown type obj %v OnDelete\", obj)\n\t\treturn\n\t}\n\tkey := fmt.Sprintf(\"%s/%s\", bcsendpoint.GetNamespace(), bcsendpoint.GetName())\n\tblog.V(5).Infof(\"BcsEndpoint %s delete, ready to refresh\", key)\n\tmesosEvent.WithLabelValues(typeBcsEndpoint, eventDelete, statusSuccess).Inc()\n\tmm.deleteAppService(key)\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2GlobalConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceMplsLspsUnconstrainedPathPathSetupProtocolLdp(ctx context.Context, name string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:lsps/frinx-openconfig-network-instance:unconstrained-path/frinx-openconfig-network-instance:path-setup-protocol/frinx-openconfig-network-instance:ldp/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (v *EventPipelineParameterDelete) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonF8e2f9b1DecodeGithubComOvhCdsSdk16(l, v)\n}", "func makeDeleteTagHandler(m *http.ServeMux, endpoints endpoint.Endpoints, options []http1.ServerOption) {\n\tm.Handle(\"/delete-tag\", http1.NewServer(endpoints.DeleteTagEndpoint, decodeDeleteTagRequest, encodeDeleteTagResponse, options...))\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceConfig(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (s *DefaultClient) Del(endpoint string) (resp *http.Response, err error) {\n\t_, resp, err = s.http(http.MethodDelete, endpoint, nil)\n\treturn\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceInterfaceRef(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:interface-ref/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (es *Endpoints) DelByUUID(uuid string) {\n\tes.Lock()\n\tdefer es.Unlock()\n\tif i, ok := es.mapUUID[uuid]; ok {\n\t\tdelete(es.mapUUID, uuid)\n\n\t\tswitch {\n\t\tcase i == 0:\n\t\t\tif len(es.endpoints) == 1 {\n\t\t\t\tes.endpoints = make([]*Endpoint, 0)\n\t\t\t} else {\n\t\t\t\tes.endpoints = es.endpoints[i+1:]\n\t\t\t}\n\t\tcase i == len(es.endpoints)-1:\n\t\t\tes.endpoints = es.endpoints[:i]\n\t\tdefault:\n\t\t\tes.endpoints = append(es.endpoints[:i], es.endpoints[i+1:]...)\n\t\t}\n\t}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceMplsSignalingProtocolsLdpInterfaceAttributes(ctx context.Context, name string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:signaling-protocols/frinx-openconfig-network-instance:ldp/frinx-openconfig-network-instance:interface-attributes/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolBgpPeerGroupsPeerGroupLoggingOptions(ctx context.Context, name string, identifier string, protocolName string, peerGroupName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:bgp/frinx-openconfig-network-instance:peer-groups/frinx-openconfig-network-instance:peer-group/{peer-group-name}/frinx-openconfig-network-instance:logging-options/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"peer-group-name\"+\"}\", fmt.Sprintf(\"%v\", peerGroupName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func EndpointDeleteMessage(e notifications.RegenNotificationInfo) AgentNotifyMessage {\n\tnotification := EndpointNotification{\n\t\tEndpointRegenNotification: EndpointRegenNotification{\n\t\t\tID: e.GetID(),\n\t\t\tLabels: e.GetOpLabels(),\n\t\t},\n\t\tPodName: e.GetK8sPodName(),\n\t\tNamespace: e.GetK8sNamespace(),\n\t}\n\n\treturn AgentNotifyMessage{\n\t\tType: AgentNotifyEndpointDeleted,\n\t\tNotification: notification,\n\t}\n}" ]
[ "0.78896624", "0.6120699", "0.5892373", "0.58651924", "0.56486714", "0.5636188", "0.5624453", "0.5530282", "0.55268186", "0.5493304", "0.5451638", "0.5444671", "0.54328173", "0.5395458", "0.53122944", "0.52827656", "0.52808744", "0.5268355", "0.52518433", "0.52463406", "0.5246078", "0.5229603", "0.51847214", "0.5176718", "0.5162673", "0.5144695", "0.51015204", "0.5101025", "0.5100676", "0.50845134", "0.50822383", "0.50775546", "0.5021456", "0.5009743", "0.5000824", "0.49872282", "0.49811193", "0.49757522", "0.4971316", "0.49628067", "0.4955001", "0.49432155", "0.493378", "0.4923893", "0.49228188", "0.4921432", "0.4913517", "0.49090612", "0.4897652", "0.48954105", "0.48851725", "0.48791513", "0.4874207", "0.48632395", "0.48559514", "0.4855919", "0.48557594", "0.48555908", "0.48549524", "0.48519373", "0.48503777", "0.48469213", "0.4841938", "0.48203993", "0.48117194", "0.48094672", "0.47893602", "0.47779867", "0.47765037", "0.47703898", "0.4766567", "0.47537977", "0.47489718", "0.47413784", "0.4735514", "0.47266427", "0.47260794", "0.4722918", "0.47228804", "0.47218972", "0.4721447", "0.47208732", "0.47195557", "0.47174346", "0.4714273", "0.47127092", "0.47071847", "0.47063372", "0.47006196", "0.46915543", "0.46904343", "0.4680746", "0.4676892", "0.46702808", "0.46649012", "0.46641713", "0.4663929", "0.46617413", "0.46607366", "0.46596915" ]
0.79024434
0
SetProtocolEndpointUUID adds the protocolEndpointUuid to the vvol binding delete params
func (o *VvolBindingDeleteParams) SetProtocolEndpointUUID(protocolEndpointUUID string) { o.ProtocolEndpointUUID = protocolEndpointUUID }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) WithProtocolEndpointUUID(protocolEndpointUUID string) *VvolBindingDeleteParams {\n\to.SetProtocolEndpointUUID(protocolEndpointUUID)\n\treturn o\n}", "func (ec *ExtensionClient) DeleteEndpoint(extensionID, serviceID, URL string) error {\n\n\turl := url.QueryEscape(URL)\n\trequest, err := extensionc.BuildDeleteEndpointPayload(extensionID, serviceID, url)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = ec.c.DeleteEndpoint()(context.Background(), request)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (o *DeleteProtocolUsingDELETEParams) WithProtocolID(protocolID string) *DeleteProtocolUsingDELETEParams {\n\to.SetProtocolID(protocolID)\n\treturn o\n}", "func (a *DefaultApiService) DeleteEndpoint(ctx _context.Context, id string) ApiDeleteEndpointRequest {\n\treturn ApiDeleteEndpointRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "func (m *peerMap) deleteEndpoint(ep *endpoint) {\n\tif ep == nil {\n\t\treturn\n\t}\n\tep.stopAndReset()\n\n\tepDisco := ep.disco.Load()\n\n\tpi := m.byNodeKey[ep.publicKey]\n\tif epDisco != nil {\n\t\tdelete(m.nodesOfDisco[epDisco.key], ep.publicKey)\n\t}\n\tdelete(m.byNodeKey, ep.publicKey)\n\tif pi == nil {\n\t\t// Kneejerk paranoia from earlier issue 2801.\n\t\t// Unexpected. But no logger plumbed here to log so.\n\t\treturn\n\t}\n\tfor ip := range pi.ipPorts {\n\t\tdelete(m.byIPPort, ip)\n\t}\n}", "func DeleteEndpoint(serviceAccountProvider provider.ServiceAccountProvider, projectProvider provider.ProjectProvider, userInfoGetter provider.UserInfoGetter) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq, ok := request.(deleteReq)\n\t\tif !ok {\n\t\t\treturn nil, errors.NewBadRequest(\"invalid request\")\n\t\t}\n\t\terr := req.Validate()\n\t\tif err != nil {\n\t\t\treturn nil, errors.NewBadRequest(err.Error())\n\t\t}\n\t\tuserInfo, err := userInfoGetter(ctx, req.ProjectID)\n\t\tif err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\t\t// check if project exist\n\t\tif _, err := projectProvider.Get(userInfo, req.ProjectID, &provider.ProjectGetOptions{}); err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\t// check if service account exist before deleting it\n\t\tif _, err := serviceAccountProvider.Get(userInfo, req.ServiceAccountID, nil); err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\tif err := serviceAccountProvider.Delete(userInfo, req.ServiceAccountID); err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\treturn nil, nil\n\t}\n}", "func DeleteEndpoint(w http.ResponseWriter, r *http.Request) {\r\n\tr.Header.Set(\"Content-Type\", \"application/json, charset=UTF-8\")\r\n\tvar dc DeleteConfig\r\n\r\n\tswitch r.Method {\r\n\tcase \"GET\":\r\n\t\tparams := mux.Vars(r)\r\n\t\tdc.Default()\r\n\t\tdc.Endpoint = params[\"endpoint_name\"]\r\n\t\tdc.EndpointList = append(dc.EndpointList, dc.Endpoint)\r\n\tcase \"POST\":\r\n\t\tbody, err := ioutil.ReadAll(r.Body)\r\n\t\tif err != nil {\r\n\t\t\tapi.LogDebug(api.DEBUG, \"[+] POST /delete/endpoint, failed to read request\")\r\n\t\t\tfmt.Fprintln(w, api.HttpFailureMessage(\"Failed to read HTTP request\"))\r\n\t\t\treturn\r\n\t\t}\r\n\t\tdc.LoadParams(body)\r\n\t}\r\n\r\n\t// Verify Endpoint is provided in request body\r\n\tif len(dc.EndpointList) == 0 {\r\n\t\tapi.LogDebug(api.DEBUG, \"[+] POST /delete/endpoint - endpoint is required\")\r\n\t\tfmt.Fprintln(w, api.HttpFailureMessage(\"Endpoint required\"))\r\n\t\treturn\r\n\t}\r\n\r\n\tvar query elastic.Query\r\n\r\n\t// Convert EndpointList to interface{} slice\r\n\tendpoints := make([]interface{}, len(dc.EndpointList))\r\n\tfor i, v := range dc.EndpointList {\r\n\t\tendpoints[i] = v\r\n\t}\r\n\r\n\tquery = elastic.NewBoolQuery().\r\n\t\tMust(elastic.NewWildcardQuery(\"CaseInfo.CaseName\", dc.CaseName),\r\n\t\t\telastic.NewTermsQuery(\"ComputerName.keyword\", endpoints...))\r\n\r\n\tdeleteEndpointByQuery(w, r, query, \"DeleteEndpoint\")\r\n\r\n}", "func (a *DeprecatedBusManagementRouterApiService) DeleteBindingUsingDELETE(ctx _context.Context, routingKeyFilter string, fifoName string) ApiDeleteBindingUsingDELETERequest {\n\treturn ApiDeleteBindingUsingDELETERequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\troutingKeyFilter: routingKeyFilter,\n\t\tfifoName: fifoName,\n\t}\n}", "func NewDeleteProtocolUsingDELETEParams() *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *DeleteProtocolUsingDELETEParams) WithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteProtocolUsingDELETEParams) SetProtocolID(protocolID string) {\n\to.ProtocolID = protocolID\n}", "func NewDeleteEndpoint(s Service) goa.Endpoint {\n\treturn func(ctx context.Context, req interface{}) (interface{}, error) {\n\t\tp := req.(*DeletePayload)\n\t\treturn nil, s.Delete(ctx, p)\n\t}\n}", "func (o *DeleteProtocolUsingDELETEParams) WithContext(ctx context.Context) *DeleteProtocolUsingDELETEParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (nb *NetBuilder) DeleteEndpoint(nw *Network, ep *Endpoint) error {\n\t// Generate network name here as endpoint name is dependent upon network name.\n\tnw.Name = nb.generateHNSNetworkName(nw)\n\t// Query the namespace identifier.\n\tnsType, namespaceIdentifier := nb.getNamespaceIdentifier(ep)\n\n\t// Find the HNS endpoint ID.\n\tendpointName := nb.generateHNSEndpointName(nw.Name, namespaceIdentifier)\n\thnsEndpoint, err := hcsshim.GetHNSEndpointByName(endpointName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Detach the HNS endpoint from the container's network namespace.\n\tlog.Infof(\"Detaching HNS endpoint %s from container %s netns.\", hnsEndpoint.Id, ep.ContainerID)\n\tif nsType == hcsNamespace {\n\t\t// Detach the HNS endpoint from the namespace, if we can.\n\t\t// HCN Namespace and HNS Endpoint have a 1-1 relationship, therefore,\n\t\t// even if detachment of endpoint from namespace fails, we can still proceed to delete it.\n\t\terr = hcn.RemoveNamespaceEndpoint(namespaceIdentifier, hnsEndpoint.Id)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to detach endpoint, ignoring: %v\", err)\n\t\t}\n\t} else {\n\t\terr = hcsshim.HotDetachEndpoint(ep.ContainerID, hnsEndpoint.Id)\n\t\tif err != nil && err != hcsshim.ErrComputeSystemDoesNotExist {\n\t\t\treturn err\n\t\t}\n\n\t\t// The rest of the delete logic applies to infrastructure container only.\n\t\tif nsType == nonInfraContainerNS {\n\t\t\t// For non-infra containers, the network must not be deleted.\n\t\t\tnw.UseExisting = true\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// Delete the HNS endpoint.\n\tlog.Infof(\"Deleting HNS endpoint name: %s ID: %s\", endpointName, hnsEndpoint.Id)\n\t_, err = hnsEndpoint.Delete()\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to delete HNS endpoint: %v.\", err)\n\t}\n\n\treturn err\n}", "func (client *NpmClient) EndpointDeleteReq(epinfo *netproto.Endpoint) (*netproto.Endpoint, error) {\n\treturn nil, nil\n}", "func (a AppblueprintApi) AppBlueprintsUuidDelete(uuid string) (*APIResponse, error) {\n\n\tvar httpMethod = \"Delete\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/app_blueprints/{uuid}\"\n\tpath = strings.Replace(path, \"{\"+\"uuid\"+\"}\", fmt.Sprintf(\"%v\", uuid), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication (basicAuth) required\n\n\t// http basic authentication required\n\tif a.Configuration.Username != \"\" || a.Configuration.Password != \"\" {\n\t\theaderParams[\"Authorization\"] = \"Basic \" + a.Configuration.GetBasicAuthEncodedString()\n\t}\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\theaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\n\thttpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tif err != nil {\n\t\treturn NewAPIResponse(httpResponse.RawResponse), err\n\t}\n\n\treturn NewAPIResponse(httpResponse.RawResponse), err\n}", "func deleteEndpoint(endpointId string) (string, error) {\n\tvar ret string\n\n\turi := fmt.Sprintf(\"%s/%s\", endpointURI, id)\n\turl, err := client.GetURL(uri)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\treq, err := client.BuildReq(nil, url, http.MethodDelete, true)\n\trawResp, err := client.HTTPClient().Do(req)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\tif _, err := client.ParseReq(rawResp); err != nil {\n\t\treturn ret, err\n\t}\n\n\t// Confirm the node was deleted.\n\tif rawResp.StatusCode != 204 {\n\t\treturn ret, errors.New(\"Endpoint was not able to be deleted\")\n\t}\n\tret = \"Endpoint deleted\\n\"\n\n\treturn ret, nil\n}", "func (o *DeleteProtocolUsingDELETEParams) WithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func MakeDeleteEndpoint(s service.DepartmentService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(DeleteRequest)\n\t\terror := s.Delete(ctx, req.Id)\n\t\treturn DeleteResponse{Error: error}, nil\n\t}\n}", "func NewDeleteProtocolUsingDELETEParamsWithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithVvolUUID(vvolUUID string) *VvolBindingDeleteParams {\n\to.SetVvolUUID(vvolUUID)\n\treturn o\n}", "func (d *Driver) DeleteEndpoint(r *sdk.DeleteEndpointRequest) error {\n\tlog.Debugf(\"Delete endpoint request: %+v\", &r)\n\t//TODO: null check cidr in case driver restarted and doesn't know the network to avoid panic\n\tlog.Debugf(\"Delete endpoint %s\", r.EndpointID)\n\n\tnid := r.NetworkID\n\teid := r.EndpointID\n\n\t// Get the network handler and make sure it exists\n\td.Lock()\n\tn, ok := d.networks[nid]\n\td.Unlock()\n\n\tif !ok {\n\t\treturn types.InternalMaskableErrorf(\"network %s does not exist\", nid)\n\t}\n\tif n == nil {\n\t\treturn driverapi.ErrNoNetwork(nid)\n\t}\n\n\t// Sanity Check\n\tn.Lock()\n\tif n.id != nid {\n\t\tn.Unlock()\n\t\treturn InvalidNetworkIDError(nid)\n\t}\n\tn.Unlock()\n\n\t// Check endpoint id and if an endpoint is actually there\n\tep, err := n.getEndpoint(eid)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif ep == nil {\n\t\treturn EndpointNotFoundError(eid)\n\t}\n\n\t// Remove it\n\tn.Lock()\n\tdelete(n.endpoints, eid)\n\tn.Unlock()\n\n\t// On failure make sure to set back ep in n.endpoints, but only\n\t// if it hasn't been taken over already by some other thread.\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tn.Lock()\n\t\t\tif _, ok := n.endpoints[eid]; !ok {\n\t\t\t\tn.endpoints[eid] = ep\n\t\t\t}\n\t\t\tn.Unlock()\n\t\t}\n\t}()\n\n\t// Try removal of link. Discard error: it is a best effort.\n\t// Also make sure defer does not see this error either.\n\tif link, err := d.nlh.LinkByName(ep.srcName); err == nil {\n\t\td.nlh.LinkDel(link)\n\t}\n\n\treturn nil\n}", "func (vl *VlanBridge) RemoveEndpoint(endpoint *OfnetEndpoint) error {\n\tlog.Infof(\"Received DELETE endpoint: %+v\", endpoint)\n\n\t// Remove the endpoint from policy tables\n\terr := vl.policyAgent.DelEndpoint(endpoint)\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleting endpoint to policy agent{%+v}. Err: %v\", endpoint, err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (r *RuntimeServer) DelThirdPartyEndpoint(ctx context.Context, re *pb.DelThirdPartyEndpointsReq) (*pb.Empty, error) {\n\tas := r.store.GetAppService(re.Sid)\n\tif as == nil {\n\t\treturn new(pb.Empty), nil\n\t}\n\tr.updateCh.In() <- discovery.Event{\n\t\tType: discovery.DeleteEvent,\n\t\tObj: &v1.RbdEndpoint{\n\t\t\tUUID: re.Uuid,\n\t\t\tSid: re.Sid,\n\t\t\tIP: re.Ip,\n\t\t\tPort: int(re.Port),\n\t\t},\n\t}\n\treturn new(pb.Empty), nil\n}", "func (client *WebAppsClient) deletePrivateEndpointConnectionCreateRequest(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, options *WebAppsBeginDeletePrivateEndpointConnectionOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}\"\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 name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif privateEndpointConnectionName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateEndpointConnectionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateEndpointConnectionName}\", url.PathEscape(privateEndpointConnectionName))\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.MethodDelete, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func NewDeleteProtocolUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (a *DeprecatedBusManagementRouterApiService) DeleteBindingUsingDELETEExecute(r ApiDeleteBindingUsingDELETERequest) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DeprecatedBusManagementRouterApiService.DeleteBindingUsingDELETE\")\n\tif err != nil {\n\t\treturn nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v0/bindings/{routingKeyFilter}/{fifoName}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"routingKeyFilter\"+\"}\", _neturl.PathEscape(parameterToString(r.routingKeyFilter, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"fifoName\"+\"}\", _neturl.PathEscape(parameterToString(r.fifoName, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.xAPIKEY == nil {\n\t\treturn 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 nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v ErrorResponseWeb\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ErrorResponseWeb\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "func (manager *Manager) OnDeleteEndpoint(endpoint *k8sTypes.CiliumEndpoint) {\n\tid := types.NamespacedName{\n\t\tName: endpoint.GetName(),\n\t\tNamespace: endpoint.GetNamespace(),\n\t}\n\n\tmanager.pendingEndpointEventsLock.Lock()\n\tdelete(manager.pendingEndpointEvents, id)\n\tmanager.pendingEndpointEventsLock.Unlock()\n\n\tmanager.endpointEventsQueue.Add(id)\n}", "func (s *EndpointServer) DeleteVertexaiEndpoint(ctx context.Context, request *vertexaipb.DeleteVertexaiEndpointRequest) (*emptypb.Empty, error) {\n\n\tcl, err := createConfigEndpoint(ctx, request.GetServiceAccountFile())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &emptypb.Empty{}, cl.DeleteEndpoint(ctx, ProtoToEndpoint(request.GetResource()))\n\n}", "func (p *fullEndpoint) delete(expectedOldValue *Endpoint) {\n\tatomic.CompareAndSwapPointer(&p.endpoint, unsafe.Pointer(expectedOldValue), nil)\n}", "func DeleteProductEndPoint(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintln(w, \"not implemented yet !\")\n}", "func (self *PolicyAgent) DelEndpoint(endpoint *OfnetEndpoint) error {\n\n\t// find the dst group flow\n\tself.mutex.RLock()\n\tdstGrp := self.dstGrpFlow[endpoint.EndpointID]\n\tself.mutex.RUnlock()\n\tif dstGrp == nil {\n\t\treturn errors.New(\"Dst Group not found\")\n\t}\n\n\t// delete the Flow\n\terr := dstGrp.Delete()\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleting dst group for endpoint: %+v. Err: %v\", endpoint, err)\n\t}\n\n\t// delete the cache\n\tself.mutex.Lock()\n\tdelete(self.dstGrpFlow, endpoint.EndpointID)\n\tself.mutex.Unlock()\n\treturn nil\n}", "func (a *SvmApiService) SvmPeerDelete(ctx _context.Context, peerUuid string) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/svm/peers/{peer.uuid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"peer.uuid\"+\"}\", _neturl.QueryEscape(parameterToString(peerUuid, \"\")), -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\", \"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, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tvar v ErrorResponse\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "func (service *Service) DeleteEndpoint(ID portainer.EndpointID) error {\n\treturn service.connection.UpdateTx(func(tx portainer.Transaction) error {\n\t\treturn service.Tx(tx).DeleteEndpoint(ID)\n\t})\n}", "func (j *Jsonnet) DeleteParam(path []string) error {\n\t// TODO: make this work at the env level too\n\tparamsData, err := j.readParams(\"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tupdatedParams, err := params.DeleteFromObject(path, paramsData, j.Name(false), paramsComponentRoot)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = j.writeParams(updatedParams); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func DeleteHCNEndpoint(ctx context.Context, i *Endpoint, netns string) (string, error) {\n\tif netns == \"\" ||\n\t\t!i.isValid() {\n\t\treturn \"\", nil\n\t}\n\n\t// get endpoint\n\tvar ep *hcn.HostComputeEndpoint\n\tif i.ID != \"\" {\n\t\tvar err error\n\t\tep, err = hcn.GetEndpointByID(i.ID)\n\t\tif err != nil {\n\t\t\tif hcn.IsNotFoundError(err) {\n\t\t\t\treturn \"\", nil\n\t\t\t}\n\t\t\treturn \"\", errors.Wrapf(err, \"failed to get HostComputeEndpoint %s\", i.ID)\n\t\t}\n\t} else {\n\t\tvar err error\n\t\tep, err = hcn.GetEndpointByName(i.Name)\n\t\tif err != nil {\n\t\t\tif hcn.IsNotFoundError(err) {\n\t\t\t\treturn \"\", nil\n\t\t\t}\n\t\t\treturn \"\", errors.Wrapf(err, \"failed to get HostComputeEndpoint %s\", i.Name)\n\t\t}\n\t}\n\n\t// delete\n\treturn deleteHCNEndpoint(ep, netns)\n}", "func Delete(c *drycc.Client, appID string, name string, port int, protocol string) error {\n\tu := fmt.Sprintf(\"/v2/apps/%s/gateways/\", appID)\n\n\treq := api.GatewayRemoveRequest{Name: name, Port: port, Protocol: protocol}\n\n\tbody, err := json.Marshal(req)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, err := c.Request(\"DELETE\", u, body)\n\tif err == nil {\n\t\tres.Body.Close()\n\t}\n\treturn err\n}", "func (sp *SessionProxy) DelEndpoint(sid string) { sp.GetSession().DelEndpoint(sid) }", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolBgpPeerGroupsPeerGroupTransport(ctx context.Context, name string, identifier string, protocolName string, peerGroupName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:bgp/frinx-openconfig-network-instance:peer-groups/frinx-openconfig-network-instance:peer-group/{peer-group-name}/frinx-openconfig-network-instance:transport/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"peer-group-name\"+\"}\", fmt.Sprintf(\"%v\", peerGroupName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func delEndpoint(domain string, addr string) error {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tservice, ok := registryMap[domain]\n\tif ok == false {\n\t\treturn ErrServiceNotFound\n\t}\n\tfor k, item := range service.Items {\n\t\tif item.Endpoint == addr {\n\t\t\tendpoints := append(service.Items[:k], service.Items[k+1:]...)\n\t\t\tservice.Items = endpoints\n\t\t\tbreak\n\t\t}\n\t}\n\tregistryMap[domain] = service\n\treturn nil\n}", "func (s *DefaultClient) Del(endpoint string) (resp *http.Response, err error) {\n\t_, resp, err = s.http(http.MethodDelete, endpoint, nil)\n\treturn\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func deleteHCNEndpoint(ep *hcn.HostComputeEndpoint, netns string) (string, error) {\n\tdefer func() { _ = recover() }()\n\tif ep == nil {\n\t\treturn \"\", nil\n\t}\n\n\t// remove endpoint from namespace\n\tif netns == \"\" {\n\t\tnetns = ep.HostComputeNamespace\n\t}\n\t_ = hcn.RemoveNamespaceEndpoint(netns, ep.Id)\n\n\t// delete endpoint\n\tif err := ep.Delete(); err != nil {\n\t\tif !hcn.IsNotFoundError(err) {\n\t\t\treturn ep.HostComputeNetwork, err\n\t\t}\n\t}\n\treturn ep.HostComputeNetwork, nil\n}", "func (do *DeleteOptions) DevfileComponentDelete() error {\n\t// Parse devfile\n\tdevObj, err := devfileParser.Parse(do.devfilePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcomponentName, err := getComponentName()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tkc := kubernetes.KubernetesContext{\n\t\tNamespace: do.namespace,\n\t}\n\n\tlabels := map[string]string{\n\t\t\"component\": componentName,\n\t}\n\tdevfileHandler, err := adapters.NewPlatformAdapter(componentName, devObj, kc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tspinner := log.Spinner(fmt.Sprintf(\"Deleting devfile component %s\", componentName))\n\tdefer spinner.End(false)\n\n\terr = devfileHandler.Delete(labels)\n\tif err != nil {\n\t\treturn err\n\t}\n\tspinner.End(true)\n\tlog.Successf(\"Successfully deleted component\")\n\treturn nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocol(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func NewDeleteConnectorUsingDELETEMethodNotAllowed() *DeleteConnectorUsingDELETEMethodNotAllowed {\n\treturn &DeleteConnectorUsingDELETEMethodNotAllowed{}\n}", "func (client *WebAppsClient) deletePrivateEndpointConnectionSlotCreateRequest(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, slot string, options *WebAppsBeginDeletePrivateEndpointConnectionSlotOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateEndpointConnections/{privateEndpointConnectionName}\"\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 name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif privateEndpointConnectionName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateEndpointConnectionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateEndpointConnectionName}\", url.PathEscape(privateEndpointConnectionName))\n\tif slot == \"\" {\n\t\treturn nil, errors.New(\"parameter slot cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{slot}\", url.PathEscape(slot))\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.MethodDelete, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (s *NotificationEndpointService) DeleteNotificationEndpoint(ctx context.Context, id platform.ID) ([]influxdb.SecretField, platform.ID, error) {\n\tif !id.Valid() {\n\t\treturn nil, 0, fmt.Errorf(\"invalid ID: please provide a valid ID\")\n\t}\n\terr := s.Client.\n\t\tDelete(prefixNotificationEndpoints, id.String()).\n\t\tDo(ctx)\n\treturn nil, 0, err\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolBgpPeerGroupsPeerGroupTransportConfig(ctx context.Context, name string, identifier string, protocolName string, peerGroupName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:bgp/frinx-openconfig-network-instance:peer-groups/frinx-openconfig-network-instance:peer-group/{peer-group-name}/frinx-openconfig-network-instance:transport/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"peer-group-name\"+\"}\", fmt.Sprintf(\"%v\", peerGroupName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func makeDeleteTagHandler(m *http.ServeMux, endpoints endpoint.Endpoints, options []http1.ServerOption) {\n\tm.Handle(\"/delete-tag\", http1.NewServer(endpoints.DeleteTagEndpoint, decodeDeleteTagRequest, encodeDeleteTagResponse, options...))\n}", "func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func makeDeleteBookEndpoint(svc BookService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\t// convert request into a bookRequest\n\t\treq := request.(deleteBookRequest)\n\n\t\t// call actual service with data from the req\n\t\terr := svc.DeleteBook(req.BookId)\n\t\treturn deleteBookResponse{\n\t\t\tErr: err,\n\t\t}, nil\n\t}\n}", "func DeleteEndpointInfo(ctx iris.Context) {\n\turi := ctx.Request().RequestURI\n\tfabricID := ctx.Params().Get(\"id\")\n\tif _, ok := capdata.FabricDataStore.Data[fabricID]; !ok {\n\t\terrMsg := fmt.Sprintf(\"Fabric data for uri %s not found\", uri)\n\t\tlog.Error(errMsg)\n\t\tresp := updateErrorResponse(response.ResourceNotFound, errMsg, []interface{}{\"Fabric\", fabricID})\n\t\tctx.StatusCode(http.StatusNotFound)\n\t\tctx.JSON(resp)\n\t\treturn\n\t}\n\tendpointData, ok := capdata.EndpointDataStore[uri]\n\tif !ok {\n\t\terrMsg := fmt.Sprintf(\"Endpoint data for uri %s not found\", uri)\n\t\tlog.Error(errMsg)\n\t\tresp := updateErrorResponse(response.ResourceNotFound, errMsg, []interface{}{\"Endpoint\", fabricID})\n\t\tctx.StatusCode(http.StatusNotFound)\n\t\tctx.JSON(resp)\n\t\treturn\n\t}\n\tif endpointData.Endpoint.Links != nil && len(endpointData.Endpoint.Links.AddressPools) > 0 {\n\t\terrMsg := fmt.Sprintf(\"Endpoint cannot be deleted as there are dependent upon AddressPool\")\n\t\tlog.Error(errMsg)\n\t\tresp := updateErrorResponse(response.ResourceCannotBeDeleted, errMsg, []interface{}{uri, \"Endpoint\"})\n\t\tctx.StatusCode(http.StatusNotAcceptable)\n\t\tctx.JSON(resp)\n\t\treturn\n\t}\n\t// Todo:Add the validation to verify the links\n\tdelete(capdata.EndpointDataStore, uri)\n\tctx.StatusCode(http.StatusNoContent)\n}", "func decodeDeleteKeyPersonRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.DeleteKeyPersonRequest)\n\treturn endpoints.DeleteKeyPersonRequest{ID: req.Id}, nil\n}", "func addIDToDeleteRequest(r *resource,\n\tinput *svcsdk.DeleteVpcEndpointsInput) error {\n\tif r.ko.Status.VPCEndpointID == nil {\n\t\treturn errors.New(\"unable to extract VPCEndpointID from resource\")\n\t}\n\tinput.VpcEndpointIds = []*string{r.ko.Status.VPCEndpointID}\n\treturn nil\n}", "func (mm *Manager) OnBcsEndpointDelete(obj interface{}) {\n\tbcsendpoint, ok := obj.(*v2.BcsEndpoint)\n\tif !ok {\n\t\tmesosCritical.WithLabelValues(typeBcsEndpoint, eventDelete).Inc()\n\t\tblog.Errorf(\"[Critical]MesosManager BcsEndpoint event handler get unknown type obj %v OnDelete\", obj)\n\t\treturn\n\t}\n\tkey := fmt.Sprintf(\"%s/%s\", bcsendpoint.GetNamespace(), bcsendpoint.GetName())\n\tblog.V(5).Infof(\"BcsEndpoint %s delete, ready to refresh\", key)\n\tmesosEvent.WithLabelValues(typeBcsEndpoint, eventDelete, statusSuccess).Inc()\n\tmm.deleteAppService(key)\n}", "func ExampleWebAppsClient_BeginDeletePrivateEndpointConnectionSlot() {\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 := armappservice.NewWebAppsClient(\"34adfa4f-cedf-4dc0-ba29-b6d1a69ab345\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpoller, err := client.BeginDeletePrivateEndpointConnectionSlot(ctx,\n\t\t\"rg\",\n\t\t\"testSite\",\n\t\t\"connection\",\n\t\t\"stage\",\n\t\tnil)\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// TODO: use response item\n\t_ = res\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalTransport(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:transport/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (o *VvolBindingDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DeleteAllReferences != nil {\n\n\t\t// query param delete_all_references\n\t\tvar qrDeleteAllReferences bool\n\n\t\tif o.DeleteAllReferences != nil {\n\t\t\tqrDeleteAllReferences = *o.DeleteAllReferences\n\t\t}\n\t\tqDeleteAllReferences := swag.FormatBool(qrDeleteAllReferences)\n\t\tif qDeleteAllReferences != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"delete_all_references\", qDeleteAllReferences); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param protocol_endpoint.uuid\n\tif err := r.SetPathParam(\"protocol_endpoint.uuid\", o.ProtocolEndpointUUID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vvol.uuid\n\tif err := r.SetPathParam(\"vvol.uuid\", o.VvolUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func MakeDeleteProductEndpoint(s service.ProductsService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(DeleteProductRequest)\n\t\tdeleteResp, err := s.DeleteProduct(ctx, req.Id)\n\t\treturn DeleteProductResponse{\n\t\t\tDeleteResp: deleteResp,\n\t\t\tErr: err,\n\t\t}, nil\n\t}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalLspBitAttachedBit(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:lsp-bit/frinx-openconfig-network-instance:attached-bit/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalLspBitOverloadBit(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:lsp-bit/frinx-openconfig-network-instance:overload-bit/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func MakeDeleteProfileEndpoint(s Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(deleteProfileRequest)\n\t\te := s.DeleteProfile(ctx, req.ProfileID)\n\t\treturn deleteProfileResponse{Err: e}, nil\n\t}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceMplsLspsUnconstrainedPathPathSetupProtocol(ctx context.Context, name string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:lsps/frinx-openconfig-network-instance:unconstrained-path/frinx-openconfig-network-instance:path-setup-protocol/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (o *StoragePhysicalDisk) SetProtocol(v string) {\n\to.Protocol = &v\n}", "func (h *descriptorHandler) delete(key string, value proto.Message, metadata kvs.Metadata) error {\n\tif h.descriptor == nil {\n\t\treturn nil\n\t}\n\tif h.descriptor.Delete == nil {\n\t\treturn kvs.ErrUnimplementedDelete\n\t}\n\tdefer trackDescMethod(h.descriptor.Name, \"Delete\")()\n\terr := h.descriptor.Delete(key, value, metadata)\n\tif nsErr := checkNetNs(); nsErr != nil {\n\t\terr = nsErr\n\t}\n\treturn err\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaVirtualLinksVirtualLinkConfig(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, remoteRouterId string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:virtual-links/frinx-openconfig-network-instance:virtual-link/{remote-router-id}/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"remote-router-id\"+\"}\", fmt.Sprintf(\"%v\", remoteRouterId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceMplsLspsUnconstrainedPathPathSetupProtocolLdp(ctx context.Context, name string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:lsps/frinx-openconfig-network-instance:unconstrained-path/frinx-openconfig-network-instance:path-setup-protocol/frinx-openconfig-network-instance:ldp/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (es *Endpoints) DelByUUID(uuid string) {\n\tes.Lock()\n\tdefer es.Unlock()\n\tif i, ok := es.mapUUID[uuid]; ok {\n\t\tdelete(es.mapUUID, uuid)\n\n\t\tswitch {\n\t\tcase i == 0:\n\t\t\tif len(es.endpoints) == 1 {\n\t\t\t\tes.endpoints = make([]*Endpoint, 0)\n\t\t\t} else {\n\t\t\t\tes.endpoints = es.endpoints[i+1:]\n\t\t\t}\n\t\tcase i == len(es.endpoints)-1:\n\t\t\tes.endpoints = es.endpoints[:i]\n\t\tdefault:\n\t\t\tes.endpoints = append(es.endpoints[:i], es.endpoints[i+1:]...)\n\t\t}\n\t}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalTransportConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:transport/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (l *Libvirt) NwfilterBindingDelete(OptNwfilter NwfilterBinding) (err error) {\n\tvar buf []byte\n\n\targs := NwfilterBindingDeleteArgs {\n\t\tOptNwfilter: OptNwfilter,\n\t}\n\n\tbuf, err = encode(&args)\n\tif err != nil {\n\t\treturn\n\t}\n\n\n\t_, err = l.requestStream(400, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (srv *Server) RegisterDelete(ep *Endpoint) (err error) {\n\tif ep == nil || ep.Call == nil {\n\t\treturn nil\n\t}\n\n\tep.Method = RequestMethodDelete\n\tep.RequestType = RequestTypeQuery\n\n\t// Check if the same route already registered.\n\tfor _, rute := range srv.routeDeletes {\n\t\t_, ok := rute.parse(ep.Path)\n\t\tif ok {\n\t\t\treturn ErrEndpointAmbiguous\n\t\t}\n\t}\n\n\trute, err := newRoute(ep)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsrv.routeDeletes = append(srv.routeDeletes, rute)\n\n\treturn nil\n}", "func (proxier *Proxier) deleteEndpointConnections(connectionMap map[util.EndpointServicePair]bool) {\n\tfor epSvcPair := range connectionMap {\n\t\tif svcInfo, ok := proxier.serviceMap[epSvcPair.ServicePortName]; ok && svcInfo.Protocol == strings.ToLower(string(api.ProtocolUDP)) {\n\t\t\tendpointIP := util.IPPart(epSvcPair.Endpoint)\n\t\t\terr := util.ClearUDPConntrackForPeers(proxier.exec, svcInfo.ClusterIP.String(), endpointIP)\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"Failed to delete %s endpoint connections, error: %v\", epSvcPair.ServicePortName.String(), err)\n\t\t\t}\n\t\t}\n\t}\n}", "func (r *ProjectsBrokersV2ServiceInstancesServiceBindingsService) Delete(parent string, instanceId string, bindingId string) *ProjectsBrokersV2ServiceInstancesServiceBindingsDeleteCall {\n\tc := &ProjectsBrokersV2ServiceInstancesServiceBindingsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\tc.instanceId = instanceId\n\tc.bindingId = bindingId\n\treturn c\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalLspBitOverloadBitConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:lsp-bit/frinx-openconfig-network-instance:overload-bit/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceMplsSignalingProtocols(ctx context.Context, name string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:signaling-protocols/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func DeletePlayerEndPoint(writer http.ResponseWriter, request *http.Request) {\n\tdefer request.Body.Close()\n\tlogRequestInfo(request)\n\n\tvar player models.Player\n\n\tif err := json.NewDecoder(request.Body).Decode(&player); err != nil {\n\t\trespondWithError(writer, http.StatusInternalServerError, err.Error())\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\tif err := playerDAO.Delete(player); err != nil {\n\t\trespondWithError(writer, http.StatusInternalServerError, err.Error())\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\n\trespondWithJSON(writer, http.StatusOK, map[string]string{\"result\": \"success\"})\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalLspBitAttachedBitConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:lsp-bit/frinx-openconfig-network-instance:attached-bit/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func EndpointDeleteMessage(e notifications.RegenNotificationInfo) AgentNotifyMessage {\n\tnotification := EndpointNotification{\n\t\tEndpointRegenNotification: EndpointRegenNotification{\n\t\t\tID: e.GetID(),\n\t\t\tLabels: e.GetOpLabels(),\n\t\t},\n\t\tPodName: e.GetK8sPodName(),\n\t\tNamespace: e.GetK8sNamespace(),\n\t}\n\n\treturn AgentNotifyMessage{\n\t\tType: AgentNotifyEndpointDeleted,\n\t\tNotification: notification,\n\t}\n}", "func (*DeleteEndpointRequest) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{11}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceMplsIgpLdpSync(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:igp-ldp-sync/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func MakeDeleteNodeEndpoint(s registry.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(DeleteNodeRequest)\n\t\terr := s.DeleteNode(ctx, req.Token, req.Id)\n\t\treturn DeleteNodeResponse{Err: err}, nil\n\t}\n}", "func deletePerson(w http.ResponseWriter, r *http.Request) {\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\r\n\tparams := mux.Vars(r)\r\n\tuuid, err := primitive.ObjectIDFromHex(params[\"uuid\"])\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\r\n\tcollection := models.ConnectDB()\r\n\tobjectToDelete, err := collection.DeleteOne(context.TODO(), bson.M{\"_id\": uuid})\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\tjson.NewEncoder(w).Encode(objectToDelete.DeletedCount)\r\n\r\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceMplsIgpLdpSyncConfig(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:igp-ldp-sync/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (p *PatternServeMux) Del(pat string, h http.Handler) {\n\tp.Add(\"DELETE\", pat, h)\n}", "func (c *Client) Delete(ctx context.Context, p *DeletePayload) (err error) {\n\t_, err = c.DeleteEndpoint(ctx, p)\n\treturn\n}", "func (v *EventPipelineParameterDelete) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonF8e2f9b1DecodeGithubComOvhCdsSdk16(l, v)\n}", "func (a *DefaultApiService) DeleteEndpointExecute(r ApiDeleteEndpointRequest) (*_nethttp.Response, GenericOpenAPIError) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\texecutionError GenericOpenAPIError\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DefaultApiService.DeleteEndpoint\")\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn nil, executionError\n\t}\n\n\tlocalVarPath := localBasePath + \"/endpoints/{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\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, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn 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 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 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 == 404 {\n\t\t\tvar v ErrorNotFound\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, executionError\n}", "func (d *ABFToInterfaceDescriptor) Delete(key string, emptyVal proto.Message, metadata api.Metadata) (err error) {\n\t// validate and get all required values\n\tisIPv6, abfIdx, ifIdx, priority, err := d.process(key)\n\tif err != nil {\n\t\td.log.Error(err)\n\t\treturn err\n\t}\n\n\t// detach interface to ABF policy\n\tif isIPv6 {\n\t\treturn d.abfHandler.AbfDetachInterfaceIPv6(abfIdx, ifIdx, priority)\n\t}\n\treturn d.abfHandler.AbfDetachInterfaceIPv4(abfIdx, ifIdx, priority)\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceInterfaceRefConfig(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:interface-ref/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaVirtualLinksVirtualLink(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, remoteRouterId string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:virtual-links/frinx-openconfig-network-instance:virtual-link/{remote-router-id}/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"remote-router-id\"+\"}\", fmt.Sprintf(\"%v\", remoteRouterId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalReferenceBandwidth(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:reference-bandwidth/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func ExampleRDS_DeleteDBClusterEndpoint_shared00() {\n\tsvc := rds.New(session.New())\n\tinput := &rds.DeleteDBClusterEndpointInput{\n\t\tDBClusterEndpointIdentifier: aws.String(\"mycustomendpoint\"),\n\t}\n\n\tresult, err := svc.DeleteDBClusterEndpoint(input)\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\n\t\t\tcase rds.ErrCodeInvalidDBClusterEndpointStateFault:\n\t\t\t\tfmt.Println(rds.ErrCodeInvalidDBClusterEndpointStateFault, aerr.Error())\n\t\t\tcase rds.ErrCodeDBClusterEndpointNotFoundFault:\n\t\t\t\tfmt.Println(rds.ErrCodeDBClusterEndpointNotFoundFault, aerr.Error())\n\t\t\tcase rds.ErrCodeInvalidDBClusterStateFault:\n\t\t\t\tfmt.Println(rds.ErrCodeInvalidDBClusterStateFault, aerr.Error())\n\t\t\tdefault:\n\t\t\t\tfmt.Println(aerr.Error())\n\t\t\t}\n\t\t} else {\n\t\t\t// Print the error, cast err to awserr.Error to get the Code and\n\t\t\t// Message from an error.\n\t\t\tfmt.Println(err.Error())\n\t\t}\n\t\treturn\n\t}\n\n\tfmt.Println(result)\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2GlobalMplsIgpLdpSyncConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:igp-ldp-sync/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func MakeDeleteEndpoint(s service.TodoService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(DeleteRequest)\n\t\terror := s.Delete(ctx, req.Id)\n\t\treturn DeleteResponse{Error: error}, nil\n\t}\n}", "func (a *SvmApiService) SvmPeerPermissionDelete(ctx _context.Context, clusterUuid string, svmUuid string) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/svm/peer-permissions/{cluster.uuid}/{svm.uuid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"cluster.uuid\"+\"}\", _neturl.QueryEscape(parameterToString(clusterUuid, \"\")), -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"svm.uuid\"+\"}\", _neturl.QueryEscape(parameterToString(svmUuid, \"\")), -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\", \"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, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tvar v ErrorResponse\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceLsaFilterConfig(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId 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 + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:lsa-filter/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -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/xml\"}\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/xml\"}\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\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (o *StoragePhysicalDiskAllOf) SetProtocol(v string) {\n\to.Protocol = &v\n}", "func (d *InterfaceVrfDescriptor) Delete(key string, emptyVal proto.Message, metadata kvs.Metadata) (err error) {\n\tswIfIndex, vrf, inheritedVrf, ipv4, ipv6, err := d.getParametersFromKey(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !inheritedVrf && vrf > 0 && ipv4 {\n\t\terr = d.ifHandler.SetInterfaceVrf(swIfIndex, uint32(0))\n\t\tif err != nil {\n\t\t\td.log.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\tif !inheritedVrf && vrf > 0 && ipv6 {\n\t\terr = d.ifHandler.SetInterfaceVrfIPv6(swIfIndex, uint32(0))\n\t\tif err != nil {\n\t\t\td.log.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (client PatternClient) DeletePatternResponder(resp *http.Response) (result OperationStatus, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}" ]
[ "0.7659155", "0.570262", "0.5665805", "0.5574231", "0.5487855", "0.5458138", "0.54484373", "0.53901285", "0.53780055", "0.5294667", "0.525582", "0.52462846", "0.5224845", "0.51934177", "0.51763844", "0.5141262", "0.51157594", "0.50997233", "0.50864244", "0.5083183", "0.5074168", "0.50425315", "0.50207734", "0.5019197", "0.49907386", "0.49783346", "0.49025732", "0.4901423", "0.4880698", "0.48686674", "0.48633406", "0.48553225", "0.48549277", "0.4838389", "0.48282278", "0.48248425", "0.48178375", "0.48143038", "0.47825012", "0.47782", "0.47685513", "0.47555846", "0.475199", "0.4737166", "0.4736255", "0.47239432", "0.47058982", "0.46993423", "0.46952316", "0.46903276", "0.4684593", "0.4682517", "0.46742675", "0.46615297", "0.46572226", "0.4645298", "0.46447167", "0.4633049", "0.4624563", "0.46199504", "0.4618318", "0.46034646", "0.45989957", "0.4597142", "0.45820674", "0.4580892", "0.45792988", "0.45774424", "0.45762387", "0.45734647", "0.4572499", "0.45715922", "0.45692363", "0.45659238", "0.4555449", "0.45550865", "0.45513573", "0.45482436", "0.45472884", "0.45465866", "0.45455536", "0.4545486", "0.4533648", "0.45299247", "0.4514827", "0.4513684", "0.4513491", "0.4501826", "0.45017937", "0.44947034", "0.4491033", "0.44896305", "0.44893298", "0.44768938", "0.44745764", "0.44701675", "0.44681287", "0.4464367", "0.4455591", "0.44536605" ]
0.8175953
0
WithVvolUUID adds the vvolUUID to the vvol binding delete params
func (o *VvolBindingDeleteParams) WithVvolUUID(vvolUUID string) *VvolBindingDeleteParams { o.SetVvolUUID(vvolUUID) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) SetVvolUUID(vvolUUID string) {\n\to.VvolUUID = vvolUUID\n}", "func (o *VvolBindingDeleteParams) WithProtocolEndpointUUID(protocolEndpointUUID string) *VvolBindingDeleteParams {\n\to.SetProtocolEndpointUUID(protocolEndpointUUID)\n\treturn o\n}", "func DeleteVol(uuid string) int32 {\n\n\t_, conn, err := utils.DialVolMgr(VolMgrHosts)\n\tif err != nil {\n\t\tlogger.Error(\"DeleteVol failed,Dial to VolMgrHosts fail :%v\", err)\n\t\treturn -1\n\t}\n\tdefer conn.Close()\n\tvc := vp.NewVolMgrClient(conn)\n\n\tpDeleteVolReq := &vp.DeleteVolReq{\n\t\tUUID: uuid,\n\t}\n\tctx, _ := context.WithTimeout(context.Background(), VOLUME_TIMEOUT_SECONDS*time.Second)\n\tpDeleteVolAck, err := vc.DeleteVol(ctx, pDeleteVolReq)\n\tif err != nil {\n\t\treturn -1\n\t}\n\n\tif pDeleteVolAck.Ret != 0 {\n\t\tlogger.Error(\"DeleteVol failed :%v\", pDeleteVolAck.Ret)\n\t\treturn -1\n\t}\n\n\treturn 0\n}", "func (l *Libvirt) StorageVolDelete(Vol StorageVol, Flags StorageVolDeleteFlags) (err error) {\n\tvar buf []byte\n\n\targs := StorageVolDeleteArgs {\n\t\tVol: Vol,\n\t\tFlags: Flags,\n\t}\n\n\tbuf, err = encode(&args)\n\tif err != nil {\n\t\treturn\n\t}\n\n\n\t_, err = l.requestStream(94, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func deleteVolume(vol string) {\n\tclient.RemoveVolume(vol)\n}", "func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (p *FCProvisioner) Delete(volume *v1.PersistentVolume, config map[string]string, nodeList []*v1.Node) (err error) {\n\tdefer func() {\n\t\tif res := recover(); res != nil && err == nil {\n\t\t\terr = errors.New(\"error while deleting volume \" + fmt.Sprint(res))\n\t\t}\n\t}()\n\tprovisioned, err := p.provisioned(volume)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error determining if this provisioner was the one to provision volume %q: %v\", volume.Name, err)\n\t}\n\tif !provisioned {\n\t\tstrerr := fmt.Sprintf(\"this provisioner id %s didn't provision volume %q and so can't delete it; id %s did & can\", createdBy, volume.Name, volume.Annotations[annCreatedBy])\n\t\treturn &controller.IgnoredError{Reason: strerr}\n\t}\n\n\tglog.Info(\"volume deletion request received: \", volume.GetName())\n\n\tif volume.Annotations[\"volumeId\"] == \"\" {\n\t\terr = errors.New(\"volumeid is empty\")\n\t\treturn err\n\t}\n\tvolId, err := strconv.ParseInt(volume.Annotations[\"volumeId\"], 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = p.volDestroy(volId, volume.Annotations[\"volume_name\"], nodeList)\n\tif err != nil {\n\t\tglog.Error(err)\n\t\treturn err\n\n\t}\n\tglog.Info(\"Volume deleted: \", volume.GetName())\n\treturn nil\n}", "func (e *ExternalInterface) DeleteVolume(ctx context.Context, req *systemsproto.VolumeRequest, pc *PluginContact, taskID string) {\n\tvar resp response.RPC\n\tvar targetURI = \"/redfish/v1/Systems/\" + req.SystemID + \"/Storage/\" + req.StorageInstance + \"/Volumes\" + req.VolumeID\n\n\ttaskInfo := &common.TaskUpdateInfo{Context: ctx, TaskID: taskID, TargetURI: targetURI,\n\t\tUpdateTask: pc.UpdateTask, TaskRequest: string(req.RequestBody)}\n\tvar volume smodel.Volume\n\terr := JSONUnmarshalFunc(req.RequestBody, &volume)\n\tif err != nil {\n\t\terrorMessage := \"Error while unmarshaling the create volume request: \" + err.Error()\n\t\tl.LogWithFields(ctx).Error(errorMessage)\n\t\tcommon.GeneralError(http.StatusBadRequest, response.MalformedJSON, errorMessage, []interface{}{}, taskInfo)\n\t\treturn\n\t}\n\n\t// spliting the uuid and system id\n\trequestData := strings.SplitN(req.SystemID, \".\", 2)\n\tif len(requestData) != 2 || requestData[1] == \"\" {\n\t\terrorMessage := \"error: SystemUUID not found\"\n\t\tcommon.GeneralError(http.StatusNotFound, response.ResourceNotFound, errorMessage, []interface{}{\"System\", req.SystemID}, taskInfo)\n\t\treturn\n\t}\n\tuuid := requestData[0]\n\ttarget, gerr := e.DB.GetTarget(uuid)\n\tif gerr != nil {\n\t\tcommon.GeneralError(http.StatusNotFound, response.ResourceNotFound, gerr.Error(), []interface{}{\"System\", uuid}, taskInfo)\n\t\treturn\n\t}\n\t// Validating the storage instance\n\tif StringTrimSpace(req.VolumeID) == \"\" {\n\t\terrorMessage := \"error: Volume id is not found\"\n\t\tcommon.GeneralError(http.StatusBadRequest, response.ResourceNotFound, errorMessage, []interface{}{\"Volume\", req.VolumeID}, taskInfo)\n\t\treturn\n\t}\n\n\t// Validating the request JSON properties for case sensitive\n\tinvalidProperties, err := RequestParamsCaseValidatorFunc(req.RequestBody, volume)\n\tif err != nil {\n\t\terrMsg := \"error while validating request parameters for volume creation: \" + err.Error()\n\t\tl.LogWithFields(ctx).Error(errMsg)\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errMsg, nil, taskInfo)\n\t\treturn\n\t} else if invalidProperties != \"\" {\n\t\terrorMessage := \"error: one or more properties given in the request body are not valid, ensure properties are listed in uppercamelcase \"\n\t\tl.LogWithFields(ctx).Error(errorMessage)\n\t\tcommon.GeneralError(http.StatusBadRequest, response.PropertyUnknown, errorMessage, []interface{}{invalidProperties}, taskInfo)\n\t\treturn\n\t}\n\n\tkey := fmt.Sprintf(\"/redfish/v1/Systems/%s/Storage/%s/Volumes/%s\", req.SystemID, req.StorageInstance, req.VolumeID)\n\t_, dbErr := e.DB.GetResource(ctx, \"Volumes\", key)\n\tif dbErr != nil {\n\t\tl.LogWithFields(ctx).Error(\"error getting volumes details : \" + dbErr.Error())\n\t\terrorMessage := dbErr.Error()\n\t\tif errors.DBKeyNotFound == dbErr.ErrNo() {\n\t\t\tvar getDeviceInfoRequest = scommon.ResourceInfoRequest{\n\t\t\t\tURL: key,\n\t\t\t\tUUID: uuid,\n\t\t\t\tSystemID: requestData[1],\n\t\t\t\tContactClient: e.ContactClient,\n\t\t\t\tDevicePassword: e.DevicePassword,\n\t\t\t\tGetPluginStatus: e.GetPluginStatus,\n\t\t\t}\n\t\t\tvar err error\n\t\t\tif _, err = scommon.GetResourceInfoFromDevice(ctx, getDeviceInfoRequest, true); err != nil {\n\t\t\t\tcommon.GeneralError(http.StatusNotFound, response.ResourceNotFound, errorMessage, []interface{}{\"Volumes\", key}, taskInfo)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t} else {\n\t\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errorMessage, nil, taskInfo)\n\t\t\treturn\n\t\t}\n\t}\n\n\tdecryptedPasswordByte, err := e.DevicePassword(target.Password)\n\tif err != nil {\n\t\terrorMessage := \"error while trying to decrypt device password: \" + err.Error()\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errorMessage, nil, taskInfo)\n\t\treturn\n\t}\n\ttarget.Password = decryptedPasswordByte\n\t// Get the Plugin info\n\tplugin, gerr := e.DB.GetPluginData(target.PluginID)\n\tif gerr != nil {\n\t\terrorMessage := \"error while trying to get plugin details\"\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errorMessage, nil, taskInfo)\n\t\treturn\n\t}\n\n\tvar contactRequest scommon.PluginContactRequest\n\tcontactRequest.ContactClient = e.ContactClient\n\tcontactRequest.Plugin = plugin\n\tcontactRequest.GetPluginStatus = e.GetPluginStatus\n\tif StringsEqualFold(plugin.PreferredAuthType, \"XAuthToken\") {\n\t\tvar err error\n\t\tcontactRequest.HTTPMethodType = http.MethodPost\n\t\tcontactRequest.DeviceInfo = map[string]interface{}{\n\t\t\t\"UserName\": plugin.Username,\n\t\t\t\"Password\": string(plugin.Password),\n\t\t}\n\t\tcontactRequest.OID = \"/ODIM/v1/Sessions\"\n\t\t_, token, _, getResponse, err := scommon.ContactPlugin(ctx, contactRequest, \"error while creating session with the plugin: \")\n\n\t\tif err != nil {\n\t\t\tcommon.GeneralError(getResponse.StatusCode, getResponse.StatusMessage, err.Error(), nil, taskInfo)\n\t\t\treturn\n\t\t}\n\t\tcontactRequest.Token = token\n\t} else {\n\t\tcontactRequest.BasicAuth = map[string]string{\n\t\t\t\"UserName\": plugin.Username,\n\t\t\t\"Password\": string(plugin.Password),\n\t\t}\n\n\t}\n\n\tif string(req.RequestBody) == \"null\" {\n\t\ttarget.PostBody = []byte{}\n\t} else {\n\t\ttarget.PostBody = req.RequestBody\n\n\t}\n\tcontactRequest.HTTPMethodType = http.MethodDelete\n\tcontactRequest.DeviceInfo = target\n\tcontactRequest.OID = fmt.Sprintf(\"/ODIM/v1/Systems/%s/Storage/%s/Volumes/%s\", requestData[1], req.StorageInstance, req.VolumeID)\n\n\tbody, location, pluginIP, getResponse, err := scommon.ContactPlugin(ctx, contactRequest, \"error while deleting a volume: \")\n\tif err != nil {\n\t\tresp.StatusCode = getResponse.StatusCode\n\t\tjson.Unmarshal(body, &resp.Body)\n\t\terrMsg := \"error while deleting volume: \" + err.Error()\n\t\tl.LogWithFields(ctx).Error(errMsg)\n\t\ttask := fillTaskData(taskID, targetURI, string(req.RequestBody), resp,\n\t\t\tcommon.Completed, common.Warning, 100, http.MethodPost)\n\t\tpc.UpdateTask(ctx, task)\n\t\treturn\n\t}\n\tif getResponse.StatusCode == http.StatusAccepted {\n\t\terr = pc.SavePluginTaskInfo(ctx, pluginIP, plugin.IP, taskID, location)\n\t\tif err != nil {\n\t\t\tl.LogWithFields(ctx).Error(err)\n\t\t}\n\t\treturn\n\t}\n\n\t// handling the status ok response from plugin\n\tif getResponse.StatusCode == http.StatusOK && body != nil {\n\t\tresp.StatusCode = getResponse.StatusCode\n\t\tjson.Unmarshal(body, &resp.Body)\n\t\ttask := fillTaskData(taskID, targetURI, string(req.RequestBody), resp,\n\t\t\tcommon.Completed, common.OK, 100, http.MethodDelete)\n\t\tpc.UpdateTask(ctx, task)\n\t\treturn\n\t}\n\n\t// delete a volume in db\n\tif derr := e.DB.DeleteVolume(ctx, key); derr != nil {\n\t\terrMsg := \"error while trying to delete volume: \" + derr.Error()\n\t\tl.LogWithFields(ctx).Error(errMsg)\n\t\tif errors.DBKeyNotFound == derr.ErrNo() {\n\t\t\tcommon.GeneralError(http.StatusNotFound, response.ResourceNotFound, errMsg, []interface{}{\"Volumes\", key}, taskInfo)\n\t\t\treturn\n\t\t}\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errMsg, nil, taskInfo)\n\t\treturn\n\t}\n\n\t// adding volume collection uri and deleted volume uri to the AddSystemResetInfo\n\t// for avoiding storing or retrieving them from DB before a BMC reset.\n\tcollectionKey := fmt.Sprintf(\"/redfish/v1/Systems/%s/Storage/%s/Volumes\", req.SystemID, req.StorageInstance)\n\te.DB.AddSystemResetInfo(ctx, key, \"On\")\n\te.DB.AddSystemResetInfo(ctx, collectionKey, \"On\")\n\n\tresp.StatusCode = http.StatusNoContent\n\tresp.StatusMessage = response.Success\n\ttask := fillTaskData(taskID, targetURI, string(req.RequestBody), resp,\n\t\tcommon.Completed, common.OK, 100, http.MethodDelete)\n\tpc.UpdateTask(ctx, task)\n}", "func DelVol(fcVolName string) (string, error) {\n\tvar (\n\t\tcmdOut []byte\n\t\terr error\n\t)\n\n\tstrs := strings.SplitAfterN(fcVolName, \"/dev/\", 2)\n\tif len(strs) == 2 && strs[0] == \"/dev/\" {\n\t\tfcVolName = strs[1]\n\t}\n\tlog.Debug(\"fcVolName=\", fcVolName)\n\n\tcmd := \"fcagent\"\n\targs := []string{\n\t\t\"delvol\",\n\t\tfcVolName,\n\t\t\"-donotdelebs\"}\n\n\tlog.Debug(cmd, args)\n\n\tif cmdOut, err = exec.Command(cmd, args...).Output(); err != nil {\n\t\tlog.Debug(err)\n\t}\n\n\treturn string(cmdOut), err\n}", "func NewVvolBindingDeleteParams() *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func cephRBDVolumeDelete(clusterName string, poolName string, volumeName string,\n\tvolumeType string, userName string) error {\n\t_, err := shared.RunCommand(\n\t\t\"rbd\",\n\t\t\"--id\", userName,\n\t\t\"--cluster\", clusterName,\n\t\t\"--pool\", poolName,\n\t\t\"rm\",\n\t\tfmt.Sprintf(\"%s_%s\", volumeType, volumeName))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (o *VvolBindingDeleteParams) WithContext(ctx context.Context) *VvolBindingDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (client *Client) DeleteTagWithUuidWithOptions(request *DeleteTagWithUuidRequest, runtime *util.RuntimeOptions) (_result *DeleteTagWithUuidResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.TagName)) {\n\t\tquery[\"TagName\"] = request.TagName\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.UuidList)) {\n\t\tquery[\"UuidList\"] = request.UuidList\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"DeleteTagWithUuid\"),\n\t\tVersion: tea.String(\"2018-12-03\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &DeleteTagWithUuidResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func (o *VvolBindingDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DeleteAllReferences != nil {\n\n\t\t// query param delete_all_references\n\t\tvar qrDeleteAllReferences bool\n\n\t\tif o.DeleteAllReferences != nil {\n\t\t\tqrDeleteAllReferences = *o.DeleteAllReferences\n\t\t}\n\t\tqDeleteAllReferences := swag.FormatBool(qrDeleteAllReferences)\n\t\tif qDeleteAllReferences != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"delete_all_references\", qDeleteAllReferences); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param protocol_endpoint.uuid\n\tif err := r.SetPathParam(\"protocol_endpoint.uuid\", o.ProtocolEndpointUUID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vvol.uuid\n\tif err := r.SetPathParam(\"vvol.uuid\", o.VvolUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (s *Stack) DeleteVolumeAttachment(serverID, vaID string) error {\n\tif s == nil {\n\t\treturn scerr.InvalidInstanceError()\n\t}\n\tif serverID == \"\" {\n\t\treturn scerr.InvalidParameterError(\"serverID\", \"cannot be empty string\")\n\t}\n\tif vaID == \"\" {\n\t\treturn scerr.InvalidParameterError(\"vaID\", \"cannot be empty string\")\n\t}\n\n\tdefer concurrency.NewTracer(nil, \"('\"+serverID+\"', '\"+vaID+\"')\", true).WithStopwatch().GoingIn().OnExitTrace()()\n\n\tr := volumeattach.Delete(s.ComputeClient, serverID, vaID)\n\terr := r.ExtractErr()\n\tif err != nil {\n\t\treturn scerr.Wrap(err, fmt.Sprintf(\"error deleting volume attachment '%s': %s\", vaID, ProviderErrorToString(err)))\n\t}\n\treturn nil\n}", "func (client *Client) DeleteVodSpecificConfigWithOptions(request *DeleteVodSpecificConfigRequest, runtime *util.RuntimeOptions) (_result *DeleteVodSpecificConfigResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.ConfigId)) {\n\t\tquery[\"ConfigId\"] = request.ConfigId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.DomainName)) {\n\t\tquery[\"DomainName\"] = request.DomainName\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Env)) {\n\t\tquery[\"Env\"] = request.Env\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerId)) {\n\t\tquery[\"OwnerId\"] = request.OwnerId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.SecurityToken)) {\n\t\tquery[\"SecurityToken\"] = request.SecurityToken\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"DeleteVodSpecificConfig\"),\n\t\tVersion: tea.String(\"2017-03-21\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &DeleteVodSpecificConfigResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func (s stack) DeleteVolume(ctx context.Context, ref string) fail.Error {\n\tif valid.IsNil(s) {\n\t\treturn fail.InvalidInstanceError()\n\t}\n\treturn fail.NotImplementedError(\"implement me\")\n}", "func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (a *DeprecatedBusManagementRouterApiService) DeleteBindingUsingDELETE(ctx _context.Context, routingKeyFilter string, fifoName string) ApiDeleteBindingUsingDELETERequest {\n\treturn ApiDeleteBindingUsingDELETERequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\troutingKeyFilter: routingKeyFilter,\n\t\tfifoName: fifoName,\n\t}\n}", "func BdevLvolDelete(ctx context.Context, client *Client, args BdevLvolDeleteArgs) (bool, error) {\n\tvar response bool\n\terr := client.Invoke(ctx, \"bdev_lvol_delete\", args, &response)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn response, err\n}", "func (cl *Client) VolumeDelete(ctx context.Context, vda *csp.VolumeDeleteArgs) error {\n\tsvc, vid, _ := VolumeIdentifierParse(vda.VolumeIdentifier)\n\tswitch svc {\n\tcase ServiceGCE:\n\t\treturn cl.gceVolumeDelete(ctx, vda, vid)\n\t}\n\treturn fmt.Errorf(\"invalid volume identifier\")\n}", "func (rc *regClient) TagDelete(ctx context.Context, ref types.Ref) error {\n\tvar tempManifest manifest.Manifest\n\tif ref.Tag == \"\" {\n\t\treturn ErrMissingTag\n\t}\n\n\t// attempt to delete the tag directly, available in OCI distribution-spec, and Hub API\n\treq := httpReq{\n\t\thost: ref.Registry,\n\t\tnoMirrors: true,\n\t\tapis: map[string]httpReqAPI{\n\t\t\t\"\": {\n\t\t\t\tmethod: \"DELETE\",\n\t\t\t\trepository: ref.Repository,\n\t\t\t\tpath: \"manifests/\" + ref.Tag,\n\t\t\t\tignoreErr: true, // do not trigger backoffs if this fails\n\t\t\t},\n\t\t\t\"hub\": {\n\t\t\t\tmethod: \"DELETE\",\n\t\t\t\tpath: \"repositories/\" + ref.Repository + \"/tags/\" + ref.Tag + \"/\",\n\t\t\t},\n\t\t},\n\t}\n\n\tresp, err := rc.httpDo(ctx, req)\n\tif resp != nil {\n\t\tdefer resp.Close()\n\t}\n\t// TODO: Hub may return a different status\n\tif err == nil && resp != nil && resp.HTTPResponse().StatusCode == 202 {\n\t\treturn nil\n\t}\n\t// ignore errors, fallback to creating a temporary manifest to replace the tag and deleting that manifest\n\n\t// lookup the current manifest media type\n\tcurManifest, err := rc.ManifestHead(ctx, ref)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// create empty image config with single label\n\t// Note, this should be MediaType specific, but it appears that docker uses OCI for the config\n\tnow := time.Now()\n\tconf := ociv1.Image{\n\t\tCreated: &now,\n\t\tConfig: ociv1.ImageConfig{\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"delete-tag\": ref.Tag,\n\t\t\t\t\"delete-date\": now.String(),\n\t\t\t},\n\t\t},\n\t\tOS: \"linux\",\n\t\tArchitecture: \"amd64\",\n\t\tRootFS: ociv1.RootFS{\n\t\t\tType: \"layers\",\n\t\t\tDiffIDs: []digest.Digest{},\n\t\t},\n\t}\n\tconfB, err := json.Marshal(conf)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdigester := digest.Canonical.Digester()\n\tconfBuf := bytes.NewBuffer(confB)\n\t_, err = confBuf.WriteTo(digester.Hash())\n\tif err != nil {\n\t\treturn err\n\t}\n\tconfDigest := digester.Digest()\n\n\t// create manifest with config, matching the original tag manifest type\n\tswitch curManifest.GetMediaType() {\n\tcase MediaTypeOCI1Manifest, MediaTypeOCI1ManifestList:\n\t\ttempManifest, err = manifest.FromOrig(ociv1.Manifest{\n\t\t\tVersioned: ociv1Specs.Versioned{\n\t\t\t\tSchemaVersion: 1,\n\t\t\t},\n\t\t\tConfig: ociv1.Descriptor{\n\t\t\t\tMediaType: MediaTypeOCI1ImageConfig,\n\t\t\t\tDigest: confDigest,\n\t\t\t\tSize: int64(len(confB)),\n\t\t\t},\n\t\t\tLayers: []ociv1.Descriptor{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault: // default to the docker v2 schema\n\t\ttempManifest, err = manifest.FromOrig(dockerSchema2.Manifest{\n\t\t\tVersioned: dockerManifest.Versioned{\n\t\t\t\tSchemaVersion: 2,\n\t\t\t\tMediaType: MediaTypeDocker2Manifest,\n\t\t\t},\n\t\t\tConfig: dockerDistribution.Descriptor{\n\t\t\t\tMediaType: MediaTypeDocker2ImageConfig,\n\t\t\t\tDigest: confDigest,\n\t\t\t\tSize: int64(len(confB)),\n\t\t\t},\n\t\t\tLayers: []dockerDistribution.Descriptor{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\trc.log.WithFields(logrus.Fields{\n\t\t\"ref\": ref.Reference,\n\t}).Debug(\"Sending dummy manifest to replace tag\")\n\n\t// push config\n\t_, _, err = rc.BlobPut(ctx, ref, confDigest, ioutil.NopCloser(bytes.NewReader(confB)), MediaTypeDocker2ImageConfig, int64(len(confB)))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed sending dummy config to delete %s: %w\", ref.CommonName(), err)\n\t}\n\n\t// push manifest to tag\n\terr = rc.ManifestPut(ctx, ref, tempManifest)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed sending dummy manifest to delete %s: %w\", ref.CommonName(), err)\n\t}\n\n\tref.Digest = tempManifest.GetDigest().String()\n\n\t// delete manifest by digest\n\trc.log.WithFields(logrus.Fields{\n\t\t\"ref\": ref.Reference,\n\t\t\"digest\": ref.Digest,\n\t}).Debug(\"Deleting dummy manifest\")\n\terr = rc.ManifestDelete(ctx, ref)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed deleting dummy manifest for %s: %w\", ref.CommonName(), err)\n\t}\n\n\treturn nil\n}", "func (util *PortworxVolumeUtil) DeleteVolume(d *portworxVolumeDeleter) error {\n\tdriver, err := util.getPortworxDriver(d.plugin.host, false /*localOnly*/)\n\tif err != nil || driver == nil {\n\t\tglog.Errorf(\"Failed to get portworx driver. Err: %v\", err)\n\t\treturn err\n\t}\n\n\terr = driver.Delete(d.volumeID)\n\tif err != nil {\n\t\tglog.Errorf(\"Error deleting Portworx Volume (%v): %v\", d.volName, err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func NewVvolBindingDeleteParamsWithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (d *InterfaceVrfDescriptor) Delete(key string, emptyVal proto.Message, metadata kvs.Metadata) (err error) {\n\tswIfIndex, vrf, inheritedVrf, ipv4, ipv6, err := d.getParametersFromKey(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !inheritedVrf && vrf > 0 && ipv4 {\n\t\terr = d.ifHandler.SetInterfaceVrf(swIfIndex, uint32(0))\n\t\tif err != nil {\n\t\t\td.log.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\tif !inheritedVrf && vrf > 0 && ipv6 {\n\t\terr = d.ifHandler.SetInterfaceVrfIPv6(swIfIndex, uint32(0))\n\t\tif err != nil {\n\t\t\td.log.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func DeleteVNet(vNetName string, rgroupName string) {\n\ta := wow.New(os.Stdout, spin.Get(spin.Dots), \"Deleting virtual network : \"+vNetName)\n\ta.Start()\n\ttime.Sleep(2 * time.Second)\n\ta.Text(\"This would take a few minutes...\").Spinner(spin.Get(spin.Dots))\n\tcmd := exec.Command(\"az\", \"network\", \"vnet\", \"delete\", \"--name\",\n\t\tvNetName, \"--resource-group\", rgroupName)\n\tvar out bytes.Buffer\n\tvar stderr bytes.Buffer\n\tcmd.Stdout = &out\n\tcmd.Stderr = &stderr\n\terr := cmd.Run()\n\tif err != nil {\n\t\tfmt.Println(fmt.Sprint(err) + \": \" + stderr.String())\n\t\treturn\n\t}\n\ta.PersistWith(spin.Spinner{}, \"....\")\n\tfmt.Println(\"Result: \" + out.String())\n}", "func DeleteVM(c config.Cpi, extInput bosh.MethodArguments) error {\n\tvar cid string\n\tif reflect.TypeOf(extInput[0]) != reflect.TypeOf(cid) {\n\t\treturn errors.New(\"Received unexpected type for vm cid\")\n\t}\n\n\tcid = extInput[0].(string)\n\tnode, err := rackhdapi.GetNodeByVMCID(c, cid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif node.PersistentDisk.IsAttached {\n\t\terr = rackhdapi.MakeDiskRequest(c, node, false)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tworkflowName, err := workflows.PublishDeprovisionNodeWorkflow(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = workflows.RunDeprovisionNodeWorkflow(c, node.ID, workflowName, cid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, tag := range node.Tags {\n\t\tif strings.HasPrefix(tag, DiskCIDTagPrefix) {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\terr = rackhdapi.ReleaseNode(c, node.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *restClient) DeleteVolume(ctx context.Context, req *netapppb.DeleteVolumeRequest, opts ...gax.CallOption) (*DeleteVolumeOperation, error) {\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.GetName())\n\n\tparams := url.Values{}\n\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\tif req.GetForce() {\n\t\tparams.Add(\"force\", fmt.Sprintf(\"%v\", req.GetForce()))\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\", \"name\", url.QueryEscape(req.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(\"DELETE\", baseUrl.String(), nil)\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 &DeleteVolumeOperation{\n\t\tlro: longrunning.InternalNewOperation(*c.LROClient, resp),\n\t\tpollPath: override,\n\t}, nil\n}", "func DeleteVolume(base, volID string) error {\n\tklog.V(4).Infof(\"starting to delete hostpath volume: %s\", volID)\n\n\tpath := filepath.Join(base, volID)\n\tif err := os.RemoveAll(path); err != nil && !os.IsNotExist(err) {\n\t\treturn err\n\t}\n\tklog.V(4).Infof(\"deleted hostpath volume: %s\", volID)\n\treturn nil\n}", "func (c *MockVirtualNetworksClient) Delete(ctx context.Context, resourceGroupName, vnetName string) error {\n\t// Ignore resourceGroupName for simplicity.\n\tif _, ok := c.VNets[vnetName]; !ok {\n\t\treturn fmt.Errorf(\"%s does not exist\", vnetName)\n\t}\n\tdelete(c.VNets, vnetName)\n\treturn nil\n}", "func (p *cinderProvisioner) Delete(pv *v1.PersistentVolume) error {\n\tann, ok := pv.Annotations[provisionerIDAnn]\n\tif !ok {\n\t\treturn errors.New(\"identity annotation not found on PV\")\n\t}\n\tif ann != p.identity {\n\t\treturn &controller.IgnoredError{\n\t\t\tReason: \"identity annotation on PV does not match ours\",\n\t\t}\n\t}\n\t// TODO when beta is removed, have to check kube version and pick v1/beta\n\t// accordingly: maybe the controller lib should offer a function for that\n\n\tvolumeID, ok := pv.Annotations[cinderVolumeID]\n\tif !ok {\n\t\treturn errors.New(cinderVolumeID + \" annotation not found on PV\")\n\t}\n\n\tctx := deleteCtx{p, pv}\n\tmapper, err := newVolumeMapperFromPV(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmapper.AuthTeardown(ctx)\n\n\terr = disconnectCinderVolume(p, volumeID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = unreserveCinderVolume(p, volumeID)\n\tif err != nil {\n\t\t// TODO: Create placeholder PV?\n\t\tglog.Errorf(\"Failed to unreserve volume: %v\", err)\n\t\treturn err\n\t}\n\n\terr = deleteCinderVolume(p, volumeID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tglog.V(2).Infof(\"Successfully deleted cinder volume %s\", volumeID)\n\treturn nil\n}", "func (s *VPCService) NewDeleteVPCOfferingParams(id string) *DeleteVPCOfferingParams {\n\tp := &DeleteVPCOfferingParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func (a AppblueprintApi) AppBlueprintsUuidDelete(uuid string) (*APIResponse, error) {\n\n\tvar httpMethod = \"Delete\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/app_blueprints/{uuid}\"\n\tpath = strings.Replace(path, \"{\"+\"uuid\"+\"}\", fmt.Sprintf(\"%v\", uuid), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication (basicAuth) required\n\n\t// http basic authentication required\n\tif a.Configuration.Username != \"\" || a.Configuration.Password != \"\" {\n\t\theaderParams[\"Authorization\"] = \"Basic \" + a.Configuration.GetBasicAuthEncodedString()\n\t}\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\theaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\n\thttpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tif err != nil {\n\t\treturn NewAPIResponse(httpResponse.RawResponse), err\n\t}\n\n\treturn NewAPIResponse(httpResponse.RawResponse), err\n}", "func (o *VvolBindingDeleteParams) WithDefaults() *VvolBindingDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func VisualisationDeleteParams(dbOwner, dbFolder, dbName, visName string) (err error) {\n\tvar commandTag pgx.CommandTag\n\tdbQuery := `\n\t\tWITH u AS (\n\t\t\tSELECT user_id\n\t\t\tFROM users\n\t\t\tWHERE lower(user_name) = lower($1)\n\t\t), d AS (\n\t\t\tSELECT db.db_id\n\t\t\tFROM sqlite_databases AS db, u\n\t\t\tWHERE db.user_id = u.user_id\n\t\t\t\tAND folder = $2\n\t\t\t\tAND db_name = $3\n\t\t)\n\t\tDELETE FROM vis_params WHERE user_id = (SELECT user_id FROM u) AND db_id = (SELECT db_id FROM d) AND name = $4`\n\tcommandTag, err = pdb.Exec(dbQuery, dbOwner, dbFolder, dbName, visName)\n\tif err != nil {\n\t\tlog.Printf(\"Deleting visualisation '%s' for database '%s%s%s' failed: %v\\n\", visName, dbOwner, dbFolder, dbName, err)\n\t\treturn err\n\t}\n\tif numRows := commandTag.RowsAffected(); numRows != 1 {\n\t\tlog.Printf(\"Wrong number of rows (%v) affected while deleting visualisation '%s' for database '%s%s%s'\\n\", numRows, visName, dbOwner, dbFolder, dbName)\n\t}\n\treturn\n}", "func (client *Client) DeleteVodSpecificConfig(request *DeleteVodSpecificConfigRequest) (_result *DeleteVodSpecificConfigResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &DeleteVodSpecificConfigResponse{}\n\t_body, _err := client.DeleteVodSpecificConfigWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func (cl *Client) gceVolumeDelete(ctx context.Context, vda *csp.VolumeDeleteArgs, vid string) error {\n\tcomputeService, err := cl.getComputeService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\top, err := computeService.Disks().Delete(cl.projectID, cl.attrs[AttrZone].Value, vid).Context(ctx).Do()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = cl.waitForOperation(ctx, op)\n\treturn err\n}", "func (o *VolumeDeleteParams) WithForce(force *bool) *VolumeDeleteParams {\n\to.SetForce(force)\n\treturn o\n}", "func DelVinho(c *gin.Context) {\n\tlog.Println(\"Iniciando rota DeleteVinho\")\n\n\tvar Vinho string\n\tVinho = c.Param(\"vinho\")\n\n\t// Realizando atualização da quantidade\n\terr := DeleteVinho(Vinho, adega)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\t// Retorna vinho\n\tlog.Println(\"Vinho apagado\")\n\tc.JSON(200, gin.H{\"message\": \"Vinho apagado com sucesso.\"})\n}", "func (j *Jsonnet) DeleteParam(path []string) error {\n\t// TODO: make this work at the env level too\n\tparamsData, err := j.readParams(\"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tupdatedParams, err := params.DeleteFromObject(path, paramsData, j.Name(false), paramsComponentRoot)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = j.writeParams(updatedParams); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func NewVolumeDeleteParams() *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (c *CmdVolumeDeleteOptions) RunVolumeDelete(cmd *cobra.Command) error {\n\tfmt.Println(\"Executing volume delete...\")\n\n\tresp := mapiserver.DeleteVolume(c.volName)\n\tif resp != nil {\n\t\treturn fmt.Errorf(\"Error: %v\", resp)\n\t}\n\n\tfmt.Printf(\"Volume deletion initiated:%v\\n\", c.volName)\n\n\treturn nil\n}", "func (oo *OmciCC) SendDeleteVtfd(ctx context.Context, timeout int, highPrio bool,\n\trxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) {\n\ttid := oo.GetNextTid(highPrio)\n\tlogger.Debugw(ctx, \"send VTFD-Delete-msg:\", log.Fields{\"device-id\": oo.deviceID,\n\t\t\"SequNo\": strconv.FormatInt(int64(tid), 16),\n\t\t\"InstId\": strconv.FormatInt(int64(aInstID), 16)})\n\n\tmeParams := me.ParamData{EntityID: aInstID}\n\tmeInstance, omciErr := me.NewVlanTaggingFilterData(meParams)\n\tif omciErr.GetError() == nil {\n\t\tomciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType,\n\t\t\toframe.TransactionID(tid))\n\t\tif err != nil {\n\t\t\tlogger.Errorw(ctx, \"Cannot encode VTFD for delete\", log.Fields{\n\t\t\t\t\"Err\": err, \"device-id\": oo.deviceID})\n\t\t\t//TODO!!: refactoring improvement requested, here as an example for [VOL-3457]:\n\t\t\t// return (dual format) error code that can be used at caller for immediate error treatment\n\t\t\t// (relevant to all used sendXX() methods and their error conditions)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tpkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)\n\t\tif err != nil {\n\t\t\tlogger.Errorw(ctx, \"Cannot serialize VTFD delete\", log.Fields{\n\t\t\t\t\"Err\": err, \"device-id\": oo.deviceID})\n\t\t\treturn nil, err\n\t\t}\n\n\t\tomciRxCallbackPair := CallbackPair{\n\t\t\tCbKey: tid,\n\t\t\tCbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true},\n\t\t}\n\t\terr = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair)\n\t\tif err != nil {\n\t\t\tlogger.Errorw(ctx, \"Cannot send VTFD delete\", log.Fields{\n\t\t\t\t\"Err\": err, \"device-id\": oo.deviceID})\n\t\t\treturn nil, err\n\t\t}\n\t\tlogger.Debug(ctx, \"send VTFD-Delete-msg done\")\n\t\treturn meInstance, nil\n\t}\n\tlogger.Errorw(ctx, \"Cannot generate VTFD Instance for delete\", log.Fields{\n\t\t\"Err\": omciErr.GetError(), \"device-id\": oo.deviceID})\n\treturn nil, omciErr.GetError()\n}", "func (s *StackEbrc) DeleteVolume(ref string) error {\n\tlogrus.Debugf(\"ebrc.Client.DeleteVolume(%s) called\", ref)\n\tdefer logrus.Debugf(\"ebrc.Client.DeleteVolume(%s) done\", ref)\n\n\tthed, err := s.findDiskByID(ref)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdeltask, err := thed.Delete()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = deltask.WaitTaskCompletion()\n\treturn err\n}", "func (_BaseLibrary *BaseLibraryTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseLibrary.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "func (cs *controller) DeleteVolume(\n\tctx context.Context,\n\treq *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {\n\n\tlogrus.Infof(\"received request to delete volume {%s}\", req.VolumeId)\n\n\tif req.VolumeId == \"\" {\n\t\treturn nil, status.Error(\n\t\t\tcodes.InvalidArgument,\n\t\t\t\"failed to handle delete volume request: missing volume id\",\n\t\t)\n\t}\n\n\terr := cs.validateRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(\n\t\t\terr,\n\t\t\t\"failed to handle delete volume request for {%s}\",\n\t\t\treq.VolumeId,\n\t\t)\n\t}\n\n\t// this call is made just to fetch pvc namespace\n\tpv, err := utils.FetchPVDetails(req.VolumeId)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(\n\t\t\terr,\n\t\t\t\"failed to handle delete volume request for {%s}\",\n\t\t\treq.VolumeId,\n\t\t)\n\t}\n\n\tpvcNamespace := pv.Spec.ClaimRef.Namespace\n\n\t// send delete request to maya apiserver\n\terr = utils.DeleteVolume(req.VolumeId, pvcNamespace)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(\n\t\t\terr,\n\t\t\t\"failed to handle delete volume request for {%s}\",\n\t\t\treq.VolumeId,\n\t\t)\n\t}\n\n\t// TODO\n\t// Use a lock to remove\n\t//\n\t// remove entry from the in-memory\n\t// maintained list\n\tdelete(utils.Volumes, req.VolumeId)\n\treturn &csi.DeleteVolumeResponse{}, nil\n}", "func (s *Storage) DeleteVolume(vname string, rSnapshots bool) RestError {\n\tvar err error\n\taddr := fmt.Sprintf(\"api/v3/pools/%s/volumes/%s\", s.pool, vname)\n\n\tdata := DeleteVolume{\n\t\tRecursivelyChildren: false,\n\t\tRecursivelyDependents: false,\n\t\tForceUmount: false,\n\t}\n\tif rSnapshots == true {\n\t\tdata.RecursivelyChildren = true\n\t}\n\n\tstat, body, err := s.rp.Send(\"DELETE\", addr, data, DeleteVolumeRCode)\n\n\ts.l.Tracef(\"Status %d\", stat)\n\ts.l.Tracef(\"Body %s\", body[:len(body)])\n\ts.l.Tracef(\"Err %+v\", err)\n\n\tif stat == DeleteVolumeRCode {\n\t\treturn nil\n\t}\n\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Internal failure during volume %s deletion.\", vname)\n\t\ts.l.Warn(msg)\n\t\treturn GetError(RestRequestMalfunction, msg)\n\t}\n\n\terrData, er := s.getError(body)\n\n\tif er != nil {\n\t\tmsg := fmt.Sprintf(\"Unable to extract err message %+v\", er)\n\t\ts.l.Warn(msg)\n\t\treturn GetError(RestRequestMalfunction, msg)\n\t}\n\n\tif (*errData).Errno == 1 {\n\t\tmsg := fmt.Sprintf(\"Volume %s doesn't exist\", vname)\n\t\ts.l.Warn(msg)\n\t\treturn GetError(RestResourceDNE, \"\")\n\t}\n\n\tif (*errData).Errno == 1000 {\n\n\t\tmsg := fmt.Sprintf(\"Volume %s is busy\", vname)\n\t\ts.l.Warn(msg)\n\t\treturn GetError(RestResourceBusy, msg)\n\t}\n\n\tmsg := fmt.Sprintf(\"Unidentified failure during volume %s deletion.\", vname)\n\ts.l.Warn(msg)\n\treturn GetError(RestFailureUnknown, msg)\n}", "func (d *DefaultDriver) DeleteVolume(volumeID string) error {\n\treturn &errors.ErrNotSupported{\n\t\tType: \"Function\",\n\t\tOperation: \"DeleteVolume()\",\n\t}\n}", "func (o *VvolBindingDeleteParams) SetProtocolEndpointUUID(protocolEndpointUUID string) {\n\to.ProtocolEndpointUUID = protocolEndpointUUID\n}", "func (_Container *ContainerTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _Container.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "func (d *DefaultDriver) ValidateDeleteVolume(vol *Volume) error {\n\treturn &errors.ErrNotSupported{\n\t\tType: \"Function\",\n\t\tOperation: \"ValidateDeleteVolume()\",\n\t}\n}", "func (cl *Client) gceVolumeTagsDelete(ctx context.Context, vta *csp.VolumeTagArgs, vid string) (*csp.Volume, error) {\n\tif _, err := cl.getComputeService(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\tlabelsToDelete := gceLabelsFromModel(vta.Tags)\n\treturn cl.intSetLabels(ctx, vid, labelsToDelete, true)\n}", "func (_BaseAccessWallet *BaseAccessWalletTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseAccessWallet.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "func (client IdentityClient) deleteTag(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodDelete, \"/tagNamespaces/{tagNamespaceId}/tags/{tagName}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response DeleteTagResponse\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}", "func (driver *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {\n\t//klog.V(4).Infof(\"DeleteVolume: called with args: %#v\", req)\n\n\tvolID := req.GetVolumeId()\n\tif len(volID) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Volume ID not provided\")\n\t}\n\n\tklog.V(4).Infof(\"DeleteVolume: volumeId (%#v)\", volID)\n\n\tirodsVolume := PopIRODSVolume(volID)\n\tif irodsVolume == nil {\n\t\t// orphant\n\t\tklog.V(4).Infof(\"DeleteVolume: cannot find a volume with id (%v)\", volID)\n\t\t// ignore this error\n\t\treturn &csi.DeleteVolumeResponse{}, nil\n\t}\n\n\tif !irodsVolume.RetainData {\n\t\tklog.V(5).Infof(\"Deleting a volume dir %s\", irodsVolume.Path)\n\t\terr := IRODSRmdir(irodsVolume.ConnectionInfo, irodsVolume.Path)\n\t\tif err != nil {\n\t\t\treturn nil, status.Errorf(codes.Internal, \"Could not delete a volume dir %s : %v\", irodsVolume.Path, err)\n\t\t}\n\t}\n\n\treturn &csi.DeleteVolumeResponse{}, nil\n}", "func (client *Client) DeleteVideoWithOptions(request *DeleteVideoRequest, runtime *util.RuntimeOptions) (_result *DeleteVideoResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.VideoIds)) {\n\t\tquery[\"VideoIds\"] = request.VideoIds\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"DeleteVideo\"),\n\t\tVersion: tea.String(\"2017-03-21\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &DeleteVideoResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func (c *Dg) DeleteDeviceVsys(g interface{}, d string, vsys []string) error {\n var name string\n\n switch v := g.(type) {\n case string:\n name = v\n case Entry:\n name = v.Name\n default:\n return fmt.Errorf(\"Unknown type sent to remove devices: %s\", v)\n }\n\n c.con.LogAction(\"(delete) device vsys from device group: %s\", name)\n\n path := make([]string, 0, 9)\n path = append(path, c.xpath([]string{name})...)\n path = append(path, \"devices\", util.AsEntryXpath([]string{d}))\n if len(vsys) > 0 {\n path = append(path, \"vsys\", util.AsEntryXpath(vsys))\n }\n\n _, err := c.con.Delete(path, nil, nil)\n return err\n}", "func deleteVxlanIntf(inParams *XfmrParams, ifName *string) error {\n var err error\n subOpMap := make(map[db.DBNum]map[string]map[string]db.Value)\n resMap := make(map[string]map[string]db.Value)\n\n _, err = inParams.d.GetEntry(&db.TableSpec{Name:\"VXLAN_TUNNEL\"}, db.Key{Comp: []string{*ifName}})\n if err != nil {\n \treturn tlerr.NotFound(\"Resource Not Found\")\n }\n \n _, err = inParams.d.GetEntry(&db.TableSpec{Name:\"EVPN_NVO\"}, db.Key{Comp: []string{\"nvo1\"}})\n if err == nil {\n\t evpnNvoMap := make(map[string]db.Value)\n\t evpnDbV := db.Value{Field:map[string]string{}}\n\t evpnDbV.Field[\"source_vtep\"] = *ifName\n\t evpnNvoMap[\"nvo1\"] = evpnDbV\n\t resMap[\"EVPN_NVO\"] = evpnNvoMap\n }\n \n vxlanIntfMap := make(map[string]db.Value)\n vxlanIntfMap[*ifName] = db.Value{Field:map[string]string{}}\n resMap[\"VXLAN_TUNNEL\"] = vxlanIntfMap\n \n subOpMap[db.ConfigDB] = resMap\n inParams.subOpDataMap[DELETE] = &subOpMap\n return nil\n}", "func NewVolumeDeleteParamsWithHTTPClient(client *http.Client) *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\t\tHTTPClient: client,\n\t}\n}", "func DeleteVolume(req systemsproto.VolumeRequest) (*systemsproto.SystemsResponse, error) {\n\tconn, err := services.ODIMService.Client(services.Systems)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to create client connection: %v\", err)\n\t}\n\tdefer conn.Close()\n\tasService := systemsproto.NewSystemsClient(conn)\n\tresp, err := asService.DeleteVolume(context.TODO(), &req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error: RPC error: %v\", err)\n\t}\n\treturn resp, nil\n}", "func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {\n\tif len(req.GetVolumeId()) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Volume ID missing in request\")\n\t}\n\n\tif err := d.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid delete volume req: %v\", req)\n\t}\n\n\tvolumeID := req.VolumeId\n\tresourceGroupName, accountName, containerName, err := getContainerInfo(volumeID)\n\tif err != nil {\n\t\tklog.Errorf(\"getContainerInfo(%s) in DeleteVolume failed with error: %v\", volumeID, err)\n\t\treturn &csi.DeleteVolumeResponse{}, nil\n\t}\n\n\tif resourceGroupName == \"\" {\n\t\tresourceGroupName = d.cloud.ResourceGroup\n\t}\n\n\taccountKey, err := d.cloud.GetStorageAccesskey(accountName, resourceGroupName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"no key for storage account(%s) under resource group(%s), err %v\", accountName, resourceGroupName, err)\n\t}\n\n\tklog.V(2).Infof(\"deleting container(%s) rg(%s) account(%s) volumeID(%s)\", containerName, resourceGroupName, accountName, volumeID)\n\tclient, err := azstorage.NewBasicClientOnSovereignCloud(accountName, accountKey, d.cloud.Environment)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tblobClient := client.GetBlobService()\n\tcontainer := blobClient.GetContainerReference(containerName)\n\t// todo: check what value to add into DeleteContainerOptions\n\terr = wait.ExponentialBackoff(d.cloud.RequestBackoff(), func() (bool, error) {\n\t\t_, err := container.DeleteIfExists(nil)\n\t\tif err != nil && !strings.Contains(err.Error(), \"ContainerBeingDeleted\") {\n\t\t\treturn false, fmt.Errorf(\"failed to delete container(%s) on account(%s), error: %v\", containerName, accountName, err)\n\t\t}\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tklog.V(2).Infof(\"container(%s) under rg(%s) account(%s) volumeID(%s) is deleted successfully\", containerName, resourceGroupName, accountName, volumeID)\n\n\treturn &csi.DeleteVolumeResponse{}, nil\n}", "func (c *WebAuthn) RemoveVirtualAuthenticatorWithParams(v *WebAuthnRemoveVirtualAuthenticatorParams) (*gcdmessage.ChromeResponse, error) {\n\treturn gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: \"WebAuthn.removeVirtualAuthenticator\", Params: v})\n}", "func (p *Processor) DeleteTag(account keppel.Account, repo keppel.Repository, tagName string, actx keppel.AuditContext) error {\n\tdigestStr, err := p.db.SelectStr(\n\t\t`DELETE FROM tags WHERE repo_id = $1 AND name = $2 RETURNING digest`,\n\t\trepo.ID, tagName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif digestStr == \"\" {\n\t\treturn sql.ErrNoRows\n\t}\n\n\ttagDigest, err := digest.Parse(digestStr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif userInfo := actx.UserIdentity.UserInfo(); userInfo != nil {\n\t\tp.auditor.Record(audittools.EventParameters{\n\t\t\tTime: p.timeNow(),\n\t\t\tRequest: actx.Request,\n\t\t\tUser: userInfo,\n\t\t\tReasonCode: http.StatusOK,\n\t\t\tAction: cadf.DeleteAction,\n\t\t\tTarget: auditTag{\n\t\t\t\tAccount: account,\n\t\t\t\tRepository: repo,\n\t\t\t\tDigest: tagDigest,\n\t\t\t\tTagName: tagName,\n\t\t\t},\n\t\t})\n\t}\n\n\treturn nil\n}", "func (client *Client) DeleteVolume(name string) (*Response, *ResponseStatus, error) {\n\treturn client.FormattedRequest(\"/delete/volumes/\\\"%s\\\"\", name)\n}", "func (_Editable *EditableTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _Editable.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "func DeleteVault(c *gin.Context) {\n\tdbmap := c.MustGet(\"DBmap\").(*gorp.DbMap)\n\tid := c.Params.ByName(\"id\")\n\n\tvar vault Vault\n\terr := dbmap.SelectOne(&vault, \"SELECT * FROM vault WHERE id=?\", id)\n\n\tif err == nil {\n\t\t_, err = dbmap.Delete(&vault)\n\n\t\tif err == nil {\n\t\t\tc.JSON(200, gin.H{\"id #\" + id: \"deleted\"})\n\t\t} else {\n\t\t\tcheckErr(err, \"Delete failed\")\n\t\t}\n\n\t} else {\n\t\tc.JSON(404, gin.H{\"error\": \"vault not found\"})\n\t}\n\n\t// curl -i -X DELETE http://localhost:8080/api/v1/vaults/1\n}", "func (o *DeleteSubnetParams) WithIfMatch(ifMatch *string) *DeleteSubnetParams {\n\to.SetIfMatch(ifMatch)\n\treturn o\n}", "func Remove(ctx context.Context, nameOrID string, force *bool) error {\n\tconn, err := bindings.GetClient(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tparams := url.Values{}\n\tif force != nil {\n\t\tparams.Set(\"force\", strconv.FormatBool(*force))\n\t}\n\tresponse, err := conn.DoRequest(nil, http.MethodPost, \"/volumes/%s/prune\", params, nameOrID)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn response.Process(nil)\n}", "func addIDToDeleteRequest(r *resource,\n\tinput *svcsdk.DeleteVpcEndpointsInput) error {\n\tif r.ko.Status.VPCEndpointID == nil {\n\t\treturn errors.New(\"unable to extract VPCEndpointID from resource\")\n\t}\n\tinput.VpcEndpointIds = []*string{r.ko.Status.VPCEndpointID}\n\treturn nil\n}", "func DeleteVolume(volumeID string) (err error) {\n\terr = volbuilder.NewKubeclient().WithNamespace(OpenEBSNamespace).Delete(volumeID)\n\tif err == nil {\n\t\tklog.Infof(\"deprovisioned volume %s\", volumeID)\n\t}\n\n\treturn\n}", "func (u *apiUtil) DeletePV(pvName string) error {\n\tstartTime := time.Now()\n\tmetrics.APIServerRequestsTotal.WithLabelValues(metrics.APIServerRequestDelete).Inc()\n\terr := u.client.CoreV1().PersistentVolumes().Delete(context.TODO(), pvName, metav1.DeleteOptions{})\n\tmetrics.APIServerRequestsDurationSeconds.WithLabelValues(metrics.APIServerRequestDelete).Observe(time.Since(startTime).Seconds())\n\tif err != nil {\n\t\tmetrics.APIServerRequestsFailedTotal.WithLabelValues(metrics.APIServerRequestDelete).Inc()\n\t}\n\treturn err\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) WithVersion(version *int32) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\to.SetVersion(version)\n\treturn o\n}", "func (client *KeyVaultClient) deleteSecretCreateRequest(ctx context.Context, vaultBaseURL string, secretName string, options *KeyVaultClientDeleteSecretOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/secrets/{secret-name}\"\n\tif secretName == \"\" {\n\t\treturn nil, errors.New(\"parameter secretName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{secret-name}\", url.PathEscape(secretName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (es *Endpoints) DelByUUID(uuid string) {\n\tes.Lock()\n\tdefer es.Unlock()\n\tif i, ok := es.mapUUID[uuid]; ok {\n\t\tdelete(es.mapUUID, uuid)\n\n\t\tswitch {\n\t\tcase i == 0:\n\t\t\tif len(es.endpoints) == 1 {\n\t\t\t\tes.endpoints = make([]*Endpoint, 0)\n\t\t\t} else {\n\t\t\t\tes.endpoints = es.endpoints[i+1:]\n\t\t\t}\n\t\tcase i == len(es.endpoints)-1:\n\t\t\tes.endpoints = es.endpoints[:i]\n\t\tdefault:\n\t\t\tes.endpoints = append(es.endpoints[:i], es.endpoints[i+1:]...)\n\t\t}\n\t}\n}", "func DeleteVolume(ip, name string) (string, error) {\n\tlog.Printf(\"Destroying volume [%s]\\n\", name)\n\tvar out string\n\tvar err error\n\n\tfor attempt := 0; attempt < maxRemoveVolAttempt; attempt++ {\n\t\tout, err = ssh.InvokeCommand(ip, dockercli.RemoveVolume+name)\n\t\tif err != nil && strings.Contains(out, pluginInitError) {\n\t\t\tmisc.SleepForSec(waitTime)\n\t\t\tlog.Printf(\"Volume cannot be deleted yet as plugin initialization still in progress. Retrying...\")\n\t\t\tcontinue\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn out, err\n}", "func removeDeleteme(){\n lvm_count := exec.Command(\"/bin/bash\", \"-c\", \"lvs | grep deleteme | wc -l\")\n if lvm_count > 1 {\n fmt.Println(\"Multiple deleteme logical volumes detected. Please remove the deleteme volumes manually.\")\n os.Exit(1)\n } else if lvm_count == 0 {\n fmt.Println(\"No deleteme logical volumes detected.\")\n } else {\n exec.Command(\"/bin/bash\", \"-c\", \"umount /delete\")\n exec.Command(\"/bin/bash\", \"-c\", \"rmdir /deleteme\")\n exec.Command(\"/bin/bash\", \"-c\", \"lvchange -an /dev/mapper/$(lvs | grep deleteme | awk ' { print $2 }')-deleteme00\")\n exec.Command(\"/bin/bash\", \"-c\", \"lvremove -f /dev/mapper/$(lvs | grep deleteme | awk ' { print $2 }')-deleteme00\")\n exec.Command(\"/bin/bash\", \"-c\", \"cp /etc/fstab /home/rack/fstab.bak\")\n exec.Command(\"/bin/bash\", \"-c\", \"sed -i '/\\/deleteme/d' /etc/fstab\")\n fmt.Println(\"The deleteme volume has been successfully removed.\")\n }\n}", "func (controller AppsController) RemoveVersion(c *gin.Context) {\n\t//app_id := c.Params.ByName(\"app_id\")\n\t//versionstring := c.Params.ByName(\"versionstring\")\n\n}", "func deleteLokiPv(ctx context.Context, k8sClient client.Client, namespace string, pv *corev1.PersistentVolume, log logr.Logger) error {\n\tlog.Info(\"Loki2vali: Delete Loki PV\", \"lokiNamespace\", namespace)\n\tif err := kubernetesutils.DeleteObject(ctx, k8sClient, pv); err != nil {\n\t\treturn err\n\t}\n\tlog.Info(\"Loki2vali: Successfully deleted the Loki PV\", \"lokiNamespace\", namespace)\n\treturn nil\n}", "func deletePerson(w http.ResponseWriter, r *http.Request) {\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\r\n\tparams := mux.Vars(r)\r\n\tuuid, err := primitive.ObjectIDFromHex(params[\"uuid\"])\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\r\n\tcollection := models.ConnectDB()\r\n\tobjectToDelete, err := collection.DeleteOne(context.TODO(), bson.M{\"_id\": uuid})\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\tjson.NewEncoder(w).Encode(objectToDelete.DeletedCount)\r\n\r\n}", "func (d *Dao) DeleteRepoTag(c context.Context, repoName, tagName string) (err error) {\n\tvar req *http.Request\n\n\thost := d.c.BiliHub.Host + _repositoryURI + \"/%s/tags/%s\"\n\turl := fmt.Sprintf(host, repoName, tagName)\n\n\tif req, err = d.newRequest(http.MethodDelete, url, nil); err != nil {\n\t\treturn\n\t}\n\n\treq.SetBasicAuth(d.c.BiliHub.Username, d.c.BiliHub.Password)\n\n\tif err = d.httpClient.Do(c, req, nil); err != nil {\n\t\tlog.Error(\"d.DeleteRepoTag url(%s) err(%v)\", url, err)\n\t\terr = ecode.MerlinHubRequestErr\n\t}\n\n\treturn\n}", "func (cl *Client) VolumeTagsDelete(ctx context.Context, vta *csp.VolumeTagArgs) (*csp.Volume, error) {\n\tif len(vta.Tags) == 0 {\n\t\treturn nil, fmt.Errorf(\"no tags specified\")\n\t}\n\tsvc, vid, _ := VolumeIdentifierParse(vta.VolumeIdentifier)\n\tswitch svc {\n\tcase ServiceGCE:\n\t\treturn cl.gceVolumeTagsDelete(ctx, vta, vid)\n\t}\n\treturn nil, fmt.Errorf(\"invalid volume identifier\")\n}", "func (t *Tags) Delete(tag string, resourceType string, resourceId string) error {\n\tpath := fmt.Sprintf(\"%s%s/\", t.getKvResourceTagsPath(resourceType, resourceId), tag)\n\n\t_, err := t.client.KV().DeleteTree(path, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *MockBlockStorageClient) DeleteVolume(ctx context.Context, id string) error {\n\treturn nil\n}", "func (c *MockBlockStorageClient) DeleteVolume(ctx context.Context, id string) error {\n\treturn nil\n}", "func (srv *VolumeService) Delete(ref string) error {\n\tvol, err := srv.Get(ref)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Volume '%s' does not exists\", ref)\n\t}\n\treturn srv.provider.DeleteVolume(vol.ID)\n}", "func (iface *Interface) DeleteVrrpVirtualAddress(subifname string, vrid uint8, addr net.IP) {\n\tiface.lock.Lock()\n\tdefer iface.lock.Unlock()\n\n\tsubiface, ret := iface.Subinterfaces[subifname]\n\tif ret {\n\t\tsubiface.DeleteVrrpVirtualAddress(vrid, addr)\n\t}\n}", "func DeleteVehicle(ctx context.Context, client *mongo.Client, reg string) (*mongo.DeleteResult, error) {\n\tcol := client.Database(\"parkai\").Collection(\"vehicles\")\n\tfilter := bson.M{\"registration\": reg}\n\n\treturn col.DeleteOne(ctx, filter)\n}", "func deleteVolunteer(c *gin.Context) {\n\temail := c.Params.ByName(\"email\")\n\tvar vol Volunteer\n\tif err := db.Where(\"email = ?\", email).Find(&vol).Error; err != nil {\n\t\tcreateNotFoundResponse(c)\n\t\treturn\n\t}\n\n\t//Checks if data belongs to the user\n\tif !volunteerAuth(c, &vol) {\n\t\treturn\n\t}\n\t//Deletes from database\n\tdb.Delete(&vol)\n\n\t//Deletes from authentification map\n\tdelete(authMap, vol.Email)\n\tc.JSON(200, gin.H{\"Message\": email + \" deleted\"})\n}", "func (client *LicenseStatusClient) Delete(uuid string, options ...session.ApiOptionsParams) error {\n\tif len(options) == 0 {\n\t\treturn client.aviSession.Delete(client.getAPIPath(uuid))\n\t} else {\n\t\treturn client.aviSession.DeleteObject(client.getAPIPath(uuid), options...)\n\t}\n}", "func (s *Stack) DeleteVolume(id string) (err error) {\n\tif s == nil {\n\t\treturn scerr.InvalidInstanceError()\n\t}\n\tif id == \"\" {\n\t\treturn scerr.InvalidParameterError(\"id\", \"cannot be empty string\")\n\t}\n\n\tdefer concurrency.NewTracer(nil, \"(\"+id+\")\", true).WithStopwatch().GoingIn().OnExitTrace()()\n\n\tvar (\n\t\ttimeout = temporal.GetBigDelay()\n\t)\n\n\tretryErr := retry.WhileUnsuccessfulDelay5Seconds(\n\t\tfunc() error {\n\t\t\tr := volumesv2.Delete(s.VolumeClient, id, nil)\n\t\t\terr := r.ExtractErr()\n\t\t\tif err != nil {\n\t\t\t\tswitch err.(type) {\n\t\t\t\tcase gc.ErrDefault400:\n\t\t\t\t\treturn scerr.Errorf(fmt.Sprintf(\"volume not in state 'available'\"), err)\n\t\t\t\tdefault:\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t\ttimeout,\n\t)\n\tif retryErr != nil {\n\t\tif _, ok := retryErr.(retry.ErrTimeout); ok {\n\t\t\treturn retryErr\n\t\t}\n\t\treturn retryErr\n\t}\n\treturn nil\n}", "func NewVolumeDeleteParamsWithTimeout(timeout time.Duration) *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (r *SoftwareVolumeResource) Delete(id string) error {\n\tif err := r.c.ModQuery(\"DELETE\", BasePath+SoftwareVolumeEndpoint+\"/\"+id, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (_BaseContentType *BaseContentTypeTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseContentType.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "func (c *CmdVolumeDeleteOptions) ValidateVolumeDelete(cmd *cobra.Command) error {\n\tif c.volName == \"\" {\n\t\treturn errors.New(\"--volname is missing. Please specify an unique name\")\n\t}\n\treturn nil\n}", "func (o *VolumeDeleteParams) WithTimeout(timeout time.Duration) *VolumeDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *VolumeDeleteParams) WithContext(ctx context.Context) *VolumeDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (op *OnPrem) DeleteVolume(ctx *lepton.Context, name string) error {\n\tquery := map[string]string{\n\t\t\"label\": name,\n\t\t\"id\": name,\n\t}\n\n\tbuildDir := ctx.Config().VolumesDir\n\tvolumes, err := GetVolumes(buildDir, query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(volumes) == 1 {\n\t\tvolumePath := path.Join(volumes[0].Path)\n\t\terr := os.Remove(volumePath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (g *Generator) RemoveConfigVolume(volume string) {\n\tdelete(g.image.Config.Volumes, volume)\n}", "func (client *AlertConfigClient) Delete(uuid string) error {\n\treturn client.aviSession.Delete(client.getAPIPath(uuid))\n}" ]
[ "0.6342966", "0.57557654", "0.56391346", "0.5401194", "0.5321719", "0.5308691", "0.52751863", "0.52710754", "0.5231506", "0.5231353", "0.5230582", "0.5166526", "0.5165278", "0.51168615", "0.5112844", "0.50630164", "0.5059387", "0.5027256", "0.50054806", "0.5002026", "0.49879515", "0.49459344", "0.49028182", "0.48981813", "0.48800045", "0.4866075", "0.48563588", "0.4854246", "0.48478875", "0.48382157", "0.48143637", "0.48078486", "0.48041368", "0.47824925", "0.477085", "0.47667286", "0.47452685", "0.4727903", "0.4717716", "0.47128832", "0.47082072", "0.46889746", "0.46745986", "0.46693483", "0.46676683", "0.46526793", "0.46440834", "0.46425608", "0.46406412", "0.46369886", "0.463677", "0.46357295", "0.46329418", "0.46021968", "0.46009797", "0.45999482", "0.4590022", "0.45832458", "0.45808268", "0.457146", "0.4563621", "0.45437402", "0.45396322", "0.45258516", "0.45256928", "0.45181662", "0.45110893", "0.45021272", "0.4498598", "0.4490919", "0.4490229", "0.4476006", "0.44751593", "0.44697618", "0.44623157", "0.44580463", "0.44531626", "0.4448117", "0.44438422", "0.4443529", "0.44411027", "0.44379652", "0.44308466", "0.44230515", "0.44230515", "0.44219127", "0.44205725", "0.44204798", "0.44195694", "0.44078928", "0.43990275", "0.4393404", "0.43902975", "0.43827036", "0.43818557", "0.43817735", "0.4377765", "0.43774962", "0.4372293", "0.43632212" ]
0.70726687
0
SetVvolUUID adds the vvolUuid to the vvol binding delete params
func (o *VvolBindingDeleteParams) SetVvolUUID(vvolUUID string) { o.VvolUUID = vvolUUID }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) WithVvolUUID(vvolUUID string) *VvolBindingDeleteParams {\n\to.SetVvolUUID(vvolUUID)\n\treturn o\n}", "func DeleteVol(uuid string) int32 {\n\n\t_, conn, err := utils.DialVolMgr(VolMgrHosts)\n\tif err != nil {\n\t\tlogger.Error(\"DeleteVol failed,Dial to VolMgrHosts fail :%v\", err)\n\t\treturn -1\n\t}\n\tdefer conn.Close()\n\tvc := vp.NewVolMgrClient(conn)\n\n\tpDeleteVolReq := &vp.DeleteVolReq{\n\t\tUUID: uuid,\n\t}\n\tctx, _ := context.WithTimeout(context.Background(), VOLUME_TIMEOUT_SECONDS*time.Second)\n\tpDeleteVolAck, err := vc.DeleteVol(ctx, pDeleteVolReq)\n\tif err != nil {\n\t\treturn -1\n\t}\n\n\tif pDeleteVolAck.Ret != 0 {\n\t\tlogger.Error(\"DeleteVol failed :%v\", pDeleteVolAck.Ret)\n\t\treturn -1\n\t}\n\n\treturn 0\n}", "func (o *VvolBindingDeleteParams) WithProtocolEndpointUUID(protocolEndpointUUID string) *VvolBindingDeleteParams {\n\to.SetProtocolEndpointUUID(protocolEndpointUUID)\n\treturn o\n}", "func deleteVolume(vol string) {\n\tclient.RemoveVolume(vol)\n}", "func (e *ExternalInterface) DeleteVolume(ctx context.Context, req *systemsproto.VolumeRequest, pc *PluginContact, taskID string) {\n\tvar resp response.RPC\n\tvar targetURI = \"/redfish/v1/Systems/\" + req.SystemID + \"/Storage/\" + req.StorageInstance + \"/Volumes\" + req.VolumeID\n\n\ttaskInfo := &common.TaskUpdateInfo{Context: ctx, TaskID: taskID, TargetURI: targetURI,\n\t\tUpdateTask: pc.UpdateTask, TaskRequest: string(req.RequestBody)}\n\tvar volume smodel.Volume\n\terr := JSONUnmarshalFunc(req.RequestBody, &volume)\n\tif err != nil {\n\t\terrorMessage := \"Error while unmarshaling the create volume request: \" + err.Error()\n\t\tl.LogWithFields(ctx).Error(errorMessage)\n\t\tcommon.GeneralError(http.StatusBadRequest, response.MalformedJSON, errorMessage, []interface{}{}, taskInfo)\n\t\treturn\n\t}\n\n\t// spliting the uuid and system id\n\trequestData := strings.SplitN(req.SystemID, \".\", 2)\n\tif len(requestData) != 2 || requestData[1] == \"\" {\n\t\terrorMessage := \"error: SystemUUID not found\"\n\t\tcommon.GeneralError(http.StatusNotFound, response.ResourceNotFound, errorMessage, []interface{}{\"System\", req.SystemID}, taskInfo)\n\t\treturn\n\t}\n\tuuid := requestData[0]\n\ttarget, gerr := e.DB.GetTarget(uuid)\n\tif gerr != nil {\n\t\tcommon.GeneralError(http.StatusNotFound, response.ResourceNotFound, gerr.Error(), []interface{}{\"System\", uuid}, taskInfo)\n\t\treturn\n\t}\n\t// Validating the storage instance\n\tif StringTrimSpace(req.VolumeID) == \"\" {\n\t\terrorMessage := \"error: Volume id is not found\"\n\t\tcommon.GeneralError(http.StatusBadRequest, response.ResourceNotFound, errorMessage, []interface{}{\"Volume\", req.VolumeID}, taskInfo)\n\t\treturn\n\t}\n\n\t// Validating the request JSON properties for case sensitive\n\tinvalidProperties, err := RequestParamsCaseValidatorFunc(req.RequestBody, volume)\n\tif err != nil {\n\t\terrMsg := \"error while validating request parameters for volume creation: \" + err.Error()\n\t\tl.LogWithFields(ctx).Error(errMsg)\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errMsg, nil, taskInfo)\n\t\treturn\n\t} else if invalidProperties != \"\" {\n\t\terrorMessage := \"error: one or more properties given in the request body are not valid, ensure properties are listed in uppercamelcase \"\n\t\tl.LogWithFields(ctx).Error(errorMessage)\n\t\tcommon.GeneralError(http.StatusBadRequest, response.PropertyUnknown, errorMessage, []interface{}{invalidProperties}, taskInfo)\n\t\treturn\n\t}\n\n\tkey := fmt.Sprintf(\"/redfish/v1/Systems/%s/Storage/%s/Volumes/%s\", req.SystemID, req.StorageInstance, req.VolumeID)\n\t_, dbErr := e.DB.GetResource(ctx, \"Volumes\", key)\n\tif dbErr != nil {\n\t\tl.LogWithFields(ctx).Error(\"error getting volumes details : \" + dbErr.Error())\n\t\terrorMessage := dbErr.Error()\n\t\tif errors.DBKeyNotFound == dbErr.ErrNo() {\n\t\t\tvar getDeviceInfoRequest = scommon.ResourceInfoRequest{\n\t\t\t\tURL: key,\n\t\t\t\tUUID: uuid,\n\t\t\t\tSystemID: requestData[1],\n\t\t\t\tContactClient: e.ContactClient,\n\t\t\t\tDevicePassword: e.DevicePassword,\n\t\t\t\tGetPluginStatus: e.GetPluginStatus,\n\t\t\t}\n\t\t\tvar err error\n\t\t\tif _, err = scommon.GetResourceInfoFromDevice(ctx, getDeviceInfoRequest, true); err != nil {\n\t\t\t\tcommon.GeneralError(http.StatusNotFound, response.ResourceNotFound, errorMessage, []interface{}{\"Volumes\", key}, taskInfo)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t} else {\n\t\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errorMessage, nil, taskInfo)\n\t\t\treturn\n\t\t}\n\t}\n\n\tdecryptedPasswordByte, err := e.DevicePassword(target.Password)\n\tif err != nil {\n\t\terrorMessage := \"error while trying to decrypt device password: \" + err.Error()\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errorMessage, nil, taskInfo)\n\t\treturn\n\t}\n\ttarget.Password = decryptedPasswordByte\n\t// Get the Plugin info\n\tplugin, gerr := e.DB.GetPluginData(target.PluginID)\n\tif gerr != nil {\n\t\terrorMessage := \"error while trying to get plugin details\"\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errorMessage, nil, taskInfo)\n\t\treturn\n\t}\n\n\tvar contactRequest scommon.PluginContactRequest\n\tcontactRequest.ContactClient = e.ContactClient\n\tcontactRequest.Plugin = plugin\n\tcontactRequest.GetPluginStatus = e.GetPluginStatus\n\tif StringsEqualFold(plugin.PreferredAuthType, \"XAuthToken\") {\n\t\tvar err error\n\t\tcontactRequest.HTTPMethodType = http.MethodPost\n\t\tcontactRequest.DeviceInfo = map[string]interface{}{\n\t\t\t\"UserName\": plugin.Username,\n\t\t\t\"Password\": string(plugin.Password),\n\t\t}\n\t\tcontactRequest.OID = \"/ODIM/v1/Sessions\"\n\t\t_, token, _, getResponse, err := scommon.ContactPlugin(ctx, contactRequest, \"error while creating session with the plugin: \")\n\n\t\tif err != nil {\n\t\t\tcommon.GeneralError(getResponse.StatusCode, getResponse.StatusMessage, err.Error(), nil, taskInfo)\n\t\t\treturn\n\t\t}\n\t\tcontactRequest.Token = token\n\t} else {\n\t\tcontactRequest.BasicAuth = map[string]string{\n\t\t\t\"UserName\": plugin.Username,\n\t\t\t\"Password\": string(plugin.Password),\n\t\t}\n\n\t}\n\n\tif string(req.RequestBody) == \"null\" {\n\t\ttarget.PostBody = []byte{}\n\t} else {\n\t\ttarget.PostBody = req.RequestBody\n\n\t}\n\tcontactRequest.HTTPMethodType = http.MethodDelete\n\tcontactRequest.DeviceInfo = target\n\tcontactRequest.OID = fmt.Sprintf(\"/ODIM/v1/Systems/%s/Storage/%s/Volumes/%s\", requestData[1], req.StorageInstance, req.VolumeID)\n\n\tbody, location, pluginIP, getResponse, err := scommon.ContactPlugin(ctx, contactRequest, \"error while deleting a volume: \")\n\tif err != nil {\n\t\tresp.StatusCode = getResponse.StatusCode\n\t\tjson.Unmarshal(body, &resp.Body)\n\t\terrMsg := \"error while deleting volume: \" + err.Error()\n\t\tl.LogWithFields(ctx).Error(errMsg)\n\t\ttask := fillTaskData(taskID, targetURI, string(req.RequestBody), resp,\n\t\t\tcommon.Completed, common.Warning, 100, http.MethodPost)\n\t\tpc.UpdateTask(ctx, task)\n\t\treturn\n\t}\n\tif getResponse.StatusCode == http.StatusAccepted {\n\t\terr = pc.SavePluginTaskInfo(ctx, pluginIP, plugin.IP, taskID, location)\n\t\tif err != nil {\n\t\t\tl.LogWithFields(ctx).Error(err)\n\t\t}\n\t\treturn\n\t}\n\n\t// handling the status ok response from plugin\n\tif getResponse.StatusCode == http.StatusOK && body != nil {\n\t\tresp.StatusCode = getResponse.StatusCode\n\t\tjson.Unmarshal(body, &resp.Body)\n\t\ttask := fillTaskData(taskID, targetURI, string(req.RequestBody), resp,\n\t\t\tcommon.Completed, common.OK, 100, http.MethodDelete)\n\t\tpc.UpdateTask(ctx, task)\n\t\treturn\n\t}\n\n\t// delete a volume in db\n\tif derr := e.DB.DeleteVolume(ctx, key); derr != nil {\n\t\terrMsg := \"error while trying to delete volume: \" + derr.Error()\n\t\tl.LogWithFields(ctx).Error(errMsg)\n\t\tif errors.DBKeyNotFound == derr.ErrNo() {\n\t\t\tcommon.GeneralError(http.StatusNotFound, response.ResourceNotFound, errMsg, []interface{}{\"Volumes\", key}, taskInfo)\n\t\t\treturn\n\t\t}\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errMsg, nil, taskInfo)\n\t\treturn\n\t}\n\n\t// adding volume collection uri and deleted volume uri to the AddSystemResetInfo\n\t// for avoiding storing or retrieving them from DB before a BMC reset.\n\tcollectionKey := fmt.Sprintf(\"/redfish/v1/Systems/%s/Storage/%s/Volumes\", req.SystemID, req.StorageInstance)\n\te.DB.AddSystemResetInfo(ctx, key, \"On\")\n\te.DB.AddSystemResetInfo(ctx, collectionKey, \"On\")\n\n\tresp.StatusCode = http.StatusNoContent\n\tresp.StatusMessage = response.Success\n\ttask := fillTaskData(taskID, targetURI, string(req.RequestBody), resp,\n\t\tcommon.Completed, common.OK, 100, http.MethodDelete)\n\tpc.UpdateTask(ctx, task)\n}", "func (o *NvmeNamespaceDeleteParams) SetUUID(uuid string) {\n\to.UUID = uuid\n}", "func (o *BucketsCollectionGetParams) SetVolumeUUID(volumeUUID *string) {\n\to.VolumeUUID = volumeUUID\n}", "func (l *Libvirt) StorageVolDelete(Vol StorageVol, Flags StorageVolDeleteFlags) (err error) {\n\tvar buf []byte\n\n\targs := StorageVolDeleteArgs {\n\t\tVol: Vol,\n\t\tFlags: Flags,\n\t}\n\n\tbuf, err = encode(&args)\n\tif err != nil {\n\t\treturn\n\t}\n\n\n\t_, err = l.requestStream(94, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (o *QtreeCollectionGetParams) SetVolumeUUID(volumeUUID *string) {\n\to.VolumeUUID = volumeUUID\n}", "func (s *VcenterClient) SetVcenterUUID(v string) *VcenterClient {\n\ts.VcenterUUID = &v\n\treturn s\n}", "func (o *GetVersioningPolicyParams) SetUUID(uuid string) {\n\to.UUID = uuid\n}", "func (o *FileInfoCreateParams) SetVolumeUUID(volumeUUID string) {\n\to.VolumeUUID = volumeUUID\n}", "func DelVol(fcVolName string) (string, error) {\n\tvar (\n\t\tcmdOut []byte\n\t\terr error\n\t)\n\n\tstrs := strings.SplitAfterN(fcVolName, \"/dev/\", 2)\n\tif len(strs) == 2 && strs[0] == \"/dev/\" {\n\t\tfcVolName = strs[1]\n\t}\n\tlog.Debug(\"fcVolName=\", fcVolName)\n\n\tcmd := \"fcagent\"\n\targs := []string{\n\t\t\"delvol\",\n\t\tfcVolName,\n\t\t\"-donotdelebs\"}\n\n\tlog.Debug(cmd, args)\n\n\tif cmdOut, err = exec.Command(cmd, args...).Output(); err != nil {\n\t\tlog.Debug(err)\n\t}\n\n\treturn string(cmdOut), err\n}", "func (p *FCProvisioner) Delete(volume *v1.PersistentVolume, config map[string]string, nodeList []*v1.Node) (err error) {\n\tdefer func() {\n\t\tif res := recover(); res != nil && err == nil {\n\t\t\terr = errors.New(\"error while deleting volume \" + fmt.Sprint(res))\n\t\t}\n\t}()\n\tprovisioned, err := p.provisioned(volume)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error determining if this provisioner was the one to provision volume %q: %v\", volume.Name, err)\n\t}\n\tif !provisioned {\n\t\tstrerr := fmt.Sprintf(\"this provisioner id %s didn't provision volume %q and so can't delete it; id %s did & can\", createdBy, volume.Name, volume.Annotations[annCreatedBy])\n\t\treturn &controller.IgnoredError{Reason: strerr}\n\t}\n\n\tglog.Info(\"volume deletion request received: \", volume.GetName())\n\n\tif volume.Annotations[\"volumeId\"] == \"\" {\n\t\terr = errors.New(\"volumeid is empty\")\n\t\treturn err\n\t}\n\tvolId, err := strconv.ParseInt(volume.Annotations[\"volumeId\"], 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = p.volDestroy(volId, volume.Annotations[\"volume_name\"], nodeList)\n\tif err != nil {\n\t\tglog.Error(err)\n\t\treturn err\n\n\t}\n\tglog.Info(\"Volume deleted: \", volume.GetName())\n\treturn nil\n}", "func (user *User) SetUUID(uuid string) {\n\tuser.GctlUUID = uuid\n}", "func (o *FileInfoCollectionGetParams) SetVolumeUUID(volumeUUID string) {\n\to.VolumeUUID = volumeUUID\n}", "func (o *GetContainersUUIDVolumesVolumeUUIDParams) SetUUID(uuid string) {\n\to.UUID = uuid\n}", "func cephRBDVolumeDelete(clusterName string, poolName string, volumeName string,\n\tvolumeType string, userName string) error {\n\t_, err := shared.RunCommand(\n\t\t\"rbd\",\n\t\t\"--id\", userName,\n\t\t\"--cluster\", clusterName,\n\t\t\"--pool\", poolName,\n\t\t\"rm\",\n\t\tfmt.Sprintf(\"%s_%s\", volumeType, volumeName))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (o *VvolBindingDeleteParams) SetProtocolEndpointUUID(protocolEndpointUUID string) {\n\to.ProtocolEndpointUUID = protocolEndpointUUID\n}", "func (o *GetContainersUUIDVolumesVolumeUUIDParams) SetVolumeUUID(volumeUUID string) {\n\to.VolumeUUID = volumeUUID\n}", "func DeleteVolume(base, volID string) error {\n\tklog.V(4).Infof(\"starting to delete hostpath volume: %s\", volID)\n\n\tpath := filepath.Join(base, volID)\n\tif err := os.RemoveAll(path); err != nil && !os.IsNotExist(err) {\n\t\treturn err\n\t}\n\tklog.V(4).Infof(\"deleted hostpath volume: %s\", volID)\n\treturn nil\n}", "func (s stack) DeleteVolume(ctx context.Context, ref string) fail.Error {\n\tif valid.IsNil(s) {\n\t\treturn fail.InvalidInstanceError()\n\t}\n\treturn fail.NotImplementedError(\"implement me\")\n}", "func (dev VMVolumeDevice) UUID() string {\n\treturn utils.NewUUID5(blockVolumeNsUUID, dev.HostPath)\n}", "func DeleteVM(c config.Cpi, extInput bosh.MethodArguments) error {\n\tvar cid string\n\tif reflect.TypeOf(extInput[0]) != reflect.TypeOf(cid) {\n\t\treturn errors.New(\"Received unexpected type for vm cid\")\n\t}\n\n\tcid = extInput[0].(string)\n\tnode, err := rackhdapi.GetNodeByVMCID(c, cid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif node.PersistentDisk.IsAttached {\n\t\terr = rackhdapi.MakeDiskRequest(c, node, false)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tworkflowName, err := workflows.PublishDeprovisionNodeWorkflow(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = workflows.RunDeprovisionNodeWorkflow(c, node.ID, workflowName, cid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, tag := range node.Tags {\n\t\tif strings.HasPrefix(tag, DiskCIDTagPrefix) {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\terr = rackhdapi.ReleaseNode(c, node.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (o *BucketsCollectionGetParams) SetUUID(uuid *string) {\n\to.UUID = uuid\n}", "func (client *Client) DeleteTagWithUuidWithOptions(request *DeleteTagWithUuidRequest, runtime *util.RuntimeOptions) (_result *DeleteTagWithUuidResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.TagName)) {\n\t\tquery[\"TagName\"] = request.TagName\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.UuidList)) {\n\t\tquery[\"UuidList\"] = request.UuidList\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"DeleteTagWithUuid\"),\n\t\tVersion: tea.String(\"2018-12-03\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &DeleteTagWithUuidResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func (util *PortworxVolumeUtil) DeleteVolume(d *portworxVolumeDeleter) error {\n\tdriver, err := util.getPortworxDriver(d.plugin.host, false /*localOnly*/)\n\tif err != nil || driver == nil {\n\t\tglog.Errorf(\"Failed to get portworx driver. Err: %v\", err)\n\t\treturn err\n\t}\n\n\terr = driver.Delete(d.volumeID)\n\tif err != nil {\n\t\tglog.Errorf(\"Error deleting Portworx Volume (%v): %v\", d.volName, err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (o *UpdateWidgetParams) SetUUID(uuid strfmt.UUID) {\n\to.UUID = uuid\n}", "func (o *NvmeNamespaceDeleteParams) WithUUID(uuid string) *NvmeNamespaceDeleteParams {\n\to.SetUUID(uuid)\n\treturn o\n}", "func (a AppblueprintApi) AppBlueprintsUuidDelete(uuid string) (*APIResponse, error) {\n\n\tvar httpMethod = \"Delete\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/app_blueprints/{uuid}\"\n\tpath = strings.Replace(path, \"{\"+\"uuid\"+\"}\", fmt.Sprintf(\"%v\", uuid), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication (basicAuth) required\n\n\t// http basic authentication required\n\tif a.Configuration.Username != \"\" || a.Configuration.Password != \"\" {\n\t\theaderParams[\"Authorization\"] = \"Basic \" + a.Configuration.GetBasicAuthEncodedString()\n\t}\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\theaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\n\thttpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tif err != nil {\n\t\treturn NewAPIResponse(httpResponse.RawResponse), err\n\t}\n\n\treturn NewAPIResponse(httpResponse.RawResponse), err\n}", "func (o *PortsetCollectionGetParams) SetUUID(uuid *string) {\n\to.UUID = uuid\n}", "func DeleteVNet(vNetName string, rgroupName string) {\n\ta := wow.New(os.Stdout, spin.Get(spin.Dots), \"Deleting virtual network : \"+vNetName)\n\ta.Start()\n\ttime.Sleep(2 * time.Second)\n\ta.Text(\"This would take a few minutes...\").Spinner(spin.Get(spin.Dots))\n\tcmd := exec.Command(\"az\", \"network\", \"vnet\", \"delete\", \"--name\",\n\t\tvNetName, \"--resource-group\", rgroupName)\n\tvar out bytes.Buffer\n\tvar stderr bytes.Buffer\n\tcmd.Stdout = &out\n\tcmd.Stderr = &stderr\n\terr := cmd.Run()\n\tif err != nil {\n\t\tfmt.Println(fmt.Sprint(err) + \": \" + stderr.String())\n\t\treturn\n\t}\n\ta.PersistWith(spin.Spinner{}, \"....\")\n\tfmt.Println(\"Result: \" + out.String())\n}", "func (o *SecurityCertificateCollectionGetParams) SetUUID(uuid *string) {\n\to.UUID = uuid\n}", "func (o *GetContainersUUIDVolumesVolumeUUIDParams) WithUUID(uuid string) *GetContainersUUIDVolumesVolumeUUIDParams {\n\to.SetUUID(uuid)\n\treturn o\n}", "func BdevLvolDelete(ctx context.Context, client *Client, args BdevLvolDeleteArgs) (bool, error) {\n\tvar response bool\n\terr := client.Invoke(ctx, \"bdev_lvol_delete\", args, &response)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn response, err\n}", "func (o *ApplicationComponentSnapshotCollectionGetParams) SetUUID(uuid *string) {\n\to.UUID = uuid\n}", "func (s *Stack) DeleteVolumeAttachment(serverID, vaID string) error {\n\tif s == nil {\n\t\treturn scerr.InvalidInstanceError()\n\t}\n\tif serverID == \"\" {\n\t\treturn scerr.InvalidParameterError(\"serverID\", \"cannot be empty string\")\n\t}\n\tif vaID == \"\" {\n\t\treturn scerr.InvalidParameterError(\"vaID\", \"cannot be empty string\")\n\t}\n\n\tdefer concurrency.NewTracer(nil, \"('\"+serverID+\"', '\"+vaID+\"')\", true).WithStopwatch().GoingIn().OnExitTrace()()\n\n\tr := volumeattach.Delete(s.ComputeClient, serverID, vaID)\n\terr := r.ExtractErr()\n\tif err != nil {\n\t\treturn scerr.Wrap(err, fmt.Sprintf(\"error deleting volume attachment '%s': %s\", vaID, ProviderErrorToString(err)))\n\t}\n\treturn nil\n}", "func (cl *Client) VolumeDelete(ctx context.Context, vda *csp.VolumeDeleteArgs) error {\n\tsvc, vid, _ := VolumeIdentifierParse(vda.VolumeIdentifier)\n\tswitch svc {\n\tcase ServiceGCE:\n\t\treturn cl.gceVolumeDelete(ctx, vda, vid)\n\t}\n\treturn fmt.Errorf(\"invalid volume identifier\")\n}", "func (o *BucketsCollectionGetParams) SetSvmUUID(svmUUID string) {\n\to.SvmUUID = svmUUID\n}", "func (calendar *OutlookCalendar) SetUUID(id string) {\n\tcalendar.uuid = id\n}", "func (rc *regClient) TagDelete(ctx context.Context, ref types.Ref) error {\n\tvar tempManifest manifest.Manifest\n\tif ref.Tag == \"\" {\n\t\treturn ErrMissingTag\n\t}\n\n\t// attempt to delete the tag directly, available in OCI distribution-spec, and Hub API\n\treq := httpReq{\n\t\thost: ref.Registry,\n\t\tnoMirrors: true,\n\t\tapis: map[string]httpReqAPI{\n\t\t\t\"\": {\n\t\t\t\tmethod: \"DELETE\",\n\t\t\t\trepository: ref.Repository,\n\t\t\t\tpath: \"manifests/\" + ref.Tag,\n\t\t\t\tignoreErr: true, // do not trigger backoffs if this fails\n\t\t\t},\n\t\t\t\"hub\": {\n\t\t\t\tmethod: \"DELETE\",\n\t\t\t\tpath: \"repositories/\" + ref.Repository + \"/tags/\" + ref.Tag + \"/\",\n\t\t\t},\n\t\t},\n\t}\n\n\tresp, err := rc.httpDo(ctx, req)\n\tif resp != nil {\n\t\tdefer resp.Close()\n\t}\n\t// TODO: Hub may return a different status\n\tif err == nil && resp != nil && resp.HTTPResponse().StatusCode == 202 {\n\t\treturn nil\n\t}\n\t// ignore errors, fallback to creating a temporary manifest to replace the tag and deleting that manifest\n\n\t// lookup the current manifest media type\n\tcurManifest, err := rc.ManifestHead(ctx, ref)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// create empty image config with single label\n\t// Note, this should be MediaType specific, but it appears that docker uses OCI for the config\n\tnow := time.Now()\n\tconf := ociv1.Image{\n\t\tCreated: &now,\n\t\tConfig: ociv1.ImageConfig{\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"delete-tag\": ref.Tag,\n\t\t\t\t\"delete-date\": now.String(),\n\t\t\t},\n\t\t},\n\t\tOS: \"linux\",\n\t\tArchitecture: \"amd64\",\n\t\tRootFS: ociv1.RootFS{\n\t\t\tType: \"layers\",\n\t\t\tDiffIDs: []digest.Digest{},\n\t\t},\n\t}\n\tconfB, err := json.Marshal(conf)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdigester := digest.Canonical.Digester()\n\tconfBuf := bytes.NewBuffer(confB)\n\t_, err = confBuf.WriteTo(digester.Hash())\n\tif err != nil {\n\t\treturn err\n\t}\n\tconfDigest := digester.Digest()\n\n\t// create manifest with config, matching the original tag manifest type\n\tswitch curManifest.GetMediaType() {\n\tcase MediaTypeOCI1Manifest, MediaTypeOCI1ManifestList:\n\t\ttempManifest, err = manifest.FromOrig(ociv1.Manifest{\n\t\t\tVersioned: ociv1Specs.Versioned{\n\t\t\t\tSchemaVersion: 1,\n\t\t\t},\n\t\t\tConfig: ociv1.Descriptor{\n\t\t\t\tMediaType: MediaTypeOCI1ImageConfig,\n\t\t\t\tDigest: confDigest,\n\t\t\t\tSize: int64(len(confB)),\n\t\t\t},\n\t\t\tLayers: []ociv1.Descriptor{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault: // default to the docker v2 schema\n\t\ttempManifest, err = manifest.FromOrig(dockerSchema2.Manifest{\n\t\t\tVersioned: dockerManifest.Versioned{\n\t\t\t\tSchemaVersion: 2,\n\t\t\t\tMediaType: MediaTypeDocker2Manifest,\n\t\t\t},\n\t\t\tConfig: dockerDistribution.Descriptor{\n\t\t\t\tMediaType: MediaTypeDocker2ImageConfig,\n\t\t\t\tDigest: confDigest,\n\t\t\t\tSize: int64(len(confB)),\n\t\t\t},\n\t\t\tLayers: []dockerDistribution.Descriptor{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\trc.log.WithFields(logrus.Fields{\n\t\t\"ref\": ref.Reference,\n\t}).Debug(\"Sending dummy manifest to replace tag\")\n\n\t// push config\n\t_, _, err = rc.BlobPut(ctx, ref, confDigest, ioutil.NopCloser(bytes.NewReader(confB)), MediaTypeDocker2ImageConfig, int64(len(confB)))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed sending dummy config to delete %s: %w\", ref.CommonName(), err)\n\t}\n\n\t// push manifest to tag\n\terr = rc.ManifestPut(ctx, ref, tempManifest)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed sending dummy manifest to delete %s: %w\", ref.CommonName(), err)\n\t}\n\n\tref.Digest = tempManifest.GetDigest().String()\n\n\t// delete manifest by digest\n\trc.log.WithFields(logrus.Fields{\n\t\t\"ref\": ref.Reference,\n\t\t\"digest\": ref.Digest,\n\t}).Debug(\"Deleting dummy manifest\")\n\terr = rc.ManifestDelete(ctx, ref)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed deleting dummy manifest for %s: %w\", ref.CommonName(), err)\n\t}\n\n\treturn nil\n}", "func DeleteVolume(req systemsproto.VolumeRequest) (*systemsproto.SystemsResponse, error) {\n\tconn, err := services.ODIMService.Client(services.Systems)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to create client connection: %v\", err)\n\t}\n\tdefer conn.Close()\n\tasService := systemsproto.NewSystemsClient(conn)\n\tresp, err := asService.DeleteVolume(context.TODO(), &req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error: RPC error: %v\", err)\n\t}\n\treturn resp, nil\n}", "func (s *Storage) DeleteVolume(vname string, rSnapshots bool) RestError {\n\tvar err error\n\taddr := fmt.Sprintf(\"api/v3/pools/%s/volumes/%s\", s.pool, vname)\n\n\tdata := DeleteVolume{\n\t\tRecursivelyChildren: false,\n\t\tRecursivelyDependents: false,\n\t\tForceUmount: false,\n\t}\n\tif rSnapshots == true {\n\t\tdata.RecursivelyChildren = true\n\t}\n\n\tstat, body, err := s.rp.Send(\"DELETE\", addr, data, DeleteVolumeRCode)\n\n\ts.l.Tracef(\"Status %d\", stat)\n\ts.l.Tracef(\"Body %s\", body[:len(body)])\n\ts.l.Tracef(\"Err %+v\", err)\n\n\tif stat == DeleteVolumeRCode {\n\t\treturn nil\n\t}\n\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Internal failure during volume %s deletion.\", vname)\n\t\ts.l.Warn(msg)\n\t\treturn GetError(RestRequestMalfunction, msg)\n\t}\n\n\terrData, er := s.getError(body)\n\n\tif er != nil {\n\t\tmsg := fmt.Sprintf(\"Unable to extract err message %+v\", er)\n\t\ts.l.Warn(msg)\n\t\treturn GetError(RestRequestMalfunction, msg)\n\t}\n\n\tif (*errData).Errno == 1 {\n\t\tmsg := fmt.Sprintf(\"Volume %s doesn't exist\", vname)\n\t\ts.l.Warn(msg)\n\t\treturn GetError(RestResourceDNE, \"\")\n\t}\n\n\tif (*errData).Errno == 1000 {\n\n\t\tmsg := fmt.Sprintf(\"Volume %s is busy\", vname)\n\t\ts.l.Warn(msg)\n\t\treturn GetError(RestResourceBusy, msg)\n\t}\n\n\tmsg := fmt.Sprintf(\"Unidentified failure during volume %s deletion.\", vname)\n\ts.l.Warn(msg)\n\treturn GetError(RestFailureUnknown, msg)\n}", "func (c *restClient) DeleteVolume(ctx context.Context, req *netapppb.DeleteVolumeRequest, opts ...gax.CallOption) (*DeleteVolumeOperation, error) {\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.GetName())\n\n\tparams := url.Values{}\n\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\tif req.GetForce() {\n\t\tparams.Add(\"force\", fmt.Sprintf(\"%v\", req.GetForce()))\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\", \"name\", url.QueryEscape(req.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(\"DELETE\", baseUrl.String(), nil)\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 &DeleteVolumeOperation{\n\t\tlro: longrunning.InternalNewOperation(*c.LROClient, resp),\n\t\tpollPath: override,\n\t}, nil\n}", "func (c *Dg) DeleteDeviceVsys(g interface{}, d string, vsys []string) error {\n var name string\n\n switch v := g.(type) {\n case string:\n name = v\n case Entry:\n name = v.Name\n default:\n return fmt.Errorf(\"Unknown type sent to remove devices: %s\", v)\n }\n\n c.con.LogAction(\"(delete) device vsys from device group: %s\", name)\n\n path := make([]string, 0, 9)\n path = append(path, c.xpath([]string{name})...)\n path = append(path, \"devices\", util.AsEntryXpath([]string{d}))\n if len(vsys) > 0 {\n path = append(path, \"vsys\", util.AsEntryXpath(vsys))\n }\n\n _, err := c.con.Delete(path, nil, nil)\n return err\n}", "func (a *Client) DeleteVMSnapshotsUUID(params *DeleteVMSnapshotsUUIDParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteVMSnapshotsUUIDOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteVMSnapshotsUUIDParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"DeleteVMSnapshotsUUID\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/vm_snapshots/{uuid}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteVMSnapshotsUUIDReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*DeleteVMSnapshotsUUIDOK), nil\n\n}", "func (o *GetContainersUUIDVolumesVolumeUUIDParams) WithContext(ctx context.Context) *GetContainersUUIDVolumesVolumeUUIDParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func removeDeleteme(){\n lvm_count := exec.Command(\"/bin/bash\", \"-c\", \"lvs | grep deleteme | wc -l\")\n if lvm_count > 1 {\n fmt.Println(\"Multiple deleteme logical volumes detected. Please remove the deleteme volumes manually.\")\n os.Exit(1)\n } else if lvm_count == 0 {\n fmt.Println(\"No deleteme logical volumes detected.\")\n } else {\n exec.Command(\"/bin/bash\", \"-c\", \"umount /delete\")\n exec.Command(\"/bin/bash\", \"-c\", \"rmdir /deleteme\")\n exec.Command(\"/bin/bash\", \"-c\", \"lvchange -an /dev/mapper/$(lvs | grep deleteme | awk ' { print $2 }')-deleteme00\")\n exec.Command(\"/bin/bash\", \"-c\", \"lvremove -f /dev/mapper/$(lvs | grep deleteme | awk ' { print $2 }')-deleteme00\")\n exec.Command(\"/bin/bash\", \"-c\", \"cp /etc/fstab /home/rack/fstab.bak\")\n exec.Command(\"/bin/bash\", \"-c\", \"sed -i '/\\/deleteme/d' /etc/fstab\")\n fmt.Println(\"The deleteme volume has been successfully removed.\")\n }\n}", "func generateVolumeID(volName string) string {\n\t//uuid := uuid.New()\n\t//return fmt.Sprintf(\"volid-%s\", uuid.String())\n\treturn volName\n}", "func (p *cinderProvisioner) Delete(pv *v1.PersistentVolume) error {\n\tann, ok := pv.Annotations[provisionerIDAnn]\n\tif !ok {\n\t\treturn errors.New(\"identity annotation not found on PV\")\n\t}\n\tif ann != p.identity {\n\t\treturn &controller.IgnoredError{\n\t\t\tReason: \"identity annotation on PV does not match ours\",\n\t\t}\n\t}\n\t// TODO when beta is removed, have to check kube version and pick v1/beta\n\t// accordingly: maybe the controller lib should offer a function for that\n\n\tvolumeID, ok := pv.Annotations[cinderVolumeID]\n\tif !ok {\n\t\treturn errors.New(cinderVolumeID + \" annotation not found on PV\")\n\t}\n\n\tctx := deleteCtx{p, pv}\n\tmapper, err := newVolumeMapperFromPV(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmapper.AuthTeardown(ctx)\n\n\terr = disconnectCinderVolume(p, volumeID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = unreserveCinderVolume(p, volumeID)\n\tif err != nil {\n\t\t// TODO: Create placeholder PV?\n\t\tglog.Errorf(\"Failed to unreserve volume: %v\", err)\n\t\treturn err\n\t}\n\n\terr = deleteCinderVolume(p, volumeID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tglog.V(2).Infof(\"Successfully deleted cinder volume %s\", volumeID)\n\treturn nil\n}", "func (cs *controller) DeleteVolume(\n\tctx context.Context,\n\treq *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {\n\n\tlogrus.Infof(\"received request to delete volume {%s}\", req.VolumeId)\n\n\tif req.VolumeId == \"\" {\n\t\treturn nil, status.Error(\n\t\t\tcodes.InvalidArgument,\n\t\t\t\"failed to handle delete volume request: missing volume id\",\n\t\t)\n\t}\n\n\terr := cs.validateRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(\n\t\t\terr,\n\t\t\t\"failed to handle delete volume request for {%s}\",\n\t\t\treq.VolumeId,\n\t\t)\n\t}\n\n\t// this call is made just to fetch pvc namespace\n\tpv, err := utils.FetchPVDetails(req.VolumeId)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(\n\t\t\terr,\n\t\t\t\"failed to handle delete volume request for {%s}\",\n\t\t\treq.VolumeId,\n\t\t)\n\t}\n\n\tpvcNamespace := pv.Spec.ClaimRef.Namespace\n\n\t// send delete request to maya apiserver\n\terr = utils.DeleteVolume(req.VolumeId, pvcNamespace)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(\n\t\t\terr,\n\t\t\t\"failed to handle delete volume request for {%s}\",\n\t\t\treq.VolumeId,\n\t\t)\n\t}\n\n\t// TODO\n\t// Use a lock to remove\n\t//\n\t// remove entry from the in-memory\n\t// maintained list\n\tdelete(utils.Volumes, req.VolumeId)\n\treturn &csi.DeleteVolumeResponse{}, nil\n}", "func (c *MockVirtualNetworksClient) Delete(ctx context.Context, resourceGroupName, vnetName string) error {\n\t// Ignore resourceGroupName for simplicity.\n\tif _, ok := c.VNets[vnetName]; !ok {\n\t\treturn fmt.Errorf(\"%s does not exist\", vnetName)\n\t}\n\tdelete(c.VNets, vnetName)\n\treturn nil\n}", "func (c *CmdVolumeDeleteOptions) RunVolumeDelete(cmd *cobra.Command) error {\n\tfmt.Println(\"Executing volume delete...\")\n\n\tresp := mapiserver.DeleteVolume(c.volName)\n\tif resp != nil {\n\t\treturn fmt.Errorf(\"Error: %v\", resp)\n\t}\n\n\tfmt.Printf(\"Volume deletion initiated:%v\\n\", c.volName)\n\n\treturn nil\n}", "func (d *InterfaceVrfDescriptor) Delete(key string, emptyVal proto.Message, metadata kvs.Metadata) (err error) {\n\tswIfIndex, vrf, inheritedVrf, ipv4, ipv6, err := d.getParametersFromKey(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !inheritedVrf && vrf > 0 && ipv4 {\n\t\terr = d.ifHandler.SetInterfaceVrf(swIfIndex, uint32(0))\n\t\tif err != nil {\n\t\t\td.log.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\tif !inheritedVrf && vrf > 0 && ipv6 {\n\t\terr = d.ifHandler.SetInterfaceVrfIPv6(swIfIndex, uint32(0))\n\t\tif err != nil {\n\t\t\td.log.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (o IopingSpecVolumeVolumeSourceFlockerOutput) DatasetUUID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceFlocker) *string { return v.DatasetUUID }).(pulumi.StringPtrOutput)\n}", "func (a *Client) GetContainersUUIDVolumesVolumeUUID(params *GetContainersUUIDVolumesVolumeUUIDParams, authInfo runtime.ClientAuthInfoWriter) (*GetContainersUUIDVolumesVolumeUUIDOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetContainersUUIDVolumesVolumeUUIDParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetContainersUUIDVolumesVolumeUUID\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/containers/{uuid}/volumes/{volume_uuid}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetContainersUUIDVolumesVolumeUUIDReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetContainersUUIDVolumesVolumeUUIDOK), nil\n\n}", "func deletePerson(w http.ResponseWriter, r *http.Request) {\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\r\n\tparams := mux.Vars(r)\r\n\tuuid, err := primitive.ObjectIDFromHex(params[\"uuid\"])\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\r\n\tcollection := models.ConnectDB()\r\n\tobjectToDelete, err := collection.DeleteOne(context.TODO(), bson.M{\"_id\": uuid})\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\tjson.NewEncoder(w).Encode(objectToDelete.DeletedCount)\r\n\r\n}", "func (s *StackEbrc) DeleteVolume(ref string) error {\n\tlogrus.Debugf(\"ebrc.Client.DeleteVolume(%s) called\", ref)\n\tdefer logrus.Debugf(\"ebrc.Client.DeleteVolume(%s) done\", ref)\n\n\tthed, err := s.findDiskByID(ref)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdeltask, err := thed.Delete()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = deltask.WaitTaskCompletion()\n\treturn err\n}", "func (u *apiUtil) DeletePV(pvName string) error {\n\tstartTime := time.Now()\n\tmetrics.APIServerRequestsTotal.WithLabelValues(metrics.APIServerRequestDelete).Inc()\n\terr := u.client.CoreV1().PersistentVolumes().Delete(context.TODO(), pvName, metav1.DeleteOptions{})\n\tmetrics.APIServerRequestsDurationSeconds.WithLabelValues(metrics.APIServerRequestDelete).Observe(time.Since(startTime).Seconds())\n\tif err != nil {\n\t\tmetrics.APIServerRequestsFailedTotal.WithLabelValues(metrics.APIServerRequestDelete).Inc()\n\t}\n\treturn err\n}", "func (d *DefaultDriver) DeleteVolume(volumeID string) error {\n\treturn &errors.ErrNotSupported{\n\t\tType: \"Function\",\n\t\tOperation: \"DeleteVolume()\",\n\t}\n}", "func (driver *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {\n\t//klog.V(4).Infof(\"DeleteVolume: called with args: %#v\", req)\n\n\tvolID := req.GetVolumeId()\n\tif len(volID) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Volume ID not provided\")\n\t}\n\n\tklog.V(4).Infof(\"DeleteVolume: volumeId (%#v)\", volID)\n\n\tirodsVolume := PopIRODSVolume(volID)\n\tif irodsVolume == nil {\n\t\t// orphant\n\t\tklog.V(4).Infof(\"DeleteVolume: cannot find a volume with id (%v)\", volID)\n\t\t// ignore this error\n\t\treturn &csi.DeleteVolumeResponse{}, nil\n\t}\n\n\tif !irodsVolume.RetainData {\n\t\tklog.V(5).Infof(\"Deleting a volume dir %s\", irodsVolume.Path)\n\t\terr := IRODSRmdir(irodsVolume.ConnectionInfo, irodsVolume.Path)\n\t\tif err != nil {\n\t\t\treturn nil, status.Errorf(codes.Internal, \"Could not delete a volume dir %s : %v\", irodsVolume.Path, err)\n\t\t}\n\t}\n\n\treturn &csi.DeleteVolumeResponse{}, nil\n}", "func (obj *ObjectBase) SetUuid(uuid string) {\n\tif obj.clientPtr != nil {\n\t\tpanic(fmt.Sprintf(\"Attempt to override uuid for %s\", obj.uuid))\n\t}\n\tobj.uuid = uuid\n}", "func (d *DefaultDriver) RandomizeVolumeName(params string) string {\n\tre := regexp.MustCompile(\"(\" + api.Name + \"=)([0-9A-Za-z_-]+)(,)?\")\n\treturn re.ReplaceAllString(params, \"${1}${2}_\"+uuid.New()+\"${3}\")\n}", "func (o *GetContainersUUIDVolumesVolumeUUIDParams) WithTimeout(timeout time.Duration) *GetContainersUUIDVolumesVolumeUUIDParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewGetContainersUUIDVolumesVolumeUUIDParams() *GetContainersUUIDVolumesVolumeUUIDParams {\n\tvar ()\n\treturn &GetContainersUUIDVolumesVolumeUUIDParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (client *LicenseStatusClient) Delete(uuid string, options ...session.ApiOptionsParams) error {\n\tif len(options) == 0 {\n\t\treturn client.aviSession.Delete(client.getAPIPath(uuid))\n\t} else {\n\t\treturn client.aviSession.DeleteObject(client.getAPIPath(uuid), options...)\n\t}\n}", "func (client *Client) DeleteVodSpecificConfigWithOptions(request *DeleteVodSpecificConfigRequest, runtime *util.RuntimeOptions) (_result *DeleteVodSpecificConfigResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.ConfigId)) {\n\t\tquery[\"ConfigId\"] = request.ConfigId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.DomainName)) {\n\t\tquery[\"DomainName\"] = request.DomainName\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Env)) {\n\t\tquery[\"Env\"] = request.Env\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerId)) {\n\t\tquery[\"OwnerId\"] = request.OwnerId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.SecurityToken)) {\n\t\tquery[\"SecurityToken\"] = request.SecurityToken\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"DeleteVodSpecificConfig\"),\n\t\tVersion: tea.String(\"2017-03-21\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &DeleteVodSpecificConfigResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func (client *Client) DeleteVolume(name string) (*Response, *ResponseStatus, error) {\n\treturn client.FormattedRequest(\"/delete/volumes/\\\"%s\\\"\", name)\n}", "func (o FioSpecVolumeVolumeSourceFlockerOutput) DatasetUUID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceFlocker) *string { return v.DatasetUUID }).(pulumi.StringPtrOutput)\n}", "func (o *GetAiProductRecommendationsByIDParams) SetUUID(uuid *string) {\n\to.UUID = uuid\n}", "func (client *Client) DeleteVodSpecificConfig(request *DeleteVodSpecificConfigRequest) (_result *DeleteVodSpecificConfigResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &DeleteVodSpecificConfigResponse{}\n\t_body, _err := client.DeleteVodSpecificConfigWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func DeleteVolume(volumeID string) (err error) {\n\terr = volbuilder.NewKubeclient().WithNamespace(OpenEBSNamespace).Delete(volumeID)\n\tif err == nil {\n\t\tklog.Infof(\"deprovisioned volume %s\", volumeID)\n\t}\n\n\treturn\n}", "func (client *AlertConfigClient) Delete(uuid string) error {\n\treturn client.aviSession.Delete(client.getAPIPath(uuid))\n}", "func DeleteVolume(ip, name string) (string, error) {\n\tlog.Printf(\"Destroying volume [%s]\\n\", name)\n\tvar out string\n\tvar err error\n\n\tfor attempt := 0; attempt < maxRemoveVolAttempt; attempt++ {\n\t\tout, err = ssh.InvokeCommand(ip, dockercli.RemoveVolume+name)\n\t\tif err != nil && strings.Contains(out, pluginInitError) {\n\t\t\tmisc.SleepForSec(waitTime)\n\t\t\tlog.Printf(\"Volume cannot be deleted yet as plugin initialization still in progress. Retrying...\")\n\t\t\tcontinue\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn out, err\n}", "func (es *Endpoints) DelByUUID(uuid string) {\n\tes.Lock()\n\tdefer es.Unlock()\n\tif i, ok := es.mapUUID[uuid]; ok {\n\t\tdelete(es.mapUUID, uuid)\n\n\t\tswitch {\n\t\tcase i == 0:\n\t\t\tif len(es.endpoints) == 1 {\n\t\t\t\tes.endpoints = make([]*Endpoint, 0)\n\t\t\t} else {\n\t\t\t\tes.endpoints = es.endpoints[i+1:]\n\t\t\t}\n\t\tcase i == len(es.endpoints)-1:\n\t\t\tes.endpoints = es.endpoints[:i]\n\t\tdefault:\n\t\t\tes.endpoints = append(es.endpoints[:i], es.endpoints[i+1:]...)\n\t\t}\n\t}\n}", "func (o *VvolBindingDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DeleteAllReferences != nil {\n\n\t\t// query param delete_all_references\n\t\tvar qrDeleteAllReferences bool\n\n\t\tif o.DeleteAllReferences != nil {\n\t\t\tqrDeleteAllReferences = *o.DeleteAllReferences\n\t\t}\n\t\tqDeleteAllReferences := swag.FormatBool(qrDeleteAllReferences)\n\t\tif qDeleteAllReferences != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"delete_all_references\", qDeleteAllReferences); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param protocol_endpoint.uuid\n\tif err := r.SetPathParam(\"protocol_endpoint.uuid\", o.ProtocolEndpointUUID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vvol.uuid\n\tif err := r.SetPathParam(\"vvol.uuid\", o.VvolUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (j *Jsonnet) DeleteParam(path []string) error {\n\t// TODO: make this work at the env level too\n\tparamsData, err := j.readParams(\"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tupdatedParams, err := params.DeleteFromObject(path, paramsData, j.Name(false), paramsComponentRoot)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = j.writeParams(updatedParams); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (w *Writer) SetUUID(u uuid.UUID) {\n\tcopy(w.blk[uuidStart:uuidEnd], u[:])\n\tcopy(w.blk[uuidCopyStart:uuidCopyEnd], u[:])\n}", "func (a *Client) DeleteContainersUUID(params *DeleteContainersUUIDParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteContainersUUIDOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteContainersUUIDParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"DeleteContainersUUID\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/containers/{uuid}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteContainersUUIDReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*DeleteContainersUUIDOK), nil\n\n}", "func (op *OnPrem) DeleteVolume(ctx *lepton.Context, name string) error {\n\tquery := map[string]string{\n\t\t\"label\": name,\n\t\t\"id\": name,\n\t}\n\n\tbuildDir := ctx.Config().VolumesDir\n\tvolumes, err := GetVolumes(buildDir, query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(volumes) == 1 {\n\t\tvolumePath := path.Join(volumes[0].Path)\n\t\terr := os.Remove(volumePath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o *PostDockerRegistriesUUIDSearchListParams) SetUUID(uuid string) {\n\to.UUID = uuid\n}", "func (_BaseAccessWallet *BaseAccessWalletTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseAccessWallet.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "func (o FioSpecVolumeVolumeSourceFlockerPtrOutput) DatasetUUID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *FioSpecVolumeVolumeSourceFlocker) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DatasetUUID\n\t}).(pulumi.StringPtrOutput)\n}", "func (p *Processor) DeleteTag(account keppel.Account, repo keppel.Repository, tagName string, actx keppel.AuditContext) error {\n\tdigestStr, err := p.db.SelectStr(\n\t\t`DELETE FROM tags WHERE repo_id = $1 AND name = $2 RETURNING digest`,\n\t\trepo.ID, tagName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif digestStr == \"\" {\n\t\treturn sql.ErrNoRows\n\t}\n\n\ttagDigest, err := digest.Parse(digestStr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif userInfo := actx.UserIdentity.UserInfo(); userInfo != nil {\n\t\tp.auditor.Record(audittools.EventParameters{\n\t\t\tTime: p.timeNow(),\n\t\t\tRequest: actx.Request,\n\t\t\tUser: userInfo,\n\t\t\tReasonCode: http.StatusOK,\n\t\t\tAction: cadf.DeleteAction,\n\t\t\tTarget: auditTag{\n\t\t\t\tAccount: account,\n\t\t\t\tRepository: repo,\n\t\t\t\tDigest: tagDigest,\n\t\t\t\tTagName: tagName,\n\t\t\t},\n\t\t})\n\t}\n\n\treturn nil\n}", "func (c *MockBlockStorageClient) DeleteVolume(ctx context.Context, id string) error {\n\treturn nil\n}", "func (c *MockBlockStorageClient) DeleteVolume(ctx context.Context, id string) error {\n\treturn nil\n}", "func (e *EPub) SetUUID(uu string) error {\n\tu, err := uuid.FromString(uu)\n\tif err != nil {\n\t\treturn err\n\t}\n\te.uuid = \"urn:uuid:\" + u.String()\n\tlog.Printf(\"Setting uuid, theoretically %q\", e.uuid)\n\tfor i, m := range e.metadata {\n\t\tif m.kind == \"dc:identifier\" {\n\t\t\tlog.Printf(\"Set id to %q\", e.uuid)\n\t\t\te.metadata[i].value = e.uuid\n\t\t}\n\t}\n\treturn nil\n}", "func (o *PortsetCollectionGetParams) SetSvmUUID(svmUUID *string) {\n\to.SvmUUID = svmUUID\n}", "func SetFakeUUID(fake string) {\n\tfakeUUID = fake\n}", "func (client IdentityClient) deleteTag(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodDelete, \"/tagNamespaces/{tagNamespaceId}/tags/{tagName}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response DeleteTagResponse\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}", "func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {\n\tif len(req.GetVolumeId()) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Volume ID missing in request\")\n\t}\n\n\tif err := d.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid delete volume req: %v\", req)\n\t}\n\n\tvolumeID := req.VolumeId\n\tresourceGroupName, accountName, containerName, err := getContainerInfo(volumeID)\n\tif err != nil {\n\t\tklog.Errorf(\"getContainerInfo(%s) in DeleteVolume failed with error: %v\", volumeID, err)\n\t\treturn &csi.DeleteVolumeResponse{}, nil\n\t}\n\n\tif resourceGroupName == \"\" {\n\t\tresourceGroupName = d.cloud.ResourceGroup\n\t}\n\n\taccountKey, err := d.cloud.GetStorageAccesskey(accountName, resourceGroupName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"no key for storage account(%s) under resource group(%s), err %v\", accountName, resourceGroupName, err)\n\t}\n\n\tklog.V(2).Infof(\"deleting container(%s) rg(%s) account(%s) volumeID(%s)\", containerName, resourceGroupName, accountName, volumeID)\n\tclient, err := azstorage.NewBasicClientOnSovereignCloud(accountName, accountKey, d.cloud.Environment)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tblobClient := client.GetBlobService()\n\tcontainer := blobClient.GetContainerReference(containerName)\n\t// todo: check what value to add into DeleteContainerOptions\n\terr = wait.ExponentialBackoff(d.cloud.RequestBackoff(), func() (bool, error) {\n\t\t_, err := container.DeleteIfExists(nil)\n\t\tif err != nil && !strings.Contains(err.Error(), \"ContainerBeingDeleted\") {\n\t\t\treturn false, fmt.Errorf(\"failed to delete container(%s) on account(%s), error: %v\", containerName, accountName, err)\n\t\t}\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tklog.V(2).Infof(\"container(%s) under rg(%s) account(%s) volumeID(%s) is deleted successfully\", containerName, resourceGroupName, accountName, volumeID)\n\n\treturn &csi.DeleteVolumeResponse{}, nil\n}", "func UUID(v string) predicate.Agent {\n\treturn predicate.Agent(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldUUID), v))\n\t})\n}", "func (oo *OmciCC) SendDeleteVtfd(ctx context.Context, timeout int, highPrio bool,\n\trxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) {\n\ttid := oo.GetNextTid(highPrio)\n\tlogger.Debugw(ctx, \"send VTFD-Delete-msg:\", log.Fields{\"device-id\": oo.deviceID,\n\t\t\"SequNo\": strconv.FormatInt(int64(tid), 16),\n\t\t\"InstId\": strconv.FormatInt(int64(aInstID), 16)})\n\n\tmeParams := me.ParamData{EntityID: aInstID}\n\tmeInstance, omciErr := me.NewVlanTaggingFilterData(meParams)\n\tif omciErr.GetError() == nil {\n\t\tomciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType,\n\t\t\toframe.TransactionID(tid))\n\t\tif err != nil {\n\t\t\tlogger.Errorw(ctx, \"Cannot encode VTFD for delete\", log.Fields{\n\t\t\t\t\"Err\": err, \"device-id\": oo.deviceID})\n\t\t\t//TODO!!: refactoring improvement requested, here as an example for [VOL-3457]:\n\t\t\t// return (dual format) error code that can be used at caller for immediate error treatment\n\t\t\t// (relevant to all used sendXX() methods and their error conditions)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tpkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)\n\t\tif err != nil {\n\t\t\tlogger.Errorw(ctx, \"Cannot serialize VTFD delete\", log.Fields{\n\t\t\t\t\"Err\": err, \"device-id\": oo.deviceID})\n\t\t\treturn nil, err\n\t\t}\n\n\t\tomciRxCallbackPair := CallbackPair{\n\t\t\tCbKey: tid,\n\t\t\tCbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true},\n\t\t}\n\t\terr = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair)\n\t\tif err != nil {\n\t\t\tlogger.Errorw(ctx, \"Cannot send VTFD delete\", log.Fields{\n\t\t\t\t\"Err\": err, \"device-id\": oo.deviceID})\n\t\t\treturn nil, err\n\t\t}\n\t\tlogger.Debug(ctx, \"send VTFD-Delete-msg done\")\n\t\treturn meInstance, nil\n\t}\n\tlogger.Errorw(ctx, \"Cannot generate VTFD Instance for delete\", log.Fields{\n\t\t\"Err\": omciErr.GetError(), \"device-id\": oo.deviceID})\n\treturn nil, omciErr.GetError()\n}", "func (p *PersistentVolume) Delete(name string) error {\n\tvar b bytes.Buffer\n\tpath := strutil.Concat(\"/api/v1/persistentvolumes/\", name)\n\n\tresp, err := p.client.Delete(p.addr).\n\t\tPath(path).\n\t\tDo().\n\t\tBody(&b)\n\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to delete pv, name: %s, (%v)\", name, err)\n\t}\n\tif !resp.IsOK() {\n\t\tif resp.IsNotfound() {\n\t\t\treturn k8serror.ErrNotFound\n\t\t}\n\n\t\treturn errors.Errorf(\"failed to delete pv, name: %s, statuscode: %v, body: %v\",\n\t\t\tname, resp.StatusCode(), b.String())\n\t}\n\treturn nil\n}", "func (o IopingSpecVolumeVolumeSourceFlockerPtrOutput) DatasetUUID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *IopingSpecVolumeVolumeSourceFlocker) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DatasetUUID\n\t}).(pulumi.StringPtrOutput)\n}", "func (upvc *UnsavedPostVideoCreate) SetUUID(s string) *UnsavedPostVideoCreate {\n\tupvc.mutation.SetUUID(s)\n\treturn upvc\n}", "func (d *Dao) DeleteRepoTag(c context.Context, repoName, tagName string) (err error) {\n\tvar req *http.Request\n\n\thost := d.c.BiliHub.Host + _repositoryURI + \"/%s/tags/%s\"\n\turl := fmt.Sprintf(host, repoName, tagName)\n\n\tif req, err = d.newRequest(http.MethodDelete, url, nil); err != nil {\n\t\treturn\n\t}\n\n\treq.SetBasicAuth(d.c.BiliHub.Username, d.c.BiliHub.Password)\n\n\tif err = d.httpClient.Do(c, req, nil); err != nil {\n\t\tlog.Error(\"d.DeleteRepoTag url(%s) err(%v)\", url, err)\n\t\terr = ecode.MerlinHubRequestErr\n\t}\n\n\treturn\n}", "func (o *QtreeCollectionGetParams) SetSvmUUID(svmUUID *string) {\n\to.SvmUUID = svmUUID\n}", "func DeleteVault(c *gin.Context) {\n\tdbmap := c.MustGet(\"DBmap\").(*gorp.DbMap)\n\tid := c.Params.ByName(\"id\")\n\n\tvar vault Vault\n\terr := dbmap.SelectOne(&vault, \"SELECT * FROM vault WHERE id=?\", id)\n\n\tif err == nil {\n\t\t_, err = dbmap.Delete(&vault)\n\n\t\tif err == nil {\n\t\t\tc.JSON(200, gin.H{\"id #\" + id: \"deleted\"})\n\t\t} else {\n\t\t\tcheckErr(err, \"Delete failed\")\n\t\t}\n\n\t} else {\n\t\tc.JSON(404, gin.H{\"error\": \"vault not found\"})\n\t}\n\n\t// curl -i -X DELETE http://localhost:8080/api/v1/vaults/1\n}", "func (s *Systems) DeleteVolume(ctx context.Context, req *systemsproto.VolumeRequest) (*systemsproto.SystemsResponse, error) {\n\tvar resp systemsproto.SystemsResponse\n\tsessionToken := req.SessionToken\n\tauthResp := s.IsAuthorizedRPC(sessionToken, []string{common.PrivilegeConfigureComponents}, []string{})\n\tif authResp.StatusCode != http.StatusOK {\n\t\tlog.Error(\"error while trying to authenticate session\")\n\t\tfillSystemProtoResponse(&resp, authResp)\n\t\treturn &resp, nil\n\t}\n\n\tdata := s.EI.DeleteVolume(req)\n\tfillSystemProtoResponse(&resp, data)\n\treturn &resp, nil\n}" ]
[ "0.6738907", "0.5607763", "0.53754246", "0.5191161", "0.5182265", "0.5169527", "0.5094504", "0.5089154", "0.50468004", "0.50332665", "0.5024225", "0.49893975", "0.4986372", "0.49672964", "0.4869989", "0.48687732", "0.48615307", "0.48320144", "0.47920194", "0.47809136", "0.47408715", "0.47321913", "0.47061163", "0.46920976", "0.4689291", "0.46650076", "0.46585023", "0.46327338", "0.462813", "0.46165472", "0.46143618", "0.46082217", "0.45581496", "0.4554866", "0.45445102", "0.45394814", "0.4535565", "0.45325282", "0.45267585", "0.45230505", "0.4508843", "0.44699398", "0.44681975", "0.4467712", "0.44654074", "0.44593325", "0.44538587", "0.44439238", "0.44421822", "0.4439007", "0.44307268", "0.44284594", "0.442497", "0.4423856", "0.44164398", "0.44124225", "0.44109768", "0.44089714", "0.4395983", "0.43940213", "0.43932435", "0.43922845", "0.43815994", "0.43806714", "0.43794233", "0.43705136", "0.43685287", "0.43563467", "0.43511784", "0.43418878", "0.43404475", "0.43364954", "0.43332985", "0.433188", "0.43308693", "0.43275973", "0.43124834", "0.43106756", "0.43030894", "0.42766714", "0.4269725", "0.42693302", "0.4266628", "0.4263774", "0.42630836", "0.42630836", "0.4259835", "0.4259233", "0.42549476", "0.42482895", "0.42419317", "0.42404357", "0.42397675", "0.42396793", "0.42395633", "0.4230643", "0.42260394", "0.42256835", "0.42220747", "0.42203623" ]
0.7143403
0
WriteToRequest writes these params to a swagger request
func (o *VvolBindingDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { if err := r.SetTimeout(o.timeout); err != nil { return err } var res []error if o.DeleteAllReferences != nil { // query param delete_all_references var qrDeleteAllReferences bool if o.DeleteAllReferences != nil { qrDeleteAllReferences = *o.DeleteAllReferences } qDeleteAllReferences := swag.FormatBool(qrDeleteAllReferences) if qDeleteAllReferences != "" { if err := r.SetQueryParam("delete_all_references", qDeleteAllReferences); err != nil { return err } } } // path param protocol_endpoint.uuid if err := r.SetPathParam("protocol_endpoint.uuid", o.ProtocolEndpointUUID); err != nil { return err } // path param vvol.uuid if err := r.SetPathParam("vvol.uuid", o.VvolUUID); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *FileInfoCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.ByteOffset != nil {\n\n\t\t// query param byte_offset\n\t\tvar qrByteOffset int64\n\n\t\tif o.ByteOffset != nil {\n\t\t\tqrByteOffset = *o.ByteOffset\n\t\t}\n\t\tqByteOffset := swag.FormatInt64(qrByteOffset)\n\t\tif qByteOffset != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"byte_offset\", qByteOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif o.Info != nil {\n\t\tif err := r.SetBodyParam(o.Info); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Overwrite != nil {\n\n\t\t// query param overwrite\n\t\tvar qrOverwrite bool\n\n\t\tif o.Overwrite != nil {\n\t\t\tqrOverwrite = *o.Overwrite\n\t\t}\n\t\tqOverwrite := swag.FormatBool(qrOverwrite)\n\t\tif qOverwrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"overwrite\", qOverwrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param path\n\tif err := r.SetPathParam(\"path\", o.Path); err != nil {\n\t\treturn err\n\t}\n\n\tif o.ReturnRecords != nil {\n\n\t\t// query param return_records\n\t\tvar qrReturnRecords bool\n\n\t\tif o.ReturnRecords != nil {\n\t\t\tqrReturnRecords = *o.ReturnRecords\n\t\t}\n\t\tqReturnRecords := swag.FormatBool(qrReturnRecords)\n\t\tif qReturnRecords != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"return_records\", qReturnRecords); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StreamName != nil {\n\n\t\t// query param stream_name\n\t\tvar qrStreamName string\n\n\t\tif o.StreamName != nil {\n\t\t\tqrStreamName = *o.StreamName\n\t\t}\n\t\tqStreamName := qrStreamName\n\t\tif qStreamName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"stream_name\", qStreamName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param volume.uuid\n\tif err := r.SetPathParam(\"volume.uuid\", o.VolumeUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Device-Id\n\tif err := r.SetHeaderParam(\"Device-Id\", o.DeviceID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.DeviceOS != nil {\n\n\t\t// header param Device-OS\n\t\tif err := r.SetHeaderParam(\"Device-OS\", *o.DeviceOS); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t// path param fiscalDocumentNumber\n\tif err := r.SetPathParam(\"fiscalDocumentNumber\", swag.FormatUint64(o.FiscalDocumentNumber)); err != nil {\n\t\treturn err\n\t}\n\n\t// path param fiscalDriveNumber\n\tif err := r.SetPathParam(\"fiscalDriveNumber\", swag.FormatUint64(o.FiscalDriveNumber)); err != nil {\n\t\treturn err\n\t}\n\n\t// query param fiscalSign\n\tqrFiscalSign := o.FiscalSign\n\tqFiscalSign := swag.FormatUint64(qrFiscalSign)\n\tif qFiscalSign != \"\" {\n\t\tif err := r.SetQueryParam(\"fiscalSign\", qFiscalSign); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.SendToEmail != nil {\n\n\t\t// query param sendToEmail\n\t\tvar qrSendToEmail string\n\t\tif o.SendToEmail != nil {\n\t\t\tqrSendToEmail = *o.SendToEmail\n\t\t}\n\t\tqSendToEmail := qrSendToEmail\n\t\tif qSendToEmail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sendToEmail\", qSendToEmail); 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}", "func (o *StartV1Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Environment != nil {\n\n\t\t// query param environment\n\t\tvar qrEnvironment string\n\t\tif o.Environment != nil {\n\t\t\tqrEnvironment = *o.Environment\n\t\t}\n\t\tqEnvironment := qrEnvironment\n\t\tif qEnvironment != \"\" {\n\t\t\tif err := r.SetQueryParam(\"environment\", qEnvironment); 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}", "func (o *UpdateAutoTagParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID.String()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PostContextsAddPhpParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param name\n\tqrName := o.Name\n\tqName := qrName\n\tif qName != \"\" {\n\n\t\tif err := r.SetQueryParam(\"name\", qName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Private != nil {\n\n\t\t// query param private\n\t\tvar qrPrivate int64\n\n\t\tif o.Private != nil {\n\t\t\tqrPrivate = *o.Private\n\t\t}\n\t\tqPrivate := swag.FormatInt64(qrPrivate)\n\t\tif qPrivate != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"private\", qPrivate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetIntrospectionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\tif o.ResponseAsJwt != nil {\n\n\t\t// query param response_as_jwt\n\t\tvar qrResponseAsJwt bool\n\t\tif o.ResponseAsJwt != nil {\n\t\t\tqrResponseAsJwt = *o.ResponseAsJwt\n\t\t}\n\t\tqResponseAsJwt := swag.FormatBool(qrResponseAsJwt)\n\t\tif qResponseAsJwt != \"\" {\n\t\t\tif err := r.SetQueryParam(\"response_as_jwt\", qResponseAsJwt); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param token\n\tqrToken := o.Token\n\tqToken := qrToken\n\tif qToken != \"\" {\n\t\tif err := r.SetQueryParam(\"token\", qToken); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.TokenTypeHint != nil {\n\n\t\t// query param token_type_hint\n\t\tvar qrTokenTypeHint string\n\t\tif o.TokenTypeHint != nil {\n\t\t\tqrTokenTypeHint = *o.TokenTypeHint\n\t\t}\n\t\tqTokenTypeHint := qrTokenTypeHint\n\t\tif qTokenTypeHint != \"\" {\n\t\t\tif err := r.SetQueryParam(\"token_type_hint\", qTokenTypeHint); 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}", "func (o *GetInstancesDocsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\tif o.OperationID != nil {\n\n\t\t// query param operationId\n\t\tvar qrOperationID string\n\t\tif o.OperationID != nil {\n\t\t\tqrOperationID = *o.OperationID\n\t\t}\n\t\tqOperationID := qrOperationID\n\t\tif qOperationID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"operationId\", qOperationID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Version != nil {\n\n\t\t// query param version\n\t\tvar qrVersion string\n\t\tif o.Version != nil {\n\t\t\tqrVersion = *o.Version\n\t\t}\n\t\tqVersion := qrVersion\n\t\tif qVersion != \"\" {\n\t\t\tif err := r.SetQueryParam(\"version\", qVersion); 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}", "func (o *CloudTargetCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.CheckOnly != nil {\n\n\t\t// query param check_only\n\t\tvar qrCheckOnly bool\n\n\t\tif o.CheckOnly != nil {\n\t\t\tqrCheckOnly = *o.CheckOnly\n\t\t}\n\t\tqCheckOnly := swag.FormatBool(qrCheckOnly)\n\t\tif qCheckOnly != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"check_only\", qCheckOnly); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.IgnoreWarnings != nil {\n\n\t\t// query param ignore_warnings\n\t\tvar qrIgnoreWarnings bool\n\n\t\tif o.IgnoreWarnings != nil {\n\t\t\tqrIgnoreWarnings = *o.IgnoreWarnings\n\t\t}\n\t\tqIgnoreWarnings := swag.FormatBool(qrIgnoreWarnings)\n\t\tif qIgnoreWarnings != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ignore_warnings\", qIgnoreWarnings); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif o.Info != nil {\n\t\tif err := r.SetBodyParam(o.Info); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.ReturnRecords != nil {\n\n\t\t// query param return_records\n\t\tvar qrReturnRecords bool\n\n\t\tif o.ReturnRecords != nil {\n\t\t\tqrReturnRecords = *o.ReturnRecords\n\t\t}\n\t\tqReturnRecords := swag.FormatBool(qrReturnRecords)\n\t\tif qReturnRecords != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"return_records\", qReturnRecords); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ReturnTimeout != nil {\n\n\t\t// query param return_timeout\n\t\tvar qrReturnTimeout int64\n\n\t\tif o.ReturnTimeout != nil {\n\t\t\tqrReturnTimeout = *o.ReturnTimeout\n\t\t}\n\t\tqReturnTimeout := swag.FormatInt64(qrReturnTimeout)\n\t\tif qReturnTimeout != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"return_timeout\", qReturnTimeout); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SayParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Sinkid != nil {\n\n\t\t// query param sinkid\n\t\tvar qrSinkid string\n\t\tif o.Sinkid != nil {\n\t\t\tqrSinkid = *o.Sinkid\n\t\t}\n\t\tqSinkid := qrSinkid\n\t\tif qSinkid != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sinkid\", qSinkid); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Voiceid != nil {\n\n\t\t// query param voiceid\n\t\tvar qrVoiceid string\n\t\tif o.Voiceid != nil {\n\t\t\tqrVoiceid = *o.Voiceid\n\t\t}\n\t\tqVoiceid := qrVoiceid\n\t\tif qVoiceid != \"\" {\n\t\t\tif err := r.SetQueryParam(\"voiceid\", qVoiceid); 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}", "func (o *HandleGetAboutUsingGETParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// query param apiVersion\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\n\tif err := r.SetQueryParam(\"apiVersion\", qAPIVersion); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetFileSystemParametersInternalParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.AccountID != nil {\n\n\t\t// query param accountId\n\t\tvar qrAccountID string\n\t\tif o.AccountID != nil {\n\t\t\tqrAccountID = *o.AccountID\n\t\t}\n\t\tqAccountID := qrAccountID\n\t\tif qAccountID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"accountId\", qAccountID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.AccountName != nil {\n\n\t\t// query param accountName\n\t\tvar qrAccountName string\n\t\tif o.AccountName != nil {\n\t\t\tqrAccountName = *o.AccountName\n\t\t}\n\t\tqAccountName := qrAccountName\n\t\tif qAccountName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"accountName\", qAccountName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.AttachedCluster != nil {\n\n\t\t// query param attachedCluster\n\t\tvar qrAttachedCluster bool\n\t\tif o.AttachedCluster != nil {\n\t\t\tqrAttachedCluster = *o.AttachedCluster\n\t\t}\n\t\tqAttachedCluster := swag.FormatBool(qrAttachedCluster)\n\t\tif qAttachedCluster != \"\" {\n\t\t\tif err := r.SetQueryParam(\"attachedCluster\", qAttachedCluster); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param blueprintName\n\tqrBlueprintName := o.BlueprintName\n\tqBlueprintName := qrBlueprintName\n\tif qBlueprintName != \"\" {\n\t\tif err := r.SetQueryParam(\"blueprintName\", qBlueprintName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param clusterName\n\tqrClusterName := o.ClusterName\n\tqClusterName := qrClusterName\n\tif qClusterName != \"\" {\n\t\tif err := r.SetQueryParam(\"clusterName\", qClusterName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param fileSystemType\n\tqrFileSystemType := o.FileSystemType\n\tqFileSystemType := qrFileSystemType\n\tif qFileSystemType != \"\" {\n\t\tif err := r.SetQueryParam(\"fileSystemType\", qFileSystemType); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Secure != nil {\n\n\t\t// query param secure\n\t\tvar qrSecure bool\n\t\tif o.Secure != nil {\n\t\t\tqrSecure = *o.Secure\n\t\t}\n\t\tqSecure := swag.FormatBool(qrSecure)\n\t\tif qSecure != \"\" {\n\t\t\tif err := r.SetQueryParam(\"secure\", qSecure); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param storageName\n\tqrStorageName := o.StorageName\n\tqStorageName := qrStorageName\n\tif qStorageName != \"\" {\n\t\tif err := r.SetQueryParam(\"storageName\", qStorageName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param workspaceId\n\tif err := r.SetPathParam(\"workspaceId\", swag.FormatInt64(o.WorkspaceID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ServeBuildFieldShortParams) 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 btLocator\n\tif err := r.SetPathParam(\"btLocator\", o.BtLocator); err != nil {\n\t\treturn err\n\t}\n\n\t// path param buildLocator\n\tif err := r.SetPathParam(\"buildLocator\", o.BuildLocator); err != nil {\n\t\treturn err\n\t}\n\n\t// path param field\n\tif err := r.SetPathParam(\"field\", o.Field); err != nil {\n\t\treturn err\n\t}\n\n\t// path param projectLocator\n\tif err := r.SetPathParam(\"projectLocator\", o.ProjectLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetRequestDetailsParams) 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 extra\n\tif err := r.SetPathParam(\"extra\", o.Extra); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetWorkItemParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DollarExpand != nil {\n\n\t\t// query param $expand\n\t\tvar qrNrDollarExpand string\n\t\tif o.DollarExpand != nil {\n\t\t\tqrNrDollarExpand = *o.DollarExpand\n\t\t}\n\t\tqNrDollarExpand := qrNrDollarExpand\n\t\tif qNrDollarExpand != \"\" {\n\t\t\tif err := r.SetQueryParam(\"$expand\", qNrDollarExpand); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.AsOf != nil {\n\n\t\t// query param asOf\n\t\tvar qrAsOf strfmt.DateTime\n\t\tif o.AsOf != nil {\n\t\t\tqrAsOf = *o.AsOf\n\t\t}\n\t\tqAsOf := qrAsOf.String()\n\t\tif qAsOf != \"\" {\n\t\t\tif err := r.SetQueryParam(\"asOf\", qAsOf); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt32(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param project\n\tif err := r.SetPathParam(\"project\", o.Project); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *IntegrationsManualHTTPSCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif err := r.SetBodyParam(o.Data); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ValidateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PostSecdefSearchParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif err := r.SetBodyParam(o.Symbol); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetLogsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.From != nil {\n\n\t\t// query param from\n\t\tvar qrFrom string\n\t\tif o.From != nil {\n\t\t\tqrFrom = *o.From\n\t\t}\n\t\tqFrom := qrFrom\n\t\tif qFrom != \"\" {\n\t\t\tif err := r.SetQueryParam(\"from\", qFrom); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludeFields != nil {\n\n\t\t// query param include_fields\n\t\tvar qrIncludeFields bool\n\t\tif o.IncludeFields != nil {\n\t\t\tqrIncludeFields = *o.IncludeFields\n\t\t}\n\t\tqIncludeFields := swag.FormatBool(qrIncludeFields)\n\t\tif qIncludeFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"include_fields\", qIncludeFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludeTotals != nil {\n\n\t\t// query param include_totals\n\t\tvar qrIncludeTotals bool\n\t\tif o.IncludeTotals != nil {\n\t\t\tqrIncludeTotals = *o.IncludeTotals\n\t\t}\n\t\tqIncludeTotals := swag.FormatBool(qrIncludeTotals)\n\t\tif qIncludeTotals != \"\" {\n\t\t\tif err := r.SetQueryParam(\"include_totals\", qIncludeTotals); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int64\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt64(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PerPage != nil {\n\n\t\t// query param per_page\n\t\tvar qrPerPage int64\n\t\tif o.PerPage != nil {\n\t\t\tqrPerPage = *o.PerPage\n\t\t}\n\t\tqPerPage := swag.FormatInt64(qrPerPage)\n\t\tif qPerPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"per_page\", qPerPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Q != nil {\n\n\t\t// query param q\n\t\tvar qrQ string\n\t\tif o.Q != nil {\n\t\t\tqrQ = *o.Q\n\t\t}\n\t\tqQ := qrQ\n\t\tif qQ != \"\" {\n\t\t\tif err := r.SetQueryParam(\"q\", qQ); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Sort != nil {\n\n\t\t// query param sort\n\t\tvar qrSort string\n\t\tif o.Sort != nil {\n\t\t\tqrSort = *o.Sort\n\t\t}\n\t\tqSort := qrSort\n\t\tif qSort != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sort\", qSort); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Take != nil {\n\n\t\t// query param take\n\t\tvar qrTake int64\n\t\tif o.Take != nil {\n\t\t\tqrTake = *o.Take\n\t\t}\n\t\tqTake := swag.FormatInt64(qrTake)\n\t\tif qTake != \"\" {\n\t\t\tif err := r.SetQueryParam(\"take\", qTake); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UserShowV1Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\t// path param name\n\tif err := r.SetPathParam(\"name\", o.Name); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PostGetOneParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\tvaluesRelated := o.Related\n\n\tjoinedRelated := swag.JoinByFormat(valuesRelated, \"\")\n\t// query array param related\n\tif err := r.SetQueryParam(\"related\", joinedRelated...); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *BarParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ConfigGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Option != nil {\n\n\t\t// binding items for option\n\t\tjoinedOption := o.bindParamOption(reg)\n\n\t\t// query array param option\n\t\tif err := r.SetQueryParam(\"option\", joinedOption...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.ProjectID != nil {\n\n\t\t// query param project_id\n\t\tvar qrProjectID int64\n\n\t\tif o.ProjectID != nil {\n\t\t\tqrProjectID = *o.ProjectID\n\t\t}\n\t\tqProjectID := swag.FormatInt64(qrProjectID)\n\t\tif qProjectID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"project_id\", qProjectID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.UserID != nil {\n\n\t\t// query param user_id\n\t\tvar qrUserID int64\n\n\t\tif o.UserID != nil {\n\t\t\tqrUserID = *o.UserID\n\t\t}\n\t\tqUserID := swag.FormatInt64(qrUserID)\n\t\tif qUserID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"user_id\", qUserID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *AllLookmlTestsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.FileID != nil {\n\n\t\t// query param file_id\n\t\tvar qrFileID string\n\t\tif o.FileID != nil {\n\t\t\tqrFileID = *o.FileID\n\t\t}\n\t\tqFileID := qrFileID\n\t\tif qFileID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"file_id\", qFileID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param project_id\n\tif err := r.SetPathParam(\"project_id\", o.ProjectID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetSsoParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param code\n\tqrCode := o.Code\n\tqCode := qrCode\n\tif qCode != \"\" {\n\t\tif err := r.SetQueryParam(\"code\", qCode); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param resource_id\n\tqrResourceID := o.ResourceID\n\tqResourceID := qrResourceID\n\tif qResourceID != \"\" {\n\t\tif err := r.SetQueryParam(\"resource_id\", qResourceID); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *APIServiceHaltsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.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}", "func (o *GetUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Connection != nil {\n\n\t\t// query param connection\n\t\tvar qrConnection string\n\t\tif o.Connection != nil {\n\t\t\tqrConnection = *o.Connection\n\t\t}\n\t\tqConnection := qrConnection\n\t\tif qConnection != \"\" {\n\t\t\tif err := r.SetQueryParam(\"connection\", qConnection); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludeFields != nil {\n\n\t\t// query param include_fields\n\t\tvar qrIncludeFields bool\n\t\tif o.IncludeFields != nil {\n\t\t\tqrIncludeFields = *o.IncludeFields\n\t\t}\n\t\tqIncludeFields := swag.FormatBool(qrIncludeFields)\n\t\tif qIncludeFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"include_fields\", qIncludeFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludeTotals != nil {\n\n\t\t// query param include_totals\n\t\tvar qrIncludeTotals bool\n\t\tif o.IncludeTotals != nil {\n\t\t\tqrIncludeTotals = *o.IncludeTotals\n\t\t}\n\t\tqIncludeTotals := swag.FormatBool(qrIncludeTotals)\n\t\tif qIncludeTotals != \"\" {\n\t\t\tif err := r.SetQueryParam(\"include_totals\", qIncludeTotals); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int64\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt64(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PerPage != nil {\n\n\t\t// query param per_page\n\t\tvar qrPerPage int64\n\t\tif o.PerPage != nil {\n\t\t\tqrPerPage = *o.PerPage\n\t\t}\n\t\tqPerPage := swag.FormatInt64(qrPerPage)\n\t\tif qPerPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"per_page\", qPerPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Q != nil {\n\n\t\t// query param q\n\t\tvar qrQ string\n\t\tif o.Q != nil {\n\t\t\tqrQ = *o.Q\n\t\t}\n\t\tqQ := qrQ\n\t\tif qQ != \"\" {\n\t\t\tif err := r.SetQueryParam(\"q\", qQ); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.SearchEngine != nil {\n\n\t\t// query param search_engine\n\t\tvar qrSearchEngine string\n\t\tif o.SearchEngine != nil {\n\t\t\tqrSearchEngine = *o.SearchEngine\n\t\t}\n\t\tqSearchEngine := qrSearchEngine\n\t\tif qSearchEngine != \"\" {\n\t\t\tif err := r.SetQueryParam(\"search_engine\", qSearchEngine); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Sort != nil {\n\n\t\t// query param sort\n\t\tvar qrSort string\n\t\tif o.Sort != nil {\n\t\t\tqrSort = *o.Sort\n\t\t}\n\t\tqSort := qrSort\n\t\tif qSort != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sort\", qSort); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetBlockGeneratorResultParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *CreateRuntimeMapParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.FileUpload != nil {\n\n\t\tif o.FileUpload != nil {\n\n\t\t\t// form file param file_upload\n\t\t\tif err := r.SetFileParam(\"file_upload\", o.FileUpload); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetPlatformsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Extended != nil {\n\n\t\t// query param extended\n\t\tvar qrExtended bool\n\t\tif o.Extended != nil {\n\t\t\tqrExtended = *o.Extended\n\t\t}\n\t\tqExtended := swag.FormatBool(qrExtended)\n\t\tif qExtended != \"\" {\n\t\t\tif err := r.SetQueryParam(\"extended\", qExtended); 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}", "func (o *GetUserUsageParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Cloud != nil {\n\n\t\t// query param cloud\n\t\tvar qrCloud string\n\t\tif o.Cloud != nil {\n\t\t\tqrCloud = *o.Cloud\n\t\t}\n\t\tqCloud := qrCloud\n\t\tif qCloud != \"\" {\n\t\t\tif err := r.SetQueryParam(\"cloud\", qCloud); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Filterenddate != nil {\n\n\t\t// query param filterenddate\n\t\tvar qrFilterenddate int64\n\t\tif o.Filterenddate != nil {\n\t\t\tqrFilterenddate = *o.Filterenddate\n\t\t}\n\t\tqFilterenddate := swag.FormatInt64(qrFilterenddate)\n\t\tif qFilterenddate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filterenddate\", qFilterenddate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Since != nil {\n\n\t\t// query param since\n\t\tvar qrSince int64\n\t\tif o.Since != nil {\n\t\t\tqrSince = *o.Since\n\t\t}\n\t\tqSince := swag.FormatInt64(qrSince)\n\t\tif qSince != \"\" {\n\t\t\tif err := r.SetQueryParam(\"since\", qSince); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Zone != nil {\n\n\t\t// query param zone\n\t\tvar qrZone string\n\t\tif o.Zone != nil {\n\t\t\tqrZone = *o.Zone\n\t\t}\n\t\tqZone := qrZone\n\t\tif qZone != \"\" {\n\t\t\tif err := r.SetQueryParam(\"zone\", qZone); 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}", "func (o *GetOrderParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.MerchantID != nil {\n\n\t\t// query param merchantId\n\t\tvar qrMerchantID int64\n\t\tif o.MerchantID != nil {\n\t\t\tqrMerchantID = *o.MerchantID\n\t\t}\n\t\tqMerchantID := swag.FormatInt64(qrMerchantID)\n\t\tif qMerchantID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"merchantId\", qMerchantID); 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}", "func (o *GetPropertyDescriptorParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\t// query param propertyName\n\tqrPropertyName := o.PropertyName\n\tqPropertyName := qrPropertyName\n\tif qPropertyName != \"\" {\n\n\t\tif err := r.SetQueryParam(\"propertyName\", qPropertyName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *CreateGitWebhookUsingPOSTParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// query param apiVersion\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\n\tif err := r.SetQueryParam(\"apiVersion\", qAPIVersion); err != nil {\n\t\treturn err\n\t}\n\tif err := r.SetBodyParam(o.GitWebhookSpec); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetCurrentGenerationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ViewsGetByIDParams) 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 identifier\n\tif err := r.SetPathParam(\"identifier\", o.Identifier); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdateDeviceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param deviceId\n\tif err := r.SetPathParam(\"deviceId\", o.DeviceID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.UpdateDeviceRequest != nil {\n\t\tif err := r.SetBodyParam(o.UpdateDeviceRequest); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SaveTemplateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param project\n\tif err := r.SetPathParam(\"project\", o.Project); err != nil {\n\t\treturn err\n\t}\n\n\t// path param templateId\n\tif err := r.SetPathParam(\"templateId\", o.TemplateID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ConvertParams) 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 from.currency_code\n\tif err := r.SetPathParam(\"from.currency_code\", o.FromCurrencyCode); err != nil {\n\t\treturn err\n\t}\n\n\tif o.FromNanos != nil {\n\n\t\t// query param from.nanos\n\t\tvar qrFromNanos int32\n\t\tif o.FromNanos != nil {\n\t\t\tqrFromNanos = *o.FromNanos\n\t\t}\n\t\tqFromNanos := swag.FormatInt32(qrFromNanos)\n\t\tif qFromNanos != \"\" {\n\t\t\tif err := r.SetQueryParam(\"from.nanos\", qFromNanos); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.FromUnits != nil {\n\n\t\t// query param from.units\n\t\tvar qrFromUnits string\n\t\tif o.FromUnits != nil {\n\t\t\tqrFromUnits = *o.FromUnits\n\t\t}\n\t\tqFromUnits := qrFromUnits\n\t\tif qFromUnits != \"\" {\n\t\t\tif err := r.SetQueryParam(\"from.units\", qFromUnits); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param to_code\n\tif err := r.SetPathParam(\"to_code\", o.ToCode); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SystemEventsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Filters != nil {\n\n\t\t// query param filters\n\t\tvar qrFilters string\n\t\tif o.Filters != nil {\n\t\t\tqrFilters = *o.Filters\n\t\t}\n\t\tqFilters := qrFilters\n\t\tif qFilters != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filters\", qFilters); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Since != nil {\n\n\t\t// query param since\n\t\tvar qrSince string\n\t\tif o.Since != nil {\n\t\t\tqrSince = *o.Since\n\t\t}\n\t\tqSince := qrSince\n\t\tif qSince != \"\" {\n\t\t\tif err := r.SetQueryParam(\"since\", qSince); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Until != nil {\n\n\t\t// query param until\n\t\tvar qrUntil string\n\t\tif o.Until != nil {\n\t\t\tqrUntil = *o.Until\n\t\t}\n\t\tqUntil := qrUntil\n\t\tif qUntil != \"\" {\n\t\t\tif err := r.SetQueryParam(\"until\", qUntil); 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}", "func (o *GetBundleByKeyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Audit != nil {\n\n\t\t// query param audit\n\t\tvar qrAudit string\n\n\t\tif o.Audit != nil {\n\t\t\tqrAudit = *o.Audit\n\t\t}\n\t\tqAudit := qrAudit\n\t\tif qAudit != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"audit\", qAudit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// query param externalKey\n\tqrExternalKey := o.ExternalKey\n\tqExternalKey := qrExternalKey\n\tif qExternalKey != \"\" {\n\n\t\tif err := r.SetQueryParam(\"externalKey\", qExternalKey); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.IncludedDeleted != nil {\n\n\t\t// query param includedDeleted\n\t\tvar qrIncludedDeleted bool\n\n\t\tif o.IncludedDeleted != nil {\n\t\t\tqrIncludedDeleted = *o.IncludedDeleted\n\t\t}\n\t\tqIncludedDeleted := swag.FormatBool(qrIncludedDeleted)\n\t\tif qIncludedDeleted != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"includedDeleted\", qIncludedDeleted); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// header param WithProfilingInfo\n\tif o.WithProfilingInfo != nil && len(*o.WithProfilingInfo) > 0 {\n\t\tif err := r.SetHeaderParam(\"X-Killbill-Profiling-Req\", *o.WithProfilingInfo); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// header param withStackTrace\n\tif o.WithStackTrace != nil && *o.WithStackTrace {\n\t\tif err := r.SetQueryParam(\"withStackTrace\", \"true\"); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SwarmUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.RotateManagerToken != nil {\n\n\t\t// query param rotateManagerToken\n\t\tvar qrRotateManagerToken bool\n\t\tif o.RotateManagerToken != nil {\n\t\t\tqrRotateManagerToken = *o.RotateManagerToken\n\t\t}\n\t\tqRotateManagerToken := swag.FormatBool(qrRotateManagerToken)\n\t\tif qRotateManagerToken != \"\" {\n\t\t\tif err := r.SetQueryParam(\"rotateManagerToken\", qRotateManagerToken); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.RotateManagerUnlockKey != nil {\n\n\t\t// query param rotateManagerUnlockKey\n\t\tvar qrRotateManagerUnlockKey bool\n\t\tif o.RotateManagerUnlockKey != nil {\n\t\t\tqrRotateManagerUnlockKey = *o.RotateManagerUnlockKey\n\t\t}\n\t\tqRotateManagerUnlockKey := swag.FormatBool(qrRotateManagerUnlockKey)\n\t\tif qRotateManagerUnlockKey != \"\" {\n\t\t\tif err := r.SetQueryParam(\"rotateManagerUnlockKey\", qRotateManagerUnlockKey); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.RotateWorkerToken != nil {\n\n\t\t// query param rotateWorkerToken\n\t\tvar qrRotateWorkerToken bool\n\t\tif o.RotateWorkerToken != nil {\n\t\t\tqrRotateWorkerToken = *o.RotateWorkerToken\n\t\t}\n\t\tqRotateWorkerToken := swag.FormatBool(qrRotateWorkerToken)\n\t\tif qRotateWorkerToken != \"\" {\n\t\t\tif err := r.SetQueryParam(\"rotateWorkerToken\", qRotateWorkerToken); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param version\n\tqrVersion := o.Version\n\tqVersion := swag.FormatInt64(qrVersion)\n\tif qVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"version\", qVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ServiceInstanceGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.XBrokerAPIOriginatingIdentity != nil {\n\n\t\t// header param X-Broker-API-Originating-Identity\n\t\tif err := r.SetHeaderParam(\"X-Broker-API-Originating-Identity\", *o.XBrokerAPIOriginatingIdentity); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// header param X-Broker-API-Version\n\tif err := r.SetHeaderParam(\"X-Broker-API-Version\", o.XBrokerAPIVersion); err != nil {\n\t\treturn err\n\t}\n\n\t// path param instance_id\n\tif err := r.SetPathParam(\"instance_id\", o.InstanceID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ShowPackageParams) 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 media_type\n\tif err := r.SetPathParam(\"media_type\", o.MediaType); err != nil {\n\t\treturn err\n\t}\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\t// path param package\n\tif err := r.SetPathParam(\"package\", o.Package); err != nil {\n\t\treturn err\n\t}\n\n\t// path param release\n\tif err := r.SetPathParam(\"release\", o.Release); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SizeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif err := r.SetBodyParam(o.Parameters); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetOutagesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param count\n\tqrCount := o.Count\n\tqCount := swag.FormatFloat64(qrCount)\n\tif qCount != \"\" {\n\n\t\tif err := r.SetQueryParam(\"count\", qCount); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.DeviceID != nil {\n\n\t\t// query param deviceId\n\t\tvar qrDeviceID string\n\n\t\tif o.DeviceID != nil {\n\t\t\tqrDeviceID = *o.DeviceID\n\t\t}\n\t\tqDeviceID := qrDeviceID\n\t\tif qDeviceID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"deviceId\", qDeviceID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.InProgress != nil {\n\n\t\t// query param inProgress\n\t\tvar qrInProgress bool\n\n\t\tif o.InProgress != nil {\n\t\t\tqrInProgress = *o.InProgress\n\t\t}\n\t\tqInProgress := swag.FormatBool(qrInProgress)\n\t\tif qInProgress != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"inProgress\", qInProgress); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// query param page\n\tqrPage := o.Page\n\tqPage := swag.FormatFloat64(qrPage)\n\tif qPage != \"\" {\n\n\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Period != nil {\n\n\t\t// query param period\n\t\tvar qrPeriod float64\n\n\t\tif o.Period != nil {\n\t\t\tqrPeriod = *o.Period\n\t\t}\n\t\tqPeriod := swag.FormatFloat64(qrPeriod)\n\t\tif qPeriod != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"period\", qPeriod); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Query != nil {\n\n\t\t// query param query\n\t\tvar qrQuery string\n\n\t\tif o.Query != nil {\n\t\t\tqrQuery = *o.Query\n\t\t}\n\t\tqQuery := qrQuery\n\t\tif qQuery != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"query\", qQuery); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Type != nil {\n\n\t\t// query param type\n\t\tvar qrType string\n\n\t\tif o.Type != nil {\n\t\t\tqrType = *o.Type\n\t\t}\n\t\tqType := qrType\n\t\tif qType != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"type\", qType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *TerminateParams) 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 extractorId\n\tif err := r.SetPathParam(\"extractorId\", o.ExtractorID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param inputId\n\tif err := r.SetPathParam(\"inputId\", o.InputID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ServeFieldParams) 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 field\n\tif err := r.SetPathParam(\"field\", o.Field); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vcsRootLocator\n\tif err := r.SetPathParam(\"vcsRootLocator\", o.VcsRootLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PostV1DevicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// form param device_identifier\n\tfrDeviceIdentifier := o.DeviceIdentifier\n\tfDeviceIdentifier := frDeviceIdentifier\n\tif fDeviceIdentifier != \"\" {\n\t\tif err := r.SetFormParam(\"device_identifier\", fDeviceIdentifier); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// form param kind\n\tfrKind := o.Kind\n\tfKind := frKind\n\tif fKind != \"\" {\n\t\tif err := r.SetFormParam(\"kind\", fKind); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// form param name\n\tfrName := o.Name\n\tfName := frName\n\tif fName != \"\" {\n\t\tif err := r.SetFormParam(\"name\", fName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.NotificationIdentifier != nil {\n\n\t\t// form param notification_identifier\n\t\tvar frNotificationIdentifier string\n\t\tif o.NotificationIdentifier != nil {\n\t\t\tfrNotificationIdentifier = *o.NotificationIdentifier\n\t\t}\n\t\tfNotificationIdentifier := frNotificationIdentifier\n\t\tif fNotificationIdentifier != \"\" {\n\t\t\tif err := r.SetFormParam(\"notification_identifier\", fNotificationIdentifier); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.SubscribeNotification != nil {\n\n\t\t// form param subscribe_notification\n\t\tvar frSubscribeNotification bool\n\t\tif o.SubscribeNotification != nil {\n\t\t\tfrSubscribeNotification = *o.SubscribeNotification\n\t\t}\n\t\tfSubscribeNotification := swag.FormatBool(frSubscribeNotification)\n\t\tif fSubscribeNotification != \"\" {\n\t\t\tif err := r.SetFormParam(\"subscribe_notification\", fSubscribeNotification); 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}", "func (o *QueryFirewallFieldsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset string\n\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := qrOffset\n\t\tif qOffset != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.PlatformID != nil {\n\n\t\t// query param platform_id\n\t\tvar qrPlatformID string\n\n\t\tif o.PlatformID != nil {\n\t\t\tqrPlatformID = *o.PlatformID\n\t\t}\n\t\tqPlatformID := qrPlatformID\n\t\tif qPlatformID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"platform_id\", qPlatformID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetCatalogXMLParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.AccountID != nil {\n\n\t\t// query param accountId\n\t\tvar qrAccountID strfmt.UUID\n\n\t\tif o.AccountID != nil {\n\t\t\tqrAccountID = *o.AccountID\n\t\t}\n\t\tqAccountID := qrAccountID.String()\n\t\tif qAccountID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"accountId\", qAccountID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.RequestedDate != nil {\n\n\t\t// query param requestedDate\n\t\tvar qrRequestedDate strfmt.DateTime\n\n\t\tif o.RequestedDate != nil {\n\t\t\tqrRequestedDate = *o.RequestedDate\n\t\t}\n\t\tqRequestedDate := qrRequestedDate.String()\n\t\tif qRequestedDate != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"requestedDate\", qRequestedDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// header param WithProfilingInfo\n\tif o.WithProfilingInfo != nil && len(*o.WithProfilingInfo) > 0 {\n\t\tif err := r.SetHeaderParam(\"X-Killbill-Profiling-Req\", *o.WithProfilingInfo); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// header param withStackTrace\n\tif o.WithStackTrace != nil && *o.WithStackTrace {\n\t\tif err := r.SetQueryParam(\"withStackTrace\", \"true\"); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetClockParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param X-Killbill-ApiKey\n\tif err := r.SetHeaderParam(\"X-Killbill-ApiKey\", o.XKillbillAPIKey); err != nil {\n\t\treturn err\n\t}\n\n\t// header param X-Killbill-ApiSecret\n\tif err := r.SetHeaderParam(\"X-Killbill-ApiSecret\", o.XKillbillAPISecret); err != nil {\n\t\treturn err\n\t}\n\n\t// header param WithProfilingInfo\n\tif o.WithProfilingInfo != nil && len(*o.WithProfilingInfo) > 0 {\n\t\tif err := r.SetHeaderParam(\"X-Killbill-Profiling-Req\", *o.WithProfilingInfo); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// header param withStackTrace\n\tif o.WithStackTrace != nil && *o.WithStackTrace {\n\t\tif err := r.SetQueryParam(\"withStackTrace\", \"true\"); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *AdminCreateJusticeUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\t// path param targetNamespace\n\tif err := r.SetPathParam(\"targetNamespace\", o.TargetNamespace); err != nil {\n\t\treturn err\n\t}\n\n\t// path param userId\n\tif err := r.SetPathParam(\"userId\", o.UserID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdateWidgetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Accept != nil {\n\n\t\t// header param Accept\n\t\tif err := r.SetHeaderParam(\"Accept\", *o.Accept); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.ContentType != nil {\n\n\t\t// header param Content-Type\n\t\tif err := r.SetHeaderParam(\"Content-Type\", *o.ContentType); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t// path param uuid\n\tif err := r.SetPathParam(\"uuid\", o.UUID.String()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.WidgetBody); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *TestEndpointParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetLogsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.XRequestID != nil {\n\n\t\t// header param X-Request-Id\n\t\tif err := r.SetHeaderParam(\"X-Request-Id\", *o.XRequestID); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int64\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt64(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PageSize != nil {\n\n\t\t// query param page_size\n\t\tvar qrPageSize int64\n\t\tif o.PageSize != nil {\n\t\t\tqrPageSize = *o.PageSize\n\t\t}\n\t\tqPageSize := swag.FormatInt64(qrPageSize)\n\t\tif qPageSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page_size\", qPageSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param project_name\n\tif err := r.SetPathParam(\"project_name\", o.ProjectName); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Q != nil {\n\n\t\t// query param q\n\t\tvar qrQ string\n\t\tif o.Q != nil {\n\t\t\tqrQ = *o.Q\n\t\t}\n\t\tqQ := qrQ\n\t\tif qQ != \"\" {\n\t\t\tif err := r.SetQueryParam(\"q\", qQ); 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}", "func (o *ListSourceFileOfProjectVersionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param parentId\n\tif err := r.SetPathParam(\"parentId\", swag.FormatInt64(o.ParentID)); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Q != nil {\n\n\t\t// query param q\n\t\tvar qrQ string\n\t\tif o.Q != nil {\n\t\t\tqrQ = *o.Q\n\t\t}\n\t\tqQ := qrQ\n\t\tif qQ != \"\" {\n\t\t\tif err := r.SetQueryParam(\"q\", qQ); 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}", "func (o *GetDrgParams) 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 drgId\n\tif err := r.SetPathParam(\"drgId\", o.DrgID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdateFlowParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param bucketId\n\tif err := r.SetPathParam(\"bucketId\", o.BucketID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param flowId\n\tif err := r.SetPathParam(\"flowId\", o.FlowID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *CreateWidgetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Accept != nil {\n\n\t\t// header param Accept\n\t\tif err := r.SetHeaderParam(\"Accept\", *o.Accept); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.ContentType != nil {\n\n\t\t// header param Content-Type\n\t\tif err := r.SetHeaderParam(\"Content-Type\", *o.ContentType); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif err := r.SetBodyParam(o.WidgetBody); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetBodyResourceByDatePeriodParams) 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 date\n\tif err := r.SetPathParam(\"date\", o.Date.String()); err != nil {\n\t\treturn err\n\t}\n\n\t// path param period\n\tif err := r.SetPathParam(\"period\", o.Period); err != nil {\n\t\treturn err\n\t}\n\n\t// path param resource-path\n\tif err := r.SetPathParam(\"resource-path\", o.ResourcePath); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetAboutUserParams) 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\tvaluesSelect := o.Select\n\n\tjoinedSelect := swag.JoinByFormat(valuesSelect, \"csv\")\n\t// query array param select\n\tif err := r.SetQueryParam(\"select\", joinedSelect...); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ExtractionListV1Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param id\n\tqrID := o.ID\n\tqID := qrID\n\tif qID != \"\" {\n\n\t\tif err := r.SetQueryParam(\"id\", qID); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset string\n\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := qrOffset\n\t\tif qOffset != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetAuditEventsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int32\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt32(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param resourceCrn\n\tqrResourceCrn := o.ResourceCrn\n\tqResourceCrn := qrResourceCrn\n\tif qResourceCrn != \"\" {\n\t\tif err := r.SetQueryParam(\"resourceCrn\", qResourceCrn); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Size != nil {\n\n\t\t// query param size\n\t\tvar qrSize int32\n\t\tif o.Size != nil {\n\t\t\tqrSize = *o.Size\n\t\t}\n\t\tqSize := swag.FormatInt32(qrSize)\n\t\tif qSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"size\", qSize); 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}", "func (o *PcloudSystempoolsGetParams) 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 cloud_instance_id\n\tif err := r.SetPathParam(\"cloud_instance_id\", o.CloudInstanceID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *WaitListParams) 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.Height != nil {\n\n\t\t// query param height\n\t\tvar qrHeight uint64\n\n\t\tif o.Height != nil {\n\t\t\tqrHeight = *o.Height\n\t\t}\n\t\tqHeight := swag.FormatUint64(qrHeight)\n\t\tif qHeight != \"\" {\n\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\t}\n\n\tif o.PublicKey != nil {\n\n\t\t// query param public_key\n\t\tvar qrPublicKey string\n\n\t\tif o.PublicKey != nil {\n\t\t\tqrPublicKey = *o.PublicKey\n\t\t}\n\t\tqPublicKey := qrPublicKey\n\t\tif qPublicKey != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"public_key\", qPublicKey); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *BudgetAddParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetGCParams) 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 gc_id\n\tif err := r.SetPathParam(\"gc_id\", swag.FormatInt64(o.GcID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PartialUpdateAppParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\t// path param app_id\n\tif err := r.SetPathParam(\"app_id\", swag.FormatInt64(o.AppID)); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\treturn err\n\t}\n\n\t// path param team_id\n\tif err := r.SetPathParam(\"team_id\", swag.FormatInt64(o.TeamID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *StartPacketCaptureParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *TaskSchemasIDGetParams) 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 identifier\n\tif err := r.SetPathParam(\"identifier\", o.Identifier); err != nil {\n\t\treturn err\n\t}\n\n\tif o.ResolveRef != nil {\n\n\t\t// query param resolveRef\n\t\tvar qrResolveRef bool\n\t\tif o.ResolveRef != nil {\n\t\t\tqrResolveRef = *o.ResolveRef\n\t\t}\n\t\tqResolveRef := swag.FormatBool(qrResolveRef)\n\t\tif qResolveRef != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resolveRef\", qResolveRef); 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}", "func (o *UploadTaskFileParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Description != nil {\n\n\t\t// form param description\n\t\tvar frDescription string\n\t\tif o.Description != nil {\n\t\t\tfrDescription = *o.Description\n\t\t}\n\t\tfDescription := frDescription\n\t\tif fDescription != \"\" {\n\t\t\tif err := r.SetFormParam(\"description\", fDescription); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.File != nil {\n\n\t\tif o.File != nil {\n\t\t\t// form file param file\n\t\t\tif err := r.SetFileParam(\"file\", o.File); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PetCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetInstrumentsInstrumentOrderBookParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.AcceptDatetimeFormat != nil {\n\n\t\t// header param Accept-Datetime-Format\n\t\tif err := r.SetHeaderParam(\"Accept-Datetime-Format\", *o.AcceptDatetimeFormat); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param instrument\n\tif err := r.SetPathParam(\"instrument\", o.Instrument); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Time != nil {\n\n\t\t// query param time\n\t\tvar qrTime string\n\t\tif o.Time != nil {\n\t\t\tqrTime = *o.Time\n\t\t}\n\t\tqTime := qrTime\n\t\tif qTime != \"\" {\n\t\t\tif err := r.SetQueryParam(\"time\", qTime); 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}", "func (o *QueryChangesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Filter != nil {\n\n\t\t// query param filter\n\t\tvar qrFilter string\n\n\t\tif o.Filter != nil {\n\t\t\tqrFilter = *o.Filter\n\t\t}\n\t\tqFilter := qrFilter\n\t\tif qFilter != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"filter\", qFilter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Sort != nil {\n\n\t\t// query param sort\n\t\tvar qrSort string\n\n\t\tif o.Sort != nil {\n\t\t\tqrSort = *o.Sort\n\t\t}\n\t\tqSort := qrSort\n\t\tif qSort != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"sort\", qSort); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetScopeConfigurationParams) 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 scope_id\n\tif err := r.SetPathParam(\"scope_id\", o.ScopeID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param site_id\n\tif err := r.SetPathParam(\"site_id\", o.SiteID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param stack_id\n\tif err := r.SetPathParam(\"stack_id\", o.StackID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdateEventParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param eventId\n\tif err := r.SetPathParam(\"eventId\", o.EventID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param koronaAccountId\n\tif err := r.SetPathParam(\"koronaAccountId\", o.KoronaAccountID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetV1FunctionalitiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Impacted != nil {\n\n\t\t// query param impacted\n\t\tvar qrImpacted string\n\n\t\tif o.Impacted != nil {\n\t\t\tqrImpacted = *o.Impacted\n\t\t}\n\t\tqImpacted := qrImpacted\n\t\tif qImpacted != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"impacted\", qImpacted); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Labels != nil {\n\n\t\t// query param labels\n\t\tvar qrLabels string\n\n\t\tif o.Labels != nil {\n\t\t\tqrLabels = *o.Labels\n\t\t}\n\t\tqLabels := qrLabels\n\t\tif qLabels != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"labels\", qLabels); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Lite != nil {\n\n\t\t// query param lite\n\t\tvar qrLite bool\n\n\t\tif o.Lite != nil {\n\t\t\tqrLite = *o.Lite\n\t\t}\n\t\tqLite := swag.FormatBool(qrLite)\n\t\tif qLite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"lite\", qLite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Name != nil {\n\n\t\t// query param name\n\t\tvar qrName string\n\n\t\tif o.Name != nil {\n\t\t\tqrName = *o.Name\n\t\t}\n\t\tqName := qrName\n\t\tif qName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"name\", qName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Owner != nil {\n\n\t\t// query param owner\n\t\tvar qrOwner string\n\n\t\tif o.Owner != nil {\n\t\t\tqrOwner = *o.Owner\n\t\t}\n\t\tqOwner := qrOwner\n\t\tif qOwner != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"owner\", qOwner); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int32\n\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt32(qrPage)\n\t\tif qPage != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.PerPage != nil {\n\n\t\t// query param per_page\n\t\tvar qrPerPage int32\n\n\t\tif o.PerPage != nil {\n\t\t\tqrPerPage = *o.PerPage\n\t\t}\n\t\tqPerPage := swag.FormatInt32(qrPerPage)\n\t\tif qPerPage != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"per_page\", qPerPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Query != nil {\n\n\t\t// query param query\n\t\tvar qrQuery string\n\n\t\tif o.Query != nil {\n\t\t\tqrQuery = *o.Query\n\t\t}\n\t\tqQuery := qrQuery\n\t\tif qQuery != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"query\", qQuery); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ContainerUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.Update); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetPointsByQueryParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DollarSkip != nil {\n\n\t\t// query param $skip\n\t\tvar qrNrDollarSkip int32\n\t\tif o.DollarSkip != nil {\n\t\t\tqrNrDollarSkip = *o.DollarSkip\n\t\t}\n\t\tqNrDollarSkip := swag.FormatInt32(qrNrDollarSkip)\n\t\tif qNrDollarSkip != \"\" {\n\t\t\tif err := r.SetQueryParam(\"$skip\", qNrDollarSkip); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.DollarTop != nil {\n\n\t\t// query param $top\n\t\tvar qrNrDollarTop int32\n\t\tif o.DollarTop != nil {\n\t\t\tqrNrDollarTop = *o.DollarTop\n\t\t}\n\t\tqNrDollarTop := swag.FormatInt32(qrNrDollarTop)\n\t\tif qNrDollarTop != \"\" {\n\t\t\tif err := r.SetQueryParam(\"$top\", qNrDollarTop); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param project\n\tif err := r.SetPathParam(\"project\", o.Project); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SyncStatusUsingGETParams) 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 namespaceSelfLinkId\n\tif err := r.SetPathParam(\"namespaceSelfLinkId\", o.NamespaceSelfLinkID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param requestId\n\tif err := r.SetPathParam(\"requestId\", o.RequestID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ResolveBatchParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Account != nil {\n\n\t\t// query param account\n\t\tvar qrAccount string\n\t\tif o.Account != nil {\n\t\t\tqrAccount = *o.Account\n\t\t}\n\t\tqAccount := qrAccount\n\t\tif qAccount != \"\" {\n\t\t\tif err := r.SetQueryParam(\"account\", qAccount); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Environment != nil {\n\n\t\t// query param environment\n\t\tvar qrEnvironment string\n\t\tif o.Environment != nil {\n\t\t\tqrEnvironment = *o.Environment\n\t\t}\n\t\tqEnvironment := qrEnvironment\n\t\tif qEnvironment != \"\" {\n\t\t\tif err := r.SetQueryParam(\"environment\", qEnvironment); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.From != nil {\n\n\t\t// query param from\n\t\tvar qrFrom string\n\t\tif o.From != nil {\n\t\t\tqrFrom = *o.From\n\t\t}\n\t\tqFrom := qrFrom\n\t\tif qFrom != \"\" {\n\t\t\tif err := r.SetQueryParam(\"from\", qFrom); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int32\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt32(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Region != nil {\n\n\t\t// query param region\n\t\tvar qrRegion string\n\t\tif o.Region != nil {\n\t\t\tqrRegion = *o.Region\n\t\t}\n\t\tqRegion := qrRegion\n\t\tif qRegion != \"\" {\n\t\t\tif err := r.SetQueryParam(\"region\", qRegion); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.To != nil {\n\n\t\t// query param to\n\t\tvar qrTo string\n\t\tif o.To != nil {\n\t\t\tqrTo = *o.To\n\t\t}\n\t\tqTo := qrTo\n\t\tif qTo != \"\" {\n\t\t\tif err := r.SetQueryParam(\"to\", qTo); 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}", "func (o *GetAccountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\tif o.Authorization != nil {\n\n\t\t// header param Authorization\n\t\tif err := r.SetHeaderParam(\"Authorization\", *o.Authorization); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.Country != nil {\n\n\t\t// query param country\n\t\tvar qrCountry string\n\t\tif o.Country != nil {\n\t\t\tqrCountry = *o.Country\n\t\t}\n\t\tqCountry := qrCountry\n\t\tif qCountry != \"\" {\n\t\t\tif err := r.SetQueryParam(\"country\", qCountry); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Email != nil {\n\n\t\t// query param email\n\t\tvar qrEmail string\n\t\tif o.Email != nil {\n\t\t\tqrEmail = *o.Email\n\t\t}\n\t\tqEmail := qrEmail\n\t\tif qEmail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"email\", qEmail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvaluesFields := o.Fields\n\n\tjoinedFields := swag.JoinByFormat(valuesFields, \"csv\")\n\t// query array param fields\n\tif err := r.SetQueryParam(\"fields\", joinedFields...); err != nil {\n\t\treturn err\n\t}\n\n\tif o.PersonID != nil {\n\n\t\t// query param person_id\n\t\tvar qrPersonID string\n\t\tif o.PersonID != nil {\n\t\t\tqrPersonID = *o.PersonID\n\t\t}\n\t\tqPersonID := qrPersonID\n\t\tif qPersonID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"person_id\", qPersonID); 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}", "func (o *GetDeviceHealthParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param deviceId\n\tif err := r.SetPathParam(\"deviceId\", o.DeviceID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdatePatientParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param ID\n\tif err := r.SetPathParam(\"ID\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Patient != nil {\n\t\tif err := r.SetBodyParam(o.Patient); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdateCustomIDPParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.CustomIDP != nil {\n\t\tif err := r.SetBodyParam(o.CustomIDP); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param aid\n\tif err := r.SetPathParam(\"aid\", o.Aid); err != nil {\n\t\treturn err\n\t}\n\n\t// path param iid\n\tif err := r.SetPathParam(\"iid\", o.Iid); err != nil {\n\t\treturn err\n\t}\n\n\t// path param tid\n\tif err := r.SetPathParam(\"tid\", o.Tid); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetSeriesIDFilterParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.AcceptLanguage != nil {\n\n\t\t// header param Accept-Language\n\t\tif err := r.SetHeaderParam(\"Accept-Language\", *o.AcceptLanguage); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\t// query param keys\n\tqrKeys := o.Keys\n\tqKeys := qrKeys\n\tif qKeys != \"\" {\n\t\tif err := r.SetQueryParam(\"keys\", qKeys); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *CreateBlueprintInWorkspaceInternalParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.AccountID != nil {\n\n\t\t// query param accountId\n\t\tvar qrAccountID string\n\t\tif o.AccountID != nil {\n\t\t\tqrAccountID = *o.AccountID\n\t\t}\n\t\tqAccountID := qrAccountID\n\t\tif qAccountID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"accountId\", qAccountID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param workspaceId\n\tif err := r.SetPathParam(\"workspaceId\", swag.FormatInt64(o.WorkspaceID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *OrgGetParams) 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 org\n\tif err := r.SetPathParam(\"org\", o.Org); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetVersioningPolicyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Description != nil {\n\n\t\t// query param Description\n\t\tvar qrDescription string\n\t\tif o.Description != nil {\n\t\t\tqrDescription = *o.Description\n\t\t}\n\t\tqDescription := qrDescription\n\t\tif qDescription != \"\" {\n\t\t\tif err := r.SetQueryParam(\"Description\", qDescription); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IgnoreFilesGreaterThan != nil {\n\n\t\t// query param IgnoreFilesGreaterThan\n\t\tvar qrIgnoreFilesGreaterThan string\n\t\tif o.IgnoreFilesGreaterThan != nil {\n\t\t\tqrIgnoreFilesGreaterThan = *o.IgnoreFilesGreaterThan\n\t\t}\n\t\tqIgnoreFilesGreaterThan := qrIgnoreFilesGreaterThan\n\t\tif qIgnoreFilesGreaterThan != \"\" {\n\t\t\tif err := r.SetQueryParam(\"IgnoreFilesGreaterThan\", qIgnoreFilesGreaterThan); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.MaxSizePerFile != nil {\n\n\t\t// query param MaxSizePerFile\n\t\tvar qrMaxSizePerFile string\n\t\tif o.MaxSizePerFile != nil {\n\t\t\tqrMaxSizePerFile = *o.MaxSizePerFile\n\t\t}\n\t\tqMaxSizePerFile := qrMaxSizePerFile\n\t\tif qMaxSizePerFile != \"\" {\n\t\t\tif err := r.SetQueryParam(\"MaxSizePerFile\", qMaxSizePerFile); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.MaxTotalSize != nil {\n\n\t\t// query param MaxTotalSize\n\t\tvar qrMaxTotalSize string\n\t\tif o.MaxTotalSize != nil {\n\t\t\tqrMaxTotalSize = *o.MaxTotalSize\n\t\t}\n\t\tqMaxTotalSize := qrMaxTotalSize\n\t\tif qMaxTotalSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"MaxTotalSize\", qMaxTotalSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Name != nil {\n\n\t\t// query param Name\n\t\tvar qrName string\n\t\tif o.Name != nil {\n\t\t\tqrName = *o.Name\n\t\t}\n\t\tqName := qrName\n\t\tif qName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"Name\", qName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param Uuid\n\tif err := r.SetPathParam(\"Uuid\", o.UUID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.VersionsDataSourceBucket != nil {\n\n\t\t// query param VersionsDataSourceBucket\n\t\tvar qrVersionsDataSourceBucket string\n\t\tif o.VersionsDataSourceBucket != nil {\n\t\t\tqrVersionsDataSourceBucket = *o.VersionsDataSourceBucket\n\t\t}\n\t\tqVersionsDataSourceBucket := qrVersionsDataSourceBucket\n\t\tif qVersionsDataSourceBucket != \"\" {\n\t\t\tif err := r.SetQueryParam(\"VersionsDataSourceBucket\", qVersionsDataSourceBucket); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.VersionsDataSourceName != nil {\n\n\t\t// query param VersionsDataSourceName\n\t\tvar qrVersionsDataSourceName string\n\t\tif o.VersionsDataSourceName != nil {\n\t\t\tqrVersionsDataSourceName = *o.VersionsDataSourceName\n\t\t}\n\t\tqVersionsDataSourceName := qrVersionsDataSourceName\n\t\tif qVersionsDataSourceName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"VersionsDataSourceName\", qVersionsDataSourceName); 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}", "func (o *ExtrasGraphsReadParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Name != nil {\n\n\t\t// query param name\n\t\tvar qrName string\n\t\tif o.Name != nil {\n\t\t\tqrName = *o.Name\n\t\t}\n\t\tqName := qrName\n\t\tif qName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"name\", qName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Type != nil {\n\n\t\t// query param type\n\t\tvar qrType string\n\t\tif o.Type != nil {\n\t\t\tqrType = *o.Type\n\t\t}\n\t\tqType := qrType\n\t\tif qType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"type\", qType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetBuildPropertiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param buildId\n\tif err := r.SetPathParam(\"buildId\", swag.FormatInt32(o.BuildID)); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Filter != nil {\n\n\t\t// query param filter\n\t\tvar qrFilter string\n\t\tif o.Filter != nil {\n\t\t\tqrFilter = *o.Filter\n\t\t}\n\t\tqFilter := qrFilter\n\t\tif qFilter != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter\", qFilter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param project\n\tif err := r.SetPathParam(\"project\", o.Project); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *AdminGetBannedDevicesV4Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\tif o.DeviceType != nil {\n\n\t\t// query param deviceType\n\t\tvar qrDeviceType string\n\t\tif o.DeviceType != nil {\n\t\t\tqrDeviceType = *o.DeviceType\n\t\t}\n\t\tqDeviceType := qrDeviceType\n\t\tif qDeviceType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"deviceType\", qDeviceType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.EndDate != nil {\n\n\t\t// query param endDate\n\t\tvar qrEndDate string\n\t\tif o.EndDate != nil {\n\t\t\tqrEndDate = *o.EndDate\n\t\t}\n\t\tqEndDate := qrEndDate\n\t\tif qEndDate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"endDate\", qEndDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.StartDate != nil {\n\n\t\t// query param startDate\n\t\tvar qrStartDate string\n\t\tif o.StartDate != nil {\n\t\t\tqrStartDate = *o.StartDate\n\t\t}\n\t\tqStartDate := qrStartDate\n\t\tif qStartDate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"startDate\", qStartDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// setting the default header value\n\tif err := r.SetHeaderParam(\"User-Agent\", utils.UserAgentGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetHeaderParam(\"X-Amzn-Trace-Id\", utils.AmazonTraceIDGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\n\treturn nil\n}", "func (o *BikePointGetAllParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *DecryptParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif err := r.SetBodyParam(o.Parameters); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *DeleteRequestsRequestNameParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// query param requestName\n\tqrRequestName := o.RequestName\n\tqRequestName := qrRequestName\n\tif qRequestName != \"\" {\n\t\tif err := r.SetQueryParam(\"requestName\", qRequestName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Synchronous != nil {\n\n\t\t// query param synchronous\n\t\tvar qrSynchronous bool\n\t\tif o.Synchronous != nil {\n\t\t\tqrSynchronous = *o.Synchronous\n\t\t}\n\t\tqSynchronous := swag.FormatBool(qrSynchronous)\n\t\tif qSynchronous != \"\" {\n\t\t\tif err := r.SetQueryParam(\"synchronous\", qSynchronous); 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}", "func (o *SearchAbsoluteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Decorate != nil {\n\n\t\t// query param decorate\n\t\tvar qrDecorate bool\n\t\tif o.Decorate != nil {\n\t\t\tqrDecorate = *o.Decorate\n\t\t}\n\t\tqDecorate := swag.FormatBool(qrDecorate)\n\t\tif qDecorate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"decorate\", qDecorate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Filter != nil {\n\n\t\t// query param filter\n\t\tvar qrFilter string\n\t\tif o.Filter != nil {\n\t\t\tqrFilter = *o.Filter\n\t\t}\n\t\tqFilter := qrFilter\n\t\tif qFilter != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter\", qFilter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param from\n\tqrFrom := o.From\n\tqFrom := qrFrom\n\tif qFrom != \"\" {\n\t\tif err := r.SetQueryParam(\"from\", qFrom); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param query\n\tqrQuery := o.Query\n\tqQuery := qrQuery\n\tif qQuery != \"\" {\n\t\tif err := r.SetQueryParam(\"query\", qQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Sort != nil {\n\n\t\t// query param sort\n\t\tvar qrSort string\n\t\tif o.Sort != nil {\n\t\t\tqrSort = *o.Sort\n\t\t}\n\t\tqSort := qrSort\n\t\tif qSort != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sort\", qSort); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param to\n\tqrTo := o.To\n\tqTo := qrTo\n\tif qTo != \"\" {\n\t\tif err := r.SetQueryParam(\"to\", qTo); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetCountersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.ClusterNodeID != nil {\n\n\t\t// query param clusterNodeId\n\t\tvar qrClusterNodeID string\n\n\t\tif o.ClusterNodeID != nil {\n\t\t\tqrClusterNodeID = *o.ClusterNodeID\n\t\t}\n\t\tqClusterNodeID := qrClusterNodeID\n\t\tif qClusterNodeID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"clusterNodeId\", qClusterNodeID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Nodewise != nil {\n\n\t\t// query param nodewise\n\t\tvar qrNodewise bool\n\n\t\tif o.Nodewise != nil {\n\t\t\tqrNodewise = *o.Nodewise\n\t\t}\n\t\tqNodewise := swag.FormatBool(qrNodewise)\n\t\tif qNodewise != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"nodewise\", qNodewise); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *MetroclusterInterconnectGetParams) 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 adapter\n\tif err := r.SetPathParam(\"adapter\", o.Adapter); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// binding items for fields\n\t\tjoinedFields := o.bindParamFields(reg)\n\n\t\t// query array param fields\n\t\tif err := r.SetQueryParam(\"fields\", joinedFields...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param node.uuid\n\tif err := r.SetPathParam(\"node.uuid\", o.NodeUUID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param partner_type\n\tif err := r.SetPathParam(\"partner_type\", o.PartnerType); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Item != nil {\n\t\tif err := r.SetBodyParam(o.Item); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param itemId\n\tif err := r.SetPathParam(\"itemId\", o.ItemID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *CreateAccessPolicyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *DeleteDataSourceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.APIKey != nil {\n\n\t\t// query param ApiKey\n\t\tvar qrAPIKey string\n\n\t\tif o.APIKey != nil {\n\t\t\tqrAPIKey = *o.APIKey\n\t\t}\n\t\tqAPIKey := qrAPIKey\n\t\tif qAPIKey != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ApiKey\", qAPIKey); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.APISecret != nil {\n\n\t\t// query param ApiSecret\n\t\tvar qrAPISecret string\n\n\t\tif o.APISecret != nil {\n\t\t\tqrAPISecret = *o.APISecret\n\t\t}\n\t\tqAPISecret := qrAPISecret\n\t\tif qAPISecret != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ApiSecret\", qAPISecret); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.CreationDate != nil {\n\n\t\t// query param CreationDate\n\t\tvar qrCreationDate int32\n\n\t\tif o.CreationDate != nil {\n\t\t\tqrCreationDate = *o.CreationDate\n\t\t}\n\t\tqCreationDate := swag.FormatInt32(qrCreationDate)\n\t\tif qCreationDate != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"CreationDate\", qCreationDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Disabled != nil {\n\n\t\t// query param Disabled\n\t\tvar qrDisabled bool\n\n\t\tif o.Disabled != nil {\n\t\t\tqrDisabled = *o.Disabled\n\t\t}\n\t\tqDisabled := swag.FormatBool(qrDisabled)\n\t\tif qDisabled != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"Disabled\", qDisabled); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.EncryptionKey != nil {\n\n\t\t// query param EncryptionKey\n\t\tvar qrEncryptionKey string\n\n\t\tif o.EncryptionKey != nil {\n\t\t\tqrEncryptionKey = *o.EncryptionKey\n\t\t}\n\t\tqEncryptionKey := qrEncryptionKey\n\t\tif qEncryptionKey != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"EncryptionKey\", qEncryptionKey); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.EncryptionMode != nil {\n\n\t\t// query param EncryptionMode\n\t\tvar qrEncryptionMode string\n\n\t\tif o.EncryptionMode != nil {\n\t\t\tqrEncryptionMode = *o.EncryptionMode\n\t\t}\n\t\tqEncryptionMode := qrEncryptionMode\n\t\tif qEncryptionMode != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"EncryptionMode\", qEncryptionMode); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.FlatStorage != nil {\n\n\t\t// query param FlatStorage\n\t\tvar qrFlatStorage bool\n\n\t\tif o.FlatStorage != nil {\n\t\t\tqrFlatStorage = *o.FlatStorage\n\t\t}\n\t\tqFlatStorage := swag.FormatBool(qrFlatStorage)\n\t\tif qFlatStorage != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"FlatStorage\", qFlatStorage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.LastSynchronizationDate != nil {\n\n\t\t// query param LastSynchronizationDate\n\t\tvar qrLastSynchronizationDate int32\n\n\t\tif o.LastSynchronizationDate != nil {\n\t\t\tqrLastSynchronizationDate = *o.LastSynchronizationDate\n\t\t}\n\t\tqLastSynchronizationDate := swag.FormatInt32(qrLastSynchronizationDate)\n\t\tif qLastSynchronizationDate != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"LastSynchronizationDate\", qLastSynchronizationDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param Name\n\tif err := r.SetPathParam(\"Name\", o.Name); err != nil {\n\t\treturn err\n\t}\n\n\tif o.ObjectsBaseFolder != nil {\n\n\t\t// query param ObjectsBaseFolder\n\t\tvar qrObjectsBaseFolder string\n\n\t\tif o.ObjectsBaseFolder != nil {\n\t\t\tqrObjectsBaseFolder = *o.ObjectsBaseFolder\n\t\t}\n\t\tqObjectsBaseFolder := qrObjectsBaseFolder\n\t\tif qObjectsBaseFolder != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ObjectsBaseFolder\", qObjectsBaseFolder); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ObjectsBucket != nil {\n\n\t\t// query param ObjectsBucket\n\t\tvar qrObjectsBucket string\n\n\t\tif o.ObjectsBucket != nil {\n\t\t\tqrObjectsBucket = *o.ObjectsBucket\n\t\t}\n\t\tqObjectsBucket := qrObjectsBucket\n\t\tif qObjectsBucket != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ObjectsBucket\", qObjectsBucket); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ObjectsHost != nil {\n\n\t\t// query param ObjectsHost\n\t\tvar qrObjectsHost string\n\n\t\tif o.ObjectsHost != nil {\n\t\t\tqrObjectsHost = *o.ObjectsHost\n\t\t}\n\t\tqObjectsHost := qrObjectsHost\n\t\tif qObjectsHost != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ObjectsHost\", qObjectsHost); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ObjectsPort != nil {\n\n\t\t// query param ObjectsPort\n\t\tvar qrObjectsPort int32\n\n\t\tif o.ObjectsPort != nil {\n\t\t\tqrObjectsPort = *o.ObjectsPort\n\t\t}\n\t\tqObjectsPort := swag.FormatInt32(qrObjectsPort)\n\t\tif qObjectsPort != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ObjectsPort\", qObjectsPort); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ObjectsSecure != nil {\n\n\t\t// query param ObjectsSecure\n\t\tvar qrObjectsSecure bool\n\n\t\tif o.ObjectsSecure != nil {\n\t\t\tqrObjectsSecure = *o.ObjectsSecure\n\t\t}\n\t\tqObjectsSecure := swag.FormatBool(qrObjectsSecure)\n\t\tif qObjectsSecure != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ObjectsSecure\", qObjectsSecure); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ObjectsServiceName != nil {\n\n\t\t// query param ObjectsServiceName\n\t\tvar qrObjectsServiceName string\n\n\t\tif o.ObjectsServiceName != nil {\n\t\t\tqrObjectsServiceName = *o.ObjectsServiceName\n\t\t}\n\t\tqObjectsServiceName := qrObjectsServiceName\n\t\tif qObjectsServiceName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ObjectsServiceName\", qObjectsServiceName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.PeerAddress != nil {\n\n\t\t// query param PeerAddress\n\t\tvar qrPeerAddress string\n\n\t\tif o.PeerAddress != nil {\n\t\t\tqrPeerAddress = *o.PeerAddress\n\t\t}\n\t\tqPeerAddress := qrPeerAddress\n\t\tif qPeerAddress != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"PeerAddress\", qPeerAddress); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.SkipSyncOnRestart != nil {\n\n\t\t// query param SkipSyncOnRestart\n\t\tvar qrSkipSyncOnRestart bool\n\n\t\tif o.SkipSyncOnRestart != nil {\n\t\t\tqrSkipSyncOnRestart = *o.SkipSyncOnRestart\n\t\t}\n\t\tqSkipSyncOnRestart := swag.FormatBool(qrSkipSyncOnRestart)\n\t\tif qSkipSyncOnRestart != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"SkipSyncOnRestart\", qSkipSyncOnRestart); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StorageType != nil {\n\n\t\t// query param StorageType\n\t\tvar qrStorageType string\n\n\t\tif o.StorageType != nil {\n\t\t\tqrStorageType = *o.StorageType\n\t\t}\n\t\tqStorageType := qrStorageType\n\t\tif qStorageType != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"StorageType\", qStorageType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.VersioningPolicyName != nil {\n\n\t\t// query param VersioningPolicyName\n\t\tvar qrVersioningPolicyName string\n\n\t\tif o.VersioningPolicyName != nil {\n\t\t\tqrVersioningPolicyName = *o.VersioningPolicyName\n\t\t}\n\t\tqVersioningPolicyName := qrVersioningPolicyName\n\t\tif qVersioningPolicyName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"VersioningPolicyName\", qVersioningPolicyName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Watch != nil {\n\n\t\t// query param Watch\n\t\tvar qrWatch bool\n\n\t\tif o.Watch != nil {\n\t\t\tqrWatch = *o.Watch\n\t\t}\n\t\tqWatch := swag.FormatBool(qrWatch)\n\t\tif qWatch != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"Watch\", qWatch); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}" ]
[ "0.71981704", "0.71441984", "0.70468456", "0.70210433", "0.69960576", "0.699581", "0.697964", "0.6979474", "0.69690293", "0.6965975", "0.69236904", "0.6907789", "0.69033754", "0.687153", "0.68571347", "0.6856087", "0.68518764", "0.6844234", "0.6843567", "0.68418425", "0.6829252", "0.68278074", "0.6821043", "0.6820534", "0.681726", "0.68096197", "0.67926276", "0.6792058", "0.6785721", "0.6780726", "0.6777309", "0.67712784", "0.67613", "0.67608464", "0.6759133", "0.6756005", "0.6750525", "0.6743269", "0.67429763", "0.67421186", "0.67402095", "0.67331135", "0.6732343", "0.67316324", "0.67312884", "0.6724864", "0.6723062", "0.6716504", "0.6712249", "0.6708367", "0.67074615", "0.6704388", "0.6700956", "0.66975456", "0.6693408", "0.6691769", "0.6683376", "0.6676501", "0.6670117", "0.66696054", "0.666872", "0.66659284", "0.66644716", "0.6664083", "0.6661897", "0.66556805", "0.66520023", "0.6647279", "0.664495", "0.66426116", "0.66402245", "0.6637575", "0.66347724", "0.6633976", "0.66260195", "0.662047", "0.66191167", "0.6616869", "0.66134477", "0.6606237", "0.6606029", "0.6602654", "0.659834", "0.6597816", "0.65958685", "0.65945", "0.65908366", "0.65847635", "0.65818715", "0.6581523", "0.6574001", "0.65730244", "0.6568649", "0.6566371", "0.6566243", "0.65655416", "0.65642107", "0.656097", "0.6560629", "0.6559931", "0.6555949" ]
0.0
-1
New returns a new MemStore.
func New() *MemStore { return &MemStore{ privateKeyEntryMap: make(map[string]*uid.KeyEntry), publicKeyEntryMap: make(map[string]*uid.KeyEntry), sessionStates: make(map[string]*session.State), sessions: make(map[string]*memSession), sessionKeys: make(map[string]*sessionKey), } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func New() *MemStore {\n\treturn NewWithCleanupInterval(time.Minute)\n}", "func New() *MemStore {\n\ts := new(MemStore)\n\ts.did = make(map[string]common.Role)\n\ts.act = make(map[string]common.Role)\n\ts.tkt = make(map[string]common.Ticket)\n\t// initialize random gen\n\ts.rand = rand.New(rand.NewSource(time.Now().UnixNano() + 9999999))\n\treturn s\n}", "func New() *memoryStore {\n\treturn &memoryStore{\n\t\trtree: radixtree.New(),\n\t\tinterns: radixtree.New(),\n\t}\n}", "func New(capacity int64) chainstore.Store {\n\tmemStore := &memStore{\n\t\tdata: make(map[string][]byte, 1000),\n\t}\n\tstore := lrumgr.New(capacity, memStore)\n\treturn store\n}", "func NewMemStore(sid string) *MemStore {\n\treturn &MemStore{\n\t\tsid: sid,\n\t\tdata: make(map[interface{}]interface{}),\n\t\tlastAccess: time.Now(),\n\t}\n}", "func NewMemStore() *MemStore {\n\treturn &MemStore{m: map[int]Puppy{}}\n}", "func NewMemStore() *MemStore {\n\treturn &MemStore{items: make(map[string]string), mimetype: make(map[string]string)}\n}", "func New(ctx context.Context, logger logger.Logger) (storage.Storage, error) {\n\tm := &memstore{\n\t\tteams: make(map[string]storage.Team),\n\t\tusersByTeam: make(map[string][]string),\n\t\tlogger: logger,\n\t}\n\n\tif err := m.EnsureAdminsTeam(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn m, nil\n}", "func NewMemStore() *MemStore {\n\tst := &MemStore{\n\t\tsessions: make(map[string]*session),\n\t}\n\treturn st\n}", "func NewStore(prefix string) store.KV {\n\treturn &Mem{\n\t\tprefix: prefix,\n\t\tstore: map[string][]byte{},\n\t}\n}", "func NewMemStore() *MemStore {\n\tms := new(MemStore)\n\tms.init()\n\treturn ms\n}", "func New(addr, password string) *Store {\n\treturn &Store{\n\t\tpool: newPool(addr, password),\n\t}\n}", "func NewMemory(kvstore map[uint64]uint64, log map[uint64]*commonpb.Entry) *Memory {\n\tif _, ok := kvstore[KeyFirstIndex]; !ok {\n\t\tkvstore[KeyFirstIndex] = 1\n\t}\n\tif _, ok := kvstore[KeyNextIndex]; !ok {\n\t\tkvstore[KeyNextIndex] = 1\n\t}\n\treturn &Memory{\n\t\tkvstore: kvstore,\n\t\tlog: log,\n\t}\n}", "func New() *memoryDatastore {\n\treturn &memoryDatastore{\n\t\trows: newOperatorSourceRowMap(),\n\t\tparser: &manifestYAMLParser{},\n\t\twalker: &walker{},\n\t\tbundler: &bundler{},\n\t}\n}", "func New() *MemoryCache {\n\treturn &MemoryCache{\n\t\tdb: make(map[string][]byte),\n\t\texpired: make(map[string]time.Time),\n\t}\n}", "func New() *Store {\n\treturn &Store{}\n}", "func New() *Store {\n\treturn &Store{}\n}", "func NewMemStore() cache.Cache {\n\treturn &Store{}\n}", "func New() *Store {\n\treturn &Store{\n\t\tm: make(map[interface{}]entry),\n\t}\n}", "func newMemoryStore() Store {\n\treturn &memoryStore{\n\t\tprefix2base: make(map[string]*NameSpace),\n\t\tbase2prefix: make(map[string]*NameSpace),\n\t\tnamespaces: make(map[string]*NameSpace),\n\t}\n}", "func New(storeType string) (*Store, error) {\n\tswitch storeType {\n\tcase \"memory\":\n\t\treturn &Store{storeType: storeType, engine: makeMemoryStore()}, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported store type: %s\", storeType)\n\t}\n}", "func New() *MemoryCache {\n\treturn &MemoryCache{\n\t\tstore: map[string]*Session{},\n\t}\n}", "func NewMemoryStore(logger *zap.SugaredLogger) (*MemoryStore, error) {\n\tschema := &memdb.DBSchema{\n\t\tTables: map[string]*memdb.TableSchema{\n\t\t\ttableName: &memdb.TableSchema{\n\t\t\t\tName: tableName,\n\t\t\t\tIndexes: map[string]*memdb.IndexSchema{\n\t\t\t\t\t\"id\": &memdb.IndexSchema{\n\t\t\t\t\t\tName: \"id\",\n\t\t\t\t\t\tUnique: true,\n\t\t\t\t\t\tIndexer: &memdb.CompoundIndex{Indexes: []memdb.Indexer{&memdb.StringFieldIndex{Field: \"Name\"}, &memdb.StringFieldIndex{Field: \"IP\"}}},\n\t\t\t\t\t},\n\t\t\t\t\t\"containerid\": &memdb.IndexSchema{\n\t\t\t\t\t\tName: \"containerid\",\n\t\t\t\t\t\tUnique: true,\n\t\t\t\t\t\tIndexer: &memdb.StringSliceFieldIndex{Field: \"ContainerID\"},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tdb, err := memdb.NewMemDB(schema)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &MemoryStore{db: db, logger: logger.Named(\"memory-store\")}, nil\n}", "func NewMem() Engine {\n\treturn &mem{\n\t\tm: raft.NewMemoryStorage(),\n\t\tkv: make(map[string][]byte),\n\t}\n}", "func NewMem() Backend {\n\treturn &memBackend{sync.Mutex{}, map[string]*memStreamObj{}}\n}", "func New() storage.Storage {\n\treturn &memStorage{\n\t\tclients: make(map[string]storage.Client),\n\t\tauthCodes: make(map[string]storage.AuthCode),\n\t\trefreshTokens: make(map[string]storage.Refresh),\n\t\tauthReqs: make(map[string]storage.AuthRequest),\n\t}\n}", "func NewMemStore() *MemBlobStore {\n\treturn &MemBlobStore{\n\t\tblobs: make(map[string][]byte),\n\t\treads: make(map[string]int),\n\t\twrites: make(map[string]int),\n\t\tdeletes: make(map[string]int),\n\t}\n}", "func New(opts ...Option) *Memory {\n\tm := &Memory{\n\t\tinterval: 500 * time.Millisecond,\n\t\tvalues: make(map[int]*sync.Map),\n\t\texit: make(chan struct{}),\n\t\tshard: 10,\n\t}\n\tfor _, opt := range opts {\n\t\topt(m)\n\t}\n\t// init shards\n\tfor i := 0; i < int(m.shard); i++ {\n\t\tm.values[i] = &sync.Map{}\n\t}\n\treturn m\n}", "func NewMemoryStore() *MemoryStore {\n\treturn &MemoryStore{\n\t\tentries: make(map[string]*aggregate),\n\t}\n}", "func New() kv.Store {\n\treturn newStore(newMapStore())\n}", "func New() (db.DB, error) {\n\tx := &MemDB{\n\t\teMap: make(map[string]*pb.Entity),\n\t\tgMap: make(map[string]*pb.Group),\n\t}\n\n\thealth.RegisterCheck(\"MemDB\", x.healthCheck)\n\treturn x, nil\n}", "func NewMemoryStore() *memory {\n\treturn &memory{\n\t\tquotes: make(map[string]Quote),\n\t}\n}", "func NewMemory(opts *MemRepoOptions) *MemRepo {\n\tif opts == nil {\n\t\topts = &MemRepoOptions{}\n\t}\n\tif opts.Ds == nil {\n\t\topts.Ds = dssync.MutexWrap(datastore.NewMapDatastore())\n\t}\n\tif opts.KeyStore == nil {\n\t\topts.KeyStore = make(map[string]types.KeyInfo)\n\t}\n\n\treturn &MemRepo{\n\t\trepoLock: make(chan struct{}, 1),\n\t\tblockstore: blockstore.WrapIDStore(blockstore.NewMemorySync()),\n\t\tdatastore: opts.Ds,\n\t\tkeystore: opts.KeyStore,\n\t}\n}", "func New() *memoryMap {\n\treturn &memoryMap{}\n}", "func New(ctx context.Context) (*MemoryRepository, error) {\n\treturn &MemoryRepository{\n\t\tsongs: make([]memorySong, 0),\n\t}, nil\n}", "func New(cfg *config.Config, ssmSvc ssmiface.SSMAPI) *Store {\n\treturn &Store{\n\t\tssmSvc: ssmSvc,\n\t\tcfg: cfg,\n\t}\n}", "func NewMemTrackingStore() *MemTrackingStore {\n\treturn &MemTrackingStore{tab: make(map[cid.Cid]abi.ChainEpoch)}\n}", "func NewMemoryStore() (*MemoryStore, error) {\n\tret := &MemoryStore{}\n\tret.subscriptions = make(map[string]subscription.Subscription)\n\tret.feeds = make(map[string]feed.Feed)\n\tret.entries = make(map[string]feed.Entry)\n\treturn ret, nil\n}", "func NewMemoryStore() *MemoryStore {\n\treturn &MemoryStore{}\n}", "func New() base.Store {\n\tvar s store\n\ts.data = make(map[string]entry)\n\treturn &s\n}", "func NewMemory() Storage {\n\treturn &memory{\n\t\tkeys: make([]string, 0),\n\t\tstorage: make(map[string][]byte),\n\t\trecovered: false,\n\t}\n}", "func NewStore() (s Store) {\n\ts = make(Store, 0)\n\treturn s\n}", "func New(ttl string) (*Memcache, error) {\n\td, err := time.ParseDuration(ttl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Memcache{\n\t\tTTL: d,\n\t}, nil\n}", "func New(ds datastore.Datastore) *Store {\n\treturn &Store{\n\t\tds: ds,\n\t}\n}", "func New(config *Config) Store {\n\treturn newStore(config)\n}", "func NewMemStorage() (storage *MemoryStorage) {\n\treturn &MemoryStorage{\n\t\tdata: make(map[string]string),\n\t\tmutex: &sync.RWMutex{},\n\t}\n}", "func New() *MemStats {\n\treturn &MemStats{\n\t\tvalues: map[string]int64{},\n\t}\n}", "func New() CStore {\n\treturn CStore{\n\t\tstore: make(map[string]string),\n\t}\n}", "func NewMemHashStore() HashStore {\n\treturn &memHashStore{}\n}", "func NewMemory(defaultExpiration time.Duration) *Memory {\n\tmem := &Memory{}\n\terr := mem.Connect(defaultExpiration)\n\tif err != nil {\n\t\tfs.Errorf(\"cache\", \"can't open ram connection: %v\", err)\n\t}\n\n\treturn mem\n}", "func NewMemoryStore() *MemoryStore {\n\tstore := MemoryStore{\n\t\tgames: make(map[string]*Game, 10),\n\t\tchallenges: make(map[string]*Challenge, 10),\n\t}\n\treturn &store\n}", "func NewMemoryStore(opts ...Option) es.DataStore {\n\tms := &memoryStore{\n\t\tallEvents: make(map[string][]*es.Event),\n\t\tallSnapshots: make(map[string]es.Aggregate),\n\t\tallAggregates: make(map[string]es.Aggregate),\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(ms)\n\t}\n\n\treturn ms\n}", "func New(hash []byte, store Store) Cache {\n\treturn Cache{\n\t\tStore: store,\n\t\tHash: hash,\n\t\tlog: logger.New(),\n\t}\n}", "func NewMemoryStorage() *MemoryStorage {\n return &MemoryStorage{tickets: make(map[string]*types.Ticket)}\n}", "func newStore(config *Config) *store {\n\treturn &store{\n\t\thashMap: hash.NewUnsafeHash(config.Capacity),\n\t\texpireHeap: newTimeHeap(config.Capacity),\n\t\texpireTimer: new(refreshTimer),\n\t}\n}", "func NewMemoryStore() *memoryStore {\n\treturn &memoryStore{\n\t\tairplanes: []Airplane{\n\t\t\t{\n\t\t\t\tID: 1,\n\t\t\t\tName: \"test\",\n\t\t\t},\n\t\t},\n\t}\n}", "func New() *Store {\n\treturn &Store{\n\t\tmu: sync.Mutex{},\n\t\tsess: make(map[string]*entities.Session),\n\t}\n}", "func NewMemory() Backend {\n\treturn &memory{\n\t\tblobs: make(map[Hash][]byte),\n\t\tmeta: make(map[string]metadata),\n\t}\n}", "func NewMemoryStorage() *MemoryStorage {\n\treturn &MemoryStorage{\n\t\t// When starting from scratch populate the list with a dummy entry at term zero.\n\t\tents: make([]Entry, 1),\n\t}\n}", "func NewMemory() *Memory {\r\n\treturn &Memory{\r\n\t\tmemory: map[int]uint64{},\r\n\t}\r\n}", "func New(redisHost, redisPassword string, dbindex, TTL int) (Store, error) {\n\treturn NewRedisStore(redisHost, redisPassword, dbindex, TTL)\n}", "func NewMemcacheStore(s ...string) Store {\n\tmc := memcache.New(s...)\n\n\treturn &mem{c: mc}\n}", "func NewStore() *Store {\n\treturn &Store{\n\t\topaStore: inmem.New(),\n\t}\n}", "func NewMemoryStore() Store {\n\treturn NewVFSStore(vfs.Memory())\n}", "func NewMemStorage() *MemStorage {\n\treturn &MemStorage{\n\t\ttufMeta: make(map[string][]*ver),\n\t\tkeys: make(map[string]map[string]*key),\n\t\tchecksums: make(map[string]map[string]ver),\n\t}\n}", "func NewMemoryStorage() *MemoryStorage {\n\treturn &MemoryStorage{\n\t\tmux: new(sync.RWMutex),\n\t\tentries: make(map[string]Entry),\n\t}\n}", "func NewMemStateStore() *MemStateStore {\n\treturn &MemStateStore{\n\t\tstates: make(map[string]string),\n\t\tvalueGenerator: CryptoValueGenerator{},\n\t}\n}", "func New(pool *redis.Pool) *Store {\n\treturn &Store{\n\t\tpool: pool,\n\t\tidPrefix: defaultIDPrefix,\n\t\turlPrefix: defaultURLPrefix,\n\t}\n}", "func NewMemStorage(n int, d time.Duration) *MemStorage {\n\treturn &MemStorage{\n\t\tkeepNumber: n,\n\t\tkeepDuration: d,\n\t}\n}", "func NewInmemStore() *InmemStore {\n\ti := &InmemStore{\n\t\tlogs: make(map[uint64]*Log),\n\t\tkv: make(map[string][]byte),\n\t\tkvInt: make(map[string]uint64),\n\t}\n\treturn i\n}", "func New(ctx context.Context, db *sql.DB, m map[string]string) (*Store, error) {\n\tstore := &Store{db: db}\n\terr := store.InitTable(ctx, m)\n\treturn store, err\n}", "func NewMemcache(client MemcacheClientInterface, options *Options) *MemcacheStore {\n\tif options == nil {\n\t\toptions = &Options{}\n\t}\n\n\treturn &MemcacheStore{\n\t\tclient: client,\n\t\toptions: options,\n\t}\n}", "func NewStore() Store {\n\tq := newTaskQueue()\n\theap.Init(q)\n\n\treturn &store{\n\t\tqueue: q,\n\t\tnodeFlags: make(Flags),\n\t\tpodListeners: make(podListeners),\n\t\tpodFlags: make(podFlags),\n\n\t\tpodTimeFlags: make(podTimeFlags),\n\t\tpodTimeIndexCache: make(podTimeIndexCache),\n\t}\n}", "func NewMemoryStore() *MemoryStore {\n\tplayer := &proto.Player{\n\t\tGUID: \"turdmongler\",\n\t\tUsername: \"tmongler\",\n\t\tMapGUID: \"some-guid\",\n\t\tXPos: 5,\n\t\tYPos: 7,\n\t\tHealth: 10,\n\t\tMaxHealth: 100,\n\t}\n\tplayerStore := []*proto.Player{player}\n\treturn &MemoryStore{playerStore}\n}", "func New(dir string) *Store {\n\treturn NewWithDB(\"\", badger.New(dir))\n}", "func New(cfg Config) (mp *Mempool, e error) {\n\tnameC := C.CString(eal.AllocObjectID(\"mempool.Mempool\"))\n\tdefer C.free(unsafe.Pointer(nameC))\n\n\tvar flags C.unsigned\n\tif cfg.SingleProducer {\n\t\tflags |= C.MEMPOOL_F_SP_PUT\n\t}\n\tif cfg.SingleConsumer {\n\t\tflags |= C.MEMPOOL_F_SC_GET\n\t}\n\n\tvar cacheSize int\n\tif !cfg.NoCache {\n\t\tcacheSize = ComputeCacheSize(cfg.Capacity)\n\t}\n\n\tc := C.rte_mempool_create(nameC, C.uint(cfg.Capacity), C.uint(cfg.ElementSize), C.uint(cacheSize),\n\t\tC.unsigned(cfg.PrivSize), nil, nil, nil, nil, C.int(cfg.Socket.ID()), flags)\n\tif c == nil {\n\t\treturn nil, eal.GetErrno()\n\t}\n\treturn (*Mempool)(c), nil\n}", "func New() *Store {\n\treturn &Store{\n\t\tingredient.NewStore(),\n\t\trecipe.NewStore(),\n\t}\n}", "func NewMemoryStorage() MemoryStorage {\n\treturn MemoryStorage{\n\t\tchecks: make(map[string]Job),\n\t\tmutex: sync.RWMutex{},\n\t}\n}", "func NewMemBook() (bookStore BookStore) {\n\treturn &MemBook{\n\t\tbooks: make(map[string]*models.Book),\n\t}\n}", "func New(_ string) (s *Store, err error) {\n\treturn &Store{xz.NewMap()}, nil\n}", "func New(cfg *types.Store, sub []byte) queue.Module {\r\n\tbs := drivers.NewBaseStore(cfg)\r\n\tvar subcfg subConfig\r\n\tif sub != nil {\r\n\t\ttypes.MustDecode(sub, &subcfg)\r\n\t}\r\n\tmavls := &Store{bs, &sync.Map{}, subcfg.EnableMavlPrefix, subcfg.EnableMVCC,\r\n\t\tsubcfg.EnableMavlPrune, subcfg.PruneHeight, subcfg.EnableMemTree, subcfg.EnableMemVal}\r\n\tmavls.enableMavlPrefix = subcfg.EnableMavlPrefix\r\n\tmavls.enableMVCC = subcfg.EnableMVCC\r\n\tmavls.enableMavlPrune = subcfg.EnableMavlPrune\r\n\tmavls.pruneHeight = subcfg.PruneHeight\r\n\tmavls.enableMemTree = subcfg.EnableMemTree\r\n\tmavls.enableMemVal = subcfg.EnableMemVal\r\n\tmavl.EnableMavlPrefix(mavls.enableMavlPrefix)\r\n\tmavl.EnableMVCC(mavls.enableMVCC)\r\n\tmavl.EnablePrune(mavls.enableMavlPrune)\r\n\tmavl.SetPruneHeight(int(mavls.pruneHeight))\r\n\tmavl.EnableMemTree(mavls.enableMemTree)\r\n\tmavl.EnableMemVal(mavls.enableMemVal)\r\n\tbs.SetChild(mavls)\r\n\treturn mavls\r\n}", "func New(provider storage.Provider) (*Store, error) {\n\tstore, err := provider.OpenStore(nameSpace)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open did anchor store: %w\", err)\n\t}\n\n\treturn &Store{\n\t\tstore: store,\n\t}, nil\n}", "func NewMemoryCellStore() (CellStore, error) {\n\tcs := &MemoryCellStore{\n\t\trows: make(map[string]*Row),\n\t}\n\treturn cs, nil\n}", "func NewMemory() *Memory {\n\treturn &Memory{}\n}", "func New(db *sqlite_db.Db) qfxdb.Store {\n\treturn sqliteStore{db}\n}", "func NewStore(p string) (Store, error) {\n\tp = path.Join(p, SQLiteDBName)\n\tdb, err := sql.Open(\"sqlite3\", fmt.Sprintf(\"file:%s?mode=ro\", p))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstmt, err := db.Prepare(\"select value from entries where key = ?\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcache, err := lru.New(DirCacheSize)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\taclCache, err := lru.New(AccessCacheSize)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &sqlStore{\n\t\tdb: db,\n\t\tstmt: stmt,\n\t\tcache: cache,\n\t\tacl: aclCache,\n\n\t\tusers: make(map[string]int),\n\t\tgroups: make(map[string]int),\n\t}, nil\n}", "func New(chromePerf anomalies.Store) (*store, error) {\n\tcache, err := lru.New(cacheSize)\n\tif err != nil {\n\t\treturn nil, skerr.Wrapf(err, \"Failed to create anomaly store cache.\")\n\t}\n\n\t// cleanup the lru cache periodically.\n\tgo func() {\n\t\tfor range time.Tick(cacheCleanupPeriod) {\n\t\t\tcleanupCache(cache)\n\t\t}\n\t}()\n\n\tret := &store{\n\t\tcache: cache,\n\t\tnumEntriesInCache: metrics2.GetInt64Metric(\"anomaly_store_num_entries_in_cache\"),\n\t\tChromePerf: chromePerf,\n\t}\n\treturn ret, nil\n}", "func New() (backends.Backend, error) {\n\treturn &inMemoryBackend{\n\t\tdata: make(map[string]string),\n\t}, nil\n}", "func NewMemory(params MemoryParams) *Memory {\n\tvar fs = afero.NewMemMapFs()\n\tvar tempFs = afero.NewMemMapFs()\n\n\treturn &Memory{\n\t\troot: params.root,\n\t\twebRoot: params.webRoot,\n\t\tfs: &afero.Afero{Fs: fs},\n\t\ttempFs: &afero.Afero{Fs: tempFs},\n\t}\n}", "func New(ctx context.Context, size int, ttl time.Duration) *Store {\n\ts := &Store{\n\t\trecords: make(map[interface{}]*record, size),\n\t\tmax: int64(ttl.Seconds()),\n\t\tlimit: 50,\n\t}\n\tticker := time.NewTicker(5 * time.Second)\n\n\tgo func() {\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\ts.gc()\n\t\t\t}\n\t\t}\n\t}()\n\treturn s\n}", "func New(tableName string, accessor Accessor) (*Store, error) {\n\tstore := &Store{\n\t\ttableName: tableName,\n\t\taccessor: accessor,\n\t}\n\n\treturn store, nil\n}", "func NewStore(mibStore smi.Store) (Store, error) {\n\treturn &store{\n\t\tscalars: make(map[string]*gosnmp.SnmpPDU),\n\t\tcolumns: make(map[string]*columnStore),\n\t\tmibStore: mibStore,\n\t}, nil\n}", "func New(prefixBucket model.DBBucket, cacheSize int, preallocate bool) model.MultisetStore {\n\treturn &multisetStore{\n\t\tshardID: staging.GenerateShardingID(),\n\t\tcache: lrucache.New(cacheSize, preallocate),\n\t\tbucket: prefixBucket.Bucket(bucketName),\n\t}\n}", "func New(ctx context.Context, log logger.Logger, db *db.Store, cache *cache.Cache) (*Store, error) { // nolint:gocognit\n\ts := &Store{\n\t\tlog: log,\n\t\tcache: cache,\n\t}\n\n\t// Set configuration\n\ts.setConfig()\n\n\tvar err error\n\n\tswitch s.typeStore {\n\tcase \"postgres\":\n\t\ts.store, err = postgres.New(ctx, db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase \"mongo\":\n\t\ts.store, err = mongo.New(ctx, db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase \"redis\":\n\t\ts.store, err = redis.New(ctx, db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase \"dgraph\":\n\t\ts.store, err = dgraph.New(ctx, db, log)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase \"leveldb\":\n\t\ts.store, err = leveldb.New(ctx, db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase \"badger\":\n\t\ts.store, err = badger.New(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase \"ram\":\n\t\tfallthrough\n\tdefault:\n\t\ts.store, err = ram.New(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tlog.Info(\"init linkStore\", field.Fields{\n\t\t\"db\": s.typeStore,\n\t})\n\n\treturn s, nil\n}", "func NewMemtable() *Memtable {\n\treturn &Memtable{}\n}", "func NewMemoryStorage() (*MemoryStorage, error) {\n\treturn &MemoryStorage{\n\t\tdata: new(sync.Map),\n\t}, nil\n}", "func NewMemFile(store *DataStore, path string, mtx *sync.RWMutex) *MemFile {\n\treturn &MemFile{\n\t\tstore: store,\n\t\tpath: path,\n\t\tmtx: mtx,\n\t}\n}", "func NewStore() *Store {\n\treturn &Store{}\n}", "func NewStore() *Store {\n\treturn &Store{}\n}", "func NewStore() *Store {\n\treturn &Store{}\n}" ]
[ "0.8351379", "0.8183977", "0.8082516", "0.76006484", "0.7484564", "0.74830467", "0.7418862", "0.7375718", "0.7306339", "0.72738653", "0.72706604", "0.72225034", "0.72098786", "0.7162066", "0.71599466", "0.71214986", "0.71214986", "0.7108652", "0.7102591", "0.7079366", "0.7070399", "0.7054936", "0.7052197", "0.7039273", "0.70103824", "0.69908464", "0.6958568", "0.6940622", "0.69194204", "0.68996954", "0.6855743", "0.68499345", "0.6808143", "0.6784097", "0.676823", "0.6762172", "0.6759811", "0.67423457", "0.67354476", "0.67285794", "0.6723862", "0.6716993", "0.6716296", "0.66977906", "0.66840464", "0.66803855", "0.6669686", "0.66160625", "0.6608672", "0.6604589", "0.660041", "0.65927756", "0.6586005", "0.6572386", "0.65681016", "0.6567923", "0.6563111", "0.655384", "0.6552845", "0.6522244", "0.65183663", "0.65167916", "0.650981", "0.650919", "0.65067285", "0.64905757", "0.6488165", "0.6465787", "0.6424036", "0.6421529", "0.64149165", "0.6408258", "0.64020735", "0.6390544", "0.63904595", "0.6377165", "0.6348687", "0.634799", "0.63465536", "0.63401276", "0.63385695", "0.63333875", "0.6333201", "0.63319296", "0.6331468", "0.6327761", "0.6319162", "0.6318873", "0.6312405", "0.63052475", "0.6304626", "0.6288878", "0.62692285", "0.6268744", "0.6265651", "0.6264206", "0.6255616", "0.62516344", "0.62516344", "0.62516344" ]
0.81686974
2
SessionKey returns the most recent sessionKey in MemStore.
func (ms *MemStore) SessionKey() string { return ms.sessionKey }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (a *Account) SessionKey() *big.Int {\n\tif a.sessionKey == nil {\n\t\ta.sessionKey, _ = new(big.Int).SetString(a.SessionKeyStr, 16)\n\t}\n\n\treturn a.sessionKey\n}", "func (session *Session) GetSessionKey() string {\n\treturn session.id.String()\n}", "func SessionStoreKey() string {\n\treturn app.SessionStoreKey\n}", "func (st *MemSessionStore) SessionID() string {\n\treturn (*session.MemSessionStore)(st).SessionID(context.Background())\n}", "func (s *session) getKey() string {\n\treturn s.uuid\n}", "func (st *MemSessionStore) SessionID() string {\n\treturn st.sid\n}", "func (dh *DiffieHelman) SessionKey() ([sha256.Size]byte, error) {\n\tif dh.B == big.NewInt(0) {\n\t\tvar k [sha256.Size]byte\n\t\treturn k, errors.New(\"no second public key available\")\n\t}\n\n\tsessionKey := big.NewInt(0)\n\t// Having your secret set to -1 means your public key is just 0.\n\t// (This is not a mathematical fact; we've just used -1 as a beacon here.)\n\tif dh.a.Cmp(big.NewInt(-1)) != 0 {\n\t\tsessionKey = big.NewInt(0).Exp(dh.B, dh.a, dh.p)\n\t}\n\n\tsessionKeyBytes := sessionKey.Bytes()\n\n\treturn sha256.Sum256(sessionKeyBytes), nil\n}", "func SessionID() int64 { return time.Now().UnixNano() }", "func (st *MemSessionStore) Get(key interface{}) interface{} {\n\treturn (*session.MemSessionStore)(st).Get(context.Background(), key)\n}", "func (c *chat) key() int64 {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\t// generates new possible key value\n\tvar key = time.Now().UnixNano()\n\n\t// generated key become actual if the previous key is absent\n\tif c.prev == 0 {\n\t\tc.prev = key\n\t\t// returns actual key\n\t\treturn c.prev\n\t}\n\n\t// calculates minimum next possible key value\n\tc.prev = c.prev + c.latency\n\n\t// generated key become actual if generated key greater than the minimum possible key\n\tif key > c.prev {\n\t\tc.prev = key\n\t}\n\n\t// returns actual key\n\treturn c.prev\n}", "func (stateID StateID) Key() string {\n\treturn string(stateID.LastAppHash)\n}", "func (ms *MemStore) GetSessionKey(hash string) (\n\tjson, privKey string,\n\terr error,\n) {\n\tsk, ok := ms.sessionKeys[hash]\n\tif !ok {\n\t\treturn \"\", \"\", log.Error(session.ErrNoKeyEntry)\n\t}\n\treturn sk.json, sk.privKey, nil\n}", "func (cache *LRUCache) GetMostRecentKey() (string, bool) {\n\tif len(cache.hash) == 0 {\n\t\treturn \"\", false\n\t}\n\n\treturn cache.curr.key, true\n}", "func (s *Store) GetSessionID() []byte {\n\treturn s.sessionID\n}", "func (ms memstore) Get(key string) Sessiondata {\n\tvar (\n\t\tn, e time.Time\n\t)\n\tms.lock.RLock()\n\tif v, ok := ms.store[key]; ok {\n\t\tms.lock.RUnlock()\n\t\tn = time.Now()\n\t\te = v[expiresTS].(time.Time)\n\t\t// timeout\n\t\tif n.After(e) {\n\t\t\tms.lock.Lock()\n\t\t\tdelete(ms.store, key)\n\t\t\tms.lock.Unlock()\n\t\t\treturn nil\n\t\t}\n\t\treturn v\n\t}\n\tms.lock.RUnlock()\n\treturn nil\n}", "func (ms *MemStore) GetMessageKey(\n\tsessionKey string,\n\tsender bool,\n\tmsgIndex uint64,\n) (*[64]byte, error) {\n\ts, ok := ms.sessions[sessionKey]\n\tif !ok {\n\t\treturn nil, log.Errorf(\"memstore: no session found for %s\", sessionKey)\n\t}\n\tif msgIndex >= uint64(len(s.send)) {\n\t\treturn nil, log.Error(\"memstore: message index out of bounds\")\n\t}\n\tvar key string\n\tvar party string\n\tif sender {\n\t\tkey = s.send[msgIndex]\n\t\tparty = \"sender\"\n\t} else {\n\t\tkey = s.recv[msgIndex]\n\t\tparty = \"recipient\"\n\t}\n\t// make sure key wasn't used yet\n\tif key == \"\" {\n\t\treturn nil, log.Error(session.ErrMessageKeyUsed)\n\t}\n\t// decode key\n\tvar messageKey [64]byte\n\tk, err := base64.Decode(key)\n\tif err != nil {\n\t\treturn nil,\n\t\t\tlog.Errorf(\"memstore: cannot decode %s key for %s\", party,\n\t\t\t\tsessionKey)\n\t}\n\tif copy(messageKey[:], k) != 64 {\n\t\treturn nil,\n\t\t\tlog.Errorf(\"memstore: %s key for %s has wrong length\", party,\n\t\t\t\tsessionKey)\n\t}\n\treturn &messageKey, nil\n}", "func (st *SessionStoreMySQL) SessionID() string {\n\treturn st.sid\n}", "func (cache *LRUCache) GetMostRecentKey() (string, bool) {\n\tif cache.listofMostRecent.head == nil {\n\t\treturn \"\", false\n\t}\n\treturn cache.listofMostRecent.head.key, true\n}", "func (m *MemoryStorer) Get(key string) (value string, err error) {\n\tm.mut.RLock()\n\tsession, ok := m.sessions[key]\n\tm.mut.RUnlock()\n\tif !ok {\n\t\treturn \"\", errNoSession{}\n\t}\n\n\treturn session.value, nil\n}", "func (c *Client) SessionKey() []byte {\n\treturn c.sessionSecret\n}", "func getSessionTicketKey() [32]byte {\n\tvar key [32]byte\n\tkeySlice, err := ioutil.ReadFile(\"session_ticket_key\")\n\tif err != nil {\n\t\tkeySlice = make([]byte, 32)\n\t\tn, err := rand.Read(keySlice)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Unable to generate session ticket key: %v\", err)\n\t\t\treturn key\n\t\t}\n\t\tif n != 32 {\n\t\t\tlog.Errorf(\"Generated unexpected length of random data %d\", n)\n\t\t\treturn key\n\t\t}\n\t\terr = ioutil.WriteFile(\"session_ticket_key\", keySlice, 0600)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Unable to save session_ticket_key: %v\", err)\n\t\t} else {\n\t\t\tlog.Debug(\"Saved new session_ticket_key\")\n\t\t}\n\t}\n\tcopy(key[:], keySlice)\n\treturn key\n}", "func (st *MemSessionStore) Get(key interface{}) interface{} {\n\tst.lock.RLock()\n\tdefer st.lock.RUnlock()\n\tif v, ok := st.value[key]; ok {\n\t\treturn v\n\t}\n\treturn nil\n}", "func (s *streamKey) lastID() string {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\treturn s.lastIDUnlocked()\n}", "func (ms *MemStore) GetRootKeyHash(sessionKey string) (*[64]byte, error) {\n\ts, ok := ms.sessions[sessionKey]\n\tif !ok {\n\t\treturn nil, log.Errorf(\"memstore: no session found for %s\", sessionKey)\n\t}\n\t// decode root key hash\n\tvar hash [64]byte\n\tk, err := base64.Decode(s.rootKeyHash)\n\tif err != nil {\n\t\treturn nil, log.Error(\"memstore: cannot decode root key hash\")\n\t}\n\tif copy(hash[:], k) != 64 {\n\t\treturn nil, log.Errorf(\"memstore: root key hash has wrong length\")\n\t}\n\treturn &hash, nil\n}", "func (ms *MemStore) GetChainKey(sessionKey string) (*[32]byte, error) {\n\ts, ok := ms.sessions[sessionKey]\n\tif !ok {\n\t\treturn nil, log.Errorf(\"memstore: no session found for %s\", sessionKey)\n\t}\n\t// decode chain key\n\tvar key [32]byte\n\tk, err := base64.Decode(s.chainKey)\n\tif err != nil {\n\t\treturn nil, log.Error(\"memstore: cannot decode chain key\")\n\t}\n\tif copy(key[:], k) != 32 {\n\t\treturn nil, log.Errorf(\"memstore: chain key has wrong length\")\n\t}\n\treturn &key, nil\n}", "func GenerateSessionKey() (string, error) {\n\tkey := make([]byte, 64)\n\n\t_, err := rand.Read(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(key), nil\n}", "func (sid SessionID) getRedisKey() string {\n\t//convert the SessionID to a string and add the prefix \"sid:\" to keep\n\t//SessionID keys separate from other keys that might end up in this\n\t//redis instance\n\treturn \"sid:\" + sid.String()\n}", "func (s *MemorySession) SessionID() string {\n\treturn s.sid\n}", "func (s *inMemorySessionStore) Get(id string) *USSDSession {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\te := s.store[id]\n\tif e != nil {\n\t\ts.gcList.MoveToFront(e)\n\t\tif session, ok := e.Value.(*USSDSession); ok {\n\t\t\treturn session\n\t\t} else {\n\t\t\tpanic(\"Data Store corrupted: non-string key value in garbage collector\")\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn nil\n}", "func (m *RedisStore) Get(key interface{}) interface{} {\n\tm.lock.RLock()\n\tdefer m.lock.RUnlock()\n\tif v, ok := m.sessionData[key]; ok {\n\t\treturn v\n\t}\n\treturn nil\n}", "func GenerateSessionKey(user_name string, j aqua.Aide) (token string, err error) {\n\tvar (\n\t\tConn *gorm.DB\n\t\t//token string\n\t\tsessionData []interface{}\n\t)\n\tif Conn, err = dbConn(); err == nil {\n\t\tif token, err = crypt.GenerateRandomString(32); err == nil {\n\t\t\texp_time := time.Now().Add(time.Minute * 30)\n\t\t\tinsertSession := `insert into user_session (\n\t\t\tsession_key, fk_user_name,\n\t\t\tlocation, expiry_time) values(?, ?, ?, ? )`\n\t\t\tsessionData = append(sessionData, token, user_name, \"bengaluru\", exp_time)\n\t\t\tif err = Conn.Debug().Exec(insertSession, sessionData...).Error; err == nil {\n\t\t\t\tj.Response.Header().Add(\"session-key\", token)\n\t\t\t\tj.Response.Header().Add(\"connection\", \"keep-alive\")\n\t\t\t\tfmt.Println(\"err\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Println(\"session not generated\")\n\t\t}\n\t} else {\n\t\tfmt.Println(\"connection not established\")\n\t}\n\treturn\n}", "func (m *SessionManager) Get(key string) (session Session) {\n\tstmt := Sessions.Select().Where(Sessions.C(\"key\").Equals(key))\n\tm.conn.Query(stmt, &session)\n\treturn\n}", "func (c *conn) Key() string {\n\t// We don't need to lock because the key never changes after creation\n\treturn c.key.String()\n}", "func (s *SessionStore) Get(key interface{}) interface{} {\n\treturn s.session.Values[key]\n}", "func SessionByKey(key string) *Session {\n\tvar data member.SessionData\n\tif scol.Find(bson.M{\"key\": key}).One(&data) != nil {\n\t\treturn nil\n\t}\n\treturn &Session{data: &data}\n}", "func (iter *dbCacheIterator) Key() []byte {\n\t// Nothing to return if iterator is exhausted.\n\tif iter.currentIter == nil {\n\t\treturn nil\n\t}\n\n\treturn iter.currentIter.Key()\n}", "func (rs *Store) SessionID(ctx context.Context) string {\n\treturn rs.sid\n}", "func (mci *XMCacheIterator) Key() []byte {\n\tif mci.err != nil || mci.dir == dirReleased {\n\t\treturn nil\n\t}\n\tswitch mci.index {\n\tcase 0, 1:\n\t\treturn mci.iters[mci.index].Key()\n\tcase 2:\n\t\tif mci.mc.isPenetrate {\n\t\t\treturn mci.mIter.Key()\n\t\t}\n\t\treturn nil\n\t}\n\treturn nil\n}", "func (m *KeyUint) Key() driver.Value { return driver.Value(m.ID) }", "func (sess Session) Get(key string) string {\n\treturn sess[key]\n}", "func clientSessionCacheKey(config *tls.Config) string {\n\treturn config.ServerName\n}", "func (ctx *Context) Session(key interface{}) interface{} {\r\n\treturn ctx.CruSession.Get(key)\r\n}", "func (p *Provider) SessionID() string {\n\tp.sessionLock.RLock()\n\tdefer p.sessionLock.RUnlock()\n\treturn p.sessionID\n}", "func (_Univ2 *Univ2Session) KLast() (*big.Int, error) {\n\treturn _Univ2.Contract.KLast(&_Univ2.CallOpts)\n}", "func (input *BeegoInput) Session(key interface{}) interface{} {\n\treturn input.CruSession.Get(nil, key)\n}", "func (n *lnode) key() []byte {\n\tbuf := (*[maxAllocSize]byte)(unsafe.Pointer(n))\n\treturn buf[n.pos : n.pos+n.ksize]\n}", "func (ms *MemStore) GetSessionState(sessionStateKey string) (\n\t*session.State,\n\terror,\n) {\n\treturn ms.sessionStates[sessionStateKey], nil\n}", "func (it *Iter) Key() byte { return it.top().key }", "func (m *RegistryKeyState) GetKey()(*string) {\n return m.key\n}", "func (xmlmc *XmlmcInstStruct) GetSessionID() string {\n\treturn xmlmc.sessionID\n}", "func GetSessionToken (strOID string) (string) {\n\thasher := sha256.New()\n\thasher.Write([]byte(strOID + time.Now().String()))\n\treturn EncodeSegment(hasher.Sum(nil))\n}", "func GetStoreIdentKey() []byte {\n\treturn storeIdentKey\n}", "func (self *Store) NextPk() []byte {\n\tself.mu.Lock()\n\tself.mu.Unlock()\n\treturn nil\n}", "func (image *image) SessionID() int32 {\n\treturn image.sessionID\n}", "func (c *client) getSessionId() string {\n\tc.acquireWriter()\n\tdefer c.releaseWriter()\n\treturn c.sessId\n}", "func (_Univ2 *Univ2CallerSession) KLast() (*big.Int, error) {\n\treturn _Univ2.Contract.KLast(&_Univ2.CallOpts)\n}", "func Get(redisdb *redis.Client, sessionID, key string) (string, error) {\n\n\tvalue, err := redisdb.HGet(sessionID, key).Result()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to read %s from session: %s\", key, err.Error())\n\t}\n\n\treturn value, nil\n}", "func (c *FakeZkConn) SessionID() int64 {\n\tc.history.addToHistory(\"SessionID\")\n\treturn int64(0)\n}", "func (c *Container) Key() string {\n\tc.Lock()\n\tdefer c.Unlock()\n\treturn c.ID\n}", "func SessionID(ctx *context.Context) *string {\n\tsessionID := (*ctx).Value(KeySessionID)\n\tif sessionID != nil {\n\t\tv := sessionID.(string)\n\t\treturn &v\n\t}\n\treturn nil\n}", "func (m *MemAdmin) Key(_ string) (key string, err error) {\n\treturn m.key, nil\n}", "func (itr *Iterator) Key() []byte {\n\treturn retrieveAppKey(itr.Iterator.Key())\n}", "func SessionId() string {\n\tid := RandString(32)\n\t//TODO; this isnt \n\treturn id\n}", "func (u User) Key() interface{} {\n\treturn u.ID\n}", "func (entry *LogEntry) GetKey() []byte {\n\treturn entry.getWriteRequest().GetKey()\n}", "func (pder *MemSessionProvider) GetSession(sid string) (Session, error) {\r\n\tpder.lock.RLock()\r\n\tdefer pder.lock.RUnlock()\r\n\r\n\tif element, ok := pder.sessions[sid]; ok {\r\n\t\tsw := element.Value.(Session)\r\n\t\tif sw == nil {\r\n\t\t\treturn nil, nil\r\n\t\t}\r\n\t\tattributes := sw.Attributes().(*MemSessionAttributes)\r\n\t\tif attributes != nil {\r\n\t\t\tattributes.timeAccessed = time.Now()\r\n\t\t}\r\n\t\treturn sw, nil\r\n\t} else {\r\n\t\treturn nil, nil\r\n\t}\r\n}", "func (s UserSet) ComputeSessionToken(sid string) string {\n\tres := s.Collection().Call(\"ComputeSessionToken\", sid)\n\tresTyped, _ := res.(string)\n\treturn resTyped\n}", "func (m *MacOSSoftwareUpdateStateSummary) GetProductKey()(*string) {\n val, err := m.GetBackingStore().Get(\"productKey\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (c *Counter) GetKey() string {\n\treturn c.key\n}", "func (c Node) GetKey() string {\n\treturn c.key\n}", "func getSessionID(appPath string) (string, error) {\n\tsettings, err := readDevelopmentSettings(appPath)\n\n\tif err != nil {\n\t\tsettings, err = getDefaultDevelopmentSettings()\n\n\t\tif err != nil {\n\t\t\tlog.Println(\"Couldn't create new development settings.\")\n\t\t\treturn \"\", err\n\t\t}\n\n\t\terr = writeDevelopmentSettings(appPath, settings)\n\n\t\tif err != nil {\n\t\t\tlog.Println(\"Could not save new development settings file.\")\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\treturn settings.SessionID, nil\n}", "func (store *SessionCookieStore) Save(sess Session) (key string, err error) {\n\tbuf := bufPool.Get().(*bytes.Buffer)\n\tdefer func() {\n\t\tbuf.Reset()\n\t\tbufPool.Put(buf)\n\t}()\n\tif err := codec.NewEncoder(buf, codecHandler).Encode(sess); err != nil {\n\t\treturn \"\", err\n\t}\n\tencrypted, err := store.encrypt(buf.Bytes())\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn store.encode(store.sign(encrypted)), nil\n}", "func (f *Factor) Key() string { return f.ID }", "func (symmetricKey *SymmetricKey) GetKey() []byte {\n\tsymmetricKey.mutex.RLock()\n\tdefer symmetricKey.mutex.RUnlock()\n\treturn symmetricKey.SymmetricKey\n}", "func (s *State) RootKey() session.RootKeyable {\n\treturn s.rootKey\n}", "func (s *Store) Get(clientID string) (*entities.Session, error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\treturn s.sess[clientID], nil\n}", "func (st *RedBlackBST) Max() Key {\n\tif st.IsEmpty() {\n\t\tpanic(\"call Max on empty RedBlackbst\")\n\t}\n\treturn st.max(st.root).key\n}", "func Next() int64 {\n\tkeygen.Lock()\n\tkey := keygen.random.Int63()\n\tkeygen.Unlock()\n\treturn key\n}", "func getSessionByKey(key string) *user.SessionState {\n\t// here goes our logic to check if passed API key is valid and appropriate key session can be retrieved\n\n\t// perform auth (only one token \"abc\" is allowed)\n\t// Here you add code to query your database\n\tif key != \"abc\" {\n\t\treturn nil\n\t}\n\n\t// return session\n\treturn &user.SessionState{\n\t\tOrgID: \"default\",\n\t\tAlias: \"abc-session\",\n\t}\n}", "func (m *MemoryCache) Get(id string) (*Session, error) {\n\tm.mx.RLock()\n\ts, ok := m.store[id]\n\tif !ok {\n\t\tm.mx.RUnlock()\n\t\treturn nil, ErrNotFound\n\t}\n\tif !s.Valid() {\n\t\t// We have to upgrade the lock. There's no harm in a yield between.\n\t\tm.mx.RUnlock()\n\t\tm.mx.Lock()\n\t\tdelete(m.store, id)\n\t\tm.mx.Unlock()\n\t\treturn nil, ErrExpired\n\t}\n\tm.mx.RUnlock()\n\treturn s, nil\n}", "func (i *TelemetryStorage) GetSessionLength() int64 {\n\treturn atomic.LoadInt64(&i.records.session)\n}", "func SessionID(ctx context.Context) string {\n\ts, ok := ctx.Value(sessionKey).(*Session)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\treturn s.id\n}", "func (s *SessionTrackerV1) GetSessionID() string {\n\treturn s.Spec.SessionID\n}", "func (s *BoltState) GetExecSession(id string) (string, error) {\n\tif !s.valid {\n\t\treturn \"\", define.ErrDBClosed\n\t}\n\n\tif id == \"\" {\n\t\treturn \"\", define.ErrEmptyID\n\t}\n\n\tdb, err := s.getDBCon()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer s.deferredCloseDBCon(db)\n\n\tctrID := \"\"\n\terr = db.View(func(tx *bolt.Tx) error {\n\t\texecBucket, err := getExecBucket(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tctr := execBucket.Get([]byte(id))\n\t\tif ctr == nil {\n\t\t\treturn fmt.Errorf(\"no exec session with ID %s found: %w\", id, define.ErrNoSuchExecSession)\n\t\t}\n\t\tctrID = string(ctr)\n\t\treturn nil\n\t})\n\treturn ctrID, err\n}", "func (s *Connection) GetKey() ConnectionName {\n\tif s == nil {\n\t\treturn \"\"\n\t}\n\treturn s.Key\n}", "func (ips *IPAMState) GetKey() string {\n\treturn ips.IPAMPolicy.GetKey()\n}", "func (s *RedisQueue) Key() string {\n\treturn s.key\n}", "func (symmetricKey *SymmetricKey) GetKeyID() string {\n\tsymmetricKey.mutex.RLock()\n\tdefer symmetricKey.mutex.RUnlock()\n\treturn symmetricKey.KeyID\n}", "func (f binaryEqualsFunc) key() Key {\n\treturn f.k\n}", "func getTokenKey(userID interface{}) string {\n\treturn utils.RedisKey(\"TOKEN\", \"getToken\", userID)\n}", "func (st *State) Session(id string) *cache.Session {\n\tfor _, s := range st.Sessions() {\n\t\tif s.ID() == id {\n\t\t\treturn s\n\t\t}\n\t}\n\treturn nil\n}", "func (lmem *lockedMemRepo) Get(name string) (types.KeyInfo, error) {\n\tif err := lmem.checkToken(); err != nil {\n\t\treturn types.KeyInfo{}, err\n\t}\n\tlmem.RLock()\n\tdefer lmem.RUnlock()\n\n\tkey, ok := lmem.mem.keystore[name]\n\tif !ok {\n\t\treturn types.KeyInfo{}, xerrors.Errorf(\"getting key '%s': %w\", name, types.ErrKeyInfoNotFound)\n\t}\n\treturn key, nil\n}", "func (s *Store) getSessionID(c *fiber.Ctx) string {\n\tid := c.Cookies(s.sessionName)\n\tif len(id) > 0 {\n\t\treturn utils.CopyString(id)\n\t}\n\n\tif s.source == SourceHeader {\n\t\tid = string(c.Request().Header.Peek(s.sessionName))\n\t\tif len(id) > 0 {\n\t\t\treturn id\n\t\t}\n\t}\n\n\tif s.source == SourceURLQuery {\n\t\tid = c.Query(s.sessionName)\n\t\tif len(id) > 0 {\n\t\t\treturn utils.CopyString(id)\n\t\t}\n\t}\n\n\treturn \"\"\n}", "func (m *KeyValue) GetKey()(*string) {\n return m.key\n}", "func getSessionId() string {\n signByte := []byte(time.Now().String())\n hash := md5.New()\n hash.Write(signByte)\n return hex.EncodeToString(hash.Sum(nil))\n}", "func (s *MemorySession) Get(key string) (interface{}, error) {\n\tif value, ok := s.data[key]; ok {\n\t\treturn value, nil\n\t}\n\treturn nil, fmt.Errorf(\"key %q in session (id %s) not found\", key, s.sid)\n}", "func (st *MemStorage) GetKey(gun, role string) (algorithm string, public []byte, err error) {\n\t// no need for lock. It's ok to return nil if an update\n\t// wasn't observed\n\tg, ok := st.keys[gun]\n\tif !ok {\n\t\treturn \"\", nil, &ErrNoKey{gun: gun}\n\t}\n\tk, ok := g[role]\n\tif !ok {\n\t\treturn \"\", nil, &ErrNoKey{gun: gun}\n\t}\n\n\treturn k.algorithm, k.public, nil\n}", "func (nc *NetClient) SessionID() string {\n\treturn nc.Session.ID\n}", "func GetIterationKey(clientStore sdk.KVStore, height exported.Height) []byte {\n\tkey := IterationKey(height)\n\treturn clientStore.Get(key)\n}", "func KeySession(priv, pub []byte) (*Session, bool) {\n\tprivKey, err := public.UnmarshalPrivate(priv)\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\tdefer privKey.Zero()\n\n\tpubKey, err := public.UnmarshalPublic(pub)\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\n\tshared := public.KeyExchange(privKey, pubKey)\n\treturn &Session{shared: shared}, true\n}" ]
[ "0.66067576", "0.6544803", "0.6505307", "0.64512503", "0.6407087", "0.6332514", "0.62486035", "0.61219746", "0.606997", "0.6033466", "0.6021937", "0.6005555", "0.59739584", "0.5952178", "0.59406084", "0.593616", "0.5876714", "0.5831891", "0.58072", "0.5770329", "0.56571907", "0.5640494", "0.5622952", "0.56096035", "0.55640864", "0.554677", "0.5493878", "0.5479823", "0.5468491", "0.54653335", "0.54612416", "0.54611504", "0.5429929", "0.54177743", "0.5416482", "0.5413051", "0.5384917", "0.53732485", "0.53583336", "0.53528774", "0.5329778", "0.532653", "0.5324067", "0.5319978", "0.53119093", "0.53110176", "0.52975136", "0.5283552", "0.5277436", "0.52718574", "0.5266444", "0.5262129", "0.5256869", "0.5252625", "0.5251263", "0.5246236", "0.5245893", "0.52415687", "0.52373534", "0.52234715", "0.5208509", "0.5181885", "0.51798296", "0.51640314", "0.51573837", "0.51433694", "0.51349473", "0.51219714", "0.51204866", "0.511681", "0.51145774", "0.5112477", "0.51086146", "0.5095534", "0.5093477", "0.5082772", "0.508216", "0.50813895", "0.50804114", "0.50587595", "0.50581735", "0.50536615", "0.5053117", "0.5049288", "0.5045474", "0.50436026", "0.50418967", "0.50383866", "0.50370646", "0.5036403", "0.5033205", "0.50276923", "0.50244623", "0.502237", "0.50194174", "0.501511", "0.5012849", "0.50064045", "0.50029254", "0.50011146" ]
0.7522756
0
AddPrivateKeyEntry adds private KeyEntry to memory store.
func (ms *MemStore) AddPrivateKeyEntry(ke *uid.KeyEntry) { ms.privateKeyEntryMap[ke.HASH] = ke }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *Service) AddPrivateKey(keyID string, privateKey crypto.PrivateKey) error {\n\tif _, ok := s.keys[keyID]; ok {\n\t\ts.log.Error(\"The specified key ID is already in use\", \"keyID\", keyID)\n\t\treturn signingkeys.ErrSigningKeyAlreadyExists.Errorf(\"The specified key ID is already in use: %s\", keyID)\n\t}\n\ts.keys[keyID] = privateKey.(crypto.Signer)\n\treturn nil\n}", "func (ks *KeyStore) Add(privateKey *rsa.PrivateKey, kid string) {\n\tks.mu.Lock()\n\tdefer ks.mu.Unlock()\n\n\tks.store[kid] = privateKey\n}", "func (keyDB *KeyDB) AddPrivateKeyInit(\n\tki *uid.KeyInit,\n\tpubKeyHash, sigPubKey, privateKey, serverSignature string,\n) error {\n\t_, err := keyDB.addPrivateKeyInitQuery.Exec(\n\t\tki.SigKeyHash(),\n\t\tpubKeyHash,\n\t\tki.JSON(),\n\t\tsigPubKey,\n\t\tprivateKey,\n\t\tserverSignature,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (ms *MemStore) AddPublicKeyEntry(identity string, ke *uid.KeyEntry) {\n\tms.publicKeyEntryMap[identity] = ke\n}", "func (ms *MemStore) GetPrivateKeyEntry(pubKeyHash string) (*uid.KeyEntry, error) {\n\tke, ok := ms.privateKeyEntryMap[pubKeyHash]\n\tif !ok {\n\t\treturn nil, log.Error(session.ErrNoKeyEntry)\n\t}\n\treturn ke, nil\n}", "func (keyDB *KeyDB) AddPrivateUIDReply(\n\tmsg *uid.Message,\n\tmsgReply *uid.MessageReply,\n) error {\n\t_, err := keyDB.addPrivateUIDReplyQuery.Exec(msgReply.JSON(), msg.JSON())\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (cache *Cache) AddEntry (path string) *FilePrint {\n ent, ok := cache.FilePrints[path]\n if ! ok {\n ent = new(FilePrint)\n ent.Local.Changed = true\n ent.Remote.Changed = true\n cache.FilePrints[path] = ent\n }\n return ent\n}", "func (o *TppCertificateParams) SetPrivateKey(v string) {\n\to.PrivateKey = v\n}", "func (r *extendedKeyring) Add(key agent.AddedKey) error {\n\t// Figure out what key type we're trying to inject\n\tswitch key.PrivateKey.(type) {\n\tcase *rsa.PrivateKey:\n\t\t// Load the injected key\n\t\tdata := &pem.Block{\n\t\t\tType: \"RSA PRIVATE KEY\",\n\t\t\tBytes: x509.MarshalPKCS1PrivateKey(key.PrivateKey.(*rsa.PrivateKey)),\n\t\t}\n\n\t\t// Ensure the key doesn't exist\n\t\tos.Remove(r.targetKeyLocation)\n\n\t\t// Write the key out to disk\n\t\tvar file, err = os.Create(r.targetKeyLocation)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"\\nssh_agent_download: Could not create key file\", err.Error())\n\t\t}\n\t\tdefer file.Close() // Ensure we close the file later\n\n\t\t// Secure before writing\n\t\t// Note: Technically someone could write in here before we do this\n\t\tos.Chmod(r.targetKeyLocation, 0400)\n\n\t\t// Dump the (un-encrypted) key into this file\n\t\tpem.Encode(file, data)\n\n\t\t// Let the keyboard monkey know\n\t\tfmt.Printf(\"ssh_agent_download: saved key to %s\\n\", r.targetKeyLocation)\n\n\t// Let the user know this won't work\n\tdefault:\n\t\tlog.Fatal(\"ssh_agent_download: unsupported key type %T\", key.PrivateKey)\n\t}\n\n\treturn nil\n}", "func (o *PipelineSshKeyPairAllOf) SetPrivateKey(v string) {\n\to.PrivateKey = &v\n}", "func (o SslCertificateSelfManagedSslCertificateOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SslCertificateSelfManagedSslCertificate) *string { return v.PrivateKey }).(pulumi.StringPtrOutput)\n}", "func (wt *Wallet) ImportPrivateKey(scope waddrmgr.KeyScope, wif *utils.WIF) (string, error) {\n\n\tmanager, err := wt.Manager.FetchScopedKeyManager(scope)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Attempt to import private key into wallet.\n\tvar addr types.Address\n\terr = walletdb.Update(wt.db, func(tx walletdb.ReadWriteTx) error {\n\t\taddrMgrNs := tx.ReadWriteBucket(waddrmgrNamespaceKey)\n\t\tmaddr, err := manager.ImportPrivateKey(addrMgrNs, wif)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\taddr = maddr.Address()\n\t\t_, err = manager.AccountProperties(\n\t\t\taddrMgrNs, waddrmgr.ImportedAddrAccount,\n\t\t)\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 \"\", err\n\t}\n\taddrStr := addr.Encode()\n\tlog.Trace(\"ImportPrivateKey succ\", \"address\", addrStr)\n\n\t// Return the payment address string of the imported private key.\n\treturn addrStr, nil\n}", "func (a *Account) GetPrivateKey() crypto.PrivateKey { return a.key }", "func (kc *Keychain) Add(key *crypto.PublicKeySECP256K1R) {\n\taddr := key.Address()\n\tkc.Addrs.Add(addr)\n}", "func (ms *MemStore) AddSessionKey(\n\thash, json, privKey string,\n\tcleanupTime uint64,\n) error {\n\tms.sessionKeys[hash] = &sessionKey{\n\t\tjson: json,\n\t\tprivKey: privKey,\n\t\tcleanupTime: cleanupTime,\n\t}\n\treturn nil\n}", "func PrivateKeyFile(usage Usage, version scrypto.KeyVersion) string {\n\treturn fmt.Sprintf(\"%s-v%d.key\", usage, version)\n}", "func (o *SecurityCertificateCollectionGetParams) SetPrivateKey(privateKey *string) {\n\to.PrivateKey = privateKey\n}", "func createPrivateKey() {\n\tnewPrivateKey, err := rsa.GenerateKey(rand.Reader, KEY_BITS)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to generate private key: %s\", err)\n\t}\n\n\tprivateKey = newPrivateKey\n\tkeyOut, err := os.OpenFile(PrivateKeyFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to open %s for writing: %s\", PrivateKeyFile, err)\n\t}\n\tif err := pem.Encode(keyOut, &pem.Block{Type: PEM_HEADER_PRIVATE_KEY, Bytes: x509.MarshalPKCS1PrivateKey(privateKey)}); err != nil {\n\t\tlog.Fatalf(\"Unable to PEM encode private key: %s\", err)\n\t}\n\tkeyOut.Close()\n\tlog.Printf(\"Wrote private key to %s\", PrivateKeyFile)\n}", "func ExportPrivateKey(key *rsa.PrivateKey) []byte {\n\tkeyBytes := x509.MarshalPKCS1PrivateKey(key)\n\treturn pem.EncodeToMemory(\n\t\t&pem.Block{\n\t\t\tType: \"RSA PRIVATE KEY\",\n\t\t\tBytes: keyBytes,\n\t\t},\n\t)\n}", "func (d *DocsCrypto) ExportPrivate(out io.Writer) error {\n\td.Info(\"Exporting private key\")\n\tif err := pem.Encode(out, &pem.Block{\n\t\tType: \"PRIVATE KEY\",\n\t\tBytes: x509.MarshalPKCS1PrivateKey(d.GetPrivate()),\n\t}); err != nil {\n\t\td.Error(err)\n\t\treturn errExportPrivateKey\n\t}\n\treturn nil\n}", "func (c *FilesBuilder) AddKeyPair(ctx context.Context, name string,\n\tf func(context.Context, *cke.Node) (cert, key []byte, err error)) error {\n\tvar mu sync.Mutex\n\tcertMap := make(map[string][]byte)\n\tkeyMap := make(map[string][]byte)\n\n\tenv := well.NewEnvironment(ctx)\n\tfor _, n := range c.nodes {\n\t\tn := n\n\t\tenv.Go(func(ctx context.Context) error {\n\t\t\tcertData, keyData, err := f(ctx, n)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tmu.Lock()\n\t\t\tcertMap[n.Address] = certData\n\t\t\tkeyMap[n.Address] = keyData\n\t\t\tmu.Unlock()\n\t\t\treturn nil\n\t\t})\n\t}\n\tenv.Stop()\n\terr := env.Wait()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.files = append(c.files, fileData{name + \".crt\", certMap})\n\tc.files = append(c.files, fileData{name + \".key\", keyMap})\n\treturn nil\n}", "func (znp *Znp) ZdoSecAddLinkKey(shortAddress string, extendedAddress string, key [16]uint8) (rsp *StatusResponse, err error) {\n\treq := &ZdoSecAddLinkKey{ShortAddress: shortAddress, ExtendedAddress: extendedAddress, Key: key}\n\terr = znp.ProcessRequest(unp.C_SREQ, unp.S_ZDO, 0x42, req, &rsp)\n\treturn\n}", "func (o SslCertificateSelfManagedSslCertificatePtrOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SslCertificateSelfManagedSslCertificate) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.PrivateKey\n\t}).(pulumi.StringPtrOutput)\n}", "func (r *Report) addEntry(key string, suppressedKinds []string, kind string, context int, diffs []difflib.DiffRecord, changeType string) {\n\tentry := ReportEntry{\n\t\tkey,\n\t\tsuppressedKinds,\n\t\tkind,\n\t\tcontext,\n\t\tdiffs,\n\t\tchangeType,\n\t}\n\tr.entries = append(r.entries, entry)\n}", "func NewPrivateKey() PEMPrivateKeyLoaderInterface {\n\treturn &PrivateKey{\n\t\tpemDecoder: pemDecoder.NewPEMDecoder(),\n\t\tx509Parser: x509parser.Newx509Parser(),\n\t}\n}", "func (user *User) SetPrivateKey(privateKey *rsa.PrivateKey) {\n\tuser.privateKey = privateKey\n}", "func (keyDB *KeyDB) AddPrivateUID(msg *uid.Message) error {\n\t_, err := keyDB.addPrivateUIDQuery.Exec(\n\t\tmsg.UIDContent.IDENTITY,\n\t\tmsg.UIDContent.MSGCOUNT,\n\t\tmsg.JSON(),\n\t\tmsg.PrivateSigKey(),\n\t\tmsg.PrivateEncKey(),\n\t\t\"\",\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (o SslCertificateSelfManagedSslCertificateResponsePtrOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SslCertificateSelfManagedSslCertificateResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.PrivateKey\n\t}).(pulumi.StringPtrOutput)\n}", "func (o ProviderOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Provider) pulumi.StringPtrOutput { return v.PrivateKey }).(pulumi.StringPtrOutput)\n}", "func (w *Whisper) AddKeyPair(key *ecdsa.PrivateKey) (string, error) {\n\tid, err := GenerateRandomID()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to generate ID: %s\", err)\n\t}\n\n\tw.keyMu.Lock()\n\tw.privateKeys[id] = key\n\tw.keyMu.Unlock()\n\n\treturn id, nil\n}", "func ImportPrivateKeyFile(filename string) ([]byte, error) {\n\treturn indirectkeyfiles.MarshalPrivateKey([]byte(filename))\n}", "func (kp *KeyPool) AddVerifyKey(key *[ed25519.PublicKeySize]byte) {\n\tkp.mapMutex.Lock()\n\tdefer kp.mapMutex.Unlock()\n\tkp.VerifyPubKeys[*key] = true\n}", "func (grc *GitRemoteConfiguration) SetPrivateKey(privateKey *string) {\n\tgrc.PrivateKey = privateKey\n}", "func (a *Account) ImportPrivateKey(wif *btcutil.WIF, bs *keystore.BlockStamp,\n\trescan bool) (string, error) {\n\n\t// Attempt to import private key into wallet.\n\taddr, err := a.KeyStore.ImportPrivateKey(wif, bs)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Immediately write wallet to disk.\n\tAcctMgr.ds.ScheduleWalletWrite(a)\n\tif err := AcctMgr.ds.FlushAccount(a); err != nil {\n\t\treturn \"\", fmt.Errorf(\"cannot write account: %v\", err)\n\t}\n\n\taddrStr := addr.EncodeAddress()\n\n\t// Rescan blockchain for transactions with txout scripts paying to the\n\t// imported address.\n\tif rescan {\n\t\taddrs := []btcutil.Address{addr}\n\t\tjob := &RescanJob{\n\t\t\tAddresses: map[*Account][]btcutil.Address{a: addrs},\n\t\t\tOutPoints: nil,\n\t\t\tStartHeight: 0,\n\t\t}\n\n\t\t// Submit rescan job and log when the import has completed.\n\t\t// Do not block on finishing the rescan.\n\t\tdoneChan := AcctMgr.rm.SubmitJob(job)\n\t\tgo func() {\n\t\t\t<-doneChan\n\t\t\tlog.Infof(\"Finished import for address %s\", addrStr)\n\t\t}()\n\t}\n\n\t// Associate the imported address with this account.\n\tAcctMgr.MarkAddressForAccount(addr, a)\n\n\tlog.Infof(\"Imported payment address %s\", addrStr)\n\n\t// Return the payment address string of the imported private key.\n\treturn addrStr, nil\n}", "func (s *LunaKeyStore) AddKey(keyInfo trustmanager.KeyInfo, privKey data.PrivateKey) error {\n\n\tvar (\n\t\tecdsaPublicKey *data.ECDSAPublicKey\n\t\trsaPublicKey *data.RSAPublicKey\n\t\terr error\n\t)\n\n\tlogrus.Debugf(\"LunaKeyStore.AddKey\")\n\n\trole := keyInfo.Role\n\n\tgeneratateRootKeyOnly := strings.ToLower(os.Getenv(\"NOTARY_LUNA_GENERATE_ROOT_KEYS_ONLY\")) == \"true\"\n\n\tif generatateRootKeyOnly && role != data.CanonicalRootRole {\n\t\treturn errors.New(\"Can only generate root keys in generate root keys only mode.\")\n\t}\n\n\talg := privKey.Algorithm()\n\n\tif alg == data.ECDSAKey {\n\t\tecdsaPublicKey, err = getECDSAPublicKeyFromPrivateKey(privKey)\n\t\tif err != nil {\n\t\t\tlogrus.Debugf(\"Error getting ECDSA Public key: %s\", err)\n\t\t\treturn err\n\t\t}\n\t} else if alg == data.RSAKey {\n\t\trsaPublicKey, err = getRSAPublicKeyFromPrivateKey(privKey)\n\t\tif err != nil {\n\t\t\tlogrus.Debugf(\"Error getting RSA Public key: %s\", err)\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\treturn errors.New(\"Invalid key type.\")\n\t}\n\n\tp, session, c, err := SetupLuna(true, s.passRetriever)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer CleanupLuna(p, session, c)\n\tgun := keyInfo.Gun\n\n\tif alg == data.ECDSAKey {\n\t\tlunaPrivateKey, err := generateECDSAKey(p, session, gun, s.passRetriever, role)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t//Store the public key value for the generated key in the public key for the added key.\n\t\tlunaECDSAPublicKey, ok := lunaPrivateKey.PublicKey.(*data.ECDSAPublicKey)\n\t\tif !ok {\n\t\t\treturn errors.New(\"Unable to get PublicKey from luna private key.\")\n\t\t}\n\t\tecdsaPublicKey.Value = lunaECDSAPublicKey.Value\n\t\tecdsaPublicKey.ResetID()\n\t} else if alg == data.RSAKey {\n\t\tlunaPrivateKey, err := generateRSAKey(p, session, gun, s.passRetriever, role)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlunaRSAPublicKey, ok := lunaPrivateKey.PublicKey.(*data.RSAPublicKey)\n\t\tif !ok {\n\t\t\treturn errors.New(\"Unable to get PublicKey from luna private key.\")\n\t\t}\n\t\trsaPublicKey.Value = lunaRSAPublicKey.Value\n\t\trsaPublicKey.ResetID()\n\t}\n\tfmt.Printf(\"Luna: Generated %s key: %s\\n\", role, privKey.ID())\n\n\treturn nil\n}", "func (mc *MoacChain) exportWalletPrivateKey(addr, addrPasswd string) (privateKey string, err error) {\n\n\tdefer func() {\n\t\tif re := recover(); re != nil {\n\t\t\terr = re.(error)\n\t\t}\n\t}()\n\n\tvar acc accounts.Account\n\tacc, err = mc.fetchKeystore().Find(accounts.Account{Address: common.HexToAddress(addr)})\n\tif err == nil {\n\t\tvar jsonBytes []byte\n\t\tjsonBytes, err = ioutil.ReadFile(acc.URL.Path)\n\t\tif err == nil {\n\t\t\tvar storeKey *keystore.Key\n\t\t\tstoreKey, err = keystore.DecryptKey(jsonBytes, addrPasswd)\n\t\t\tif err == nil {\n\t\t\t\tprivateKey = hex.EncodeToString(ethMath.PaddedBigBytes(storeKey.PrivateKey.D, storeKey.PrivateKey.Params().BitSize/8))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn privateKey, err\n}", "func DerivePrivateKey(mnemonic, hdPath string) (*ecdsa.PrivateKey, error) {\n\t// Parse the seed string into the master BIP32 key.\n\tseed, err := bip39.NewSeedWithErrorChecking(mnemonic, \"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprivKey, err := hdkeychain.NewMaster(seed, fakeNetworkParams{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Parse the derivation path and derive a child for each level of the\n\t// BIP32 derivation path.\n\tderivationPath, err := accounts.ParseDerivationPath(hdPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, child := range derivationPath {\n\t\tprivKey, err = privKey.Child(child)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\trawPrivKey, err := privKey.SerializedPrivKey()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn crypto.ToECDSA(rawPrivKey)\n}", "func loadPrivateKey() {\n\tif privateKeyData, err := ioutil.ReadFile(PrivateKeyFile); err != nil {\n\t\tlog.Print(\"Unable to read private key file from disk, creating\")\n\t\tcreatePrivateKey()\n\t} else {\n\t\tblock, _ := pem.Decode(privateKeyData)\n\t\tif block == nil {\n\t\t\tlog.Print(\"Unable to decode PEM encoded private key data, creating\")\n\t\t\tcreatePrivateKey()\n\t\t} else {\n\t\t\tprivateKey, err = x509.ParsePKCS1PrivateKey(block.Bytes)\n\t\t\tif err != nil {\n\t\t\t\tlog.Print(\"Unable to decode X509 private key data, creating\")\n\t\t\t\tcreatePrivateKey()\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Read private key\")\n\t\t\t}\n\t\t}\n\t}\n}", "func (mc *MoacChain) ImportWalletPrivateKey(privateKey, passwd string) (err error) {\n\n\tdefer func() {\n\t\tif re := recover(); re != nil {\n\t\t\terr = re.(error)\n\t\t}\n\t}()\n\n\treturn errors.New(\"\")\n}", "func NewMemoryPrivateKeyStore(wrappedIntKek []byte) (keystore *MemoryStore) {\n\tkeystore = &MemoryStore{\n\t\tKeys: map[string]jose.Jwk{},\n\t\tKeyIdMap: map[string]string{},\n\t\taeGen: &gose.AuthenticatedEncryptionKeyGenerator{},\n\t\twrappedIntKek: wrappedIntKek,\n\t}\n\n\treturn\n}", "func (k *Keeper) addKeyToKeeper(client cmd.HTTPClient, privKeyHex string) (string, error) {\n\tprivkey, err := crypto.HexToECDSA(utils.RemoveHexPrefix(privKeyHex))\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to decode priv key %s: %v\", privKeyHex, err)\n\t}\n\taddress := crypto.PubkeyToAddress(privkey.PublicKey).Hex()\n\tlog.Printf(\"importing keeper key %s\", address)\n\tkeyJSON, err := ethkey.FromPrivateKey(privkey).ToEncryptedJSON(defaultChainlinkNodePassword, utils.FastScryptParams)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to encrypt piv key %s: %v\", privKeyHex, err)\n\t}\n\timportUrl := url.URL{\n\t\tPath: \"/v2/keys/evm/import\",\n\t}\n\tquery := importUrl.Query()\n\n\tquery.Set(\"oldpassword\", defaultChainlinkNodePassword)\n\tquery.Set(\"evmChainID\", fmt.Sprint(k.cfg.ChainID))\n\n\timportUrl.RawQuery = query.Encode()\n\tresp, err := client.Post(importUrl.String(), bytes.NewReader(keyJSON))\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to import priv key %s: %v\", privKeyHex, err)\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode >= 400 {\n\t\tbody, err := io.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to read error response body: %s\", err)\n\t\t}\n\n\t\treturn \"\", fmt.Errorf(\"unable to create ocr2keeper job: '%v' [%d]\", string(body), resp.StatusCode)\n\t}\n\n\treturn address, nil\n}", "func (e *Domain) Private() *PrivateKey {\n\tif e.ClearPrivateKey == nil {\n\t\te.decrypt_privatekey()\n\t}\n\treturn e.ClearPrivateKey\n}", "func (w Wallet) ExportWithPrivateKey() (string, error) {\n\tw.PrivateKey = w.keyPair.String()\n\n\ts := memguard.NewStream()\n\n\tenc := json.NewEncoder(s)\n\terr := enc.Encode(w)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tenclave := s.Front().Value.(*memguard.Enclave)\n\tdata, err := enclave.Open()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdata.Melt()\n\n\tdefer data.Destroy()\n\n\treturn strings.TrimSpace(string(data.Bytes())), err\n}", "func (c EasyCert) savePrivateKey(key crypto.PrivateKey, file string) error {\n\tkeyOut, err := os.OpenFile(file, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer keyOut.Close()\n\n\tswitch v := key.(type) {\n\tcase *rsa.PrivateKey:\n\t\tkeyBytes := x509.MarshalPKCS1PrivateKey(v)\n\t\tpem.Encode(keyOut, &pem.Block{Type: \"RSA PRIVATE KEY\", Bytes: keyBytes})\n\tcase *ecdsa.PrivateKey:\n\t\tkeyBytes, err := x509.MarshalECPrivateKey(v)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpem.Encode(keyOut, &pem.Block{Type: \"EC PRIVATE KEY\", Bytes: keyBytes})\n\tdefault:\n\t\treturn fmt.Errorf(\"Unsupport private key type: %#v\", key)\n\t}\n\n\treturn nil\n}", "func (recv *TypeClass) AddPrivate(privateSize uint64) {\n\tc_private_size := (C.gsize)(privateSize)\n\n\tC.g_type_class_add_private((C.gpointer)(recv.native), c_private_size)\n\n\treturn\n}", "func (e *dataUsageEntry) addChild(hash dataUsageHash) {\n\tif _, ok := e.Children[hash.Key()]; ok {\n\t\treturn\n\t}\n\tif e.Children == nil {\n\t\te.Children = make(dataUsageHashMap, 1)\n\t}\n\te.Children[hash.Key()] = struct{}{}\n}", "func (addr *Address) PrivateKey() *btcec.PrivateKey {\n\tpk := addr.calcDoubleHash()[:32]\n\tprivKey, _ := btcec.PrivKeyFromBytes(btcec.S256(), pk)\n\treturn privKey\n}", "func (instance *cache) AddEntry(content Cacheable) (_ *Entry, xerr fail.Error) {\n\tif instance == nil {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\tif content == nil {\n\t\treturn nil, fail.InvalidParameterCannotBeNilError(\"content\")\n\t}\n\n\tinstance.lock.Lock()\n\tdefer instance.lock.Unlock()\n\n\tid := content.GetID()\n\tif xerr := instance.unsafeReserveEntry(id); xerr != nil {\n\t\treturn nil, xerr\n\t}\n\tdefer func() {\n\t\tif xerr != nil {\n\t\t\tif derr := instance.unsafeFreeEntry(id); derr != nil {\n\t\t\t\t_ = xerr.AddConsequence(fail.Wrap(derr, \"cleaning up on failure, failed to free cache entry '%s'\", id))\n\t\t\t}\n\t\t}\n\t}()\n\n\tcacheEntry, xerr := instance.unsafeCommitEntry(id, content)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\treturn cacheEntry, nil\n}", "func (kb *Keybase) ExportPrivateKeyObject(name string, passphrase string) (crypto.PrivKey, error) {\n\tkb.mx.Lock()\n\tdefer kb.mx.Unlock()\n\treturn kb.kb.ExportPrivateKeyObject(name, passphrase)\n}", "func NewPrivateKey() (*rsa.PrivateKey, error) {\n\treturn rsa.GenerateKey(cryptorand.Reader, rsaKeySize)\n}", "func GeneratePrivateKey() (privateKey PrivateKey, err error) {\n\t_, privateKey, err = GenerateKey()\n\n\treturn\n}", "func (l *InMemoryUserRecordLayer) AddUserRecord(u model.UserRecord) {\n\tl.users[u.ID] = u\n}", "func (wlt *Wallet) AddEntry(entry Entry) error {\n\t// dup check\n\tfor _, e := range wlt.Entries {\n\t\tif e.Address == entry.Address {\n\t\t\treturn errors.New(\"duplicate address entry\")\n\t\t}\n\t}\n\n\twlt.Entries = append(wlt.Entries, entry)\n\treturn nil\n}", "func (d *identityManager) PrivateKey() []byte {\n\treturn d.key.PrivateKey\n}", "func GeneratePrivateKey() *PrivateKey {\n\tpriv := new(PrivateKey)\n\tseckey := NewSeckey()\n\tpriv.seckey = seckey\n\treturn priv\n}", "func (gc *GceCache) AddMachine(machineType MachineType, zone string) {\n\tgc.cacheMutex.Lock()\n\tdefer gc.cacheMutex.Unlock()\n\n\tgc.machinesCache[MachineTypeKey{zone, machineType.Name}] = machineType\n}", "func (p *PGP) SavePrivateKey(keyFilename, version, passphrase string) error {\n\tkeyBytes, err := p.toPrivateKey(version)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot save private key: %s\", err)\n\t}\n\tif len(passphrase) > 0 {\n\t\tif len(passphrase) == 16 || len(passphrase) == 24 || len(passphrase) == 32 {\n\t\t\tc := &AesCrypto{\n\t\t\t\tCipherMode: CBC,\n\t\t\t\tPadding: NoPadding,\n\t\t\t}\n\t\t\tencStr, err := c.Encrypt(string(keyBytes[:]), []byte(passphrase))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tkeyBytes = []byte(encStr)\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"passphrase length incorrect, valid lengths are 0, 16, 24 or 32 characters\")\n\t\t}\n\t}\n\t// write the private key to a file\n\terr = ioutil.WriteFile(keyFilename, keyBytes, os.ModePerm)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot save private key: %s\", err)\n\t}\n\treturn nil\n}", "func NewPrivateKey(keyType string) (interface{}, error) {\n\tswitch keyType {\n\tcase \"ecdsa256\":\n\t\treturn ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\tcase \"ecdsa384\":\n\t\treturn ecdsa.GenerateKey(elliptic.P384(), rand.Reader)\n\tcase \"ecdsa521\":\n\t\treturn ecdsa.GenerateKey(elliptic.P521(), rand.Reader)\n\tcase \"ed25519\":\n\t\t_, privateKey, err := ed25519.GenerateKey(rand.Reader)\n\t\treturn privateKey, err\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported key type: %v\", keyType)\n\t}\n}", "func (o SslCertificateSelfManagedSslCertificateResponseOutput) PrivateKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SslCertificateSelfManagedSslCertificateResponse) string { return v.PrivateKey }).(pulumi.StringOutput)\n}", "func NewPrivateKey(name ndn.Name, key *rsa.PrivateKey) (keychain.PrivateKeyKeyLocatorChanger, error) {\n\tif !keychain.IsKeyName(name) {\n\t\treturn nil, keychain.ErrKeyName\n\t}\n\tvar pvt privateKey\n\tpvt.name = name\n\tpvt.key = key\n\treturn &pvt, nil\n}", "func StoreECDSAPrivateKey(privateKey *ecdsa.PrivateKey, password string, path string) error {\n\tpemBlock, err := EncodeECDSAPrivateKeyToPEM(privateKey, password)\n\tif err != nil {\n\t\treturn errors.WithStackTrace(err)\n\t}\n\treturn errors.WithStackTrace(StorePEM(pemBlock, path))\n}", "func (keyDB *KeyDB) AddHashChainEntry(\n\tdomain string,\n\tposition uint64,\n\tentry string,\n) error {\n\tdmn := identity.MapDomain(domain)\n\t_, err := keyDB.addHashChainEntryQuery.Exec(dmn, position, entry)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func LoadPrivateKey(path string) (SignatureCreator, error) {\r\n\tdat, err := ioutil.ReadFile(path)\r\n\tLogErrorF(err)\r\n\treturn parsePrivateKey(dat)\r\n}", "func (s *ExtSession) AddPrivateCommand(category string, check func(ctx *Context) bool, c *Command) {\n\tc.Check = check\n\ts.AddCommand(category, c)\n}", "func NewPrivateKey() (*rsa.PrivateKey, error) {\n\treturn rsa.GenerateKey(rand.Reader, 2048)\n}", "func (keys *RSAKeyPair) ExportRSAPrivateKeyBinaryFile(filePath string) error {\n\tpemfile, err := os.Create(filePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer pemfile.Close()\n\n\t// Private key in PEM format\n\terr = binary.Write(pemfile, binary.LittleEndian, keys.PrivateKeyPKCS8Bytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (v *Virter) addDHCPEntry(mac string, id uint) (net.IP, error) {\n\tnetwork, err := v.libvirt.NetworkLookupByName(v.networkName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not get network: %w\", err)\n\t}\n\n\tipNet, err := v.getIPNet(network)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnetworkBaseIP := ipNet.IP.Mask(ipNet.Mask)\n\tip := addToIP(networkBaseIP, id)\n\n\tif !ipNet.Contains(ip) {\n\t\treturn nil, fmt.Errorf(\"computed IP %v is not in network\", ip)\n\t}\n\n\tlog.Printf(\"Add DHCP entry from %v to %v\", mac, ip)\n\terr = v.libvirt.NetworkUpdate(\n\t\tnetwork,\n\t\t// the following 2 arguments are swapped; see\n\t\t// https://github.com/digitalocean/go-libvirt/issues/87\n\t\tuint32(libvirt.NetworkSectionIPDhcpHost),\n\t\tuint32(libvirt.NetworkUpdateCommandAddLast),\n\t\t-1,\n\t\tfmt.Sprintf(\"<host mac='%s' ip='%v'/>\", mac, ip),\n\t\tlibvirt.NetworkUpdateAffectLive|libvirt.NetworkUpdateAffectConfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not add DHCP entry: %w\", err)\n\t}\n\n\treturn ip, nil\n}", "func GenerateFromPrivateKey(privateKey string) (*Wallet, error) {\n\tpb := hex2bytes(privateKey)\n\tvar priv btckey.PrivateKey\n\terr := priv.FromBytes(pb)\n\tif err != nil {\n\t\treturn &Wallet{}, err\n\t}\n\twallet := &Wallet{\n\t\tPublicKey: priv.PublicKey.ToBytes(),\n\t\tPrivateKey: priv.ToBytes(),\n\t\tAddress: priv.ToNeoAddress(),\n\t\tWIF: priv.ToWIFC(),\n\t\tHashedSignature: priv.ToNeoSignature(),\n\t}\n\treturn wallet, nil\n}", "func (room *Room) AddEntry(entry, issuer string) error {\n\tif room.game == nil {\n\t\treturn errors.New(\"there isn't a started game\")\n\t}\n\n\tif err := room.game.AddEntry(entry, issuer); err != nil {\n\t\treturn err\n\t}\n\n\tif room.game.Finished {\n\t\troom.previousGame = room.game\n\t\troom.game = nil\n\t}\n\treturn nil\n}", "func (s *session) AddRecord(key string, member interface{}, unixstamp int64) error {\n\taction, err := s.addRecord(key, member, unixstamp)\n\tif err != nil {\n\t\treturn s.catch(\"AddRecord: \"+action, err)\n\t}\n\treturn nil\n}", "func GeneratePrivateKey(bitSize int) (*rsa.PrivateKey, error) {\n\tprivateKey, err := rsa.GenerateKey(rand.Reader, bitSize)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = privateKey.Validate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn privateKey, nil\n}", "func Add(kp *keypool.KeyPool, keyDir string) error {\n\terr := os.MkdirAll(keyDir, 0700)\n\tif err != nil {\n\t\treturn err\n\t}\n\tkp.RegisterStorage(nil, writeKeyToDir(keyDir), loadKeysFromDir(keyDir))\n\treturn nil\n}", "func NewPrivateKey(str string) (key PrivateKey, err error) {\n\tbs, err := base58.Decode(str)\n\tif err != nil {\n\t\treturn key, err\n\t}\n\tif len(bs) != KeySize {\n\t\treturn key, errors.New(\"invalid key\")\n\t}\n\tcopy(key[:], bs)\n\treturn key, nil\n}", "func PrivateKeyValidate(priv *rsa.PrivateKey,) error", "func (x *Ed25519Credentials) SetPrivateKey(privatekey PrivateKey) error {\n\n\tif privatekey.Algorithm != AlgorithmEd25519 {\n\t\treturn fmt.Errorf(\"Algorithm mismatch %v vs %v\", privatekey.Algorithm, AlgorithmEd25519)\n\t}\n\n\tst, ok := privatekey.Private.(string)\n\tif !ok {\n\t\treturn ErrInvalidPrivateKeyType\n\t}\n\n\tif len(st) != base64.URLEncoding.EncodedLen(ed25519.PrivateKeySize) {\n\t\treturn fmt.Errorf(\"Key data incorrect length\")\n\t}\n\n\tbytes, err := base64.URLEncoding.DecodeString(st)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tx.Private = bytes\n\n\treturn nil\n\n}", "func LoadPrivateKey(basepath, name string) (*PrivateKey, error) {\n\tkeysdir := filepath.Join(basepath, \"keys\")\n\tprivateKeyPath := fmt.Sprintf(DefaultKeystoreFile, keysdir, name, PrivateType)\n\n\tprivateExists, err := checkFileStat(privateKeyPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !privateExists {\n\t\treturn nil, ErrKeyNotFound\n\t}\n\n\tprivateKeyData, err := ioutil.ReadFile(privateKeyPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpemBlock, _ := pem.Decode(privateKeyData)\n\tecdsaPrivateKey, err := x509.ParseECPrivateKey(pemBlock.Bytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &PrivateKey{\n\t\tecdsaPrivateKey,\n\t}, nil\n}", "func newPrivateKey(size int) (*rsa.PrivateKey, error) {\n\t// TODO: support more key types\n\tprivateKey, err := rsa.GenerateKey(rand.Reader, size)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn privateKey, nil\n}", "func WithPrivateKey(privKey *ecdsa.PrivateKey) WakuNodeOption {\n\treturn func(params *WakuNodeParameters) error {\n\t\tprivk := crypto.PrivKey((*crypto.Secp256k1PrivateKey)(privKey))\n\t\tparams.privKey = &privk\n\t\treturn nil\n\t}\n}", "func (b *BigIP) AddKey(config *Key) error {\n\treturn b.post(config, uriSys, uriCrypto, uriKey)\n}", "func (w *Wallet) ImportPrivateKey(scope waddrmgr.KeyScope, wif *btcutil.WIF,\n\tbs *waddrmgr.BlockStamp, rescan bool) (string, er.R) {\n\n\tmanager, err := w.Manager.FetchScopedKeyManager(scope)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// The starting block for the key is the genesis block unless otherwise\n\t// specified.\n\tif bs == nil {\n\t\tbs = &waddrmgr.BlockStamp{\n\t\t\tHash: *w.chainParams.GenesisHash,\n\t\t\tHeight: 0,\n\t\t\tTimestamp: genesis.Block(w.chainParams.GenesisHash).Header.Timestamp,\n\t\t}\n\t} else if bs.Timestamp.IsZero() {\n\t\t// Only update the new birthday time from default value if we\n\t\t// actually have timestamp info in the header.\n\t\theader, err := w.chainClient.GetBlockHeader(&bs.Hash)\n\t\tif err == nil {\n\t\t\tbs.Timestamp = header.Timestamp\n\t\t}\n\t}\n\n\t// Attempt to import private key into wallet.\n\tvar addr btcutil.Address\n\tvar props *waddrmgr.AccountProperties\n\terr = walletdb.Update(w.db, func(tx walletdb.ReadWriteTx) er.R {\n\t\taddrmgrNs := tx.ReadWriteBucket(waddrmgrNamespaceKey)\n\t\tmaddr, err := manager.ImportPrivateKey(addrmgrNs, wif, bs)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\taddr = maddr.Address()\n\t\tprops, err = manager.AccountProperties(\n\t\t\taddrmgrNs, waddrmgr.ImportedAddrAccount,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// We'll only update our birthday with the new one if it is\n\t\t// before our current one. Otherwise, if we do, we can\n\t\t// potentially miss detecting relevant chain events that\n\t\t// occurred between them while rescanning.\n\t\tbirthdayBlock, _, err := w.Manager.BirthdayBlock(addrmgrNs)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif bs.Height >= birthdayBlock.Height {\n\t\t\treturn nil\n\t\t}\n\n\t\terr = w.Manager.SetBirthday(addrmgrNs, bs.Timestamp)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// To ensure this birthday block is correct, we'll mark it as\n\t\t// unverified to prompt a sanity check at the next restart to\n\t\t// ensure it is correct as it was provided by the caller.\n\t\treturn w.Manager.SetBirthdayBlock(addrmgrNs, *bs, false)\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Rescan blockchain for transactions with txout scripts paying to the\n\t// imported address.\n\tif rescan {\n\t\tjob := &RescanJob{\n\t\t\tAddrs: []btcutil.Address{addr},\n\t\t\tOutPoints: nil,\n\t\t\tBlockStamp: *bs,\n\t\t}\n\n\t\t// Submit rescan job and log when the import has completed.\n\t\t// Do not block on finishing the rescan. The rescan success\n\t\t// or failure is logged elsewhere, and the channel is not\n\t\t// required to be read, so discard the return value.\n\t\t_ = w.SubmitRescan(job)\n\t} else {\n\t\terr := w.chainClient.NotifyReceived([]btcutil.Address{addr})\n\t\tif err != nil {\n\t\t\treturn \"\", er.Errorf(\"Failed to subscribe for address ntfns for \"+\n\t\t\t\t\"address %s: %s\", addr.EncodeAddress(), err)\n\t\t}\n\t}\n\n\taddrStr := addr.EncodeAddress()\n\tlog.Infof(\"Imported payment address %s\", addrStr)\n\n\tw.NtfnServer.notifyAccountProperties(props)\n\n\t// Return the payment address string of the imported private key.\n\treturn addrStr, nil\n}", "func (mc *MemCache) Add(key string, value interface{}) {\n\t_, expTime, found := mc.c.GetWithExpiration(key)\n\tif found { // do not reset expiration if the key already exists\n\t\tmc.c.Set(key, value, time.Until(expTime))\n\t\treturn\n\t}\n\n\tmc.c.Set(key, value, mc.expiration)\n}", "func TypeAddInstancePrivate(classType Type, privateSize uint64) int32 {\n\tc_class_type := (C.GType)(classType)\n\n\tc_private_size := (C.gsize)(privateSize)\n\n\tretC := C.g_type_add_instance_private(c_class_type, c_private_size)\n\tretGo := (int32)(retC)\n\n\treturn retGo\n}", "func ImportFromPrivateKey(privateKey, name, passphrase string) (string, error) {\n\tprivateKey = strings.TrimPrefix(privateKey, \"0x\")\n\n\tif name == \"\" {\n\t\tname = generateName() + \"-imported\"\n\t\tfor store.DoesNamedAccountExist(name) {\n\t\t\tname = generateName() + \"-imported\"\n\t\t}\n\t} else if store.DoesNamedAccountExist(name) {\n\t\treturn \"\", fmt.Errorf(\"account %s already exists\", name)\n\t}\n\n\tprivateKeyBytes, err := hex.DecodeString(privateKey)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif len(privateKeyBytes) != common.Secp256k1PrivateKeyBytesLength {\n\t\treturn \"\", common.ErrBadKeyLength\n\t}\n\n\t// btcec.PrivKeyFromBytes only returns a secret key and public key\n\tsk, _ := btcec.PrivKeyFromBytes(btcec.S256(), privateKeyBytes)\n\toneAddress := address.ToBech32(crypto.PubkeyToAddress(sk.PublicKey))\n\n\tif store.FromAddress(oneAddress) != nil {\n\t\treturn \"\", fmt.Errorf(\"address %s already exists\", oneAddress)\n\t}\n\n\tks := store.FromAccountName(name)\n\t_, err = ks.ImportECDSA(sk.ToECDSA(), passphrase)\n\treturn name, err\n}", "func (k2h *K2hash) AddDecryptionPassword(pass string) (bool, error) {\n\tcPass := C.CString(pass)\n\tdefer C.free(unsafe.Pointer(cPass))\n\tok := C.k2h_add_attr_crypt_pass(k2h.handle, cPass, false)\n\tif ok != true {\n\t\treturn false, fmt.Errorf(\"k2h_add_attr_crypt_pass() returns false\")\n\t}\n\treturn true, nil\n}", "func GeneratePrivateKey() (*rsa.PrivateKey, error) {\n\treturn rsa.GenerateKey(rand.Reader, RSA_BITS)\n}", "func GetPrivateKey() ed25519.PrivateKey {\n\tkey, _ := DecodePrivateKey(privateKey)\n\treturn key\n}", "func (i *Interpreter) AddDictionaryEntry(e DictionaryEntry) {\n\ti.dictionary[dictionaryKey{e.EnterpriseID, e.FieldID}] = e\n}", "func (authcl *Client) AddKey(key, description string, temp bool) error {\n\terr := authcl.LoadToken()\n\tif err != nil {\n\t\treturn err\n\t}\n\tnewkey := gogs.PublicKey{Key: key, Title: description}\n\taddress := fmt.Sprintf(\"/api/v1/user/keys\")\n\tres, err := authcl.Post(address, newkey)\n\tif err != nil {\n\t\treturn err\n\t} else if res.StatusCode != http.StatusCreated {\n\t\treturn fmt.Errorf(\"[Add key] Failed. Server returned %s\", res.Status)\n\t}\n\tweb.CloseRes(res.Body)\n\treturn nil\n}", "func AddENCEntry(hostName string, class string, entry Entry, backend gitlab.ENCBackend, force bool) {\n\t// TODO class should be directly injected in the entry array\n\tb := []string{class}\n\tentry.Classes = b\n\n\t// Marshal to yaml\n\tenc, err := yaml.Marshal(entry)\n\tif err != nil {\n\t\tlog.Fatalf(\"error: %v\", err)\n\t}\n\tfileName, err := writeToFile(enc, hostName)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// TODO implement error handling for\n\tgitlab.AddToGitlab(fileName, enc, backend, force)\n}", "func (w *rpcWallet) AddressPrivKey(ctx context.Context, address stdaddr.Address) (*secp256k1.PrivateKey, error) {\n\twif, err := w.rpcClient.DumpPrivKey(ctx, address)\n\tif err != nil {\n\t\treturn nil, translateRPCCancelErr(err)\n\t}\n\tvar priv secp256k1.PrivateKey\n\tif overflow := priv.Key.SetByteSlice(wif.PrivKey()); overflow || priv.Key.IsZero() {\n\t\treturn nil, errors.New(\"invalid private key\")\n\t}\n\treturn &priv, nil\n}", "func (s *Store) AddRecipient(ctx context.Context, id string) error {\n\trs, err := s.GetRecipients(ctx, \"\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read recipient list: %w\", err)\n\t}\n\n\tdebug.Log(\"new recipient: %q - existing: %+v\", id, rs)\n\n\tidAlreadyInStore := rs.Has(id)\n\tif idAlreadyInStore {\n\t\tif !termio.AskForConfirmation(ctx, fmt.Sprintf(\"key %q already in store. Do you want to re-encrypt with public key? This is useful if you changed your public key (e.g. added subkeys).\", id)) {\n\t\t\treturn nil\n\t\t}\n\t} else {\n\t\trs.Add(id)\n\n\t\tif err := s.saveRecipients(ctx, rs, \"Added Recipient \"+id); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to save recipients: %w\", err)\n\t\t}\n\t}\n\n\tout.Printf(ctx, \"Reencrypting existing secrets. This may take some time ...\")\n\n\tcommitMsg := \"Recipient \" + id\n\tif idAlreadyInStore {\n\t\tcommitMsg = \"Re-encrypted Store for \" + commitMsg\n\t} else {\n\t\tcommitMsg = \"Added \" + commitMsg\n\t}\n\n\treturn s.reencrypt(ctxutil.WithCommitMessage(ctx, commitMsg))\n}", "func (a *Account) ImportPrivateKey(pk []byte, compressed bool,\n\tbs *wallet.BlockStamp, rescan bool) (string, error) {\n\n\t// Attempt to import private key into wallet.\n\taddr, err := a.Wallet.ImportPrivateKey(pk, compressed, bs)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Immediately write wallet to disk.\n\tAcctMgr.ds.ScheduleWalletWrite(a)\n\tif err := AcctMgr.ds.FlushAccount(a); err != nil {\n\t\treturn \"\", fmt.Errorf(\"cannot write account: %v\", err)\n\t}\n\n\taddrStr := addr.EncodeAddress()\n\n\t// Rescan blockchain for transactions with txout scripts paying to the\n\t// imported address.\n\tif rescan {\n\t\taddrs := []btcutil.Address{addr}\n\t\tjob := &RescanJob{\n\t\t\tAddresses: map[*Account][]btcutil.Address{a: addrs},\n\t\t\tOutPoints: nil,\n\t\t\tStartHeight: 0,\n\t\t}\n\n\t\t// Submit rescan job and log when the import has completed.\n\t\t// Do not block on finishing the rescan.\n\t\tdoneChan := AcctMgr.rm.SubmitJob(job)\n\t\tgo func() {\n\t\t\t<-doneChan\n\t\t\tlog.Infof(\"Finished import for address %s\", addrStr)\n\t\t}()\n\t}\n\n\t// Associate the imported address with this account.\n\tAcctMgr.MarkAddressForAccount(addr, a)\n\n\tlog.Infof(\"Imported payment address %s\", addrStr)\n\n\t// Return the payment address string of the imported private key.\n\treturn addrStr, nil\n}", "func (s ServiceClientWrapper) AddKey(name string, password string) (addr string, mnemonic string, err error) {\n\treturn s.ServiceClient.Insert(name, password)\n}", "func (txt *DNSSdTxtRecord) Add(key, value string) {\n\t*txt = append(*txt, DNSSdTxtItem{key, value, false})\n}", "func (a *Archive) AddEntry(typ EntryType, name string, mtime int64, uid, gid int, mode os.FileMode, size int64, r io.Reader) {\n\toff, err := a.f.Seek(0, os.SEEK_END)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tn, err := fmt.Fprintf(a.f, entryHeader, exactly16Bytes(name), mtime, uid, gid, mode, size)\n\tif err != nil || n != entryLen {\n\t\tlog.Fatal(\"writing entry header: \", err)\n\t}\n\tn1, _ := io.CopyN(a.f, r, size)\n\tif n1 != size {\n\t\tlog.Fatal(err)\n\t}\n\tif (off+size)&1 != 0 {\n\t\ta.f.Write([]byte{0}) // pad to even byte\n\t}\n\ta.Entries = append(a.Entries, Entry{\n\t\tName: name,\n\t\tType: typ,\n\t\tMtime: mtime,\n\t\tUid: uid,\n\t\tGid: gid,\n\t\tMode: mode,\n\t\tData: Data{off + entryLen, size},\n\t})\n}", "func (a *Account) GetPrivateKey() crypto.PrivateKey {\n\treturn a.key\n}", "func FromPrivateKey(privateKey []byte) (*Identity, error) {\n\tidentity := Identity{}\n\tidentity.PrivateKey = ed25519.NewKeyFromSeed(privateKey)\n\tidentity.PublicKey = make([]byte, ed25519.PublicKeySize)\n\tcopy(identity.PublicKey, identity.PrivateKey[32:])\n\tidentity.addConvenienceDerivatives()\n\treturn &identity, nil\n}", "func (o SslCertificateOutput) PrivateKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SslCertificate) pulumi.StringOutput { return v.PrivateKey }).(pulumi.StringOutput)\n}", "func (o SslCertOutput) PrivateKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SslCert) pulumi.StringOutput { return v.PrivateKey }).(pulumi.StringOutput)\n}", "func EvalPrivateKey(s sexprs.Sexp) (k PrivateKey, err error) {\n\tl, ok := s.(sexprs.List)\n\tif !ok {\n\t\treturn k, fmt.Errorf(\"Key S-expression must be a list\")\n\t}\n\tif !privateKeyAtom.Equal(l[0]) {\n\t\treturn k, fmt.Errorf(\"Key S-expression must start with 'private-key'\")\n\t}\n\tif len(l) != 2 {\n\t\treturn k, fmt.Errorf(\"Key S-expression must have two elements\")\n\t}\n\treturn evalECDSAPrivateKey(l[1])\n\tpanic(\"Can't reach here\")\n}" ]
[ "0.70359194", "0.6639596", "0.5902523", "0.5467966", "0.5320013", "0.5296554", "0.5258727", "0.5252541", "0.52133185", "0.51536345", "0.513239", "0.5129155", "0.5101568", "0.5091105", "0.5075747", "0.5056588", "0.5034122", "0.50106305", "0.5004521", "0.50001854", "0.49769345", "0.49704066", "0.4938369", "0.4909113", "0.49002528", "0.48905975", "0.4885787", "0.4878356", "0.4875934", "0.48756424", "0.48742846", "0.48551857", "0.48473918", "0.48216462", "0.4798918", "0.47928366", "0.47836795", "0.47719955", "0.47707888", "0.4759229", "0.47559237", "0.47558984", "0.47497687", "0.4749009", "0.47450963", "0.4720073", "0.4719256", "0.47190616", "0.4711242", "0.4710108", "0.46986276", "0.46891147", "0.46851507", "0.46828052", "0.4679464", "0.46665522", "0.46624866", "0.46571058", "0.46518365", "0.4650488", "0.46473458", "0.46463478", "0.4643828", "0.46393606", "0.4638807", "0.4637869", "0.4634329", "0.46276066", "0.46173805", "0.45981768", "0.45965204", "0.45905977", "0.45896998", "0.45829868", "0.4570078", "0.45669773", "0.45661268", "0.45608836", "0.45525742", "0.45513195", "0.45506507", "0.45359617", "0.45319998", "0.45302558", "0.45243338", "0.45168152", "0.4507622", "0.45011365", "0.4500933", "0.4498331", "0.44932413", "0.44929093", "0.44903117", "0.44868523", "0.4485161", "0.44829336", "0.44808862", "0.44772974", "0.4476372", "0.44683376" ]
0.8498008
0
AddPublicKeyEntry adds public KeyEntry from identity to memory store.
func (ms *MemStore) AddPublicKeyEntry(identity string, ke *uid.KeyEntry) { ms.publicKeyEntryMap[identity] = ke }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (rd *RootDomain) AddNewMemberToPublicKeyMap(publicKey string, memberRef insolar.Reference) error {\n\ttrimmedPublicKey := foundation.TrimPublicKey(publicKey)\n\tshardIndex := foundation.GetShardIndex(trimmedPublicKey, insolar.GenesisAmountPublicKeyShards)\n\tif shardIndex >= len(rd.PublicKeyShards) {\n\t\treturn fmt.Errorf(\"incorrect public key shard index\")\n\t}\n\tpks := pkshard.GetObject(rd.PublicKeyShards[shardIndex])\n\terr := pks.SetRef(trimmedPublicKey, memberRef.String())\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to set reference in public key shard\")\n\t}\n\treturn nil\n}", "func (_IRMAScheme *IRMASchemeTransactor) AddIssuerPublicKey(opts *bind.TransactOpts, _issuerId string, _key []byte) (*types.Transaction, error) {\n\treturn _IRMAScheme.contract.Transact(opts, \"addIssuerPublicKey\", _issuerId, _key)\n}", "func (ms *MemStore) GetPublicKeyEntry(uidMsg *uid.Message) (*uid.KeyEntry, string, error) {\n\tke, ok := ms.publicKeyEntryMap[uidMsg.Identity()]\n\tif !ok {\n\t\treturn nil, \"\", log.Error(session.ErrNoKeyEntry)\n\t}\n\treturn ke, \"undefined\", nil\n}", "func (keyDB *KeyDB) AddPublicKeyInit(ki *uid.KeyInit) error {\n\t_, err := keyDB.addPublicKeyInitQuery.Exec(ki.SigKeyHash(), ki.JSON())\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (ms *MemStore) AddPrivateKeyEntry(ke *uid.KeyEntry) {\n\tms.privateKeyEntryMap[ke.HASH] = ke\n}", "func (_IRMAScheme *IRMASchemeTransactorSession) AddIssuerPublicKey(_issuerId string, _key []byte) (*types.Transaction, error) {\n\treturn _IRMAScheme.Contract.AddIssuerPublicKey(&_IRMAScheme.TransactOpts, _issuerId, _key)\n}", "func (s *service) AddPublicKeyTag(ctx context.Context, tenant, fingerprint, tag string) error {\n\t// Checks if the namespace exists.\n\tnamespace, err := s.store.NamespaceGet(ctx, tenant)\n\tif err != nil || namespace == nil {\n\t\treturn NewErrNamespaceNotFound(tenant, err)\n\t}\n\n\t// Checks if the public key exists.\n\tkey, err := s.store.PublicKeyGet(ctx, fingerprint, tenant)\n\tif err != nil || key == nil {\n\t\treturn NewErrPublicKeyNotFound(fingerprint, err)\n\t}\n\n\tif key.Filter.Hostname != \"\" {\n\t\treturn NewErrPublicKeyFilter(nil)\n\t}\n\n\tif len(key.Filter.Tags) == DeviceMaxTags {\n\t\treturn NewErrTagLimit(DeviceMaxTags, nil)\n\t}\n\n\ttags, _, err := s.store.TagsGet(ctx, tenant)\n\tif err != nil {\n\t\treturn NewErrTagEmpty(tenant, err)\n\t}\n\n\tif !contains(tags, tag) {\n\t\treturn NewErrTagNotFound(tag, nil)\n\t}\n\n\t// Trys to add a public key.\n\terr = s.store.PublicKeyAddTag(ctx, tenant, fingerprint, tag)\n\tif err != nil {\n\t\tswitch err {\n\t\tcase store.ErrNoDocuments:\n\t\t\treturn ErrDuplicateTagName\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (_IRMAScheme *IRMASchemeSession) AddIssuerPublicKey(_issuerId string, _key []byte) (*types.Transaction, error) {\n\treturn _IRMAScheme.Contract.AddIssuerPublicKey(&_IRMAScheme.TransactOpts, _issuerId, _key)\n}", "func NewPublicKey(pk map[string]interface{}) PublicKey {\n\treturn pk\n}", "func (o *DKSharesInfo) SetPublicKey(v string) {\n\to.PublicKey = v\n}", "func (c *Included) MustPublicKeyEntry(key Key) *PublicKeyEntry {\n\tvar publicKeyEntry PublicKeyEntry\n\tif c.tryFindEntry(key, &publicKeyEntry) {\n\t\treturn &publicKeyEntry\n\t}\n\treturn nil\n}", "func AddSSHPublicKeyToConfig(name string, file string) (*SSHPublicKey, error) {\n\tsshPublicKey, err := parseSSHPublicKey(name, file)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error while parsing ssh key from file '%s' config: %s\", file, err)\n\t}\n\n\tsshPublicKey.WriteToConfig()\n\n\treturn sshPublicKey, nil\n}", "func (p Planner) AddEntry(planIdentifier string, user users.User, startAtUnix, duration int64) (PlanEntry, error) {\n\t// Get the plan based on identifier\n\tplan, err := p.data.GetPlan(planIdentifier)\n\tif err != nil {\n\t\treturn PlanEntry{}, fmt.Errorf(\"no plan: %w\", err)\n\t}\n\t// Check that the duration is longer than the plan's minimum availability\n\tif plan.MinimumAvailabilitySeconds > uint(duration) {\n\t\treturn PlanEntry{}, dataerror.ErrBasic(fmt.Sprintf(\"Entry duration cannot be shorter than the plan's (%d)\", plan.MinimumAvailabilitySeconds))\n\t}\n\n\tcreatedEntry, err := p.data.AddEntry(&plan, user, startAtUnix, duration)\n\tif err != nil {\n\t\treturn PlanEntry{}, fmt.Errorf(\"failed saving entry: %w\", err)\n\t}\n\n\t// Now just convert createdEntry to PlanEntry\n\tfinalEntry := PlanEntry{}\n\tfinalEntry.FillFromDataType(createdEntry)\n\n\treturn finalEntry, nil\n}", "func (t *SimpleTable) AddEntry(addr Address, nextHop Node) {\n\tt.Lock()\n\tdefer t.Unlock()\n\tt.entries = append(t.entries, NewTableEntry(addr, nextHop))\n}", "func (s *MedianSubscriber) addEntry(e entry) {\n\tn := len(s.entries)\n\tpos := sort.Search(n, func(i int) bool {\n\t\treturn s.entries[i].Compare(e) >= 0\n\t}) // insert pos of entry\n\tif pos == n {\n\t\ts.entries = append(s.entries, e)\n\t} else {\n\t\ts.entries = append(s.entries[:pos+1], s.entries[pos:]...)\n\t\ts.entries[pos] = e\n\t}\n}", "func (instance *cache) AddEntry(content Cacheable) (_ *Entry, xerr fail.Error) {\n\tif instance == nil {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\tif content == nil {\n\t\treturn nil, fail.InvalidParameterCannotBeNilError(\"content\")\n\t}\n\n\tinstance.lock.Lock()\n\tdefer instance.lock.Unlock()\n\n\tid := content.GetID()\n\tif xerr := instance.unsafeReserveEntry(id); xerr != nil {\n\t\treturn nil, xerr\n\t}\n\tdefer func() {\n\t\tif xerr != nil {\n\t\t\tif derr := instance.unsafeFreeEntry(id); derr != nil {\n\t\t\t\t_ = xerr.AddConsequence(fail.Wrap(derr, \"cleaning up on failure, failed to free cache entry '%s'\", id))\n\t\t\t}\n\t\t}\n\t}()\n\n\tcacheEntry, xerr := instance.unsafeCommitEntry(id, content)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\treturn cacheEntry, nil\n}", "func (keyRing *KeyRing) WritePublicKey(w io.Writer) (err error) {\n\tfor _, e := range keyRing.entities {\n\t\tif err = e.Serialize(w); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "func (kc *Keychain) Add(key *crypto.PublicKeySECP256K1R) {\n\taddr := key.Address()\n\tkc.Addrs.Add(addr)\n}", "func (a *Archive) AddEntry(typ EntryType, name string, mtime int64, uid, gid int, mode os.FileMode, size int64, r io.Reader) {\n\toff, err := a.f.Seek(0, os.SEEK_END)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tn, err := fmt.Fprintf(a.f, entryHeader, exactly16Bytes(name), mtime, uid, gid, mode, size)\n\tif err != nil || n != entryLen {\n\t\tlog.Fatal(\"writing entry header: \", err)\n\t}\n\tn1, _ := io.CopyN(a.f, r, size)\n\tif n1 != size {\n\t\tlog.Fatal(err)\n\t}\n\tif (off+size)&1 != 0 {\n\t\ta.f.Write([]byte{0}) // pad to even byte\n\t}\n\ta.Entries = append(a.Entries, Entry{\n\t\tName: name,\n\t\tType: typ,\n\t\tMtime: mtime,\n\t\tUid: uid,\n\t\tGid: gid,\n\t\tMode: mode,\n\t\tData: Data{off + entryLen, size},\n\t})\n}", "func NewPublicKey(seed Trytes, index int) (Trytes, error) {\n\tbytesSec, err := seed.Trits().Bytes()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif mKey == nil {\n\t\tkey, err := hdkey.NewMaster(bytesSec, nil, 1)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tmKey = key\n\t}\n\n\tpubKey, err := mKey.Child(uint32(index))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tpkCompressed := pubKey.PublicKey().Compress()\n\tpkInt := new(big.Int).SetBytes(pkCompressed[:])\n\tkeyTrit := make([]byte, 48)\n\tcopy(keyTrit, pkInt.Bytes())\n\ttrits, err := BytesToTrits(keyTrit)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn trits.Trytes(), err\n}", "func (r *rsaPublicKey) Store() ([]byte, error) {\r\n\treturn x509.MarshalPKIXPublicKey(r.PublicKey)\r\n}", "func (p *Resolver) AddExecEntry(entry *model.ProcessCacheEntry) {\n\tp.Lock()\n\tdefer p.Unlock()\n\n\tp.insertExecEntry(entry, model.ProcessCacheEntryFromEvent)\n}", "func ExportPublicKey(key *rsa.PublicKey) []byte {\n\tkeyBytes := x509.MarshalPKCS1PublicKey(key)\n\treturn pem.EncodeToMemory(&pem.Block{\n\t\tType: \"PUBLIC KEY\",\n\t\tBytes: keyBytes,\n\t})\n}", "func (c *publicKey) Encode() (*pb.PublicKey, error) {\n\tif c.ki == nil {\n\t\treturn nil, ErrPublicKeyCannotBeNil()\n\t}\n\n\tblob, err := crypto.MarshalPublicKey(c.ki)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpbuf := pb.PublicKey{Blob: blob}\n\n\treturn &pbuf, nil\n}", "func (o *PipelineSshKeyPairAllOf) SetPublicKey(v string) {\n\to.PublicKey = &v\n}", "func (keyDB *KeyDB) AddHashChainEntry(\n\tdomain string,\n\tposition uint64,\n\tentry string,\n) error {\n\tdmn := identity.MapDomain(domain)\n\t_, err := keyDB.addHashChainEntryQuery.Exec(dmn, position, entry)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func NewPublicKey(keyType KeyType, keyData []byte, keyID string) PublicKey {\n\treturn PublicKey{\n\t\tKeyType: keyType,\n\t\tKeyData: keyData,\n\t\tID: keyID,\n\t}\n}", "func (pk *PublicKey) Pack(buf *[PublicKeySize]byte) {\n\tvar tmp [mode2.PublicKeySize]byte\n\tpk.d.Pack(&tmp)\n\tcopy(buf[:mode2.PublicKeySize], tmp[:])\n\tcopy(buf[mode2.PublicKeySize:], pk.e)\n}", "func (s *Storage) Add(uuid []byte, e Entry) (err error) {\n\ttxn, dbis, err := s.startTxn(false, timeDB, entryDB, keyDB)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif e.Key != \"\" {\n\t\tDebug(\"Entry has key: \", e.Key)\n\n\t\tvar ouuid []byte\n\t\touuid, err = txn.Get(dbis[2], []byte(e.Key))\n\t\tif err != nil && err != mdb.NotFound {\n\t\t\ttxn.Abort()\n\t\t\treturn\n\t\t}\n\n\t\tif err == nil {\n\t\t\tDebug(\"Exising key found; removing.\")\n\n\t\t\terr = s.innerRemove(txn, dbis, ouuid)\n\t\t\tif err != nil {\n\t\t\t\ttxn.Abort()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\terr = txn.Put(dbis[2], []byte(e.Key), uuid, 0)\n\t\tif err != nil {\n\t\t\ttxn.Abort()\n\t\t\treturn\n\t\t}\n\t}\n\n\tk := uint64ToBytes(uint64(e.SendAt.UnixNano()))\n\terr = txn.Put(dbis[0], k, uuid, 0)\n\tif err != nil {\n\t\ttxn.Abort()\n\t\treturn\n\t}\n\n\tb, err := e.ToBytes()\n\tif err != nil {\n\t\ttxn.Abort()\n\t\treturn\n\t}\n\n\terr = txn.Put(dbis[1], uuid, b, 0)\n\tif err != nil {\n\t\ttxn.Abort()\n\t\treturn\n\t}\n\n\tok, t, err := s.innerNextTime(txn, dbis[0])\n\tif err != nil {\n\t\ttxn.Abort()\n\t\treturn\n\t}\n\n\terr = txn.Commit()\n\n\tif err == nil && ok {\n\t\ts.c <- t\n\t}\n\n\treturn\n}", "func AddENCEntry(hostName string, class string, entry Entry, backend gitlab.ENCBackend, force bool) {\n\t// TODO class should be directly injected in the entry array\n\tb := []string{class}\n\tentry.Classes = b\n\n\t// Marshal to yaml\n\tenc, err := yaml.Marshal(entry)\n\tif err != nil {\n\t\tlog.Fatalf(\"error: %v\", err)\n\t}\n\tfileName, err := writeToFile(enc, hostName)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// TODO implement error handling for\n\tgitlab.AddToGitlab(fileName, enc, backend, force)\n}", "func (router *Router) AddEntry(origin, address string, onlyIfNotExists bool) bool {\n\toldValue, found := router.GetAddress(origin)\n\tisNew := false\n\tif !found || (!onlyIfNotExists && oldValue.String() != address) {\n\t\tisNew = true\n\t\tnewEntry := utils.PeerAddress{}\n\t\terr := newEntry.Set(address)\n\t\tif err != nil {\n\t\t\tlogger.Logw(\"Error updating router entry\")\n\t\t\treturn false\n\t\t}\n\t\trouter.setEntry(origin, newEntry)\n\t}\n\treturn isNew\n}", "func newPersistedEntry(value *value) (persistedEntry, error) {\n\tif len(value.data) > modules.RegistryDataSize {\n\t\tbuild.Critical(\"newPersistedEntry: called with too much data\")\n\t\treturn persistedEntry{}, errors.New(\"value's data is too large\")\n\t}\n\tcpk, err := newCompressedPublicKey(value.key)\n\tif err != nil {\n\t\treturn persistedEntry{}, errors.AddContext(err, \"newPersistedEntry: failed to compress key\")\n\t}\n\tif value.entryType == modules.RegistryTypeInvalid {\n\t\terr := modules.ErrInvalidRegistryEntryType\n\t\tbuild.Critical(err)\n\t\treturn persistedEntry{}, err\n\t}\n\tpe := persistedEntry{\n\t\tKey: cpk,\n\t\tSignature: value.signature,\n\t\tTweak: value.tweak,\n\t\tType: value.entryType,\n\n\t\tDataLen: uint8(len(value.data)),\n\t\tExpiry: compressedBlockHeight(value.expiry),\n\t\tRevision: value.revision,\n\t}\n\tcopy(pe.Data[:], value.data)\n\treturn pe, nil\n}", "func (r *RPCKeyRing) ImportPublicKey(pubKey *btcec.PublicKey,\n\taddrType waddrmgr.AddressType) error {\n\n\tctxt, cancel := context.WithTimeout(context.Background(), r.rpcTimeout)\n\tdefer cancel()\n\n\trpcAddrType, err := toRPCAddrType(&addrType)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error converting address type: %v\", err)\n\t}\n\n\t_, err = r.walletClient.ImportPublicKey(\n\t\tctxt, &walletrpc.ImportPublicKeyRequest{\n\t\t\tPublicKey: pubKey.SerializeCompressed(),\n\t\t\tAddressType: rpcAddrType,\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error importing pubkey on remote signer \"+\n\t\t\t\"instance: %v\", err)\n\t}\n\n\terr = r.WalletController.ImportPublicKey(pubKey, addrType)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error importing pubkey on local signer \"+\n\t\t\t\"instance: %v\", err)\n\t}\n\n\treturn nil\n}", "func AddEntryToIPSet(setName string) {\n\tnumIPSetEntries.Inc()\n\tipsetInventoryMap[setName]++ // adds the setName with value 1 if it doesn't exist\n\tupdateIPSetInventory(setName)\n}", "func marshalPublicKey(pub interface{}) ([]byte, error) {\n\tvar publicKeyBytes []byte\n\tvar err error\n\tswitch p := pub.(type) {\n\tcase *ecdsa.PublicKey:\n\t\t// Stolen from https://golang.org/src/crypto/x509/x509.go?s=2771:2829#L87\n\t\tpublicKeyBytes = elliptic.Marshal(p.Curve, p.X, p.Y)\n\tcase *rsa.PublicKey:\n\t\t// TODO: Append exponent\n\t\tpublicKeyBytes = p.N.Bytes()\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Unsupported public key type: %T\", pub)\n\t}\n\treturn publicKeyBytes, err\n}", "func AddEntry(storage core.StorageClient) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tvar (\n\t\t\terr error\n\t\t\tentry models.Entry\n\t\t)\n\n\t\terr = c.Bind(&entry)\n\t\tif err != nil {\n\t\t\tc.Status(http.StatusBadRequest)\n\n\t\t\treturn\n\t\t}\n\n\t\tentry.Id = uuid.New().String()\n\n\t\terr = storage.Add(entry)\n\t\tif err != nil {\n\t\t\tvar storageError *core.StorageError\n\n\t\t\tif errors.As(err, &storageError) {\n\t\t\t\tc.Status(storageError.StatusCode())\n\t\t\t} else {\n\t\t\t\tc.Status(http.StatusInternalServerError)\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\tc.JSON(http.StatusCreated, entry)\n\t}\n}", "func ValidatePublicKeyRecord(k u.Key, val []byte) error {\n\tkeyparts := bytes.Split([]byte(k), []byte(\"/\"))\n\tif len(keyparts) < 3 {\n\t\treturn errors.New(\"invalid key\")\n\t}\n\n\tpkh := u.Hash(val)\n\tif !bytes.Equal(keyparts[2], pkh) {\n\t\treturn errors.New(\"public key does not match storage key\")\n\t}\n\treturn nil\n}", "func (mr *MockAnonymousMockRecorder) StorePublicKey(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"StorePublicKey\", reflect.TypeOf((*MockAnonymous)(nil).StorePublicKey), arg0, arg1)\n}", "func (priv *PrivateKey) Public() crypto.PublicKey", "func (priv *PrivateKey) Public() crypto.PublicKey", "func NewPublicKey(r io.Reader) (*PublicKey, error) {\n\trawPub, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkey, _, _, _, err := ssh.ParseAuthorizedKey(rawPub)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &PublicKey{key: key}, nil\n}", "func (wlt *Wallet) AddEntry(entry Entry) error {\n\t// dup check\n\tfor _, e := range wlt.Entries {\n\t\tif e.Address == entry.Address {\n\t\t\treturn errors.New(\"duplicate address entry\")\n\t\t}\n\t}\n\n\twlt.Entries = append(wlt.Entries, entry)\n\treturn nil\n}", "func (system *System) SavePublicKey(publicKey io.Reader) error {\n\tdb := GetGORMDbConnection()\n\tdefer Close(db)\n\n\tk, err := ioutil.ReadAll(publicKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot read public key for clientID %s: %s\", system.ClientID, err.Error())\n\t}\n\n\tkey, err := ReadPublicKey(string(k))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid public key for clientID %s: %s\", system.ClientID, err.Error())\n\t}\n\tif key == nil {\n\t\treturn fmt.Errorf(\"invalid public key for clientID %s\", system.ClientID)\n\t}\n\n\tencryptionKey := EncryptionKey{\n\t\tBody: string(k),\n\t\tSystemID: system.ID,\n\t}\n\n\t// Only one key should be valid per system. Soft delete the currently active key, if any.\n\terr = db.Where(\"system_id = ?\", system.ID).Delete(&EncryptionKey{}).Error\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to soft delete previous encryption keys for clientID %s: %s\", system.ClientID, err.Error())\n\t}\n\n\terr = db.Create(&encryptionKey).Error\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not save public key for clientID %s: %s\", system.ClientID, err.Error())\n\t}\n\n\treturn nil\n}", "func (pkv PublicKeyValidator) CreateRecord(signingKey crypto.PrivKey, encryptionKey *[32]byte) ([]byte, error) {\n\tpublicKey := &pb.PublicKey{\n\t\tType: pb.KeyType_Curve25519,\n\t\tCreatedAt: ptypes.TimestampNow(),\n\t\tData: encryptionKey[:],\n\t}\n\n\ttoSign, err := proto.Marshal(publicKey)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tpublicKey.Signature, err = signingKey.Sign(toSign)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tpublicKey.SignatureKey, err = signingKey.GetPublic().Bytes()\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tserialized, err := proto.Marshal(publicKey)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\treturn serialized, nil\n}", "func (ks *KeyStore) Add(privateKey *rsa.PrivateKey, kid string) {\n\tks.mu.Lock()\n\tdefer ks.mu.Unlock()\n\n\tks.store[kid] = privateKey\n}", "func addEntry(t *testing.T, key string, keyspace uint) {\n\t// Insert at least one event to make sure db exists\n\tc, err := rd.Dial(\"tcp\", host)\n\tif err != nil {\n\t\tt.Fatal(\"connect\", err)\n\t}\n\t_, err = c.Do(\"SELECT\", keyspace)\n\tif err != nil {\n\t\tt.Fatal(\"select\", err)\n\t}\n\tdefer c.Close()\n\t_, err = c.Do(\"SET\", key, \"bar\", \"EX\", \"360\")\n\tif err != nil {\n\t\tt.Fatal(\"SET\", err)\n\t}\n}", "func (h *IPSecVppHandler) AddSAEntry(saID uint32, sa *ipsec.SecurityAssociations_SA) error {\n\treturn h.sadAddDelEntry(saID, sa, true)\n}", "func ecdsaPublicKeyImport(x509Cert *x509.Certificate) (*ecdsa.PublicKey, error) {\n\tpk := x509Cert.PublicKey\n\n\tlowLevelKey, ok := pk.(*ecdsa.PublicKey)\n\tif !ok {\n\t\treturn nil, errors.New(\"certificate does not contain valid ECDSA public key\")\n\t}\n\n\treturn lowLevelKey, nil\n}", "func (pk *PublicKey) Pack(buf []byte) {\n\tif len(buf) != PublicKeySize {\n\t\tpanic(\"buf must be of length PublicKeySize\")\n\t}\n\n\tpk.pk.Pack(buf)\n}", "func encodePublicKey(public *rsa.PublicKey) ([]byte, error) {\n\tpublicBytes, err := x509.MarshalPKIXPublicKey(public)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn pem.EncodeToMemory(&pem.Block{\n\t\tBytes: publicBytes,\n\t\tType: \"PUBLIC KEY\",\n\t\tHeaders: nil,\n\t}), nil\n}", "func (c *directClient) PutEntry(ctx context.Context, _ cipher.SecKey, entry *disc.Entry) error {\n\tc.mx.Lock()\n\tdefer c.mx.Unlock()\n\tc.entries[entry.Static] = entry\n\treturn nil\n}", "func (p *Resolver) AddForkEntry(entry *model.ProcessCacheEntry) {\n\tp.Lock()\n\tdefer p.Unlock()\n\n\tp.insertForkEntry(entry, model.ProcessCacheEntryFromEvent)\n}", "func (lib *PKCS11Lib) exportRSAPublicKey(session pkcs11.SessionHandle, pubHandle pkcs11.ObjectHandle) (crypto.PublicKey, error) {\n\tlogger.Tracef(\"session=0x%X, obj=0x%X\", session, pubHandle)\n\ttemplate := []*pkcs11.Attribute{\n\t\tpkcs11.NewAttribute(pkcs11.CKA_MODULUS, nil),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_PUBLIC_EXPONENT, nil),\n\t}\n\texported, err := lib.Ctx.GetAttributeValue(session, pubHandle, template)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tvar modulus = new(big.Int)\n\tmodulus.SetBytes(exported[0].Value)\n\tvar bigExponent = new(big.Int)\n\tbigExponent.SetBytes(exported[1].Value)\n\tif bigExponent.BitLen() > 32 {\n\t\treturn nil, errors.WithStack(errMalformedRSAKey)\n\t}\n\tif bigExponent.Sign() < 1 {\n\t\treturn nil, errors.WithStack(errMalformedRSAKey)\n\t}\n\texponent := int(bigExponent.Uint64())\n\tresult := rsa.PublicKey{\n\t\tN: modulus,\n\t\tE: exponent,\n\t}\n\tif result.E < 2 {\n\t\treturn nil, errors.WithStack(errMalformedRSAKey)\n\t}\n\treturn &result, nil\n}", "func (s *BaserpnListener) EnterSignedAtom(ctx *SignedAtomContext) {}", "func (k *EnterpriseCertSigner) Public(ignored struct{}, publicKey *[]byte) (err error) {\n\tif len(k.cert.Certificate) == 0 {\n\t\treturn nil\n\t}\n\tcert, err := x509.ParseCertificate(k.cert.Certificate[0])\n\tif err != nil {\n\t\treturn err\n\t}\n\t*publicKey, err = x509.MarshalPKIXPublicKey(cert.PublicKey)\n\treturn err\n}", "func (ctx Ctx) ImportPublicKeyInfo(cert Cert) (Key, error) {\n\tvar res Key\n\tif C.CryptImportPublicKeyInfoEx(ctx.hProv, C.MY_ENC_TYPE, &cert.pCert.pCertInfo.SubjectPublicKeyInfo, 0, 0, nil, &res.hKey) == 0 {\n\t\treturn res, getErr(\"Error importing public key info\")\n\t}\n\treturn res, nil\n}", "func (k Keeper) addPubkey(ctx sdk.Context, pubkey crypto.PubKey) {\n\taddr := pubkey.Address()\n\tk.setAddrPubkeyRelation(ctx, addr, pubkey)\n}", "func (a *Account) PublicKey() *PubKey {\n\tk := new(PubKey)\n\tcopy(k[:], a.pub[:])\n\treturn k\n}", "func (d *Deployer) AddEntry(name, value string) (*r.ChangeResourceRecordSetsResponse, error) {\n\tif !strings.HasPrefix(name, \"_dnslink.\") {\n\t\treturn nil, errors.New(\"invalid dnslink name\")\n\t}\n\tformattedValue := fmt.Sprintf(\"\\\"%s\\\"\", value)\n\treturn d.client.Zone(d.zoneID).Add(\"TXT\", name, formattedValue)\n}", "func (s Seed) PublicKey(index uint64) types.SiaPublicKey {\n\tkey := s.deriveKeyPair(index)\n\treturn types.SiaPublicKey{\n\t\tAlgorithm: types.SignatureEd25519,\n\t\tKey: key[len(key)-ed25519.PublicKeySize:],\n\t}\n}", "func NewPublicKey(ki crypto.PubKey) PublicKey {\n\treturn &publicKey{ki: ki}\n}", "func submitEntryToAnchorChain(aRecord *AnchorRecord) error {\n\n\t//Marshal aRecord into json\n\tjsonARecord, err := json.Marshal(aRecord)\n\tanchorLog.Debug(\"submitEntryToAnchorChain - jsonARecord: \", string(jsonARecord))\n\tif err != nil {\n\t\treturn err\n\t}\n\tbufARecord := new(bytes.Buffer)\n\tbufARecord.Write(jsonARecord)\n\t//Sign the json aRecord with the server key\n\taRecordSig := serverPrivKey.Sign(jsonARecord)\n\t//Encode sig into Hex string\n\tbufARecord.Write([]byte(hex.EncodeToString(aRecordSig.Sig[:])))\n\n\t//Create a new entry\n\tentry := common.NewEntry()\n\tentry.ChainID = anchorChainID\n\tanchorLog.Debug(\"anchorChainID: \", anchorChainID)\n\tentry.Content = bufARecord.Bytes()\n\n\tbuf := new(bytes.Buffer)\n\t// 1 byte version\n\tbuf.Write([]byte{0})\n\t// 6 byte milliTimestamp (truncated unix time)\n\tbuf.Write(milliTime())\n\t// 32 byte Entry Hash\n\tbuf.Write(entry.Hash().Bytes())\n\t// 1 byte number of entry credits to pay\n\tbinaryEntry, err := entry.MarshalBinary()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tanchorLog.Info(\"jsonARecord binary entry: \", hex.EncodeToString(binaryEntry))\n\tif c, err := util.EntryCost(binaryEntry); err != nil {\n\t\treturn err\n\t} else {\n\t\tbuf.WriteByte(byte(c))\n\t}\n\ttmp := buf.Bytes()\n\tsig := serverECKey.Sign(tmp)\n\tbuf = bytes.NewBuffer(tmp)\n\tbuf.Write(serverECKey.Pub.Key[:])\n\tbuf.Write(sig.Sig[:])\n\n\tcommit := common.NewCommitEntry()\n\terr = commit.UnmarshalBinary(buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// create a CommitEntry msg and send it to the local inmsgQ\n\tcm := factomwire.NewMsgCommitEntry()\n\tcm.CommitEntry = commit\n\tinMsgQ <- cm\n\n\t// create a RevealEntry msg and send it to the local inmsgQ\n\trm := factomwire.NewMsgRevealEntry()\n\trm.Entry = entry\n\tinMsgQ <- rm\n\n\treturn nil\n}", "func (i service) AddKey(ctx context.Context, key id.KeyDID) error {\n\tDID, err := NewDIDFromContext(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontract, opts, err := i.prepareTransaction(ctx, DID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Info(\"Add key to identity contract %s\", DID.ToAddress().String())\n\ttxID, done, err := i.txManager.ExecuteWithinTX(context.Background(), DID, transactions.NilTxID(), \"Check TX for add key\",\n\t\ti.ethereumTX(opts, contract.AddKey, key.GetKey(), key.GetPurpose(), key.GetType()))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tisDone := <-done\n\t// non async task\n\tif !isDone {\n\t\treturn errors.New(\"add key TX failed: txID:%s\", txID.String())\n\n\t}\n\treturn nil\n\n}", "func (s *streamKey) add(entryID string, values []string, now time.Time) (string, error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tif entryID == \"\" || entryID == \"*\" {\n\t\tentryID = s.generateID(now)\n\t}\n\n\tentryID, err := formatStreamID(entryID)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif entryID == \"0-0\" {\n\t\treturn \"\", errors.New(msgStreamIDZero)\n\t}\n\tif streamCmp(s.lastIDUnlocked(), entryID) != -1 {\n\t\treturn \"\", errors.New(msgStreamIDTooSmall)\n\t}\n\n\ts.entries = append(s.entries, StreamEntry{\n\t\tID: entryID,\n\t\tValues: values,\n\t})\n\treturn entryID, nil\n}", "func (p *PGP) SavePublicKey(keyFilename, version, passphrase string) (err error) {\n\tkeyBytes, err := p.toPublicKey(version)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot save public key: %s\", err)\n\t}\n\tif len(passphrase) > 0 {\n\t\tc := &AesCrypto{\n\t\t\tCipherMode: CBC,\n\t\t\tPadding: NoPadding,\n\t\t}\n\t\tencStr, err := c.Encrypt(string(keyBytes[:]), []byte(passphrase))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tkeyBytes = []byte(encStr)\n\t}\n\t// write the public key to a file\n\terr = ioutil.WriteFile(keyFilename, keyBytes, os.ModePerm)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot save public key: %s\", err)\n\t}\n\treturn nil\n}", "func (pk PublicKey) Encode() []byte {\n\treturn pk.publicKey.Encode()\n}", "func (nr NodeRecord) GetPublicKey() (string, error) {\n\treturn nr.Record.PublicKey, nil\n}", "func (s *LunaKeyStore) AddKey(keyInfo trustmanager.KeyInfo, privKey data.PrivateKey) error {\n\n\tvar (\n\t\tecdsaPublicKey *data.ECDSAPublicKey\n\t\trsaPublicKey *data.RSAPublicKey\n\t\terr error\n\t)\n\n\tlogrus.Debugf(\"LunaKeyStore.AddKey\")\n\n\trole := keyInfo.Role\n\n\tgeneratateRootKeyOnly := strings.ToLower(os.Getenv(\"NOTARY_LUNA_GENERATE_ROOT_KEYS_ONLY\")) == \"true\"\n\n\tif generatateRootKeyOnly && role != data.CanonicalRootRole {\n\t\treturn errors.New(\"Can only generate root keys in generate root keys only mode.\")\n\t}\n\n\talg := privKey.Algorithm()\n\n\tif alg == data.ECDSAKey {\n\t\tecdsaPublicKey, err = getECDSAPublicKeyFromPrivateKey(privKey)\n\t\tif err != nil {\n\t\t\tlogrus.Debugf(\"Error getting ECDSA Public key: %s\", err)\n\t\t\treturn err\n\t\t}\n\t} else if alg == data.RSAKey {\n\t\trsaPublicKey, err = getRSAPublicKeyFromPrivateKey(privKey)\n\t\tif err != nil {\n\t\t\tlogrus.Debugf(\"Error getting RSA Public key: %s\", err)\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\treturn errors.New(\"Invalid key type.\")\n\t}\n\n\tp, session, c, err := SetupLuna(true, s.passRetriever)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer CleanupLuna(p, session, c)\n\tgun := keyInfo.Gun\n\n\tif alg == data.ECDSAKey {\n\t\tlunaPrivateKey, err := generateECDSAKey(p, session, gun, s.passRetriever, role)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t//Store the public key value for the generated key in the public key for the added key.\n\t\tlunaECDSAPublicKey, ok := lunaPrivateKey.PublicKey.(*data.ECDSAPublicKey)\n\t\tif !ok {\n\t\t\treturn errors.New(\"Unable to get PublicKey from luna private key.\")\n\t\t}\n\t\tecdsaPublicKey.Value = lunaECDSAPublicKey.Value\n\t\tecdsaPublicKey.ResetID()\n\t} else if alg == data.RSAKey {\n\t\tlunaPrivateKey, err := generateRSAKey(p, session, gun, s.passRetriever, role)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlunaRSAPublicKey, ok := lunaPrivateKey.PublicKey.(*data.RSAPublicKey)\n\t\tif !ok {\n\t\t\treturn errors.New(\"Unable to get PublicKey from luna private key.\")\n\t\t}\n\t\trsaPublicKey.Value = lunaRSAPublicKey.Value\n\t\trsaPublicKey.ResetID()\n\t}\n\tfmt.Printf(\"Luna: Generated %s key: %s\\n\", role, privKey.ID())\n\n\treturn nil\n}", "func MakePublicKey(privateKey *[64]byte) (publicKey *[32]byte) {\n\tpublicKey = new([32]byte)\n\n\th := sha512.New()\n\th.Write(privateKey[:32])\n\tdigest := h.Sum(nil)\n\n\tdigest[0] &= 248\n\tdigest[31] &= 127\n\tdigest[31] |= 64\n\n\tvar A edwards25519.ExtendedGroupElement\n\tvar hBytes [32]byte\n\tcopy(hBytes[:], digest)\n\tedwards25519.GeScalarMultBase(&A, &hBytes)\n\tA.ToBytes(publicKey)\n\n\tcopy(privateKey[32:], publicKey[:])\n\treturn\n}", "func Add(a, b *ecdsa.PublicKey) *ecdsa.PublicKey {\n\tkey := new(ecdsa.PublicKey)\n\tkey.Curve = Secp256k1()\n\tkey.X, key.Y = Secp256k1().Add(a.X, a.Y, b.X, b.Y)\n\treturn key\n}", "func (t *EnterEntry) Encode(w io.Writer) error {\n\tif _, err := w.Write([]byte{EntryEnter}); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := leb128.WriteVarUint32(w, uint32(len(t.ModuleName))); err != nil {\n\t\treturn err\n\t}\n\tif _, err := w.Write([]byte(t.ModuleName)); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := leb128.WriteVarUint32(w, t.FunctionIndex); err != nil {\n\t\treturn err\n\t}\n\n\treturn t.FunctionSignature.MarshalWASM(w)\n}", "func NewPublicKey(name ndn.Name, key *rsa.PublicKey) (keychain.PublicKey, error) {\n\tif !keychain.IsKeyName(name) {\n\t\treturn nil, keychain.ErrKeyName\n\t}\n\tvar pub publicKey\n\tpub.name = name\n\tpub.key = key\n\treturn &pub, nil\n}", "func (s *Store) Add(ctx context.Context, key interface{}, v json.Marshaler) error {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tdefault:\n\t}\n\n\tb, err := v.MarshalJSON()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tdefault:\n\t}\n\n\tif _, ok := s.m[key]; ok {\n\t\treturn store.ErrKeyExists\n\t}\n\n\ts.m[key] = entry{data: b}\n\treturn nil\n}", "func (ks *KeyStore) PublicKey(kid string) (*rsa.PublicKey, error) {\n\tks.mu.RLock()\n\tdefer ks.mu.RUnlock()\n\n\tprivateKey, found := ks.store[kid]\n\tif !found {\n\t\treturn nil, errors.New(\"kid lookup failed\")\n\t}\n\treturn &privateKey.PublicKey, nil\n}", "func (o *TppCertificateParams) SetPublicKey(v string) {\n\to.PublicKey = v\n}", "func (c *Client) FilterEntryAdd(tenant, filter, entry, etherType, ipProto, srcPortFrom, srcPortTo, dstPortFrom, dstPortTo string) error {\n\n\tme := \"FilterEntryAdd\"\n\n\trn := rnFilterEntry(entry)\n\tdn := dnFilterEntry(tenant, filter, entry)\n\n\tapi := \"/api/node/mo/uni/\" + dn + \".json\"\n\n\turl := c.getURL(api)\n\n\tj := fmt.Sprintf(`{\"vzEntry\":{\"attributes\":{\"dn\":\"uni/%s\",\"name\":\"%s\",\"etherT\":\"%s\",\"status\":\"created,modified\",\"prot\":\"%s\",\"sFromPort\":\"%s\",\"sToPort\":\"%s\",\"dFromPort\":\"%s\",\"dToPort\":\"%s\",\"rn\":\"%s\"}}}`,\n\t\tdn, entry, etherType, ipProto, srcPortFrom, srcPortTo, dstPortFrom, dstPortTo, rn)\n\n\tc.debugf(\"%s: url=%s json=%s\", me, url, j)\n\n\tbody, errPost := c.post(url, contentTypeJSON, bytes.NewBufferString(j))\n\tif errPost != nil {\n\t\treturn fmt.Errorf(\"%s: %v\", me, errPost)\n\t}\n\n\tc.debugf(\"%s: reply: %s\", me, string(body))\n\n\treturn parseJSONError(body)\n}", "func readPublicKey(d *pluginsdk.ResourceData, pubKey interface{}) error {\n\tpubKeyBytes, err := x509.MarshalPKIXPublicKey(pubKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to marshal public key error: %s\", err)\n\t}\n\tpubKeyPemBlock := &pem.Block{\n\t\tType: \"PUBLIC KEY\",\n\t\tBytes: pubKeyBytes,\n\t}\n\n\td.Set(\"public_key_pem\", string(pem.EncodeToMemory(pubKeyPemBlock)))\n\n\tsshPubKey, err := ssh.NewPublicKey(pubKey)\n\tif err == nil {\n\t\t// Not all EC types can be SSH keys, so we'll produce this only\n\t\t// if an appropriate type was selected.\n\t\tsshPubKeyBytes := ssh.MarshalAuthorizedKey(sshPubKey)\n\t\td.Set(\"public_key_openssh\", string(sshPubKeyBytes))\n\t} else {\n\t\td.Set(\"public_key_openssh\", \"\")\n\t}\n\treturn nil\n}", "func (mc *MemoryStorage) Add(key string, data interface{}) {\n\tmc.Lock()\n\tif _, found := mc.bucket[key]; found {\n\t\tdelete(mc.bucket, key)\n\t}\n\tmc.bucket[key] = entity{object: data}\n\tmc.Unlock()\n}", "func _dbKeyForMessageEntry(publicKey []byte, tstampNanos uint64) []byte {\n\t// Make a copy to avoid multiple calls to this function re-using the same slice.\n\tprefixCopy := append([]byte{}, _PrefixPublicKeyTimestampToPrivateMessage...)\n\tkey := append(prefixCopy, publicKey...)\n\tkey = append(key, EncodeUint64(tstampNanos)...)\n\treturn key\n}", "func (oz *OutputZip) addZipEntry(name string, source ZipEntryContents) (ZipEntryContents, error) {\n\tif existingSource, exists := oz.sourceByDest[name]; exists {\n\t\treturn existingSource, nil\n\t}\n\toz.sourceByDest[name] = source\n\t// Delay writing an entry if entries need to be rearranged.\n\tif oz.emulateJar || oz.sortEntries {\n\t\treturn nil, nil\n\t}\n\treturn nil, source.WriteToZip(name, oz.outputWriter)\n}", "func (s *slotsPosition) PutEntryHeader(e *EntryHeader) bool {\n\te.nextFree &= IdMask\n\treturn s.Put(e.nextFree)\n}", "func NewPublicKey(authenticatorType AuthenticatorType, signatureAlgorithm SignatureAlgorithm, keyData []byte, keyID string) (*PublicKey, error) {\n\tnewKeyID := \"\"\n\tswitch authenticatorType {\n\tcase Pgp:\n\t\tid, err := extractPgpKeyID(keyData)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnewKeyID = id\n\t\tif signatureAlgorithm != PGPUnused {\n\t\t\treturn nil, fmt.Errorf(\"expected undefined signature algorithm with PGP key type\")\n\t\t}\n\tcase Pkix, Jwt:\n\t\tid, err := extractPkixKeyID(keyData, keyID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnewKeyID = id\n\t\tif signatureAlgorithm == UnknownSigningAlgorithm || signatureAlgorithm == PGPUnused {\n\t\t\treturn nil, fmt.Errorf(\"expected signature algorithm with JWT/PKIX key type\")\n\t\t}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid AuthenticatorType\")\n\t}\n\n\treturn &PublicKey{\n\t\tAuthenticatorType: authenticatorType,\n\t\tSignatureAlgorithm: signatureAlgorithm,\n\t\tKeyData: keyData,\n\t\tID: newKeyID,\n\t}, nil\n}", "func (j *Journal) AddEntry(entry entry.Entry) {\n\tj.Entries = append(j.Entries, entry)\n\tj.NumEntries++\n\n\treturn\n}", "func MyIdentityKey() []byte {\n\treturn identityKey.PublicKey.Serialize()\n}", "func (ec *EthereumChain) OnPublicKeyPublished(\n\tkeepAddress common.Address,\n\thandler func(event *eth.PublicKeyPublishedEvent),\n) (subscription.EventSubscription, error) {\n\tkeepContract, err := ec.getKeepContract(keepAddress)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create contract abi: [%v]\", err)\n\t}\n\n\treturn keepContract.WatchPublicKeyPublished(\n\t\tfunc(\n\t\t\tPublicKey []byte,\n\t\t\tblockNumber uint64,\n\t\t) {\n\t\t\thandler(&eth.PublicKeyPublishedEvent{\n\t\t\t\tPublicKey: PublicKey,\n\t\t\t})\n\t\t},\n\t\tfunc(err error) error {\n\t\t\treturn fmt.Errorf(\"keep created callback failed: [%v]\", err)\n\t\t},\n\t)\n}", "func (h *HostsManager) add(ip, hostname string) error {\n\th.Lock()\n\tdefer h.Unlock()\n\th.hosts[ip] = hostname\n\tif err := OverwriteFile(h.path, h.String()); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s NativeSigner) PublicKey() ([]byte, error) {\n\tkeybuf := new(bytes.Buffer)\n\tif err := (*openpgp.Entity)(&s).Serialize(keybuf); err != nil {\n\t\treturn nil, err\n\t}\n\treturn keybuf.Bytes(), nil\n}", "func (authcl *Client) AddKey(key, description string, temp bool) error {\n\terr := authcl.LoadToken()\n\tif err != nil {\n\t\treturn err\n\t}\n\tnewkey := gogs.PublicKey{Key: key, Title: description}\n\taddress := fmt.Sprintf(\"/api/v1/user/keys\")\n\tres, err := authcl.Post(address, newkey)\n\tif err != nil {\n\t\treturn err\n\t} else if res.StatusCode != http.StatusCreated {\n\t\treturn fmt.Errorf(\"[Add key] Failed. Server returned %s\", res.Status)\n\t}\n\tweb.CloseRes(res.Body)\n\treturn nil\n}", "func StoreECDSAPublicKey(publicKey *ecdsa.PublicKey, path string) error {\n\tpemBlock, err := EncodePublicKeyToPEM(publicKey)\n\tif err != nil {\n\t\treturn errors.WithStackTrace(err)\n\t}\n\treturn errors.WithStackTrace(StorePEM(pemBlock, path))\n}", "func (i *Identity) Public() (*ecdsa.PublicKey, error) {\n\treturn crypto.ParseECDSAPublicKey(i.PublicKey)\n}", "func (o KeystoresAliasesPkcs12CertsInfoCertInfoOutput) PublicKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v KeystoresAliasesPkcs12CertsInfoCertInfo) *string { return v.PublicKey }).(pulumi.StringPtrOutput)\n}", "func (store *keyStore) GetPublicKey(address string) (*openpgp.Entity, error) {\n\tel := store.lookupPublicKey(address)\n\tif len(el) > 0 {\n\t\treturn el[0], nil\n\t}\n\treturn nil, nil\n}", "func (kp *KeyPool) AddVerifyKey(key *[ed25519.PublicKeySize]byte) {\n\tkp.mapMutex.Lock()\n\tdefer kp.mapMutex.Unlock()\n\tkp.VerifyPubKeys[*key] = true\n}", "func (rm *ReconstructingMember) individualPublicKey() *bn256.G2 {\n\treturn rm.publicKeySharePoints[0]\n}", "func (pk *PublicKey) SaveToDB() error {\n\treturn model.SetPublicKey(string(pk.ID), pk)\n}", "func (store *KVStore) add(key string, val []byte, isOrigin bool) {\n\tstore.ht[key] = val\n\tstore.isOrigin[key] = isOrigin\n}", "func (ec *ECPoint) ToPublicKey() *ecdsa.PublicKey {\n\tres := new(ecdsa.PublicKey)\n\tres.X = ec.X\n\tres.Y = ec.Y\n\tres.Curve = ec.Curve\n\n\treturn res\n}", "func (kb *Keybase) ImportPubKey(name, armor string) (err error) {\n\tkb.mx.Lock()\n\tdefer kb.mx.Unlock()\n\treturn kb.kb.ImportPubKey(name, armor)\n}", "func (o KeystoresAliasesKeyCertFileCertsInfoCertInfoOutput) PublicKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v KeystoresAliasesKeyCertFileCertsInfoCertInfo) *string { return v.PublicKey }).(pulumi.StringPtrOutput)\n}", "func WithPublicKey(publicKey *PublicKeyType) Opt {\n\treturn func(opts *Options) {\n\t\topts.PublicKey = publicKey\n\t}\n}" ]
[ "0.63024616", "0.59909403", "0.569348", "0.5526946", "0.5513472", "0.5460001", "0.5453411", "0.5379979", "0.533164", "0.53291917", "0.532534", "0.5313849", "0.5195983", "0.515629", "0.51547736", "0.51377964", "0.50954324", "0.50908095", "0.50813365", "0.50612247", "0.5059582", "0.5053476", "0.5044166", "0.5040529", "0.50394887", "0.50099945", "0.5005571", "0.4987909", "0.49824768", "0.49661624", "0.49561372", "0.49363592", "0.49344683", "0.49298465", "0.49046123", "0.48988062", "0.48965222", "0.48780137", "0.48716468", "0.48716468", "0.4867667", "0.4828541", "0.48273677", "0.48048905", "0.47933063", "0.4783816", "0.47535288", "0.47443968", "0.47397164", "0.47362936", "0.472725", "0.471893", "0.47145432", "0.47057664", "0.47021678", "0.47018716", "0.46941057", "0.46899536", "0.4689769", "0.46842408", "0.46769923", "0.4675316", "0.46740147", "0.46712714", "0.46687576", "0.4662243", "0.4654695", "0.4650483", "0.46481568", "0.46354544", "0.46345562", "0.46269768", "0.46248388", "0.46231812", "0.46205243", "0.4619878", "0.46175912", "0.46086717", "0.45992547", "0.45967022", "0.45963252", "0.45948568", "0.45944494", "0.4587871", "0.45850253", "0.45767793", "0.45748705", "0.45710596", "0.4568785", "0.4563817", "0.45554936", "0.45529372", "0.45380667", "0.4536425", "0.4532901", "0.45322222", "0.45303544", "0.45266858", "0.45243704", "0.45096633" ]
0.847996
0
GetSessionState implemented in memory.
func (ms *MemStore) GetSessionState(sessionStateKey string) ( *session.State, error, ) { return ms.sessionStates[sessionStateKey], nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetState(sid string, sessionKey string, rs RedisStore, sessionState interface{}) (interface{}, error) {\n\ttoken, err:= ValidateID(sid, sessionKey)\n\n\tif err != nil {\n\t\treturn \"invalid session\", err\n\t}\n\n\tsessionState, err = rs.Get(token, sessionState)\n\t// fmt.Printf(\"user is: %+v\\n\", sessionState)\n\n\tif err != nil {\n\t\treturn \"invalid session\", err\n\t}\n\n\tfmt.Println(\"session successfully retrived\", err)\n\n\treturn sessionState, nil\n\n}", "func GetState(key string) interface{} {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\treturn state[key]\n}", "func GetCurrentState() {\n\n}", "func (rs *RedisStore) Get(sid SessionID, sessionState interface{}) error {\n\t//for extra-credit using the Pipeline feature of the redis\n\t//package to do both the get and the reset of the expiry time\n\t//in just one network round trip!\n\n\t// Set up pipelining to get previously saved session state data from redis\n\trsPipeline := rs.Client.Pipeline()\n\tpreviousSessionPipeline := rsPipeline.Get(sid.getRedisKey())\n\n\t// Reset expiry time, so doesn't get deleted until SessionDuration has passed.\n\trsPipeline.Expire(sid.getRedisKey(), rs.SessionDuration)\n\n\trsPipeline.Exec()\n\tpreviousSessionState, err := previousSessionPipeline.Result()\n\tif err != nil {\n\t\tlog.Printf(\"!!! NOTE TO SLEEPY JAY, THIS NEXT ONE IS THE ONE I CARE ABOUT\")\n\t\tlog.Printf(\"Inside Get - The error is\" + err.Error())\n\t\treturn ErrStateNotFound\n\t}\n\n\tjsonBuffer := []byte(previousSessionState)\n\tif err := json.Unmarshal(jsonBuffer, sessionState); err != nil {\n\t\tlog.Printf(\"Inside Get - The second error is \" + err.Error())\n\t\treturn ErrStateNotFound\n\t}\n\n\t//log.Printf(\"Inside Get -returning with no errors\", err)\n\n\treturn nil\n\n\t/*\n\t\tlog.Printf(\"THE CODE HAS CHANGED TO JAY'S CODE\")\n\n\t\tkey := sid.getRedisKey()\n\t\tj := rs.Client.Get(key)\n\n\t\t//reset TTL\n\t\trs.Client.Set(sid.String(), j, time.Hour)\n\n\t\t//for extra-credit using the Pipeline feature of the redis\n\t\t//package to do both the get and the reset of the expiry time\n\t\t//in just one network round trip!\n\n\t\t//documentation TODO here https://redis.uptrace.dev/\n\n\t\tbytesJ, err := j.Bytes()\n\t\tif err != nil {\n\t\t\treturn ErrStateNotFound\n\t\t}\n\t\treturn json.Unmarshal(bytesJ, sessionState)\n\t*/\n}", "func (_DelegationController *DelegationControllerCallerSession) GetState(delegationId *big.Int) (uint8, error) {\n\treturn _DelegationController.Contract.GetState(&_DelegationController.CallOpts, delegationId)\n}", "func (_DelegationController *DelegationControllerSession) GetState(delegationId *big.Int) (uint8, error) {\n\treturn _DelegationController.Contract.GetState(&_DelegationController.CallOpts, delegationId)\n}", "func GetState(ctx context.Context, tconn *chrome.TestConn) (State, error) {\n\tvar st State\n\tif err := tconn.EvalPromise(ctx, `tast.promisify(chrome.autotestPrivate.loginStatus)()`, &st); err != nil {\n\t\treturn st, errors.Wrap(err, \"failed calling chrome.autotestPrivate.loginStatus\")\n\t}\n\treturn st, nil\n}", "func (rs *RedisStore) Get(sid SessionID, state interface{}) error {\n\tpipe := rs.Client.Pipeline()\n\tsc := pipe.Get(sid.getRedisKey())\n\tpipe.Expire(sid.getRedisKey(), rs.SessionDuration)\n\n\t_, err := pipe.Exec()\n\n\tif err == redis.Nil {\n\t\treturn ErrStateNotFound\n\t} else if err != nil {\n\t\treturn err\n\t}\n\n\tdata, err := sc.Bytes()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = json.Unmarshal(data, state)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (delegateObject *delegateObject) GetState(db Database, key common.Hash) common.Hash {\n\tvalue, exists := delegateObject.cachedStorage[key]\n\tif exists {\n\t\treturn value\n\t}\n\t// Load from DB in case it is missing.\n\tenc, err := delegateObject.getTrie(db).TryGet(key[:])\n\tif err != nil {\n\t\tdelegateObject.setError(err)\n\t\treturn common.Hash{}\n\t}\n\tif len(enc) > 0 {\n\t\t_, content, _, err := rlp.Split(enc)\n\t\tif err != nil {\n\t\t\tdelegateObject.setError(err)\n\t\t}\n\t\tvalue.SetBytes(content)\n\t}\n\tif (value != common.Hash{}) {\n\t\tdelegateObject.cachedStorage[key] = value\n\t}\n\treturn value\n}", "func idle() State_t {\n\t\n}", "func (ec EncryptedStateContext) State() state.State {\n\ts, _ := StateWithTransientKey(ec)\n\treturn s\n}", "func (db *CassandraDB) GetState(userid gocql.UUID) (*State, error) {\n\tstate := State{Id: userid}\n\terr := db.Session.Query(`\n select gamesPlayed, score from User where id = ?`,\n\t\tstate.Id).Scan(&state.GamesPlayed, &state.Highscore)\n\treturn &state, err\n}", "func luaGetSession(L *lua.LState, sess *core.MilterSession) lua.LValue {\n\tud := L.NewUserData()\n\tud.Value = sess\n\tL.SetMetatable(ud, L.GetTypeMetatable(\"session\"))\n\tL.Push(ud)\n\n\treturn ud\n}", "func (wc *WasmContext) state() kv.KVStoreReader {\n\tctx := wc.wcSandbox.ctx\n\tif ctx != nil {\n\t\treturn ctx.State()\n\t}\n\tctxView := wc.wcSandbox.ctxView\n\tif ctxView != nil {\n\t\treturn ctxView.StateR()\n\t}\n\tpanic(\"cannot access state\")\n}", "func (d delegate) LocalState(join bool) []byte { return nil }", "func (c *SCClient) StateGet(ctx context.Context, key string) ([]byte, error) {\n\treturn c.ChainClient.StateGet(ctx, string(c.ContractHname.Bytes())+key)\n}", "func (c *Prometheus) getState(name string) state.State {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tst, ok := c.states[name]\n\tif !ok {\n\t\tst = c.stFactory.Create()\n\t\tc.states[name] = st\n\t}\n\n\treturn st\n}", "func (self *StateObject) GetState(db trie.Database, key helper.Hash) helper.Hash {\n\tvalue, exists := self.cachedStorage[key]\n\tif exists {\n\t\treturn value\n\t}\n\t// Load from DB in case it is missing.\n\tif enc := self.getTrie(db).Get(key[:]); len(enc) > 0 {\n\t\t_, content, _, err := rlp.Split(enc)\n\t\tif err != nil {\n\t\t\tself.setError(err)\n\t\t}\n\t\tvalue.SetBytes(content)\n\t}\n\tif (value != helper.Hash{}) {\n\t\tself.cachedStorage[key] = value\n\t}\n\treturn value\n}", "func (c *GRPCClient) GetState(ctx context.Context, store, key string) (out []byte, etag string, err error) {\n\treturn c.GetStateWithConsistency(ctx, store, key, StateConsistencyStrong)\n}", "func (stub *MockStub) GetState(key string) ([]byte, error) {\n\tvalue := stub.State[key]\n\treturn value, nil\n}", "func (a *Authenticator) getSession(r *http.Request) *authState {\n\tcookie, err := r.Cookie(cookieName)\n\tif err != nil {\n\t\tif err != http.ErrNoCookie {\n\t\t\t// should be the only kind of error\n\t\t\tlog.Printf(\"googlelogin: error: ignoring unexpected error getting cookie: %s\", err.Error())\n\t\t}\n\t\t// no session: return an empty session\n\t\treturn &authState{}\n\t}\n\n\tsession := &authState{}\n\terr = a.securecookies.Decode(cookie.Name, cookie.Value, session)\n\tif err != nil {\n\t\tlog.Printf(\"googlelogin: error: ignoring invalid session cookie: %s\", err.Error())\n\t\treturn &authState{}\n\t}\n\treturn session\n}", "func (mc *mgmtClient) GetSessionState(ctx context.Context, sessionID string) ([]byte, error) {\n\tamqpMsg := &amqp.Message{\n\t\tValue: map[string]interface{}{\n\t\t\t\"session-id\": sessionID,\n\t\t},\n\t\tApplicationProperties: map[string]interface{}{\n\t\t\t\"operation\": \"com.microsoft:get-session-state\",\n\t\t},\n\t}\n\n\tresp, err := mc.doRPCWithRetry(ctx, amqpMsg, 5, 5*time.Second)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.Code != 200 {\n\t\treturn nil, ErrAMQP(*resp)\n\t}\n\n\tasMap, ok := resp.Message.Value.(map[string]interface{})\n\n\tif !ok {\n\t\treturn nil, NewErrIncorrectType(\"Value\", map[string]interface{}{}, resp.Message.Value)\n\t}\n\n\tval := asMap[\"session-state\"]\n\n\tif val == nil {\n\t\t// no session state set\n\t\treturn nil, nil\n\t}\n\n\tasBytes, ok := val.([]byte)\n\n\tif !ok {\n\t\treturn nil, NewErrIncorrectType(\"Value['session-state']\", []byte{}, asMap[\"session-state\"])\n\t}\n\n\treturn asBytes, nil\n}", "func (s *SecretManager) getCurrentState(namespace string, name string) (map[string][]byte, error) {\n\tcurrentState, err := s.kubernetes.ReadSecret(namespace, name)\n\tif err != nil {\n\t\tlogger.Debugf(\"failed to read '%s/%s' secret from kubernetes api: %v\", namespace, name, err)\n\t}\n\treturn currentState, err\n}", "func newTCPCryptoState(sessionKey *[32]byte, outbound bool) *tcpCryptoState {\n\ts := &tcpCryptoState{sessionKey: sessionKey}\n\tif outbound {\n\t\ts.nonce[0] |= (1 << 7)\n\t}\n\ts.nonce[0] |= (1 << 6)\n\treturn s\n}", "func (m *VppToken) GetState()(*VppTokenState) {\n return m.state\n}", "func (_DelegationController *DelegationControllerCaller) GetState(opts *bind.CallOpts, delegationId *big.Int) (uint8, error) {\n\tvar (\n\t\tret0 = new(uint8)\n\t)\n\tout := ret0\n\terr := _DelegationController.contract.Call(opts, out, \"getState\", delegationId)\n\treturn *ret0, err\n}", "func (c *SCClient) StateGet(key string) ([]byte, error) {\n\treturn c.ChainClient.StateGet(string(c.ContractHname.Bytes()) + key)\n}", "func (s *Session) getState(primitive primitiveapi.PrimitiveId) *headers.RequestHeader {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\treturn &headers.RequestHeader{\n\t\tPrimitive: primitive,\n\t\tPartition: uint32(s.Partition),\n\t\tSessionID: s.SessionID,\n\t\tIndex: s.lastIndex,\n\t\tRequestID: s.responseID,\n\t\tStreams: s.getStreamHeaders(),\n\t}\n}", "func (rc *Ctx) State() State {\n\treturn rc.state\n}", "func (k Keeper) State(c context.Context, req *types.QueryStateRequest) (*types.QueryStateResponse, error) {\n\tctx := sdk.UnwrapSDKContext(c)\n\tstate := k.GetState(ctx)\n\n\treturn &types.QueryStateResponse{State: state}, nil\n}", "func GetState(fd uintptr) (*State, error) {\n\treturn &State{}, nil\n}", "func (pder *MemSessionProvider) GetSession(sid string) (Session, error) {\r\n\tpder.lock.RLock()\r\n\tdefer pder.lock.RUnlock()\r\n\r\n\tif element, ok := pder.sessions[sid]; ok {\r\n\t\tsw := element.Value.(Session)\r\n\t\tif sw == nil {\r\n\t\t\treturn nil, nil\r\n\t\t}\r\n\t\tattributes := sw.Attributes().(*MemSessionAttributes)\r\n\t\tif attributes != nil {\r\n\t\t\tattributes.timeAccessed = time.Now()\r\n\t\t}\r\n\t\treturn sw, nil\r\n\t} else {\r\n\t\treturn nil, nil\r\n\t}\r\n}", "func (session *NetSession) GoNextState(methodName string) bool {\n\tif methodName != SETUP && methodName != TEARDOWN && methodName != PLAY &&\n\t\tmethodName != RECORD && methodName != PAUSE {\n\t\treturn true\n\t}\n\tserverState, ok := machinaStateMap[session.serverState+methodName]\n\tif ok {\n\t\tsession.serverState = serverState\n\t}\n\treturn ok\n}", "func (m *ExternalConnection) GetState()(*ConnectionState) {\n return m.state\n}", "func (instance *ClassicCluster) unsafeGetState(inctx context.Context) (_ clusterstate.Enum, _ fail.Error) {\n\treturn instance.state, nil\n}", "func (pdr *ProviderMySQL) SessionRead(sid string) (session.Store, error) {\n\tc := pdr.connectInit()\n\trow := c.QueryRow(\"select session_data from \"+TableName+\" where session_key=?\", sid)\n\tvar data []byte\n\terr := row.Scan(&data)\n\t//if err == sql.ErrNoRows {\n\t//\tconn.Exec(\"insert into \"+TableName+\"(`session_key`,`session_data`,`session_expiry`) values(?,?,?)\",\n\t//\t\tsid, \"\", time.Now().Unix())\n\t//}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar kv map[interface{}]interface{}\n\tif len(data) == 0 {\n\t\tkv = make(map[interface{}]interface{})\n\t} else {\n\t\tkv, err = session.DecodeGob(data)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\trs := &SessionStoreMySQL{conn: c, sid: sid, values: kv}\n\treturn rs, nil\n}", "func (m *User) GetState()(*string) {\n return m.state\n}", "func (process *process) getStateMachine(stateName string, tmpRow []interface{}) *statemachine.MachineState {\n\nStart:\n\tfor name, machine := range process.machine {\n\t\tif name == stateName {\n\t\t\treturn machine\n\t\t}\n\t}\n\tprocess.findStateAndAddToMachine(stateName, tmpRow)\n\tgoto Start\n\n}", "func (w *Watcher) GetState(key string) any {\n\tw.lock.RLock()\n\tdefer w.lock.RUnlock()\n\n\treturn w.stateCache[key]\n}", "func (s *StorageBase) GetSession(ctx context.Context, sessionId string, ttl time.Duration) (*gmap.StrAnyMap, error) {\n\treturn nil, ErrorDisabled\n}", "func Get(ctx context.Context) *Session {\n\t// TODO maybe check this\n\treturn ctx.Value(sessionContextKey{}).(*Session)\n}", "func (stateObj *stateObject) GetState(db StateDatabase, key common.Hash) common.Hash {\n\t// If the fake storage is set, only lookup the state here(in the debugging mode)\n\tif stateObj.fakeStorage != nil {\n\t\treturn stateObj.fakeStorage[key]\n\t}\n\t// If we have a dirty value for this state entry, return it\n\tvalue, dirty := stateObj.dirtyStorage[key]\n\tif dirty {\n\t\treturn value\n\t}\n\t// Otherwise return the entry's original value\n\treturn stateObj.GetCommittedState(db, key)\n}", "func (s *stateMachine) State() (*State, time.Time) {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\treturn s.state, s.ts\n}", "func (joinSession *JoinSession) getStateString() string {\n\tstate := string(joinSession.State)\n\n\tswitch joinSession.State {\n\tcase 1:\n\t\tstate = \"StateKeyExchange\"\n\tcase 2:\n\t\tstate = \"StateDcExponential\"\n\tcase 3:\n\t\tstate = \"StateDcXor\"\n\tcase 4:\n\t\tstate = \"StateTxInput\"\n\tcase 5:\n\t\tstate = \"StateTxSign\"\n\tcase 6:\n\t\tstate = \"StateTxPublish\"\n\tcase 7:\n\t\tstate = \"StateCompleted\"\n\tcase 8:\n\t\tstate = \"StateRevealSecret\"\n\t}\n\treturn state\n}", "func GetSession(sessionID string) (session *Session) {\n\tsession = &Session{ID: sessionID}\n\n\tconn := redisConnPool.Get()\n\tdefer conn.Close()\n\n\tkey := fmt.Sprintf(\"sessions:%s\", sessionID)\n\treply, err := redis.String(conn.Do(\"GET\", key))\n\tif err != nil {\n\t\t// NOTE: This is a normal situation, if the session is not stored in the cache, it will hit this condition.\n\t\treturn\n\t}\n\n\terr = json.Unmarshal([]byte(reply), session)\n\n\treturn\n}", "func (s *userState) Sessions() map[string]string {\n\treturn s.sessions\n}", "func getState(app *BaseApp, isCheckTx bool) *state {\n\tif isCheckTx {\n\t\treturn app.checkState\n\t}\n\n\treturn app.deliverState\n}", "func (ctx *Context) Session(key interface{}) interface{} {\r\n\treturn ctx.CruSession.Get(key)\r\n}", "func (b *BaseHandler) GetSession(key interface{}) (interface{}, error) {\n\treturn b.sessionStore.Get(b, key)\n}", "func getSession(r string) *session.Session {\n\treturn session.New(&aws.Config{\n\t\tRegion: aws.String(r),\n\t})\n}", "func GetState(conn db.Connection, channel string) (State, error) {\n\tvar state State\n\n\tif testStateLoadError != nil {\n\t\treturn state, testStateLoadError\n\t}\n\n\terr := db.Get(conn, StateKey(channel), &state)\n\treturn state, err\n}", "func GetState(conn db.Connection, channel string) (State, error) {\n\tvar state State\n\n\tif testStateLoadError != nil {\n\t\treturn state, testStateLoadError\n\t}\n\n\terr := db.Get(conn, StateKey(channel), &state)\n\treturn state, err\n}", "func GetState(conn db.Connection, channel string) (State, error) {\n\tvar state State\n\n\tif testStateLoadError != nil {\n\t\treturn state, testStateLoadError\n\t}\n\n\terr := db.Get(conn, StateKey(channel), &state)\n\treturn state, err\n}", "func getState(state *bytes.Buffer) error {\n\tcmd := exec.Command(\"stty\", \"-g\")\n\tcmd.Stdin = os.Stdin\n\tcmd.Stdout = state\n\treturn cmd.Run()\n}", "func (s *Store) GetSessionID() []byte {\n\treturn s.sessionID\n}", "func (svr *TMServer) GetState(ctx context.Context, _ *pb.Empty) (*pb.TuringMachine, error) {\n\treturn svr.TuringMachine, nil\n}", "func (o *EditorPlugin) GetState() gdnative.Dictionary {\n\t//log.Println(\"Calling EditorPlugin.GetState()\")\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(\"EditorPlugin\", \"get_state\")\n\n\t// Call the parent method.\n\t// Dictionary\n\tretPtr := gdnative.NewEmptyDictionary()\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.NewDictionaryFromPointer(retPtr)\n\treturn ret\n}", "func (m *Machine) State() State {\n\treturn m.currentState\n}", "func (m *AccessPackageCatalog) GetState()(*AccessPackageCatalogState) {\n return m.state\n}", "func pvtNewSession(c *db.SessionCookie, firstname string, rid int, updateSessionTable bool) *Session {\n\t// lib.Ulog(\"Entering NewSession: %s (%d)\\n\", username, uid)\n\tuid := int(c.UID)\n\ts := new(Session)\n\ts.Token = c.Cookie\n\ts.Username = c.UserName\n\ts.Firstname = firstname\n\ts.UID = c.UID\n\ts.UIDorig = c.UID\n\ts.ImageURL = ui.GetImageLocation(uid)\n\ts.Breadcrumbs = make([]ui.Crumb, 0)\n\ts.Expire = c.Expire\n\ts.IP = c.IP\n\ts.UserAgent = c.UserAgent\n\tauthz.GetRoleInfo(rid, &s.PMap)\n\n\tif authz.Authz.SecurityDebug {\n\t\tfor i := 0; i < len(s.PMap.Urole.Perms); i++ {\n\t\t\tlib.Ulog(\"f: %s, perm: %02x\\n\", s.PMap.Urole.Perms[i].Field, s.PMap.Urole.Perms[i].Perm)\n\t\t}\n\t}\n\n\tvar d db.PersonDetail\n\td.UID = uid\n\n\terr := SessionManager.db.QueryRow(fmt.Sprintf(\"SELECT CoCode FROM people WHERE UID=%d\", uid)).Scan(&s.CoCode)\n\tif nil != err {\n\t\tlib.Ulog(\"Unable to read CoCode for userid=%d, err = %v\\n\", uid, err)\n\t}\n\n\tif updateSessionTable {\n\t\tlib.Console(\"JUST BEFORE InsertSessionCookie: s.IP = %s, s.UserAgent = %s\\n\", s.IP, s.UserAgent)\n\t\terr = InsertSessionCookie(s)\n\t\tif err != nil {\n\t\t\tlib.Ulog(\"Unable to save session for UID = %d to database, err = %s\\n\", uid, err.Error())\n\t\t}\n\t}\n\n\tSessionManager.ReqSessionMem <- 1 // ask to access the shared mem, blocks until granted\n\t<-SessionManager.ReqSessionMemAck // make sure we got it\n\tSessions[c.Cookie] = s\n\tSessionManager.ReqSessionMemAck <- 1 // tell SessionDispatcher we're done with the data\n\n\treturn s\n}", "func Get(c echo.Context) (*sessions.Session, error) {\n\tsess, err := session.Get(sessionStr, c)\n\treturn sess, err\n}", "func (r Request) State() interfaces.GameState { return r.state }", "func (h *Harness) State() *gmon.Ganglia {\n\taddr := fmt.Sprintf(\"%s:%d\", localhostIP, h.port)\n\tganglia, err := gmon.RemoteRead(\"tcp\", addr)\n\tif err != nil {\n\t\th.t.Fatal(err)\n\t}\n\treturn ganglia\n}", "func (m *ScheduleChangeRequest) GetState()(*ScheduleChangeState) {\n val, err := m.GetBackingStore().Get(\"state\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*ScheduleChangeState)\n }\n return nil\n}", "func (g *Gameboi) GetState() string {\n\treturn fmt.Sprintf(\"Acc: %d Ptr: %d Instr: %#v\\n\", g.acc, g.instrPointer, g.program[g.instrPointer])\n}", "func GetSessionFromContext(context context.Context) *mgo.Session {\n\treturn context.Value(sessionKey).(*mgo.Session)\n}", "func GetSession(token string) (Session, *errors.Error) {\n\tvar session Session\n\tconnPool, err := GetDBConnectionFunc(sessionStore)\n\tif err != nil {\n\t\treturn session, errors.PackError(err.ErrNo(), \"error while trying to connecting to DB: \", err.Error())\n\t}\n\tsessionData, err := connPool.Read(\"session\", token)\n\tif err != nil {\n\t\treturn session, errors.PackError(err.ErrNo(), \"error while trying to get the session from DB: \", err.Error())\n\t}\n\tif jerr := json.Unmarshal([]byte(sessionData), &session); jerr != nil {\n\t\treturn session, errors.PackError(errors.UndefinedErrorType, \"error while trying to unmarshal session data: \", jerr)\n\t}\n\treturn session, nil\n}", "func GetWorldState(ctx CustomTransactionContextInterface) error {\n\t_, params := ctx.GetStub().GetFunctionAndParameters()\n\n\tif len(params) < 1 {\n\t\treturn errors.New(\"Missing key for world state\")\n\t}\n\n\texisting, err := ctx.GetStub().GetState(params[0])\n\n\tif err != nil {\n\t\treturn errors.New(\"Unable to interact with world state\")\n\t}\n\n\tctx.SetData(existing)\n\n\treturn nil\n}", "func (e *dockerExec) getState() (execState, error) {\n\te.mu.Lock()\n\tdefer e.mu.Unlock()\n\treturn e.State, e.err\n}", "func getSession(r *http.Request) (*sessions.Session, error) {\n\tsession, err := store.Get(r, sessionName)\n\tif err != nil {\n\t\tif session.IsNew {\n\t\t\tglog.V(1).Infof(\"ignoring initial session fetch error since session IsNew: %v\\n\", err)\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"error fetching session: %v\", err)\n\t\t}\n\t}\n\treturn session, nil\n}", "func GetSession(ctx iris.Context) *sessions.Session {\n\treturn manager.Start(ctx)\n}", "func GetSessionStatus(c *gin.Context) {\n\tcode := c.Param(\"code\")\n\tsession, err := FindSessionForCode(&Session{Code: code})\n\tif err != nil {\n\t\tc.JSON(http.StatusNotFound, common.NewError(\"session\", errors.New(\"Invalid session code\")))\n\t\treturn\n\t}\n\n\tstatus, err := retrieveSessionStatus(session)\n\tif err != nil {\n\t\tc.JSON(http.StatusNotFound, common.NewError(\"session\", errors.New(\"Could not get session status\")))\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, status)\n}", "func GetSession(cm *kuberlogicv1.KuberLogicService, client kubernetes.Interface, db string) (session interfaces.Session, err error) {\n\top, err := GetCluster(cm)\n\tif err != nil {\n\t\treturn\n\t}\n\tsession, err = op.GetSession(cm, client, db)\n\treturn\n}", "func GetState(context context.Context, obj runtime.Object) func() string {\n\treturn func() string {\n\t\tif obj := GetObject(context, obj)(); obj != nil {\n\t\t\tif status := resv1.GetStatus(obj); status != nil {\n\t\t\t\treturn status.GetState()\n\t\t\t}\n\t\t}\n\t\treturn \"\"\n\t}\n}", "func (s *StateMgr) State(n State) State {\n\treturn s.current\n}", "func (s *SessionTrackerV1) GetState() SessionState {\n\treturn s.Spec.State\n}", "func (s *Store) Get(c *fiber.Ctx) (*Session, error) {\n\tvar fresh bool\n\tloadData := true\n\n\tid := s.getSessionID(c)\n\n\tif len(id) == 0 {\n\t\tfresh = true\n\t\tvar err error\n\t\tif id, err = s.responseCookies(c); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// If no key exist, create new one\n\tif len(id) == 0 {\n\t\tloadData = false\n\t\tid = s.KeyGenerator()\n\t}\n\n\t// Create session object\n\tsess := acquireSession()\n\tsess.ctx = c\n\tsess.config = s\n\tsess.id = id\n\tsess.fresh = fresh\n\n\t// Fetch existing data\n\tif loadData {\n\t\traw, err := s.Storage.Get(id)\n\t\t// Unmarshal if we found data\n\t\tif raw != nil && err == nil {\n\t\t\tmux.Lock()\n\t\t\tdefer mux.Unlock()\n\t\t\t_, _ = sess.byteBuffer.Write(raw) //nolint:errcheck // This will never fail\n\t\t\tencCache := gob.NewDecoder(sess.byteBuffer)\n\t\t\terr := encCache.Decode(&sess.data.Data)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to decode session data: %w\", err)\n\t\t\t}\n\t\t} else if err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\t// both raw and err is nil, which means id is not in the storage\n\t\t\tsess.fresh = true\n\t\t}\n\t}\n\n\treturn sess, nil\n}", "func (m *DeviceEnrollmentWindowsHelloForBusinessConfiguration) GetState()(*Enablement) {\n val, err := m.GetBackingStore().Get(\"state\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*Enablement)\n }\n return nil\n}", "func (a *Access) GetState(id string) (s State, err error) {\n\tvar state State\n\terr = a.httpGet(\"/api/states/\"+id, &state)\n\tif err != nil {\n\t\treturn State{}, err\n\t}\n\treturn state, nil\n}", "func (d *mlDelegate) LocalState(bool) []byte { return nil }", "func (rc *Ctx) StateValue(key string) interface{} {\n\treturn rc.state.Get(key)\n}", "func (s *stateMemory) GetMachineState() NUMANodeMap {\n\ts.RLock()\n\tdefer s.RUnlock()\n\n\treturn s.machineState.Clone()\n}", "func (d *Driver) GetState() (state.State, error) {\n\terr := d.connectAPI()\n\tif err != nil {\n\t\treturn state.Paused, err\n\t}\n\n\tif d.ping() {\n\t\treturn state.Running, nil\n\t}\n\treturn state.Paused, nil\n}", "func (pdr *ProviderMySQL) SessionNew(sid string) (session.Store, error) {\n\tc := pdr.connectInit()\n\trow := c.QueryRow(\"select session_data from \"+TableName+\" where session_key=?\", sid)\n\tvar data []byte\n\terr := row.Scan(&data)\n\tif err == sql.ErrNoRows {\n\t\t_, err = c.Exec(\"insert into \"+TableName+\"(`session_key`,`session_data`,`session_expiry`) values(?,?,?)\",\n\t\t\tsid, \"\", time.Now().Unix())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tvar kv map[interface{}]interface{}\n\tif len(data) == 0 {\n\t\tkv = make(map[interface{}]interface{})\n\t} else {\n\t\tkv, err = session.DecodeGob(data)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\trs := &SessionStoreMySQL{conn: c, sid: sid, values: kv}\n\treturn rs, nil\n}", "func (r GopassRepo) getState() ([]byte, error) {\n\tif err := r.prepare(); err != nil {\n\t\treturn []byte{}, err\n\t}\n\tcmd := exec.Command(\"gopass\", \"show\", \"-f\", r.config.Repo.State)\n\tsecret, err := cmd.Output()\n\tif err != nil {\n\t\t// state not clearly found -> new state\n\t\treturn []byte{}, &GetStateError{\n\t\t\tmessage: err.Error(),\n\t\t}\n\t}\n\tdecoded, err := base64.StdEncoding.DecodeString(string(secret))\n\tif err != nil {\n\t\treturn []byte{}, fmt.Errorf(\"state decoding failed with error: %s\\nPlease repair gopass entry: %s\", err, r.config.Repo.State)\n\t}\n\treturn decoded, nil\n}", "func (r *Runsc) State(context context.Context, id string) (*runc.Container, error) {\n\tdata, stderr, err := cmdOutput(r.command(context, \"state\", id), false)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: %s\", err, stderr)\n\t}\n\tvar c runc.Container\n\tif err := json.Unmarshal(data, &c); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &c, nil\n}", "func (c *Client) getSession(full bool) (string, error) {\n\tcache, err := simplecache.New(c.cfg.Cache)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn cache.Fetch(\"session\", 30*time.Minute, full, func() (string, error) {\n\t\tpassphrase, err := c.cfg.GetPassphrase()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tsecret, err := c.cfg.GetSecret()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\targs := []string{\"signin\"}\n\t\tif full {\n\t\t\targs = append(args, c.cfg.Subdomain+\".1password.com\", c.cfg.Email, secret)\n\t\t} else {\n\t\t\targs = append(args, c.cfg.Subdomain)\n\t\t}\n\n\t\tcmd := exec.Command(\"/usr/local/bin/op\", args...)\n\t\tstdin, err := cmd.StdinPipe()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tgo func() {\n\t\t\tdefer stdin.Close()\n\t\t\tio.WriteString(stdin, passphrase)\n\t\t}()\n\n\t\tout, err := cmd.CombinedOutput()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tre := regexp.MustCompile(`export (OP_SESSION_\\w+)=\\\"(.*?)\\\"`)\n\t\tscanner := bufio.NewScanner(strings.NewReader(string(out)))\n\t\tfor scanner.Scan() {\n\t\t\ts := scanner.Text()\n\t\t\tm := re.FindAllStringSubmatch(s, -1)\n\t\t\tif len(m) > 0 {\n\t\t\t\tlogrus.Debugf(\"setting environment '%s' with '%s'\", m[0][1], m[0][2])\n\t\t\t\treturn m[0][1] + \":\" + m[0][2], nil\n\t\t\t}\n\t\t}\n\t\treturn \"\", nil\n\t})\n}", "func GetSession(ctx context.Context) session.Session {\n\ts, ok := ctx.Value(sessionCtx).(session.Session)\n\tif !ok {\n\t\tpanic(\"context does not have an edgegrid session\")\n\t}\n\n\treturn s\n}", "func (p *Provider) Read(sid string) Session {\n\tp.mu.Lock()\n\tif elem, found := p.sessions[sid]; found {\n\t\tp.mu.Unlock() // yes defer is slow\n\t\telem.Value.(*session).lastAccessedTime = time.Now()\n\t\treturn elem.Value.(*session)\n\t}\n\tp.mu.Unlock()\n\t// if not found create new\n\tsess := p.Init(sid)\n\treturn sess\n}", "func (w *xcWallet) state() *WalletState {\n\twinfo := w.Info()\n\n\tw.mtx.RLock()\n\tvar peerCount uint32\n\tif w.peerCount > 0 { // initialized to -1 initially, means no count yet\n\t\tpeerCount = uint32(w.peerCount)\n\t}\n\n\tvar tokenApprovals map[uint32]asset.ApprovalStatus\n\tif w.connector.On() {\n\t\ttokenApprovals = w.ApprovalStatus()\n\t}\n\n\tstate := &WalletState{\n\t\tSymbol: unbip(w.AssetID),\n\t\tAssetID: w.AssetID,\n\t\tVersion: winfo.Version,\n\t\tOpen: len(w.encPass) == 0 || len(w.pw) > 0,\n\t\tRunning: w.connector.On(),\n\t\tBalance: w.balance,\n\t\tAddress: w.address,\n\t\tUnits: winfo.UnitInfo.AtomicUnit,\n\t\tEncrypted: len(w.encPass) > 0,\n\t\tPeerCount: peerCount,\n\t\tSynced: w.synced,\n\t\tSyncProgress: w.syncProgress,\n\t\tWalletType: w.walletType,\n\t\tTraits: w.traits,\n\t\tDisabled: w.disabled,\n\t\tApproved: tokenApprovals,\n\t}\n\tw.mtx.RUnlock()\n\n\tif w.parent != nil {\n\t\tw.parent.mtx.RLock()\n\t\tstate.Open = len(w.parent.encPass) == 0 || len(w.parent.pw) > 0\n\t\tw.parent.mtx.RUnlock()\n\t}\n\n\treturn state\n}", "func (obj *StateObject) GetState(db Database, key math.Hash) math.Hash {\n\t// If we have a dirty value for this state entry, return it\n\tvalue, dirty := obj.dirtyStorage[key]\n\tif dirty {\n\t\treturn value\n\t}\n\t// Otherwise return the entry's original value\n\treturn obj.GetCommittedState(db, key)\n}", "func (d *Driver) GetState() (state.State, error) {\n\tvm, err := d.virtualMachine()\n\tif err != nil {\n\t\treturn state.Error, err\n\t}\n\tswitch vm.State {\n\tcase \"Starting\":\n\t\treturn state.Starting, nil\n\tcase \"Running\":\n\t\treturn state.Running, nil\n\tcase \"Stopping\":\n\t\treturn state.Running, nil\n\tcase \"Stopped\":\n\t\treturn state.Stopped, nil\n\tcase \"Destroyed\":\n\t\treturn state.Stopped, nil\n\tcase \"Expunging\":\n\t\treturn state.Stopped, nil\n\tcase \"Migrating\":\n\t\treturn state.Paused, nil\n\tcase \"Error\":\n\t\treturn state.Error, nil\n\tcase \"Unknown\":\n\t\treturn state.Error, nil\n\tcase \"Shutdowned\":\n\t\treturn state.Stopped, nil\n\t}\n\treturn state.None, nil\n}", "func (sp *SessionProxy) GetSession() (session Session) {\n\tsp.lock.RLock()\n\tsession = sp.session\n\tsp.lock.RUnlock()\n\treturn\n}", "func (sc *SessionCache) GetSession(region string, s AWSDatasourceSettings) (*session.Session, error) {\n\tif region == \"\" || region == defaultRegion {\n\t\tregion = s.Region\n\t}\n\n\tauthTypeAllowed := false\n\tfor _, provider := range sc.authSettings.AllowedAuthProviders {\n\t\tif provider == s.AuthType.String() {\n\t\t\tauthTypeAllowed = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !authTypeAllowed {\n\t\treturn nil, fmt.Errorf(\"attempting to use an auth type that is not allowed: %q\", s.AuthType.String())\n\t}\n\n\tif s.AssumeRoleARN != \"\" && !sc.authSettings.AssumeRoleEnabled {\n\t\treturn nil, fmt.Errorf(\"attempting to use assume role (ARN) which is disabled in grafana.ini\")\n\t}\n\n\tbldr := strings.Builder{}\n\tfor i, s := range []string{\n\t\ts.AuthType.String(), s.AccessKey, s.Profile, s.AssumeRoleARN, region, s.Endpoint,\n\t} {\n\t\tif i != 0 {\n\t\t\tbldr.WriteString(\":\")\n\t\t}\n\t\tbldr.WriteString(strings.ReplaceAll(s, \":\", `\\:`))\n\t}\n\tcacheKey := bldr.String()\n\n\tsc.sessCacheLock.RLock()\n\tif env, ok := sc.sessCache[cacheKey]; ok {\n\t\tif env.expiration.After(time.Now().UTC()) {\n\t\t\tsc.sessCacheLock.RUnlock()\n\t\t\treturn env.session, nil\n\t\t}\n\t}\n\tsc.sessCacheLock.RUnlock()\n\n\tcfgs := []*aws.Config{\n\t\t{\n\t\t\tCredentialsChainVerboseErrors: aws.Bool(true),\n\t\t},\n\t}\n\n\tvar regionCfg *aws.Config\n\tif region == defaultRegion {\n\t\tplog.Warn(\"Region is set to \\\"default\\\", which is unsupported\")\n\t\tregion = \"\"\n\t}\n\tif region != \"\" {\n\t\tregionCfg = &aws.Config{Region: aws.String(region)}\n\t\tcfgs = append(cfgs, regionCfg)\n\t}\n\n\tif s.Endpoint != \"\" {\n\t\tcfgs = append(cfgs, &aws.Config{Endpoint: aws.String(s.Endpoint)})\n\t}\n\n\tif s.HTTPClient != nil {\n\t\tcfgs = append(cfgs, &aws.Config{HTTPClient: s.HTTPClient})\n\t}\n\n\tswitch s.AuthType {\n\tcase AuthTypeSharedCreds:\n\t\tplog.Debug(\"Authenticating towards AWS with shared credentials\", \"profile\", s.Profile,\n\t\t\t\"region\", region)\n\t\tcfgs = append(cfgs, &aws.Config{\n\t\t\tCredentials: credentials.NewSharedCredentials(\"\", s.Profile),\n\t\t})\n\tcase AuthTypeKeys:\n\t\tplog.Debug(\"Authenticating towards AWS with an access key pair\", \"region\", region)\n\t\tcfgs = append(cfgs, &aws.Config{\n\t\t\tCredentials: credentials.NewStaticCredentials(s.AccessKey, s.SecretKey, \"\"),\n\t\t})\n\tcase AuthTypeDefault:\n\t\tplog.Debug(\"Authenticating towards AWS with default SDK method\", \"region\", region)\n\tcase AuthTypeEC2IAMRole:\n\t\tplog.Debug(\"Authenticating towards AWS with IAM Role\", \"region\", region)\n\t\tsess, err := newSession(cfgs...)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcfgs = append(cfgs, &aws.Config{Credentials: newEC2RoleCredentials(sess)})\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Unrecognized authType: %d\", s.AuthType))\n\t}\n\tsess, err := newSession(cfgs...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tduration := stscreds.DefaultDuration\n\texpiration := time.Now().UTC().Add(duration)\n\tif s.AssumeRoleARN != \"\" && sc.authSettings.AssumeRoleEnabled {\n\t\t// We should assume a role in AWS\n\t\tplog.Debug(\"Trying to assume role in AWS\", \"arn\", s.AssumeRoleARN)\n\n\t\tcfgs := []*aws.Config{\n\t\t\t{\n\t\t\t\tCredentialsChainVerboseErrors: aws.Bool(true),\n\t\t\t},\n\t\t\t{\n\t\t\t\tCredentials: newSTSCredentials(sess, s.AssumeRoleARN, func(p *stscreds.AssumeRoleProvider) {\n\t\t\t\t\t// Not sure if this is necessary, overlaps with p.Duration and is undocumented\n\t\t\t\t\tp.Expiry.SetExpiration(expiration, 0)\n\t\t\t\t\tp.Duration = duration\n\t\t\t\t\tif s.ExternalID != \"\" {\n\t\t\t\t\t\tp.ExternalID = aws.String(s.ExternalID)\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t},\n\t\t}\n\t\tif regionCfg != nil {\n\t\t\tcfgs = append(cfgs, regionCfg)\n\t\t}\n\t\tsess, err = newSession(cfgs...)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tplog.Debug(\"Successfully created AWS session\")\n\n\tsc.sessCacheLock.Lock()\n\tsc.sessCache[cacheKey] = envelope{\n\t\tsession: sess,\n\t\texpiration: expiration,\n\t}\n\tsc.sessCacheLock.Unlock()\n\n\treturn sess, nil\n}", "func (s *Store) Get(clientID string) (*entities.Session, error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\treturn s.sess[clientID], nil\n}", "func (e *engine) loadSession(ctx *Context) {\n\tif AppSessionManager().IsStateful() {\n\t\tctx.subject.Session = AppSessionManager().GetSession(ctx.Req.Unwrap())\n\t}\n}", "func (c *KafkaCluster) getGroupState(groupID string) map[string]*topicState {\n\t// Read lock check\n\tc.lock.RLock()\n\tif group, ok := c.groups[groupID]; ok {\n\t\tc.lock.RUnlock()\n\t\treturn group\n\t}\n\tc.lock.RUnlock()\n\n\t// Failed, write lock check and possible create\n\tc.lock.Lock()\n\tdefer c.lock.Unlock()\n\n\tif group, ok := c.groups[groupID]; ok {\n\t\treturn group\n\t}\n\tc.groups[groupID] = make(map[string]*topicState)\n\treturn c.groups[groupID]\n}", "func (ledger *Ledger) GetState(chaincodeID string, key string, committed bool) ([]byte, error) {\n\treturn ledger.chaincodeState.Get(chaincodeID, key, committed)\n}", "func getSessionByKey(key string) *user.SessionState {\n\t// here goes our logic to check if passed API key is valid and appropriate key session can be retrieved\n\n\t// perform auth (only one token \"abc\" is allowed)\n\t// Here you add code to query your database\n\tif key != \"abc\" {\n\t\treturn nil\n\t}\n\n\t// return session\n\treturn &user.SessionState{\n\t\tOrgID: \"default\",\n\t\tAlias: \"abc-session\",\n\t}\n}", "func (ts *TaskService) State(requestCtx context.Context, req *taskAPI.StateRequest) (*taskAPI.StateResponse, error) {\n\tdefer logPanicAndDie(log.G(requestCtx))\n\tlog.G(requestCtx).WithFields(logrus.Fields{\"id\": req.ID, \"exec_id\": req.ExecID}).Debug(\"state\")\n\n\tresp, err := ts.runcService.State(requestCtx, req)\n\tif err != nil {\n\t\tlog.G(requestCtx).WithError(err).Error(\"state failed\")\n\t\treturn nil, err\n\t}\n\n\tlog.G(requestCtx).WithFields(logrus.Fields{\n\t\t\"id\": resp.ID,\n\t\t\"bundle\": resp.Bundle,\n\t\t\"pid\": resp.Pid,\n\t\t\"status\": resp.Status,\n\t}).Debug(\"state succeeded\")\n\treturn resp, nil\n}" ]
[ "0.6782715", "0.6444168", "0.62722516", "0.5943054", "0.5837123", "0.5833319", "0.5795831", "0.57569706", "0.57566524", "0.565932", "0.563737", "0.56201184", "0.5608902", "0.5605511", "0.5574754", "0.5481208", "0.5473911", "0.54708517", "0.54691565", "0.545781", "0.5446316", "0.54460853", "0.54410934", "0.54312015", "0.54281664", "0.5423871", "0.5423519", "0.5418236", "0.53947175", "0.53889155", "0.53778", "0.5364909", "0.532489", "0.53171337", "0.5308836", "0.5281442", "0.52715766", "0.5265935", "0.5264354", "0.5259857", "0.5254772", "0.5252564", "0.52490073", "0.52402955", "0.5220284", "0.5218594", "0.520351", "0.5195661", "0.51773536", "0.5170502", "0.5166243", "0.5166243", "0.5166243", "0.51658607", "0.5161015", "0.51609075", "0.5147652", "0.5144165", "0.51400083", "0.5139738", "0.5129415", "0.5123388", "0.5117779", "0.511463", "0.5105405", "0.51037073", "0.5095714", "0.5094193", "0.5094073", "0.50857145", "0.507896", "0.5066591", "0.50664204", "0.5063877", "0.5063641", "0.5061893", "0.5058667", "0.50564015", "0.50528824", "0.50496286", "0.5047588", "0.50474626", "0.50470823", "0.5046047", "0.5042851", "0.50347036", "0.50286484", "0.5024548", "0.50204545", "0.5018995", "0.5016968", "0.50164336", "0.501432", "0.49985945", "0.49932596", "0.49908647", "0.49887285", "0.49851158", "0.4984011", "0.49831027" ]
0.57678425
7
SetSessionState implemented in memory.
func (ms *MemStore) SetSessionState( sessionStateKey string, sessionState *session.State, ) error { ms.sessionStates[sessionStateKey] = sessionState return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (mc *mgmtClient) SetSessionState(ctx context.Context, sessionID string, state []byte) error {\n\tuuid, err := uuid.New()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tamqpMsg := &amqp.Message{\n\t\tValue: map[string]interface{}{\n\t\t\t\"session-id\": sessionID,\n\t\t\t\"session-state\": state,\n\t\t},\n\t\tApplicationProperties: map[string]interface{}{\n\t\t\t\"operation\": \"com.microsoft:set-session-state\",\n\t\t\t\"com.microsoft:tracking-id\": uuid.String(),\n\t\t},\n\t}\n\n\tresp, err := mc.doRPCWithRetry(ctx, amqpMsg, 5, 5*time.Second)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.Code != 200 {\n\t\treturn ErrAMQP(*resp)\n\t}\n\n\treturn nil\n}", "func (b *BaseHandler) SetSession(key interface{}, value interface{}) {\n\tb.sessionStore.Set(b, key, value)\n}", "func (s *StorageBase) SetSession(ctx context.Context, sessionId string, sessionData *gmap.StrAnyMap, ttl time.Duration) error {\n\treturn ErrorDisabled\n}", "func (csm *RedisCsm) Set(sessionID int64, state string) {\n\tkey := csm.key(sessionID)\n\toldData := csm.getOrCreate(key)\n\n\toldData[\"__state__\"] = state\n\n\tbody, err := json.Marshal(oldData)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tcsm.set(key, string(body))\n\n}", "func (cmd *Start) SetState(agg types.Aggregate) error {\n\tif s, ok := agg.(*aggregates.Session); ok {\n\t\tcmd.session = s\n\t\treturn nil\n\t} else {\n\t\treturn errors.New(\"can't cast\")\n\t}\n}", "func (w *Worker) SetSession(s *Session) {\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\tw.s = s\n}", "func (b *BaseHandler) setSessionStore(store SessionStore) {\n\tb.sessionStore = store\n}", "func SetSession(client *client.Client, db *db.Database, log *log.Logger) {\n\ts = &Session{client, db, log}\n}", "func (s *StorageFile) SetSession(ctx context.Context, sessionId string, sessionData *gmap.StrAnyMap, ttl time.Duration) error {\n\tintlog.Printf(ctx, \"StorageFile.SetSession: %s, %v, %v\", sessionId, sessionData, ttl)\n\tpath := s.sessionFilePath(sessionId)\n\tcontent, err := json.Marshal(sessionData)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Encrypt with AES.\n\tif s.cryptoEnabled {\n\t\tcontent, err = gaes.Encrypt(content, DefaultStorageFileCryptoKey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tfile, err := gfile.OpenWithFlagPerm(\n\t\tpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.ModePerm,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\tif _, err = file.Write(gbinary.EncodeInt64(gtime.TimestampMilli())); err != nil {\n\t\terr = gerror.Wrapf(err, `write data failed to file \"%s\"`, path)\n\t\treturn err\n\t}\n\tif _, err = file.Write(content); err != nil {\n\t\terr = gerror.Wrapf(err, `write data failed to file \"%s\"`, path)\n\t\treturn err\n\t}\n\treturn nil\n}", "func setSession(c echo.Context, r *http.Response) {\r\n\r\n\tfor _, cookie := range r.Cookies() {\r\n\r\n\t\tif cookie.Name == \"PHPSESSID\" {\r\n\r\n\t\t\tsess, _ := session.Get(\"Session\", c)\r\n\t\t\tsess.Options = &sessions.Options{\r\n\t\t\t\tPath: \"*\",\r\n\t\t\t\tMaxAge: 60 * 3,\r\n\t\t\t\tHttpOnly: true,\r\n\t\t\t}\r\n\t\t\tsess.Values[\"PHPSESSID\"] = cookie.Value\r\n\r\n\t\t\tsess.Save(c.Request(), c.Response())\r\n\t\t}\r\n\t}\r\n}", "func (node *DataNode) SetSession(session *sessionutil.Session) {\n\tnode.sessionMu.Lock()\n\tdefer node.sessionMu.Unlock()\n\tnode.session = session\n}", "func (c *Controller) SetSession(name interface{}, value interface{}) error {\n\tif c.CruSession == nil {\n\t\tc.StartSession()\n\t}\n\treturn c.CruSession.Set(context2.Background(), name, value)\n}", "func (s *SessionTrackerV1) SetState(state SessionState) error {\n\tswitch state {\n\tcase SessionState_SessionStateRunning, SessionState_SessionStatePending, SessionState_SessionStateTerminated:\n\t\ts.Spec.State = state\n\t\treturn nil\n\tdefault:\n\t\treturn trace.BadParameter(\"invalid session state: %v\", state)\n\t}\n}", "func (p *PersistentStorage) UpdateSimSessionState(simID string, state SimulatorState) error {\n\tdefer func(now time.Time) {\n\t\trequestTime.With(\"method\", updateSimSessionState, \"data_store\", redisStore).Observe(time.Since(now).Seconds() * 1e3)\n\t}(time.Now())\n\n\tsession, err := p.FindSimSession(simID)\n\tif err != nil {\n\t\tif err == redis.ErrNil {\n\t\t\treturn ErrNoSimSession\n\t\t}\n\n\t\treturn err\n\t}\n\tsession.State = state\n\n\treturn p.SetSimSession(session)\n}", "func NewServerSessionState(pool *redis.Pool, keyPairs [][]byte, options ...Option) (*session.ServerSessionState, error) {\n\trs := &storage{\n\t\tpool: pool,\n\t\tserializer: driver.GobSerializer,\n\t\tdefaultExpire: 604800, // 7 days\n\t\tidleTimeout: 604800, // 7 days\n\t\tabsoluteTimeout: 5184000, // 60 days\n\t}\n\tfor _, option := range options {\n\t\toption(rs)\n\t}\n\t_, err := rs.ping()\n\treturn session.NewServerSessionState(rs, keyPairs...), err\n}", "func (c *minecraftConn) setSessionHandler(handler sessionHandler) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tc.setSessionHandler0(handler)\n}", "func (s *SessionStore) Set(key, value interface{}) {\n\ts.session.Values[key] = value\n}", "func SetSession(w http.ResponseWriter, sid string) {\n\thttp.SetCookie(w, &http.Cookie{Name: SidName, Value: sid})\n}", "func (sess Session) Set(key, value string) {\n\tsess[key] = value\n}", "func (s *SessionManager) SetSession(user *User, w http.ResponseWriter, r *http.Request) error {\n\tlog.Printf(\"Saving new session for %s (id: %s)\", user.Username, user.ID)\n\tif user.Username == \"\" || user.PasswordHash == nil || user.ID == \"\" {\n\t\t// Internal sanity check to ensure we are provided valid session\n\t\treturn errors.New(errors.CodeInternal, \"incomplete user session information\")\n\t}\n\tsession, _ := s.Store.Get(r, \"session\")\n\tsession.Values[\"user_id\"] = user.ID\n\tsession.Values[\"username\"] = user.Username\n\terr := session.Save(r, w)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to save session: %s\", err)\n\t\treturn errors.InternalError(err)\n\t}\n\tlog.Printf(\"Saved new session for %s (id: %s)\", user.Username, user.ID)\n\treturn nil\n}", "func (s *Store) Set(session *entities.Session) error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\ts.sess[session.ClientID] = session\n\treturn nil\n}", "func (s *Session) Set(args SetSessionArgs) error {\n\ttReq := &Request{\n\t\tArguments: args,\n\t\tMethod: \"session-set\",\n\t}\n\tr := &Response{}\n\terr := s.Client.request(tReq, r)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *TrafficOpsSessionThreadsafe) setSession(url, username, password string, insecure bool, userAgent string, useCache bool, timeout time.Duration) error {\n\toptions := cookiejar.Options{\n\t\tPublicSuffixList: publicsuffix.List,\n\t}\n\tjar, err := cookiejar.New(&options)\n\tif err != nil {\n\t\treturn err\n\t}\n\tto := client.NewSession(username, password, url, userAgent, &http.Client{\n\t\tTimeout: timeout,\n\t\tTransport: &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: insecure},\n\t\t},\n\t\tJar: jar,\n\t}, useCache)\n\t*s.session = to\n\treturn nil\n}", "func (m *RedisStore) Set(key interface{}, value interface{}) error {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\tm.sessionData[key] = value\n\treturn nil\n}", "func SetSession(id interface{}, user interface{}) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tsession := sessions.Default(c)\n\t\tsession.Set(\"id\", id)\n\t\tsession.Set(\"username\", user)\n\t\tsession.Save()\n\t}\n}", "func (l *localSimHostStorage) UpdateSimSessionState(simID string, state SimulatorState) error {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\n\tsimSession, ok := l.simSessions[simID]\n\tif !ok {\n\t\treturn ErrNoSimSession\n\t}\n\n\tsimSession.State = state\n\n\tl.simSessions[simID] = simSession\n\n\treturn nil\n}", "func SetState(newState map[string]interface{}) {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\tfor key, value := range newState {\n\t\tstate[key] = value\n\t}\n}", "func (m *MemoryStorer) Set(key, value string) error {\n\tm.mut.Lock()\n\tm.sessions[key] = memorySession{\n\t\texpires: time.Now().UTC().Add(m.maxAge),\n\t\tvalue: value,\n\t}\n\tm.mut.Unlock()\n\n\treturn nil\n}", "func (mgr *SessionMgr) Set(sessionID string, key interface{}, value interface{}) {\n\tmgr.Lock.Lock()\n\tdefer mgr.Lock.Unlock()\n\n\tif session, ok := mgr.Sessions[sessionID]; ok {\n\t\tsession.Values[key] = value\n\t}\n}", "func (s *UserTurnInputSpecification) SetSessionState(v *InputSessionStateSpecification) *UserTurnInputSpecification {\n\ts.SessionState = v\n\treturn s\n}", "func SessionSetValue(ctx context.Context, name string, value interface{}) {\n\ts, ok := ctx.Value(sessionKey).(*Session)\n\tif ok {\n\t\ts.set(name, value)\n\t}\n}", "func (s *SecureSessionStore) Set(key, value string, rw http.ResponseWriter, req *http.Request) error {\n\tsession := s.getSession(req)\n\tsession.Values[key] = value\n\treturn session.Save(req, rw)\n}", "func (m *VppToken) SetState(value *VppTokenState)() {\n m.state = value\n}", "func (s *Store) SetSessionID(id []byte) {\n\ts.lock.Lock()\n\ts.sessionID = id\n\ts.lock.Unlock()\n}", "func (ms *MemStore) GetSessionState(sessionStateKey string) (\n\t*session.State,\n\terror,\n) {\n\treturn ms.sessionStates[sessionStateKey], nil\n}", "func (m *ExactMatchDataStore) SetSessions(value []ExactMatchSessionable)() {\n err := m.GetBackingStore().Set(\"sessions\", value)\n if err != nil {\n panic(err)\n }\n}", "func SetSession(ctx context.Context, session bool, logoutURL string) context.Context {\n\tctx = context.WithValue(ctx, sessionKey, session)\n\tctx = context.WithValue(ctx, logoutKey, logoutURL)\n\treturn ctx\n}", "func (s *Sessions) Set(r *http.Request, session Session) error {\n\ts.RLock()\n\tdefer s.RUnlock()\n\tsess, err := s.Get(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.sessions[sess.ID] = session\n\treturn nil\n}", "func (st *MemSessionStore) Set(key, value interface{}) error {\n\tst.lock.Lock()\n\tdefer st.lock.Unlock()\n\tst.value[key] = value\n\treturn nil\n}", "func (p *PersistentStorage) SetSimSession(s *SimulatorSession) error {\n\tdefer func(now time.Time) {\n\t\trequestTime.With(\"method\", setSimSession, \"data_store\", redisStore).Observe(time.Since(now).Seconds() * 1e3)\n\t}(time.Now())\n\n\tkey := fmt.Sprintf(simSessionKeyFmt, s.SimulatorID)\n\terr := p.setRedisJSON(\"SET\", key, \"\", s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (hc *httpContext) setSession(userInfo *Authentication) {\n\n\tsession := hc.getSession()\n\tif session == nil {\n\t\treturn\n\t}\n\n\tsession.Values[sv[\"provider\"]] = userInfo.Provider\n\tsession.Values[sv[\"name\"]] = userInfo.Name\n\tsession.Values[sv[\"email\"]] = userInfo.Email\n\tsession.Values[sv[\"user\"]] = userInfo.UserName\n\tsession.Values[sv[\"token\"]] = userInfo.Token\n\thc.clearFlashes()\n\tsession.AddFlash(\"Logged in via \" + userInfo.Provider)\n\n\thc.saveSession(session)\n}", "func (sm *SessionMap) Set(sessionID string, session *Session) {\n\tsm.Lock.Lock()\n\tdefer sm.Lock.Unlock()\n\tsm.Sessions[sessionID] = session\n}", "func (delegateObject *delegateObject) SetState(db Database, key, value common.Hash) {\n\tdelegateObject.db.journal = append(delegateObject.db.journal, storageChange{\n\t\taccount: &delegateObject.address,\n\t\tkey: key,\n\t\tprevalue: delegateObject.GetState(db, key),\n\t})\n\tdelegateObject.setState(key, value)\n}", "func setSession(userName, token string, response http.ResponseWriter) {\n\tvalue := map[string]string{\n\t\t\"name\": userName,\n\t\t\"token\": token,\n\t}\n\tif encoded, err := cookieHandler.Encode(\"session\", value); err == nil {\n\t\tcookie := &http.Cookie{\n\t\t\tName: \"session\",\n\t\t\tValue: encoded,\n\t\t\tPath: \"/\",\n\t\t}\n\t\thttp.SetCookie(response, cookie)\n\t} else {\n\t\tlog.Println(err)\n\t}\n}", "func Set(redisdb *redis.Client, sessionID, key string, value interface{}) error {\n\n\tif _, err := redisdb.HSet(sessionID, key, value).Result(); err != nil {\n\t\treturn fmt.Errorf(\"failed to write %s to session: %s\", key, err.Error())\n\t}\n\n\treturn nil\n}", "func (m *Mob) SetState(state MobStateType) {\n\tnext := time.Now().UnixMilli()\n\n\tswitch state {\n\tcase MobStateFind:\n\t\tnext += m.FindInterval\n\tcase MobStateMove:\n\t\tnext += m.MoveInterval\n\t}\n\n\tm.mutex.Lock()\n\tm.state = state\n\tm.nextRun = next\n\tm.findRemain = m.FindCount\n\tm.mutex.Unlock()\n}", "func (s TrafficOpsSessionThreadsafe) Set(session *to.Session) {\n\ts.m.Lock()\n\t*s.session = session\n\ts.m.Unlock()\n}", "func SessionSetUser(user *models.User, session *session.Session, r *http.Request) {\n\t(*session).Set(\"id\", user.Id)\n\t(*session).Set(\"name\", user.Name)\n\t(*session).Set(\"email\", user.Email)\n}", "func Benchmark_Session(b *testing.B) {\n\tapp, store := fiber.New(), New()\n\tc := app.AcquireCtx(&fasthttp.RequestCtx{})\n\tdefer app.ReleaseCtx(c)\n\tc.Request().Header.SetCookie(store.CookieName, \"12356789\")\n\n\tb.Run(\"default\", func(b *testing.B) {\n\t\tb.ReportAllocs()\n\t\tb.ResetTimer()\n\t\tfor n := 0; n < b.N; n++ {\n\t\t\tsess, _ := store.Get(c)\n\t\t\tsess.Set(\"john\", \"doe\")\n\t\t\t_ = sess.Save()\n\t\t}\n\t})\n\n\tb.Run(\"storage\", func(b *testing.B) {\n\t\tstore = New(Config{\n\t\t\tStorage: memory.New(),\n\t\t})\n\t\tb.ReportAllocs()\n\t\tb.ResetTimer()\n\t\tfor n := 0; n < b.N; n++ {\n\t\t\tsess, _ := store.Get(c)\n\t\t\tsess.Set(\"john\", \"doe\")\n\t\t\t_ = sess.Save()\n\t\t}\n\t})\n}", "func Test_Session_Save(t *testing.T) {\n\tt.Parallel()\n\n\t// session store\n\tstore := New()\n\n\t// fiber instance\n\tapp := fiber.New()\n\n\t// fiber context\n\tctx := app.AcquireCtx(&fasthttp.RequestCtx{})\n\tdefer app.ReleaseCtx(ctx)\n\n\t// get store\n\tsess, _ := store.Get(ctx)\n\n\t// set value\n\tsess.Set(\"name\", \"john\")\n\n\t// save session\n\terr := sess.Save()\n\tutils.AssertEqual(t, nil, err)\n\n}", "func SetSessionInContext(ctx context.Context, session *Session) context.Context {\n\treturn context.WithValue(ctx, sessionContextKey, session)\n}", "func (db *DB) SetSession(sess *Session) error {\n\tif sess == nil {\n\t\treturn errors.New(\"sess is nil\")\n\t}\n\treturn db.db.Save(sess).Error\n}", "func (st *MemSessionStore) Set(key, value interface{}) error {\n\treturn (*session.MemSessionStore)(st).Set(context.Background(), key, value)\n}", "func (session *Session) Set(key string, v string) {\n\tif session.Data == nil {\n\t\tsession.Data = make(map[string]string)\n\t}\n\tsession.Data[key] = v\n}", "func SetCtx(p PTR, _ctxid int64, rpc *memrpc.Server) {\n\tC.set_ctxid(C.PTR(p), C.int64_t(_ctxid))\n\tsessionBuf[_ctxid] = &session{ctxId: _ctxid, rpcServer: rpc}\n}", "func StoreInSession(key string, value string, req *http.Request, res http.ResponseWriter) error {\n\tsession, _ := Store.New(req, SessionName)\n\n\tif err := updateSessionValue(session, key, value); err != nil {\n\t\treturn err\n\t}\n\n\treturn session.Save(req, res)\n}", "func (s *Session) Set(key string, value interface{}) {\n\tdefer s.refresh()\n\ts.values[key] = value\n}", "func (s *Session) Set(key string, value interface{}) (err error) {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\ts.Values[key] = value\n\treturn\n}", "func (c *connAttrs) SetSessionVariables(sessionVariables SessionVariables) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tc._sessionVariables = maps.Clone(sessionVariables)\n}", "func (p *OIDCIBMProvider) ValidateSessionState(s *SessionState) bool {\n\t//ctx := context.Background()\n\t//_, err := p.Verifier.Verify(ctx, s.IdToken)\n\t//if err != nil {\n\t// 20180629 - TL: Testing. This should be set back to return false and log removed.\n\t//fmt.Printf(\"oidcibm ValidateSessionState() Error: %s\\n...Returning VALID for IBM.\", err)\n\t//return false\n\t//}\n\n\t// 20180703 - TL: Logging and testing.\n\t//fmt.Printf(\"oidcibm ValidateSessionState() - Returning VALID for IBM.\", err)\n\t// return true\n\tctx := context.Background()\n\t_, err := p.Verifier.Verify(ctx, s.IDToken)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (c *minecraftConn) setSessionHandler0(handler sessionHandler) {\n\tif c.sessionHandler != nil {\n\t\tc.sessionHandler.deactivated()\n\t}\n\tc.sessionHandler = handler\n\thandler.activated()\n}", "func (ms *MemStore) StoreSession(\n\tsessionKey, rootKeyHash, chainKey string,\n\tsend, recv []string,\n) error {\n\tif len(send) != len(recv) {\n\t\treturn log.Error(\"memstore: len(send) != len(recv)\")\n\t}\n\tlog.Debugf(\"memstore.StoreSession(): %s\", sessionKey)\n\ts, ok := ms.sessions[sessionKey]\n\tif !ok {\n\t\tms.sessions[sessionKey] = &memSession{\n\t\t\trootKeyHash: rootKeyHash,\n\t\t\tchainKey: chainKey,\n\t\t\tsend: send,\n\t\t\trecv: recv,\n\t\t}\n\t\tms.sessionKey = sessionKey\n\t} else {\n\t\t// session already exists -> update\n\t\t// rootKeyHash stays the same!\n\t\ts.chainKey = chainKey\n\t\ts.send = append(s.send, send...)\n\t\ts.recv = append(s.recv, recv...)\n\t}\n\treturn nil\n}", "func (s *SessionStorer) Set(f string, u []byte) {\n\ts.SetInvoked = true\n\ts.SetFn(f, u)\n}", "func SetValue(c echo.Context, key string, value interface{}) error {\n\tsess, _ := Get(c)\n\tsess.Values[key] = value\n\treturn nil\n}", "func (s *session) Set(key string, value interface{}) {\n\ts.mu.Lock()\n\ts.values[key] = value\n\ts.mu.Unlock()\n\ts.provider.update(s.sid)\n}", "func (s *Session) Set(key string, val interface{}) {\n\t// Better safe than sorry\n\tif s.data == nil {\n\t\treturn\n\t}\n\ts.data.Set(key, val)\n}", "func TestSet(t *testing.T) {\n\tsessionHandler = newDefaultHandler()\n\tret := &Session{hasStarted: false}\n\n\tvar ok bool\n\n\t//set\n\tok = ret.Set(\"name\", \"wgf\")\n\tif !ok {\n\t\tt.Error(\"set error\")\n\t}\n\n\t//get\n\tvar val string\n\tok = ret.Get(\"name\", &val)\n\n\tif !ok {\n\t\tt.Error(\"content missed after set\")\n\t}\n\tif val != \"wgf\" {\n\t\tt.Error(\"content mismatched after set\")\n\t}\n}", "func SetGlobalState(key, value string) {\n\tglobalState.Lock()\n\tglobalState.m[key] = value\n\tglobalState.Unlock()\n}", "func setSession(userName string, response http.ResponseWriter) {\n value := map[string]string{\n \"name\": userName,\n }\n if encoded, err := cookieHandler.Encode(\"session\", value); err == nil {\n cookie := &http.Cookie{\n Name: \"session\",\n Value: encoded,\n Path: \"/\",\n }\n http.SetCookie(response, cookie)\n }\n }", "func SetSessionUser(sessionID string, userID int) error {\n\tkey := stringutil.Build(\"sessionid:\", sessionID, \":userid\")\n\terr := Set(key, userID)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot set key in Redis\")\n\t}\n\treturn nil\n}", "func (s *TrafficOpsSessionThreadsafe) setLegacySession(url, username, password string, insecure bool, userAgent string, useCache bool, timeout time.Duration) error {\n\toptions := cookiejar.Options{\n\t\tPublicSuffixList: publicsuffix.List,\n\t}\n\tjar, err := cookiejar.New(&options)\n\tif err != nil {\n\t\treturn err\n\t}\n\tto := legacyClient.NewSession(username, password, url, userAgent, &http.Client{\n\t\tTimeout: timeout,\n\t\tTransport: &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: insecure},\n\t\t},\n\t\tJar: jar,\n\t}, useCache)\n\t*s.legacySession = to\n\treturn nil\n}", "func (w *Watcher) SetState(key string, value any) {\n\tw.lock.Lock()\n\tdefer w.lock.Unlock()\n\n\tw.stateCache[key] = value\n}", "func (s *Session) Set(key string, value interface{}) {\n\ts.Values[key] = value\n}", "func (m *MacOSSoftwareUpdateStateSummary) SetState(value *MacOSSoftwareUpdateState)() {\n err := m.GetBackingStore().Set(\"state\", value)\n if err != nil {\n panic(err)\n }\n}", "func (s *session) Set(key interface{}, val interface{}) {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\n\ts.values[key] = val\n}", "func (p *Resolver) SetState(state int64) {\n\tp.state.Store(state)\n}", "func (m *ScheduleChangeRequest) SetState(value *ScheduleChangeState)() {\n err := m.GetBackingStore().Set(\"state\", value)\n if err != nil {\n panic(err)\n }\n}", "func (c *cache) Set(session *Session) error {\n\tc.Lock()\n\tdefer c.Unlock()\n\tsession.Lock()\n\tsession.lastAccess = time.Now()\n\tid := session.id\n\tsession.Unlock()\n\n\t// Try to compact the cache.\n\tvar requiredSpace int\n\tif _, ok := c.sessions[id]; !ok {\n\t\trequiredSpace = 1\n\t}\n\tc.compact(requiredSpace)\n\n\t// Save in cache.\n\tif MaxSessionCacheSize != 0 {\n\t\tc.sessions[id] = session\n\t}\n\n\t// Write through to database.\n\tif err := Persistence.SaveSession(id, session); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (mgr ScsManager) Use(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tvar data []byte\n\t\tvar temp string\n\t\t// get the session. All of our session data is stored in only one key in the session manager.\n\t\tsession := mgr.Manager.Load(r)\n\t\tif err := session.Touch(w); err != nil { // Make sure to get a cookie in our header if we don't have one\n\t\t\tlog.Errorf(\"Error loading session: %s\", err.Error()) // we can't panic here, because our panic handlers have not been set up\n\t\t}\n\t\tdata, _ = session.GetBytes(scsSessionDataKey)\n\t\tsessionData := NewSession()\n\t\tif data != nil {\n\t\t\tif err := sessionData.UnmarshalBinary(data); err != nil {\n\t\t\t\tlog.Errorf(\"Error unpacking session data: %s\", err.Error())\n\t\t\t}\n\t\t}\n\n\t\tif sessionData.Has(sessionResetKey) {\n\t\t\t// Our previous session requested a reset. We can't reset after writing, so we reset here at the start of the next request.\n\t\t\tsessionData.Delete(sessionResetKey)\n\t\t\tif err := session.RenewToken(w); err != nil {\n\t\t\t\tlog.Errorf(\"Error renewing session token: %s\", err.Error())\n\t\t\t}\n\t\t}\n\n\t\tctx := r.Context()\n\t\tctx = context.WithValue(ctx, sessionContext, sessionData)\n\t\tr = r.WithContext(ctx)\n\t\tnext.ServeHTTP(w, r)\n\n\t\t// write out the changed session. The below will attempt to write a cookie, but it can't because headers have already been written.\n\t\t// That is OK, because of our Touch above.\n\t\tif sessionData.Len() > 0 {\n\t\t\tvar err error\n\t\t\tdata, err = sessionData.MarshalBinary()\n\t\t\tif err != nil {\n\t\t\t\t// This is an application error. We put data into the session which is not serializable.\n\t\t\t\ts := \"Error marshalling session data: %s\" + err.Error()\n\t\t\t\tlog.Error(s)\n\t\t\t\thttp.Error(w, s, 500)\n\t\t\t}\n\t\t\ttemp = string(data)\n\t\t\t_ = temp\n\t\t\tif err := session.PutBytes(w, scsSessionDataKey, data); err != nil {\n\t\t\t\tlog.Errorf(\"Error putting session data: %s\", err.Error())\n\t\t\t}\n\t\t} else {\n\t\t\tif err := session.Clear(w); err != nil {\n\t\t\t\tlog.Errorf(\"Error clearing session: %s\", err.Error())\n\t\t\t}\n\t\t}\n\t}\n\treturn mgr.Manager.Use(http.HandlerFunc(fn))\n}", "func (m *AccessPackageAssignment) SetState(value *AccessPackageAssignmentState)() {\n m.state = value\n}", "func (s *StateMgr) SetState(n State) {\n\ts.current = n\n}", "func (m *AccessPackageCatalog) SetState(value *AccessPackageCatalogState)() {\n m.state = value\n}", "func setSession(email string, writer http.ResponseWriter) {\n\tvalue := map[string]string{\n\t\t\"email\": email,\n\t}\n\tif encoded, err := cookieHandler.Encode(\"session\", value); err == nil {\n\t\tcookie := &http.Cookie{\n\t\t\tName: \"session\",\n\t\t\tValue: encoded,\n\t\t\tPath: \"/\",\n\t\t\tExpires: time.Now().Add(4 * time.Hour),\n\t\t}\n\t\thttp.SetCookie(writer, cookie)\n\t}\n}", "func SetIPNState(state string, wantRunning bool) {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\tipnState = state\n\tipnWantRunning = wantRunning\n\tselfCheckLocked()\n}", "func SetState(state bool, macAdd string) {\n\tvar statebit string\n\tif state == true {\n\t\tstatebit = \"01\"\n\t} else {\n\t\tstatebit = \"00\"\n\t}\n\tsendMessage(\"686400176463\"+macAdd+twenties+\"00000000\"+statebit, sockets[macAdd].IP)\n\tgo func() { Events <- EventStruct{\"stateset\", *sockets[macAdd]} }()\n}", "func (obj *StateObject) SetState(db Database, key, value math.Hash) {\n\t// If the new value is the same as old, don't set\n\tprev := obj.GetState(db, key)\n\tif prev == value {\n\t\treturn\n\t}\n\n\tobj.setState(key, value)\n}", "func (s *MemorySession) Set(key string, value interface{}) error {\n\ts.data[key] = value\n\treturn nil\n}", "func (p *OktaProvider) ValidateSessionState(s *sessions.SessionState) bool {\n\tif s.AccessToken == \"\" {\n\t\treturn false\n\t}\n\n\tvar response struct {\n\t\tActive bool `json:\"active\"`\n\t}\n\n\tform := url.Values{}\n\tform.Add(\"token\", s.AccessToken)\n\tform.Add(\"token_type_hint\", \"access_token\")\n\tform.Add(\"client_id\", p.ClientID)\n\tform.Add(\"client_secret\", p.ClientSecret)\n\n\terr := p.oktaRequest(\"POST\", p.ValidateURL.String(), form, []string{\"action:validate\"}, nil, &response)\n\tif err != nil {\n\t\treturn false\n\t}\n\tif !response.Active {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (mg *MoveGen) SetState(st *GameState) {\n\tmg.state = st\n\n\t// reset any data associated with the old state\n\tmg.Clear()\n}", "func (r *Runner) SetState(state RunnerState) {\n\tr.state = state\n\tswitch r.state {\n\tcase Idle:\n\t\tr.animation.Play(\"Idle\")\n\tcase Running:\n\t\tr.animation.Play(\"Run\")\n\t}\n}", "func pvtNewSession(c *db.SessionCookie, firstname string, rid int, updateSessionTable bool) *Session {\n\t// lib.Ulog(\"Entering NewSession: %s (%d)\\n\", username, uid)\n\tuid := int(c.UID)\n\ts := new(Session)\n\ts.Token = c.Cookie\n\ts.Username = c.UserName\n\ts.Firstname = firstname\n\ts.UID = c.UID\n\ts.UIDorig = c.UID\n\ts.ImageURL = ui.GetImageLocation(uid)\n\ts.Breadcrumbs = make([]ui.Crumb, 0)\n\ts.Expire = c.Expire\n\ts.IP = c.IP\n\ts.UserAgent = c.UserAgent\n\tauthz.GetRoleInfo(rid, &s.PMap)\n\n\tif authz.Authz.SecurityDebug {\n\t\tfor i := 0; i < len(s.PMap.Urole.Perms); i++ {\n\t\t\tlib.Ulog(\"f: %s, perm: %02x\\n\", s.PMap.Urole.Perms[i].Field, s.PMap.Urole.Perms[i].Perm)\n\t\t}\n\t}\n\n\tvar d db.PersonDetail\n\td.UID = uid\n\n\terr := SessionManager.db.QueryRow(fmt.Sprintf(\"SELECT CoCode FROM people WHERE UID=%d\", uid)).Scan(&s.CoCode)\n\tif nil != err {\n\t\tlib.Ulog(\"Unable to read CoCode for userid=%d, err = %v\\n\", uid, err)\n\t}\n\n\tif updateSessionTable {\n\t\tlib.Console(\"JUST BEFORE InsertSessionCookie: s.IP = %s, s.UserAgent = %s\\n\", s.IP, s.UserAgent)\n\t\terr = InsertSessionCookie(s)\n\t\tif err != nil {\n\t\t\tlib.Ulog(\"Unable to save session for UID = %d to database, err = %s\\n\", uid, err.Error())\n\t\t}\n\t}\n\n\tSessionManager.ReqSessionMem <- 1 // ask to access the shared mem, blocks until granted\n\t<-SessionManager.ReqSessionMemAck // make sure we got it\n\tSessions[c.Cookie] = s\n\tSessionManager.ReqSessionMemAck <- 1 // tell SessionDispatcher we're done with the data\n\n\treturn s\n}", "func Test_Session_Reset(t *testing.T) {\n\tt.Parallel()\n\t// session store\n\tstore := New()\n\t// fiber instance\n\tapp := fiber.New()\n\t// fiber context\n\tctx := app.AcquireCtx(&fasthttp.RequestCtx{})\n\tdefer app.ReleaseCtx(ctx)\n\t// get session\n\tsess, _ := store.Get(ctx)\n\n\tsess.Set(\"name\", \"fenny\")\n\tsess.Destroy()\n\tname := sess.Get(\"name\")\n\tutils.AssertEqual(t, nil, name)\n}", "func (t *CookieAuthTransport) setSessionObject() error {\n\treq, err := t.buildAuthRequest()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar authClient = &http.Client{\n\t\tTimeout: time.Second * 60,\n\t}\n\tresp, err := authClient.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tt.SessionObject = resp.Cookies()\n\treturn nil\n}", "func (st *SessionStoreMySQL) Set(key, value interface{}) error {\n\tst.lock.Lock()\n\tdefer st.lock.Unlock()\n\tst.values[key] = value\n\treturn nil\n}", "func NewSessionIniter(m map[string]string) func(driver.Conn) error {\r\n\treturn func(cx driver.Conn) error {\r\n\t\tfor k, v := range m {\r\n\t\t\tqry := fmt.Sprintf(\"ALTER SESSION SET %s = '%s'\", k, strings.Replace(v, \"'\", \"''\", -1))\r\n\t\t\tst, err := cx.Prepare(qry)\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn errors.Errorf(\"%s: %w\", qry, err)\r\n\t\t\t}\r\n\t\t\t_, err = st.Exec(nil) //lint:ignore SA1019 it's hard to use ExecContext here\r\n\t\t\tst.Close()\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn err\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn nil\r\n\t}\r\n}", "func SetSessionContextKey(ctx context.Context, s *Session) context.Context {\n\treturn context.WithValue(ctx, sessionCtxKey, s)\n}", "func (stateObj *stateObject) SetState(db StateDatabase, key, value common.Hash) {\n\t// If the fake storage is set, put the temporary state update here.\n\tif stateObj.fakeStorage != nil {\n\t\tstateObj.fakeStorage[key] = value\n\t\treturn\n\t}\n\t// If the new value is the same as old, don't set\n\tprev := stateObj.GetState(db, key)\n\tif prev == value {\n\t\treturn\n\t}\n\t// New value is different, update and journal the change\n\tstateObj.db.journal.append(storageChange{\n\t\taccount: &stateObj.address,\n\t\tkey: key,\n\t\tprevalue: prev,\n\t})\n\tstateObj.setState(key, value)\n}", "func SetState(stub shim.ChaincodeStubInterface) peer.Response {\r\n\targs := stub.GetStringArgs()\r\n\r\n\tif len(args) != 3 {\r\n\t\treturn shim.Error(\"Incorrect arguments. Expecting two arguments 'name of state' & 'state code'\")\r\n\t}\r\n\r\n\t_, err := strconv.Atoi(args[2])\r\n\tif err != nil {\r\n\t\treturn shim.Error(\"Incorrect data type state code should be a number!!!\")\r\n\t}\r\n\r\n\tkey := strings.ToLower(args[1])\r\n\tstub.PutState(key, []byte(args[2]))\r\n\r\n\treturn shim.Success([]byte(\"true\"))\r\n}", "func (sc *SessionCreate) SetSessionStatus(i int8) *SessionCreate {\n\tsc.mutation.SetSessionStatus(i)\n\treturn sc\n}", "func (lockedCtx *UserCtx) SetState(s aka.AkaState) {\n\tif !lockedCtx.locked {\n\t\tpanic(\"Expected locked\")\n\t}\n\tlockedCtx.state, lockedCtx.stateTime = s, time.Now()\n}" ]
[ "0.75131947", "0.6425117", "0.6318091", "0.6184344", "0.6074247", "0.6017674", "0.59498626", "0.58186895", "0.5739513", "0.57371587", "0.5629504", "0.56084186", "0.5596258", "0.5556739", "0.55478746", "0.5545527", "0.5541016", "0.5524564", "0.55016655", "0.5493186", "0.5469984", "0.5464513", "0.5445337", "0.54163444", "0.54157525", "0.5414373", "0.54126495", "0.5405365", "0.538467", "0.53321534", "0.5302065", "0.529565", "0.5285866", "0.52417654", "0.5239457", "0.5207996", "0.516072", "0.51568276", "0.51536924", "0.5148869", "0.5141785", "0.5139549", "0.51190525", "0.5114985", "0.5105479", "0.509941", "0.5081707", "0.5077738", "0.50675076", "0.5033573", "0.5033009", "0.5031834", "0.50282407", "0.50184065", "0.5003774", "0.49961704", "0.49885786", "0.49846208", "0.4984233", "0.49772", "0.49769086", "0.4957123", "0.49569422", "0.49459967", "0.4943852", "0.49270922", "0.49245882", "0.49233758", "0.49199188", "0.4916901", "0.49020776", "0.48995543", "0.48979405", "0.4892443", "0.48882467", "0.4876604", "0.48765904", "0.48734057", "0.48698193", "0.48624787", "0.48610118", "0.4860939", "0.48607576", "0.48539793", "0.48403057", "0.4833458", "0.48289764", "0.48239654", "0.48101443", "0.48081192", "0.4794619", "0.47869816", "0.4781404", "0.47685128", "0.47682968", "0.47470245", "0.47454494", "0.47451678", "0.47451183", "0.4744167" ]
0.7806558
0
StoreSession implemented in memory.
func (ms *MemStore) StoreSession( sessionKey, rootKeyHash, chainKey string, send, recv []string, ) error { if len(send) != len(recv) { return log.Error("memstore: len(send) != len(recv)") } log.Debugf("memstore.StoreSession(): %s", sessionKey) s, ok := ms.sessions[sessionKey] if !ok { ms.sessions[sessionKey] = &memSession{ rootKeyHash: rootKeyHash, chainKey: chainKey, send: send, recv: recv, } ms.sessionKey = sessionKey } else { // session already exists -> update // rootKeyHash stays the same! s.chainKey = chainKey s.send = append(s.send, send...) s.recv = append(s.recv, recv...) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Store() gorillaSessions.Store {\n\n}", "func (session *Session) Store() error {\n\treturn session.cache.Store(session.id, session)\n}", "func (s *inMemorySessionStore) Save(session USSDSession) {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\ts.deleteOldestIfFull()\n\tif s.store[session.ID] == nil {\n\t\ts.currentSize++\n\t}\n\ts.gcList.PushFront(&session)\n\ts.store[session.ID] = s.gcList.Front()\n}", "func (service *SessionService) StoreSession(session *entity.Session) (*entity.Session, error) {\n\tsess, err := service.conn.StoreSession(session)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sess, err\n}", "func (s *MemoryStore) Save(r *http.Request, w http.ResponseWriter, session *Session) error {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\tsid := session.ID\n\ts.value[sid] = session.Values\n\ts.gc[sid] = time.Now().Unix()\n\n\tcookie := NewCookie(session.CookieName(), session.ID, session.Options)\n\thttp.SetCookie(w, cookie)\n\n\treturn nil\n}", "func (ss *SessionServiceImpl) StoreSession(session *entities.Session) (*entities.Session, []error) {\n\treturn ss.sessionRepo.StoreSession(session)\n}", "func StoreInSession(key string, value string, req *http.Request, res http.ResponseWriter) error {\n\tsession, _ := Store.New(req, SessionName)\n\n\tif err := updateSessionValue(session, key, value); err != nil {\n\t\treturn err\n\t}\n\n\treturn session.Save(req, res)\n}", "func (s *Store) Set(session *entities.Session) error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\ts.sess[session.ClientID] = session\n\treturn nil\n}", "func (m *MemoryCache) Save(s *Session) error {\n\t// Basically, this provides to option to replace an old session\n\t// with a new one (change the pointer), provided that the old\n\t// one existed and is still valid.\n\tm.mx.Lock()\n\tdefer m.mx.Unlock()\n\n\tif old, ok := m.store[s.Id]; !ok || !old.Valid() {\n\t\treturn ErrUnrecognized\n\t}\n\n\tm.store[s.Id] = s\n\treturn nil\n}", "func (s *SessionStore) Save(r *http.Request, w http.ResponseWriter) {\n\ts.session.Save(r, w)\n}", "func (ss *SessionServiceImpl) StoreSession(session *entity.Session) (*entity.Session, error) {\n\tsess, err := ss.sessionRepo.StoreSession(session)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sess, err\n}", "func Test_Session_Save(t *testing.T) {\n\tt.Parallel()\n\n\t// session store\n\tstore := New()\n\n\t// fiber instance\n\tapp := fiber.New()\n\n\t// fiber context\n\tctx := app.AcquireCtx(&fasthttp.RequestCtx{})\n\tdefer app.ReleaseCtx(ctx)\n\n\t// get store\n\tsess, _ := store.Get(ctx)\n\n\t// set value\n\tsess.Set(\"name\", \"john\")\n\n\t// save session\n\terr := sess.Save()\n\tutils.AssertEqual(t, nil, err)\n\n}", "func (store *SessionPostgresStore) save(session *sessions.Session) error {\n\tb, err := store.serializer.Serialize(session)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif store.maxLength != 0 && len(b) > store.maxLength {\n\t\treturn errors.New(\"SessionStore: the value to store is too big\")\n\t}\n\tage := session.Options.MaxAge\n\tif age == 0 {\n\t\tage = store.DefaultMaxAge\n\t}\n\ttoken := store.keyPrefix + session.ID\n\texpiry := time.Now().Add(time.Second * time.Duration(age))\n\tvar sessionData orm.Session\n\tif orm.Engine.First(&sessionData, \"token = ?\", token).RecordNotFound() {\n\t\tsessionData = orm.Session{\n\t\t\tToken: store.keyPrefix + session.ID,\n\t\t\tData: b,\n\t\t\tExpiry: expiry,\n\t\t}\n\t\tif err := orm.Engine.Create(&sessionData).Error; err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tsessionData.Data = b\n\t\tsessionData.Expiry = expiry\n\t\tif err := orm.Engine.Save(&sessionData).Error; err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (sr *SessionGormRepo) StoreSession(session *entity.Session) (*entity.Session, []error) {\n\tsess := session\n\terrs := sr.conn.Save(sess).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn sess, errs\n}", "func persistInCache(sesh *Sesh) error {\n\tif seshCache == nil {\n\t\treturn errors.New(\"This is not a session server\")\n\t}\n\tseshCache.Set(sesh.Key, *sesh)\n\treturn nil\n}", "func (s *Store) Save(session *Session) error {\n\tremoved := session.Removed()\n\tif len(removed) > 0 {\n\t\tif _, err := s.client.HDel(session.ID(), removed...).Result(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tsessionVals := make(map[string]interface{}, 0)\n\tfor key, value := range session.Values() {\n\t\tsessionVals[key] = value\n\t}\n\n\tif _, err := s.client.HMSet(session.ID(), sessionVals).Result(); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := s.client.Expire(session.ID(), s.valid).Result(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (b *BaseHandler) SetSession(key interface{}, value interface{}) {\n\tb.sessionStore.Set(b, key, value)\n}", "func (s *Session) Save() error {\n\t// Better safe than sorry\n\tif s.data == nil {\n\t\treturn nil\n\t}\n\n\t// Check if session has your own expiration, otherwise use default value\n\tif s.exp <= 0 {\n\t\ts.exp = s.config.Expiration\n\t}\n\n\t// Update client cookie\n\ts.setSession()\n\n\t// Convert data to bytes\n\tmux.Lock()\n\tdefer mux.Unlock()\n\tencCache := gob.NewEncoder(s.byteBuffer)\n\terr := encCache.Encode(&s.data.Data)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to encode data: %w\", err)\n\t}\n\n\t// copy the data in buffer\n\tencodedBytes := make([]byte, s.byteBuffer.Len())\n\tcopy(encodedBytes, s.byteBuffer.Bytes())\n\n\t// pass copied bytes with session id to provider\n\tif err := s.config.Storage.Set(s.id, encodedBytes, s.exp); err != nil {\n\t\treturn err\n\t}\n\n\t// Release session\n\t// TODO: It's not safe to use the Session after called Save()\n\treleaseSession(s)\n\n\treturn nil\n}", "func (sess *Session) Store() Store {\n\treturn sess.store\n}", "func (st *MemSessionStore) Set(key, value interface{}) error {\n\treturn (*session.MemSessionStore)(st).Set(context.Background(), key, value)\n}", "func SaveSession(session *Session) {\n\n\tconn := redisConnPool.Get()\n\tdefer conn.Close()\n\n\tsessionBytes, err := json.Marshal(session)\n\tif err != nil {\n\t\tfmt.Println(\"Couldn't marshal session to string: \", err.Error())\n\t\treturn\n\t}\n\n\tkey := fmt.Sprintf(\"sessions:%s\", session.ID)\n\t_, err = conn.Do(\"SET\", key, string(sessionBytes))\n\tif err != nil {\n\t\tfmt.Println(\"Failed to set session: \", err.Error())\n\t}\n}", "func (s *SessionStore) Add(session *Session) {\n\tfmt.Println(session.AccessToken)\n\n\ts.atM.Lock()\n\ts.accessTokens[session.AccessToken] = session\n\ts.atM.Unlock()\n\n\ts.rtM.Lock()\n\ts.refreshTokens[session.RefreshToken] = session\n\ts.rtM.Unlock()\n}", "func (s *SessionStore) Set(key, value interface{}) {\n\ts.session.Values[key] = value\n}", "func (c *cache) Set(session *Session) error {\n\tc.Lock()\n\tdefer c.Unlock()\n\tsession.Lock()\n\tsession.lastAccess = time.Now()\n\tid := session.id\n\tsession.Unlock()\n\n\t// Try to compact the cache.\n\tvar requiredSpace int\n\tif _, ok := c.sessions[id]; !ok {\n\t\trequiredSpace = 1\n\t}\n\tc.compact(requiredSpace)\n\n\t// Save in cache.\n\tif MaxSessionCacheSize != 0 {\n\t\tc.sessions[id] = session\n\t}\n\n\t// Write through to database.\n\tif err := Persistence.SaveSession(id, session); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (st *MemSessionStore) Flush() error {\n\tst.lock.Lock()\n\tdefer st.lock.Unlock()\n\tst.value = make(map[interface{}]interface{})\n\treturn nil\n}", "func (this *SessionStorage) CreateSession(w http.ResponseWriter) (*Session) {\n session := &Session{ lastAccessed: time.Now(), storage: make(map[string]string) }\n this.sessions[this.sessionCounter] = session\n http.SetCookie(w, &http.Cookie{Name: \"session\", Value: fmt.Sprint(this.sessionCounter)})\n this.sessionCounter += 1\n session.lastAccessed = time.Now()\n return session\n}", "func (s *StorageBase) SetSession(ctx context.Context, sessionId string, sessionData *gmap.StrAnyMap, ttl time.Duration) error {\n\treturn ErrorDisabled\n}", "func (cl *APIClient) SaveSession(sessionobj map[string]interface{}) *APIClient {\n\tsessionobj[\"socketcfg\"] = map[string]string{\n\t\t\"entity\": cl.socketConfig.GetSystemEntity(),\n\t\t\"session\": cl.socketConfig.GetSession(),\n\t}\n\treturn cl\n}", "func (session *Session) StoreEngine(storeEngine string) *Session {\n\tsession.Session = session.Session.StoreEngine(storeEngine)\n\treturn session\n}", "func (m *RedisStore) Set(key interface{}, value interface{}) error {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\tm.sessionData[key] = value\n\treturn nil\n}", "func (s *StorageFile) SetSession(ctx context.Context, sessionId string, sessionData *gmap.StrAnyMap, ttl time.Duration) error {\n\tintlog.Printf(ctx, \"StorageFile.SetSession: %s, %v, %v\", sessionId, sessionData, ttl)\n\tpath := s.sessionFilePath(sessionId)\n\tcontent, err := json.Marshal(sessionData)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Encrypt with AES.\n\tif s.cryptoEnabled {\n\t\tcontent, err = gaes.Encrypt(content, DefaultStorageFileCryptoKey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tfile, err := gfile.OpenWithFlagPerm(\n\t\tpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.ModePerm,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\tif _, err = file.Write(gbinary.EncodeInt64(gtime.TimestampMilli())); err != nil {\n\t\terr = gerror.Wrapf(err, `write data failed to file \"%s\"`, path)\n\t\treturn err\n\t}\n\tif _, err = file.Write(content); err != nil {\n\t\terr = gerror.Wrapf(err, `write data failed to file \"%s\"`, path)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (b *BaseHandler) setSessionStore(store SessionStore) {\n\tb.sessionStore = store\n}", "func (m *ExactMatchDataStore) SetSessions(value []ExactMatchSessionable)() {\n err := m.GetBackingStore().Set(\"sessions\", value)\n if err != nil {\n panic(err)\n }\n}", "func CreateSessionStorage(config SessionConfig) *SessionStorage {\n storage := &SessionStorage {\n sessions: make(map[uint64]*Session),\n sessionCounter: 0,\n done: make(chan bool),\n config: config,\n }\n storage.StartClearingSessions()\n return storage\n}", "func Benchmark_Session(b *testing.B) {\n\tapp, store := fiber.New(), New()\n\tc := app.AcquireCtx(&fasthttp.RequestCtx{})\n\tdefer app.ReleaseCtx(c)\n\tc.Request().Header.SetCookie(store.CookieName, \"12356789\")\n\n\tb.Run(\"default\", func(b *testing.B) {\n\t\tb.ReportAllocs()\n\t\tb.ResetTimer()\n\t\tfor n := 0; n < b.N; n++ {\n\t\t\tsess, _ := store.Get(c)\n\t\t\tsess.Set(\"john\", \"doe\")\n\t\t\t_ = sess.Save()\n\t\t}\n\t})\n\n\tb.Run(\"storage\", func(b *testing.B) {\n\t\tstore = New(Config{\n\t\t\tStorage: memory.New(),\n\t\t})\n\t\tb.ReportAllocs()\n\t\tb.ResetTimer()\n\t\tfor n := 0; n < b.N; n++ {\n\t\t\tsess, _ := store.Get(c)\n\t\t\tsess.Set(\"john\", \"doe\")\n\t\t\t_ = sess.Save()\n\t\t}\n\t})\n}", "func (e *engine) loadSession(ctx *Context) {\n\tif AppSessionManager().IsStateful() {\n\t\tctx.subject.Session = AppSessionManager().GetSession(ctx.Req.Unwrap())\n\t}\n}", "func (st *MemSessionStore) Set(key, value interface{}) error {\n\tst.lock.Lock()\n\tdefer st.lock.Unlock()\n\tst.value[key] = value\n\treturn nil\n}", "func (pdr *ProviderMySQL) SessionNew(sid string) (session.Store, error) {\n\tc := pdr.connectInit()\n\trow := c.QueryRow(\"select session_data from \"+TableName+\" where session_key=?\", sid)\n\tvar data []byte\n\terr := row.Scan(&data)\n\tif err == sql.ErrNoRows {\n\t\t_, err = c.Exec(\"insert into \"+TableName+\"(`session_key`,`session_data`,`session_expiry`) values(?,?,?)\",\n\t\t\tsid, \"\", time.Now().Unix())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tvar kv map[interface{}]interface{}\n\tif len(data) == 0 {\n\t\tkv = make(map[interface{}]interface{})\n\t} else {\n\t\tkv, err = session.DecodeGob(data)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\trs := &SessionStoreMySQL{conn: c, sid: sid, values: kv}\n\treturn rs, nil\n}", "func (s *Store) Get(c *fiber.Ctx) (*Session, error) {\n\tvar fresh bool\n\tloadData := true\n\n\tid := s.getSessionID(c)\n\n\tif len(id) == 0 {\n\t\tfresh = true\n\t\tvar err error\n\t\tif id, err = s.responseCookies(c); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// If no key exist, create new one\n\tif len(id) == 0 {\n\t\tloadData = false\n\t\tid = s.KeyGenerator()\n\t}\n\n\t// Create session object\n\tsess := acquireSession()\n\tsess.ctx = c\n\tsess.config = s\n\tsess.id = id\n\tsess.fresh = fresh\n\n\t// Fetch existing data\n\tif loadData {\n\t\traw, err := s.Storage.Get(id)\n\t\t// Unmarshal if we found data\n\t\tif raw != nil && err == nil {\n\t\t\tmux.Lock()\n\t\t\tdefer mux.Unlock()\n\t\t\t_, _ = sess.byteBuffer.Write(raw) //nolint:errcheck // This will never fail\n\t\t\tencCache := gob.NewDecoder(sess.byteBuffer)\n\t\t\terr := encCache.Decode(&sess.data.Data)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to decode session data: %w\", err)\n\t\t\t}\n\t\t} else if err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\t// both raw and err is nil, which means id is not in the storage\n\t\t\tsess.fresh = true\n\t\t}\n\t}\n\n\treturn sess, nil\n}", "func (m *MemoryStorer) Set(key, value string) error {\n\tm.mut.Lock()\n\tm.sessions[key] = memorySession{\n\t\texpires: time.Now().UTC().Add(m.maxAge),\n\t\tvalue: value,\n\t}\n\tm.mut.Unlock()\n\n\treturn nil\n}", "func (s *RedisStore) save(ctx context.Context, session *sessions.Session) error {\n\tb, err := s.serializer.Serialize(session)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif s.maxLength != 0 && len(b) > s.maxLength {\n\t\treturn errors.New(\"SessionStore: the value to store is too big\")\n\t}\n\n\tage := time.Duration(session.Options.MaxAge) * time.Second\n\tif age == 0 {\n\t\tage = time.Duration(s.DefaultMaxAge) * time.Second\n\t}\n\n\treturn s.Cmd.SetEX(ctx, s.keyPrefix+session.ID, b, age).Err()\n}", "func (s *RestStore) SaveSession(w http.ResponseWriter, r *http.Request, sessionState *SessionState) error {\n\tencToken, err := MarshalSession(sessionState, s.Cipher)\n\tif err != nil {\n\t\treturn err\n\t}\n\tjsonBytes, err := json.Marshal(\n\t\t&RestStoreResponse{\n\t\t\tToken: encToken,\n\t\t\tExpiry: sessionState.RefreshDeadline,\n\t\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"internal/sessions: couldn't marshal token struct: %v\", err)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(jsonBytes)\n\treturn nil\n}", "func (sess *Session) Save(w http.ResponseWriter) error {\n\treturn sess.store.Save(w, sess)\n}", "func (s *DgraphStore) Save(r *http.Request, w http.ResponseWriter,\n\tsession *sessions.Session) error {\n\t// Delete if max-age is <= 0\n\tif session.Options.MaxAge <= 0 {\n\t\tif err := s.erase(session); err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttp.SetCookie(w, sessions.NewCookie(session.Name(), \"\", session.Options))\n\t\treturn nil\n\t}\n\n\tif session.ID == \"\" {\n\t\tsession.ID = strings.TrimRight(\n\t\t\tbase32.StdEncoding.EncodeToString(\n\t\t\t\tsecurecookie.GenerateRandomKey(32)), \"=\")\n\t}\n\n\tif err := s.save(session); err != nil {\n\t\treturn err\n\t}\n\n\tencoded, err := securecookie.EncodeMulti(session.Name(), session.ID,\n\t\ts.Codecs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thttp.SetCookie(w, sessions.NewCookie(session.Name(), encoded, session.Options))\n\treturn nil\n}", "func (s *DatastoreStore) save(r *http.Request,\n\tsession *sessions.Session) error {\n\tif len(session.Values) == 0 {\n\t\t// Don't need to write anything.\n\t\treturn nil\n\t}\n\tserialized, err := serialize(session.Values)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tk := datastore.NameKey(s.kind, session.ID, nil)\n\tk, err = ds.Put(context.Background(), k, &Session{\n\t\tDate: time.Now(),\n\t\tValue: serialized,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not put session %s: %v\", session.ID, err)\n\t}\n\treturn nil\n}", "func (s *SessionStore) New(w http.ResponseWriter) (*Session, error) {\n\tsessionID := generateSessionID()\n\n\tif s.isCookieBased {\n\t\thttp.SetCookie(w, &http.Cookie{\n\t\t\tName: s.name,\n\t\t\tValue: sessionID,\n\t\t\tMaxAge: 0,\n\t\t\tHttpOnly: true})\n\t}\n\n\tsession := Session{\n\t\tID: sessionID,\n\t\tstore: s,\n\t\tData: make(map[string]interface{})}\n\tsession.Save()\n\treturn &session, nil\n}", "func (s *UserSession) Save(session map[string]string) bool {\n if !s.IsEncrypted() && !s.Encrypt() {\n revel.ERROR.Println(\"failed to encrypt user session when saving in cookie\")\n return false\n }\n\n session[app.STR_NAME] = s.UserName\n session[app.STR_PASSWORD] = s.Password\n session[app.STR_KEY] = s.AesKey\n session[app.STR_EXPIRE] = s.Expire\n return true\n}", "func (s *FilesystemStore) save(session *SessionImp) error {\n\tencoded, err := securecookie.EncodeMulti(session.name, session.Values,\n\t\ts.Codecs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfilename := filepath.Join(s.path, \"session_\"+session.ID)\n\tfileMutex.Lock()\n\tdefer fileMutex.Unlock()\n\treturn ioutil.WriteFile(filename, []byte(encoded), 0600)\n}", "func NewMemorySessionStore(duration time.Duration) *MemorySessionStore {\n\tm := &MemorySessionStore{\n\t\tstore: make(map[string]time.Time),\n\t\tduration: duration,\n\t\tmu: new(sync.Mutex),\n\t}\n\tgo scavenge(m)\n\treturn m\n}", "func (s *Session) Save() error {\n\treturn s.store.provider.Save(s.ID, s.Data)\n}", "func (s *RedisStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error {\n\t// Marked for deletion.\n\tif session.Options.MaxAge <= 0 {\n\t\tif err := s.delete(r.Context(), session); err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttp.SetCookie(w, sessions.NewCookie(session.Name(), \"\", session.Options))\n\t} else {\n\t\t// Build an alphanumeric key for the redis store.\n\t\tif session.ID == \"\" {\n\t\t\tsession.ID = strings.TrimRight(base32.StdEncoding.EncodeToString(securecookie.GenerateRandomKey(32)), \"=\")\n\t\t}\n\t\tif err := s.save(r.Context(), session); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tencoded, err := securecookie.EncodeMulti(session.Name(), session.ID, s.Codecs...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttp.SetCookie(w, sessions.NewCookie(session.Name(), encoded, session.Options))\n\t}\n\treturn nil\n}", "func NewSession(cfg Config) (*Session, error) {\n\tif cfg.PortBegin >= cfg.PortEnd {\n\t\treturn nil, errors.New(\"invalid port range\")\n\t}\n\tvar err error\n\tcfg.Database, err = homedir.Expand(cfg.Database)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcfg.DataDir, err = homedir.Expand(cfg.DataDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = os.MkdirAll(filepath.Dir(cfg.Database), 0750)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tl := logger.New(\"session\")\n\tdb, err := bolt.Open(cfg.Database, 0640, &bolt.Options{Timeout: time.Second})\n\tif err == bolt.ErrTimeout {\n\t\treturn nil, errors.New(\"resume database is locked by another process\")\n\t} else if err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tdb.Close()\n\t\t}\n\t}()\n\tvar ids []string\n\terr = db.Update(func(tx *bolt.Tx) error {\n\t\t_, err2 := tx.CreateBucketIfNotExists(sessionBucket)\n\t\tif err2 != nil {\n\t\t\treturn err2\n\t\t}\n\t\tb, err2 := tx.CreateBucketIfNotExists(torrentsBucket)\n\t\tif err2 != nil {\n\t\t\treturn err2\n\t\t}\n\t\treturn b.ForEach(func(k, _ []byte) error {\n\t\t\tids = append(ids, string(k))\n\t\t\treturn nil\n\t\t})\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres, err := boltdbresumer.New(db, torrentsBucket)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar dhtNode *dht.DHT\n\tif cfg.DHTEnabled {\n\t\tdhtConfig := dht.NewConfig()\n\t\tdhtConfig.Address = cfg.DHTHost\n\t\tdhtConfig.Port = int(cfg.DHTPort)\n\t\tdhtConfig.DHTRouters = strings.Join(cfg.DHTBootstrapNodes, \",\")\n\t\tdhtConfig.SaveRoutingTable = false\n\t\tdhtNode, err = dht.New(dhtConfig)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = dhtNode.Start()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tports := make(map[int]struct{})\n\tfor p := cfg.PortBegin; p < cfg.PortEnd; p++ {\n\t\tports[int(p)] = struct{}{}\n\t}\n\tbl := blocklist.New()\n\tc := &Session{\n\t\tconfig: cfg,\n\t\tdb: db,\n\t\tresumer: res,\n\t\tblocklist: bl,\n\t\ttrackerManager: trackermanager.New(bl, cfg.DNSResolveTimeout),\n\t\tlog: l,\n\t\ttorrents: make(map[string]*Torrent),\n\t\ttorrentsByInfoHash: make(map[dht.InfoHash][]*Torrent),\n\t\tavailablePorts: ports,\n\t\tdht: dhtNode,\n\t\tpieceCache: piececache.New(cfg.PieceCacheSize, cfg.PieceCacheTTL, cfg.ParallelReads),\n\t\tram: resourcemanager.New(cfg.MaxActivePieceBytes),\n\t\tcreatedAt: time.Now(),\n\t\tcloseC: make(chan struct{}),\n\t\twebseedClient: http.Client{\n\t\t\tTransport: &http.Transport{\n\t\t\t\tDialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {\n\t\t\t\t\tip, port, err := resolver.Resolve(ctx, addr, cfg.DNSResolveTimeout, bl)\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\tvar d net.Dialer\n\t\t\t\t\ttaddr := &net.TCPAddr{IP: ip, Port: port}\n\t\t\t\t\tdctx, cancel := context.WithTimeout(ctx, cfg.WebseedDialTimeout)\n\t\t\t\t\tdefer cancel()\n\t\t\t\t\treturn d.DialContext(dctx, network, taddr.String())\n\t\t\t\t},\n\t\t\t\tTLSHandshakeTimeout: cfg.WebseedTLSHandshakeTimeout,\n\t\t\t\tResponseHeaderTimeout: cfg.WebseedResponseHeaderTimeout,\n\t\t\t},\n\t\t},\n\t}\n\text, err := bitfield.NewBytes(c.extensions[:], 64)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\text.Set(61) // Fast Extension (BEP 6)\n\text.Set(43) // Extension Protocol (BEP 10)\n\tif cfg.DHTEnabled {\n\t\text.Set(63) // DHT Protocol (BEP 5)\n\t}\n\terr = c.startBlocklistReloader()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif cfg.DHTEnabled {\n\t\tc.dhtPeerRequests = make(map[*torrent]struct{})\n\t\tgo c.processDHTResults()\n\t}\n\tc.loadExistingTorrents(ids)\n\tif c.config.RPCEnabled {\n\t\tc.rpc = newRPCServer(c)\n\t\terr = c.rpc.Start(c.config.RPCHost, c.config.RPCPort)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tgo c.updateStatsLoop()\n\treturn c, nil\n}", "func Session(m *session.Manager) jsonapi.Middleware {\n\treturn func(h jsonapi.Handler) jsonapi.Handler {\n\t\treturn func(req jsonapi.Request) (i interface{}, e error) {\n\t\t\tr := req.R()\n\t\t\tsess, err := m.Start(req.W(), r)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, jsonapi.E500.SetOrigin(err)\n\t\t\t}\n\n\t\t\tr = r.WithContext(context.WithValue(\n\t\t\t\tr.Context(),\n\t\t\t\tsession.SessionObjectKey,\n\t\t\t\tsess,\n\t\t\t))\n\t\t\ti, e = h(jsonapi.WrapRequest(req, r))\n\n\t\t\t_ = sess.Save(req.W())\n\t\t\treturn\n\t\t}\n\t}\n}", "func Test_Session(t *testing.T) {\n\tt.Parallel()\n\n\t// session store\n\tstore := New()\n\n\t// fiber instance\n\tapp := fiber.New()\n\n\t// fiber context\n\tctx := app.AcquireCtx(&fasthttp.RequestCtx{})\n\tdefer app.ReleaseCtx(ctx)\n\n\t// set cookie\n\tctx.Request().Header.SetCookie(store.CookieName, \"123\")\n\n\t// get session\n\tsess, err := store.Get(ctx)\n\tutils.AssertEqual(t, nil, err)\n\tutils.AssertEqual(t, true, sess.Fresh())\n\n\t// get value\n\tname := sess.Get(\"name\")\n\tutils.AssertEqual(t, nil, name)\n\n\t// set value\n\tsess.Set(\"name\", \"john\")\n\n\t// get value\n\tname = sess.Get(\"name\")\n\tutils.AssertEqual(t, \"john\", name)\n\n\t// delete key\n\tsess.Delete(\"name\")\n\n\t// get value\n\tname = sess.Get(\"name\")\n\tutils.AssertEqual(t, nil, name)\n\n\t// get id\n\tid := sess.ID()\n\tutils.AssertEqual(t, \"123\", id)\n\n\t// delete cookie\n\tctx.Request().Header.Del(fiber.HeaderCookie)\n\n\t// get session\n\tsess, err = store.Get(ctx)\n\tutils.AssertEqual(t, nil, err)\n\tutils.AssertEqual(t, true, sess.Fresh())\n\n\t// get id\n\tid = sess.ID()\n\tutils.AssertEqual(t, 36, len(id))\n}", "func (st *MemSessionStore) Flush() error {\n\treturn (*session.MemSessionStore)(st).Flush(context.Background())\n}", "func NewMemorySession() Session {\n\treturn memorySession{store: new(sync.Map)}\n}", "func (s *Session) Persist() *errors.Error {\n\tconnPool, err := GetDBConnectionFunc(sessionStore)\n\tif err != nil {\n\t\treturn errors.PackError(err.ErrNo(), \"error while trying to connecting to DB: \", err.Error())\n\t}\n\tif err = connPool.Create(\"session\", s.Token, s); err != nil {\n\t\treturn errors.PackError(err.ErrNo(), \"error while trying to create new session: \", err.Error())\n\t}\n\treturn nil\n}", "func (m *MemorySessionStore) Create() (sessionID string, err error) {\n\tid := randString(128)\n\tm.mu.Lock()\n\tm.store[id] = time.Now().Add(m.duration)\n\tm.mu.Unlock()\n\treturn id, nil\n}", "func (m *MongoDBStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error {\n\tif session.Options.MaxAge < 0 {\n\t\tif err := m.delete(session); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tm.Token.SetToken(w, session.Name(), \"\", session.Options)\n\t\treturn nil\n\t}\n\n\tif session.ID == \"\" {\n\t\tsession.ID = primitive.NewObjectID().Hex()\n\t}\n\n\tif err := m.upsert(session); err != nil {\n\t\treturn err\n\t}\n\n\tencoded, err := securecookie.EncodeMulti(session.Name(), session.ID, m.Codecs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tm.Token.SetToken(w, session.Name(), encoded, session.Options)\n\treturn nil\n}", "func (s TrafficOpsSessionThreadsafe) Set(session *to.Session) {\n\ts.m.Lock()\n\t*s.session = session\n\ts.m.Unlock()\n}", "func (s *FilesystemStore) Save(c *kelly.Context, session *SessionImp) error {\n\t// Delete if max-age is <= 0\n\tif session.Options.MaxAge <= 0 {\n\t\tif err := s.erase(session); err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttp.SetCookie(c, NewCookie(session.name, \"\", session.Options))\n\t\treturn nil\n\t}\n\n\tif session.ID == \"\" {\n\t\t// Because the ID is used in the filename, encode it to\n\t\t// use alphanumeric characters only.\n\t\tsession.ID = strings.TrimRight(\n\t\t\tbase32.StdEncoding.EncodeToString(securecookie.GenerateRandomKey(32)), \"=\")\n\t}\n\tif err := s.save(session); err != nil {\n\t\treturn err\n\t}\n\tencoded, err := securecookie.EncodeMulti(session.name, session.ID,\n\t\ts.Codecs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\thttp.SetCookie(c, NewCookie(session.name, encoded, session.Options))\n\treturn nil\n}", "func (s *InMemoryDocumentSessionOperations) Store(entity Object) error {\n\t_, hasID := s.generateEntityIdOnTheClient.tryGetIdFromInstance(entity)\n\tconcu := ConcurrencyCheck_AUTO\n\tif !hasID {\n\t\tconcu = ConcurrencyCheck_FORCED\n\t}\n\treturn s.storeInternal(entity, nil, \"\", concu)\n}", "func (rs *RedisStore) Save(sid SessionID, sessionState interface{}) error {\n\tlog.Printf(\"!!! I am about to save something to the redis db\")\n\n\tj, err := json.Marshal(sessionState)\n\tif err != nil {\n\t\tlog.Printf(\"!!! There was an error in saving\" + err.Error())\n\t\treturn err\n\t}\n\t//rs.Client.Set(sid.getRedisKey(), j, rs.SessionDuration)\n\trs.Client.Set(sid.getRedisKey(), j, time.Hour)\n\t//JAY MADE THE ABOVE CHANGE TO ATTEMPT A HARDCODED DEBUG FIX\n\treturn nil\n}", "func (mgr *SessionMgr) Set(sessionID string, key interface{}, value interface{}) {\n\tmgr.Lock.Lock()\n\tdefer mgr.Lock.Unlock()\n\n\tif session, ok := mgr.Sessions[sessionID]; ok {\n\t\tsession.Values[key] = value\n\t}\n}", "func Session() HandlerFunc {\n\treturn func(c *Context) {\n\t\tif sessionManager == nil {\n\t\t\tpanic(\"please call gow.InitSession()\")\n\t\t}\n\t\tsessionID = sessionManager.Start(c.Writer, c.Req)\n\t\tsessionManager.Extension(c.Writer, c.Req)\n\t\tc.Next()\n\t}\n}", "func (sc *SessionCreate) Save(ctx context.Context) (*Session, error) {\n\tvar (\n\t\terr error\n\t\tnode *Session\n\t)\n\tsc.defaults()\n\tif len(sc.hooks) == 0 {\n\t\tif err = sc.check(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnode, err = sc.sqlSave(ctx)\n\t} else {\n\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\tmutation, ok := m.(*SessionMutation)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t}\n\t\t\tif err = sc.check(); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tsc.mutation = mutation\n\t\t\tif node, err = sc.sqlSave(ctx); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tmutation.id = &node.ID\n\t\t\tmutation.done = true\n\t\t\treturn node, err\n\t\t})\n\t\tfor i := len(sc.hooks) - 1; i >= 0; i-- {\n\t\t\tif sc.hooks[i] == nil {\n\t\t\t\treturn nil, fmt.Errorf(\"ent: uninitialized hook (forgotten import ent/runtime?)\")\n\t\t\t}\n\t\t\tmut = sc.hooks[i](mut)\n\t\t}\n\t\tv, err := mut.Mutate(ctx, sc.mutation)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnv, ok := v.(*Session)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"unexpected node type %T returned from SessionMutation\", v)\n\t\t}\n\t\tnode = nv\n\t}\n\treturn node, err\n}", "func (st *MemSessionStore) SessionID() string {\n\treturn st.sid\n}", "func (t *SimpleChaincode) SaveSession(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\n\n\tvar err error\n\tfmt.Println(\"running savesession\")\n\n\tif len(args) != 2 {\n\t\treturn nil, errors.New(\"Incorrect number of arguments. Expecting 2.\")\n\t}\n\tif len(args[0]) <= 0 {\n\t\treturn nil, errors.New(\"1st argument must be a non-empty string\")\n\t}\n\tif len(args[1]) <= 0 {\n\t\treturn nil, errors.New(\"2nd argument must be a non-empty string\")\n\t}\n\tauthsession := SessionAunthentication{}\n\tauthsession.Token = args[0]\n\tauthsession.Email = args[1]\n\t//get session empty[]\n\tUserAsBytes, err := stub.GetState(\"savesessionvfm\")\n\tif err != nil {\n\t\treturn nil, errors.New(\"Failed to get users session\")\n\t}\n\tvar session Session\n\tjson.Unmarshal(UserAsBytes, &session) //un stringify it aka JSON.parse()\n\n\tsession.StoreSession = append(session.StoreSession, authsession)\n\tfmt.Println(\"allsessions\", session.StoreSession) //append each users session to allsession[]\n\tfmt.Println(\"! appended user to allsessions\")\n\tjsonAsBytes, _ := json.Marshal(session)\n\tfmt.Println(\"json\", jsonAsBytes)\n\terr = stub.PutState(\"savesessionvfm\", jsonAsBytes) //rewrite allsession[]\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfmt.Println(\"- end save session\")\n\treturn nil, nil\n}", "func (m *RedisStore) Flush() error {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\tm.sessionData = make(map[interface{}]interface{})\n\treturn nil\n}", "func SaveSession(ctx context.Context, session *sessions.Session) error {\n\thttpContext := ctx.Value(HTTPKey(\"http\")).(HTTP)\n\n\terr := session.Save(httpContext.R, *httpContext.W)\n\n\treturn err\n}", "func (s *DatastoreStore) Save(r *http.Request, w http.ResponseWriter,\n\tsession *sessions.Session) error {\n\tif session.ID == \"\" {\n\t\tsession.ID = string(newToken(\"\", 32))\n\t}\n\tif err := s.save(r, session); err != nil {\n\t\treturn err\n\t}\n\tencoded, err := securecookie.EncodeMulti(session.Name(), session.ID,\n\t\ts.Codecs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\toptions := s.Options\n\thttp.SetCookie(w, sessions.NewCookie(session.Name(), encoded, options))\n\treturn nil\n}", "func pvtNewSession(c *db.SessionCookie, firstname string, rid int, updateSessionTable bool) *Session {\n\t// lib.Ulog(\"Entering NewSession: %s (%d)\\n\", username, uid)\n\tuid := int(c.UID)\n\ts := new(Session)\n\ts.Token = c.Cookie\n\ts.Username = c.UserName\n\ts.Firstname = firstname\n\ts.UID = c.UID\n\ts.UIDorig = c.UID\n\ts.ImageURL = ui.GetImageLocation(uid)\n\ts.Breadcrumbs = make([]ui.Crumb, 0)\n\ts.Expire = c.Expire\n\ts.IP = c.IP\n\ts.UserAgent = c.UserAgent\n\tauthz.GetRoleInfo(rid, &s.PMap)\n\n\tif authz.Authz.SecurityDebug {\n\t\tfor i := 0; i < len(s.PMap.Urole.Perms); i++ {\n\t\t\tlib.Ulog(\"f: %s, perm: %02x\\n\", s.PMap.Urole.Perms[i].Field, s.PMap.Urole.Perms[i].Perm)\n\t\t}\n\t}\n\n\tvar d db.PersonDetail\n\td.UID = uid\n\n\terr := SessionManager.db.QueryRow(fmt.Sprintf(\"SELECT CoCode FROM people WHERE UID=%d\", uid)).Scan(&s.CoCode)\n\tif nil != err {\n\t\tlib.Ulog(\"Unable to read CoCode for userid=%d, err = %v\\n\", uid, err)\n\t}\n\n\tif updateSessionTable {\n\t\tlib.Console(\"JUST BEFORE InsertSessionCookie: s.IP = %s, s.UserAgent = %s\\n\", s.IP, s.UserAgent)\n\t\terr = InsertSessionCookie(s)\n\t\tif err != nil {\n\t\t\tlib.Ulog(\"Unable to save session for UID = %d to database, err = %s\\n\", uid, err.Error())\n\t\t}\n\t}\n\n\tSessionManager.ReqSessionMem <- 1 // ask to access the shared mem, blocks until granted\n\t<-SessionManager.ReqSessionMemAck // make sure we got it\n\tSessions[c.Cookie] = s\n\tSessionManager.ReqSessionMemAck <- 1 // tell SessionDispatcher we're done with the data\n\n\treturn s\n}", "func (s *SecureSessionStore) Set(key, value string, rw http.ResponseWriter, req *http.Request) error {\n\tsession := s.getSession(req)\n\tsession.Values[key] = value\n\treturn session.Save(req, rw)\n}", "func NewSessionStore(db *sql.DB) *SessionStore {\n\treturn &SessionStore{kallax.NewStore(db)}\n}", "func (pdr *ProviderMySQL) SessionRegenerate(oldSid, sid string) (session.Store, error) {\n\tc := pdr.connectInit()\n\trow := c.QueryRow(\"select session_data from \"+TableName+\" where session_key=?\", oldSid)\n\tvar data []byte\n\terr := row.Scan(&data)\n\tif err == sql.ErrNoRows {\n\t\t_, err = c.Exec(\"insert into \"+TableName+\"(`session_key`,`session_data`,`session_expiry`) values(?,?,?)\", oldSid, \"\", time.Now().Unix())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t_, err = c.Exec(\"update \"+TableName+\" set `session_key`=?, `session_expiry`=? where session_key=?\", sid, time.Now().Unix(), oldSid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar kv map[interface{}]interface{}\n\tif len(data) == 0 {\n\t\tkv = make(map[interface{}]interface{})\n\t} else {\n\t\tkv, err = session.DecodeGob(data)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\trs := &SessionStoreMySQL{conn: c, sid: sid, values: kv}\n\treturn rs, nil\n}", "func (s *Store) Create(ID string) (*Session, error) {\n\tsession := newSession(ID)\n\tsession.Add(\"exists\", true)\n\n\tif _, err := s.client.HMSet(ID, session.toRedisDict()).Result(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif _, err := s.client.Expire(ID, s.valid).Result(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn session, nil\n}", "func (mgr ScsManager) Use(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tvar data []byte\n\t\tvar temp string\n\t\t// get the session. All of our session data is stored in only one key in the session manager.\n\t\tsession := mgr.Manager.Load(r)\n\t\tif err := session.Touch(w); err != nil { // Make sure to get a cookie in our header if we don't have one\n\t\t\tlog.Errorf(\"Error loading session: %s\", err.Error()) // we can't panic here, because our panic handlers have not been set up\n\t\t}\n\t\tdata, _ = session.GetBytes(scsSessionDataKey)\n\t\tsessionData := NewSession()\n\t\tif data != nil {\n\t\t\tif err := sessionData.UnmarshalBinary(data); err != nil {\n\t\t\t\tlog.Errorf(\"Error unpacking session data: %s\", err.Error())\n\t\t\t}\n\t\t}\n\n\t\tif sessionData.Has(sessionResetKey) {\n\t\t\t// Our previous session requested a reset. We can't reset after writing, so we reset here at the start of the next request.\n\t\t\tsessionData.Delete(sessionResetKey)\n\t\t\tif err := session.RenewToken(w); err != nil {\n\t\t\t\tlog.Errorf(\"Error renewing session token: %s\", err.Error())\n\t\t\t}\n\t\t}\n\n\t\tctx := r.Context()\n\t\tctx = context.WithValue(ctx, sessionContext, sessionData)\n\t\tr = r.WithContext(ctx)\n\t\tnext.ServeHTTP(w, r)\n\n\t\t// write out the changed session. The below will attempt to write a cookie, but it can't because headers have already been written.\n\t\t// That is OK, because of our Touch above.\n\t\tif sessionData.Len() > 0 {\n\t\t\tvar err error\n\t\t\tdata, err = sessionData.MarshalBinary()\n\t\t\tif err != nil {\n\t\t\t\t// This is an application error. We put data into the session which is not serializable.\n\t\t\t\ts := \"Error marshalling session data: %s\" + err.Error()\n\t\t\t\tlog.Error(s)\n\t\t\t\thttp.Error(w, s, 500)\n\t\t\t}\n\t\t\ttemp = string(data)\n\t\t\t_ = temp\n\t\t\tif err := session.PutBytes(w, scsSessionDataKey, data); err != nil {\n\t\t\t\tlog.Errorf(\"Error putting session data: %s\", err.Error())\n\t\t\t}\n\t\t} else {\n\t\t\tif err := session.Clear(w); err != nil {\n\t\t\t\tlog.Errorf(\"Error clearing session: %s\", err.Error())\n\t\t\t}\n\t\t}\n\t}\n\treturn mgr.Manager.Use(http.HandlerFunc(fn))\n}", "func SessionSetValue(ctx context.Context, name string, value interface{}) {\n\ts, ok := ctx.Value(sessionKey).(*Session)\n\tif ok {\n\t\ts.set(name, value)\n\t}\n}", "func StoreSessionRealm(session *sessions.Session, realm *database.Realm) {\n\tif session == nil || realm == nil {\n\t\treturn\n\t}\n\tClearWelcomeMessageDisplayed(session)\n\tsession.Values[sessionKeyRealmID] = realm.ID\n}", "func NewSessionStore(domain string) *DatastoreStore {\n\n\tkind := \"session\"\n\tk := datastore.NameKey(\"sessionKey\", \"key\", nil)\n\tkp := &key{}\n\terr := ds.Get(context.Background(), k, kp)\n\tif err == datastore.ErrNoSuchEntity {\n\t\tkp.KeyPairs = [][]byte{securecookie.GenerateRandomKey(64)}\n\t\t_, err = ds.Put(context.Background(), k, kp)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn &DatastoreStore{\n\t\tCodecs: securecookie.CodecsFromPairs(kp.KeyPairs...),\n\t\tOptions: &sessions.Options{\n\t\t\tDomain: domain,\n\t\t\tPath: \"/\",\n\t\t\tMaxAge: 86400 * 30,\n\t\t},\n\t\tkind: kind,\n\t}\n}", "func StartSession(w http.ResponseWriter, r *http.Request, u GSUser) {\n\tuID, _ := uuid.NewV4()\n\tcookie, err := r.Cookie(\"session\")\n\tif err == nil {\n\t\t//Value of cookie which named session, is checking\n\t\t_, err := uuid.FromString(cookie.Value)\n\t\tif err != nil {\n\t\t\t//invalid uuid(Cookie/Session Value) is detected by *Satori* and value is changed\n\t\t\tdelMaps(cookie.Value, u)\n\t\t\tcookie.Value = uID.String()\n\t\t\tcookie.MaxAge = SessionTime\n\t\t\thttp.SetCookie(w, cookie)\n\t\t}\n\t\t//System already have a session now. Checking harmony between uuid and RAM(dbUsers, dbSessions)\n\t\tif !checkDatabases(cookie.Value) {\n\t\t\t//RAM is cleared, now system have a cookie but RAM cleared by 'checkDatabases'(internal command)\n\t\t\t//fmt.Println(\"içerideyiz\", uID.String())\n\t\t\tcookie.Value = uID.String()\n\t\t\tcookie.MaxAge = SessionTime\n\t\t\thttp.SetCookie(w, cookie)\n\t\t\taddMaps(cookie.Value, u)\n\t\t\t//OK, everything is fine. Session value(uuid) is valid and RAM and Session are pointed by each other.\n\t\t} else {\n\t\t\t//OK, everything is fine. Session value(uuid) is valid and RAM and Session are pointed by each other.\n\t\t}\n\t} else {\n\t\t//System has no any cookie which named session and everything is created from A to Z\n\t\t//In this command, RAM isn't check because 1 session can point 1 user object.\n\t\t//but\n\t\t//1 user object can pointed more than one session(uuid)\n\t\t//\n\t\t//Why?: User have mobile, desktop, tablet devices which can login by.\n\t\tcreateSessionCookie(w, r, uID.String())\n\t\taddMaps(uID.String(), u)\n\t\t//OK, everything is fine. Session value(uuid) is valid and RAM and Session are pointed by each other.\n\t}\n}", "func Run() {\n\tGlobalSessions, _ = session.NewManager(\"memory\", \"gosessionid\", 3600)\n\tgo GlobalSessions.GC()\n}", "func newSession(id rsession.ID, r *SessionRegistry, ctx *ServerContext) (*session, error) {\n\tserverSessions.Inc()\n\trsess := rsession.Session{\n\t\tID: id,\n\t\tTerminalParams: rsession.TerminalParams{\n\t\t\tW: teleport.DefaultTerminalWidth,\n\t\t\tH: teleport.DefaultTerminalHeight,\n\t\t},\n\t\tLogin: ctx.Identity.Login,\n\t\tCreated: time.Now().UTC(),\n\t\tLastActive: time.Now().UTC(),\n\t\tServerID: ctx.srv.ID(),\n\t\tNamespace: r.srv.GetNamespace(),\n\t}\n\tterm := ctx.GetTerm()\n\tif term != nil {\n\t\twinsize, err := term.GetWinSize()\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\trsess.TerminalParams.W = int(winsize.Width)\n\t\trsess.TerminalParams.H = int(winsize.Height)\n\t}\n\n\t// get the session server where session information lives. if the recording\n\t// proxy is being used and this is a node, then a discard session server will\n\t// be returned here.\n\tsessionServer := r.srv.GetSessionServer()\n\n\terr := sessionServer.CreateSession(rsess)\n\tif err != nil {\n\t\tif trace.IsAlreadyExists(err) {\n\t\t\t// if session already exists, make sure they are compatible\n\t\t\t// Login matches existing login\n\t\t\texisting, err := sessionServer.GetSession(r.srv.GetNamespace(), id)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\tif existing.Login != rsess.Login {\n\t\t\t\treturn nil, trace.AccessDenied(\n\t\t\t\t\t\"can't switch users from %v to %v for session %v\",\n\t\t\t\t\trsess.Login, existing.Login, id)\n\t\t\t}\n\t\t}\n\t\t// return nil, trace.Wrap(err)\n\t\t// No need to abort. Perhaps the auth server is down?\n\t\t// Log the error and continue:\n\t\tr.log.Errorf(\"Failed to create new session: %v.\", err)\n\t}\n\n\tsess := &session{\n\t\tlog: logrus.WithFields(logrus.Fields{\n\t\t\ttrace.Component: teleport.Component(teleport.ComponentSession, r.srv.Component()),\n\t\t}),\n\t\tid: id,\n\t\tregistry: r,\n\t\tparties: make(map[rsession.ID]*party),\n\t\twriter: newMultiWriter(),\n\t\tlogin: ctx.Identity.Login,\n\t\tcloseC: make(chan bool),\n\t\tlingerTTL: defaults.SessionIdlePeriod,\n\t}\n\treturn sess, nil\n}", "func (st *SessionStoreMySQL) Set(key, value interface{}) error {\n\tst.lock.Lock()\n\tdefer st.lock.Unlock()\n\tst.values[key] = value\n\treturn nil\n}", "func StoreSessionRegion(session *sessions.Session, region string) {\n\tif session == nil {\n\t\treturn\n\t}\n\tsession.Values[regionKey] = region\n}", "func (rs *RedisStore) Save(sid SessionID, state interface{}) error {\n\tj, err := json.Marshal(state)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = rs.Client.Set(sid.getRedisKey(), j, rs.SessionDuration).Err()\n\n\treturn err\n}", "func (m *Memory) Store(_ context.Context, key string, value process.Context) error {\n\tm.mx.Lock()\n\tdefer m.mx.Unlock()\n\tm.storage[key] = value\n\n\treturn nil\n}", "func (mgr *MemorySessionManager) Session(sid string) (Session, error) {\n\tmgr.lock.RLock()\n\tif s, ok := mgr.sessions[sid]; ok {\n\t\ts.createdAt = time.Now()\n\t\tmgr.lock.RUnlock()\n\t\treturn s, nil\n\t}\n\tmgr.lock.RUnlock()\n\treturn nil, fmt.Errorf(\"Can not retrieve session with id %s\", sid)\n}", "func TestSession_AsSession(t *testing.T) { var _ Session = newSession(nil, \"id\", 0, 0) }", "func NewInMemorySessionStore(maxSize int) inMemorySessionStore {\n\treturn inMemorySessionStore{maxSize: maxSize, store: map[string]*list.Element{}}\n}", "func (sess Session) Set(key, value string) {\n\tsess[key] = value\n}", "func Sessionload(next http.Handler) http.Handler {\n\treturn session.LoadAndSave(next)\n}", "func (w *Worker) SetSession(s *Session) {\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\tw.s = s\n}", "func (s *Session) Save() (err error) {\n\tvar (\n\t\tfile *os.File\n\t)\n\n\t// create the session directory\n\tif err = os.MkdirAll(s.Folder, 0600); err != nil {\n\t\treturn fmt.Errorf(\"could not create .clouditor in home directory: %w\", err)\n\t}\n\n\tif file, err = os.OpenFile(fmt.Sprintf(\"%s/session.json\", s.Folder), os.O_TRUNC|os.O_CREATE|os.O_WRONLY, 0600); err != nil {\n\t\treturn fmt.Errorf(\"could not save session.json: %w\", err)\n\t}\n\n\tdefer func(file *os.File) {\n\t\terr = file.Close()\n\t}(file)\n\n\tif err = json.NewEncoder(file).Encode(&s); err != nil {\n\t\treturn fmt.Errorf(\"could not serialize JSON: %w\", err)\n\t}\n\n\ts.dirty = false\n\n\treturn nil\n}", "func New(w http.ResponseWriter, r *http.Request, tmpdir string) (*Session, error) {\n\ts := Session{\n\t\tw: w,\n\t\tr: r,\n\t\ttmpdir: tmpdir,\n\t\tvarlist: &vars{\n\t\t\tBool: map[string]bool{},\n\t\t\tInt: map[string]int{},\n\t\t\tInt64: map[string]int64{},\n\t\t\tString: map[string]string{},\n\t\t},\n\t\tchanged: false,\n\t\thash: \"\",\n\t}\n\n\ts.varlist.Lock()\n\tdefer s.varlist.Unlock()\n\n\tcookie, err := r.Cookie(\"session\")\n\tif err == nil && len(cookie.Value) == 40 {\n\t\t// Load from file\n\t\ts.hash = cookie.Value\n\t\tfname := strings.Join([]string{s.tmpdir, s.hash}, string(os.PathSeparator))\n\n\t\tinfo, err := os.Stat(fname)\n\t\tif err != nil {\n\t\t\treturn &s, err\n\t\t}\n\n\t\tvar f *os.File\n\t\tf, err = os.Open(fname)\n\t\tif err != nil {\n\t\t\treturn &s, err\n\t\t}\n\t\tdefer f.Close()\n\n\t\tdec := json.NewDecoder(f)\n\t\terr = dec.Decode(&s.varlist)\n\t\tif err != nil {\n\t\t\treturn &s, err\n\t\t}\n\n\t\t// Update file last modify time\n\t\tif time.Since(info.ModTime()) > 30*time.Minute {\n\t\t\tif err := os.Chtimes(fname, time.Now(), time.Now()); err != nil {\n\t\t\t\treturn &s, err\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// Create new\n\t\trand.Seed(time.Now().Unix())\n\n\t\t// Real remote IP for proxy servers\n\t\trRemoteAddr := r.RemoteAddr\n\t\tif r.Header.Get(\"X-Real-IP\") != \"\" && len(r.Header.Get(\"X-Real-IP\")) <= 25 {\n\t\t\trRemoteAddr = rRemoteAddr + \", \" + strings.TrimSpace(r.Header.Get(\"X-Real-IP\"))\n\t\t} else if r.Header.Get(\"X-Forwarded-For\") != \"\" && len(r.Header.Get(\"X-Forwarded-For\")) <= 25 {\n\t\t\trRemoteAddr = rRemoteAddr + \", \" + strings.TrimSpace(r.Header.Get(\"X-Forwarded-For\"))\n\t\t}\n\n\t\tsign := rRemoteAddr + r.Header.Get(\"User-Agent\") + fmt.Sprintf(\"%d\", int64(time.Now().Unix())) + fmt.Sprintf(\"%d\", int64(rand.Intn(9999999-99)+99))\n\t\ts.hash = fmt.Sprintf(\"%x\", sha1.Sum([]byte(sign)))\n\n\t\thttp.SetCookie(w, &http.Cookie{\n\t\t\tName: \"session\",\n\t\t\tValue: s.hash,\n\t\t\tPath: \"/\",\n\t\t\tExpires: time.Now().Add(7 * 24 * time.Hour),\n\t\t\tHttpOnly: true,\n\t\t})\n\t}\n\n\treturn &s, nil\n}", "func (ms memstore) Set(key string, data Sessiondata, timeout int) error {\n\tn := time.Now()\n\te := data[expiresTS].(time.Time)\n\tif e.After(n) {\n\t\t/*\n\t\t *\tdelete it from map when timeout\n\t\t */\n\t\ttmr := time.AfterFunc(e.Sub(n), func() {\n\t\t\tms.lock.Lock()\n\t\t\tdelete(ms.store, key)\n\t\t\tms.lock.Unlock()\n\t\t})\n\t\tdata[\"_tmr\"] = tmr\n\n\t\tms.lock.Lock()\n\t\tms.store[key] = data\n\t\tms.lock.Unlock()\n\t}\n\n\treturn nil\n}", "func New(name string, store gorillaSessions.Store) middleware.Handler {\n\treturn middleware.HandlerFunc(func(c context.Context, w http.ResponseWriter, r *http.Request) context.Context {\n\t\tsession, _ := store.Get(r, sessionName)\n\t\tc = context.WithValue(c, storeKey, store)\n\t\t// gogo.Session(c).Values[\"foo\"]\n\t\treturn c\n\t})\n}", "func For(ctx context.Context) (*Store, error) {\n\treturn ctx.Value(sessionContextKey).(*Store), nil\n\n}", "func setSession(c echo.Context, r *http.Response) {\r\n\r\n\tfor _, cookie := range r.Cookies() {\r\n\r\n\t\tif cookie.Name == \"PHPSESSID\" {\r\n\r\n\t\t\tsess, _ := session.Get(\"Session\", c)\r\n\t\t\tsess.Options = &sessions.Options{\r\n\t\t\t\tPath: \"*\",\r\n\t\t\t\tMaxAge: 60 * 3,\r\n\t\t\t\tHttpOnly: true,\r\n\t\t\t}\r\n\t\t\tsess.Values[\"PHPSESSID\"] = cookie.Value\r\n\r\n\t\t\tsess.Save(c.Request(), c.Response())\r\n\t\t}\r\n\t}\r\n}", "func SetSession(client *client.Client, db *db.Database, log *log.Logger) {\n\ts = &Session{client, db, log}\n}" ]
[ "0.7168202", "0.7162182", "0.7039447", "0.6854262", "0.68216854", "0.6818332", "0.6646486", "0.66210485", "0.6595175", "0.6536938", "0.6471403", "0.6465982", "0.6429156", "0.64185417", "0.6374666", "0.6370199", "0.63664067", "0.63397634", "0.6339028", "0.6318748", "0.6291724", "0.62836176", "0.6277572", "0.6244726", "0.6233536", "0.6208358", "0.62061423", "0.61995846", "0.61868966", "0.6184727", "0.6169451", "0.6134889", "0.61243856", "0.6091787", "0.6090805", "0.6083932", "0.6083635", "0.6075574", "0.60631156", "0.6032243", "0.6025108", "0.6019997", "0.6016463", "0.59937775", "0.5977907", "0.59646267", "0.59423244", "0.5934536", "0.5916189", "0.59161717", "0.59036213", "0.5898954", "0.5895022", "0.5891128", "0.5887665", "0.5872153", "0.58688474", "0.58563536", "0.5846014", "0.5824395", "0.5822099", "0.58153826", "0.5803791", "0.5799906", "0.578976", "0.5749049", "0.5734619", "0.5729709", "0.5703837", "0.5698235", "0.56889904", "0.5687449", "0.5682116", "0.5678704", "0.56659824", "0.5656173", "0.5651722", "0.564568", "0.5645227", "0.56352025", "0.5634383", "0.56298846", "0.562625", "0.56231874", "0.56215745", "0.5617588", "0.5612499", "0.560654", "0.5606417", "0.55954945", "0.55828404", "0.55792975", "0.55776787", "0.5566478", "0.5564723", "0.5562301", "0.556018", "0.554813", "0.5541952", "0.5540983" ]
0.7362877
0
HasSession implemented in memory.
func (ms *MemStore) HasSession(sessionKey string) bool { _, ok := ms.sessions[sessionKey] return ok }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (pder *MemSessionProvider) HasSession(sid string) (bool, error) {\r\n\tpder.lock.RLock()\r\n\tdefer pder.lock.RUnlock()\r\n\r\n\t_, ok := pder.sessions[sid]\r\n\treturn ok, nil\r\n}", "func (f *Features) canSession(ctx context.Context, adminDB *mongo.Database) {\n\tcmd := bson.D{\n\t\t{\n\t\t\tKey: \"replSetGetStatus\",\n\t\t\tValue: 1,\n\t\t},\n\t}\n\tvar result replInfo\n\terr := adminDB.RunCommand(ctx, cmd).Decode(&result)\n\tif err != nil {\n\t\t// assume we don't have session support on error..\n\t\t// error code 76 will be thrown if replSet is not enabled.\n\t\treturn\n\t}\n\n\tf.HasSessions = result.Ok\n}", "func (pder *MemProvider) SessionExist(sid string) bool {\n\tres, _ := (*session.MemProvider)(pder).SessionExist(context.Background(), sid)\n\treturn res\n}", "func (ctx *RequestContext) HasSession(key string) bool {\n\tvars := ctx.token.Claims[\"vars\"].(map[string]interface{})\n\t_, ok := vars[key]\n\treturn ok\n}", "func (o *StatusAzureServiceBus) HasSessions() bool {\n\tif o != nil && !IsNil(o.Sessions) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (this *ConnackMessage) SessionPresent() bool {\n\treturn this.sessionPresent\n}", "func (ca *NullClientAdapter) IsSessionPresent() bool {\n\treturn ca.SessionPresent\n}", "func (s *SideTwistHandler) hasImplantSession(guid string) bool {\n\t_, ok := s.commandNumbers[guid]\n\treturn ok\n}", "func SessionExists(SID string) bool {\n\t_, exists := SessionMap[SID]\n\treturn exists\n}", "func (o *VirtualSessionProvider) Exist(sid string) bool {\n\treturn true\n}", "func (session Session) Exists() bool {\n\treturn session.Key != \"\"\n}", "func (asr *sessionRegistry) Exists(sessionKey string) bool {\n\tasr.lock.RLock()\n\t_, exists := asr.registry[sessionKey]\n\tasr.lock.RUnlock()\n\treturn exists\n}", "func hasUserSession(userID uuid.UUID) bool {\n\t_, ok := userCache[userID]\n\treturn ok\n}", "func HasActiveSessions() bool {\n\treturn len(activeSessions) > 0\n}", "func IsSession(r *http.Request) bool {\n\tval := r.Context().Value(authSessionActiveKey)\n\tswitch val.(type) {\n\tcase bool:\n\t\treturn val.(bool)\n\tdefault:\n\t\treturn false\n\t}\n}", "func (me TxsdCounterSimpleContentExtensionType) IsSession() bool { return me.String() == \"session\" }", "func (pdr *ProviderMySQL) SessionExist(sid string) bool {\n\tc := pdr.connectInit()\n\tdefer func() {\n\t\terr := c.Close()\n\t\tif err != nil {\n\t\t\tsession.SLogger.Println(err)\n\t\t}\n\t}()\n\n\trow := c.QueryRow(\"select session_data from \"+TableName+\" where session_key=?\", sid)\n\tvar data []byte\n\terr := row.Scan(&data)\n\treturn err != sql.ErrNoRows\n}", "func (o *LoginRequest) HasSessionId() bool {\n\tif o != nil && o.SessionId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func SessionGet(token string) (*Session, bool) {\n\ts, ok := Sessions[token]\n\treturn s, ok\n}", "func (ds *DjangoSession) Exists() bool {\n\treturn ds._exists\n}", "func (o *EnvironmentUsageDto) HasSessionReplays() bool {\n\tif o != nil && o.SessionReplays != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (ss *SessionServiceImpl) Session(sessionID string) (*entities.Session, []error) {\n\treturn ss.sessionRepo.Session(sessionID)\n}", "func HasUserSession(userID uuid.UUID) bool {\n\tdefer mutex.Unlock()\n\tmutex.Lock()\n\n\treturn hasUserSession(userID)\n}", "func (s *userState) Sessions() map[string]string {\n\treturn s.sessions\n}", "func (ctx *Context) Session(key interface{}) interface{} {\r\n\treturn ctx.CruSession.Get(key)\r\n}", "func (o *KvmPolicyInventory) HasMaximumSessions() bool {\n\tif o != nil && o.MaximumSessions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (rp *Provider) SessionExist(ctx context.Context, sid string) (bool, error) {\n\tif ctx == nil {\n\t\tctx = context.TODO()\n\t}\n\treturn rp.c.Contains(ctx, sid), nil\n}", "func (sr *SessionGormRepo) Session(sessionID string) (*entity.Session, []error) {\n\tsession := entity.Session{}\n\terrs := sr.conn.Find(&session, \"uuid=?\", sessionID).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn &session, errs\n}", "func GoodSession(r *http.Request) bool {\n\tstore, err := pgstore.NewPGStore(os.Getenv(\"PGURL\"), key)\n\tcheck(err)\n\tdefer store.Close()\n\n\tsession, err := store.Get(r, \"scheduler-session\")\n\tcheck(err)\n\n\t// Check if user is authenticated\n\tif auth, ok := session.Values[\"authenticated\"].(bool); !ok || !auth {\n\t\tlog.Info(\"Stale session rejected: \", session)\n\t\treturn false\n\t}\n\tlog.Info(\"Session OK: \", session)\n\treturn true\n}", "func (r *SmscSessionRepository) ExistsById(ID string) bool {\n\treturn app.BuntDBInMemory.View(func(tx *buntdb.Tx) error {\n\t\t_, err := tx.Get(SMSC_SESSION_PREFIX + ID)\n\t\treturn err\n\t}) == nil\n}", "func (srv *server) Session(id string) Session {\n\tsrv.mu.Lock()\n\tdefer srv.mu.Unlock()\n\n\treturn srv.s[id]\n}", "func (gs *Service) IsSessionCreated(_ context.Context, req *api.IsSessionCreatedRequest, rsp *api.IsSessionCreatedResponse) error {\n\trsp.IsRunning = 2 // Stands for false.\n\tfor _, value := range gs.sessions {\n\t\tif value.currentGameID == req.GameId {\n\t\t\trsp.IsRunning = 1\n\t\t\trsp.SessionId = value.sessionID\n\t\t\trsp.ChatSocketAddress = value.chatAddress\n\t\t\trsp.SessionSocketAddress = value.sessionAddress\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (handler *IdentityProviderHandler) CheckSession(sessionID string, userAgent string, remoteAddr string) (r bool, err error) {\n\thandler.log.Printf(\"checkSession(%v, %v, %v)\", sessionID, userAgent, remoteAddr)\n\n\tsession, err := handler.SessionInteractor.Find(sessionID)\n\tif err != nil {\n\t\te := err.(*errs.Error)\n\t\treturn false, errorToServiceError(e)\n\t}\n\n\tif !session.Domain.Enabled || !session.User.Enabled {\n\t\te := services.NewUnauthorizedError()\n\t\te.Msg = \"Domain and/or user disabled\"\n\t\treturn false, e\n\t}\n\n\tif session.UserAgent != userAgent || session.RemoteAddr != remoteAddr {\n\t\te := services.NewNotFoundError()\n\t\te.Msg = \"Session not found\"\n\t\treturn false, e\n\t}\n\n\tif session.IsExpired() {\n\t\te := services.NewUnauthorizedError()\n\t\te.Msg = \"Session expired\"\n\t\treturn false, e\n\t}\n\n\terr = handler.SessionInteractor.Retain(*session)\n\tif err != nil {\n\t\te := err.(*errs.Error)\n\t\treturn false, errorToServiceError(e)\n\t}\n\n\treturn true, nil\n}", "func (st *State) Session(id string) *cache.Session {\n\tfor _, s := range st.Sessions() {\n\t\tif s.ID() == id {\n\t\t\treturn s\n\t\t}\n\t}\n\treturn nil\n}", "func (o *EnvironmentUsageDto) HasMobileSessions() bool {\n\tif o != nil && o.MobileSessions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (ss *SessionServiceImpl) Session(sessionID string) (*entity.Session, error) {\n\tsess, err := ss.sessionRepo.Session(sessionID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sess, err\n}", "func (pc *PFCPConnection) ForgetSession(seid SEID) bool {\n\tpc.Lock()\n\tdefer pc.Unlock()\n\t_, found := pc.sessions[seid]\n\tif !found {\n\t\treturn false\n\t}\n\tdelete(pc.sessions, seid)\n\treturn true\n}", "func (sm *SessionMap) Get(sessionID string) (*Session, bool) {\n\tsm.Lock.RLock()\n\tdefer sm.Lock.RUnlock()\n\n\tsession, ok := sm.Sessions[sessionID]\n\treturn session, ok\n}", "func (p *PostgresProvider) Exist(sid string) bool {\n\tvar data []byte\n\terr := p.c.QueryRow(\"SELECT data FROM session WHERE key=$1\", sid).Scan(&data)\n\tif err != nil && err != sql.ErrNoRows {\n\t\tpanic(\"session/postgres: error checking existence: \" + err.Error())\n\t}\n\treturn err != sql.ErrNoRows\n}", "func (w *Worker) Session() *Session {\n\tw.mu.RLock()\n\tdefer w.mu.RUnlock()\n\n\treturn w.s\n}", "func (_Contract *ContractSession) Exists(_tokenId *big.Int) (bool, error) {\n\treturn _Contract.Contract.Exists(&_Contract.CallOpts, _tokenId)\n}", "func (service *SessionService) Session(sessionID string) (*entity.Session, error) {\n\tsess, err := service.conn.Session(sessionID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sess, err\n}", "func (pder *MemProvider) SessionAll() int {\n\treturn (*session.MemProvider)(pder).SessionAll(context.Background())\n}", "func TestSession_AsSession(t *testing.T) { var _ Session = newSession(nil, \"id\", 0, 0) }", "func (s *Session) Exists(q db.Queryable) (bool, error) {\n\tif s == nil {\n\t\treturn false, apperror.NewServerError(\"session is nil\")\n\t}\n\n\tif s.UserID == \"\" {\n\t\treturn false, apperror.NewServerError(\"user id required\")\n\t}\n\n\t// Deleted sessions should be explicitly checked\n\tif s.DeletedAt != nil {\n\t\treturn false, nil\n\t}\n\n\tvar count int\n\tstmt := `SELECT count(1)\n\t\t\t\t\tFROM user_sessions\n\t\t\t\t\tWHERE deleted_at IS NULL\n\t\t\t\t\t\tAND id = $1\n\t\t\t\t\t\tAND user_id = $2`\n\terr := q.Get(&count, stmt, s.ID, s.UserID)\n\treturn (count > 0), err\n}", "func (o *SmscSession) HasRemoteAddr() bool {\n\tif o != nil && o.RemoteAddr != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m *MemorySessionStore) Check(sessionID string) (status bool, err error) {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\tif t, ok := m.store[sessionID]; ok {\n\t\tif t.After(time.Now()) {\n\t\t\treturn true, nil\n\t\t}\n\t\tdelete(m.store, sessionID)\n\t}\n\treturn false, nil\n}", "func (m mongod) Session() *mgo.Session {\n\treturn m.session\n}", "func (db *Db) Session() *gocql.Session {\n\treturn db.session\n}", "func session(w http.ResponseWriter, r *http.Request) (sess data.Session, err error) {\n\t\n\t// リクエストからクッキーを取得\n\tcookie, err := r.Cookie(\"_cookie\")\n\t// ユーザーがログインしているならクッキーがあるはず\n\tif err == nil {\n\t\t// データベースを検索\n\t\t// ユニークIDが存在してるか?\n\t\tsess = data.Session{ Uuid: cookie.Value }\n\t\t\n\t\tif ok, _ := sess.Check(); !ok {\n\t\t\terr = errors.New(\"Invalid session\")\n\t\t}\n\t}\n\treturn\n}", "func (mgr *MemorySessionManager) Session(sid string) (Session, error) {\n\tmgr.lock.RLock()\n\tif s, ok := mgr.sessions[sid]; ok {\n\t\ts.createdAt = time.Now()\n\t\tmgr.lock.RUnlock()\n\t\treturn s, nil\n\t}\n\tmgr.lock.RUnlock()\n\treturn nil, fmt.Errorf(\"Can not retrieve session with id %s\", sid)\n}", "func NewSession() Session {\n\treturn Session{\n\t\tID: utils.NewBytes32ID(),\n\t\tLastUsed: Time{Time: time.Now()},\n\t}\n}", "func (p *CharacterCreateCommandPayload) Session() commands.DiscordConnector {\n\treturn p.session\n}", "func (irc *Bot) hijackSession() bool {\n\treturn false\n}", "func SessionCheck(writer http.ResponseWriter, request *http.Request) (sess Session, err error) {\n\tcookie, err := request.Cookie(\"_cookie\")\n\tif err == nil {\n\t\tsess = Session{Uuid: cookie.Value}\n\t\tif ok, _ := sess.Valid(); ok {\n\t\t\terr = errors.New(\"invalid session\")\n\t\t}\n\t}\n\treturn\n}", "func (s *Service) CheckIfPersonHaveSession(c context.Context, sessionID ulid.ULID, personID ulid.ULID) (*Session, error) {\n\treturn &Session{}, nil\n}", "func VerifySession(sid string) bool {\n\tvar session Session\n\tif err := cache.Get(SessionId+SESSION_KEY, &session); err != nil {\n\t\treturn false\n\t}\n\treturn sid == session.Id\n}", "func (s Store) getFreshSession() *mgo.Session {\n\treturn s.Session.Copy()\n}", "func (_DelegateProfile *DelegateProfileSession) Registered(_addr common.Address) (bool, error) {\n\treturn _DelegateProfile.Contract.Registered(&_DelegateProfile.CallOpts, _addr)\n}", "func (s Session) Session() string {\n\treturn s.session\n}", "func (rc *Ctx) Session() *Session {\n\treturn rc.session\n}", "func Session() HandlerFunc {\n\treturn func(c *Context) {\n\t\tif sessionManager == nil {\n\t\t\tpanic(\"please call gow.InitSession()\")\n\t\t}\n\t\tsessionID = sessionManager.Start(c.Writer, c.Req)\n\t\tsessionManager.Extension(c.Writer, c.Req)\n\t\tc.Next()\n\t}\n}", "func (mconn *MConn) Session() (*MSession, error) {\n\t// Start race (waiting-for-binding vs. timeout)\n\tc := make(chan struct{})\n\tgo func() {\n\t\tdefer close(c)\n\t\tmconn.bindWaitGroup.Wait()\n\t\t//TODO: ping to prolong session life? Because session can be aborted\n\t}()\n\tselect {\n\tcase <-c:\n\t\treturn mconn.session, nil\n\tcase <-time.After(TIMEOUT_SESSION_BINDING):\n\t\treturn nil, fmt.Errorf(\"No Session: session binding timeout\")\n\t}\n}", "func NewSession(id uint64) *Session {\n\tfactory := service.NewLocalServiceFactory(repository.NewInMemoryRepositoryFactory())\n\n\tscheduableSrv := factory.ScheduableService()\n\tdepSrv := factory.DependencyService()\n\n\treturn &Session{id: id, DepSrv: depSrv, ScheduableSrv: scheduableSrv, running: true}\n}", "func Session(w http.ResponseWriter, r *http.Request) (models.Session, error) {\n\tvar s models.Session\n\tcookie, err := r.Cookie(\"_cookie\")\n\tif err != nil {\n\t\tfmt.Printf(\"%s\", err.Error())\n\t\treturn s, err\n\t}\n\ts = models.Session{UUID: cookie.Value}\n\tif ok, _ := s.Check(); !ok {\n\t\treturn s, errors.New(\"Invalid session. \")\n\t}\n\treturn s, nil\n}", "func (d *DefaultContext) Session() *Session {\n\treturn d.session\n}", "func (m NoTradingSessions) HasTradingSessionID() bool {\n\treturn m.Has(tag.TradingSessionID)\n}", "func (s *Sessions) IsExist(r *http.Request) bool {\n\t// Getting cookie\n\tcookie, err := r.Cookie(cfg.SessionIDKey)\n\t// No sessionID in request's cookies.\n\tif err != nil {\n\t\treturn false\n\t}\n\tsessionID := cookie.Value\n\t// Atomic Check if sssion with given id contains in sessions map\n\ts.RLock()\n\t_, ok := s.sessions[sessionID]\n\ts.RUnlock()\n\n\treturn ok\n}", "func (clt *client) Session() *webwire.Session {\n\tclt.sessionLock.RLock()\n\tif clt.session == nil {\n\t\tclt.sessionLock.RUnlock()\n\t\treturn nil\n\t}\n\tclone := &webwire.Session{\n\t\tKey: clt.session.Key,\n\t\tCreation: clt.session.Creation,\n\t}\n\tif clt.session.Info != nil {\n\t\tclone.Info = clt.session.Info.Copy()\n\t}\n\tclt.sessionLock.RUnlock()\n\treturn clone\n}", "func (m NoMDEntries) HasTradingSessionID() bool {\n\treturn m.Has(tag.TradingSessionID)\n}", "func (m NoTradingSessions) HasTradingSessionSubID() bool {\n\treturn m.Has(tag.TradingSessionSubID)\n}", "func isAuthSession(r *http.Request, w http.ResponseWriter) bool {\n\tloggedIn, loggedInMat := loggedIn(r)\n\tloggedInUser, err := user.FromMatrikel(loggedInMat)\n\n\tif !loggedIn || loggedInUser.Usertype == user.STUDENT || err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "func (m *memoryStorage) sessionChecker() {\n\tfor {\n\t\tm.mutex.Lock()\n\t\tfor sessionID, v := range m.sessions {\n\t\t\tif v.expires < time.Now().Unix() {\n\t\t\t\tdelete(m.sessions, sessionID)\n\t\t\t}\n\t\t}\n\t\tfor nonce, expires := range m.nonces {\n\t\t\tif time.Now().After(expires) {\n\t\t\t\tdelete(m.nonces, nonce)\n\t\t\t}\n\t\t}\n\t\tm.mutex.Unlock()\n\t\ttime.Sleep(sessionCheckInterval * time.Second)\n\t}\n}", "func CheckRunningSession(userID int64) bool {\n\tif err := GetSessionByUserID(&Session{}, userID); err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "func (s *Stream) Session() *Session {\n\treturn s.session\n}", "func (rp *Provider) SessionAll(ctx context.Context) int {\n\treturn 0\n}", "func (input *BeegoInput) Session(key interface{}) interface{} {\n\treturn input.CruSession.Get(nil, key)\n}", "func (e *engine) loadSession(ctx *Context) {\n\tif AppSessionManager().IsStateful() {\n\t\tctx.subject.Session = AppSessionManager().GetSession(ctx.Req.Unwrap())\n\t}\n}", "func (st *MemSessionStore) SessionID() string {\n\treturn st.sid\n}", "func (pc *PFCPConnection) ForgetSession(seid SEID) bool {\n\tpc.Lock()\n\tdefer pc.Unlock()\n\treturn pc.forgetSessionUnlocked(seid)\n}", "func (c *Config) Session() (*Session, diag.Diagnostics) {\n\tsess := &Session{\n\t\tjunosIP: c.junosIP,\n\t\tjunosPort: c.junosPort,\n\t\tjunosUserName: c.junosUserName,\n\t\tjunosPassword: c.junosPassword,\n\t\tjunosSSHKeyPEM: c.junosSSHKeyPEM,\n\t\tjunosSSHKeyFile: c.junosSSHKeyFile,\n\t\tjunosKeyPass: c.junosKeyPass,\n\t\tjunosGroupIntDel: c.junosGroupIntDel,\n\t\tjunosLogFile: c.junosDebugNetconfLogPath,\n\t\tjunosSleep: c.junosCmdSleepLock,\n\t\tjunosSleepShort: c.junosCmdSleepShort,\n\t}\n\n\treturn sess, nil\n}", "func (session *Session) IsValid() error {\n\tif err := mongo.Execute(\"monotonic\", SessionCollectionName(session.TenantID),\n\t\tfunc(collection *mgo.Collection) error {\n\t\t\tselector := bson.M{\n\t\t\t\t\"token\": session.Token,\n\t\t\t}\n\t\t\treturn collection.Find(selector).One(session)\n\t\t}); err != nil {\n\t\treturn fmt.Errorf(\"Error[%s] while finding session with token[%s]\", err, session.Token)\n\t}\n\t// if session.Expired() {\n\t// \treturn fmt.Errorf(\"Session expired\")\n\t// }\n\t// extend expired Time\n\tselector := bson.M{\n\t\t\"_id\": session.ID,\n\t}\n\tupdator := bson.M{\n\t\t\"$set\": bson.M{\n\t\t\t\"e_at\": time.Now().Add(time.Duration(1) * time.Hour),\n\t\t\t\"u_at\": time.Now(),\n\t\t},\n\t}\n\treturn session.Update(session.TenantID, selector, updator)\n}", "func IsAuthenticatedQuick(socketID uuid.UUID) bool {\n\tdefer mutex.Unlock()\n\tmutex.Lock()\n\n\t_, ok := sessionCache[socketID]\n\treturn ok\n}", "func (o *SessionDevice) HasUserAgent() bool {\n\tif o != nil && o.UserAgent != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func addSession(s *sessions.Session, triggerEvent bool) {\n\t// Remove the session if closed from the map.\n\ts.OnceClose(removeSession)\n\n\t// Lock the mutex.\n\tactiveSessionsMutex.Lock()\n\tdefer activeSessionsMutex.Unlock()\n\n\t// Add the session to the map.\n\tactiveSessions[s.SessionID()] = s\n\n\tif triggerEvent {\n\t\t// Trigger the event.\n\t\ttriggerOnNewSession(s)\n\t}\n}", "func (pder *MemProvider) SessionInit(maxlifetime int64, savePath string) error {\n\treturn (*session.MemProvider)(pder).SessionInit(context.Background(), maxlifetime, savePath)\n}", "func GetSession(token string) (*Session, bool) {\n\tconst q = `SELECT * FROM Sessions WHERE token=$1 AND expires > now()`\n\n\tsession := &Session{}\n\terr := database.Get(session, q, token)\n\tif err != nil && err != sql.ErrNoRows {\n\t\tpanic(err)\n\t}\n\n\treturn session, err == nil\n}", "func session(rp core.Roundtrip) (sess model.Session, err error) {\n\tcookie := rp.GetCookie(\"_cookie\")\n\tif err == nil {\n\t\tsess = model.Session{Uuid: cookie}\n\t\tif ok, _ := sess.Check(); !ok {\n\t\t\terr = errors.New(\"Invalid session\")\n\t\t}\n\t}\n\treturn\n}", "func Get(ctx context.Context) *Session {\n\t// TODO maybe check this\n\treturn ctx.Value(sessionContextKey{}).(*Session)\n}", "func (c *ConsulClient) IsRegistered(ctx context.Context, sessionID string) bool {\n\tregistryOperationCount.WithLabelValues(env, \"IsRegistered\").Inc()\n\n\tstartTime := time.Now()\n\tdefer func() {\n\t\tregistryOperationTimeTaken.WithLabelValues(env, \"IsRegistered\").Observe(time.Now().Sub(startTime).Seconds())\n\t}()\n\n\tsession, _, err := c.client.Session().Info(sessionID, nil)\n\tif err != nil {\n\t\tlogger.Ctx(ctx).Errorw(\"failed to get session info\", \"error\", err.Error())\n\t\treturn false\n\t}\n\n\treturn session != nil\n}", "func (c _StoreImpl) Session_ById(Id int) (*Session, bool) {\n\to, ok := RowCacheIndex.Get(\"Session_Id:\" + fmt.Sprintf(\"%v\", Id))\n\tif ok {\n\t\tif obj, ok := o.(*Session); ok {\n\t\t\treturn obj, true\n\t\t}\n\t}\n\n\trow, err := NewSession_Selector().Id_Eq(Id).GetRow(base.DB)\n\tif err == nil {\n\t\tRowCacheIndex.Set(\"Session_Id:\"+fmt.Sprintf(\"%v\", row.Id), row, 0)\n\t\treturn row, true\n\t}\n\n\tXOLogErr(err)\n\treturn nil, false\n}", "func Session(c *gin.Context) {\n\tc.JSON(http.StatusOK, domain.GamesMap)\n}", "func (_FinalizableCrowdsaleImpl *FinalizableCrowdsaleImplSession) HasClosed() (bool, error) {\n\treturn _FinalizableCrowdsaleImpl.Contract.HasClosed(&_FinalizableCrowdsaleImpl.CallOpts)\n}", "func (p *MongodbProvider) Exist(sid string) bool {\n\tnum, err := p.c.Find(bson.M{\"key\": sid}).Count()\n\tif err != nil {\n\t\tpanic(\"session/mgoSession: error checking existence: \" + err.Error())\n\t}\n\treturn num != 0\n}", "func (sp *SessionProxy) GetSession() (session Session) {\n\tsp.lock.RLock()\n\tsession = sp.session\n\tsp.lock.RUnlock()\n\treturn\n}", "func (pder *MemProvider) SessionGC() {\n\t(*session.MemProvider)(pder).SessionGC(context.Background())\n}", "func (_Lmc *LmcSession) HasStakingStarted() (bool, error) {\n\treturn _Lmc.Contract.HasStakingStarted(&_Lmc.CallOpts)\n}", "func getSession(r *http.Request) (*sessions.Session, error) {\n\tsession, err := store.Get(r, sessionName)\n\tif err != nil {\n\t\tif session.IsNew {\n\t\t\tglog.V(1).Infof(\"ignoring initial session fetch error since session IsNew: %v\\n\", err)\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"error fetching session: %v\", err)\n\t\t}\n\t}\n\treturn session, nil\n}", "func VerifySession(key string, user int) bool {\n\tvar sessions []Session\n\tdb.Where(\"user is ?\", user).Find(&sessions)\n\tfor i := range sessions {\n\t\tif sessions[i].Key == key {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (s *State) MarkSession(req *rpc.RemainRequest, now time.Time) (ok bool) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tsessionID := req.Session.SessionId\n\n\tif sess, ok := s.sessions[sessionID]; ok {\n\t\tsess.SetLastMarked(now)\n\t\tif req.ApiKey != \"\" {\n\t\t\tif client, ok := s.clients.Load(sessionID); ok {\n\t\t\t\tclient.ApiKey = req.ApiKey\n\t\t\t\ts.clients.Store(sessionID, client)\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\n\treturn false\n}" ]
[ "0.73276985", "0.6829984", "0.663619", "0.66340333", "0.6624183", "0.66232616", "0.66033375", "0.65276873", "0.6525407", "0.6486037", "0.6478318", "0.6466748", "0.64379466", "0.6426397", "0.63889796", "0.6324362", "0.63059235", "0.6290662", "0.623621", "0.6206161", "0.6145826", "0.60492903", "0.604686", "0.6009767", "0.5994057", "0.59537107", "0.59120935", "0.5899927", "0.5887429", "0.5859137", "0.58505917", "0.5845827", "0.5845018", "0.58444893", "0.58395666", "0.58375734", "0.5833557", "0.5824095", "0.5810919", "0.58092326", "0.578658", "0.57701623", "0.576708", "0.5743296", "0.5741098", "0.57397825", "0.57375896", "0.57368535", "0.5728702", "0.5727856", "0.57264316", "0.57221794", "0.57143945", "0.57139426", "0.5708952", "0.57023615", "0.5691356", "0.56900615", "0.568958", "0.56877244", "0.56873816", "0.5681202", "0.56782955", "0.5669477", "0.56694275", "0.5662315", "0.5648669", "0.5647297", "0.5630967", "0.56274146", "0.5626108", "0.56189966", "0.56121725", "0.5607199", "0.5603774", "0.56023324", "0.55980414", "0.5583701", "0.5547827", "0.5546138", "0.5545076", "0.5536357", "0.5526894", "0.55265695", "0.55111", "0.5510963", "0.5508394", "0.5505777", "0.5501209", "0.54925615", "0.54891175", "0.54872507", "0.54861313", "0.5470696", "0.54658234", "0.54603684", "0.5455042", "0.5454483", "0.5448433", "0.5441484" ]
0.7448208
0
GetPrivateKeyEntry implemented in memory.
func (ms *MemStore) GetPrivateKeyEntry(pubKeyHash string) (*uid.KeyEntry, error) { ke, ok := ms.privateKeyEntryMap[pubKeyHash] if !ok { return nil, log.Error(session.ErrNoKeyEntry) } return ke, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (a *Account) GetPrivateKey() crypto.PrivateKey { return a.key }", "func (a *Account) GetPrivateKey() crypto.PrivateKey {\n\treturn a.key\n}", "func (w *Whisper) GetPrivateKey(id string) (*ecdsa.PrivateKey, error) {\n\tw.keyMu.RLock()\n\tdefer w.keyMu.RUnlock()\n\tkey := w.privateKeys[id]\n\tif key == nil {\n\t\treturn nil, fmt.Errorf(\"invalid id\")\n\t}\n\treturn key, nil\n}", "func GetPrivateKey() ed25519.PrivateKey {\n\tkey, _ := DecodePrivateKey(privateKey)\n\treturn key\n}", "func (u user) GetPrivateKey() crypto.PrivateKey {\n\treturn u.key\n}", "func (c Certificate) GetPrivateKey() []byte {\n\treturn c.privateKey\n}", "func GetPrivateKey(passphrase string, address string) (string, error) {\n\tkeys, err := GetPublicPrivateKey(passphrase, address)\n\n\treturn keys.PrivateKey, err\n}", "func (d *identityManager) PrivateKey() []byte {\n\treturn d.key.PrivateKey\n}", "func (k *key) getPrivateKey() (*ecdsa.PrivateKey, error) {\n\tby, err := base64.StdEncoding.DecodeString(k.PrivateKeyB64)\n\tif err != nil {\n\t\treturn (*ecdsa.PrivateKey)(nil), err\n\t}\n\n\tblock, _ := pem.Decode([]byte(by))\n\ttempKey, err := x509.ParseECPrivateKey(block.Bytes)\n\tif err != nil {\n\t\treturn (*ecdsa.PrivateKey)(nil), err\n\t}\n\n\treturn tempKey, nil\n}", "func GetPrivateKey(address, password, folderPath string) (*ecdsa.PrivateKey, error) {\n\n\t// Get the file that contains the private key\n\tfile, err := getUTCFile(address[2:], folderPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Read the file\n\tjsonBytes, err := ioutil.ReadFile(file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get the private key\n\tkeyWrapper, err := keystore.DecryptKey(jsonBytes, password)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn keyWrapper.PrivateKey, nil\n}", "func (o *PipelineSshKeyPairAllOf) GetPrivateKey() string {\n\tif o == nil || o.PrivateKey == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.PrivateKey\n}", "func (decryptor *PgDecryptor) GetPrivateKey() (*keys.PrivateKey, error) {\n\tif decryptor.IsWithZone() {\n\t\treturn decryptor.keyStore.GetZonePrivateKey(decryptor.GetMatchedZoneID())\n\t}\n\treturn decryptor.keyStore.GetServerDecryptionPrivateKey(decryptor.clientID)\n}", "func (grc *GitRemoteConfiguration) GetPrivateKey() *string {\n\treturn grc.PrivateKey\n}", "func (e *Domain) Private() *PrivateKey {\n\tif e.ClearPrivateKey == nil {\n\t\te.decrypt_privatekey()\n\t}\n\treturn e.ClearPrivateKey\n}", "func (p *PrivateKey) PrivateKey() *ecdsa.PrivateKey {\n\treturn p.privateKey\n}", "func (k *KeyPair) GetPrivateKey() p2pCrypto.PrivKey {\n\treturn k.privKey\n}", "func (rm *ReconstructingMember) individualPrivateKey() *big.Int {\n\treturn rm.secretCoefficients[0]\n}", "func (ms *MemStore) AddPrivateKeyEntry(ke *uid.KeyEntry) {\n\tms.privateKeyEntryMap[ke.HASH] = ke\n}", "func (o SslCertificateSelfManagedSslCertificateOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SslCertificateSelfManagedSslCertificate) *string { return v.PrivateKey }).(pulumi.StringPtrOutput)\n}", "func (w *Wallet) GetPrivateKey() string {\n\treturn hex.EncodeToString(w.PrivateKey.D.Bytes())\n}", "func GetKey(t *testing.T) []byte {\n\tt.Helper()\n\n\tk, _ := GeneratePrivateKey()\n\treturn k.Data[:]\n}", "func GetPrivateKey(bitSize int) *rsa.PrivateKey {\n\tfilePath := \"private.pem\"\n\n\tif _, err := os.Stat(filePath); os.IsNotExist(err) {\n\t\tprivateKey, err := GeneratePrivateKey(bitSize)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"could not generate private key, %v\", err)\n\t\t}\n\n\t\tEncodePrivateKeyToPEM(filePath, privateKey)\n\t\treturn privateKey\n\t}\n\treturn DecodePrivateKeyFromFile(filePath)\n\n}", "func GetPrivateKey() (*ecdsa.PrivateKey, error) {\n\t// Opens the wallet\n\tfile, err := os.Open(\"aurum_wallet.json\")\n\tif err != nil {\n\t\treturn nil, errors.New(\"Failed to open wallet\")\n\t}\n\tdefer file.Close()\n\n\t// Reads the file and stores the data into a byte slice\n\tdata, err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Failed to read wallet\")\n\t}\n\n\t// Json struct for storing the private key from the json file\n\ttype jsonStruct struct {\n\t\tPrivateKey string\n\t}\n\n\t// Parse the data from the json file into a jsonStruct\n\tvar j jsonStruct\n\terr = json.Unmarshal(data, &j)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Decodes the private key from the jsonStruct\n\tpemEncoded, _ := hex.DecodeString(j.PrivateKey)\n\tprivateKey, err := privatekey.Decode(pemEncoded)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn privateKey, nil\n}", "func (o ProviderOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Provider) pulumi.StringPtrOutput { return v.PrivateKey }).(pulumi.StringPtrOutput)\n}", "func (s *Service) GetPrivateKey(keyID string) (crypto.PrivateKey, error) {\n\tprivateKey, ok := s.keys[keyID]\n\tif !ok {\n\t\ts.log.Error(\"The specified key was not found\", \"keyID\", keyID)\n\t\treturn nil, signingkeys.ErrSigningKeyNotFound.Errorf(\"The specified key was not found: %s\", keyID)\n\t}\n\n\treturn privateKey, nil\n}", "func (c ClientSettings) RetrievalPrivateKey() *fcrcrypto.KeyPair {\n\treturn c.retrievalPrivateKey\n}", "func (cfg *Config) PrivateKey() hotstuff.PrivateKey {\n\treturn cfg.privKey\n}", "func (c *ConfigurationData) GetServiceAccountPrivateKey() ([]byte, string) {\n\treturn []byte(c.v.GetString(varServiceAccountPrivateKey)), c.v.GetString(varServiceAccountPrivateKeyID)\n}", "func (u *walletIdentity) PrivateKey() core.Key {\n\treturn u.privateKey\n}", "func (w *XPubWallet) GetEntry(a cipher.Address) (Entry, bool) {\n\treturn w.Entries.get(a)\n}", "func (o SslCertificateSelfManagedSslCertificatePtrOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SslCertificateSelfManagedSslCertificate) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.PrivateKey\n\t}).(pulumi.StringPtrOutput)\n}", "func (obj *bucket) PrivateKey() encryption.PrivateKey {\n\treturn obj.pk\n}", "func GetPrivateKey() (*ecdsa.PrivateKey, error) {\n\treturn crypto.HexToECDSA(\"1944dae12efeb1b1107dc1f3c7a459a01d865fff1c4b43a26f1755876aa1b820\")\n}", "func (handler *NonceSignHandler) GetPrivateKey() *ecdsa.PrivateKey {\n\treturn handler.privateKey\n}", "func getPrivateKey(data []byte) ([]byte, error) {\n\tvar der []byte\n\tvar derKey []byte\n\tfor {\n\t\tpemBlock, rest := pem.Decode(data)\n\t\tif pemBlock == nil {\n\t\t\tbreak\n\t\t}\n\t\tif pemBlock.Type != certType {\n\t\t\tder = pemBlock.Bytes\n\t\t}\n\t\tdata = rest\n\t}\n\n\tif key, err := x509.ParsePKCS1PrivateKey(der); err == nil {\n\t\tderKey = x509.MarshalPKCS1PrivateKey(key)\n\t}\n\n\tif key, err := x509.ParsePKCS8PrivateKey(der); err == nil {\n\t\tswitch key := key.(type) {\n\t\tcase *rsa.PrivateKey:\n\t\t\tderKey = x509.MarshalPKCS1PrivateKey(key)\n\t\tcase *ecdsa.PrivateKey:\n\t\t\tderKey, err = x509.MarshalECPrivateKey(key)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unknown private key type found while getting key. Only rsa and ecdsa are supported\")\n\t\t}\n\t}\n\tif key, err := x509.ParseECPrivateKey(der); err == nil {\n\t\tderKey, err = x509.MarshalECPrivateKey(key)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tblock := &pem.Block{\n\t\tType: privateKeyType,\n\t\tBytes: derKey,\n\t}\n\n\treturn pem.EncodeToMemory(block), nil\n}", "func (k *EdX25519Key) PrivateKey() *[ed25519.PrivateKeySize]byte {\n\treturn k.privateKey\n}", "func (addr *Address) PrivateKey() *btcec.PrivateKey {\n\tpk := addr.calcDoubleHash()[:32]\n\tprivKey, _ := btcec.PrivKeyFromBytes(btcec.S256(), pk)\n\treturn privKey\n}", "func GetAnotherPrivateKey() (*ecdsa.PrivateKey, error) {\n\treturn crypto.HexToECDSA(\"a05b7b4580376959940f3bbdb84dab4780c49e97f47c1e8792c12963552931b3\")\n}", "func (serv *ExchangeServer) GetAddrPrivKey(cp, addr string) (string, error) {\n\t_, key, err := serv.wallets.GetKeypair(cp, addr)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn key, nil\n}", "func (o SslCertificateSelfManagedSslCertificateResponsePtrOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SslCertificateSelfManagedSslCertificateResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.PrivateKey\n\t}).(pulumi.StringPtrOutput)\n}", "func (c *ConfigurationData) GetUserAccountPrivateKey() ([]byte, string) {\n\treturn []byte(c.v.GetString(varUserAccountPrivateKey)), c.v.GetString(varUserAccountPrivateKeyID)\n}", "func (km *Keystore) Get(name string) (ci.PrivKey, error) {\n\tif err := validateName(name); err != nil {\n\t\treturn nil, err\n\t}\n\tif has, err := km.Has(name); err != nil {\n\t\treturn nil, err\n\t} else if !has {\n\t\treturn nil, errors.New(ErrNoSuchKey)\n\t}\n\tencryptedPKBytes, err := km.ds.Get(ds.NewKey(name))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treader := bytes.NewReader(encryptedPKBytes)\n\tpkBytes, err := km.em.Decrypt(reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ci.UnmarshalPrivateKey(pkBytes)\n}", "func (*FactorySECP256K1R) ToPrivateKey(b []byte) (PrivateKey, error) {\n\treturn &PrivateKeySECP256K1R{\n\t\tsk: secp256k1.PrivKeyFromBytes(b),\n\t\tbytes: b,\n\t}, nil\n}", "func (e *EtcdCert) PrivateKeyPath() string { return path.Join(e.BaseDir, etcdKeyFileName) }", "func GetPrivateKey(loader KeyLoader) (*rsa.PrivateKey, error) {\n\tif loader == nil {\n\t\treturn nil, errors.New(\"no loader\")\n\t}\n\n\tdata, err := loader.GetBytes()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tprivPem, _ := pem.Decode(data)\n\tif privPem.Type != \"RSA PRIVATE KEY\" {\n\t\treturn nil, errors.New(\"incorrect pem type: \" + privPem.Type)\n\t}\n\n\tvar parsedKey interface{}\n\tif parsedKey, err = x509.ParsePKCS1PrivateKey(privPem.Bytes); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif privateKey, ok := parsedKey.(*rsa.PrivateKey); !ok {\n\t\treturn nil, errors.New(\"failed convert parsed key to private key\")\n\t} else {\n\t\treturn privateKey, nil\n\t}\n}", "func (o SslCertOutput) PrivateKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SslCert) pulumi.StringOutput { return v.PrivateKey }).(pulumi.StringOutput)\n}", "func (kp *MockKeyProvider) GetPrivateKey() (crypto.PrivateKey, error) {\n\treturn kp.PrivateKey, kp.Err\n}", "func (o SslCertificateOutput) PrivateKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SslCertificate) pulumi.StringOutput { return v.PrivateKey }).(pulumi.StringOutput)\n}", "func (c *Client) GetEntry(ctx context.Context, userID, appID string, opts ...grpc.CallOption) ([]byte, *trillian.SignedMapRoot, error) {\n\te, err := c.VerifiedGetEntry(ctx, appID, userID)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\t// Empty case.\n\tif e.GetCommitted() == nil {\n\t\treturn nil, e.GetSmr(), nil\n\t}\n\n\treturn e.GetCommitted().GetData(), e.GetSmr(), nil\n}", "func (o *TppCertificateParams) GetPrivateKey() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.PrivateKey\n}", "func (sc Credential) getPrivateKey(privateKeyPath string, privateKeyPassphrase string) (ssh.AuthMethod, error) {\n\tif !fileExist(privateKeyPath) {\n\t\tprivateKeyPath = filepath.Join(os.Getenv(\"HOME\"), \".ssh/id_rsa\")\n\t}\n\n\tkey, err := ioutil.ReadFile(privateKeyPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to parse private key: %v\", err)\n\t}\n\n\tvar signer ssh.Signer\n\tif privateKeyPassphrase != \"\" {\n\t\tsigner, err = ssh.ParsePrivateKeyWithPassphrase(key, []byte(privateKeyPassphrase))\n\t} else {\n\t\tsigner, err = ssh.ParsePrivateKey(key)\n\t}\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parse private key failed: %v\", err)\n\t}\n\n\treturn ssh.PublicKeys(signer), nil\n}", "func getPrivateKeyHandle(p *pkcs11.Ctx, session pkcs11.SessionHandle, keyID []byte) (pkcs11.ObjectHandle, error) {\n\tfindTemplate := []*pkcs11.Attribute{\n\t\tpkcs11.NewAttribute(pkcs11.CKA_TOKEN, true),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_ID, keyID),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_PRIVATE_KEY),\n\t}\n\tif err := p.FindObjectsInit(session, findTemplate); err != nil {\n\t\tlogrus.Debugf(\"Failed to init: %s\", err.Error())\n\t\treturn 0, err\n\t}\n\tobj, _, err := p.FindObjects(session, 1)\n\tif err != nil {\n\t\tlogrus.Debugf(\"Failed to find objects: %v\", err)\n\t\treturn 0, err\n\t}\n\tif err := p.FindObjectsFinal(session); err != nil {\n\t\tlogrus.Debugf(\"Failed to finalize: %s\", err.Error())\n\t\treturn 0, err\n\t}\n\tif len(obj) != 1 {\n\t\tlogrus.Debugf(\"should have found one object\")\n\t\treturn 0, errors.New(\"no matching keys found inside of Luna\")\n\t}\n\treturn obj[0], nil\n}", "func GetPrivateKeyFromFile(keyFile string) (*ecdsa.PrivateKey, error) {\n\tkeyPEMBlock, err := os.ReadFile(keyFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t//Following logic is derived from steps in\n\t//https://golang.org/src/crypto/tls/tls.go:X509KeyPair()\n\tvar keyDERBlock *pem.Block\n\tvar skippedBlockTypes []string\n\tfor {\n\t\tkeyDERBlock, keyPEMBlock = pem.Decode(keyPEMBlock)\n\t\tif keyDERBlock == nil {\n\t\t\tif len(skippedBlockTypes) == 0 {\n\t\t\t\treturn nil, errors.New(\"Failed to find any PEM data in key input\")\n\t\t\t}\n\t\t\tif len(skippedBlockTypes) == 1 && skippedBlockTypes[0] == \"CERTIFICATE\" {\n\t\t\t\treturn nil, errors.New(\"Got a certificate instead of key\")\n\t\t\t}\n\t\t\treturn nil, errors.New(\"No PEM block found with type PRIVATE KEY\")\n\t\t}\n\t\tif keyDERBlock.Type == \"PRIVATE KEY\" ||\n\t\t\tstrings.HasSuffix(keyDERBlock.Type, \"EC PRIVATE KEY\") {\n\t\t\tbreak\n\t\t}\n\t\tskippedBlockTypes = append(skippedBlockTypes, keyDERBlock.Type)\n\t}\n\tif key, err := x509.ParsePKCS8PrivateKey(keyDERBlock.Bytes); err == nil {\n\t\tvar pkey *ecdsa.PrivateKey\n\t\tvar ok bool\n\t\tif pkey, ok = key.(*ecdsa.PrivateKey); !ok {\n\t\t\treturn nil, errors.New(\"Private key is not ecdsa type\")\n\t\t}\n\t\treturn pkey, nil\n\t}\n\tif key, err := x509.ParseECPrivateKey(keyDERBlock.Bytes); err == nil {\n\t\treturn key, nil\n\t} else {\n\t\treturn nil, err\n\t}\n}", "func (o SslCertificateSelfManagedSslCertificateResponseOutput) PrivateKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SslCertificateSelfManagedSslCertificateResponse) string { return v.PrivateKey }).(pulumi.StringOutput)\n}", "func (c CertificateKey) Private() string {\n\treturn c.private\n}", "func PrivateKeyFile(usage Usage, version scrypto.KeyVersion) string {\n\treturn fmt.Sprintf(\"%s-v%d.key\", usage, version)\n}", "func (kt KeyType) PrivateKey() string {\n\treturn kt.KeyBaseName\n}", "func GetPrivateKeyByPath(hdKey *hdkeychain.ExtendedKey, chain, num uint32) (*bsvec.PrivateKey, error) {\r\n\r\n\t// Get the child key from the num & chain\r\n\tchildKeyNum, err := GetHDKeyByPath(hdKey, chain, num)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\t// Get the private key\r\n\treturn childKeyNum.ECPrivKey()\r\n}", "func (keyDB *KeyDB) GetPrivateKeyInit(\n\tpubKeyHash string,\n) (ki *uid.KeyInit, sigPubKey, privKey string, err error) {\n\tvar json string\n\terr = keyDB.getPrivateKeyInitQuery.QueryRow(pubKeyHash).Scan(&json, &sigPubKey, &privKey)\n\tswitch {\n\tcase err != nil:\n\t\treturn nil, \"\", \"\", log.Error(err)\n\tdefault:\n\t\tki, err = uid.NewJSONKeyInit([]byte(json))\n\t\tif err != nil {\n\t\t\treturn nil, \"\", \"\", err\n\t\t}\n\t\treturn\n\t}\n}", "func (x *Ed25519Credentials) PrivateKey() PrivateKey {\n\n\treturn PrivateKey{\n\t\tAlgorithm: AlgorithmEd25519,\n\t\tPrivate: base64.URLEncoding.EncodeToString(x.Private[:]),\n\t}\n\n}", "func (mc *MoacChain) exportWalletPrivateKey(addr, addrPasswd string) (privateKey string, err error) {\n\n\tdefer func() {\n\t\tif re := recover(); re != nil {\n\t\t\terr = re.(error)\n\t\t}\n\t}()\n\n\tvar acc accounts.Account\n\tacc, err = mc.fetchKeystore().Find(accounts.Account{Address: common.HexToAddress(addr)})\n\tif err == nil {\n\t\tvar jsonBytes []byte\n\t\tjsonBytes, err = ioutil.ReadFile(acc.URL.Path)\n\t\tif err == nil {\n\t\t\tvar storeKey *keystore.Key\n\t\t\tstoreKey, err = keystore.DecryptKey(jsonBytes, addrPasswd)\n\t\t\tif err == nil {\n\t\t\t\tprivateKey = hex.EncodeToString(ethMath.PaddedBigBytes(storeKey.PrivateKey.D, storeKey.PrivateKey.Params().BitSize/8))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn privateKey, err\n}", "func readPrivateKey() ([]byte, error) {\n\tkeyData, err := ioutil.ReadFile(authConfigFile)\n\tif err != nil {\n\t\tlog.Errorf(\"Returning error, authConfigFile %s not found\", authConfigFile)\n\t\treturn []byte{}, err\n\t}\n\n\tlog.Debug(\"Key: %s\", string(keyData))\n\treturn keyData, nil\n}", "func parsePrivateKey(der []byte) (crypto.PrivateKey, error) {\n if key, err := x509.ParsePKCS1PrivateKey(der); err == nil {\n return key, nil\n }\n if key, err := x509.ParsePKCS8PrivateKey(der); err == nil {\n switch key := key.(type) {\n case *rsa.PrivateKey, *ecdsa.PrivateKey:\n return key, nil\n default:\n return nil, errors.New(\"crypto/tls: found unknown private key type in PKCS#8 wrapping\")\n }\n }\n if key, err := x509.ParseECPrivateKey(der); err == nil {\n return key, nil\n }\n\n return nil, errors.New(\"crypto/tls: failed to parse private key\")\n}", "func GetTokenPrivateKey() []byte {\n\treturn []byte(viper.GetString(varTokenPrivateKey))\n}", "func FindPrivateKey(clientID string) (string, *exception.Exception) {\n\texits, ex := redisservice.Exits(clientID)\n\tif ex != nil {\n\t\treturn \"\", ex.ResetCode(1001)\n\t}\n\n\tif !exits {\n\t\treturn \"\", exception.NewException(exception.Error, 1002, \"This client security session was not found.\")\n\t}\n\n\tkey, ex1 := redisservice.Get(clientID)\n\tif ex1 != nil {\n\t\treturn \"\", ex1.ResetCode(1001)\n\t}\n\n\treturn key, nil\n}", "func (e *EtcdClientCert) PrivateKeyPath() string { return path.Join(e.BaseDir, etcdClientKeyFileName) }", "func GetRSAKey(size int) (data.PrivateKey, error) {\n\traw := map[int][]byte{\n\t\t1024: []byte(`-----BEGIN RSA PRIVATE KEY-----\nMIICXAIBAAKBgQDJ8BO2/HOHLJgrb3srafbNRUD8r0SGNJFi5h7t4vxZ4F5oBW/4\nO2/aZmdToinyuCm0eGguK77HAsTfSHqDUoEfuInNg7pPk4F6xa4feQzEeG6P0YaL\n+VbApUdCHLBE0tVZg1SCW97+27wqIM4Cl1Tcsbb+aXfgMaOFGxlyga+a6wIDAQAB\nAoGBAKDWLH2kGMfjBtghlLKBVWcs75PSbPuPRvTEYIIMNf3HrKmhGwtVG8ORqF5+\nXHbLo7vv4tpTUUHkvLUyXxHVVq1oX+QqiRwTRm+ROF0/T6LlrWvTzvowTKtkRbsm\nmqIYEbc+fBZ/7gEeW2ycCfE7HWgxNGvbUsK4LNa1ozJbrVEBAkEA8ML0mXyxq+cX\nCwWvdXscN9vopLG/y+LKsvlKckoI/Hc0HjPyraq5Docwl2trZEmkvct1EcN8VvcV\nvCtVsrAfwQJBANa4EBPfcIH2NKYHxt9cP00n74dVSHpwJYjBnbec5RCzn5UTbqd2\ni62AkQREYhHZAryvBVE81JAFW3nqI9ZTpasCQBqEPlBRTXgzYXRTUfnMb1UvoTXS\nZd9cwRppHmvr/4Ve05yn+AhsjyksdouWxyMqgTxuFhy4vQ8O85Pf6fZeM4ECQCPp\nWv8H4thJplqSeGeJFSlBYaVf1SRtN0ndIBTCj+kwMaOMQXiOsiPNmfN9wG09v2Bx\nYVFJ/D8uNjN4vo+tI8sCQFbtF+Qkj4uSFDZGMESF6MOgsGt1R1iCpvpMSr9h9V02\nLPXyS3ozB7Deq26pEiCrFtHxw2Pb7RJO6GEqH7Dg4oU=\n-----END RSA PRIVATE KEY-----`),\n\t\t2048: []byte(`-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAtKGse3BcxXAp5OkLGYq0HfDcCvgag3R/9e8pHUGsJhkSZFrn\nZWAsAVFKSYaYItf1D/g3izqVDMtMpXZ1chNzaRysnbrb/q7JTbiGzXo9FcshyUc9\ntcB60wFbvsXE2LaxZcKNxLYXbOvf+tdg/P07oPG24fzYI4+rbZ1wyoORbT1ys33Z\nhHyifFvO7rbe69y3HG+xbp7yWYAR4e8Nw9jX8/9sGslAV9vEXOdNL3qlcgsYRGDU\nDsUJsnWaMzjstvUxb8mVf9KG2W039ucgaXgBW/jeP3F1VSYFKLd03LvuJ8Ir5E0s\ncWjwTd59nm0XbbRI3KiBGnAgrJ4iK07HrUkpDQIDAQABAoIBAHfr1k1lfdH+83Fs\nXtgoRAiUviHyMfgQQlwO2eb4kMgCYTmLOJEPVmfRhlZmK18GrUZa7tVaoVYLKum3\nSaXg0AB67wcQ5bmiZTdaSPTmMOPlJpsw1wFxtpmcD0MKnfOa5w++KMzub4L63or0\nrwmHPi1ODLLgYMbLPW7a1eU9kDFLOnx3RRy9a29hQXxGsRYetrIbKmeDi6c+ndQ8\nI5YWObcixxl5GP6CTnEugV7wd2JmXuQRGFdopUwQESCD9VkxDSevQBSPoyZKHxGy\n/d3jf0VNlvwsxhD3ybhw8jTN/cmm2LWmP4jylG7iG7YRPVaW/0s39IZ9DnNDwgWB\n03Yk2gECgYEA44jcSI5kXOrbBGDdV+wTUoL24Zoc0URX33F15UIOQuQsypaFoRJ6\nJ23JWEZN99aquuo1+0BBSfiumbpLwSwfXi0nL3oTzS9eOp1HS7AwFGd/OHdpdMsC\nw2eInRwCh4GrEf508GXo+tSL2NS8+MFVAG2/SjEf06SroQ/rQ87Qm0ECgYEAyzqr\n6YvbAnRBy5GgQlTgxR9r0U8N7lM9g2Tk8uGvYI8zu/Tgia4diHAwK1ymKbl3lf95\n3NcHR+ffwOO+nnfFCvmCYXs4ggRCkeopv19bsCLkfnTBNTxPFh6lyLEnn3C+rcCe\nZAkKLrm8BHGviPIgn0aElMQAbhJxTWfClw/VVs0CgYAlDhfZ1R6xJypN9zx04iRv\nbpaoPQHubrPk1sR9dpl9+Uz2HTdb+PddznpY3vI5p4Mcd6Ic7eT0GATPUlCeAAKH\nwtC74aSx6MHux8hhoiriV8yXNJM/CwTDL+xGsdYTnWFvx8HhmKctmknAIT05QbsH\nG9hoS8HEJPAyhbYpz9eXQQKBgQCftPXQTPXJUe86uLBGMEmK34xtKkD6XzPiA/Hf\n5PdbXG39cQzbZZcT14YjLWXvOC8AE4qCwACaw1+VR+ROyDRy0W1iieD4W7ysymYQ\nXDHDk0gZEEudOE22RlNmCcHnjERsawiN+ISl/5P/sg+OASkdwd8CwZzM43VirP3A\nlNLEqQKBgHqj85n8ew23SR0GX0W1PgowaCHHD1p81y2afs1x7H9R1PNuQsTXKnpf\nvMiG7Oxakj4WDC5M5KsHWqchqKDycT+J1BfLI58Sf2qo6vtaV+4DARNgzcG/WB4b\nVnpsczK/1aUH7iBexuF0YqdPQwzpSvrY0XZcgCFQ52JDn3vjblhX\n-----END RSA PRIVATE KEY-----`),\n\t\t4096: []byte(`-----BEGIN RSA PRIVATE KEY-----\nMIIJKgIBAAKCAgEAw28m5P1j7Rv1Wy4AicNkR4DXVxJXlPma+c5U/KJzFg0emiyx\nfkGQnUWeFofOI3rgrgK3deQ6yspgavTKWnHs4YeAz2egMSDsobI1OAP7ocPrFhYc\nFB+pTLXm1CkvyxIt9UWPxgc4CGiO1wIlfL8PpFg5vur7sAqbzxKeFx8GikbjFbQg\nd/RMFYeQacuimo9yea9DqjELvwewby3iP81FP9JJKiM3G6+7BiI+pJv65dNLbBUY\nHgKrmBHYg7WVSdmR7pZucEDoBqJcjc+kIHDGMH2vndWhIybEpHxxXdW+DrnPlhGV\n/hqKWw5fqJvhdh0OR1yefCCva0m6mZAKardzqxndFJqJbs1ehXg0luijVRYXaUpP\nuvHaKj+QV2R/PJWxkCLZLFSEAE156QT1sfY5FOh8rYBWBNrJk7X6qUTaF7Jfeo3H\nCF94ioP0Up8bohIu0lH8WPfTxdZ2lvUGSteMEYWBSbKhcbSCOP6a2K4/znSNl/J3\nLV/YcbmuSb7sAp+sZXELarYg/JMNVP4Vo2vh5S4ZCPYtk2or2WY27rMHWQ1vIhjB\nxjuSKzpLx9klusoTHB3wD6K7FwyT4JLUTfxGloSSpOuLG5yp9dAL/i8WHY20w6jP\n7ZYOss6OsQzp5ZqpW5M/0z60NsEOhfFXd1bxPYUP7//6N14XHTg31fg7vykCAwEA\nAQKCAgEAnn+j/K0ggKlfGL67Qv9Lcc4lVwGSNEknDhfvxyB809J6EjHTFYFZJqPS\nbZVgclfypk2fuqYJpHPzNGspPacNpW7+4ba6LX31S8I69R4N0wkQvM3bodp3tLYF\n6eUpVLl+ul/bFZC/OdqKlgewnXZa2j+PPa5Xx1MjQBJqUnggFr8c5no6pu5jUkaq\nsZKsYkuaXOPurbWvQBOdXN3Kk1IIKpWCLwF2bSbdOEFHqrqyBfiSP6rv707dGazH\nezImTEl+2A/6q2GIi/DbvUs8Ye70XVlht1ENqXOEoZ4nVyHFTS4XFC9ZBUdDFEwY\n+qbJeMBh1zBffG4JtqqKAobWW+xCioKVn2ArSzh1/2Q5652yeVVhR+GTSK2yd1uE\n5a5Pc65C8LCRNTz0iHEUESfVO5QnUq9bWShgm0H/LQ3sk8gzQjuBS5Ya523vOl1w\nxRUYxjEFW0382BrG0dn+WE2Yn0z5i2X9+WRgiKrh8tNZ+wNGN3MtZ5mloHsocH4N\nuUIZ6J0x/YruW126b0XA6fE+3taQDmJ4Qj/puU7+sFCs7MXUtd3tClEH1NUalH0T\n5awjZcJnMmGVmtGGfP1DtuEd082mIUuvKZj1vCEiSavwK3JDVl5goxlDpvEgdh2X\no1eSIMMZb6FG5h3dsyyMpXaRobgL+qbLm0XDGwtiIu+d5BE8OQECggEBAPL+FwUB\n2w4bRGzmDNRJm3oDcDlBROn5nFpzzSuXRA8zSrJbNB9s55EqTnZw7xVNa6nUxi9C\nd2Hqcbp9HD8EezlbMWJ4LASlYPzdBpAo5eyvK8YccE1QjlGlP7ZOf4+ekwlreqZ4\nfhRb4r/q49eW3aAWbJPu67MYu1iBMpdINZpMzDdE1wKjRXWu0j7Lr3SXjzgjD94E\nG+4VvJ0xc8WgjM9YSLxFN/5VZd+us7l6V18vOrdPDpAlJuTkmSpP0Xx4oUKJs7X+\n84CEB47GgUqf3bPadS8XRC2slEA+or5BJnPTVQ5YgTeWZE2kD3tLDOVHE7gLmV61\njYy2Icm+sosnfeECggEBAM3lVYO3D5Cw9Z4CkewrzMUxd7sSd5YqHavfEjvFc4Pk\n6Q6hsH1KR4Ai6loB8ugSz2SIS6KoqGD8ExvQxWy4AJf/n39hxb8/9IJ3b6IqBs64\n+ELJ8zw3QheER93FwK/KbawzLES9RkdpvDBSHFFfbGxjHpm+quQ8JcNIHTg43fb+\nTWe+mXYSjIWVCNssHBl5LRmkly37DxvBzu9YSZugESr80xSMDkBmWnpsq2Twh3q4\n2yP6jgfaZtV9AQQ01jkPgqpcuSoHm2qyqfiIr3LkA34OQmzWpyPn17If1DSJhlXo\nClSSl5Guqt9r0ifuBcMbl69OyAgpGr4N5sFxRk0wGkkCggEBAMt34hSqSiAUywYY\n2DNGc28GxAjdU3RMNBU1lF5k6nOD8o9IeWu7CGhwsYTR6hC/ZGCwL0dRc5/E7XhH\n3MgT247ago6+q7U0OfNirGU4Kdc3kwLvu0WyJ4nMQn5IWt4K3XpsyiXtDT3E9yjW\n6fQTev7a6A4zaJ/uHKnufUtaBrBukC3TcerehoIVYi185y1M33sVOOsiK7T/9JD3\n4MZiOqZAeZ9Uop9QKN7Vbd7ox5KHfLYT99DRmzDdDjf04ChG5llN7vJ9Sq6ZX665\nH3g6Ry2bxrYo2EkakoT9Lc77xNQF6Nn7WDAQuWqd7uzBmkm+a4+X/tPkWGOz+rTw\n/pYw+mECggEBAKQiMe1yPUJHD0YLHnB66h44tQ24RwS6RjUA+vQTD2cRUIiNdLgs\nQptvOgrOiuleNV4bGNBuSuwlhsYhw4BLno2NBYTyWEWBolVvCNrpTcv1wFLd0r0p\n/9HnbbLpNhXs9UjU8nFJwYCkVZTfoBtuSmyNB5PgXzLaj/AAyOpMywVe7C3Lz2JE\nnyjOCeVOYIgeBUnv32SUQxMJiQFcDDG3hHgUW+CBVcsYzP/TKT6qUBYQzwD7d8Xi\n4R9HK0xDIpMSPkO47xMGRWrlSoIJ1HNuOSqAC4vgAhWpeFVS8kN/bkuFUtbglVtZ\nNnYs6bdTE9zZXi4uS1/WBK+FPXLv7e8SbaECggEAI2gTDuCm5kVoVJhGzWA5/hmB\nPAUhSQpMHrT8Em4cXss6Q07q9A2l8NuNrZt6kNhwagdng7v7NdPY3ZBl/ntmKmZN\nxWUKzQCtIddW6Z/veO86F15NyBBZFXIOhzvwnrTtS3iX0JP0dlTZTv/Oe3DPk3aq\nsFJtHM6s44ZBYYAgzSAxTdl+80oGmtdrGnSRfRmlav1kjWLAKurXw8FTl9rKgGNA\nUUv/jGSe1DxnEMvtoSwQVjcS0im57vW0x8LEz5eTWMYwkvxGHm0/WU2Yb0I6mL4j\nPWrHwwPdRoF/cPNWa7eTsZBKdVN9iNHSu7yE9owXyHSpesI1IZf8Zq4bqPNpaA==\n-----END RSA PRIVATE KEY-----`),\n\t}\n\tblock, _ := pem.Decode(raw[size])\n\tkey, err := x509.ParsePKCS1PrivateKey(block.Bytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprivKey, err := utils.RSAToPrivateKey(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn privKey, nil\n}", "func (instance *cache) GetEntry(key string) (*Entry, fail.Error) {\n\tif instance.isNull() {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\tif key == \"\" {\n\t\treturn nil, fail.InvalidParameterCannotBeEmptyStringError(\"id\")\n\t}\n\n\tinstance.lock.RLock()\n\tdefer instance.lock.RUnlock()\n\n\tif _, ok := instance.reserved[key]; ok {\n\t\treturn nil, fail.NotAvailableError(\"cache entry '%s' is reserved and cannot be use until freed or committed\", key)\n\t}\n\tif ce, ok := instance.cache[key]; ok {\n\t\treturn ce, nil\n\t}\n\n\treturn nil, fail.NotFoundError(\"failed to find cache entry with key '%s'\", key)\n}", "func (c *Client) Private(id *key.Identity) ([]byte, error) {\n\tephScalar := key.KeyGroup.Scalar()\n\tephPoint := key.KeyGroup.Point().Mul(ephScalar, nil)\n\tephBuff, err := ephPoint.MarshalBinary()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tobj, err := ecies.Encrypt(key.KeyGroup, id.Key, ephBuff, EciesHash)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := c.client.PrivateRand(context.TODO(), id, &drand.PrivateRandRequest{Request: obj})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ecies.Decrypt(key.KeyGroup, ephScalar, resp.GetResponse(), EciesHash)\n}", "func PrivateKey(p *big.Int) *big.Int {\n\tkey := new(big.Int)\n\tlimit := new(big.Int).Sub(p, big.NewInt(2))\n\tseed := rand.New(rand.NewSource(time.Now().UnixNano()))\n\treturn key.Rand(seed, limit).Add(key, big.NewInt(2))\n}", "func (key Key) ToPrivKey() cryptotypes.PrivKey {\n\treturn key.k\n}", "func GetPrivateKeyFromHDKey(hdKey *hdkeychain.ExtendedKey) (*bsvec.PrivateKey, error) {\r\n\treturn hdKey.ECPrivKey()\r\n}", "func GetAddressByPrivateKey(ssk string) (address, ucs_s string, err error) {\n\taddress = \"\"\n\tucs_s = \"\"\n\n\tsk, err := hexString2SecretKey(ssk)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpk := sk.PublicKey()\n\n\tucs := types.UnlockConditions{\n\t\tPublicKeys: []types.SiaPublicKey{types.Ed25519PublicKey(pk)},\n\t\tSignaturesRequired: 1,\n\t}\n\n\tucs_b, err := json.Marshal(ucs)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tucs_s = string(ucs_b)\n\taddress = ucs.UnlockHash().String()\n\terr = nil\n\treturn\n}", "func GetRSAPrivateKey(raw []byte) (*rsa.PrivateKey, error) {\n\tdecoded, _ := pem.Decode(raw)\n\tif decoded == nil {\n\t\treturn nil, errors.New(\"Failed to decode the PEM-encoded RSA key\")\n\t}\n\tRSAPrivKey, err := x509.ParsePKCS1PrivateKey(decoded.Bytes)\n\tif err == nil {\n\t\treturn RSAPrivKey, nil\n\t}\n\tkey, err2 := x509.ParsePKCS8PrivateKey(decoded.Bytes)\n\tif err2 == nil {\n\t\tswitch key.(type) {\n\t\tcase *ecdsa.PrivateKey:\n\t\t\treturn nil, errors.New(\"Expecting RSA private key but found EC private key\")\n\t\tcase *rsa.PrivateKey:\n\t\t\treturn key.(*rsa.PrivateKey), nil\n\t\tdefault:\n\t\t\treturn nil, errors.New(\"Invalid private key type in PKCS#8 wrapping\")\n\t\t}\n\t}\n\treturn nil, errors.Wrap(err, \"Failed parsing RSA private key\")\n}", "func (tb *tableManager) getEntry(keyIn uint64) (*tableEntry, error) {\n\tkey, ok := CleanKey(keyIn)\n\tif !ok {\n\t\tlog.Println(\"Key out of range.\")\n\t\treturn nil, errors.New(\"Key out of range.\")\n\t}\n\tentry, ok := tb.data[key]\n\tif !ok {\n\t\treturn nil, errors.New(\"Key not found in table.\")\n\t}\n\treturn entry, nil\n}", "func (b *BtcWallet) fetchPrivKey(\n\tkeyDesc *keychain.KeyDescriptor) (*btcec.PrivateKey, error) {\n\n\t// If the key locator within the descriptor *isn't* empty, then we can\n\t// directly derive the keys raw.\n\temptyLocator := keyDesc.KeyLocator.IsEmpty()\n\tif !emptyLocator || keyDesc.PubKey == nil {\n\t\treturn b.deriveKeyByLocator(keyDesc.KeyLocator)\n\t}\n\n\thash160 := btcutil.Hash160(keyDesc.PubKey.SerializeCompressed())\n\taddr, err := btcutil.NewAddressWitnessPubKeyHash(hash160, b.netParams)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Otherwise, we'll attempt to derive the key based on the address.\n\t// This will only work if we've already derived this address in the\n\t// past, since the wallet relies on a mapping of addr -> key.\n\tkey, err := b.wallet.PrivKeyForAddress(addr)\n\tswitch {\n\t// If we didn't find this key in the wallet, then there's a chance that\n\t// this is actually an \"empty\" key locator. The legacy KeyLocator\n\t// format failed to properly distinguish an empty key locator from the\n\t// very first in the index (0, 0).IsEmpty() == true.\n\tcase waddrmgr.IsError(err, waddrmgr.ErrAddressNotFound) && emptyLocator:\n\t\treturn b.deriveKeyByLocator(keyDesc.KeyLocator)\n\n\tcase err != nil:\n\t\treturn nil, err\n\n\tdefault:\n\t\treturn key, nil\n\t}\n}", "func (c *CertInfo) PrivateKey() []byte {\n\tecKey, ok := c.KeyPair().PrivateKey.(*ecdsa.PrivateKey)\n\tif ok {\n\t\tdata, err := x509.MarshalECPrivateKey(ecKey)\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn pem.EncodeToMemory(&pem.Block{Type: \"EC PRIVATE KEY\", Bytes: data})\n\t}\n\n\trsaKey, ok := c.KeyPair().PrivateKey.(*rsa.PrivateKey)\n\tif ok {\n\t\tdata := x509.MarshalPKCS1PrivateKey(rsaKey)\n\t\treturn pem.EncodeToMemory(&pem.Block{Type: \"RSA PRIVATE KEY\", Bytes: data})\n\t}\n\n\treturn nil\n}", "func (o *PipelineSshKeyPairAllOf) GetPrivateKeyOk() (*string, bool) {\n\tif o == nil || o.PrivateKey == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PrivateKey, true\n}", "func PrivateKey(i int) *keys.PrivateKey {\n\twif := WIF(i)\n\tpriv, err := keys.NewPrivateKeyFromWIF(wif)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn priv\n}", "func GetPrivateInfo(ctx context.Context, privateKeyDir string) (*ServerPrivateInfo, error) {\n\tsPriv, err := cryptoio.ReadStandardPrivateKey(ctx, &cryptoio.ReadStandardPrivateKeyParams{FilePath: path.Join(privateKeyDir, cryptoio.DefaultStandardPrivateKey)})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tePriv, err := cryptoio.ReadElGamalPrivateKey(path.Join(privateKeyDir, cryptoio.DefaultElgamalPrivateKey))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsecret, err := cryptoio.ReadElGamalSecret(path.Join(privateKeyDir, cryptoio.DefaultElgamalSecret))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ServerPrivateInfo{\n\t\tStandardPrivateKey: sPriv,\n\t\tElGamalPrivateKey: ePriv,\n\t\tSecret: secret,\n\t}, nil\n}", "func (c *HTTPClient) GetPrivKey() crypto.PrivateKey {\n\treturn c.privKey\n}", "func (ks *KeyStore) PrivateKey(kid string) (*rsa.PrivateKey, error) {\n\tks.mu.RLock()\n\tdefer ks.mu.RUnlock()\n\n\tprivateKey, found := ks.store[kid]\n\tif !found {\n\t\treturn nil, errors.New(\"kid lookup failed\")\n\t}\n\treturn privateKey, nil\n}", "func (ks *CSA) Unsafe_GetUnlockedPrivateKey(pubkey crypto.PublicKey) ([]byte, error) {\n\treturn ks.keys[pubkey.String()].Unsafe_GetPrivateKey()\n}", "func NewPrivateKey() PEMPrivateKeyLoaderInterface {\n\treturn &PrivateKey{\n\t\tpemDecoder: pemDecoder.NewPEMDecoder(),\n\t\tx509Parser: x509parser.Newx509Parser(),\n\t}\n}", "func PrivateKey(p *big.Int) *big.Int {\n\t// handle range requirement and generate random number within that range\n\tnum := big.NewInt(0)\n\tnum = num.Add(p, big.NewInt(-2))\n\trandNum, _ := rand.Int(rand.Reader, num)\n\n\tresult := randNum.Add(randNum, big.NewInt(2))\n\treturn result\n}", "func readPrivateKey() ([]byte, error) {\n\tprivateKey, e := ioutil.ReadFile(\"keys/sample-key\")\n\treturn privateKey, e\n}", "func (o *Gojwt) GetPrivKeyPath()(string){\n return o.privKeyPath\n}", "func (mgr *StateManager) GetEntry(vmAddress []byte) (*EvmEntry, error) {\n\taddress := toStateAddress(mgr.prefix, vmAddress)\n\n\t// Retrieve the account from global state\n\tentries, err := mgr.state.Get([]string{address})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tentryData, exists := entries[address]\n\tif !exists {\n\t\treturn nil, nil\n\t}\n\n\t// Deserialize the entry\n\tentry := &EvmEntry{}\n\terr = proto.Unmarshal(entryData, entry)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn entry, nil\n}", "func (c *Crypto) PrivateKeyPath() string {\n\treturn c.privateKeyPath\n}", "func (c *directClient) Entry(ctx context.Context, pubKey cipher.PubKey) (*disc.Entry, error) {\n\tc.mx.RLock()\n\tdefer c.mx.RUnlock()\n\tfor _, entry := range c.entries {\n\t\tif entry.Static == pubKey {\n\t\t\treturn entry, nil\n\t\t}\n\t}\n\treturn &disc.Entry{}, nil\n}", "func (ms *MemStore) GetPublicKeyEntry(uidMsg *uid.Message) (*uid.KeyEntry, string, error) {\n\tke, ok := ms.publicKeyEntryMap[uidMsg.Identity()]\n\tif !ok {\n\t\treturn nil, \"\", log.Error(session.ErrNoKeyEntry)\n\t}\n\treturn ke, \"undefined\", nil\n}", "func GetPrivateKeyFromSecret(secret string) []byte {\n\tsecretHash := GetSHA256Hash(secret)\n\t_, prKey, _ := ed25519.GenerateKey(bytes.NewReader(secretHash[:sha256.Size]))\n\n\treturn prKey\n}", "func (backend *JwtBackend) getSecretEntry(storage logical.Storage, roleID string, secretID string) (*secretStorageEntry, error) {\n\tif roleID == \"\" {\n\t\treturn nil, fmt.Errorf(\"Secrets Role ID is not specified\")\n\t}\n\n\tif secretID == \"\" {\n\t\treturn nil, nil\n\t}\n\n\tvar result secretStorageEntry\n\tif entry, err := storage.Get(fmt.Sprintf(\"secrets/%s/%s\", roleID, secretID)); err != nil {\n\t\treturn nil, err\n\t} else if entry == nil {\n\t\treturn nil, nil\n\t} else if err := entry.DecodeJSON(&result); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &result, nil\n}", "func (s *Service) GetServerPrivateKey() crypto.PrivateKey {\n\t// The server private key is always available\n\tpk, _ := s.GetPrivateKey(serverPrivateKeyID)\n\treturn pk\n}", "func (s *ChaincodeStubWrapper) Get(key datastore.Key) ([]byte, error) {\n\tlogger.Debugf(\"Getting key %s\", key)\n\n\tv, err := s.stub.GetPrivateData(s.collection, key.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(v) == 0 {\n\t\treturn nil, datastore.ErrNotFound\n\t}\n\n\treturn v, nil\n}", "func LoadPrivateKey(path string) (Signer, error) {\n dat, _ := ioutil.ReadFile(path)\n if !strings.Contains(string(dat), \"PRIVATE\") {\n fmt.Println(path, \" MUST contain the Private Key.\")\n os.Exit(0)\n } // if not PRIVATE.\n\n return ParsePrivateKey([]byte(dat))\n}", "func (decryptor *PgDecryptor) GetPrivateKeys() ([]*keys.PrivateKey, error) {\n\tif decryptor.IsWithZone() {\n\t\treturn decryptor.keyStore.GetZonePrivateKeys(decryptor.GetMatchedZoneID())\n\t}\n\treturn decryptor.keyStore.GetServerDecryptionPrivateKeys(decryptor.clientID)\n}", "func (repo Keys) GetPrivateKey(ctx context.Context) (jwk.RSAPrivateKey, error) {\n\tlogger := logging.Logger\n\tprivateJWKBytes, err := repo.cache.Get(ctx, redisPrivateKeyKey).Bytes()\n\tif err != nil && err != redis.Nil {\n\t\treturn nil, err\n\t}\n\tif len(privateJWKBytes) != 0 {\n\t\tkey := jwk.NewRSAPrivateKey()\n\t\terr = json.Unmarshal(privateJWKBytes, &key)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn key, nil\n\t}\n\n\trsaPrivateKey, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\tlogger.Error(\"failed to generate rsa key\", zap.Error(err))\n\t\treturn nil, err\n\t}\n\tprivateJWK, publicJWK, err := repo.newJWKRSAKeys(rsaPrivateKey)\n\tif err != nil {\n\t\tlogger.Error(\"could not create rsa jwk keys from rsa private key\", zap.Error(err))\n\t\treturn nil, err\n\t}\n\n\terr = repo.savePrivateJWK(ctx, privateJWK)\n\tif err != nil {\n\t\tlogger.Error(\"could not save new private jwk\", zap.Error(err))\n\t\treturn nil, err\n\t}\n\terr = repo.savePublicJWK(ctx, publicJWK)\n\tif err != nil {\n\t\tlogger.Error(\"could not save new public jwk\", zap.Error(err))\n\t\treturn nil, err\n\t}\n\n\treturn privateJWK, nil\n}", "func (o *Gojwt) GetRSAPrivKey()(*rsa.PrivateKey){\n return o.privRSAKey\n}", "func PEMtoPrivateKey(raw []byte, pwd []byte) (interface{}, error) {\n\tif len(raw) == 0 {\n\t\treturn nil, errors.New(\"Invalid PEM. It must be different from nil.\")\n\t}\n\tblock, _ := pem.Decode(raw)\n\tif block == nil {\n\t\treturn nil, fmt.Errorf(\"Failed decoding PEM. Block must be different from nil. [% x]\", raw)\n\t}\n\n\t// TODO: derive from header the type of the key\n\n\tif x509.IsEncryptedPEMBlock(block) {\n\t\tif len(pwd) == 0 {\n\t\t\treturn nil, errors.New(\"Encrypted Key. Need a password\")\n\t\t}\n\n\t\tdecrypted, err := x509.DecryptPEMBlock(block, pwd)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Failed PEM decryption [%s]\", err)\n\t\t}\n\n\t\tkey, err := DERToPrivateKey(decrypted)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn key, err\n\t}\n\n\tcert, err := DERToPrivateKey(block.Bytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn cert, err\n}" ]
[ "0.7356036", "0.66376597", "0.65908307", "0.651616", "0.6494148", "0.647002", "0.6434694", "0.6398078", "0.6364217", "0.63412416", "0.6313559", "0.62824595", "0.62165207", "0.6210221", "0.6189422", "0.6186901", "0.61555266", "0.6147926", "0.6114492", "0.6103414", "0.60985696", "0.6088891", "0.6081246", "0.60599315", "0.6025552", "0.6021195", "0.60088646", "0.60081476", "0.59983903", "0.5977301", "0.5973766", "0.596736", "0.59609777", "0.59592056", "0.59415627", "0.592678", "0.59212714", "0.58920413", "0.5883392", "0.5878794", "0.58741164", "0.5830577", "0.58146125", "0.5809181", "0.5804035", "0.58026385", "0.57974195", "0.5766261", "0.5750245", "0.57494015", "0.5733975", "0.57330966", "0.5728371", "0.5707118", "0.5696396", "0.56676656", "0.5666867", "0.5636192", "0.5633757", "0.55746007", "0.5565054", "0.5551817", "0.5550865", "0.5548399", "0.5537251", "0.55314076", "0.5526348", "0.55089563", "0.5508883", "0.5508667", "0.55085135", "0.5507891", "0.5505429", "0.5495615", "0.549163", "0.5486947", "0.5472568", "0.5472253", "0.545498", "0.5454282", "0.5450632", "0.54462963", "0.54445195", "0.5419182", "0.5417824", "0.54169595", "0.541552", "0.541049", "0.5397873", "0.5394832", "0.5389838", "0.53826845", "0.53820527", "0.53739274", "0.53713", "0.537095", "0.53708005", "0.53592217", "0.5358756", "0.5355722" ]
0.71336013
1
GetPublicKeyEntry implemented in memory.
func (ms *MemStore) GetPublicKeyEntry(uidMsg *uid.Message) (*uid.KeyEntry, string, error) { ke, ok := ms.publicKeyEntryMap[uidMsg.Identity()] if !ok { return nil, "", log.Error(session.ErrNoKeyEntry) } return ke, "undefined", nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (pk PrivateKey) GetPublicKey() PublicKey {\n\treturn NewPublicKey(pk[32:])\n}", "func (store *keyStore) GetPublicKey(address string) (*openpgp.Entity, error) {\n\tel := store.lookupPublicKey(address)\n\tif len(el) > 0 {\n\t\treturn el[0], nil\n\t}\n\treturn nil, nil\n}", "func (pk *PrivateKey) GetPublicKey() *PublicKey {\n var publicKeyBytes PublicKey\n copy(publicKeyBytes[:], pk[32:])\n return &publicKeyBytes\n}", "func GetPublicKey(pub ssh.PublicKey) []byte {\n\tmarshaled := ssh.MarshalAuthorizedKey(pub)\n\t// Strip trailing newline\n\treturn marshaled[:len(marshaled)-1]\n}", "func (nr NodeRecord) GetPublicKey() (string, error) {\n\treturn nr.Record.PublicKey, nil\n}", "func (r *Member) GetPublicKey() string {\n\tvar args [0]interface{}\n\n\tvar argsSerialized []byte\n\n\terr := proxyctx.Current.Serialize(args, &argsSerialized)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tres, err := proxyctx.Current.RouteCall(r.Reference, true, \"GetPublicKey\", argsSerialized)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tret := [1]interface{}{}\n\tvar ret0 string\n\tret[0] = &ret0\n\n\terr = proxyctx.Current.Deserialize(res, &ret)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn ret0\n}", "func GetPublicKey(fingerprint string) (result string, err string) {\n\tr, e := chevronlib.GetPublicKey(fingerprint)\n\tresult = r\n\tif e != nil {\n\t\terr = e.Error()\n\t}\n\n\treturn\n}", "func (_UsersData *UsersDataCaller) GetPublicKey(opts *bind.CallOpts, uuid [16]byte) ([2][32]byte, error) {\n\tvar (\n\t\tret0 = new([2][32]byte)\n\t)\n\tout := ret0\n\terr := _UsersData.contract.Call(opts, out, \"getPublicKey\", uuid)\n\treturn *ret0, err\n}", "func (o *DKSharesInfo) GetPublicKey() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.PublicKey\n}", "func (_UsersData *UsersDataCallerSession) GetPublicKey(uuid [16]byte) ([2][32]byte, error) {\n\treturn _UsersData.Contract.GetPublicKey(&_UsersData.CallOpts, uuid)\n}", "func (_UsersData *UsersDataSession) GetPublicKey(uuid [16]byte) ([2][32]byte, error) {\n\treturn _UsersData.Contract.GetPublicKey(&_UsersData.CallOpts, uuid)\n}", "func GetPublicKey(passphrase string, address string) (string, error) {\n\tkeys, err := GetPublicPrivateKey(passphrase, address)\n\n\treturn keys.PublicKey, err\n}", "func (keyRing *KeyRing) GetPublicKey() (b []byte, err error) {\n\tvar outBuf bytes.Buffer\n\tif err = keyRing.WritePublicKey(&outBuf); err != nil {\n\t\treturn\n\t}\n\n\tb = outBuf.Bytes()\n\treturn\n}", "func (rm *ReconstructingMember) individualPublicKey() *bn256.G2 {\n\treturn rm.publicKeySharePoints[0]\n}", "func (_BondedECDSAKeep *BondedECDSAKeepCaller) GetPublicKey(opts *bind.CallOpts) ([]byte, error) {\n\tvar (\n\t\tret0 = new([]byte)\n\t)\n\tout := ret0\n\terr := _BondedECDSAKeep.contract.Call(opts, out, \"getPublicKey\")\n\treturn *ret0, err\n}", "func (rd *RootDomain) GetMemberByPublicKey(publicKey string) (*insolar.Reference, error) {\n\ttrimmedPublicKey := foundation.TrimPublicKey(publicKey)\n\ti := foundation.GetShardIndex(trimmedPublicKey, insolar.GenesisAmountPublicKeyShards)\n\tif i >= len(rd.PublicKeyShards) {\n\t\treturn nil, fmt.Errorf(\"incorrect shard index\")\n\t}\n\ts := pkshard.GetObject(rd.PublicKeyShards[i])\n\trefStr, err := s.GetRef(trimmedPublicKey)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get reference in shard\")\n\t}\n\tref, err := insolar.NewReferenceFromBase58(refStr)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"bad member reference for this public key\")\n\t}\n\n\treturn ref, nil\n}", "func GetPublicKey() ed25519.PublicKey {\n\tkey, _ := DecodePublicKey(publicKey)\n\treturn key\n}", "func GetAddressFromPublicKey(publicKey []byte) string {\n\t//publicKeyHash := sha256.Sum256(publicKey)\n\n\tpk, err := crypto.PublicKeyFromBytes(publicKey)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\treturn pk.ToAddress()\n\n}", "func (m *ValidatorStatusRequest) GetPublicKey() []byte {\n\tif m != nil {\n\t\treturn m.PublicKey\n\t}\n\treturn nil\n}", "func (o *PipelineSshKeyPairAllOf) GetPublicKey() string {\n\tif o == nil || o.PublicKey == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.PublicKey\n}", "func getPublicKey(priv interface{}) interface{} {\n\tswitch k := priv.(type) {\n\tcase *rsa.PrivateKey:\n\t\treturn &k.PublicKey\n\tcase *ecdsa.PrivateKey:\n\t\treturn &k.PublicKey\n\tdefault:\n\t\treturn nil\n\t}\n}", "func (i *Identity) GetPublicKey() (ic.PubKey, error) {\n\treturn ic.UnmarshalPublicKey(i.PublicKey)\n}", "func (c *Client) GetPublicKey(scope ...string) (map[string]interface{}, error) {\n\tlog.info(\"========== GET PUBLIC KEY ==========\")\n\turl := buildURL(path[\"client\"])\n\tdefaultScope := \"OAUTH|POST,USERS|POST,USERS|GET,USER|GET,USER|PATCH,SUBSCRIPTIONS|GET,SUBSCRIPTIONS|POST,SUBSCRIPTION|GET,SUBSCRIPTION|PATCH,CLIENT|REPORTS,CLIENT|CONTROLS\"\n\n\tif len(scope) > 0 {\n\t\tdefaultScope = scope[0]\n\t}\n\n\tqp := []string{\"issue_public_key=YES&scope=\" + defaultScope}\n\n\tif len(scope) > 1 {\n\t\tuserId := scope[1]\n\t\tqp[0] += \"&user_id=\" + userId\n\t}\n\n\treturn c.do(\"GET\", url, \"\", qp)\n}", "func searchPublicKey(p *onet.TreeNodeInstance, servID *network.ServerIdentity) kyber.Point {\n\tfor _, si := range p.Roster().List {\n\t\tif si.Equal(servID) {\n\t\t\treturn p.NodePublic(si)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (u *AttestationClient) GetPublicKey(\n\tctx context.Context,\n\tusername,\n\tlabel string) (string, error) {\n\treply, err := u.ac.GetKeyInfo(ctx, &apb.GetKeyInfoRequest{\n\t\tKeyLabel: &label,\n\t\tUsername: &username,\n\t})\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"failed to call |GetKeyInfo|\")\n\t}\n\tif reply.GetStatus() != apb.AttestationStatus_STATUS_SUCCESS {\n\t\treturn \"\", &AttestationError{\n\t\t\terrors.Errorf(\"failed |GetKeyInfo|: %s\", reply.GetStatus().String()),\n\t\t\treply.GetStatus(),\n\t\t}\n\t}\n\treturn string(hexEncode(reply.GetPublicKey())), nil\n}", "func FetchPublicKey(ctx context.Context, client *http.Client, endpoint string) (*PublicKey, error) {\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"hpke: error building hpke-public-key http request: %w\", err)\n\t}\n\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"hpke: error requesting hpke-public-key endpoint: %w\", err)\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode/100 != 2 {\n\t\treturn nil, fmt.Errorf(\"hpke: error requesting hpke-public-key endpoint, invalid status code: %d\", res.StatusCode)\n\t}\n\n\tbs, err := io.ReadAll(io.LimitReader(res.Body, defaultMaxBodySize))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"hpke: error reading hpke-public-key endpoint: %w\", err)\n\t}\n\treturn PublicKeyFromBytes(bs)\n}", "func (k *key) getPublicKey() (*ecdsa.PublicKey, error) {\n\tby, err := base64.StdEncoding.DecodeString(k.PublicKeyB64)\n\tif err != nil {\n\t\treturn (*ecdsa.PublicKey)(nil), err\n\t}\n\n\tblockPub, _ := pem.Decode([]byte(by))\n\tgenericPublicKey, err := x509.ParsePKIXPublicKey(blockPub.Bytes)\n\tif err != nil {\n\t\treturn (*ecdsa.PublicKey)(nil), err\n\t}\n\n\treturn genericPublicKey.(*ecdsa.PublicKey), nil\n}", "func (a *Client) GetPublicKey(params *GetPublicKeyParams, authInfo runtime.ClientAuthInfoWriter) (*GetPublicKeyOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetPublicKeyParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getPublicKey\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/publickeys/{userID}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetPublicKeyReader{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.(*GetPublicKeyOK), nil\n\n}", "func (c *Included) MustPublicKeyEntry(key Key) *PublicKeyEntry {\n\tvar publicKeyEntry PublicKeyEntry\n\tif c.tryFindEntry(key, &publicKeyEntry) {\n\t\treturn &publicKeyEntry\n\t}\n\treturn nil\n}", "func (h *FormatHandler) ExtractPublicKey(data []byte) (key [32]byte, err error) {\n\tvar obj map[string]interface{}\n\tif err = Unmarshal(data, &obj); err != nil {\n\t\treturn\n\t}\n\treturn format.ExtractPublicKeyHelper(obj)\n}", "func (pk PrivateKey) PublicKey() hotstuff.PublicKey {\n\treturn pk.Public()\n}", "func (ec *EthereumChain) GetPublicKey(keepAddress common.Address) ([]uint8, error) {\n\tkeepContract, err := ec.getKeepContract(keepAddress)\n\tif err != nil {\n\t\treturn []uint8{}, err\n\t}\n\n\treturn keepContract.GetPublicKey()\n}", "func (priv *PrivateKey) Public() crypto.PublicKey", "func (priv *PrivateKey) Public() crypto.PublicKey", "func GetPublicKey() {\n\tauthenticator := &core.IamAuthenticator{\n\t\tApiKey: apiKey,\n\t\tURL: url, //use for dev/preprod env\n\t}\n\tservice, _ := notificationsapiv1.NewNotificationsApiV1(&notificationsapiv1.NotificationsApiV1Options{\n\t\tAuthenticator: authenticator,\n\t\tURL: \"https://us-south.secadvisor.cloud.ibm.com/notifications\", //Specify url or use default\n\t})\n\n\tgetPublicKeyOptions := service.NewGetPublicKeyOptions(accountID)\n\tresult, resp, operationErr := service.GetPublicKey(getPublicKeyOptions)\n\tif operationErr != nil {\n\t\tfmt.Println(resp.Result)\n\t\tfmt.Println(\"Failed to get public key: \", operationErr)\n\t\treturn\n\t}\n\n\tfmt.Println(*result.PublicKey)\n}", "func (pk *PublicKey) Key() string {\n\treturn string(pk.PublicKeyHex.Value)\n}", "func (s Sig) PublicKey() ([]byte, error) {\n\treturn nil, fmt.Errorf(\"not implemented\")\n}", "func (gossiper *Gossiper) GetPublicKey(name string) *peersterCrypto.PublicPair {\n\tvar key *peersterCrypto.PublicPair\n\n\t// No blockChain initialised\n\tif gossiper.headBlock == nil {\n\t\treturn key\n\t}\n\n\tfound := false\n\tblockStruct := gossiper.headBlock\n\thasNext := true\n\n\tfor !found && hasNext {\n\t\tblock := blockStruct.Block\n\t\tfor _, transaction := range block.Transactions {\n\t\t\tif transaction.GetName() == name {\n\t\t\t\tfound = true\n\t\t\t\tkey = transaction.GetPublicKey()\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tblockStruct, hasNext = gossiper.blocksMap[hex.EncodeToString(block.PrevHash[:])]\n\t\t}\n\t}\n\n\treturn key\n}", "func (a *Account) PublicKey() *PubKey {\n\tk := new(PubKey)\n\tcopy(k[:], a.pub[:])\n\treturn k\n}", "func (s GPGSigner) PublicKey() ([]byte, error) {\n\tgpg2 := exec.Command(s.gpgExecutable, \"--export\", s.GPGUserName)\n\tif err := s.Rewriter(gpg2); err != nil {\n\t\treturn nil, fmt.Errorf(\"Error invoking Rewrite: %v\", err)\n\t}\n\tout, err := gpg2.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error getting stdout pipe: %v\", err)\n\t}\n\tif err := gpg2.Start(); err != nil {\n\t\treturn nil, fmt.Errorf(\"Error starting gpg command: %v\", err)\n\t}\n\tpubkey, err := ioutil.ReadAll(out)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error reading pubkey data: %v\", err)\n\t}\n\tif err := gpg2.Wait(); err != nil {\n\t\treturn nil, fmt.Errorf(\"Error running gpg: %v\", err)\n\t}\n\treturn pubkey, nil\n}", "func (c *directClient) Entry(ctx context.Context, pubKey cipher.PubKey) (*disc.Entry, error) {\n\tc.mx.RLock()\n\tdefer c.mx.RUnlock()\n\tfor _, entry := range c.entries {\n\t\tif entry.Static == pubKey {\n\t\t\treturn entry, nil\n\t\t}\n\t}\n\treturn &disc.Entry{}, nil\n}", "func GetAddressFromPublicKey(publicKey []byte) string {\n\tpublicKeyHash := sha256.Sum256(publicKey)\n\n\treturn GetBigNumberStringFromBytes(GetFirstEightBytesReversed(publicKeyHash[:sha256.Size])) + \"L\"\n}", "func (_BondedECDSAKeep *BondedECDSAKeepCallerSession) GetPublicKey() ([]byte, error) {\n\treturn _BondedECDSAKeep.Contract.GetPublicKey(&_BondedECDSAKeep.CallOpts)\n}", "func (_BondedECDSAKeep *BondedECDSAKeepSession) GetPublicKey() ([]byte, error) {\n\treturn _BondedECDSAKeep.Contract.GetPublicKey(&_BondedECDSAKeep.CallOpts)\n}", "func (s NativeSigner) PublicKey() ([]byte, error) {\n\tkeybuf := new(bytes.Buffer)\n\tif err := (*openpgp.Entity)(&s).Serialize(keybuf); err != nil {\n\t\treturn nil, err\n\t}\n\treturn keybuf.Bytes(), nil\n}", "func (ms *MemStore) AddPublicKeyEntry(identity string, ke *uid.KeyEntry) {\n\tms.publicKeyEntryMap[identity] = ke\n}", "func readPublicKey(d *pluginsdk.ResourceData, pubKey interface{}) error {\n\tpubKeyBytes, err := x509.MarshalPKIXPublicKey(pubKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to marshal public key error: %s\", err)\n\t}\n\tpubKeyPemBlock := &pem.Block{\n\t\tType: \"PUBLIC KEY\",\n\t\tBytes: pubKeyBytes,\n\t}\n\n\td.Set(\"public_key_pem\", string(pem.EncodeToMemory(pubKeyPemBlock)))\n\n\tsshPubKey, err := ssh.NewPublicKey(pubKey)\n\tif err == nil {\n\t\t// Not all EC types can be SSH keys, so we'll produce this only\n\t\t// if an appropriate type was selected.\n\t\tsshPubKeyBytes := ssh.MarshalAuthorizedKey(sshPubKey)\n\t\td.Set(\"public_key_openssh\", string(sshPubKeyBytes))\n\t} else {\n\t\td.Set(\"public_key_openssh\", \"\")\n\t}\n\treturn nil\n}", "func GetPublicKey(stub shim.ChaincodeStubInterface) (string, error) {\r\n\tcert, err := GetCreatorCert(stub)\r\n\r\n\tbytePublicKey, _ := x509.MarshalPKIXPublicKey(cert.PublicKey)\r\n\treturn string(bytePublicKey), err\r\n}", "func (a *managedAddress) PubKey() chainec.PublicKey {\n\treturn a.pubKey\n}", "func (bn *BootstrapNode) GetPublicKey() crypto.PublicKey {\n\treturn bn.nodePublicKey\n}", "func getRSAPublicKey(modulus []byte, exponent []byte) (*rsa.PublicKey, error) {\n\tn := new(big.Int).SetBytes(modulus)\n\te := new(big.Int).SetBytes(exponent)\n\teInt := int(e.Int64())\n\trsaPubKey := rsa.PublicKey{N: n, E: eInt}\n\treturn &rsaPubKey, nil\n}", "func DisplayPublicKey(path string) (string) {\n dat, _ := ioutil.ReadFile(path)\n return string(dat)\n}", "func GetPublicKeyFromDB(id string) (*PublicKey, error) {\n\tpk := &PublicKey{}\n\terr := model.GetPublicKey(pk, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn pk, nil\n}", "func NewPublicKey(pk map[string]interface{}) PublicKey {\n\treturn pk\n}", "func (s *Service) GetPublicKey(keyID string) (crypto.PublicKey, error) {\n\tprivateKey, ok := s.keys[keyID]\n\tif !ok {\n\t\ts.log.Error(\"The specified key was not found\", \"keyID\", keyID)\n\t\treturn nil, signingkeys.ErrSigningKeyNotFound.Errorf(\"The specified key was not found: %s\", keyID)\n\t}\n\n\treturn privateKey.Public(), nil\n}", "func (r *Member) GetPublicKeyNoWait() {\n\tvar args [0]interface{}\n\n\tvar argsSerialized []byte\n\n\terr := proxyctx.Current.Serialize(args, &argsSerialized)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t_, err = proxyctx.Current.RouteCall(r.Reference, false, \"GetPublicKey\", argsSerialized)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func getPublicKeyHandler(w http.ResponseWriter, r *http.Request) {\n userPubHash := validateHash(r.URL.Path[len(\"/user/\"):])\n userPub := LoadPubKey(userPubHash)\n if userPub == \"\" {\n http.Error(w, \"Not found\", http.StatusNotFound)\n } else {\n w.Write([]byte(userPub))\n }\n}", "func GetPublicKey() interface{} {\n\tfmt.Println(\"get public key from JWK_URI\")\n\topts := auth0.JWKClientOptions{URI: AUTH0_DOMAIN + \"/.well-known/jwks.json\"}\n\t// Creating key cacher with max age of 100sec and max size of 5 entries.\n\t// Defaults to persistent key cacher if not specified when creating a client.\n\tkeyCacher := auth0.NewMemoryKeyCacher(time.Duration(100)*time.Second, 5)\n\tclient := auth0.NewJWKClientWithCache(opts, nil, keyCacher)\n\n\tsearchedKey, err := client.GetKey(KID)\n\n\tif err != nil {\n\t\tfmt.Println(\"Cannot get key because of\", err)\n\t\treturn nil\n\t}\n\tfmt.Println(\"key:\", searchedKey)\n\treturn searchedKey.Certificates[0].PublicKey\n}", "func GetUserPubKey(username string) (map[string]interface{}, error) {\n\ttargetUser, err := auth.NewUser(username, \"pass\")\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, errors.New(err.Error())\n\n\t}\n\n\tpubKey, err := targetUser.GetPublicKey()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, errors.New(\"No data found for : \" + username)\n\t}\n\n\tmarshalledPublicKey := x509.MarshalPKCS1PublicKey(pubKey)\n\n\treturn map[string]interface{}{\n\t\t\"publicKey\": marshalledPublicKey,\n\t}, nil\n\n}", "func (p *PrivateKey) PublicKey() *ecdsa.PublicKey {\n\treturn &p.privateKey.PublicKey\n}", "func (w *XPubWallet) GetEntry(a cipher.Address) (Entry, bool) {\n\treturn w.Entries.get(a)\n}", "func (_ArbSys *ArbSysCallerSession) GetBlsPublicKey(addr common.Address) (*big.Int, *big.Int, *big.Int, *big.Int, error) {\n\treturn _ArbSys.Contract.GetBlsPublicKey(&_ArbSys.CallOpts, addr)\n}", "func (k *KeyPair) GetPublicKey() p2pCrypto.PubKey {\n\treturn k.pubKey\n}", "func (h *handler) publicKey(w http.ResponseWriter, req *http.Request) {\n\tresponse := struct {\n\t\tPublicKey *bakery.PublicKey\n\t}{\n\t\tPublicKey: h.config.Bakery.PublicKey(),\n\t}\n\n\twriteResponse(w, http.StatusOK, response)\n}", "func (_ArbSys *ArbSysCaller) GetBlsPublicKey(opts *bind.CallOpts, addr common.Address) (*big.Int, *big.Int, *big.Int, *big.Int, error) {\n\tvar out []interface{}\n\terr := _ArbSys.contract.Call(opts, &out, \"getBlsPublicKey\", addr)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), *new(*big.Int), *new(*big.Int), *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\tout1 := *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\tout2 := *abi.ConvertType(out[2], new(*big.Int)).(**big.Int)\n\tout3 := *abi.ConvertType(out[3], new(*big.Int)).(**big.Int)\n\n\treturn out0, out1, out2, out3, err\n\n}", "func (d *DocsCrypto) GetPublic() *rsa.PublicKey {\n\td.Debug(\"gettting public key\")\n\treturn d.privateKey.Public().(*rsa.PublicKey)\n}", "func (k otherKey) Public() crypto.PublicKey {\n\treturn nil\n}", "func (n Node) PublicKey() p2pcrypto.PublicKey {\n\treturn n.pubKey\n}", "func (k PrivateKey) Public() crypto.PublicKey {\n\treturn &k.PublicKey\n}", "func (s Keygen) PublicKey() *ecdsa.PublicKey {\n\treturn nil\n}", "func (sk PrivateKey) PublicKey() PublicKey {\n\treturn PublicKey{publicKey: sk.privateKey.PublicKey()}\n}", "func (s *Server) GetTokenPublicKey(ctx context.Context, _ *pb.Noop) (*pb.TokenInfo, error) {\n\treturn &pb.TokenInfo{PublicKey: s.pubKey}, nil\n}", "func (p *PrivateKey) PublicKey() *PublicKey {\n\tresult := PublicKey(p.PrivateKey.PublicKey)\n\treturn &result\n}", "func (k *KeyPairEd25519) GetPublicKey() PublicKey {\n\treturn PublicKey{\n\t\tType: ED25519,\n\t\tData: k.privateKey.Public().(ed25519.PublicKey),\n\t}\n}", "func (kp *MockKeyProvider) GetPublicKey(keyID string) (crypto.PublicKey, error) {\n\tkey, ok := kp.PublicKeys[keyID]\n\tif !ok {\n\t\treturn nil, errors.New(\"couldn't find key\")\n\t}\n\n\treturn key, kp.Err\n}", "func (_ArbSys *ArbSysSession) GetBlsPublicKey(addr common.Address) (*big.Int, *big.Int, *big.Int, *big.Int, error) {\n\treturn _ArbSys.Contract.GetBlsPublicKey(&_ArbSys.CallOpts, addr)\n}", "func (notificationsApi *NotificationsApiV1) GetPublicKey(getPublicKeyOptions *GetPublicKeyOptions) (result *PublicKeyResponse, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(getPublicKeyOptions, \"getPublicKeyOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(getPublicKeyOptions, \"getPublicKeyOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathSegments := []string{\"v1\", \"notifications/public_key\"}\n\tpathParameters := []string{*getPublicKeyOptions.AccountID}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\t_, err = builder.ConstructHTTPURL(notificationsApi.Service.Options.URL, pathSegments, pathParameters)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range getPublicKeyOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"notifications_api\", \"V1\", \"GetPublicKey\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\tif getPublicKeyOptions.TransactionID != nil {\n\t\tbuilder.AddHeader(\"Transaction-Id\", fmt.Sprint(*getPublicKeyOptions.TransactionID))\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = notificationsApi.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalPublicKeyResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tresponse.Result = result\n\n\treturn\n}", "func (k *Keypair) PublicKey() *PubKey {\n\tpub := new(PubKey)\n\tcopy(pub[:], k.pub[:])\n\treturn pub\n}", "func (obj *key) Key() rsa.PublicKey {\n\treturn obj.ky\n}", "func (g *GPGKey) GetPublicKey() string {\n\tif g == nil || g.PublicKey == nil {\n\t\treturn \"\"\n\t}\n\treturn *g.PublicKey\n}", "func GetPublicKey(loader KeyLoader) (*rsa.PublicKey, error) {\n\tif loader == nil {\n\t\treturn nil, errors.New(\"no loader\")\n\t}\n\n\tdata, err := loader.GetBytes()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpublicPem, _ := pem.Decode(data)\n\tif publicPem.Type != \"RSA PUBLIC KEY\" {\n\t\treturn nil, errors.New(\"incorrect pem type: \" + publicPem.Type)\n\t}\n\n\tvar parsedKey interface{}\n\tif parsedKey, err = x509.ParsePKCS1PublicKey(publicPem.Bytes); err != nil {\n\t\treturn nil, emperror.Wrap(err, \"failed to load public key x509.ParsePKCS1PublicKey\")\n\t}\n\n\tif publicKey, ok := parsedKey.(*rsa.PublicKey); !ok {\n\t\treturn nil, errors.New(\"failed convert parsed key to public key\")\n\t} else {\n\t\treturn publicKey, nil\n\t}\n}", "func (r *gorumsReplica) PublicKey() hotstuff.PublicKey {\n\treturn r.pubKey\n}", "func (x *X25519) PublicKey() []byte {\n\treturn x.publicKey[:]\n}", "func (k *VrfablePrivateKey) Public() PublicKey {\n\treturn &VrfablePublicKey{&k.PublicKey}\n}", "func (o *DKSharesInfo) GetPublicKeyOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.PublicKey, true\n}", "func (e *Domain) Public() *PublicKey {\n\tif e.PublicKey != nil {\n\t\treturn e.PublicKey\n\t}\n\n\tif e.ClearPrivateKey != nil {\n\t\treturn e.ClearPrivateKey.Public()\n\t}\n\treturn nil\n}", "func PrivateKeyPublic(priv *rsa.PrivateKey,) crypto.PublicKey", "func (_IRMAScheme *IRMASchemeCaller) GetIssuerPublicKeyById(opts *bind.CallOpts, _issuerId string, _keyIndex *big.Int) (*big.Int, []byte, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t\tret1 = new([]byte)\n\t)\n\tout := &[]interface{}{\n\t\tret0,\n\t\tret1,\n\t}\n\terr := _IRMAScheme.contract.Call(opts, out, \"getIssuerPublicKeyById\", _issuerId, _keyIndex)\n\treturn *ret0, *ret1, err\n}", "func (ak *AgentKey) Key() (PublicKey, error) {\r\n\tif key, _, ok := ParsePublicKey(ak.blob); ok {\r\n\t\treturn key, nil\r\n\t}\r\n\treturn nil, errors.New(\"ssh: failed to parse key blob\")\r\n}", "func (ks *KeyStore) PublicKey(kid string) (*rsa.PublicKey, error) {\n\tks.mu.RLock()\n\tdefer ks.mu.RUnlock()\n\n\tprivateKey, found := ks.store[kid]\n\tif !found {\n\t\treturn nil, errors.New(\"kid lookup failed\")\n\t}\n\treturn &privateKey.PublicKey, nil\n}", "func (lib *PKCS11Lib) exportRSAPublicKey(session pkcs11.SessionHandle, pubHandle pkcs11.ObjectHandle) (crypto.PublicKey, error) {\n\tlogger.Tracef(\"session=0x%X, obj=0x%X\", session, pubHandle)\n\ttemplate := []*pkcs11.Attribute{\n\t\tpkcs11.NewAttribute(pkcs11.CKA_MODULUS, nil),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_PUBLIC_EXPONENT, nil),\n\t}\n\texported, err := lib.Ctx.GetAttributeValue(session, pubHandle, template)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tvar modulus = new(big.Int)\n\tmodulus.SetBytes(exported[0].Value)\n\tvar bigExponent = new(big.Int)\n\tbigExponent.SetBytes(exported[1].Value)\n\tif bigExponent.BitLen() > 32 {\n\t\treturn nil, errors.WithStack(errMalformedRSAKey)\n\t}\n\tif bigExponent.Sign() < 1 {\n\t\treturn nil, errors.WithStack(errMalformedRSAKey)\n\t}\n\texponent := int(bigExponent.Uint64())\n\tresult := rsa.PublicKey{\n\t\tN: modulus,\n\t\tE: exponent,\n\t}\n\tif result.E < 2 {\n\t\treturn nil, errors.WithStack(errMalformedRSAKey)\n\t}\n\treturn &result, nil\n}", "func (k *PrivateKeySECP256K1R) PublicKey() PublicKey {\n\tif k.pk == nil {\n\t\tk.pk = &PublicKeySECP256K1R{pk: k.sk.PubKey()}\n\t}\n\treturn k.pk\n}", "func NewPublicKey(seed Trytes, index int) (Trytes, error) {\n\tbytesSec, err := seed.Trits().Bytes()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif mKey == nil {\n\t\tkey, err := hdkey.NewMaster(bytesSec, nil, 1)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tmKey = key\n\t}\n\n\tpubKey, err := mKey.Child(uint32(index))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tpkCompressed := pubKey.PublicKey().Compress()\n\tpkInt := new(big.Int).SetBytes(pkCompressed[:])\n\tkeyTrit := make([]byte, 48)\n\tcopy(keyTrit, pkInt.Bytes())\n\ttrits, err := BytesToTrits(keyTrit)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn trits.Trytes(), err\n}", "func (d Dispatcher) PublicKey() string {\n\treturn d.GetPubString()\n}", "func dnsGetServerPublicKey(dnsParent string) *rsa.PublicKey {\n\tpubKeyPEM, err := LookupDomainKey(consts.SliverName, dnsParent)\n\tif err != nil {\n\t\t// {{if .Debug}}\n\t\tlog.Printf(\"Failed to fetch domain key %v\", err)\n\t\t// {{end}}\n\t\treturn nil\n\t}\n\n\tpubKeyBlock, _ := pem.Decode([]byte(pubKeyPEM))\n\tif pubKeyBlock == nil {\n\t\t// {{if .Debug}}\n\t\tlog.Printf(\"failed to parse certificate PEM\")\n\t\t// {{end}}\n\t\treturn nil\n\t}\n\t// {{if .Debug}}\n\tlog.Printf(\"RSA Fingerprint: %s\", fingerprintSHA256(pubKeyBlock))\n\t// {{end}}\n\n\tcertErr := rootOnlyVerifyCertificate([][]byte{pubKeyBlock.Bytes}, [][]*x509.Certificate{})\n\tif certErr == nil {\n\t\tcert, _ := x509.ParseCertificate(pubKeyBlock.Bytes)\n\t\treturn cert.PublicKey.(*rsa.PublicKey)\n\t}\n\n\t// {{if .Debug}}\n\tlog.Printf(\"Invalid certificate %v\", err)\n\t// {{end}}\n\treturn nil\n}", "func NewPublicKey(r io.Reader) (*PublicKey, error) {\n\trawPub, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkey, _, _, _, err := ssh.ParseAuthorizedKey(rawPub)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &PublicKey{key: key}, nil\n}", "func publicKeyHandler(w http.ResponseWriter, r *http.Request) {\n\tuserPubHash := validateHash(r.URL.Path[len(\"/user/\"):])\n\tuserPub := LoadPubKey(userPubHash)\n\tif userPub == \"\" {\n\t\thttp.Error(w, \"Not found\", http.StatusNotFound)\n\t} else {\n\t\tw.Write([]byte(userPub))\n\t}\n}", "func (k *PrivateKey) PublicKey() *PublicKey {\n\tpointG2 := curve.GenG2.Mul(frToRepr(k.FR))\n\n\treturn &PublicKey{pointG2}\n}", "func (srv *Server) HostPublicKey() (types.SiaPublicKey, error) {\n\tif srv.node.Host == nil {\n\t\treturn types.SiaPublicKey{}, errors.New(\"can't get public host key of a non-host node\")\n\t}\n\treturn srv.node.Host.PublicKey(), nil\n}", "func (k *EdX25519Key) PublicKey() *EdX25519PublicKey {\n\treturn k.publicKey\n}" ]
[ "0.6892429", "0.68824655", "0.6855572", "0.68315506", "0.67732835", "0.6762745", "0.673968", "0.67140543", "0.667578", "0.66340315", "0.66220355", "0.6611298", "0.6580103", "0.6537619", "0.6503447", "0.6442019", "0.6441319", "0.6419658", "0.6399346", "0.63818866", "0.63710785", "0.63670164", "0.63117725", "0.62948847", "0.6286688", "0.62720555", "0.62667996", "0.62655824", "0.6258111", "0.6245775", "0.62413955", "0.62366194", "0.62303513", "0.62303513", "0.62212956", "0.6209783", "0.62081224", "0.6195677", "0.6185614", "0.6138895", "0.61350125", "0.61162734", "0.610378", "0.61005634", "0.60836947", "0.6062527", "0.60604787", "0.6033073", "0.6019353", "0.60143447", "0.6007136", "0.59818774", "0.59760135", "0.59701115", "0.5969596", "0.5963899", "0.59581375", "0.5942705", "0.58809525", "0.5880744", "0.5874513", "0.5872507", "0.58722407", "0.58694243", "0.5860168", "0.5858917", "0.585802", "0.5845215", "0.5842221", "0.5834345", "0.5833658", "0.5833142", "0.58294564", "0.5826411", "0.5818385", "0.58161014", "0.5808515", "0.5801777", "0.57978207", "0.5796589", "0.5792579", "0.5790896", "0.578813", "0.57765573", "0.5768135", "0.5765756", "0.5760818", "0.5759488", "0.5758738", "0.57570803", "0.5731719", "0.57280606", "0.57272947", "0.5719642", "0.5708272", "0.57071906", "0.5704055", "0.57038957", "0.57024723", "0.5696997" ]
0.7593955
0
NumMessageKeys implemented in memory.
func (ms *MemStore) NumMessageKeys(sessionKey string) (uint64, error) { s, ok := ms.sessions[sessionKey] if !ok { return 0, log.Errorf("memstore: no session found for %s", sessionKey) } return uint64(len(s.send)), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Message) NKeys() int { return 12 }", "func (m *SubMessage) NKeys() int { return 4 }", "func (p BnetAuthCheckPacket) NumKeys() int {\n\tpb := PacketBuffer(p)\n\treturn pb.Uint32(16)\n}", "func (m *WatcherMetrics) NKeys() int { return 4 }", "func (m *Metric) NKeys() int { return 5 }", "func (d *Data) NKeys() int { return 1 }", "func (m *NodeMetricsMap) NKeys() int { return 0 }", "func (m *NodeMetrics) NKeys() int { return 3 }", "func (t *Tags) NKeys() int { return 0 }", "func (m *Metadata) NKeys() int { return 1 }", "func (*Integer) NKeys() int { return 2 }", "func (k *Keychain) KeyCount() int {\n\tk.m.RLock()\n\tc := len(k.keys)\n\tk.m.RUnlock()\n\treturn c\n}", "func (*Object) NKeys() int { return 2 }", "func (*Number) NKeys() int { return 2 }", "func (u *UserDetails) NKeys() int {\n\treturn 4 + u.UserMeta.NKeys()\n}", "func (z *KeyInv) Msgsize() (s int) {\n\ts = 1 + 4 + msgp.BytesPrefixSize + len(z.Key) + 4 + msgp.StringPrefixSize + len(z.Who) + 5 + msgp.TimeSize + 5 + msgp.Int64Size + 8 + msgp.BytesPrefixSize + len(z.Blake2b) + 4 + msgp.BytesPrefixSize + len(z.Val)\n\treturn\n}", "func (s *TaskDetails) NKeys() int {\n\treturn 7 + s.TaskMeta.NKeys()\n}", "func (*Array) NKeys() int { return 2 }", "func (*Null) NKeys() int { return 2 }", "func (v *FileSystemWatcher) NKeys() int { return 2 }", "func (v *ConfigurationParams) NKeys() int { return 1 }", "func (s *Store) numEntries() int {\r\n\treturn len(s.GetKeys())\r\n}", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (v *ConfigurationItem) NKeys() int { return 2 }", "func (da *DoubleArray) NumKeys() int {\n\treturn da.numKeys\n}", "func (s *ScanKeys) Count() int {\n\treturn len(s.skbs)\n}", "func (d *tstKeyK) Size() int {\n\treturn int(unsafe.Sizeof(tstKeyK{}))\n}", "func (s *session) getMessageCount() uint64 {\n\treturn uint64(len(s.msgSizes) - len(s.markedDeleted))\n}", "func (v *FileEvent) NKeys() int { return 2 }", "func (c *Cache) Len() int {\n\treturn len(c.keyMap)\n}", "func (v *PublishDiagnosticsParams) NKeys() int { return 3 }", "func (z dataUsageHashMap) Msgsize() (s int) {\n\ts = msgp.ArrayHeaderSize\n\tfor zb0004 := range z {\n\t\ts += msgp.StringPrefixSize + len(zb0004)\n\t}\n\treturn\n}", "func (*Boolean) NKeys() int { return 3 }", "func (*String) NKeys() int { return 2 }", "func (a ByKey) Len() int {\n\treturn len(a)\n}", "func (p *Properties) NumRangeKeys() uint64 {\n\treturn p.NumRangeKeyDels + p.NumRangeKeySets + p.NumRangeKeyUnsets\n}", "func (i IntHashMap[T, V]) Len() int {\n\t// DEBUG:\n\tif len(i.hashToKey) != len(i.hashToVal) {\n\t\tpanic(\"hashToKey and hashToVal have different lengths\")\n\t}\n\treturn len(i.hashToKey)\n}", "func (keys *DupMD5Keys) Len() int {\n\treturn len(keys.md5Keys)\n}", "func (z *BotRecord) Msgsize() (s int) {\n\ts = 1 + 2 + z.ID.Msgsize() + 2 + z.Addresses.Msgsize() + 2 + z.Names.Msgsize() + 2 + z.PublicKey.Msgsize() + 2 + z.Expiration.Msgsize()\n\treturn\n}", "func (d DBase) CountKeys(table string) int {\n\tcount, err := d.Store.CountKeys(table)\n\tCritical(err)\n\treturn count\n}", "func InternalNodeNumKeys(node []byte) *uint32 {\n\treturn (*uint32)(unsafe.Pointer(&node[InternalNodeNumKeysOffset]))\n}", "func (w *Window) NKeys() int { return 3 }", "func (sm safeMap) Len() int {\n\treply := make(chan interface{})\n\tsm <- commandData{action: COUNT, result: reply}\n\treturn (<-reply).(int)\n}", "func (hm HashMap) Len(ctx context.Context) (int64, error) {\n\treq := newRequest(\"*2\\r\\n$4\\r\\nHLEN\\r\\n$\")\n\treq.addString(hm.name)\n\treturn hm.c.cmdInt(ctx, req)\n}", "func (z *MessageControl) Msgsize() (s int) {\n\ts = 1 + 5\n\tif z.Hash == nil {\n\t\ts += msgp.NilSize\n\t} else {\n\t\ts += z.Hash.Msgsize()\n\t}\n\treturn\n}", "func (t *SBF) Keys() uint64 {\n return atomic.LoadUint64(&t.keys)\n}", "func (m *OMap) Count() int {\n\treturn len(m.keys)\n}", "func (m *peerMap) nodeCount() int {\n\treturn len(m.byNodeKey)\n}", "func (z *TokenInfo) Msgsize() (s int) {\n\ts = 1 + z.PublicOffering.Msgsize() + z.Sender.Msgsize()\n\tif z.CurrentValue == nil {\n\t\ts += msgp.NilSize\n\t} else {\n\t\ts += z.CurrentValue.Msgsize()\n\t}\n\ts += msgp.BoolSize\n\treturn\n}", "func (t *Map) Len() int {\n\treturn t.keys.Len()\n}", "func (z GraphiteApiItems) Msgsize() (s int) {\n\ts = msgp.ArrayHeaderSize\n\tfor zhct := range z {\n\t\tif z[zhct] == nil {\n\t\t\ts += msgp.NilSize\n\t\t} else {\n\t\t\ts += z[zhct].Msgsize()\n\t\t}\n\t}\n\treturn\n}", "func (z *TxBaseJson) Msgsize() (s int) {\n\ts = 1 + msgp.Uint16Size + z.Hash.Msgsize() + z.ParentsHash.Msgsize() + msgp.Uint64Size + msgp.Uint64Size + z.PublicKey.Msgsize() + z.Signature.Msgsize() + msgp.Uint64Size + msgp.Uint64Size + msgp.ByteSize\n\treturn\n}", "func (m *OrderedUintMap) Len() int { return len(m.m) }", "func (v *WorkspaceFolder) NKeys() int { return 2 }", "func (m *Map) Len() int {\n\tm.store.RLock()\n\tdefer m.store.RUnlock()\n\tn := len(m.store.kv)\n\treturn n\n}", "func (c *NoReplKeyCache) Len() int {\n\tc.lock.RLock()\n\tlength := len(c.cache)\n\tc.lock.RUnlock()\n\treturn length\n}", "func LLEN() int {\n\treturn globalListCache.countKeys()\n}", "func (m MessageID) size() int {\n\treturn INTEGER(m).size()\n}", "func (self *SimpleEqualDistribution) Len() int {\n\treturn len(self.keys)\n}", "func (k keyDecls) Len() int {\n\treturn len(k)\n}", "func (p OrderedMap) Len() int {\n\treturn len(p.keys)\n}", "func (fi *FastIntegerHashMap) Len() uint64 {\n\treturn fi.count\n}", "func (g *GlobalMessages) Len() int {\n\tg.locker.RLock()\n\tdefer g.locker.RUnlock()\n\treturn len(g.Events)\n}", "func (z SequencerHeaders) Msgsize() (s int) {\n\ts = msgp.ArrayHeaderSize\n\tfor zb0004 := range z {\n\t\tif z[zb0004] == nil {\n\t\t\ts += msgp.NilSize\n\t\t} else {\n\t\t\ts += 1 + z[zb0004].Hash.Msgsize() + msgp.Uint64Size\n\t\t}\n\t}\n\treturn\n}", "func messageKey(messageKeyLarge []byte) bin.Int128 {\n\tvar v bin.Int128\n\tb := messageKeyLarge[8 : 16+8]\n\tcopy(v[:len(b)], b)\n\treturn v\n}", "func (params *KeyParameters) MaxMsgBytes() int {\n\treturn (params.P.BitLen() / 8) - 4\n}", "func (z *MessageTxsRequest) Msgsize() (s int) {\n\ts = 1 + z.Hashes.Msgsize()\n\tif z.SeqHash == nil {\n\t\ts += msgp.NilSize\n\t} else {\n\t\ts += z.SeqHash.Msgsize()\n\t}\n\ts += msgp.Uint64Size + msgp.Uint32Size\n\treturn\n}", "func (c *TwoQueueCache[K, V]) Len() int {\n\tc.lock.RLock()\n\tdefer c.lock.RUnlock()\n\treturn c.recent.Len() + c.frequent.Len()\n}", "func (z *MessageGetMsg) Msgsize() (s int) {\n\ts = 1 + 5\n\tif z.Hash == nil {\n\t\ts += msgp.NilSize\n\t} else {\n\t\ts += z.Hash.Msgsize()\n\t}\n\treturn\n}", "func (a *AvroEventBatchEncoder) Size() int {\n\tif a.resultBuf == nil {\n\t\treturn 0\n\t}\n\tsum := 0\n\tfor _, msg := range a.resultBuf {\n\t\tsum += len(msg.Key)\n\t\tsum += len(msg.Value)\n\t}\n\treturn sum\n}", "func (z *metacache) Msgsize() (s int) {\n\ts = 1 + 3 + msgp.StringPrefixSize + len(z.id) + 2 + msgp.StringPrefixSize + len(z.bucket) + 5 + msgp.StringPrefixSize + len(z.root) + 4 + msgp.BoolSize + 4 + msgp.StringPrefixSize + len(z.filter) + 5 + msgp.Uint8Size + 4 + msgp.BoolSize + 4 + msgp.StringPrefixSize + len(z.error) + 3 + msgp.TimeSize + 4 + msgp.TimeSize + 2 + msgp.TimeSize + 3 + msgp.TimeSize + 2 + msgp.Uint8Size\n\treturn\n}", "func getMapLen(dec *msgpack.Decoder) (n int, nextKey func() int32, err error) {\n\tism, err := isMap(dec)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif ism {\n\t\tn, err = dec.DecodeMapLen()\n\t\treturn\n\t}\n\n\tn, err = dec.DecodeArrayLen()\n\tvar idx int32 // remember; lua indexes are 1 based, so we ++ and then return\n\tnextKey = func() int32 { idx++; return idx }\n\treturn\n}", "func (i StringHashMap[T, V]) Len() int {\n\t// DEBUG:\n\tif len(i.hashToKey) != len(i.hashToVal) {\n\t\tpanic(\"hashToKey and hashToVal have different lengths\")\n\t}\n\treturn len(i.hashToKey)\n}", "func (m *OrderedMap) Len() int {\n\treturn len(m.keypairs)\n}", "func (kr *KeyRequest) Size() int {\n\treturn kr.S\n}", "func (z *HashOrNumber) Msgsize() (s int) {\n\ts = 1\n\tif z.Hash == nil {\n\t\ts += msgp.NilSize\n\t} else {\n\t\ts += z.Hash.Msgsize()\n\t}\n\ts += msgp.Uint64Size\n\treturn\n}", "func (z *MessageHeaderRequest) Msgsize() (s int) {\n\ts = 1 + 1\n\tif z.Origin.Hash == nil {\n\t\ts += msgp.NilSize\n\t} else {\n\t\ts += z.Origin.Hash.Msgsize()\n\t}\n\ts += msgp.Uint64Size + msgp.Uint64Size + msgp.Uint64Size + msgp.BoolSize + msgp.Uint32Size\n\treturn\n}", "func (dict *Dictionary) NumberOfElements() int {\n\tdict.lock.RLock()\n\tdefer dict.lock.RUnlock()\n\treturn len(dict.elements)\n}", "func (z *ClientStatsBucket) Msgsize() (s int) {\n\ts = 1 + 6 + msgp.Uint64Size + 9 + msgp.Uint64Size + 6 + msgp.ArrayHeaderSize\n\tfor za0001 := range z.Stats {\n\t\tif z.Stats[za0001] == nil {\n\t\t\ts += msgp.NilSize\n\t\t} else {\n\t\t\ts += z.Stats[za0001].Msgsize()\n\t\t}\n\t}\n\ts += 15 + msgp.Int64Size\n\treturn\n}", "func (z Bucket) Msgsize() (s int) {\n\ts = msgp.ArrayHeaderSize\n\tfor zhct := range z {\n\t\ts += msgp.BytesPrefixSize + len(z[zhct])\n\t}\n\treturn\n}" ]
[ "0.81549484", "0.78064597", "0.75367594", "0.7298265", "0.7173821", "0.7139803", "0.7030167", "0.6948036", "0.6934252", "0.69107145", "0.6790297", "0.6749787", "0.6585243", "0.65516406", "0.6520214", "0.6461423", "0.64228487", "0.64208007", "0.63739985", "0.63620496", "0.63162565", "0.63138884", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6302333", "0.62972224", "0.6277249", "0.6240042", "0.6198029", "0.61766505", "0.6162629", "0.61595035", "0.6155946", "0.61409086", "0.61296475", "0.6123562", "0.6114381", "0.6106895", "0.6093166", "0.607992", "0.60797745", "0.6073021", "0.6072284", "0.60511374", "0.6050677", "0.6035836", "0.6031137", "0.60281783", "0.5991873", "0.59917295", "0.5989335", "0.5983765", "0.5982842", "0.5979868", "0.5975639", "0.59737676", "0.5964078", "0.5962425", "0.5952884", "0.59452987", "0.59093523", "0.5899819", "0.58952636", "0.58835226", "0.58730805", "0.5872093", "0.5865144", "0.58623147", "0.5860502", "0.58582306", "0.5842062", "0.58366495", "0.5834903", "0.5834856", "0.5830517", "0.5817592", "0.5804193", "0.5803685", "0.5803426", "0.57928526", "0.57898957" ]
0.80916345
1
GetMessageKey implemented in memory.
func (ms *MemStore) GetMessageKey( sessionKey string, sender bool, msgIndex uint64, ) (*[64]byte, error) { s, ok := ms.sessions[sessionKey] if !ok { return nil, log.Errorf("memstore: no session found for %s", sessionKey) } if msgIndex >= uint64(len(s.send)) { return nil, log.Error("memstore: message index out of bounds") } var key string var party string if sender { key = s.send[msgIndex] party = "sender" } else { key = s.recv[msgIndex] party = "recipient" } // make sure key wasn't used yet if key == "" { return nil, log.Error(session.ErrMessageKeyUsed) } // decode key var messageKey [64]byte k, err := base64.Decode(key) if err != nil { return nil, log.Errorf("memstore: cannot decode %s key for %s", party, sessionKey) } if copy(messageKey[:], k) != 64 { return nil, log.Errorf("memstore: %s key for %s has wrong length", party, sessionKey) } return &messageKey, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m Message) Key() []byte {\n\tstart, end, size := m.keyOffsets()\n\tif size == -1 {\n\t\treturn nil\n\t}\n\treturn m[start+4 : end]\n}", "func MessageKey(authKey Key, plaintextPadded []byte, mode Side) bin.Int128 {\n\t// `msg_key_large = SHA256 (substr (auth_key, 88+x, 32) + plaintext + random_padding);`\n\tmsgKeyLarge := msgKeyLarge(authKey, plaintextPadded, mode)\n\t// `msg_key = substr (msg_key_large, 8, 16);`\n\treturn messageKey(msgKeyLarge)\n}", "func messageKey(messageKeyLarge []byte) bin.Int128 {\n\tvar v bin.Int128\n\tb := messageKeyLarge[8 : 16+8]\n\tcopy(v[:len(b)], b)\n\treturn v\n}", "func (st *MemStorage) GetKey(gun, role string) (algorithm string, public []byte, err error) {\n\t// no need for lock. It's ok to return nil if an update\n\t// wasn't observed\n\tg, ok := st.keys[gun]\n\tif !ok {\n\t\treturn \"\", nil, &ErrNoKey{gun: gun}\n\t}\n\tk, ok := g[role]\n\tif !ok {\n\t\treturn \"\", nil, &ErrNoKey{gun: gun}\n\t}\n\n\treturn k.algorithm, k.public, nil\n}", "func (symmetricKey *SymmetricKey) GetKey() []byte {\n\tsymmetricKey.mutex.RLock()\n\tdefer symmetricKey.mutex.RUnlock()\n\treturn symmetricKey.SymmetricKey\n}", "func MsgKey(s string) {\n\tmsgKey = s\n\tgenLevelSlices()\n}", "func (m *RegistryKeyState) GetKey()(*string) {\n return m.key\n}", "func (g *GetLanguagePackStringRequest) GetKey() (value string) {\n\tif g == nil {\n\t\treturn\n\t}\n\treturn g.Key\n}", "func GetKey(size int) []byte {\n\treturn GetIV(size)\n}", "func (m *message) Key() string {\n\treturn m.TS.Format(time.RFC3339) + \"|\" + m.User\n}", "func (m LocalTransit) GetKey(context string) ([]byte, error) {\n\tif m.KeyProvider == nil {\n\t\treturn nil, ex.New(\"local transit; key provider is unset\")\n\t}\n\treturn m.KeyProvider(context)\n}", "func (p *Provider) GetKey() interface{} {\n\treturn p.key\n}", "func (m *KeyValue) GetKey()(*string) {\n return m.key\n}", "func (c *Counter) GetKey() string {\n\treturn c.key\n}", "func MsgKey(R, P *btcec.PublicKey, m []byte) *btcec.PublicKey {\n\th := Hash(R.SerializeCompressed(), m)\n\th = new(big.Int).Mod(new(big.Int).Neg(h), btcec.S256().N)\n\thP := new(btcec.PublicKey)\n\thP.X, hP.Y = btcec.S256().ScalarMult(P.X, P.Y, h.Bytes())\n\treturn SumPubs(R, hP)\n}", "func (c Node) GetKey() string {\n\treturn c.key\n}", "func (entry *LogEntry) GetKey() []byte {\n\treturn entry.getWriteRequest().GetKey()\n}", "func GetKey(t *testing.T) []byte {\n\tt.Helper()\n\n\tk, _ := GeneratePrivateKey()\n\treturn k.Data[:]\n}", "func (ips *IPAMState) GetKey() string {\n\treturn ips.IPAMPolicy.GetKey()\n}", "func (i SNSProtocol) Key() string {\n\tif val, ok := _SNSProtocolValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "func (cg *ConsumerGroup) GetKey() types.NamespacedName {\n\treturn types.NamespacedName{\n\t\tNamespace: cg.GetNamespace(),\n\t\tName: cg.GetName(),\n\t}\n}", "func (k Keeper) GetMessage(ctx sdk.Context, id uint64) types.Message {\n\tstore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.MessageKey))\n\tvar message types.Message\n\tk.cdc.MustUnmarshalBinaryBare(store.Get(GetMessageIDBytes(id)), &message)\n\treturn message\n}", "func (key twofishKey) Key() []byte {\n\treturn key[:]\n}", "func GetMessage(locale, key string) string {\n\treturn locales[locale].Langs[key].(string)\n}", "func (s HTTPStore) GetKey(role data.RoleName) ([]byte, error) {\n\turl, err := s.buildKeyURL(role)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq, err := http.NewRequest(\"GET\", url.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := s.roundTrip.RoundTrip(req)\n\tif err != nil {\n\t\treturn nil, NetworkError{Wrapped: err}\n\t}\n\tdefer resp.Body.Close()\n\tif err := translateStatusToError(resp, role.String()+\" key\"); err != nil {\n\t\treturn nil, err\n\t}\n\tb := io.LimitReader(resp.Body, MaxKeySize)\n\tbody, err := ioutil.ReadAll(b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn body, nil\n}", "func (d *Dispatcher) key(m *Message) string {\n\t// Message to runnable: Cmds\n\tif m.To != nil && m.To.Type == RunnableIdentifierType {\n\t\treturn fmt.Sprintf(\"to.runnable.%s.%s\", *m.To.Worker, *m.To.Name)\n\t}\n\n\t// Message from runnable: Events\n\tif m.From.Type == RunnableIdentifierType {\n\t\treturn fmt.Sprintf(\"from.runnable.%s.%s\", *m.From.Worker, *m.From.Name)\n\t}\n\treturn \"default\"\n}", "func (eln *EmptyLeafNode) GetKey() []byte {\n\treturn nil\n}", "func (area *MineArea) GetKey() string {\n\treturn GetKey(area.X, area.Y)\n}", "func (m *KeyUint) Key() driver.Value { return driver.Value(m.ID) }", "func (d *DynamicTranslation) Key() string {\n\treturn translationKey(d.RealmID, d.Locale, d.MessageID)\n}", "func (adminport *Adminport) GetMessageKeyFromRequest(r *http.Request) (string, error) {\n\tvar key string\n\t// remove adminport url prefix from path\n\tpath := r.URL.Path[len(base.AdminportUrlPrefix):]\n\t// remove trailing \"/\" in path if it exists\n\tif strings.HasSuffix(path, base.UrlDelimiter) {\n\t\tpath = path[:len(path)-1]\n\t}\n\n\tfor _, staticPath := range StaticPaths {\n\t\tif path == staticPath {\n\t\t\t// if path in url is a static path, use it as name\n\t\t\tkey = path\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif len(key) == 0 {\n\t\t// if path does not match any static paths, check if it has a prefix that matches dynamic path prefixes\n\t\tfor _, dynPathPrefix := range DynamicPathPrefixes {\n\t\t\tif strings.HasPrefix(path, dynPathPrefix) {\n\t\t\t\tkey = dynPathPrefix + DynamicSuffix\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(key) == 0 {\n\t\treturn \"\", base.InvalidPathInHttpRequestError(r.URL.Path)\n\t} else {\n\t\t// add http method suffix to name to ensure uniqueness\n\t\tkey += base.UrlDelimiter + strings.ToUpper(r.Method)\n\n\t\tlogger_ap.Debugf(\"Request key decoded: %v\\n\", key)\n\n\t\treturn key, nil\n\t}\n}", "func (l *LangPackStringPluralized) GetKey() (value string) {\n\tif l == nil {\n\t\treturn\n\t}\n\treturn l.Key\n}", "func (symmetricKey *SymmetricKey) GetKeyID() string {\n\tsymmetricKey.mutex.RLock()\n\tdefer symmetricKey.mutex.RUnlock()\n\treturn symmetricKey.KeyID\n}", "func (e GetMessageRequestValidationError) Key() bool { return e.key }", "func msgToKey(m *dns.Msg) (b []byte) {\n\tq := m.Question[0]\n\tname := q.Name\n\tb = make([]byte, packedMsgLenSz+packedMsgLenSz+len(name))\n\n\t// Put QTYPE, QCLASS, and QNAME.\n\tbinary.BigEndian.PutUint16(b, q.Qtype)\n\tbinary.BigEndian.PutUint16(b[packedMsgLenSz:], q.Qclass)\n\tcopy(b[2*packedMsgLenSz:], strings.ToLower(name))\n\n\treturn b\n}", "func (kl *Keylogger) GetKey() Key {\n\tactiveKey := 0\n\tvar keyState uint16\n\n\tfor i := 0; i < 256; i++ {\n\t\tkeyState = w32.GetAsyncKeyState(i)\n\n\t\t// Check if the most significant bit is set (key is down)\n\t\t// And check if the key is not a non-char key (except for space, 0x20)\n\t\tif keyState&(1<<15) != 0 && !(i < 0x2F && i != 0x20) && (i < 160 || i > 165) && (i < 91 || i > 93) {\n\t\t\tactiveKey = i\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif activeKey != 0 {\n\t\tif activeKey != kl.lastKey {\n\t\t\tkl.lastKey = activeKey\n\t\t\treturn kl.ParseKeycode(activeKey, keyState)\n\t\t}\n\t} else {\n\t\tkl.lastKey = 0\n\t}\n\n\treturn Key{Empty: true}\n}", "func (l *LangPackString) GetKey() (value string) {\n\tif l == nil {\n\t\treturn\n\t}\n\treturn l.Key\n}", "func (g *Generator) GetKey(K string) interface{} {\n\treturn g.data[K]\n}", "func (m *Messages) Get(key string) string {\n\tresult, ok := (*m)[key]\n\tif ok == false {\n\t\tresult = key\n\t}\n\treturn result\n}", "func msgKeyLarge(authKey Key, plaintextPadded []byte, mode Side) []byte {\n\th := getSHA256()\n\tdefer sha256Pool.Put(h)\n\n\tx := getX(mode)\n\t_, _ = h.Write(authKey[88+x : 32+88+x])\n\t_, _ = h.Write(plaintextPadded)\n\treturn h.Sum(nil)\n}", "func (m *Message) ObjectStorageKey() []byte {\n\treturn m.ID().Bytes()\n}", "func (i service) GetKey(did id.DID, key [32]byte) (*id.KeyResponse, error) {\n\tcontract, opts, _, err := i.prepareCall(did)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult, err := contract.GetKey(opts, key)\n\n\tif err != nil {\n\t\treturn nil, errors.New(\"Could not call identity contract: %v\", err)\n\t}\n\n\treturn &id.KeyResponse{result.Key, result.Purposes, result.RevokedAt}, nil\n\n}", "func (m *Metric) GetKey() string {\n\tif m == nil || m.Key == nil {\n\t\treturn \"\"\n\t}\n\treturn *m.Key\n}", "func (c VpnCredential) GetKey() string {\n\treturn c.Key\n}", "func (e EnumByte) Key() EnumByteKey {\n return EnumByteKey(e)\n}", "func (t *Tkeyid) GetKey(id uint) (key string, ok bool) {\n\tkey, ok = t.idtokey[id]\n\treturn\n}", "func hostGetKeyId(key *byte, size int32) int32", "func (s *Arena) getKey(offset uint32, size uint16) []byte {\n\treturn s.data[offset : offset+uint32(size)]\n}", "func (kl *Keylogger) GetKey() Key {\n\tactiveKey := 0\n\tvar keyState uint16\n\n\tfor i := 0; i < 256; i++ {\n\t\tkeyState = w32.GetAsyncKeyState(i)\n\n\t\t// Check if the key is pressed (if the most significant bit is set)\n\t\t// And check if the key is not a ASCII control characters (except for enter, 13)\n\t\tif keyState&(1<<15) != 0 && !(i < 32 && i != 13) && (i < 160 || i > 165) {\n\t\t\tactiveKey = i\n\t\t\tif i == 13 {\n\t\t\t\tactiveKey = 32\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t}\n\n\tif activeKey != 0 {\n\t\tif activeKey != kl.lastKey {\n\t\t\tkl.lastKey = activeKey\n\t\t\treturn kl.ParseKeycode(activeKey, keyState)\n\t\t}\n\t} else {\n\t\tkl.lastKey = 0\n\t}\n\n\treturn Key{Empty: true}\n}", "func (l *LangPackStringDeleted) GetKey() (value string) {\n\tif l == nil {\n\t\treturn\n\t}\n\treturn l.Key\n}", "func (d Digest) GetKey(format KeyFormat) string {\n\tswitch format {\n\tcase KeyWithoutInstance:\n\t\t_, _, _, sizeBytesEnd := d.unpack()\n\t\treturn d.value[:sizeBytesEnd]\n\tcase KeyWithInstance:\n\t\treturn d.value\n\tdefault:\n\t\tpanic(\"Invalid digest key format\")\n\t}\n}", "func GetKeyID(recoveryFlag int) int {\n\treturn (recoveryFlag - 27) & 0b11\n}", "func (a *LocalKeyAgent) GetCoreKey() (*Key, error) {\n\treturn a.GetKey(\"\")\n}", "func (s *GCPCKMSSeal) KeyID() string {\n\treturn s.currentKeyID.Load().(string)\n}", "func (*produceRequest) Key() int16 { return 0 }", "func (pdu *Pdu) AsMapKey() string {\n // return fmt.Sprintf(\"%d[%x]\", pdu.MessageID, pdu.Token)\n return fmt.Sprintf(\"%x\", pdu.Token)\n // return fmt.Sprintf(\"%d\", pdu.MessageID)\n}", "func (s *Subscription) GetKey() string {\n\tbaseURL, _ := url.Parse(s.BaseURL)\n\tfields := []string{\n\t\ts.VCSType,\n\t\tbaseURL.Hostname(),\n\t\ts.OrgName,\n\t\ts.RepoName,\n\t}\n\tkey := strings.Join(fields, \"_\")\n\treturn util.GetKeyHash(key)\n}", "func (pmm *PrivateMsgMap) GetMsg(origin string, index uint32) string {\n\tvar toReturn string\n\tpmm.RLock()\n\tvalue, _ := pmm.messages[origin]\n\ttoReturn = value[index]\n\tpmm.RUnlock()\n\treturn toReturn\n}", "func (n *lnode) key() []byte {\n\tbuf := (*[maxAllocSize]byte)(unsafe.Pointer(n))\n\treturn buf[n.pos : n.pos+n.ksize]\n}", "func GetKey(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *KeyState, opts ...pulumi.ResourceOption) (*Key, error) {\n\tvar resource Key\n\terr := ctx.ReadResource(\"google-native:apikeys/v2:Key\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (b *BigIP) GetKey(name string) (*Key, error) {\n\tvar key Key\n\terr, ok := b.getForEntity(&key, uriSys, uriCrypto, uriKey, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !ok {\n\t\treturn nil, nil\n\t}\n\n\treturn &key, nil\n}", "func (s *Connection) GetKey() ConnectionName {\n\tif s == nil {\n\t\treturn \"\"\n\t}\n\treturn s.Key\n}", "func (o *CustomHostMetadataKey) GetKey() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Key\n}", "func (m *SearchBucket) GetKey()(*string) {\n return m.key\n}", "func (r *MCRequest) Key() []byte {\n\treturn r.key\n}", "func (w *Wallet) GetKey(address types.UnlockHash) (pk types.PublicKey, sk types.ByteSlice, err error) {\n\tw.mu.RLock()\n\tpk, sk, err = w.getKey(address)\n\tw.mu.RUnlock()\n\treturn\n}", "func (e ApplicationPubSub_MessageValidationError) Key() bool { return e.key }", "func getKey(data string) string {\n\tsign := md5.Sum([]byte(data))\n\tsignStr := fmt.Sprintf(\"%x\", sign)\n\treturn signStr[:7]\n}", "func (v *Value) GetKey() *string {\n\tret := C.zj_GetKey(v.V)\n\tif ret == nil {\n\t\treturn nil\n\t}\n\tretStr := C.GoString(ret)\n\treturn &retStr\n}", "func (req *RequestMessage) GetAPIKey() int16 {\n\treturn req.kind\n}", "func (keyRing *KeyRing) GetKey(n int) (*Key, error) {\n\tif n >= keyRing.CountEntities() {\n\t\treturn nil, errors.New(\"gopenpgp: out of bound when fetching key\")\n\t}\n\treturn &Key{keyRing.entities[n]}, nil\n}", "func (o *LabelProperties) GetKey() *string {\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\treturn o.Key\n\n}", "func (l *License) GetKey() string {\n\tif l == nil || l.Key == nil {\n\t\treturn \"\"\n\t}\n\treturn *l.Key\n}", "func (o *LongProperty) GetKey() string {\n\tif o == nil || o.Key == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Key\n}", "func (p *PKCS11) GetKeyID() (err error) {\n findTemplate := []*pkcs11.Attribute{\n pkcs11.NewAttribute(pkcs11.CKA_ID, true), // KeyID\n pkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_PRIVATE_KEY),\n pkcs11.NewAttribute(pkcs11.CKA_PRIVATE, true),\n pkcs11.NewAttribute(pkcs11.CKA_KEY_TYPE, pkcs11.CKK_RSA),\n }\n\n p.Ctx.FindObjectsInit(p.SessionHandle, findTemplate)\n obj, _, err := p.Ctx.FindObjects(p.SessionHandle, 1000)\n if err != nil {\n return\n }\n\n err = p.Ctx.FindObjectsFinal(p.SessionHandle)\n if err != nil {\n return\n }\n\n p.KeyID = map[int][]byte{}\n for num, objValue := range obj {\n attrs, _ := p.Ctx.GetAttributeValue(p.SessionHandle, objValue, findTemplate)\n p.KeyID[num] = attrs[0].Value\n }\n\n return\n}", "func (k *Key) GetKey() string {\n\tif k == nil || k.Key == nil {\n\t\treturn \"\"\n\t}\n\treturn *k.Key\n}", "func (sgp *SgpolicyState) GetKey() string {\n\treturn sgp.NetworkSecurityPolicy.GetKey()\n}", "func getKey() (string, error) {\n\tvar b [KeyLen]byte\n\t_, err := rand.Read(b[:])\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn hex.EncodeToString(b[:]), nil\n}", "func getKmsKeyFromKeyCache(keyHandle string) (string, string, error) {\n\tcounter := 0\n\tgoto GetKey\nGetKey:\n\t//search for the key in keyring\n\tdata, _, err := getKeyFromKeyCache(keyHandle)\n\tif err != nil {\n\t\tlogrus.Debugf(\"secureoverlay2: Error: Not able to get the key from keyring - %s, counter = %d\", err.Error(), counter)\n\t\tif counter < MAXKEYPOLL {\n\t\t\tgoto WaitForKey\n\t\t}\n\t\treturn \"\", \"\", err\n\t}\n\tlogrus.Debugf(\"secureoverlay2: Got the key in the keyring\")\n\treturn data, \"\", nil\n\nWaitForKey:\n\tlogrus.Debugf(\"secureoverlay2: Waiting for the key\")\n\ttime.Sleep(250 * time.Millisecond)\n\tcounter++\n\tgoto GetKey\n}", "func GetKey(allkeys [][]byte, loc Where) []byte {\n\tif loc == Left {\n\t\treturn allkeys[0]\n\t}\n\tif loc == Right {\n\t\treturn allkeys[len(allkeys)-1]\n\t}\n\t// select a random index between 1 and allkeys-2\n\t// nolint:gosec\n\tidx := rand.Int()%(len(allkeys)-2) + 1\n\treturn allkeys[idx]\n}", "func MGetCacheKey(c Cacheable, i int) string {\n\treturn c.cs.s[i+1]\n}", "func GetMapKey(UsernameHashed, PasswordHashed string) []byte {\r\n\treturn []byte(path.Join(keyPrefix4SubTree, UsernameHashed, PasswordHashed))\r\n}", "func (s *session) getKey() string {\n\treturn s.uuid\n}", "func GetKey(ctx context.Context) string {\n\tsv, ok := ctx.Value(ctxKeyKey).(string)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\n\treturn sv\n}", "func (mm *MessageKey) StringKey(params *BitCloutParams) string {\n\treturn PkToString(mm.PublicKey[:], params) + \"_\" + fmt.Sprint(mm.TstampNanos)\n}", "func GetKey(namespace, name string) string {\n\treturn fmt.Sprintf(\"%s/%s\", namespace, name)\n}", "func (c *chat) key() int64 {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\t// generates new possible key value\n\tvar key = time.Now().UnixNano()\n\n\t// generated key become actual if the previous key is absent\n\tif c.prev == 0 {\n\t\tc.prev = key\n\t\t// returns actual key\n\t\treturn c.prev\n\t}\n\n\t// calculates minimum next possible key value\n\tc.prev = c.prev + c.latency\n\n\t// generated key become actual if generated key greater than the minimum possible key\n\tif key > c.prev {\n\t\tc.prev = key\n\t}\n\n\t// returns actual key\n\treturn c.prev\n}", "func getKeyFromKeyCache(keyHandle string) (string, string, error) {\n\n\tctxkey := ctx.Value(keyHandle)\n\tif ctxkey == nil || ctxkey == \"\" {\n\t\tconn, err := net.Dial(\"unix\", RPCSocketFilePath)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"secureoverlay2: Failed to dial workload-agent wlagent.sock\")\n\t\t}\n\t\tclient := rpc.NewClient(conn)\n\t\tdefer client.Close()\n\t\tvar outKey KeyInfo\n\t\tvar args = KeyInfo{\n\t\t\tKeyID: keyHandle,\n\t\t}\n\t\terr = client.Call(\"VirtualMachine.FetchKey\", &args, &outKey)\n\t\tif err != nil {\n\t\t\tlogrus.Tracef(\"%+v\", err)\n\t\t\treturn \"\", \"\", fmt.Errorf(\"secureoverlay2: rpc call workload-agent fetch-key: Client call failed\")\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"Could not fetch the key from workload-agent\")\n\t\t}\n\t\tif len(outKey.Key) == 0 {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"Empty key received from workload-agent\")\n\t\t}\n\t\tunwrappedKey := base64.StdEncoding.EncodeToString(outKey.Key)\n\t\tctx = context.WithValue(context.TODO(), keyHandle, unwrappedKey)\n\t\treturn unwrappedKey, \"\", nil\n\t}\n\treturn fmt.Sprintf(\"%v\", ctx.Value(keyHandle)), \"\", nil\n\n}", "func (d *Disk) getKey(p *DiskParams) []byte {\n\treturn []byte(time_util.TimeToName(time.Unix(p.ExicutionTime, 0), fmt.Sprintf(\"%x\", d.hasher.Sum(nil))))\n}", "func (k *Index) GetKeyPtr() unsafe.Pointer { return unsafe.Pointer(k) }", "func (e MessageCValidationError) Key() bool { return e.key }", "func (this *DefaultHandler) GetKey(xesRedis redo.XesRedisBase) (ret string) {\n\tdefer func() {\n\t\tif xesRedis.GetCtx() == nil {\n\t\t\treturn\n\t\t}\n\t\tbench := xesRedis.GetCtx().Value(\"IS_BENCHMARK\")\n\t\tif cast.ToString(bench) == \"1\" {\n\t\t\tret = \"benchmark_\" + ret\n\t\t}\n\t}()\n\n\tkeyInfo := this.getKeyInfo(xesRedis)\n\tkey := cast.ToString(keyInfo[\"key\"])\n\tif key == \"\" {\n\t\tret = xesRedis.GetKeyName()\n\t\treturn\n\t}\n\tret = fmt.Sprintf(key, (xesRedis.GetKeyParams())...)\n\treturn\n}", "func GetMessage(id MessageID) string {\n\treturn messages[id]\n}", "func (e GetMessageResponseValidationError) Key() bool { return e.key }", "func (c *Client) GetKey() (types.EncKey, error) {\n\n\treturn types.EncKey{}, nil\n}", "func (e DeleteMessageRequestValidationError) Key() bool { return e.key }", "func (g *Genkey) Getkey() (key int64, err error) {\n\tselect {\n\tcase key = <-g.keys:\n\t\treturn\n\tcase <-time.After(genKeyTimeout):\n\t\terr = errors.New(\"getKey timeout\")\n\t\treturn\n\t}\n}", "func (ctx Ctx) Key(at KeyPairID) (res Key, err error) {\n\tif C.CryptGetUserKey(ctx.hProv, C.DWORD(at), &res.hKey) == 0 {\n\t\terr = getErr(\"Error getting key for container\")\n\t\treturn\n\t}\n\treturn\n}", "func (d *device) getKey() string {\n\treturn d.GetClass().ToString() + \",\" + d.GetName()\n}", "func (m *Module) GetKey(ctx context.Context, key string) (string, error) {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\n\treturn m.client.Get(ctx, key).Result()\n}" ]
[ "0.73595506", "0.6789251", "0.6704122", "0.66150147", "0.6544578", "0.6529682", "0.64331543", "0.641901", "0.6389284", "0.6387634", "0.63848305", "0.63806224", "0.63209355", "0.62894017", "0.62710315", "0.62678534", "0.6229667", "0.62214786", "0.6218583", "0.61587995", "0.61500424", "0.6149393", "0.61464775", "0.61439997", "0.61197335", "0.61177117", "0.61117333", "0.6092023", "0.6090333", "0.60739756", "0.6071076", "0.6067772", "0.6057327", "0.6052317", "0.60377324", "0.60341465", "0.60009253", "0.59898865", "0.59874946", "0.59791845", "0.59748864", "0.5968991", "0.5968132", "0.5964096", "0.5956948", "0.5948237", "0.59471965", "0.5939836", "0.5921703", "0.59110665", "0.59102887", "0.59096575", "0.58898175", "0.5889589", "0.5884898", "0.5870068", "0.5864815", "0.5862602", "0.58599037", "0.5858676", "0.58575016", "0.5854996", "0.5854242", "0.58506316", "0.5850183", "0.58496624", "0.584727", "0.58427906", "0.5840078", "0.5835007", "0.5828927", "0.58151484", "0.5813389", "0.5813112", "0.5809906", "0.5807087", "0.57995623", "0.57908314", "0.5785737", "0.5774968", "0.576822", "0.57656634", "0.57574713", "0.57457006", "0.5745137", "0.5743851", "0.57358515", "0.57311064", "0.5728112", "0.5719489", "0.57158303", "0.5710166", "0.5701322", "0.56989324", "0.5697165", "0.5667351", "0.5666986", "0.5666865", "0.5662102", "0.5654947" ]
0.7453689
0
GetRootKeyHash implemented in memory.
func (ms *MemStore) GetRootKeyHash(sessionKey string) (*[64]byte, error) { s, ok := ms.sessions[sessionKey] if !ok { return nil, log.Errorf("memstore: no session found for %s", sessionKey) } // decode root key hash var hash [64]byte k, err := base64.Decode(s.rootKeyHash) if err != nil { return nil, log.Error("memstore: cannot decode root key hash") } if copy(hash[:], k) != 64 { return nil, log.Errorf("memstore: root key hash has wrong length") } return &hash, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (eln *EmptyLeafNode) GetKey() []byte {\n\treturn nil\n}", "func GetRootHash(msg []byte) []byte {\n\tx := sha1.Sum(msg)\n\treturn x[:]\n}", "func (ws *workingSet) RootHash() hash.Hash32B {\n\treturn ws.accountTrie.RootHash()\n}", "func (d *dataUsageCache) rootHash() dataUsageHash {\n\treturn hashPath(d.Info.Name)\n}", "func (s *StateDB) RootHash() *corecrypto.HashType {\n\treturn s.trie.RootHash()\n}", "func (k Keys) HashKey() interface{} { return k[0] }", "func (i *indexBack) getHashKey() uint64 {\n\treturn i.hashKey\n}", "func (hasher *SHA256) HashKey() string {\n\treturn \"\"\n}", "func getKeyHash(k string) [4]int {\n\th1 := sha1.New()\n\th1.Write([]byte(k))\n\tb1 := h1.Sum(nil)\n\tdata1 := b1[0]\n\tid1 := data1 % 8\n\tid1 = id1 * 4\n\tidint := int(id1)\n\tvar nodelist [4]int\n\tfor k := 0; k < 4; k++ {\n\t\tnodelist[k] = k + idint\n\t}\n\n\t//fmt.Println(\"Nodelist for given key\", nodelist)\n\treturn nodelist\n}", "func Hash(s string, maxKey uint64) Key {\n\th := fnv.New64a()\n\th.Write([]byte(s))\n\treturn NewKey(h.Sum64() % maxKey)\n}", "func RootHash(start uint64, end uint64) {\n\tRPCClient, err := rpc.Dial(\"ws://127.0.0.1:8585\") // websocket port of a node started from bor-devnet directory\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tclient := ethclient.NewClient(RPCClient)\n\tctx, _ := context.WithCancel(context.Background())\n\n\troot, err := client.GetRootHash(ctx, start, end)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(root)\n}", "func (k KeyStore) Get(address bitcoin.RawAddress) (*Key, error) {\r\n\thash, err := address.Hash()\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\tkey, ok := k.Keys[*hash]\r\n\tif !ok {\r\n\t\treturn nil, ErrKeyNotFound\r\n\t}\r\n\treturn key, nil\r\n}", "func (mt *merkleTreeImp) GetRootHash() []byte {\n\tif mt.root == nil {\n\t\treturn EmptyTreeRootHash\n\t}\n\treturn mt.root.getNodeHash()\n\n}", "func GetMapKey(UsernameHashed, PasswordHashed string) []byte {\r\n\treturn []byte(path.Join(keyPrefix4SubTree, UsernameHashed, PasswordHashed))\r\n}", "func (k Keeper) GetHashFn() vm.GetHashFunc {\n\treturn func(height uint64) common.Hash {\n\t\tctx := k.Ctx()\n\n\t\th, err := ethermint.SafeInt64(height)\n\t\tif err != nil {\n\t\t\tk.Logger(ctx).Error(\"failed to cast height to int64\", \"error\", err)\n\t\t\treturn common.Hash{}\n\t\t}\n\n\t\tswitch {\n\t\tcase ctx.BlockHeight() == h:\n\t\t\t// Case 1: The requested height matches the one from the context so we can retrieve the header\n\t\t\t// hash directly from the context.\n\t\t\t// Note: The headerHash is only set at begin block, it will be nil in case of a query context\n\t\t\theaderHash := ctx.HeaderHash()\n\t\t\tif len(headerHash) != 0 {\n\t\t\t\treturn common.BytesToHash(headerHash)\n\t\t\t}\n\n\t\t\t// only recompute the hash if not set (eg: checkTxState)\n\t\t\tcontextBlockHeader := ctx.BlockHeader()\n\t\t\theader, err := tmtypes.HeaderFromProto(&contextBlockHeader)\n\t\t\tif err != nil {\n\t\t\t\tk.Logger(ctx).Error(\"failed to cast tendermint header from proto\", \"error\", err)\n\t\t\t\treturn common.Hash{}\n\t\t\t}\n\n\t\t\theaderHash = header.Hash()\n\t\t\treturn common.BytesToHash(headerHash)\n\n\t\tcase ctx.BlockHeight() > h:\n\t\t\t// Case 2: if the chain is not the current height we need to retrieve the hash from the store for the\n\t\t\t// current chain epoch. This only applies if the current height is greater than the requested height.\n\t\t\thistInfo, found := k.stakingKeeper.GetHistoricalInfo(ctx, h)\n\t\t\tif !found {\n\t\t\t\tk.Logger(ctx).Debug(\"historical info not found\", \"height\", h)\n\t\t\t\treturn common.Hash{}\n\t\t\t}\n\n\t\t\theader, err := tmtypes.HeaderFromProto(&histInfo.Header)\n\t\t\tif err != nil {\n\t\t\t\tk.Logger(ctx).Error(\"failed to cast tendermint header from proto\", \"error\", err)\n\t\t\t\treturn common.Hash{}\n\t\t\t}\n\n\t\t\treturn common.BytesToHash(header.Hash())\n\t\tdefault:\n\t\t\t// Case 3: heights greater than the current one returns an empty hash.\n\t\t\treturn common.Hash{}\n\t\t}\n\t}\n}", "func (m *hasher) EmptyRoot() []byte {\n\tpanic(\"EmptyRoot() not defined for coniks.Hasher\")\n}", "func (mgr *LocalHashMapDBMgr) GetRoot() (*Base, error) {\n\tif mgr.base.RootKey.IsNil() || mgr.base.Degree == 0 {\n\t\treturn nil, nil\n\t}\n\treturn &mgr.base, nil\n}", "func (s *DHT) hashKey(data []byte) []byte {\n\tsha := sha3.Sum256(data)\n\treturn sha[:]\n}", "func (v EcdsaVerifier) KeyHash() uint32 {\n\treturn v.hash\n}", "func (st *RedBlackBST) Max() Key {\n\tif st.IsEmpty() {\n\t\tpanic(\"call Max on empty RedBlackbst\")\n\t}\n\treturn st.max(st.root).key\n}", "func (eln *EmptyLeafNode) GetHash() []byte {\n\treturn emptyLeafNodeHash\n}", "func Key(hash *chainhash.Hash) [gcs.KeySize]byte {\n\tvar key [gcs.KeySize]byte\n\tcopy(key[:], hash[:])\n\treturn key\n}", "func (n *lnode) key() []byte {\n\tbuf := (*[maxAllocSize]byte)(unsafe.Pointer(n))\n\treturn buf[n.pos : n.pos+n.ksize]\n}", "func TstBaseGetPubKey() *GetPubKey {\n\treturn &GetPubKey{\n\t\theader: wire.NewObjectHeader(\n\t\t\t123123, // 0x1e0f3\n\t\t\ttime.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST)\n\t\t\twire.ObjectTypeGetPubKey,\n\t\t\t3,\n\t\t\t1),\n\t\tRipe: &hash.Ripe{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},\n\t\tTag: nil,\n\t}\n}", "func (db *DB) GetStateRootHash() (core.ByteArray, error) {\n\tstate, err := db.GetStateRoot()\n\tif err != nil {\n\t\treturn core.ByteArray{}, err\n\t}\n\treturn core.HexToByteArray(state.Hash)\n}", "func (s *State) RootKey() session.RootKeyable {\n\treturn s.rootKey\n}", "func fixedHashGetNodeFunc(depth int, index int64) (trillian.Hash, error) {\n\treturn []byte(\"12345678901234567890123456789012\"), nil\n}", "func HashRoot(input []byte) (out Root) {\n\tcopy(out[:], Hash(input))\n\treturn\n}", "func (h dataUsageHash) Key() string {\n\treturn string(h)\n}", "func (b *BaseNode) getHash(n Node) util.Uint256 {\n\tif !b.hashValid {\n\t\tb.updateHash(n)\n\t}\n\treturn b.hash\n}", "func (ds *RegularStateMachineWrapper) GetHash() (uint64, error) {\n\tds.ensureNotDestroyed()\n\tv := C.GetHashDBRegularStateMachine(ds.dataStore)\n\treturn uint64(v), nil\n}", "func (m *Multi) Hash(key string) string {\n\tbkey := []byte(key)\n\n\tminDistance := uint64(math.MaxUint64)\n\n\tvar minhash uint64\n\n\th1 := m.hashf(bkey, m.seeds[0])\n\th2 := m.hashf(bkey, m.seeds[1])\n\n\tfor i := 0; i < m.k; i++ {\n\t\thash := h1 + uint64(i)*h2\n\t\tprefix := (hash & m.prefixmask) >> m.prefixshift\n\n\t\tvar node uint64\n\tFOUND:\n\t\tfor {\n\t\t\tuints := m.bhashes[prefix]\n\n\t\t\tfor _, v := range uints {\n\t\t\t\tif hash < v {\n\t\t\t\t\tnode = v\n\t\t\t\t\tbreak FOUND\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprefix++\n\t\t\tif prefix == uint64(len(m.bhashes)) {\n\t\t\t\tprefix = 0\n\t\t\t\t// wrapped -- take the first node hash we can find\n\t\t\t\tfor uints = nil; uints == nil; prefix++ {\n\t\t\t\t\tuints = m.bhashes[prefix]\n\t\t\t\t}\n\n\t\t\t\tnode = uints[0]\n\t\t\t\tbreak FOUND\n\t\t\t}\n\t\t}\n\n\t\tdistance := node - hash\n\t\tif distance < minDistance {\n\t\t\tminDistance = distance\n\t\t\tminhash = node\n\t\t}\n\t}\n\n\treturn m.bmap[minhash]\n}", "func GetKey(size int) []byte {\n\treturn GetIV(size)\n}", "func (m *HashRing) GetNode(key string) string {\n\t// no nodes in the ring yet\n\tif len(m.keys) == 0 {\n\t\treturn \"\"\n\t}\n\t// hash result of the data key\n\thash := int(m.hash([]byte(key)))\n\t// get the first i where m.keys[i] >= hash\n\tindex := sort.Search(len(m.keys), func(i int) bool {\n\t\treturn m.keys[i] >= hash\n\t})\n\treturn m.hashMap[m.keys[index%len(m.keys)]]\n}", "func (c Node) GetKey() string {\n\treturn c.key\n}", "func (k *Key) Root() *Key {\n\tif len(k.toks) > 1 {\n\t\tret := *k\n\t\tret.toks = ret.toks[:1]\n\t\treturn &ret\n\t}\n\treturn k\n}", "func (n node) GetHash() uint64 {\n\treturn n.hash\n}", "func (dtk *DcmTagKey) Hash() uint32 {\n\treturn ((uint32(int(dtk.group)<<16) & 0xffff0000) | (uint32(int(dtk.element) & 0xffff)))\n}", "func hostGetKeyId(key *byte, size int32) int32", "func (symmetricKey *SymmetricKey) GetKey() []byte {\n\tsymmetricKey.mutex.RLock()\n\tdefer symmetricKey.mutex.RUnlock()\n\treturn symmetricKey.SymmetricKey\n}", "func GetNodeHashForKey(key string, circle *treemap.Map) uint64 {\n\n\tkeyHash := Hashcode(key)\n\tkeys := circle.Keys()\n\n\treturn keys[getNodeIndex(keys, keyHash, 0, circle)].(uint64)\n}", "func (n *NoOP) GetHash() uint64 {\n\t// the hash value is always 0, so it is of course always consistent\n\treturn 0\n}", "func (c *Conf) GetOnRootKey() common.RawBytes {\n\tc.keyConfLock.RLock()\n\tdefer c.keyConfLock.RUnlock()\n\treturn c.keyConf.OnRootKey\n}", "func New() Hashmap {\n\treturn Hashmap{make([]node, defaultSize), defaultSize, 0}\n}", "func NewKustHash() *kustHash {\n\treturn &kustHash{}\n}", "func GetTheBlockKey(chain, index uint64) []byte {\n\tvar key Hash\n\tif chain == 0 {\n\t\treturn nil\n\t}\n\tif index == 0 {\n\t\tvar pStat BaseInfo\n\t\tgetDataFormDB(chain, dbStat{}, []byte{StatBaseInfo}, &pStat)\n\t\treturn pStat.Key[:]\n\t}\n\tgetDataFormLog(chain, logBlockInfo{}, runtime.Encode(index), &key)\n\tif key.Empty() {\n\t\treturn nil\n\t}\n\treturn key[:]\n}", "func GetHashAll(key string) (interface{}, error) {\n\tconnect := Connect()\n\trep, err := connect.Do(\"HGETALL\", key)\n\tif err != nil {\n\t\tlog.Fatal(err, \"not ok\")\n\t}\n\tdefer connect.Close()\n\treturn rep, err\n}", "func (a *Account) GetHash() Hash256 {\n\tpubHash := Sha256H(a.pub[:])\n\tnameHash := Sha256H([]byte(a.name))\n\tts := make([]byte, 4)\n\tPutUint32Le(ts, a.timestamp)\n\ttsHash := Sha256H(ts)\n\n\tfields := make(map[Hash256]Hash256)\n\tkeys := []Hash256{}\n\tfor k, v := range a.fields {\n\t\tkeyH := Sha256H([]byte(k))\n\t\tfields[keyH] = Sha256H([]byte(v))\n\t\tkeys = append(keys, keyH)\n\t}\n\n\tkeys = SortHash256(keys)\n\troot := Sha256H(pubHash[:], nameHash[:], tsHash[:])\n\n\tfor _, key := range keys {\n\t\tval := fields[key]\n\t\troot = Sha256H(key[:], val[:])\n\t}\n\n\treturn root\n}", "func GetKey(t *testing.T) []byte {\n\tt.Helper()\n\n\tk, _ := GeneratePrivateKey()\n\treturn k.Data[:]\n}", "func (a *AttesterSlashing) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(a)\n}", "func (h TreeHasher) HashEmpty() []byte {\n\treturn h.hasher([]byte{})\n}", "func KeyHash(s string) string {\n\tif len(s) > 100 {\n\t\ts = s[:100]\n\t}\n\td := sha256.Sum256([]byte(s))\n\treturn hex.EncodeToString(d[:])[:12]\n}", "func (m *Map) Get(key string) string {\n\tif m.IsEmpty() {\n\t\treturn \"\"\n\t}\n\thash := m.hash([]byte(key))\n\tn := node{hash: hash, key: key}\n\titer := floor(&m.nodes.Tree, &n)\n\tif iter == m.nodes.End() {\n\t\titer = m.nodes.Begin()\n\t}\n\treturn iter.Node().Key.(*node).key\n}", "func (s *RegularStateMachine) GetHash() (uint64, error) {\n\tif s.h == nil {\n\t\treturn 0, sm.ErrNotImplemented\n\t}\n\treturn s.h.GetHash()\n}", "func (f *Float) HashKey() HashKey {\n\th := fnv.New64a()\n\th.Write([]byte(f.Inspect()))\n\treturn HashKey{Type: f.Type(), Value: h.Sum64()}\n}", "func (t *Tree) Hash() []byte {\n\treturn t.rootNode.getHash()\n}", "func fixedHashGetNodeFunc(_ int, _ int64) ([]byte, error) {\n\treturn []byte(\"12345678901234567890123456789012\"), nil\n}", "func (m *Ring) Get(key string) string {\n\thash := xxhash.Sum64String(key)\n\n\t// Binary search for appropriate replica.\n\tidx := sort.Search(len(m.vnodes), func(i int) bool {\n\t\treturn m.vnodes[i] >= hash\n\t})\n\n\t// we have cycled back to the first replica\n\tif idx == len(m.vnodes) {\n\t\tidx = 0\n\t}\n\n\treturn m.vnodeNodes[m.vnodes[idx]]\n}", "func keyHash(k crypto.Key) ([]byte, error) {\n\tkb, err := k.Bytes()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\th, _ := mh.Sum(kb, mh.SHA2_256, -1)\n\treturn []byte(h), nil\n}", "func (s *CountMinSketch) baseHashes(key []byte) [2]uint32 {\n\ts.h.Reset()\n\ts.h.Write(key)\n\tsum := s.h.Sum(nil)\n\treturn [2]uint32{binary.BigEndian.Uint32(sum[0:4]), binary.BigEndian.Uint32(sum[4:8])}\n}", "func (k *ReadKey) Hash() hash.Hash160 {\n\tb, _ := json.Marshal(k)\n\treturn hash.Hash160b(b)\n}", "func (f binaryEqualsFunc) key() Key {\n\treturn f.k\n}", "func (idx *ExistsAddrIndex) Key() []byte {\n\treturn existsAddrIndexKey\n}", "func getKeyRelHash(k string, r string) int {\n\th1 := sha1.New()\n\th1.Write([]byte(k))\n\tb1 := h1.Sum(nil)\n\tdata1 := b1[0]\n\tid1 := data1 % 8\n\tid1 = id1 * 4\n\n\th2 := sha1.New()\n\th2.Write([]byte(r))\n\tb2 := h2.Sum(nil)\n\tdata2 := b2[0]\n\tid2 := data2 % 4\n\tretid := int(id1 + id2)\n\t//fmt.Println(\"Hash for key-rel=\", retid)\n\treturn retid\n}", "func (p BnetAuthCheckPacket) KeyHash(index int) string {\n\tconst keyOffset = 24\n\tconst keyLen = 4 * 9\n\toffset := keyOffset + index*keyLen + 8\n\thashBytes := p[offset : offset+4]\n\treturn hex.EncodeToString(hashBytes)\n}", "func (linkDef *LinkDefinition) GetHashKey() string {\n\treturn fmt.Sprintf(\"%s_hash_key\", stringtool.ToSnakeCase(linkDef.Name))\n}", "func (n *NeighborsTable) GetTableHash() []byte {\n\t// Create a list of node ids in the table\n\tnodeIDs := make([]uint64, 0, n.m.Len())\n\tfor item := range n.m.Iter() {\n\t\tnodeIDs = append(nodeIDs, item.Key.(uint64))\n\t}\n\n\t// Convert to a bytes slice to hash\n\tb := make([]byte, len(nodeIDs)*8)\n\tstart := 0\n\tfor _, nodeID := range nodeIDs {\n\t\tb[start] = byte(nodeID >> 56)\n\t\tb[start+1] = byte(nodeID >> 48)\n\t\tb[start+2] = byte(nodeID >> 40)\n\t\tb[start+3] = byte(nodeID >> 32)\n\t\tb[start+4] = byte(nodeID >> 24)\n\t\tb[start+5] = byte(nodeID >> 16)\n\t\tb[start+6] = byte(nodeID >> 8)\n\t\tb[start+7] = byte(nodeID)\n\t\tstart += 8\n\t}\n\treturn HashSHA3(b)\n}", "func (hm *HashMap) GetAllKey() []common.Hash {\n\thm.lock.RLock()\n\tdefer hm.lock.RUnlock()\n\n\tmapList := make([]common.Hash, 0)\n\tfor val := range hm.data {\n\t\tmapList = append(mapList, val)\n\t}\n\treturn mapList\n}", "func (vrfs *VRFShare) GetKey() datastore.Key {\n\treturn datastore.ToKey(fmt.Sprintf(\"%v\", vrfs.Round))\n}", "func (eln *EmptyLeafNode) CountHashesRequiredForGetHash() int {\n\treturn 0\n}", "func (r *ProviderRegister) GetRootSigningKey() (*fcrcrypto.KeyPair, error) {\n\treturn fcrcrypto.DecodePublicKey(r.RootSigningKey)\n}", "func hashmapTopHash(hash uint32) uint8 {\n\ttophash := uint8(hash >> 24)\n\tif tophash < 1 {\n\t\t// 0 means empty slot, so make it bigger.\n\t\ttophash += 1\n\t}\n\treturn tophash\n}", "func (k *Index) GetKeyPtr() unsafe.Pointer { return unsafe.Pointer(k) }", "func (i *Integer) HashKey() HashKey {\n\treturn HashKey{Type: i.Type(), Value: uint64(i.Value)}\n}", "func (c *ConsistentHash) Get(key string) string {\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\tif len(c.keys) == 0 {\n\t\treturn \"\"\n\t}\n\th := c.hashKey(key)\n\tidx := sort.Search(len(c.keys), func(i int) bool {\n\t\treturn c.keys[i] >= h\n\t})\n\tif idx == len(c.keys) {\n\t\tidx = 0\n\t}\n\treturn c.ring[c.keys[idx]]\n}", "func newKey() key {\n\treturn &[32]byte{}\n}", "func (e aesGCMEncodedEncryptor) PrimaryKeyHash() string {\n\treturn e.primaryKeyHash\n}", "func (s *ConcurrentStateMachine) GetHash() (uint64, error) {\n\tif s.h == nil {\n\t\treturn 0, sm.ErrNotImplemented\n\t}\n\treturn s.h.GetHash()\n}", "func (e EmptyNode) Hash() util.Uint256 {\n\tpanic(\"can't get hash of an EmptyNode\")\n}", "func (d *DStarLite) keyFor(s *dStarLiteNode) key {\n\t/*\n\t procedure CalculateKey(s)\n\t {01”} return [min(g(s), rhs(s)) + h(s_start, s) + k_m; min(g(s), rhs(s))];\n\t*/\n\tk := key{1: math.Min(s.g, s.rhs)}\n\tk[0] = k[1] + d.heuristic(d.s.Node, s.Node) + d.keyModifier\n\treturn k\n}", "func GetRoot(store store.Store, id string) Root { return GetFromCache(store, id).(Root) }", "func (m *MockFactory) RootHash() hash.Hash32B {\n\tret := m.ctrl.Call(m, \"RootHash\")\n\tret0, _ := ret[0].(hash.Hash32B)\n\treturn ret0\n}", "func (sm *RegularStateMachine) GetHash() uint64 {\n\treturn sm.sm.GetHash()\n}", "func (keyRing *KeyRing) GetKey(n int) (*Key, error) {\n\tif n >= keyRing.CountEntities() {\n\t\treturn nil, errors.New(\"gopenpgp: out of bound when fetching key\")\n\t}\n\treturn &Key{keyRing.entities[n]}, nil\n}", "func (level DepthOfMarketLevel) GetKey() float64 { return level[0] }", "func (k Key) Hash() []byte {\n\tsum := sha256.Sum256(k)\n\treturn sum[:]\n}", "func calcTaprootSignatureHashRaw(sigHashes *TxSigHashes, hType SigHashType,\n\ttx *wire.MsgTx, idx int,\n\tprevOutFetcher PrevOutputFetcher,\n\tsigHashOpts ...TaprootSigHashOption) ([]byte, error) {\n\n\topts := defaultTaprootSighashOptions()\n\tfor _, sigHashOpt := range sigHashOpts {\n\t\tsigHashOpt(opts)\n\t}\n\n\t// If a valid sighash type isn't passed in, then we'll exit early.\n\tif !isValidTaprootSigHash(hType) {\n\t\t// TODO(roasbeef): use actual errr here\n\t\treturn nil, fmt.Errorf(\"invalid taproot sighash type: %v\", hType)\n\t}\n\n\t// As a sanity check, ensure the passed input index for the transaction\n\t// is valid.\n\tif idx > len(tx.TxIn)-1 {\n\t\treturn nil, fmt.Errorf(\"idx %d but %d txins\", idx, len(tx.TxIn))\n\t}\n\n\t// We'll utilize this buffer throughout to incrementally calculate\n\t// the signature hash for this transaction.\n\tvar sigMsg bytes.Buffer\n\n\t// The final sighash always has a value of 0x00 prepended to it, which\n\t// is called the sighash epoch.\n\tsigMsg.WriteByte(0x00)\n\n\t// First, we write the hash type encoded as a single byte.\n\tif err := sigMsg.WriteByte(byte(hType)); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Next we'll write out the transaction specific data which binds the\n\t// outer context of the sighash.\n\terr := binary.Write(&sigMsg, binary.LittleEndian, tx.Version)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = binary.Write(&sigMsg, binary.LittleEndian, tx.LockTime)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// If sighash isn't anyone can pay, then we'll include all the\n\t// pre-computed midstate digests in the sighash.\n\tif hType&SigHashAnyOneCanPay != SigHashAnyOneCanPay {\n\t\tsigMsg.Write(sigHashes.HashPrevOutsV1[:])\n\t\tsigMsg.Write(sigHashes.HashInputAmountsV1[:])\n\t\tsigMsg.Write(sigHashes.HashInputScriptsV1[:])\n\t\tsigMsg.Write(sigHashes.HashSequenceV1[:])\n\t}\n\n\t// If this is sighash all, or its taproot alias (sighash default),\n\t// then we'll also include the pre-computed digest of all the outputs\n\t// of the transaction.\n\tif hType&SigHashSingle != SigHashSingle &&\n\t\thType&SigHashSingle != SigHashNone {\n\n\t\tsigMsg.Write(sigHashes.HashOutputsV1[:])\n\t}\n\n\t// Next, we'll write out the relevant information for this specific\n\t// input.\n\t//\n\t// The spend type is computed as the (ext_flag*2) + annex_present. We\n\t// use this to bind the extension flag (that BIP 342 uses), as well as\n\t// the annex if its present.\n\tinput := tx.TxIn[idx]\n\twitnessHasAnnex := opts.annexHash != nil\n\tspendType := byte(opts.extFlag) * 2\n\tif witnessHasAnnex {\n\t\tspendType += 1\n\t}\n\n\tif err := sigMsg.WriteByte(spendType); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// If anyone can pay is active, then we'll write out just the specific\n\t// information about this input, given we skipped writing all the\n\t// information of all the inputs above.\n\tif hType&SigHashAnyOneCanPay == SigHashAnyOneCanPay {\n\t\t// We'll start out with writing this input specific information by\n\t\t// first writing the entire previous output.\n\t\terr = wire.WriteOutPoint(&sigMsg, 0, 0, &input.PreviousOutPoint)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Next, we'll write out the previous output (amt+script) being\n\t\t// spent itself.\n\t\tprevOut := prevOutFetcher.FetchPrevOutput(input.PreviousOutPoint)\n\t\tif err := wire.WriteTxOut(&sigMsg, 0, 0, prevOut); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Finally, we'll write out the input sequence itself.\n\t\terr = binary.Write(&sigMsg, binary.LittleEndian, input.Sequence)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\terr := binary.Write(&sigMsg, binary.LittleEndian, uint32(idx))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Now that we have the input specific information written, we'll\n\t// include the anex, if we have it.\n\tif witnessHasAnnex {\n\t\tsigMsg.Write(opts.annexHash)\n\t}\n\n\t// Finally, if this is sighash single, then we'll write out the\n\t// information for this given output.\n\tif hType&sigHashMask == SigHashSingle {\n\t\t// If this output doesn't exist, then we'll return with an error\n\t\t// here as this is an invalid sighash type for this input.\n\t\tif idx >= len(tx.TxOut) {\n\t\t\t// TODO(roasbeef): real error here\n\t\t\treturn nil, fmt.Errorf(\"invalid sighash type for input\")\n\t\t}\n\n\t\t// Now that we know this is a valid sighash input combination,\n\t\t// we'll write out the information specific to this input.\n\t\t// We'll write the wire serialization of the output and compute\n\t\t// the sha256 in a single step.\n\t\tshaWriter := sha256.New()\n\t\ttxOut := tx.TxOut[idx]\n\t\tif err := wire.WriteTxOut(shaWriter, 0, 0, txOut); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// With the digest obtained, we'll write this out into our\n\t\t// signature message.\n\t\tif _, err := sigMsg.Write(shaWriter.Sum(nil)); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Now that we've written out all the base information, we'll write any\n\t// message extensions (if they exist).\n\tif err := opts.writeDigestExtensions(&sigMsg); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// The final sighash is computed as: hash_TagSigHash(0x00 || sigMsg).\n\t// We wrote the 0x00 above so we don't need to append here and incur\n\t// extra allocations.\n\tsigHash := chainhash.TaggedHash(chainhash.TagTapSighash, sigMsg.Bytes())\n\treturn sigHash[:], nil\n}", "func HashKey(key int) int {\n\t/*\n\t\ttiedot should be compiled/run on x86-64 systems.\n\t\tIf you decide to compile tiedot on 32-bit systems, the following integer-smear algorithm will cause compilation failure\n\t\tdue to 32-bit interger overflow; therefore you must modify the algorithm.\n\t\tDo not remove the integer-smear process, and remember to run test cases to verify your mods.\n\t*/\n\t// ========== Integer-smear start =======\n\tkey = key ^ (key >> 4)\n\tkey = (key ^ 0xdeadbeef) + (key << 5)\n\tkey = key ^ (key >> 11)\n\t// ========== Integer-smear end =========\n\treturn key & ((1 << HASH_BITS) - 1) // Do not modify this line\n}", "func (s *CommonStorageDB) GetKeyHashVersion(namespace, collection string, keyHash []byte) (*version.Height, error) {\n\tkeyHashStr := string(keyHash)\n\tif !s.BytesKeySupported() {\n\t\tkeyHashStr = base64.StdEncoding.EncodeToString(keyHash)\n\t}\n\treturn s.GetVersion(deriveHashedDataNs(namespace, collection), keyHashStr)\n}", "func hash(key string) int{\n\tvar num = 0\n\t// get the lenght of the key\n\tvar length = len(key)\n\n\t// add the ascii character value to creat a sum \n\tfor i := 0; i < length; i++{\n\n\t\tnum += int(key[i])\n\t}\n\t\n\t// square in the middle hash method\n\tvar avg = num * int((math.Pow(5.0, 0.5) - 1)) / 2\n\tvar numeric = avg - int(math.Floor(float64(avg)))\n\n\n\t// hash value to place into the table slice between -1 and CAPACITY - 1\n\treturn int(math.Floor(float64(numeric * CAPACITY)))\n}", "func (k *Keychain) BinKey() ([]byte, error) {\n\tk.m.RLock()\n\tif len(k.keys) == 0 {\n\t\tk.m.RUnlock()\n\t\treturn nil, ErrNoKeys\n\t}\n\tkey := k.keys[0]\n\tk.m.RUnlock()\n\treturn key, nil\n}", "func (e Aes128CtsHmacSha256128) GetHashFunc() func() hash.Hash {\n\treturn sha256.New\n}", "func ToKey(dg *repb.Digest) Key {\n\treturn Key{hash: dg.Hash, size: dg.SizeBytes}\n}", "func (s *CountMinSketch) baseHashes(key []byte) (a uint32, b uint32) {\n\ts.hasher.Reset()\n\ts.hasher.Write(key)\n\tsum := s.hasher.Sum(nil)\n\tupper := sum[0:4]\n\tlower := sum[4:8]\n\ta = binary.BigEndian.Uint32(lower)\n\tb = binary.BigEndian.Uint32(upper)\n\treturn\n}", "func (m *Map) Get(key string) string {\n\tif m.IsEmpty() {\n\t\treturn \"\"\n\t}\n\n\thash := int(m.hash([]byte(key)))\n\n\t// Binary search for appropriate replica.\n\tidx := sort.Search(len(m.keys), func(i int) bool { return m.keys[i] >= hash })\n\n\t// Means we have cycled back to the first replica.\n\tif idx == len(m.keys) {\n\t\tidx = 0\n\t}\n\n\treturn m.hashMap[m.keys[idx]]\n}", "func Hash(length int, key string) int64 {\n\tif key == \"\" {\n\t\treturn 0\n\t}\n\thc := hashCode(key)\n\treturn (hc ^ (hc >> 16)) % int64(length)\n}", "func (i *Integer) HashKey() HashKey {\n\treturn HashKey{\n\t\tType: i.Type(),\n\t\tValue: uint64(i.Value),\n\t}\n}", "func (w *Wallet) GetKey(address types.UnlockHash) (pk types.PublicKey, sk types.ByteSlice, err error) {\n\tw.mu.RLock()\n\tpk, sk, err = w.getKey(address)\n\tw.mu.RUnlock()\n\treturn\n}", "func generateRootHashes(ctx context.Context, input <-chan *pb.LeafData) <-chan []byte {\n\trv := make(chan []byte)\n\tgo func() {\n\t\tdefer close(rv)\n\t\tindex := 0\n\t\tstack := make([][]byte, 0)\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase b, ok := <-input:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tstack = append(stack, merkle.LeafHash(b.GetLeafInput()))\n\t\t\t}\n\n\t\t\tfor j := index; (j & 1) == 1; j >>= 1 {\n\t\t\t\tstack = append(stack[:len(stack)-2], merkle.NodeHash(stack[len(stack)-2], stack[len(stack)-1]))\n\t\t\t}\n\n\t\t\trh := stack[len(stack)-1]\n\t\t\tfor j := len(stack) - 2; j >= 0; j-- {\n\t\t\t\trh = merkle.NodeHash(stack[j], rh)\n\t\t\t}\n\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase rv <- rh:\n\t\t\t\tindex++\n\t\t\t}\n\t\t}\n\t}()\n\treturn rv\n}", "func hashCode(key string) int64 {\n\tv := int64(crc32.ChecksumIEEE([]byte(key)))\n\tif v >= 0 {\n\t\treturn v\n\t}\n\tif -v > 0 {\n\t\treturn -v\n\t}\n\t// v == MinInt\n\treturn 0\n}" ]
[ "0.6185094", "0.6163292", "0.6006869", "0.59640056", "0.5943054", "0.5922559", "0.5867593", "0.58194095", "0.5785975", "0.57525444", "0.5704679", "0.5667827", "0.5604741", "0.5592587", "0.558746", "0.55859965", "0.55706024", "0.5570442", "0.5508317", "0.5495532", "0.5494974", "0.548678", "0.54603016", "0.5445345", "0.5434822", "0.5426919", "0.5411761", "0.54013336", "0.5394447", "0.53902537", "0.53587943", "0.5346396", "0.53412116", "0.5336846", "0.5328489", "0.5324508", "0.5323353", "0.53212094", "0.53103924", "0.53088176", "0.52919805", "0.52861977", "0.5270374", "0.5261258", "0.52461666", "0.52451015", "0.5242305", "0.5220778", "0.522059", "0.52109724", "0.5202502", "0.5199718", "0.5198025", "0.51912475", "0.5177085", "0.5167007", "0.5164873", "0.51629853", "0.5162395", "0.5160755", "0.5156426", "0.514878", "0.5140133", "0.51390725", "0.51219577", "0.5113144", "0.5113046", "0.51123816", "0.51090044", "0.5108682", "0.5107165", "0.5104883", "0.5099851", "0.5093761", "0.5091183", "0.5089414", "0.50888574", "0.50878865", "0.5080294", "0.5076314", "0.5072467", "0.5069838", "0.5065908", "0.50647944", "0.5064484", "0.5063295", "0.506291", "0.5062121", "0.50589246", "0.50508416", "0.50490326", "0.50481206", "0.504762", "0.5046996", "0.50437444", "0.5040771", "0.5039946", "0.50392365", "0.5037806", "0.5030525" ]
0.63743734
0
GetChainKey implemented in memory.
func (ms *MemStore) GetChainKey(sessionKey string) (*[32]byte, error) { s, ok := ms.sessions[sessionKey] if !ok { return nil, log.Errorf("memstore: no session found for %s", sessionKey) } // decode chain key var key [32]byte k, err := base64.Decode(s.chainKey) if err != nil { return nil, log.Error("memstore: cannot decode chain key") } if copy(key[:], k) != 32 { return nil, log.Errorf("memstore: chain key has wrong length") } return &key, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetChainKey(chainID string) []byte {\n\treturn append(KeyPrefix(ChainKey), []byte(chainID)...)\n}", "func (hs *HandshakeState) GetChainingKey() []byte {\n\treturn hs.ss.chainingKey[:]\n}", "func (k *Keychain) Key() (string, error) {\n\tkey, err := k.BinKey()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn hex.EncodeToString(key), nil\n}", "func GetTheBlockKey(chain, index uint64) []byte {\n\tvar key Hash\n\tif chain == 0 {\n\t\treturn nil\n\t}\n\tif index == 0 {\n\t\tvar pStat BaseInfo\n\t\tgetDataFormDB(chain, dbStat{}, []byte{StatBaseInfo}, &pStat)\n\t\treturn pStat.Key[:]\n\t}\n\tgetDataFormLog(chain, logBlockInfo{}, runtime.Encode(index), &key)\n\tif key.Empty() {\n\t\treturn nil\n\t}\n\treturn key[:]\n}", "func GetKey(t *testing.T) []byte {\n\tt.Helper()\n\n\tk, _ := GeneratePrivateKey()\n\treturn k.Data[:]\n}", "func (m LocalTransit) GetKey(context string) ([]byte, error) {\n\tif m.KeyProvider == nil {\n\t\treturn nil, ex.New(\"local transit; key provider is unset\")\n\t}\n\treturn m.KeyProvider(context)\n}", "func (ctx *Context) APIKeychain() *Keychain {\n\treturn ctx.apiKeychain\n}", "func (s *State) SenderChainKey() session.ChainKeyable {\n\tchainKey := s.senderChain.chainKey\n\treturn chain.NewKey(kdf.DeriveSecrets, chainKey.Key(), chainKey.Index())\n}", "func (rk *caIdemixRevocationKey) GetKey() *ecdsa.PrivateKey {\n\treturn rk.key\n}", "func (w *Wallet) GetKey(address types.UnlockHash) (pk types.PublicKey, sk types.ByteSlice, err error) {\n\tw.mu.RLock()\n\tpk, sk, err = w.getKey(address)\n\tw.mu.RUnlock()\n\treturn\n}", "func (p *bitsharesAPI) GetChainID() objects.ChainID {\n\treturn p.chainID // return cached value\n}", "func (symmetricKey *SymmetricKey) GetKey() []byte {\n\tsymmetricKey.mutex.RLock()\n\tdefer symmetricKey.mutex.RUnlock()\n\treturn symmetricKey.SymmetricKey\n}", "func (s *SmartContract) queryChainKey(stub shim.ChaincodeStubInterface, args []string) sc.Response {\n\tif len(args) != 1 {\n\t\tshim.Error(\"Incorrect number of arguments, Expecting 1\")\n\t}\n\tchainkeyAsBytes, _ := stub.GetState(args[0])\n\tdata := string(chainkeyAsBytes)\n\tfmt.Println(\"Returning list of Asset %s args[0]\", data)\n\n\tif chainkeyAsBytes == nil {\n\t\treturn shim.Error(\"could not locate Asset\")\n\t}\n\treturn shim.Success(chainkeyAsBytes)\n}", "func NewKeychain() *Keychain {\n\treturn &Keychain{}\n}", "func (s *State) ReceiverChainKey(senderEphemeral ecc.ECPublicKeyable) *chain.Key {\n\treceiverChainAndIndex := s.receiverChain(senderEphemeral)\n\treceiverChain := receiverChainAndIndex.ReceiverChain\n\n\tif receiverChainAndIndex == nil || receiverChain == nil {\n\t\treturn nil\n\t}\n\n\treturn chain.NewKey(\n\t\tkdf.DeriveSecrets,\n\t\treceiverChain.chainKey.Key(),\n\t\treceiverChain.chainKey.Index(),\n\t)\n}", "func ChainName() string {\n\tglobalData.RLock()\n\tdefer globalData.RUnlock()\n\treturn globalData.chain\n}", "func NewKeychain() *Keychain {\n\tk := &Keychain{\n\t\tkeys: make([][]byte, 0, keychainLen),\n\t}\n\treturn k\n}", "func (ctx Ctx) Key(at KeyPairID) (res Key, err error) {\n\tif C.CryptGetUserKey(ctx.hProv, C.DWORD(at), &res.hKey) == 0 {\n\t\terr = getErr(\"Error getting key for container\")\n\t\treturn\n\t}\n\treturn\n}", "func GetValidatorKey(address sdk.Address, power sdk.Rational, cdc *wire.Codec) []byte {\n\tb, _ := cdc.MarshalJSON(power) // TODO need to handle error here?\n\treturn append(ValidatorKeyPrefix, append(b, address.Bytes()...)...) // TODO does this need prefix if its in its own store\n}", "func (key twofishKey) Key() []byte {\n\treturn key[:]\n}", "func GetWorkKey() ([]byte, error) {\n\t// get root key by key components\n\trootKey, genRootKeyErr := genRootKey(ComponentFilePath, SaltFilePath)\n\tif genRootKeyErr != nil {\n\t\tlog.Errorf(nil, \"Failed to generate root key by key components.\")\n\t\treturn nil, genRootKeyErr\n\t}\n\tlog.Info(\"Succeed to generate root key by key components.\")\n\n\t// decrypt work key by root key.\n\tworkKey, decryptedWorkKeyErr := decryptKey(rootKey, EncryptedWorkKeyFilePath, WorkKeyNonceFilePath)\n\t// clear root key\n\tClearByteArray(rootKey)\n\tif decryptedWorkKeyErr != nil {\n\t\tlog.Errorf(nil, decryptedWorkKeyErr.Error())\n\t\treturn nil, decryptedWorkKeyErr\n\t}\n\tlog.Info(\"Succeed to decrypt work key.\")\n\treturn workKey, nil\n}", "func (keyDB *KeyDB) GetHashChainEntry(domain string, position uint64) (string, error) {\n\tvar entry string\n\tdmn := identity.MapDomain(domain)\n\terr := keyDB.getHashChainEntryQuery.QueryRow(dmn, position).Scan(&entry)\n\tswitch {\n\tcase err != nil:\n\t\treturn \"\", log.Error(err)\n\tdefault:\n\t\treturn entry, nil\n\t}\n}", "func (k KeyStore) Get(address bitcoin.RawAddress) (*Key, error) {\r\n\thash, err := address.Hash()\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\tkey, ok := k.Keys[*hash]\r\n\tif !ok {\r\n\t\treturn nil, ErrKeyNotFound\r\n\t}\r\n\treturn key, nil\r\n}", "func (ips *IPAMState) GetKey() string {\n\treturn ips.IPAMPolicy.GetKey()\n}", "func (d *Disk) getKey(p *DiskParams) []byte {\n\treturn []byte(time_util.TimeToName(time.Unix(p.ExicutionTime, 0), fmt.Sprintf(\"%x\", d.hasher.Sum(nil))))\n}", "func (l *License) GetKey() string {\n\tif l == nil || l.Key == nil {\n\t\treturn \"\"\n\t}\n\treturn *l.Key\n}", "func (level DepthOfMarketLevel) GetKey() float64 { return level[0] }", "func (st *MemStorage) GetKey(gun, role string) (algorithm string, public []byte, err error) {\n\t// no need for lock. It's ok to return nil if an update\n\t// wasn't observed\n\tg, ok := st.keys[gun]\n\tif !ok {\n\t\treturn \"\", nil, &ErrNoKey{gun: gun}\n\t}\n\tk, ok := g[role]\n\tif !ok {\n\t\treturn \"\", nil, &ErrNoKey{gun: gun}\n\t}\n\n\treturn k.algorithm, k.public, nil\n}", "func (mci *XMCacheIterator) Key() []byte {\n\tif mci.err != nil || mci.dir == dirReleased {\n\t\treturn nil\n\t}\n\tswitch mci.index {\n\tcase 0, 1:\n\t\treturn mci.iters[mci.index].Key()\n\tcase 2:\n\t\tif mci.mc.isPenetrate {\n\t\t\treturn mci.mIter.Key()\n\t\t}\n\t\treturn nil\n\t}\n\treturn nil\n}", "func (keyRing *KeyRing) GetKey(n int) (*Key, error) {\n\tif n >= keyRing.CountEntities() {\n\t\treturn nil, errors.New(\"gopenpgp: out of bound when fetching key\")\n\t}\n\treturn &Key{keyRing.entities[n]}, nil\n}", "func (k *Keychain) BinKey() ([]byte, error) {\n\tk.m.RLock()\n\tif len(k.keys) == 0 {\n\t\tk.m.RUnlock()\n\t\treturn nil, ErrNoKeys\n\t}\n\tkey := k.keys[0]\n\tk.m.RUnlock()\n\treturn key, nil\n}", "func (c Node) GetKey() string {\n\treturn c.key\n}", "func (s *ChaincodeStubWrapper) Get(key datastore.Key) ([]byte, error) {\n\tlogger.Debugf(\"Getting key %s\", key)\n\n\tv, err := s.stub.GetPrivateData(s.collection, key.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(v) == 0 {\n\t\treturn nil, datastore.ErrNotFound\n\t}\n\n\treturn v, nil\n}", "func (s *PublicTransactionPoolAPI) GetTxKey(ctx context.Context, hash common.Hash, addr *common.Address) (*lkctypes.Key, error) {\n\treturn s.wallet.GetTxKey(&hash, addr)\n}", "func (m *KeyValue) GetKey()(*string) {\n return m.key\n}", "func GetChainID(ctx Context) string {\n\tif x := ctx.Value(contextKeyChainID); x == nil {\n\t\tpanic(\"Chain id is not in context\")\n\t}\n\treturn ctx.Value(contextKeyChainID).(string)\n}", "func (m *RegistryKeyState) GetKey()(*string) {\n return m.key\n}", "func (sgp *SgpolicyState) GetKey() string {\n\treturn sgp.NetworkSecurityPolicy.GetKey()\n}", "func (p *Provider) GetKey() interface{} {\n\treturn p.key\n}", "func (transaction *AccountCreateTransaction) GetKey() (Key, error) {\n\treturn transaction.key, nil\n}", "func (o *Gojwt) GetPubKeyPath()(string){\n return o.pubKeyPath\n}", "func GetValidatorKey(chainID string, valAddress sdk.ValAddress) []byte {\n\tkey := append(KeyPrefix(ValidatorKey), []byte(chainID)...)\n\n\t// We use \"_\" to separate chainID and proposalID to avoid prefix conflic since \"-\" is allowed in chainID\n\tkey = append(key, []byte(\"_\")...)\n\treturn append(key, valAddress.Bytes()...)\n}", "func (m *Win32LobAppRegistryDetection) GetKeyPath()(*string) {\n val, err := m.GetBackingStore().Get(\"keyPath\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (c VpnCredential) GetKey() string {\n\treturn c.Key\n}", "func (a *LocalKeyAgent) GetCoreKey() (*Key, error) {\n\treturn a.GetKey(\"\")\n}", "func (i GinJwtSignAlgorithm) Key() string {\n\tif val, ok := _GinJwtSignAlgorithmValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "func (s HTTPStore) GetKey(role data.RoleName) ([]byte, error) {\n\turl, err := s.buildKeyURL(role)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq, err := http.NewRequest(\"GET\", url.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := s.roundTrip.RoundTrip(req)\n\tif err != nil {\n\t\treturn nil, NetworkError{Wrapped: err}\n\t}\n\tdefer resp.Body.Close()\n\tif err := translateStatusToError(resp, role.String()+\" key\"); err != nil {\n\t\treturn nil, err\n\t}\n\tb := io.LimitReader(resp.Body, MaxKeySize)\n\tbody, err := ioutil.ReadAll(b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn body, nil\n}", "func (km *KeyManager) GetPathKey(path string, i int) (*bip32.Key, error) {\n\tkey, ok := km.getKey(path)\n\tif ok {\n\t\treturn key, nil\n\t}\n\n\tif path == \"m\" {\n\t\treturn km.getMasterKey()\n\t}\n\n\tderivationPath, err := ParseDerivationPath(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tparentPath := derivationPath[:i] \t\n\tparent, err := km.GetPathKey(parentPath.toString(), i-1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkey, err = parent.NewChildKey(derivationPath[i])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkm.setKey(path, key)\n\treturn key, nil\n}", "func (transaction *TokenUpdateTransaction) GetSupplyKey() Key {\n\treturn transaction.supplyKey\n}", "func (obj *key) Key() rsa.PublicKey {\n\treturn obj.ky\n}", "func (stateID StateID) Key() string {\n\treturn string(stateID.LastAppHash)\n}", "func (i service) GetKey(did id.DID, key [32]byte) (*id.KeyResponse, error) {\n\tcontract, opts, _, err := i.prepareCall(did)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult, err := contract.GetKey(opts, key)\n\n\tif err != nil {\n\t\treturn nil, errors.New(\"Could not call identity contract: %v\", err)\n\t}\n\n\treturn &id.KeyResponse{result.Key, result.Purposes, result.RevokedAt}, nil\n\n}", "func (blockID BlockID) Key() string {\n\tpbph := blockID.PartSetHeader.ToProto()\n\tbz, err := pbph.Marshal()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn fmt.Sprint(string(blockID.Hash), string(bz))\n}", "func (blockID BlockID) Key() string {\n\tpbph := blockID.PartSetHeader.ToProto()\n\tbz, err := pbph.Marshal()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn fmt.Sprint(string(blockID.Hash), string(bz))\n}", "func (acc *Account) Key() []byte {\n\treturn []byte(acc.Email)\n}", "func (m *Win32LobAppRegistryRule) GetKeyPath()(*string) {\n return m.keyPath\n}", "func GetIterationKey(clientStore sdk.KVStore, height exported.Height) []byte {\n\tkey := IterationKey(height)\n\treturn clientStore.Get(key)\n}", "func GetKey(size int) []byte {\n\treturn GetIV(size)\n}", "func GetValidatorKey(pubKey crypto.PubKey, power types.Rational) []byte {\n\tb, _ := cdc.MarshalJSON(power) // TODO need to handle error here?\n\treturn append(ValidatorKeyPrefix, append(b, pubKey.Bytes()...)...) // TODO does this need prefix if its in its own store\n}", "func (eln *EmptyLeafNode) GetKey() []byte {\n\treturn nil\n}", "func (itr *Iterator) Key() []byte {\n\treturn retrieveAppKey(itr.Iterator.Key())\n}", "func GetAccountKey(chainID string, accountAddress sdk.AccAddress) []byte {\n\tkey := append(KeyPrefix(AccountKey), []byte(chainID)...)\n\n\t// We use \"_\" to separate chainID and proposalID to avoid prefix conflic since \"-\" is allowed in chainID\n\tkey = append(key, []byte(\"_\")...)\n\treturn append(key, accountAddress.Bytes()...)\n}", "func (f binaryEqualsFunc) key() Key {\n\treturn f.k\n}", "func (t *Tx) GetTxKey() (string, error) {\n\tif t.Tx == nil {\n\t\treturn \"\", ErrNilTx\n\t}\n\n\tb, err := ultpb.Encode(t.Tx)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"encode tx failed: %v\", err)\n\t}\n\n\ttxKey := &crypto.ULTKey{\n\t\tCode: crypto.KeyTypeTx,\n\t\tHash: crypto.SHA256HashBytes(b),\n\t}\n\tkeyStr := crypto.EncodeKey(txKey)\n\n\treturn keyStr, nil\n}", "func (area *MineArea) GetKey() string {\n\treturn GetKey(area.X, area.Y)\n}", "func (b *BigIP) GetKey(name string) (*Key, error) {\n\tvar key Key\n\terr, ok := b.getForEntity(&key, uriSys, uriCrypto, uriKey, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !ok {\n\t\treturn nil, nil\n\t}\n\n\treturn &key, nil\n}", "func GetEncryptionKey(agentID uuid.UUID) []byte {\n\tif core.Debug {\n\t\tmessage(\"debug\", \"Entering into agents.GetEncryptionKey function\")\n\t}\n\tvar key []byte\n\n\tif isAgent(agentID) {\n\t\tkey = Agents[agentID].secret\n\t}\n\n\tif core.Debug {\n\t\tmessage(\"debug\", \"Leaving agents.GetEncryptionKey function\")\n\t}\n\treturn key\n}", "func (coord *Coordinator) GetChain(chainID string) *TestChain {\n\tchain, found := coord.Chains[chainID]\n\trequire.True(coord.t, found, fmt.Sprintf(\"%s chain does not exist\", chainID))\n\treturn chain\n}", "func GetMyChain() BlockChain {\r\n\treturn myChain.Chain\r\n}", "func GetChainID(index int) string {\n\treturn ChainIDPrefix + strconv.Itoa(index)\n}", "func (pk *PublicKey) Key() string {\n\treturn string(pk.PublicKeyHex.Value)\n}", "func (key StepsCacheKey) Key() (string, error) {\n\treturn marshalAndHashStepsCacheKey(key, []string{})\n}", "func GetInteropChaincodeIDKey() string {\n\treturn \"interopChaincodeID\"\n}", "func (b *BitSet) Key() string {\n\tif b == nil {\n\t\treturn \"\"\n\t} else {\n\t\treturn string(b.Bits.Bytes())\n\t}\n}", "func (am *AppchainManager) GetPubKeyByChainID(id string) (bool, []byte) {\n\tok := am.Has(am.appchainKey(id))\n\tif !ok {\n\t\treturn false, []byte(\"chain is not existed\")\n\t} else {\n\t\tchain := &Appchain{}\n\t\tam.GetObject(am.appchainKey(id), chain)\n\t\treturn true, []byte(chain.PublicKey)\n\t}\n}", "func (iter *dbCacheIterator) Key() []byte {\n\t// Nothing to return if iterator is exhausted.\n\tif iter.currentIter == nil {\n\t\treturn nil\n\t}\n\n\treturn iter.currentIter.Key()\n}", "func (ck *CertKey) Key() []byte { return ck.key }", "func Key(hash *chainhash.Hash) [gcs.KeySize]byte {\n\tvar key [gcs.KeySize]byte\n\tcopy(key[:], hash[:])\n\treturn key\n}", "func (model *Trade) Key() string {\n\treturn model.Tbk.GetItemKey()\n}", "func (m *SearchBucket) GetKey()(*string) {\n return m.key\n}", "func (s *Subscription) GetKey() string {\n\tbaseURL, _ := url.Parse(s.BaseURL)\n\tfields := []string{\n\t\ts.VCSType,\n\t\tbaseURL.Hostname(),\n\t\ts.OrgName,\n\t\ts.RepoName,\n\t}\n\tkey := strings.Join(fields, \"_\")\n\treturn util.GetKeyHash(key)\n}", "func (bi *Blockchainidentifier) GetChain(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(r.RemoteAddr + \" GET /chain\")\n\n\tresponseMessage := map[string]interface{}{\n\t\t\"chain\": bi.Blocks,\n\t\t\"length\": len(bi.Blocks),\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(responseMessage)\n}", "func (h dataUsageHash) Key() string {\n\treturn string(h)\n}", "func (n *lnode) key() []byte {\n\tbuf := (*[maxAllocSize]byte)(unsafe.Pointer(n))\n\treturn buf[n.pos : n.pos+n.ksize]\n}", "func (o *Gojwt) GetPrivKeyPath()(string){\n return o.privKeyPath\n}", "func (k Keeper) getInviteStoreKey(user sdk.AccAddress) []byte {\n\treturn []byte(types.InviteStorePrefix + user.String())\n}", "func (cs ClientState) GetChainID() string {\n\treturn cs.ChainID\n}", "func (ce *ClientEncryption) GetKey(ctx context.Context, id primitive.Binary) *SingleResult {\n\tfilter := bsoncore.NewDocumentBuilder().AppendBinary(\"_id\", id.Subtype, id.Data).Build()\n\treturn ce.keyVaultColl.FindOne(ctx, filter)\n}", "func (_TokensNetwork *TokensNetworkCallerSession) ChainId() (*big.Int, error) {\n\treturn _TokensNetwork.Contract.ChainId(&_TokensNetwork.CallOpts)\n}", "func ChainLinksStoreKey(user, chainName, address string) []byte {\n\treturn append(UserChainLinksPrefix(user), []byte(chainName+address)...)\n}", "func (this *DefaultHandler) GetKey(xesRedis redo.XesRedisBase) (ret string) {\n\tdefer func() {\n\t\tif xesRedis.GetCtx() == nil {\n\t\t\treturn\n\t\t}\n\t\tbench := xesRedis.GetCtx().Value(\"IS_BENCHMARK\")\n\t\tif cast.ToString(bench) == \"1\" {\n\t\t\tret = \"benchmark_\" + ret\n\t\t}\n\t}()\n\n\tkeyInfo := this.getKeyInfo(xesRedis)\n\tkey := cast.ToString(keyInfo[\"key\"])\n\tif key == \"\" {\n\t\tret = xesRedis.GetKeyName()\n\t\treturn\n\t}\n\tret = fmt.Sprintf(key, (xesRedis.GetKeyParams())...)\n\treturn\n}", "func (it *iterator) Key() []byte {\n\treturn utils.CopyBytes(it.key)\n}", "func (c *Client) GetKey() (types.EncKey, error) {\n\n\treturn types.EncKey{}, nil\n}", "func (k *Keyring) Get(kid keys.ID) (*api.Key, error) {\n\tif err := k.initDB(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn getKey(k.db, kid)\n}", "func (_TokensNetwork *TokensNetworkSession) ChainId() (*big.Int, error) {\n\treturn _TokensNetwork.Contract.ChainId(&_TokensNetwork.CallOpts)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementLabelMatchStatementPtrOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementLabelMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Key\n\t}).(pulumi.StringPtrOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementOrStatementStatementLabelMatchStatementPtrOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementAndStatementStatementOrStatementStatementOrStatementStatementLabelMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Key\n\t}).(pulumi.StringPtrOutput)\n}", "func (core *coreService) ChainID() uint32 {\n\treturn core.bc.ChainID()\n}", "func GetProposalKey(chainID string, proposalID int32) []byte {\n\tkey := append(KeyPrefix(ProposalKey), []byte(chainID)...)\n\n\t// We use \"_\" to separate chainID and proposalID to avoid prefix conflic since \"-\" is allowed in chainID\n\tkey = append(key, []byte(\"_\")...)\n\treturn append(key, []byte(strconv.Itoa(int(proposalID)))...)\n}", "func (i *Iterator) Key() []byte {\n\treturn i.iterator.Item().KeyCopy(nil)\n}" ]
[ "0.7708475", "0.6766239", "0.6656993", "0.6499389", "0.6392745", "0.62943345", "0.62314993", "0.6175444", "0.6171842", "0.614765", "0.6102029", "0.6063963", "0.6012486", "0.59941924", "0.5986066", "0.5903795", "0.589596", "0.5884794", "0.58799124", "0.5879614", "0.58652234", "0.583999", "0.5836492", "0.5822572", "0.5781878", "0.57637817", "0.57624197", "0.57595277", "0.5757929", "0.5753992", "0.5751088", "0.57235897", "0.5719422", "0.57118845", "0.5702504", "0.57016224", "0.5700033", "0.5693133", "0.5689015", "0.56722546", "0.56717265", "0.5668787", "0.56571794", "0.56531423", "0.56474", "0.5646877", "0.56358916", "0.56295365", "0.56265545", "0.5623859", "0.56230706", "0.5622", "0.56169003", "0.56169003", "0.5615133", "0.5609858", "0.5607785", "0.5600417", "0.55967396", "0.5590956", "0.5586986", "0.55815446", "0.5579036", "0.5577469", "0.5567039", "0.55649054", "0.55573726", "0.55475765", "0.5538755", "0.55291915", "0.5525391", "0.5522816", "0.5521084", "0.5520661", "0.55096495", "0.5503217", "0.54931587", "0.54924536", "0.54855114", "0.547792", "0.54723054", "0.5472227", "0.5460194", "0.5453527", "0.54488385", "0.5443277", "0.5437515", "0.5435174", "0.5431243", "0.5425836", "0.5425288", "0.5420524", "0.5418184", "0.5391123", "0.539058", "0.53900325", "0.53894234", "0.5386728", "0.53834534", "0.53823787" ]
0.75926346
1
DelMessageKey implemented in memory.
func (ms *MemStore) DelMessageKey( sessionKey string, sender bool, msgIndex uint64, ) error { s, ok := ms.sessions[sessionKey] if !ok { return log.Errorf("memstore: no session found for %s", sessionKey) } if msgIndex >= uint64(len(s.send)) { return log.Error("memstore: message index out of bounds") } // delete key if sender { s.send[msgIndex] = "" } else { s.recv[msgIndex] = "" } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (k Keeper) RemoveMessage(ctx sdk.Context, id uint64) {\n\tstore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.MessageKey))\n\tstore.Delete(GetMessageIDBytes(id))\n}", "func (c Context) Del(key string) {\n\tdelete(c.data, key)\n}", "func (u *UdMap) Del(key string) { delete(u.Data, key) }", "func (sm safeMap) Delete(key string) {\n\tsm <- commandData{action: REMOVE, key: key}\n}", "func (this *mMap) Del(k string) (result int64, err error) {\n\tkey := this.Key(k)\n\tresult, err = this.Client.Del(key).Result()\n\treturn\n}", "func (db *MemoryStorage) Del(key []byte) error {\n\tdb.data.Delete(common.BytesToHex(key))\n\treturn nil\n}", "func (c *memoryCache) Del(key string) {\n\tdelete(c.data, key)\n}", "func (s *State) RemoveMessageKeys(senderEphemeral ecc.ECPublicKeyable, counter uint32) *message.Keys {\n\t// Get our chain state that has our chain key.\n\tchainAndIndex := s.receiverChain(senderEphemeral)\n\tchainKey := chainAndIndex.ReceiverChain\n\n\t// If the chain is empty, we don't have any message keys.\n\tif chainKey == nil {\n\t\treturn nil\n\t}\n\n\t// Get our message keys from our receiver chain.\n\tmessageKeyList := chainKey.MessageKeys()\n\n\t// Loop through our message keys and compare its index with the\n\t// given counter. When we find a match, remove it from our list.\n\tvar rmIndex int\n\tfor i, messageKey := range messageKeyList {\n\t\tif messageKey.Index() == counter {\n\t\t\trmIndex = i\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Retrive the message key\n\tmessageKey := chainKey.messageKeys[rmIndex]\n\n\t// Delete the message key from the given position.\n\tchainKey.messageKeys = append(chainKey.messageKeys[:rmIndex], chainKey.messageKeys[rmIndex+1:]...)\n\n\treturn message.NewKeys(\n\t\tmessageKey.CipherKey(),\n\t\tmessageKey.MacKey(),\n\t\tmessageKey.Iv(),\n\t\tmessageKey.Index(),\n\t)\n}", "func DEL(key string) (err error) {\n\tconn := pool.Get()\n\tdefer conn.Close()\n\n\t_, err = conn.Do(\"DEL\", key)\n\treturn\n}", "func MessageKey(authKey Key, plaintextPadded []byte, mode Side) bin.Int128 {\n\t// `msg_key_large = SHA256 (substr (auth_key, 88+x, 32) + plaintext + random_padding);`\n\tmsgKeyLarge := msgKeyLarge(authKey, plaintextPadded, mode)\n\t// `msg_key = substr (msg_key_large, 8, 16);`\n\treturn messageKey(msgKeyLarge)\n}", "func (d Data) Del(key uint32) {\n\td.mutex.Lock()\n\tcount := d.counts[key]\n\tcount -= 1\n\tif count < 1 {\n\t\tdelete(d.data, key)\n\t\tdelete(d.counts, key)\n\t} else {\n\t\td.counts[key] = count\n\t}\n\td.mutex.Unlock()\n}", "func (db *memorydb) Del(key []byte) error {\n\n\tif db.enableBatch {\n\t\tdb.batch.Del(key)\n\t} else {\n\t\tdb.writeLock <- struct{}{}\n\t\tdefer func() {\n\t\t\t<-db.writeLock\n\t\t}()\n\n\t\tdb.sm.Lock()\n\t\tdefer db.sm.Unlock()\n\n\t\tdelete(db.db, string(key))\n\t}\n\n\treturn nil\n}", "func (m *Uint64) Delete(key interface{}) {\n\tm.m.Delete(key)\n}", "func (fi *FastIntegerHashMap) Delete(key uint64) {\n\tif fi.packets.delete(key) {\n\t\tfi.count--\n\t}\n}", "func (n *Notification) DelKey(key string) error {\n\tfor i, value := range n.apikeys {\n\t\tif strings.EqualFold(key, value) {\n\t\t\tcopy(n.apikeys[i:], n.apikeys[i+1:])\n\t\t\tn.apikeys[len(n.apikeys)-1] = \"\"\n\t\t\tn.apikeys = n.apikeys[:len(n.apikeys)-1]\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn errors.New(\"Error, key not found\")\n}", "func DecryptMessage(key []byte, message []byte) ([]byte, error) {\n // Key should be 32byte (256bit)\n block, err := aes.NewCipher(key)\n if err != nil {\n return nil, err\n }\n\n aead, err := cipher.NewGCM(block)\n if err != nil {\n return nil, err\n }\n\n nonceSize := aead.NonceSize()\n if len(message) < nonceSize {\n return nil, err\n }\n\n nonce, ciphertext := message[:nonceSize], message[nonceSize:]\n return aead.Open(nil, nonce, ciphertext, nil)\n}", "func (md Metadata) Del(key string) {\n\t// fast path\n\tif _, ok := md[key]; ok {\n\t\tdelete(md, key)\n\t} else {\n\t\t// slow path\n\t\tdelete(md, textproto.CanonicalMIMEHeaderKey(key))\n\t}\n}", "func MsgKey(s string) {\n\tmsgKey = s\n\tgenLevelSlices()\n}", "func (ms *MongoStore) DeleteMessage(id MessageID) error {\n\terr := ms.Session.DB(ms.DatabaseName).C(ms.MessagesCollectionName).RemoveId(id)\n\treturn err\n}", "func (m *Message) Delete() error {\n\treturn globalMessage.Delete(m.ID)\n}", "func (h Header) Del(key string) {\n\ttextproto.MIMEHeader(h).Del(key)\n}", "func (t *Tkeyid) DelFromKey(key string) (id uint, ok bool) {\n\tid, ok = t.keytoid[key]\n\tif ok {\n\t\tdelete(t.idtokey, id)\n\t\tdelete(t.keytoid, key)\n\t}\n\treturn\n}", "func (p *Parser) Del(key string) {\n\tm, err := p.Map()\n\tif err != nil {\n\t\treturn\n\t}\n\tdelete(m, key)\n}", "func (c *SimpleMemoryCache) Del(ctx *Context, next Next) {\n\tdelete(c.data, ctx.Key)\n}", "func Del(key string) error {\n\treturn db.Update(func(txn *badger.Txn) error {\n\t\ttxn.Delete([]byte(key))\n\t\treturn nil\n\t})\n}", "func (m Message) Key() []byte {\n\tstart, end, size := m.keyOffsets()\n\tif size == -1 {\n\t\treturn nil\n\t}\n\treturn m[start+4 : end]\n}", "func (p *metadataService) deleteMessage(clientID string, pid uint16, direction uint8) {\n\tp.deleteMessageWithValidator(clientID, func(msg *base.Message) bool {\n\t\treturn msg.PacketId == pid && msg.Direction == direction\n\t})\n}", "func (h CommonHeader) Del(key string) {\n\tdelete(h, key)\n}", "func (f *Flash) Del(key string) {\n\tif !f.Has(key) {\n\t\treturn\n\t}\n\tif !f.changed {\n\t\tf.changed = true\n\t}\n\tf.v.Del(key)\n}", "func (h *hashMap) Del(strKey string) {\n\tkey := GetHash(strKey)\n\tbucket := h.getBucket(key)\n\tbucket.remove(Regularkey(key))\n}", "func deletedKey(key string) string {\n\treturn key + \":deleted\"\n}", "func (service *service) decrKey(key string) (int64, error) {\n\treturn service.client.Decr(key).Result()\n}", "func (e DeleteMessageRequestValidationError) Key() bool { return e.key }", "func handleMsgDelete(ctx sdk.Context, k Keeper, msg *MsgDelete) (*sdk.Result, error) {\n\tif err := k.Delete(ctx, msg); err != nil {\n\t\treturn nil, err\n\t}\n\n\tctx.EventManager().EmitEvent(\n\t\tsdk.NewEvent(\n\t\t\tsdk.EventTypeMessage,\n\t\t\tsdk.NewAttribute(sdk.AttributeKeyModule, ModuleName),\n\t\t\tsdk.NewAttribute(sdk.AttributeKeySender, msg.Owner.String()),\n\t\t),\n\t)\n\n\treturn &sdk.Result{Events: ctx.EventManager().Events()}, nil\n}", "func (h *RequestHeader) Del(key string) {\n\tk := getHeaderKeyBytes(&h.bufKV, key, h.disableNormalizing)\n\th.del(k)\n}", "func (s *service) Del(key string) error {\n\treturn s.redis.Del(key).Err()\n}", "func (o *AuthMessage) Delete(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no AuthMessage provided for delete\")\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), authMessagePrimaryKeyMapping)\n\tsql := \"DELETE FROM `auth_message` WHERE `id`=?\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete from auth_message\")\n\t}\n\n\treturn nil\n}", "func ExampleClient_DeleteMessage() {\n\tclient := sqwiggle.NewClient(\"YOUR-API-KEY\")\n\n\tmessageID := 48914\n\terr := client.DeleteMessage(messageID)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func (m XmlToMap) Del(key string) {\n\tdelete(m, key)\n}", "func DeleteMessage(clientId string, mid uint16, direction MessageDirection) error {\n\tmeta := broker.GetService(ServiceName).(*MetadataService)\n\treturn meta.deleteMessage(clientId, mid, direction)\n}", "func (p Parameters) Del(key string) {\n\tdelete(p, key)\n}", "func DelKey(filename, JSONpath string) error {\n\tjf, err := NewFile(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn jf.DelKey(JSONpath)\n}", "func (s *server) Del(key string) {\n\tres := make(chan bool)\n\ts.ops <- func() {\n\t\tdelete(s.store, key)\n\t\tres <- true\n\t}\n\t<-res\n}", "func (rc *RedisClient) Del(key string) (int64, error) {\n\tconn := rc.pool.Get()\n\tdefer conn.Close()\n\treply, errDo := conn.Do(\"DEL\", key)\n\tif errDo == nil && reply == nil {\n\t\treturn 0, nil\n\t}\n\tval, err := redis.Int64(reply, errDo)\n\treturn val, err\n}", "func (m *MemoryStorer) Del(key string) error {\n\tm.mut.Lock()\n\tdelete(m.sessions, key)\n\tm.mut.Unlock()\n\n\treturn nil\n}", "func (keyDB *KeyDB) DelPrivateUID(msg *uid.Message) error {\n\tif _, err := keyDB.delPrivateUIDQuery.Exec(msg.JSON()); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func DeleteMessage() {\n\n}", "func (c *cache) Del(key string) error {\n\terr := c.cacheConn.Del(key).Err()\n\tif err != nil {\n\t\tlogger.Log().Error(\"Error while deleting key\", zap.String(\"key\", key), zap.Error(err))\n\t\treturn err\n\t}\n\treturn nil\n}", "func (ms *MemStore) DelPrivSessionKey(hash string) error {\n\tsk, ok := ms.sessionKeys[hash]\n\tif !ok {\n\t\treturn nil\n\t}\n\tsk.privKey = \"\"\n\treturn nil\n}", "func messageKey(messageKeyLarge []byte) bin.Int128 {\n\tvar v bin.Int128\n\tb := messageKeyLarge[8 : 16+8]\n\tcopy(v[:len(b)], b)\n\treturn v\n}", "func (b *OGame) DeleteMessage(msgID int64) error {\n\treturn b.WithPriority(taskRunner.Normal).DeleteMessage(msgID)\n}", "func (fb *FlatBatch) Delete(key []byte) error { panic(\"not supported\") }", "func (db *Database) DeleteMessageRead(messageID mail.ID) error {\n\treturn db.db.Update(func(txn *badger.Txn) error {\n\t\treturn txn.Delete(db.messageReadKey(messageID))\n\t})\n}", "func (h *ResponseHeader) Del(key string) {\n\tk := getHeaderKeyBytes(&h.bufKV, key, h.disableNormalizing)\n\th.del(k)\n}", "func (db *Database) DeleteMessage(id int) error {\n\t_, err := db.db.Exec(`\n\t\tDELETE FROM melodious.messages WHERE id=$1;\n\t`, id)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func Delete(key string){\n n := keyValue[key]\n n.val = \"\"\n n.hash = \"\"\n keyValue[key] = n\n}", "func Del(kb KeyBucket) {\n\terr := kb.B.Del(kb.Key.Key)\n\tif err != nil {\n\t\tlog.Warnf(\"%v\\n\", err)\n\t}\n\tatomic.AddUint64(&donecounter, 1)\n}", "func (e *EntityChat) Delete(ctx context.Context) {\n\tmemKey := e.memcacheKey()\n\tif err := memcache.Delete(ctx, memKey); err != nil {\n\t\tlog.Errorf(ctx, \"failed to delete memcache key %s: %v\", memKey, err)\n\t}\n\tkey := e.datastoreKey(ctx)\n\tif err := datastore.Delete(ctx, key); err != nil {\n\t\tlog.Errorf(ctx, \"failed to delete datastore key %v: %v\", key, err)\n\t}\n}", "func (s *RedisSession) DelKey(key string) (int64, error) {\r\n\tctx, cancel := context.WithTimeout(context.Background(), time.Duration(time.Second*5))\r\n\tdefer cancel()\r\n\r\n\tc, err := s.getClient()\r\n\tif err != nil {\r\n\t\treturn 0, err\r\n\t}\r\n\tcnt, err := c.Del(ctx, []string{s.config.KeyPrefix + key}...).Result()\r\n\tif err != nil {\r\n\t\treturn 0, err\r\n\t}\r\n\treturn cnt, nil\r\n}", "func DeleteMessage(ctx *context.Context, session *context.Session, w http.ResponseWriter, r *http.Request, vars map[string]string) {\n\terr := ctx.MessageService.DeleteMessage(vars[\"id\"], session.CurrentUser)\n\n\tif err != nil {\n\t\thandleError(w, err)\n\t\treturn\n\t}\n}", "func (s *svcManager) DeleteMessage(log log.T, update *UpdateDetail) (err error) {\n\tvar svc messageService.Service\n\n\tif svc, err = getMsgSvc(s.context); err != nil {\n\t\treturn fmt.Errorf(\"could not load message service %v\", err)\n\t}\n\n\treturn svc.DeleteMessage(log, update.MessageID)\n}", "func (d *DirectAddress) Delete(key int) {\n\tif err := d.validateKey(key); err != nil {\n\t\treturn\n\t}\n\td.array[key-d.uMin] = nil\n}", "func (h *descriptorHandler) delete(key string, value proto.Message, metadata kvs.Metadata) error {\n\tif h.descriptor == nil {\n\t\treturn nil\n\t}\n\tif h.descriptor.Delete == nil {\n\t\treturn kvs.ErrUnimplementedDelete\n\t}\n\tdefer trackDescMethod(h.descriptor.Name, \"Delete\")()\n\terr := h.descriptor.Delete(key, value, metadata)\n\tif nsErr := checkNetNs(); nsErr != nil {\n\t\terr = nsErr\n\t}\n\treturn err\n}", "func MsgKey(R, P *btcec.PublicKey, m []byte) *btcec.PublicKey {\n\th := Hash(R.SerializeCompressed(), m)\n\th = new(big.Int).Mod(new(big.Int).Neg(h), btcec.S256().N)\n\thP := new(btcec.PublicKey)\n\thP.X, hP.Y = btcec.S256().ScalarMult(P.X, P.Y, h.Bytes())\n\treturn SumPubs(R, hP)\n}", "func (b *Bucket) Del(key string) {\n\tb.cLock.Lock()\n\tif _, ok := b.chs[key]; ok {\n\t\tdelete(b.chs, key)\n\t}\n\tb.cLock.Unlock()\n}", "func (p *metadataService) deleteMessageWithValidator(clientID string, validator func(*base.Message) bool) {\n}", "func (s *MemStore) Delete(key interface{}) error {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tdelete(s.data, key)\n\treturn nil\n}", "func (_ECC *ECCTransactor) ProposeRemoveKey(opts *bind.TransactOpts, key common.Address, keyType uint8) (*types.Transaction, error) {\n\treturn _ECC.contract.Transact(opts, \"proposeRemoveKey\", key, keyType)\n}", "func (db *MemoryCache) Delete(key []byte) error {\n\tdb.lock.Lock()\n\tdefer db.lock.Unlock()\n\n\tif db.db == nil {\n\t\treturn NewMemCacheError(MemCacheClosedError, nil)\n\t}\n\tkeyStr := base58.Base58Check{}.Encode(key, 0x0)\n\tdelete(db.db, keyStr)\n\treturn nil\n}", "func (client *MemcachedClient4T) Delete(key string) error {\n\treturn client.parse.Deletion(key)\n}", "func (jf *JFile) DelKey(JSONpath string) error {\n\terr := jf.rootnode.DelKey(JSONpath)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Use the correct JSON function, depending on the pretty parameter\n\tJSON := jf.rootnode.JSON\n\tif jf.pretty {\n\t\tJSON = jf.rootnode.PrettyJSON\n\t}\n\tdata, err := JSON()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn jf.Write(data)\n}", "func ( handle * MemcacheClient) Delete(key string ) error {\n\n\tif len(key) <= 0 {\n\t\tlog.Printf(\"Error: key passed is blank blank\\n\")\n\t\treturn fmt.Errorf(\"key Passed is blank\")\n\t}\n\t\n\terr := handle.mc.Delete(key)\n\tif err != nil{\n\t\tlog.Printf(\"Error: unable to delete key:%s:%s\\n\",key,err.Error())\n\t\treturn err\n\t}\n\tlog.Printf(\"Info:Key:%s deleted successfully\\n\",key)\n\treturn nil\n}", "func (m *MockCache) Del(key string) error {\n\treturn nil\n}", "func (s *Basememcached_protocolListener) ExitKey(ctx *KeyContext) {}", "func (c *RedisCache) Del(ctx context.Context, key string) error {\n\treturn c.client.Del(ctx, key).Err()\n}", "func (db *FlatDatabase) Delete(key []byte) error { panic(\"not supported\") }", "func (p *MemDB) Delete(key []byte) {\n\tp.Put(key, nil)\n}", "func (e *endpointMap) remove(key device.MultiDeviceKey) {\n\tdelete(e.m, key)\n}", "func (e DeleteMessageResponseValidationError) Key() bool { return e.key }", "func Delete(conn redis.Conn, key string) error {\n\t_, err := conn.Do(\"DEL\", key)\n\treturn err\n}", "func (o *AuthMessage) DeleteP(exec boil.Executor) {\n\tif err := o.Delete(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (cb *cachedBatch) Delete(namespace string, key []byte, errorMessage string) {\n\tcb.lock.Lock()\n\tdefer cb.lock.Unlock()\n\th := cb.hash(namespace, key)\n\tcb.touchKey(h)\n\tcb.currentCache().Evict(&h)\n\tcb.kvStoreBatch.batch(Delete, namespace, key, nil, errorMessage)\n}", "func (tx *transaction) deleteKey(key []byte, notifyIterators bool) {\n\t// Remove the key from the list of pendings keys to be written on\n\t// transaction commit if needed.\n\ttx.pendingKeys.Delete(key)\n\n\t// Add the key to the list to be deleted on transaction\tcommit.\n\ttx.pendingRemove.Put(key, nil)\n\n\t// Notify the active iterators about the change if the flag is set.\n\tif notifyIterators {\n\t\ttx.notifyActiveIters()\n\t}\n}", "func DeleteMsg(username string) {\n\tDB.Exec(\"delete from messages where user_id = ?;\", username)\n}", "func (ms *MemStore) GetMessageKey(\n\tsessionKey string,\n\tsender bool,\n\tmsgIndex uint64,\n) (*[64]byte, error) {\n\ts, ok := ms.sessions[sessionKey]\n\tif !ok {\n\t\treturn nil, log.Errorf(\"memstore: no session found for %s\", sessionKey)\n\t}\n\tif msgIndex >= uint64(len(s.send)) {\n\t\treturn nil, log.Error(\"memstore: message index out of bounds\")\n\t}\n\tvar key string\n\tvar party string\n\tif sender {\n\t\tkey = s.send[msgIndex]\n\t\tparty = \"sender\"\n\t} else {\n\t\tkey = s.recv[msgIndex]\n\t\tparty = \"recipient\"\n\t}\n\t// make sure key wasn't used yet\n\tif key == \"\" {\n\t\treturn nil, log.Error(session.ErrMessageKeyUsed)\n\t}\n\t// decode key\n\tvar messageKey [64]byte\n\tk, err := base64.Decode(key)\n\tif err != nil {\n\t\treturn nil,\n\t\t\tlog.Errorf(\"memstore: cannot decode %s key for %s\", party,\n\t\t\t\tsessionKey)\n\t}\n\tif copy(messageKey[:], k) != 64 {\n\t\treturn nil,\n\t\t\tlog.Errorf(\"memstore: %s key for %s has wrong length\", party,\n\t\t\t\tsessionKey)\n\t}\n\treturn &messageKey, nil\n}", "func (obj *MessengerFileCipher) delete() {\n\tC.vssq_messenger_file_cipher_delete(obj.cCtx)\n}", "func (h *RequestHeader) DelBytes(key []byte) {\n\th.bufKV.key = append(h.bufKV.key[:0], key...)\n\tnormalizeHeaderKey(h.bufKV.key, h.disableNormalizing)\n\th.del(h.bufKV.key)\n}", "func (txn *Txn) Del(dbi DBI, key, val []byte) error {\n\tckey := Wrap(key)\n\tif val == nil {\n\t\tret := C.mdb_del(txn._txn, C.MDB_dbi(dbi), (*C.MDB_val)(ckey), nil)\n\t\treturn errno(ret)\n\t}\n\tcval := Wrap(val)\n\tret := C.mdb_del(txn._txn, C.MDB_dbi(dbi), (*C.MDB_val)(ckey), (*C.MDB_val)(cval))\n\treturn errno(ret)\n}", "func Delete(s *discordgo.Session, m *discordgo.MessageCreate) {\n}", "func (ms memstore) Delete(key string) {\n\tms.lock.Lock()\n\tdelete(ms.store, key)\n\tms.lock.Unlock()\n}", "func (sess Session) Del(key string) {\n\tdelete(sess, key)\n}", "func (s *MemorySession) Delete(key string) error {\n\tdelete(s.data, key)\n\treturn nil\n}", "func (c Cipher) decryptMessage(k AuthKey, encrypted *EncryptedMessage) ([]byte, error) {\n\tif k.ID != encrypted.AuthKeyID {\n\t\treturn nil, errors.New(\"unknown auth key id\")\n\t}\n\tif len(encrypted.EncryptedData)%16 != 0 {\n\t\treturn nil, errors.New(\"invalid encrypted data padding\")\n\t}\n\n\tkey, iv := Keys(k.Value, encrypted.MsgKey, c.encryptSide.DecryptSide())\n\tcipher, err := aes.NewCipher(key[:])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tplaintext := make([]byte, len(encrypted.EncryptedData))\n\tige.DecryptBlocks(cipher, iv[:], plaintext, encrypted.EncryptedData)\n\n\treturn plaintext, nil\n}", "func (h Headers) Del(key string) {\n\tdelete(h, strings.ToLower(key))\n}", "func (d *Dam) Delete(key Marshallable) error {\n\tk, err := hash(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\td.freeze.Lock()\n\td.mutex.Lock()\n\tdelete(d.storage, k)\n\td.mutex.Unlock()\n\td.freeze.Unlock()\n\treturn nil\n}", "func (m *Memory) Delete(_ context.Context, key string) error {\n\tm.mx.Lock()\n\tdefer m.mx.Unlock()\n\tdelete(m.storage, key)\n\n\treturn nil\n}", "func (c *Context) Delete(key string) {\n\tdelete(c.Data, key)\n}", "func (s *API) DeleteMessage(w http.ResponseWriter, req *http.Request) {\n\tlog.Debug(\"DeleteMessage\")\n\tw.WriteHeader(http.StatusNotImplemented)\n}", "func (h *HBaseClient) Del(key int64) (err error) {\n\tvar (\n\t\ti int\n\t\tk = make([]byte, 8)\n\t\tks = [Size]byte{}\n\t\tc interface{}\n\t)\n\tbinary.BigEndian.PutUint64(k, uint64(key))\n\tks = sha1.Sum(k)\n\tif c, err = hbasePool.Get(); err != nil {\n\t\tlog.Errorf(\"hbasePool.Get() error(%v)\", err)\n\t\treturn\n\t}\n\tdefer hbasePool.Put(c, false)\n\tfor i = 0; i < retryCount; i++ {\n\t\tif err = c.(hbasethrift.THBaseService).DeleteSingle(filemeta.HbaseTable, &hbasethrift.TDelete{\n\t\t\tRow: ks[:],\n\t\t\tColumns: []*hbasethrift.TColumn{\n\t\t\t\t&hbasethrift.TColumn{\n\t\t\t\t\tFamily: filemeta.HbaseFamilyBasic,\n\t\t\t\t\tQualifier: filemeta.HbaseColumnVid,\n\t\t\t\t},\n\t\t\t\t&hbasethrift.TColumn{\n\t\t\t\t\tFamily: filemeta.HbaseFamilyBasic,\n\t\t\t\t\tQualifier: filemeta.HbaseColumnCookie,\n\t\t\t\t},\n\t\t\t},\n\t\t}); err == nil {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(retrySleep)\n\t}\n\tif err != nil {\n\t\tlog.Errorf(\"client.DeleteSingle error(%v)\", err)\n\t}\n\treturn\n}", "func (st *MemSessionStore) Delete(key interface{}) error {\n\treturn (*session.MemSessionStore)(st).Delete(context.Background(), key)\n}" ]
[ "0.6409165", "0.62833005", "0.62153774", "0.6165137", "0.6157906", "0.61292326", "0.60809404", "0.60754925", "0.60167915", "0.5963728", "0.5958929", "0.5957783", "0.5909399", "0.59034777", "0.58986545", "0.5890563", "0.5835201", "0.58141613", "0.5803102", "0.57944787", "0.57813394", "0.57808226", "0.5774079", "0.5773825", "0.5769236", "0.57629704", "0.5754254", "0.5748964", "0.57376426", "0.5735182", "0.5688034", "0.5686557", "0.56840396", "0.56823754", "0.56787974", "0.56674725", "0.5656569", "0.5655016", "0.56467783", "0.5630647", "0.56245637", "0.56191534", "0.5611942", "0.5610459", "0.56005347", "0.5595387", "0.5592902", "0.5591697", "0.5572802", "0.5571419", "0.5564263", "0.5544895", "0.5527644", "0.55259717", "0.55212915", "0.551812", "0.5514987", "0.5510157", "0.55089104", "0.55045706", "0.5504144", "0.5503181", "0.5501915", "0.5492139", "0.5491421", "0.5470766", "0.5466317", "0.54602766", "0.5458798", "0.54507214", "0.5449142", "0.54451156", "0.5443186", "0.5437209", "0.5431242", "0.5424897", "0.5416358", "0.5413509", "0.5412015", "0.5409874", "0.54089063", "0.5406855", "0.5403941", "0.54012823", "0.53973204", "0.53871214", "0.53828496", "0.5378081", "0.5375643", "0.537222", "0.5368236", "0.5366964", "0.5366716", "0.53658646", "0.536447", "0.535571", "0.5353002", "0.53462756", "0.5340865", "0.5338108" ]
0.805607
0
AddSessionKey implemented in memory.
func (ms *MemStore) AddSessionKey( hash, json, privKey string, cleanupTime uint64, ) error { ms.sessionKeys[hash] = &sessionKey{ json: json, privKey: privKey, cleanupTime: cleanupTime, } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *Session) Add(key string, value interface{}) error {\n\tbts, err := json.Marshal(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.values[key] = string(bts)\n\n\treturn nil\n}", "func addSession(user *User) error {\n\trandBytes, err := scrypt.GenerateRandomBytes(32)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsessionId := string(randBytes)\n\t// TODO: store more than the username\n\terr = rd.Set(\"session:\"+sessionId, user.Username, sessionTimeout).Err()\n\tif err != nil {\n\t\treturn err\n\t}\n\tuser.sessionId = url.QueryEscape(sessionId)\n\treturn nil\n}", "func (b *BigIP) AddKey(config *Key) error {\n\treturn b.post(config, uriSys, uriCrypto, uriKey)\n}", "func (a *LocalKeyAgent) addKey(key *Key) error {\n\tif key == nil {\n\t\treturn trace.BadParameter(\"key is nil\")\n\t}\n\tif key.ProxyHost == \"\" {\n\t\tkey.ProxyHost = a.proxyHost\n\t}\n\tif key.Username == \"\" {\n\t\tkey.Username = a.username\n\t}\n\n\t// In order to prevent unrelated key data to be left over after the new\n\t// key is added, delete any already stored key with the same index if their\n\t// RSA private keys do not match.\n\tstoredKey, err := a.keyStore.GetKey(key.KeyIndex)\n\tif err != nil {\n\t\tif !trace.IsNotFound(err) {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t} else {\n\t\tif subtle.ConstantTimeCompare(storedKey.Priv, key.Priv) == 0 {\n\t\t\ta.log.Debugf(\"Deleting obsolete stored key with index %+v.\", storedKey.KeyIndex)\n\t\t\tif err := a.keyStore.DeleteKey(storedKey.KeyIndex); err != nil {\n\t\t\t\treturn trace.Wrap(err)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Save the new key to the keystore (usually into ~/.tsh).\n\tif err := a.keyStore.AddKey(key); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\treturn nil\n}", "func (gorilla Gorilla) Add(w http.ResponseWriter, req *http.Request, key string, value interface{}) error {\n\tdefer gorilla.saveSession(w, req)\n\n\tsession, err := gorilla.getSession(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif str, ok := value.(string); ok {\n\t\tsession.Values[key] = str\n\t} else {\n\t\tresult, _ := json.Marshal(value)\n\t\tsession.Values[key] = string(result)\n\t}\n\n\treturn nil\n}", "func (i service) AddKey(ctx context.Context, key id.KeyDID) error {\n\tDID, err := NewDIDFromContext(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontract, opts, err := i.prepareTransaction(ctx, DID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Info(\"Add key to identity contract %s\", DID.ToAddress().String())\n\ttxID, done, err := i.txManager.ExecuteWithinTX(context.Background(), DID, transactions.NilTxID(), \"Check TX for add key\",\n\t\ti.ethereumTX(opts, contract.AddKey, key.GetKey(), key.GetPurpose(), key.GetType()))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tisDone := <-done\n\t// non async task\n\tif !isDone {\n\t\treturn errors.New(\"add key TX failed: txID:%s\", txID.String())\n\n\t}\n\treturn nil\n\n}", "func (s *SessionStore) Add(session *Session) {\n\tfmt.Println(session.AccessToken)\n\n\ts.atM.Lock()\n\ts.accessTokens[session.AccessToken] = session\n\ts.atM.Unlock()\n\n\ts.rtM.Lock()\n\ts.refreshTokens[session.RefreshToken] = session\n\ts.rtM.Unlock()\n}", "func (s *SharemeService) Add(c *gae.Context, session *Session, key string) (stat Share) {\n\tstat = s.Stat(c, key)\n\tif stat.IsError() {\n\t\treturn\n\t}\n\tsession.Set(fmt.Sprintf(\"%s%s\", KeySessionPrefix, key), stat.Name)\n\treturn\n}", "func (ctx *MqttSrvContext) AddSession(fd int, s interface{}) {\n\tctx.Clock.Lock()\n\tctx.Connections[fd] = s\n\tctx.Clock.Unlock()\n}", "func addSession(s *sessions.Session, triggerEvent bool) {\n\t// Remove the session if closed from the map.\n\ts.OnceClose(removeSession)\n\n\t// Lock the mutex.\n\tactiveSessionsMutex.Lock()\n\tdefer activeSessionsMutex.Unlock()\n\n\t// Add the session to the map.\n\tactiveSessions[s.SessionID()] = s\n\n\tif triggerEvent {\n\t\t// Trigger the event.\n\t\ttriggerOnNewSession(s)\n\t}\n}", "func (ms *MemStore) SessionKey() string {\n\treturn ms.sessionKey\n}", "func (ks *KeyStore) Add(privateKey *rsa.PrivateKey, kid string) {\n\tks.mu.Lock()\n\tdefer ks.mu.Unlock()\n\n\tks.store[kid] = privateKey\n}", "func (s ServiceClientWrapper) AddKey(name string, password string) (addr string, mnemonic string, err error) {\n\treturn s.ServiceClient.Insert(name, password)\n}", "func (a *Account) SessionKey() *big.Int {\n\tif a.sessionKey == nil {\n\t\ta.sessionKey, _ = new(big.Int).SetString(a.SessionKeyStr, 16)\n\t}\n\n\treturn a.sessionKey\n}", "func AddKey(s Server, password string, template *Key) (*Key, error) {\n\t// fill meta data about key\n\tnewkey := &Key{\n\t\tCreated: time.Now(),\n\t\tKDF: \"scrypt\",\n\t\tN: scryptN,\n\t\tR: scryptR,\n\t\tP: scryptP,\n\t}\n\n\thn, err := os.Hostname()\n\tif err == nil {\n\t\tnewkey.Hostname = hn\n\t}\n\n\tusr, err := user.Current()\n\tif err == nil {\n\t\tnewkey.Username = usr.Username\n\t}\n\n\t// generate random salt\n\tnewkey.Salt = make([]byte, scryptSaltsize)\n\tn, err := rand.Read(newkey.Salt)\n\tif n != scryptSaltsize || err != nil {\n\t\tpanic(\"unable to read enough random bytes for salt\")\n\t}\n\n\t// call scrypt() to derive user key\n\tnewkey.user, err = newkey.scrypt(password)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif template == nil {\n\t\t// generate new random master keys\n\t\tnewkey.master, err = newkey.newKeys()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\t// copy master keys from old key\n\t\tnewkey.master = template.master\n\t}\n\n\t// encrypt master keys (as json) with user key\n\tbuf, err := json.Marshal(newkey.master)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnewkey.Data = GetChunkBuf(\"key\")\n\tn, err = newkey.EncryptUser(newkey.Data, buf)\n\tnewkey.Data = newkey.Data[:n]\n\n\t// dump as json\n\tbuf, err = json.Marshal(newkey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// store in repository and return\n\tid, err := s.Create(backend.Key, buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnewkey.id = id\n\n\tFreeChunkBuf(\"key\", newkey.Data)\n\n\treturn newkey, nil\n}", "func AddKey(key * Key) {\n\tKeys = append(Keys, *key)\n\tSaveDatabase(Keys, \"keys\")\n}", "func StoreSessionAPIKey(session *sessions.Session, apiKey string) {\n\tif session == nil || len(apiKey) == 0 {\n\t\treturn\n\t}\n\tsession.Values[sessionKeyAPIKey] = apiKey\n}", "func (authcl *Client) AddKey(key, description string, temp bool) error {\n\terr := authcl.LoadToken()\n\tif err != nil {\n\t\treturn err\n\t}\n\tnewkey := gogs.PublicKey{Key: key, Title: description}\n\taddress := fmt.Sprintf(\"/api/v1/user/keys\")\n\tres, err := authcl.Post(address, newkey)\n\tif err != nil {\n\t\treturn err\n\t} else if res.StatusCode != http.StatusCreated {\n\t\treturn fmt.Errorf(\"[Add key] Failed. Server returned %s\", res.Status)\n\t}\n\tweb.CloseRes(res.Body)\n\treturn nil\n}", "func (be InmemBackend) Add(key []byte, value []byte) error {\n\treturn be.Put(key, value, false, false)\n}", "func (a *LocalKeyAgent) AddKey(key *Key) (*agent.AddedKey, error) {\n\tif err := a.addKey(key); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\t// Load key into the teleport agent and system agent.\n\treturn a.LoadKey(*key)\n}", "func (k *Keychain) AddKey(newKey string) error {\n\tkey, err := hex.DecodeString(newKey)\n\tif err != nil {\n\t\treturn ErrInvalidKey\n\t}\n\tk.pushKey(key)\n\treturn nil\n}", "func AddKey(sshFilePath string) error {\n\tconfigRepository := config.NewConfigRepository(func(error) {})\n\tuserRepo := api.NewUserRepository(configRepository, net.NewCloudControllerGateway(configRepository))\n\n\tuser, err := userRepo.GetUser(configRepository.Id())\n\tif err != nil {\n\t\treturn err\n\t}\n\tpublic, name, err := getKey(sshFilePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tkeyParams := api.KeyParams{\n\t\tPublic: public,\n\t\tName: name,\n\t}\n\t_, err = user.UploadKey(keyParams)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Key already exists\")\n\t}\n\n\tfmt.Println(\"Upload key successfully\")\n\treturn err\n}", "func KeyAdd(organizationId uint, clusterId uint) (string, error) {\n\tlog.Info(\"Generate and store SSH key \")\n\n\tsshKey, err := KeyGenerator()\n\tif err != nil {\n\t\tlog.Errorf(\"KeyGenerator failed reason: %s\", err.Error())\n\t\treturn \"\", err\n\t}\n\n\tdb := model.GetDB()\n\tcluster := model.ClusterModel{ID: clusterId}\n\tif err = db.First(&cluster).Error; err != nil {\n\t\tlog.Errorf(\"Cluster with id=% not found: %s\", cluster.ID, err.Error())\n\t\treturn \"\", err\n\t}\n\tsecretId, err := KeyStore(sshKey, organizationId, cluster.Name)\n\tif err != nil {\n\t\tlog.Errorf(\"KeyStore failed reason: %s\", err.Error())\n\t\treturn \"\", err\n\t}\n\treturn secretId, nil\n}", "func KeySession(priv, pub []byte) (*Session, bool) {\n\tprivKey, err := public.UnmarshalPrivate(priv)\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\tdefer privKey.Zero()\n\n\tpubKey, err := public.UnmarshalPublic(pub)\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\n\tshared := public.KeyExchange(privKey, pubKey)\n\treturn &Session{shared: shared}, true\n}", "func GenerateSessionKey(user_name string, j aqua.Aide) (token string, err error) {\n\tvar (\n\t\tConn *gorm.DB\n\t\t//token string\n\t\tsessionData []interface{}\n\t)\n\tif Conn, err = dbConn(); err == nil {\n\t\tif token, err = crypt.GenerateRandomString(32); err == nil {\n\t\t\texp_time := time.Now().Add(time.Minute * 30)\n\t\t\tinsertSession := `insert into user_session (\n\t\t\tsession_key, fk_user_name,\n\t\t\tlocation, expiry_time) values(?, ?, ?, ? )`\n\t\t\tsessionData = append(sessionData, token, user_name, \"bengaluru\", exp_time)\n\t\t\tif err = Conn.Debug().Exec(insertSession, sessionData...).Error; err == nil {\n\t\t\t\tj.Response.Header().Add(\"session-key\", token)\n\t\t\t\tj.Response.Header().Add(\"connection\", \"keep-alive\")\n\t\t\t\tfmt.Println(\"err\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Println(\"session not generated\")\n\t\t}\n\t} else {\n\t\tfmt.Println(\"connection not established\")\n\t}\n\treturn\n}", "func (r *extendedKeyring) Add(key agent.AddedKey) error {\n\t// Figure out what key type we're trying to inject\n\tswitch key.PrivateKey.(type) {\n\tcase *rsa.PrivateKey:\n\t\t// Load the injected key\n\t\tdata := &pem.Block{\n\t\t\tType: \"RSA PRIVATE KEY\",\n\t\t\tBytes: x509.MarshalPKCS1PrivateKey(key.PrivateKey.(*rsa.PrivateKey)),\n\t\t}\n\n\t\t// Ensure the key doesn't exist\n\t\tos.Remove(r.targetKeyLocation)\n\n\t\t// Write the key out to disk\n\t\tvar file, err = os.Create(r.targetKeyLocation)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"\\nssh_agent_download: Could not create key file\", err.Error())\n\t\t}\n\t\tdefer file.Close() // Ensure we close the file later\n\n\t\t// Secure before writing\n\t\t// Note: Technically someone could write in here before we do this\n\t\tos.Chmod(r.targetKeyLocation, 0400)\n\n\t\t// Dump the (un-encrypted) key into this file\n\t\tpem.Encode(file, data)\n\n\t\t// Let the keyboard monkey know\n\t\tfmt.Printf(\"ssh_agent_download: saved key to %s\\n\", r.targetKeyLocation)\n\n\t// Let the user know this won't work\n\tdefault:\n\t\tlog.Fatal(\"ssh_agent_download: unsupported key type %T\", key.PrivateKey)\n\t}\n\n\treturn nil\n}", "func (s * SortedBySizeKeys) AddKey(key Key) {\n\tif _, ok := keysMap[key]; ok { return }\n\tkeysMap[key] = true;\n\t*s = append(*s, key)\n}", "func (n *Notification) AddKey(key string) error {\n\n\tif len(key) != 40 {\n\t\treturn errors.New(\"Error, Apikey must be 40 characters long.\")\n\t}\n\n\tn.apikeys = append(n.apikeys, key)\n\treturn nil\n}", "func (h *WebDriverHub) AddSession(id string, session *WebDriverSession) {\n\th.mu.Lock()\n\tdefer h.mu.Unlock()\n\tif h.sessions == nil {\n\t\th.sessions = map[string]*WebDriverSession{}\n\t}\n\th.sessions[id] = session\n}", "func SessionStoreKey() string {\n\treturn app.SessionStoreKey\n}", "func (keyRing *KeyRing) EncryptSessionKey(sessionSplit *SymmetricKey) ([]byte, error) {\n\toutbuf := &bytes.Buffer{}\n\n\tcf := sessionSplit.GetCipherFunc()\n\n\tvar pub *packet.PublicKey\n\tfor _, e := range keyRing.GetEntities() {\n\t\tif encryptionKey, ok := e.getRawEntity().EncryptionKey(pgp.getNow()); ok {\n\t\t\tpub = encryptionKey.PublicKey\n\t\t\tbreak\n\t\t}\n\t}\n\tif pub == nil {\n\t\treturn nil, errors.New(\"cannot set key: no public key available\")\n\t}\n\n\tif err := packet.SerializeEncryptedKey(outbuf, pub, cf, sessionSplit.Key, nil); err != nil {\n\t\terr = fmt.Errorf(\"gopenpgp: cannot set key: %v\", err)\n\t\treturn nil, err\n\t}\n\treturn outbuf.Bytes(), nil\n}", "func (trust *RufusSigner) addKey(k *data.PrivateKey) error {\n\treturn errors.New(\"Not implemented: RufusSigner.addKey\")\n}", "func addSession(context *echo.Context, id uint, classification int, username string) error {\n\tsess := getSession(\"authorization\", context)\n\tsess.Values[\"user_id\"] = id\n\tsess.Values[\"classification\"] = classification\n\tsess.Values[\"username\"] = username\n\tif classification == 1 {\n\t\tsess.Values[\"stringClassification\"] = \"الوزير\"\n\t} else if classification == 2 {\n\t\tsess.Values[\"stringClassification\"] = \"متابع\"\n\t} else {\n\t\tsess.Values[\"stringClassification\"] = \"قائم به\"\n\t}\n\n\treturn sess.Save((*context).Request(), (*context).Response())\n}", "func (b *BaseHandler) SetSession(key interface{}, value interface{}) {\n\tb.sessionStore.Set(b, key, value)\n}", "func (ctx *RequestContext) PutSession(key string, value interface{}) {\n\tvars := ctx.token.Claims[\"vars\"].(map[string]interface{})\n\tvars[key] = value\n}", "func (h *Hub) AddSession(s *Session) {\n\th.register <- HubRegistration{event: \"add\", session: s}\n}", "func (s *LunaKeyStore) AddKey(keyInfo trustmanager.KeyInfo, privKey data.PrivateKey) error {\n\n\tvar (\n\t\tecdsaPublicKey *data.ECDSAPublicKey\n\t\trsaPublicKey *data.RSAPublicKey\n\t\terr error\n\t)\n\n\tlogrus.Debugf(\"LunaKeyStore.AddKey\")\n\n\trole := keyInfo.Role\n\n\tgeneratateRootKeyOnly := strings.ToLower(os.Getenv(\"NOTARY_LUNA_GENERATE_ROOT_KEYS_ONLY\")) == \"true\"\n\n\tif generatateRootKeyOnly && role != data.CanonicalRootRole {\n\t\treturn errors.New(\"Can only generate root keys in generate root keys only mode.\")\n\t}\n\n\talg := privKey.Algorithm()\n\n\tif alg == data.ECDSAKey {\n\t\tecdsaPublicKey, err = getECDSAPublicKeyFromPrivateKey(privKey)\n\t\tif err != nil {\n\t\t\tlogrus.Debugf(\"Error getting ECDSA Public key: %s\", err)\n\t\t\treturn err\n\t\t}\n\t} else if alg == data.RSAKey {\n\t\trsaPublicKey, err = getRSAPublicKeyFromPrivateKey(privKey)\n\t\tif err != nil {\n\t\t\tlogrus.Debugf(\"Error getting RSA Public key: %s\", err)\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\treturn errors.New(\"Invalid key type.\")\n\t}\n\n\tp, session, c, err := SetupLuna(true, s.passRetriever)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer CleanupLuna(p, session, c)\n\tgun := keyInfo.Gun\n\n\tif alg == data.ECDSAKey {\n\t\tlunaPrivateKey, err := generateECDSAKey(p, session, gun, s.passRetriever, role)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t//Store the public key value for the generated key in the public key for the added key.\n\t\tlunaECDSAPublicKey, ok := lunaPrivateKey.PublicKey.(*data.ECDSAPublicKey)\n\t\tif !ok {\n\t\t\treturn errors.New(\"Unable to get PublicKey from luna private key.\")\n\t\t}\n\t\tecdsaPublicKey.Value = lunaECDSAPublicKey.Value\n\t\tecdsaPublicKey.ResetID()\n\t} else if alg == data.RSAKey {\n\t\tlunaPrivateKey, err := generateRSAKey(p, session, gun, s.passRetriever, role)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlunaRSAPublicKey, ok := lunaPrivateKey.PublicKey.(*data.RSAPublicKey)\n\t\tif !ok {\n\t\t\treturn errors.New(\"Unable to get PublicKey from luna private key.\")\n\t\t}\n\t\trsaPublicKey.Value = lunaRSAPublicKey.Value\n\t\trsaPublicKey.ResetID()\n\t}\n\tfmt.Printf(\"Luna: Generated %s key: %s\\n\", role, privKey.ID())\n\n\treturn nil\n}", "func (s *Basememcached_protocolListener) EnterKey(ctx *KeyContext) {}", "func (b *Buffer) Add(key string) {\n\tb.In <- key\n}", "func (r *KeyRing) AddKey(k *Key) {\n\tif r.isDuplicate(k.entity) {\n\t\treturn\n\t}\n\tr.entities = append(r.entities, k.entity)\n}", "func (c *Connect) AddKeySshAgent(sshAgent interface{}, key interface{}) {\n\taddedKey := agent.AddedKey{\n\t\tPrivateKey: key,\n\t\tConfirmBeforeUse: true,\n\t\tLifetimeSecs: 3000,\n\t}\n\n\tswitch ag := sshAgent.(type) {\n\tcase agent.Agent:\n\t\tag.Add(addedKey)\n\tcase agent.ExtendedAgent:\n\t\tag.Add(addedKey)\n\t}\n}", "func (w *Whisper) AddSymKeyDirect(key []byte) (string, error) {\n\tif len(key) != aesKeyLength {\n\t\treturn \"\", fmt.Errorf(\"wrong key size: %d\", len(key))\n\t}\n\n\tid, err := GenerateRandomID()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to generate ID: %s\", err)\n\t}\n\n\tw.keyMu.Lock()\n\tdefer w.keyMu.Unlock()\n\n\tif w.symKeys[id] != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to generate unique ID\")\n\t}\n\tw.symKeys[id] = key\n\treturn id, nil\n}", "func AddUserSession(userID int, sessionID string) error {\n\tkey := stringutil.Build(\"userid:\", strconv.Itoa(userID), \":sessionids\")\n\terr := SetAddMember(key, sessionID)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot add member to set in Redis\")\n\t}\n\treturn nil\n}", "func (h *RequestHeader) Add(key, value string) {\n\th.AddBytesKV(s2b(key), s2b(value))\n}", "func (_ECC *ECCTransactorSession) VoteAddKey(key common.Address) (*types.Transaction, error) {\n\treturn _ECC.Contract.VoteAddKey(&_ECC.TransactOpts, key)\n}", "func (r *Redis) AddUser(id, key string) (err error) {\n\terr = r.client.HMSet(id, \"timestamp\", strconv.FormatInt(time.Now().UTC().Unix(), 10), \"key\", key, \"files\", \"\").Err()\n\treturn\n}", "func (session *Session) GetSessionKey() string {\n\treturn session.id.String()\n}", "func (b *SharingKeys) Add(name string, key *[32]byte) (*SharingKey, error) {\n\tif name == \"\" {\n\t\treturn nil, ErrSharingKeyNameInvalid\n\t}\n\tn := []byte(name)\n\tif v := b.b.Get(n); v != nil {\n\t\treturn nil, ErrSharingKeyExist\n\t}\n\tif err := b.b.Put([]byte(name), key[:]); err != nil {\n\t\treturn nil, err\n\t}\n\ts := &SharingKey{\n\t\tb: b,\n\t\tname: n,\n\t\tsecret: key[:],\n\t}\n\treturn s, nil\n}", "func (s *Envelope) AddKey(alias string, masterKey string, context map[string]string) (string, error) {\n\tkey, err := keysvc.GenerateDatakey(alias, masterKey, context)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\terr = s.Keyring.AddKey(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn key.ID.String(), nil\n}", "func AddKeyToRequest(req *http.Request, token string) {\n\treq.Header.Set(\"Authorisation\", fmt.Sprintf(\"Key %v\", token))\n}", "func SetSessionContextKey(ctx context.Context, s *Session) context.Context {\n\treturn context.WithValue(ctx, sessionCtxKey, s)\n}", "func (s *KeyAgentTestSuite) TestAddKey(c *check.C) {\n\t// make a new local agent\n\tlka, err := NewLocalAgent(s.keyDir, s.hostname, s.username)\n\tc.Assert(err, check.IsNil)\n\n\t// add the key to the local agent, this should write the key\n\t// to disk as well as load it in the agent\n\t_, err = lka.AddKey(s.key)\n\tc.Assert(err, check.IsNil)\n\n\t// check that the key has been written to disk\n\tfor _, ext := range []string{fileExtCert, \"\", fileExtPub} {\n\t\t_, err := os.Stat(fmt.Sprintf(\"%v/keys/%v/%v%v\", s.keyDir, s.hostname, s.username, ext))\n\t\tc.Assert(err, check.IsNil)\n\t}\n\n\t// get all agent keys from teleport agent and system agent\n\tteleportAgentKeys, err := lka.Agent.List()\n\tc.Assert(err, check.IsNil)\n\tsystemAgentKeys, err := lka.sshAgent.List()\n\tc.Assert(err, check.IsNil)\n\n\t// check that we've loaded a cert as well as a private key into the teleport agent\n\t// and it's for the user we expected to add a certificate for\n\tc.Assert(teleportAgentKeys, check.HasLen, 2)\n\tc.Assert(teleportAgentKeys[0].Type(), check.Equals, \"[email protected]\")\n\tc.Assert(teleportAgentKeys[0].Comment, check.Equals, \"teleport:\"+s.username)\n\tc.Assert(teleportAgentKeys[1].Type(), check.Equals, \"ssh-rsa\")\n\tc.Assert(teleportAgentKeys[1].Comment, check.Equals, \"teleport:\"+s.username)\n\n\t// check that we've loaded a cert as well as a private key into the system again\n\tfound := false\n\tfor _, sak := range systemAgentKeys {\n\t\tif sak.Comment == \"teleport:\"+s.username && sak.Type() == \"ssh-rsa\" {\n\t\t\tfound = true\n\t\t}\n\t}\n\tc.Assert(true, check.Equals, found)\n\tfound = false\n\tfor _, sak := range systemAgentKeys {\n\t\tif sak.Comment == \"teleport:\"+s.username && sak.Type() == \"[email protected]\" {\n\t\t\tfound = true\n\t\t}\n\t}\n\tc.Assert(true, check.Equals, found)\n\n\t// unload all keys for this user from the teleport agent and system agent\n\terr = lka.UnloadKey()\n\tc.Assert(err, check.IsNil)\n}", "func StoreInSession(key string, value string, req *http.Request, res http.ResponseWriter) error {\n\tsession, _ := Store.New(req, SessionName)\n\n\tif err := updateSessionValue(session, key, value); err != nil {\n\t\treturn err\n\t}\n\n\treturn session.Save(req, res)\n}", "func (self *Store) Add(k string) []byte {\n\tself.mu.Lock()\n\tself.mu.Unlock()\n\treturn nil\n}", "func (_ECC *ECCSession) VoteAddKey(key common.Address) (*types.Transaction, error) {\n\treturn _ECC.Contract.VoteAddKey(&_ECC.TransactOpts, key)\n}", "func (enc *Encoder) AddBoolKey(key string, v bool) {\n\tenc.BoolKey(key, v)\n}", "func (s *service) AddSession(session *Session) (*Session, []error) {\n\treturn (*s.repo).AddSession(session)\n}", "func Add(c context.Context, key string, data []byte) {\n\tmemcache.Add(c, &memcache.Item{\n\t\tKey: key,\n\t\tValue: data,\n\t})\n}", "func (ks *KeyStore) AddECDSAKey(session pkcs11.SessionHandle, privKey data.PrivateKey, hwslot common.HardwareSlot, passwd string, role data.RoleName) error {\n\tlogrus.Debugf(\"Attempting to add key to %s with ID: %s\", name, privKey.ID())\n\terr := pkcs11Ctx.Login(session, pkcs11.CKU_USER, passwd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer pkcs11Ctx.Logout(session)\n\tecdsaPrivKey, err := x509.ParseECPrivateKey(privKey.Private())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tecdsaPrivKeyD := common.EnsurePrivateKeySize(ecdsaPrivKey.D.Bytes())\n\n\tstartTime := time.Now()\n\n\ttemplate, err := utils.NewCertificate(role.String(), startTime, startTime.AddDate(data.DefaultExpires(data.CanonicalRootRole).Year(), 0, 0))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create the certificate template: %v\", err)\n\t}\n\n\tcertBytes, err := x509.CreateCertificate(rand.Reader, template, template, ecdsaPrivKey.Public(), ecdsaPrivKey)\n\tecdsaPrivKey = nil\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create the certificate: %v\", err)\n\t}\n\tcertTemplate := []*pkcs11.Attribute{\n\t\tpkcs11.NewAttribute(pkcs11.CKA_LABEL, \"Notary Certificate\"),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_CERTIFICATE),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_CERTIFICATE_TYPE, pkcs11.CKC_X_509),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_TOKEN, true),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_VALUE, certBytes),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_SUBJECT, template.SubjectKeyId),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_ID, hwslot.KeyID),\n\t}\n\n\tprivateKeyTemplate := []*pkcs11.Attribute{\n\t\tpkcs11.NewAttribute(pkcs11.CKA_LABEL, \"Notary Private Key\"),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_PRIVATE_KEY),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_KEY_TYPE, pkcs11.CKK_ECDSA),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_TOKEN, true),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_PRIVATE, true),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_ID, hwslot.KeyID),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_EC_PARAMS, []byte{0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07}),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_VALUE, ecdsaPrivKeyD),\n\t}\n\n\t_, err = pkcs11Ctx.CreateObject(session, certTemplate)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error importing: %v\", err)\n\t}\n\n\t_, err = pkcs11Ctx.CreateObject(session, privateKeyTemplate)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error importing: %v\", err)\n\t}\n\n\treturn nil\n}", "func (ms *MemStore) StoreSession(\n\tsessionKey, rootKeyHash, chainKey string,\n\tsend, recv []string,\n) error {\n\tif len(send) != len(recv) {\n\t\treturn log.Error(\"memstore: len(send) != len(recv)\")\n\t}\n\tlog.Debugf(\"memstore.StoreSession(): %s\", sessionKey)\n\ts, ok := ms.sessions[sessionKey]\n\tif !ok {\n\t\tms.sessions[sessionKey] = &memSession{\n\t\t\trootKeyHash: rootKeyHash,\n\t\t\tchainKey: chainKey,\n\t\t\tsend: send,\n\t\t\trecv: recv,\n\t\t}\n\t\tms.sessionKey = sessionKey\n\t} else {\n\t\t// session already exists -> update\n\t\t// rootKeyHash stays the same!\n\t\ts.chainKey = chainKey\n\t\ts.send = append(s.send, send...)\n\t\ts.recv = append(s.recv, recv...)\n\t}\n\treturn nil\n}", "func AddKeyValue(key string, value interface{}) error {\n\treturn memoryconfigsource.NewMemoryConfigurationSource().AddKeyValue(key, value)\n}", "func (se *StringExpression) Add(key string, value string) *StringExpression {\n\tse.env[key] = value\n\treturn se\n}", "func addKey(keys map[rune]kb.Key, r rune, key kb.Key, scanCodeMap map[string][]int64, shouldPanic bool) {\n\tif _, ok := keys[r]; ok {\n\t\tif shouldPanic {\n\t\t\tpanic(fmt.Sprintf(\"rune %U (%s/%s) already defined in keys\", r, key.Code, key.Key))\n\t\t}\n\t\treturn\n\t}\n\n\tsc, ok := scanCodeMap[key.Code]\n\tif ok {\n\t\tkey.Native = sc[0]\n\t\tkey.Windows = sc[1]\n\t}\n\n\tkeys[r] = key\n}", "func AddSession(db *sql.DB, oauthClientName ClientName, userID UserID) (SessionID, error) {\n\tvar clientID string\n\terr := db.QueryRow(`\n\t\tselect id from oauth_clients where name = $1\n\t`, oauthClientName).Scan(&clientID)\n\tif err == sql.ErrNoRows {\n\t\treturn 0, errors.Errorf(\"failed to find oauth client: %s\", oauthClientName)\n\t} else if err != nil {\n\t\tpanic(err)\n\t}\n\n\tvar sessionID SessionID\n\t\n\terr = db.QueryRow(`\n\t\tinsert into oauth_sessions(client_id, owner_type, owner_id, created_at, updated_at) values ($1, 'user', $2, now(), now()) returning id\n\t`, clientID, userID).Scan(&sessionID)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn sessionID, nil\n}", "func (c *CryptohomeBinary) AddKeyEx(ctx context.Context, username, password, label, newPassword, newLabel string, lowEntropy bool) ([]byte, error) {\n\targs := []string{\"--action=add_key_ex\", \"--user=\" + username, \"--password=\" + password, \"--key_label=\" + label, \"--new_password=\" + newPassword, \"--new_key_label=\" + newLabel}\n\tif lowEntropy {\n\t\targs = append(args, \"--key_policy=le\")\n\t}\n\treturn c.call(ctx, args...)\n}", "func (f *Flash) Add(key, value string) {\n\tif !f.changed {\n\t\tf.changed = true\n\t}\n\tf.v.Add(key, value)\n}", "func (c *Client) SessionKey() []byte {\n\treturn c.sessionSecret\n}", "func (i *instances) AddSSHKeyToAllInstances(_ context.Context, _ string, _ []byte) error {\n\treturn errors.New(\"not implemented\")\n}", "func (kc *Keychain) Add(key *crypto.PublicKeySECP256K1R) {\n\taddr := key.Address()\n\tkc.Addrs.Add(addr)\n}", "func (sess Session) Set(key, value string) {\n\tsess[key] = value\n}", "func GenerateSessionKey() (string, error) {\n\tkey := make([]byte, 64)\n\n\t_, err := rand.Read(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(key), nil\n}", "func (c *kvStatsCollector) Add(key sstable.InternalKey, value []byte) error {\n\tc.curSize += len(key.UserKey) + len(value)\n\tc.lastKey = append(c.lastKey[:0], key.UserKey...)\n\tif c.curSize >= c.bucketSize {\n\t\tc.addBucket()\n\t}\n\treturn nil\n}", "func (c Context) Add(key string, value interface{}) {\n\tc.data[key] = value\n}", "func addKey(Writer http.ResponseWriter, Request *http.Request) {\n\tdefer Request.Body.Close()\n\terr := jwt.ValidateToken(Request.Header[\"Authorization\"][0])\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stdout, \"POST\\t\\\\KeyHook\\t\"+string(http.StatusUnauthorized)+\"\\n\")\n\t\tWriter.WriteHeader(http.StatusUnauthorized)\n\t\tWriter.Write([]byte(\"Invalid Token\"))\n\t\treturn\n\t}\n\n\taddRequest := keyHookRequest{}\n\terr = json.NewDecoder(Request.Body).Decode(&addRequest)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, err.Error()+\"\\n\")\n\t\tfmt.Fprintf(os.Stdout, \"POST\\t\\\\KeyHook\\t\"+string(http.StatusInternalServerError)+\"\\n\")\n\t\tWriter.WriteHeader(http.StatusInternalServerError)\n\t\tWriter.Write([]byte(err.Error()))\n\t\treturn\n\t}\n\n\terr = keyhook.AddNewKey(addRequest.ID, addRequest.Website)\n\tif err != nil {\n\t\tfmt.Printf(\"POST\\t\\\\Auth\\t500\\n\")\n\t\tWriter.WriteHeader(http.StatusInternalServerError)\n\t\tWriter.Write([]byte(err.Error()))\n\t\treturn\n\t}\n\n\tfmt.Printf(\"POST\\t\\\\Auth\\t202\\n\")\n\tWriter.WriteHeader(http.StatusAccepted)\n\treturn\n\n}", "func (s *Store) Add(key []byte, value []byte) error {\n\tif s.HasKey(key) {\n\t\treturn fmt.Errorf(\"key already exists\")\n\t}\n\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\ts.addRec(key, value)\n\n\ts.count++\n\ts.rCount++\n\ts.txCount++\n\n\treturn s.updateHeader()\n}", "func (rh *RedisHandle) CreateHashKey_Session(key string) string {\n\treturn fmt.Sprintf(\"%s:%s\", \"session\", key)\n}", "func addSSHKey(serverKey string, sshKey string) core.BeforeFunc {\n\treturn func(ctx *core.BeforeFuncCtx) error {\n\t\tserver := ctx.Meta[serverKey].(*instance.Server)\n\t\ttags := append(server.Tags, formatSSHKeyToTag(sshKey))\n\n\t\tresp, err := instance.NewAPI(ctx.Client).UpdateServer(&instance.UpdateServerRequest{\n\t\t\tZone: server.Zone,\n\t\t\tServerID: server.ID,\n\t\t\tTags: &tags,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tctx.Meta[serverKey] = resp.Server\n\n\t\treturn nil\n\t}\n}", "func (k2h *K2hash) AddSubKey(k interface{}, s interface{}, v interface{}, options ...func(*K2hashParams)) (bool, error) {\n\t// 1. binary or text\n\tvar key string\n\tvar subkey string\n\tvar val string\n\tswitch k.(type) {\n\tdefault:\n\t\treturn false, fmt.Errorf(\"unsupported key data format %T\", k)\n\tcase string:\n\t\tkey = k.(string)\n\t}\n\tswitch s.(type) {\n\tdefault:\n\t\treturn false, fmt.Errorf(\"unsupported key data format %T\", s)\n\tcase string:\n\t\tsubkey = s.(string)\n\t}\n\tswitch v.(type) {\n\tdefault:\n\t\treturn false, fmt.Errorf(\"unsupported key data format %T\", v)\n\tcase string:\n\t\tval = v.(string)\n\t}\n\t//fmt.Printf(\"key %v val %v\\n\", key, val)\n\n\t// 2. set params\n\tparams := K2hashParams{\n\t\tpassword: \"\",\n\t\texpirationDuration: 0,\n\t}\n\n\tfor _, option := range options {\n\t\toption(&params)\n\t}\n\n\t// 3. get from k2hash get API\n\tcKey := C.CString(key)\n\tdefer C.free(unsafe.Pointer(cKey))\n\tcSubKey := C.CString(subkey)\n\tdefer C.free(unsafe.Pointer(cSubKey))\n\tcVal := C.CString(val)\n\tdefer C.free(unsafe.Pointer(cVal))\n\tcPass := C.CString(params.password)\n\tdefer C.free(unsafe.Pointer(cPass))\n\tvar expire *C.time_t\n\t// WARNING: You can't set zero expire.\n\tif params.expirationDuration != 0 {\n\t\texpire = (*C.time_t)(&params.expirationDuration)\n\t}\n\tok := C.k2h_add_str_subkey_wa(k2h.handle, (*C.char)(cKey), (*C.char)(cSubKey), (*C.char)(cVal), cPass, expire)\n\t//fmt.Printf(\"ok %v\\n\", ok)\n\tif ok != true {\n\t\treturn false, fmt.Errorf(\"C.C.k2h_add_str_subkey_wa return false\")\n\t}\n\treturn true, nil\n}", "func (tb *TaskBuilder) AddSessionParameters(params map[string]interface{}) string {\n\tp := make([]string, 0)\n\tsortedKeys := make([]string, 0)\n\tfor k := range params {\n\t\tsortedKeys = append(sortedKeys, k)\n\t}\n\tsort.Strings(sortedKeys)\n\n\tfor _, k := range sortedKeys {\n\t\tp = append(p, EscapeString(fmt.Sprintf(`%v = \"%v\"`, k, params[k])))\n\t}\n\n\treturn fmt.Sprintf(`ALTER TASK %v SET %v`, tb.QualifiedName(), strings.Join(p, \", \"))\n}", "func (s *Service) AddPrivateKey(keyID string, privateKey crypto.PrivateKey) error {\n\tif _, ok := s.keys[keyID]; ok {\n\t\ts.log.Error(\"The specified key ID is already in use\", \"keyID\", keyID)\n\t\treturn signingkeys.ErrSigningKeyAlreadyExists.Errorf(\"The specified key ID is already in use: %s\", keyID)\n\t}\n\ts.keys[keyID] = privateKey.(crypto.Signer)\n\treturn nil\n}", "func (ds *DataStore) Add(key uint64, value []byte) error {\n\tds.dataStoreLock.Lock()\n\tdefer ds.dataStoreLock.Unlock()\n\tif _, present := ds.kvSet[key]; present {\n\t\tds.kvTime[key] = time.Now().UnixNano()\n\t\treturn fmt.Errorf(\"Key %d already exists\", key)\n\t}\n\tds.kvSet[key] = value\n\treturn nil\n}", "func (mmap *stateSyncMap) add(key string, value interface{}) error {\n\treturn mmap.Add(key, value)\n}", "func WithSessionID(ctx context.Context, sessionID eh.UUID) context.Context {\n\treturn context.WithValue(ctx, sessionIDKey, sessionID)\n}", "func (_ECC *ECCTransactor) VoteAddKey(opts *bind.TransactOpts, key common.Address) (*types.Transaction, error) {\n\treturn _ECC.contract.Transact(opts, \"voteAddKey\", key)\n}", "func WithSessionID(ctx context.Context, sessionID string) context.Context {\n\treturn context.WithValue(ctx, sessionIDKey, sessionID)\n}", "func (c CryptoServiceTester) TestAddKey(t *testing.T) {\n\tcryptoService := c.cryptoServiceFactory()\n\tcryptoService.keyStores = append(cryptoService.keyStores,\n\t\ttrustmanager.NewKeyMemoryStore(passphraseRetriever))\n\n\tprivKey, err := utils.GenerateECDSAKey(rand.Reader)\n\trequire.NoError(t, err)\n\n\t// Add the key to the targets role\n\trequire.NoError(t, cryptoService.AddKey(data.CanonicalTargetsRole, c.gun, privKey))\n\n\t// Check that we added the key and its info to only the first keystore\n\tretrievedKey, retrievedRole, err := cryptoService.keyStores[0].GetKey(privKey.ID())\n\trequire.NoError(t, err)\n\trequire.Equal(t, privKey.Private(), retrievedKey.Private())\n\trequire.Equal(t, data.CanonicalTargetsRole, retrievedRole)\n\n\tretrievedKeyInfo, err := cryptoService.keyStores[0].GetKeyInfo(privKey.ID())\n\trequire.NoError(t, err)\n\trequire.Equal(t, data.CanonicalTargetsRole, retrievedKeyInfo.Role)\n\trequire.Equal(t, c.gun, retrievedKeyInfo.Gun)\n\n\t// The key should not exist in the second keystore\n\t_, _, err = cryptoService.keyStores[1].GetKey(privKey.ID())\n\trequire.Error(t, err)\n\t_, err = cryptoService.keyStores[1].GetKeyInfo(privKey.ID())\n\trequire.Error(t, err)\n\n\t// We should be able to successfully get the key from the cryptoservice level\n\tretrievedKey, retrievedRole, err = cryptoService.GetPrivateKey(privKey.ID())\n\trequire.NoError(t, err)\n\trequire.Equal(t, privKey.Private(), retrievedKey.Private())\n\trequire.Equal(t, data.CanonicalTargetsRole, retrievedRole)\n\tretrievedKeyInfo, err = cryptoService.GetKeyInfo(privKey.ID())\n\trequire.NoError(t, err)\n\trequire.Equal(t, data.CanonicalTargetsRole, retrievedKeyInfo.Role)\n\trequire.Equal(t, c.gun, retrievedKeyInfo.Gun)\n\n\t// Add the same key to the targets role, since the info is the same we should have no error\n\trequire.NoError(t, cryptoService.AddKey(data.CanonicalTargetsRole, c.gun, privKey))\n\n\t// Try to add the same key to the snapshot role, which should error due to the role mismatch\n\trequire.Error(t, cryptoService.AddKey(data.CanonicalSnapshotRole, c.gun, privKey))\n}", "func AddSessionToContext(ctx context.Context, session *types.UserSession) context.Context {\n\tk := types.BenderContextKey(\"__SESSION__\")\n\treturn context.WithValue(ctx, k, session)\n}", "func (lru *KeyLRU) Add(key interface{}) error {\n\tlru.lazyInit()\n\tele := lru.ll.PushFront(key)\n\tif _, ok := lru.m[key]; ok {\n\t\treturn errors.New(\"key was already in LRU\")\n\t}\n\tlru.m[key] = ele\n\treturn nil\n}", "func Add(p *pool.Pool, key int, m *dns.Msg, duration time.Duration) error {\n\t// SETEX key duration m\n\tconn, err := p.Get()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer p.Put(conn)\n\n\tresp := conn.Cmd(\"SETEX\", strconv.Itoa(key), int(duration.Seconds()), ToString(m))\n\n\treturn resp.Err\n}", "func (_ECC *ECCTransactorSession) ProposeAddKey(key common.Address, keyType uint8) (*types.Transaction, error) {\n\treturn _ECC.Contract.ProposeAddKey(&_ECC.TransactOpts, key, keyType)\n}", "func (mc *MemCache) Add(key string, value interface{}) {\n\t_, expTime, found := mc.c.GetWithExpiration(key)\n\tif found { // do not reset expiration if the key already exists\n\t\tmc.c.Set(key, value, time.Until(expTime))\n\t\treturn\n\t}\n\n\tmc.c.Set(key, value, mc.expiration)\n}", "func (r *request) Add(key string, payload interface{}) {\n\tr.details[key] = payload\n}", "func (h *RequestHeader) Add(key, val string) {\n\t// h.RequestHeader.Add(key, val)\n}", "func (keyRing *KeyRing) AddKey(key *Key) error {\n\tif key.IsPrivate() {\n\t\tunlocked, err := key.IsUnlocked()\n\t\tif err != nil || !unlocked {\n\t\t\treturn errors.New(\"gopenpgp: unable to add locked key to a keyring\")\n\t\t}\n\t}\n\n\tkeyRing.appendKey(key)\n\treturn nil\n}", "func (store *KapacitorStore) Add(ctx context.Context, kap chronograf.Server) (chronograf.Server, error) {\n\treturn chronograf.Server{}, fmt.Errorf(\"in-memory KapacitorStore does not support adding a Kapacitor\")\n}", "func (session *SafeSession) Append(shardSession *vtgatepb.Session_ShardSession) {\n\tsession.mu.Lock()\n\tdefer session.mu.Unlock()\n\tsession.ShardSessions = append(session.ShardSessions, shardSession)\n}", "func (s *session) getKey() string {\n\treturn s.uuid\n}", "func (t *Terminal) AddUserSession(username, session string, server *Server) {\n\tt.Lock()\n\tdefer t.Unlock()\n\n\t// check if it's exists, if not go and lazy initialize a new user instance\n\tvar user *User\n\tvar ok bool\n\tuser, ok = t.Users[username]\n\tif !ok {\n\t\tuser = NewUser(username)\n\t}\n\n\tuser.AddSession(session, server)\n\tt.Users[username] = user\n}", "func ( handle *MemcacheClient) Add(key string, value []byte) error {\n\n\tif len(key) <= 0 {\n\t\tlog.Printf(\"Error: passed key to be placd in memcache in blank\\n\")\n\t\treturn fmt.Errorf(\"passed key to be placd in memcache in blank\")\n\t}\n\tlog.Printf(\"Info: memcache set key:%s value:%s\\n\",key , string(value))\n\tit := memcache.Item{Key:key, Value:value, Expiration: defTTL}\n\terr := handle.mc.Set(&it)\n\tif err != nil{\n\t\tlog.Printf(\"Error: unable to set data:%s:%s\\n\",key,err.Error())\n\t\treturn fmt.Errorf(\"unable to set data:%s\\n\",err.Error())\n\t}\n\n\treturn nil\n}", "func AddUserToSession(user User, c *gin.Context) {\n\ts := sessions.Default(c)\n\t// Clear out password field\n\tuser.Password = \"\"\n\tuser.PasswordConfirm = \"\"\n\ts.Set(defaultUserKeystring, user)\n\ts.Save()\n\n\tlogrus.WithFields(logrus.Fields{\n\t\t\"module\": \"core\",\n\t\t\"action\": \"AddUserToSession\",\n\t\t\"data\": user,\n\t}).Info(\"User added to Session using default key\")\n}" ]
[ "0.6423503", "0.6323099", "0.62819356", "0.6256926", "0.61663294", "0.616442", "0.6119882", "0.6119334", "0.6081158", "0.6046519", "0.5989558", "0.5984429", "0.5983712", "0.59713036", "0.59532416", "0.59405285", "0.5913878", "0.59074885", "0.5815175", "0.5807486", "0.580188", "0.57989657", "0.5792403", "0.57757634", "0.57112783", "0.5703132", "0.56951594", "0.568648", "0.568323", "0.56731325", "0.56215906", "0.561825", "0.56174237", "0.55890334", "0.5584223", "0.5579639", "0.5578529", "0.55599296", "0.55573153", "0.5530858", "0.5506086", "0.5446968", "0.54311925", "0.542998", "0.5429458", "0.5421666", "0.5420896", "0.5419528", "0.5412513", "0.53996325", "0.5385608", "0.5377725", "0.53771996", "0.536344", "0.53586906", "0.5357903", "0.5339969", "0.53362525", "0.5325072", "0.5317272", "0.5309564", "0.5300848", "0.5297305", "0.5277424", "0.5277162", "0.52750283", "0.5273311", "0.52558786", "0.52461046", "0.52339023", "0.52330357", "0.52328426", "0.5229951", "0.522649", "0.522036", "0.52142996", "0.5212497", "0.5212496", "0.52082783", "0.52059865", "0.520325", "0.5202424", "0.51994187", "0.5195336", "0.518863", "0.518812", "0.517793", "0.5169337", "0.5160038", "0.5141562", "0.5139184", "0.51257825", "0.51235116", "0.51228774", "0.51203203", "0.51192343", "0.51122016", "0.5107569", "0.5105379", "0.5102183" ]
0.8089887
0
GetSessionKey implemented in memory.
func (ms *MemStore) GetSessionKey(hash string) ( json, privKey string, err error, ) { sk, ok := ms.sessionKeys[hash] if !ok { return "", "", log.Error(session.ErrNoKeyEntry) } return sk.json, sk.privKey, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (session *Session) GetSessionKey() string {\n\treturn session.id.String()\n}", "func (s *session) getKey() string {\n\treturn s.uuid\n}", "func (m *RegistryKeyState) GetKey()(*string) {\n return m.key\n}", "func (p *Provider) GetKey() interface{} {\n\treturn p.key\n}", "func (ms *MemStore) SessionKey() string {\n\treturn ms.sessionKey\n}", "func (ctx Ctx) Key(at KeyPairID) (res Key, err error) {\n\tif C.CryptGetUserKey(ctx.hProv, C.DWORD(at), &res.hKey) == 0 {\n\t\terr = getErr(\"Error getting key for container\")\n\t\treturn\n\t}\n\treturn\n}", "func (symmetricKey *SymmetricKey) GetKey() []byte {\n\tsymmetricKey.mutex.RLock()\n\tdefer symmetricKey.mutex.RUnlock()\n\treturn symmetricKey.SymmetricKey\n}", "func GetKey(t *testing.T) []byte {\n\tt.Helper()\n\n\tk, _ := GeneratePrivateKey()\n\treturn k.Data[:]\n}", "func getSessionByKey(key string) *user.SessionState {\n\t// here goes our logic to check if passed API key is valid and appropriate key session can be retrieved\n\n\t// perform auth (only one token \"abc\" is allowed)\n\t// Here you add code to query your database\n\tif key != \"abc\" {\n\t\treturn nil\n\t}\n\n\t// return session\n\treturn &user.SessionState{\n\t\tOrgID: \"default\",\n\t\tAlias: \"abc-session\",\n\t}\n}", "func (a *Account) SessionKey() *big.Int {\n\tif a.sessionKey == nil {\n\t\ta.sessionKey, _ = new(big.Int).SetString(a.SessionKeyStr, 16)\n\t}\n\n\treturn a.sessionKey\n}", "func (m LocalTransit) GetKey(context string) ([]byte, error) {\n\tif m.KeyProvider == nil {\n\t\treturn nil, ex.New(\"local transit; key provider is unset\")\n\t}\n\treturn m.KeyProvider(context)\n}", "func GetKey(size int) []byte {\n\treturn GetIV(size)\n}", "func (c Node) GetKey() string {\n\treturn c.key\n}", "func (m *SessionManager) Get(key string) (session Session) {\n\tstmt := Sessions.Select().Where(Sessions.C(\"key\").Equals(key))\n\tm.conn.Query(stmt, &session)\n\treturn\n}", "func (m *KeyValue) GetKey()(*string) {\n return m.key\n}", "func (st *MemSessionStore) Get(key interface{}) interface{} {\n\treturn (*session.MemSessionStore)(st).Get(context.Background(), key)\n}", "func ConnEkgKey(cid types.ConnId) []byte {\n return createKey(CONN,EKG,cid.Serialize())\n}", "func (s *Basememcached_protocolListener) EnterKey(ctx *KeyContext) {}", "func (ips *IPAMState) GetKey() string {\n\treturn ips.IPAMPolicy.GetKey()\n}", "func (m *KeyUint) Key() driver.Value { return driver.Value(m.ID) }", "func (u User) Key() interface{} {\n\treturn u.ID\n}", "func (sid SessionID) getRedisKey() string {\n\t//convert the SessionID to a string and add the prefix \"sid:\" to keep\n\t//SessionID keys separate from other keys that might end up in this\n\t//redis instance\n\treturn \"sid:\" + sid.String()\n}", "func (ms *MemStore) GetChainKey(sessionKey string) (*[32]byte, error) {\n\ts, ok := ms.sessions[sessionKey]\n\tif !ok {\n\t\treturn nil, log.Errorf(\"memstore: no session found for %s\", sessionKey)\n\t}\n\t// decode chain key\n\tvar key [32]byte\n\tk, err := base64.Decode(s.chainKey)\n\tif err != nil {\n\t\treturn nil, log.Error(\"memstore: cannot decode chain key\")\n\t}\n\tif copy(key[:], k) != 32 {\n\t\treturn nil, log.Errorf(\"memstore: chain key has wrong length\")\n\t}\n\treturn &key, nil\n}", "func (st *MemStorage) GetKey(gun, role string) (algorithm string, public []byte, err error) {\n\t// no need for lock. It's ok to return nil if an update\n\t// wasn't observed\n\tg, ok := st.keys[gun]\n\tif !ok {\n\t\treturn \"\", nil, &ErrNoKey{gun: gun}\n\t}\n\tk, ok := g[role]\n\tif !ok {\n\t\treturn \"\", nil, &ErrNoKey{gun: gun}\n\t}\n\n\treturn k.algorithm, k.public, nil\n}", "func (k *Index) GetKeyPtr() unsafe.Pointer { return unsafe.Pointer(k) }", "func (c *conn) Key() string {\n\t// We don't need to lock because the key never changes after creation\n\treturn c.key.String()\n}", "func (key twofishKey) Key() []byte {\n\treturn key[:]\n}", "func (ms *MemStore) GetMessageKey(\n\tsessionKey string,\n\tsender bool,\n\tmsgIndex uint64,\n) (*[64]byte, error) {\n\ts, ok := ms.sessions[sessionKey]\n\tif !ok {\n\t\treturn nil, log.Errorf(\"memstore: no session found for %s\", sessionKey)\n\t}\n\tif msgIndex >= uint64(len(s.send)) {\n\t\treturn nil, log.Error(\"memstore: message index out of bounds\")\n\t}\n\tvar key string\n\tvar party string\n\tif sender {\n\t\tkey = s.send[msgIndex]\n\t\tparty = \"sender\"\n\t} else {\n\t\tkey = s.recv[msgIndex]\n\t\tparty = \"recipient\"\n\t}\n\t// make sure key wasn't used yet\n\tif key == \"\" {\n\t\treturn nil, log.Error(session.ErrMessageKeyUsed)\n\t}\n\t// decode key\n\tvar messageKey [64]byte\n\tk, err := base64.Decode(key)\n\tif err != nil {\n\t\treturn nil,\n\t\t\tlog.Errorf(\"memstore: cannot decode %s key for %s\", party,\n\t\t\t\tsessionKey)\n\t}\n\tif copy(messageKey[:], k) != 64 {\n\t\treturn nil,\n\t\t\tlog.Errorf(\"memstore: %s key for %s has wrong length\", party,\n\t\t\t\tsessionKey)\n\t}\n\treturn &messageKey, nil\n}", "func (n *lnode) key() []byte {\n\tbuf := (*[maxAllocSize]byte)(unsafe.Pointer(n))\n\treturn buf[n.pos : n.pos+n.ksize]\n}", "func (dh *DiffieHelman) SessionKey() ([sha256.Size]byte, error) {\n\tif dh.B == big.NewInt(0) {\n\t\tvar k [sha256.Size]byte\n\t\treturn k, errors.New(\"no second public key available\")\n\t}\n\n\tsessionKey := big.NewInt(0)\n\t// Having your secret set to -1 means your public key is just 0.\n\t// (This is not a mathematical fact; we've just used -1 as a beacon here.)\n\tif dh.a.Cmp(big.NewInt(-1)) != 0 {\n\t\tsessionKey = big.NewInt(0).Exp(dh.B, dh.a, dh.p)\n\t}\n\n\tsessionKeyBytes := sessionKey.Bytes()\n\n\treturn sha256.Sum256(sessionKeyBytes), nil\n}", "func Key() key {\n\treturn contextKey\n}", "func (p *PKCS11) GetKeyID() (err error) {\n findTemplate := []*pkcs11.Attribute{\n pkcs11.NewAttribute(pkcs11.CKA_ID, true), // KeyID\n pkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_PRIVATE_KEY),\n pkcs11.NewAttribute(pkcs11.CKA_PRIVATE, true),\n pkcs11.NewAttribute(pkcs11.CKA_KEY_TYPE, pkcs11.CKK_RSA),\n }\n\n p.Ctx.FindObjectsInit(p.SessionHandle, findTemplate)\n obj, _, err := p.Ctx.FindObjects(p.SessionHandle, 1000)\n if err != nil {\n return\n }\n\n err = p.Ctx.FindObjectsFinal(p.SessionHandle)\n if err != nil {\n return\n }\n\n p.KeyID = map[int][]byte{}\n for num, objValue := range obj {\n attrs, _ := p.Ctx.GetAttributeValue(p.SessionHandle, objValue, findTemplate)\n p.KeyID[num] = attrs[0].Value\n }\n\n return\n}", "func (sess Session) Get(key string) string {\n\treturn sess[key]\n}", "func GetSessionKeyInfo(sessionKey string, clientCode string, client HttpClient) (*SessionKeyInfo, error) {\n\trequestUrl := fmt.Sprintf(common.BaseUrl, clientCode)\n\tparams := url.Values{}\n\tparams.Add(\"sessionKey\", sessionKey)\n\tparams.Add(\"request\", \"getSessionKeyInfo\")\n\tparams.Add(\"clientCode\", clientCode)\n\n\treq, err := http.NewRequest(\"POST\", requestUrl, nil)\n\tif err != nil {\n\t\treturn nil, sharedCommon.NewFromError(\"failed to build HTTP request\", err, 0)\n\t}\n\n\treq.URL.RawQuery = params.Encode()\n\treq.Header.Add(\"Accept\", \"application/json\")\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, sharedCommon.NewFromError(\"failed to call getSessionKeyInfo request\", err, 0)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode < 200 || resp.StatusCode > 299 {\n\t\tvar body []byte\n\t\tif resp.Body != nil {\n\t\t\tbody, err = ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\tbody = []byte{}\n\t\t\t}\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"wrong response status code: %d, body: %s\", resp.StatusCode, string(body))\n\t}\n\n\tres := &SessionKeyInfoResponse{}\n\tif err := json.NewDecoder(resp.Body).Decode(&res); err != nil {\n\t\treturn nil, sharedCommon.NewFromError(\"failed to decode SessionKeyInfoResponse\", err, 0)\n\t}\n\tif len(res.Records) < 1 {\n\t\treturn nil, sharedCommon.NewFromError(\"getSessionKeyUser: no records in response\", nil, res.Status.ErrorCode)\n\t}\n\treturn &res.Records[0], nil\n}", "func (sgp *SgpolicyState) GetKey() string {\n\treturn sgp.NetworkSecurityPolicy.GetKey()\n}", "func (ctx *Context) Session(key interface{}) interface{} {\r\n\treturn ctx.CruSession.Get(key)\r\n}", "func GetSessionFromContext(context context.Context) *mgo.Session {\n\treturn context.Value(sessionKey).(*mgo.Session)\n}", "func (s *GCPCKMSSeal) KeyID() string {\n\treturn s.currentKeyID.Load().(string)\n}", "func getSessionTicketKey() [32]byte {\n\tvar key [32]byte\n\tkeySlice, err := ioutil.ReadFile(\"session_ticket_key\")\n\tif err != nil {\n\t\tkeySlice = make([]byte, 32)\n\t\tn, err := rand.Read(keySlice)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Unable to generate session ticket key: %v\", err)\n\t\t\treturn key\n\t\t}\n\t\tif n != 32 {\n\t\t\tlog.Errorf(\"Generated unexpected length of random data %d\", n)\n\t\t\treturn key\n\t\t}\n\t\terr = ioutil.WriteFile(\"session_ticket_key\", keySlice, 0600)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Unable to save session_ticket_key: %v\", err)\n\t\t} else {\n\t\t\tlog.Debug(\"Saved new session_ticket_key\")\n\t\t}\n\t}\n\tcopy(key[:], keySlice)\n\treturn key\n}", "func (c *Container) Key() string {\n\tc.Lock()\n\tdefer c.Unlock()\n\treturn c.ID\n}", "func (g *Generator) GetKey(K string) interface{} {\n\treturn g.data[K]\n}", "func (b *BaseHandler) GetSession(key interface{}) (interface{}, error) {\n\treturn b.sessionStore.Get(b, key)\n}", "func (stateID StateID) Key() string {\n\treturn string(stateID.LastAppHash)\n}", "func (c *Client) SessionKey() []byte {\n\treturn c.sessionSecret\n}", "func (a *LocalKeyAgent) GetCoreKey() (*Key, error) {\n\treturn a.GetKey(\"\")\n}", "func (it *KeyAccess_Iterator) Key() interface{} {\n\treturn it.node.key\n}", "func (s *Store) GetSessionID() []byte {\n\treturn s.sessionID\n}", "func (s *State) LocalIdentityKey() *identity.Key {\n\treturn s.localIdentityPublic\n}", "func OpenKey(s Server, id backend.ID, password string) (*Key, error) {\n\t// extract data from repo\n\tdata, err := s.Get(backend.Key, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// restore json\n\tk := &Key{}\n\terr = json.Unmarshal(data, k)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// check KDF\n\tif k.KDF != \"scrypt\" {\n\t\treturn nil, errors.New(\"only supported KDF is scrypt()\")\n\t}\n\n\t// derive user key\n\tk.user, err = k.scrypt(password)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// decrypt master keys\n\tbuf, err := k.DecryptUser(k.Data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// restore json\n\tk.master = &keys{}\n\terr = json.Unmarshal(buf, k.master)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tk.id = id\n\n\treturn k, nil\n}", "func getTokenKey(userID interface{}) string {\n\treturn utils.RedisKey(\"TOKEN\", \"getToken\", userID)\n}", "func (i service) GetKey(did id.DID, key [32]byte) (*id.KeyResponse, error) {\n\tcontract, opts, _, err := i.prepareCall(did)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult, err := contract.GetKey(opts, key)\n\n\tif err != nil {\n\t\treturn nil, errors.New(\"Could not call identity contract: %v\", err)\n\t}\n\n\treturn &id.KeyResponse{result.Key, result.Purposes, result.RevokedAt}, nil\n\n}", "func ReadUserSessionKey(b *[]byte, p *int, e *binary.ByteOrder) UserSessionKey {\n\tcb1 := CypherBlock{\n\t\tData: ndr.ReadBytes(b, p, 8, e),\n\t}\n\tcb2 := CypherBlock{\n\t\tData: ndr.ReadBytes(b, p, 8, e),\n\t}\n\treturn UserSessionKey{\n\t\tData: []CypherBlock{cb1, cb2},\n\t}\n}", "func GenerateSessionKey(user_name string, j aqua.Aide) (token string, err error) {\n\tvar (\n\t\tConn *gorm.DB\n\t\t//token string\n\t\tsessionData []interface{}\n\t)\n\tif Conn, err = dbConn(); err == nil {\n\t\tif token, err = crypt.GenerateRandomString(32); err == nil {\n\t\t\texp_time := time.Now().Add(time.Minute * 30)\n\t\t\tinsertSession := `insert into user_session (\n\t\t\tsession_key, fk_user_name,\n\t\t\tlocation, expiry_time) values(?, ?, ?, ? )`\n\t\t\tsessionData = append(sessionData, token, user_name, \"bengaluru\", exp_time)\n\t\t\tif err = Conn.Debug().Exec(insertSession, sessionData...).Error; err == nil {\n\t\t\t\tj.Response.Header().Add(\"session-key\", token)\n\t\t\t\tj.Response.Header().Add(\"connection\", \"keep-alive\")\n\t\t\t\tfmt.Println(\"err\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Println(\"session not generated\")\n\t\t}\n\t} else {\n\t\tfmt.Println(\"connection not established\")\n\t}\n\treturn\n}", "func (s *StorageBase) GetSession(ctx context.Context, sessionId string, ttl time.Duration) (*gmap.StrAnyMap, error) {\n\treturn nil, ErrorDisabled\n}", "func (symmetricKey *SymmetricKey) GetKeyID() string {\n\tsymmetricKey.mutex.RLock()\n\tdefer symmetricKey.mutex.RUnlock()\n\treturn symmetricKey.KeyID\n}", "func KeySession(priv, pub []byte) (*Session, bool) {\n\tprivKey, err := public.UnmarshalPrivate(priv)\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\tdefer privKey.Zero()\n\n\tpubKey, err := public.UnmarshalPublic(pub)\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\n\tshared := public.KeyExchange(privKey, pubKey)\n\treturn &Session{shared: shared}, true\n}", "func (m *PooledWrapper) KeyId(ctx context.Context) (string, error) {\n\treturn m.encryptor().KeyId(ctx)\n}", "func (eln *EmptyLeafNode) GetKey() []byte {\n\treturn nil\n}", "func GetKey(ctx context.Context) string {\n\tsv, ok := ctx.Value(ctxKeyKey).(string)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\n\treturn sv\n}", "func GetSessionKeyUser(sessionKey string, clientCode string, client HttpClient) (*SessionKeyUser, error) {\n\trequestUrl := fmt.Sprintf(common.BaseUrl, clientCode)\n\tparams := url.Values{}\n\tparams.Add(\"sessionKey\", sessionKey)\n\tparams.Add(\"doNotGenerateIdentityToken\", \"1\")\n\tparams.Add(\"request\", \"getSessionKeyUser\")\n\tparams.Add(\"clientCode\", clientCode)\n\n\treq, err := http.NewRequest(\"POST\", requestUrl, nil)\n\tif err != nil {\n\t\treturn nil, sharedCommon.NewFromError(\"failed to build HTTP request\", err, 0)\n\t}\n\n\treq.URL.RawQuery = params.Encode()\n\treq.Header.Add(\"Accept\", \"application/json\")\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, sharedCommon.NewFromError(\"failed to call getSessionKeyUser request\", err, 0)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode < 200 || resp.StatusCode > 299 {\n\t\tvar body []byte\n\t\tif resp.Body != nil {\n\t\t\tbody, err = ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\tbody = []byte{}\n\t\t\t}\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"wrong response status code: %d, body: %s\", resp.StatusCode, string(body))\n\t}\n\n\tres := &SessionKeyUserResponse{}\n\tif err := json.NewDecoder(resp.Body).Decode(&res); err != nil {\n\t\treturn nil, sharedCommon.NewFromError(\"failed to decode SessionKeyUserResponse\", err, 0)\n\t}\n\tif len(res.Records) < 1 {\n\t\treturn nil, sharedCommon.NewFromError(\"getSessionKeyUser: no records in response\", nil, 0)\n\t}\n\treturn &res.Records[0], nil\n}", "func (mci *XMCacheIterator) Key() []byte {\n\tif mci.err != nil || mci.dir == dirReleased {\n\t\treturn nil\n\t}\n\tswitch mci.index {\n\tcase 0, 1:\n\t\treturn mci.iters[mci.index].Key()\n\tcase 2:\n\t\tif mci.mc.isPenetrate {\n\t\t\treturn mci.mIter.Key()\n\t\t}\n\t\treturn nil\n\t}\n\treturn nil\n}", "func (t *Tkeyid) GetKey(id uint) (key string, ok bool) {\n\tkey, ok = t.idtokey[id]\n\treturn\n}", "func (win *Window) GetKey(key Key) Action {\n\treturn Action(C.glfwGetKey(win.c(), C.int(key)))\n}", "func (win *Window) GetKey(key Key) Action {\n\treturn Action(C.glfwGetKey(win.c(), C.int(key)))\n}", "func (m *RedisStore) Get(key interface{}) interface{} {\n\tm.lock.RLock()\n\tdefer m.lock.RUnlock()\n\tif v, ok := m.sessionData[key]; ok {\n\t\treturn v\n\t}\n\treturn nil\n}", "func (st *MemSessionStore) Get(key interface{}) interface{} {\n\tst.lock.RLock()\n\tdefer st.lock.RUnlock()\n\tif v, ok := st.value[key]; ok {\n\t\treturn v\n\t}\n\treturn nil\n}", "func (g *Genkey) Getkey() (key int64, err error) {\n\tselect {\n\tcase key = <-g.keys:\n\t\treturn\n\tcase <-time.After(genKeyTimeout):\n\t\terr = errors.New(\"getKey timeout\")\n\t\treturn\n\t}\n}", "func (m *DeviceHealthAttestationState) GetAttestationIdentityKey()(*string) {\n val, err := m.GetBackingStore().Get(\"attestationIdentityKey\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (ctx Ctx) GenKey(at KeyPairID, flags KeyFlag) (res Key, err error) {\n\tif C.CryptGenKey(ctx.hProv, C.ALG_ID(at), C.DWORD(flags), &res.hKey) == 0 {\n\t\t// BUG: CryptGenKey raises error NTE_FAIL. Looking into it...\n\t\terr = getErr(\"Error creating key for container\")\n\t\treturn\n\t}\n\treturn\n}", "func (s HTTPStore) GetKey(role data.RoleName) ([]byte, error) {\n\turl, err := s.buildKeyURL(role)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq, err := http.NewRequest(\"GET\", url.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := s.roundTrip.RoundTrip(req)\n\tif err != nil {\n\t\treturn nil, NetworkError{Wrapped: err}\n\t}\n\tdefer resp.Body.Close()\n\tif err := translateStatusToError(resp, role.String()+\" key\"); err != nil {\n\t\treturn nil, err\n\t}\n\tb := io.LimitReader(resp.Body, MaxKeySize)\n\tbody, err := ioutil.ReadAll(b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn body, nil\n}", "func getUserIDKey(token string) string {\n\treturn utils.RedisKey(\"TOKEN\", \"getUserID\", token)\n}", "func (d *device) getKey() string {\n\treturn d.GetClass().ToString() + \",\" + d.GetName()\n}", "func Get(redisdb *redis.Client, sessionID, key string) (string, error) {\n\n\tvalue, err := redisdb.HGet(sessionID, key).Result()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to read %s from session: %s\", key, err.Error())\n\t}\n\n\treturn value, nil\n}", "func stringKeyFunc(obj interface{}) (string, error) {\n\tkey := obj.(*nodeidentity.Info).InstanceID\n\treturn key, nil\n}", "func (m *Module) GetKey(ctx context.Context, key string) (string, error) {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\n\treturn m.client.Get(ctx, key).Result()\n}", "func GetSession(key string, cache SessionCache) *Session {\n\tid, err := SessionIdFromString(key)\n\tif err != nil {\n\t\treturn nil\n\t}\n\tsession, err := cache.Retrieve(id)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn session\n}", "func hostGetKeyId(key *byte, size int32) int32", "func GenerateSessionKey() (string, error) {\n\tkey := make([]byte, 64)\n\n\t_, err := rand.Read(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(key), nil\n}", "func (rk *caIdemixRevocationKey) GetKey() *ecdsa.PrivateKey {\n\treturn rk.key\n}", "func (l *License) GetKey() string {\n\tif l == nil || l.Key == nil {\n\t\treturn \"\"\n\t}\n\treturn *l.Key\n}", "func ContextKey(key string) string {\n return ContextKeyBase + key\n}", "func (this *DefaultHandler) GetKey(xesRedis redo.XesRedisBase) (ret string) {\n\tdefer func() {\n\t\tif xesRedis.GetCtx() == nil {\n\t\t\treturn\n\t\t}\n\t\tbench := xesRedis.GetCtx().Value(\"IS_BENCHMARK\")\n\t\tif cast.ToString(bench) == \"1\" {\n\t\t\tret = \"benchmark_\" + ret\n\t\t}\n\t}()\n\n\tkeyInfo := this.getKeyInfo(xesRedis)\n\tkey := cast.ToString(keyInfo[\"key\"])\n\tif key == \"\" {\n\t\tret = xesRedis.GetKeyName()\n\t\treturn\n\t}\n\tret = fmt.Sprintf(key, (xesRedis.GetKeyParams())...)\n\treturn\n}", "func GetSessionToken (strOID string) (string) {\n\thasher := sha256.New()\n\thasher.Write([]byte(strOID + time.Now().String()))\n\treturn EncodeSegment(hasher.Sum(nil))\n}", "func IdentityKey(s string) string {\n\treturn s\n}", "func EkgKey(domain, id []byte) []byte {\n return createKey(EKG,domain,id)\n}", "func (f *Factor) Key() string { return f.ID }", "func (f Base) Key() string {\n\treturn f.key\n}", "func GetKey(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *KeyState, opts ...pulumi.ResourceOption) (*Key, error) {\n\tvar resource Key\n\terr := ctx.ReadResource(\"google-native:apikeys/v2:Key\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func GetEncryptionKey(agentID uuid.UUID) []byte {\n\tif core.Debug {\n\t\tmessage(\"debug\", \"Entering into agents.GetEncryptionKey function\")\n\t}\n\tvar key []byte\n\n\tif isAgent(agentID) {\n\t\tkey = Agents[agentID].secret\n\t}\n\n\tif core.Debug {\n\t\tmessage(\"debug\", \"Leaving agents.GetEncryptionKey function\")\n\t}\n\treturn key\n}", "func GetSession(ctx appengine.Context) (session *Session, err error) {\n\treqId := appengine.RequestID(ctx)\n\tsession, ok := authenticatedSessions[reqId]\n\tif ok {\n\t\treturn\n\t}\n\treturn nil, Unauthenticated\n}", "func (c *Counter) GetKey() string {\n\treturn c.key\n}", "func (f binaryEqualsFunc) key() Key {\n\treturn f.k\n}", "func (c VpnCredential) GetKey() string {\n\treturn c.Key\n}", "func (kl *Keylogger) GetKey() Key {\n\tactiveKey := 0\n\tvar keyState uint16\n\n\tfor i := 0; i < 256; i++ {\n\t\tkeyState = w32.GetAsyncKeyState(i)\n\n\t\t// Check if the most significant bit is set (key is down)\n\t\t// And check if the key is not a non-char key (except for space, 0x20)\n\t\tif keyState&(1<<15) != 0 && !(i < 0x2F && i != 0x20) && (i < 160 || i > 165) && (i < 91 || i > 93) {\n\t\t\tactiveKey = i\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif activeKey != 0 {\n\t\tif activeKey != kl.lastKey {\n\t\t\tkl.lastKey = activeKey\n\t\t\treturn kl.ParseKeycode(activeKey, keyState)\n\t\t}\n\t} else {\n\t\tkl.lastKey = 0\n\t}\n\n\treturn Key{Empty: true}\n}", "func getKey(cluster *clusteroperator.Cluster, t *testing.T) string {\n\tif key, err := controller.KeyFunc(cluster); err != nil {\n\t\tt.Errorf(\"Unexpected error getting key for Cluster %v: %v\", cluster.Name, err)\n\t\treturn \"\"\n\t} else {\n\t\treturn key\n\t}\n}", "func (xmlmc *XmlmcInstStruct) GetSessionID() string {\n\treturn xmlmc.sessionID\n}", "func (s *Arena) getKey(offset uint32, size uint16) []byte {\n\treturn s.data[offset : offset+uint32(size)]\n}", "func getKeyFromKeyCache(keyHandle string) (string, string, error) {\n\n\tctxkey := ctx.Value(keyHandle)\n\tif ctxkey == nil || ctxkey == \"\" {\n\t\tconn, err := net.Dial(\"unix\", RPCSocketFilePath)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"secureoverlay2: Failed to dial workload-agent wlagent.sock\")\n\t\t}\n\t\tclient := rpc.NewClient(conn)\n\t\tdefer client.Close()\n\t\tvar outKey KeyInfo\n\t\tvar args = KeyInfo{\n\t\t\tKeyID: keyHandle,\n\t\t}\n\t\terr = client.Call(\"VirtualMachine.FetchKey\", &args, &outKey)\n\t\tif err != nil {\n\t\t\tlogrus.Tracef(\"%+v\", err)\n\t\t\treturn \"\", \"\", fmt.Errorf(\"secureoverlay2: rpc call workload-agent fetch-key: Client call failed\")\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"Could not fetch the key from workload-agent\")\n\t\t}\n\t\tif len(outKey.Key) == 0 {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"Empty key received from workload-agent\")\n\t\t}\n\t\tunwrappedKey := base64.StdEncoding.EncodeToString(outKey.Key)\n\t\tctx = context.WithValue(context.TODO(), keyHandle, unwrappedKey)\n\t\treturn unwrappedKey, \"\", nil\n\t}\n\treturn fmt.Sprintf(\"%v\", ctx.Value(keyHandle)), \"\", nil\n\n}", "func (t *Type) Key() *Type", "func getPrivateKeyHandle(p *pkcs11.Ctx, session pkcs11.SessionHandle, keyID []byte) (pkcs11.ObjectHandle, error) {\n\tfindTemplate := []*pkcs11.Attribute{\n\t\tpkcs11.NewAttribute(pkcs11.CKA_TOKEN, true),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_ID, keyID),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_PRIVATE_KEY),\n\t}\n\tif err := p.FindObjectsInit(session, findTemplate); err != nil {\n\t\tlogrus.Debugf(\"Failed to init: %s\", err.Error())\n\t\treturn 0, err\n\t}\n\tobj, _, err := p.FindObjects(session, 1)\n\tif err != nil {\n\t\tlogrus.Debugf(\"Failed to find objects: %v\", err)\n\t\treturn 0, err\n\t}\n\tif err := p.FindObjectsFinal(session); err != nil {\n\t\tlogrus.Debugf(\"Failed to finalize: %s\", err.Error())\n\t\treturn 0, err\n\t}\n\tif len(obj) != 1 {\n\t\tlogrus.Debugf(\"should have found one object\")\n\t\treturn 0, errors.New(\"no matching keys found inside of Luna\")\n\t}\n\treturn obj[0], nil\n}" ]
[ "0.70029384", "0.6841103", "0.6389375", "0.63144046", "0.6304477", "0.62602717", "0.6162837", "0.61327755", "0.61287624", "0.6114548", "0.60990095", "0.6028275", "0.598803", "0.5966878", "0.59385234", "0.5934305", "0.5903026", "0.58605933", "0.58512104", "0.5850547", "0.5831964", "0.5822134", "0.58106554", "0.58033615", "0.5785652", "0.5763684", "0.5755971", "0.57452005", "0.57132894", "0.5710831", "0.5710326", "0.570269", "0.56822807", "0.56806", "0.5668552", "0.5666184", "0.5655479", "0.5650829", "0.56449777", "0.5644659", "0.5640333", "0.56401044", "0.56379396", "0.5632459", "0.56298584", "0.5626772", "0.5622314", "0.56213176", "0.55996567", "0.5569825", "0.556932", "0.5563534", "0.55452836", "0.5525513", "0.5520595", "0.5512631", "0.5511767", "0.5508661", "0.5508267", "0.5500976", "0.5499806", "0.5497", "0.5496395", "0.5496395", "0.5494052", "0.54918456", "0.5489178", "0.5486978", "0.5484908", "0.54722303", "0.5469697", "0.54652286", "0.5459924", "0.5458335", "0.5457593", "0.54565406", "0.5454332", "0.5452645", "0.5446065", "0.5445582", "0.5440265", "0.54392725", "0.5439175", "0.5438974", "0.54370004", "0.5431161", "0.5429018", "0.5428928", "0.5426878", "0.5420685", "0.54145485", "0.541087", "0.5402277", "0.5399143", "0.53988135", "0.5388347", "0.5383576", "0.5375685", "0.5373803", "0.53726643" ]
0.63485473
3
DelPrivSessionKey implemented in memory.
func (ms *MemStore) DelPrivSessionKey(hash string) error { sk, ok := ms.sessionKeys[hash] if !ok { return nil } sk.privKey = "" return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (privKey *YubiHsmPrivateKey) UnloadYubiHsmPrivKey() {\n\tif privKey.sessionMgr == nil {\n\t\treturn\n\t}\n\tprivKey.sessionMgr.Destroy()\n}", "func (sess Session) Del(key string) {\n\tdelete(sess, key)\n}", "func (m *MemoryStorer) Del(key string) error {\n\tm.mut.Lock()\n\tdelete(m.sessions, key)\n\tm.mut.Unlock()\n\n\treturn nil\n}", "func (ms *MemStore) DelMessageKey(\n\tsessionKey string,\n\tsender bool,\n\tmsgIndex uint64,\n) error {\n\ts, ok := ms.sessions[sessionKey]\n\tif !ok {\n\t\treturn log.Errorf(\"memstore: no session found for %s\", sessionKey)\n\t}\n\tif msgIndex >= uint64(len(s.send)) {\n\t\treturn log.Error(\"memstore: message index out of bounds\")\n\t}\n\t// delete key\n\tif sender {\n\t\ts.send[msgIndex] = \"\"\n\t} else {\n\t\ts.recv[msgIndex] = \"\"\n\t}\n\treturn nil\n}", "func (keyDB *KeyDB) DelPrivateUID(msg *uid.Message) error {\n\tif _, err := keyDB.delPrivateUIDQuery.Exec(msg.JSON()); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func DecryptPrivKey(entList openpgp.EntityList, pass string) {\n\tent := entList[0]\n\tpassphrase := []byte(pass)\n\n\t// Decrypt priv key\n\tif ent.PrivateKey != nil && ent.PrivateKey.Encrypted {\n\t\terr := ent.PrivateKey.Decrypt(passphrase)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Private key decryption failed.\")\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\n\t// Decrypt all subkeys\n\tfor _, subkey := range ent.Subkeys {\n\t\tif subkey.PrivateKey != nil && subkey.PrivateKey.Encrypted {\n\t\t\terr := subkey.PrivateKey.Decrypt(passphrase)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Subkey decryption failed.\")\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t}\n\t}\n}", "func DecryptPrivKey(data []byte, password string) (crypto.PrivateKey, error) {\n\tvar plain []byte\n\tif password != \"\" {\n\t\t// Set up the crypto stuff\n\t\thash := crypto.SHA256.New()\n\t\tif _, err := hash.Write([]byte(password)); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to hash: %w\", err)\n\t\t}\n\t\thashPW := hash.Sum(nil)\n\t\taes, err := aes.NewCipher(hashPW)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\taesGCM, err := cipher.NewGCM(aes)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnonceSize := aesGCM.NonceSize()\n\n\t\tnonce, ciphertext := data[:nonceSize], data[nonceSize:]\n\t\tplain, err = aesGCM.Open(nil, nonce, ciphertext, nil)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tplain = data\n\t}\n\n\tkey, err := parsePrivateKey(plain)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn key, nil\n}", "func (s *session) Delete(key string) {\n\ts.mu.Lock()\n\tdelete(s.values, key)\n\ts.mu.Unlock()\n\ts.provider.update(s.sid)\n}", "func (o *Gojwt) SetPrivKeyPath(path string)(){\n o.privKeyPath = path\n}", "func (d *Dao) DelPKGCache(c context.Context, mid int64) (err error) {\n\tkey := _pendantPKG + strconv.FormatInt(mid, 10)\n\tconn := d.redis.Get(c)\n\tdefer conn.Close()\n\tif err = conn.Send(\"DEL\", key); err != nil {\n\t\tlog.Error(\"conn.Send(DEL, %s) error(%v)\", key, err)\n\t\treturn\n\t}\n\treturn\n}", "func (m *Manager) Delete(sessionID string, key interface{}) {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\tif session, ok := m.session[sessionID]; ok {\n\t\tdelete(session.values, key)\n\t}\n}", "func (u *UdMap) Del(key string) { delete(u.Data, key) }", "func (key Key) ToPrivKey() cryptotypes.PrivKey {\n\treturn key.k\n}", "func (r *RPCKeyRing) DerivePrivKey(_ keychain.KeyDescriptor) (*btcec.PrivateKey,\n\terror) {\n\n\t// This operation is not supported with remote signing. There should be\n\t// no need for invoking this method unless a channel backup (SCB) file\n\t// for pre-0.13.0 channels are attempted to be restored. In that case\n\t// it is recommended to restore the channels using a node with the full\n\t// seed available.\n\treturn nil, ErrRemoteSigningPrivateKeyNotAvailable\n}", "func (system *System) RevokeSystemKeyPair() error {\n\tdb := database.GetGORMDbConnection()\n\tdefer database.Close(db)\n\n\tvar encryptionKey EncryptionKey\n\n\terr := db.Where(\"system_id = ?\", system.ID).Find(&encryptionKey).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = db.Delete(&encryptionKey).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (system *System) RevokeSystemKeyPair() error {\n\tdb := GetGORMDbConnection()\n\tdefer Close(db)\n\n\tvar encryptionKey EncryptionKey\n\n\terr := db.Where(\"system_id = ?\", system.ID).Find(&encryptionKey).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = db.Delete(&encryptionKey).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *memoryCache) Del(key string) {\n\tdelete(c.data, key)\n}", "func (c *CredCache) removeCachedTokenInternal() error {\n\tkeyring, err := keyctl.SessionKeyring()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get keyring during removing cached token, %v\", err)\n\t}\n\tkey, err := keyring.Search(c.keyName)\n\tif err != nil {\n\t\tif err == syscall.ENOKEY {\n\t\t\treturn fmt.Errorf(\"no cached token found for current user\")\n\t\t}\n\t\treturn fmt.Errorf(\"no cached token found for current user, %v\", err)\n\t}\n\terr = key.Unlink()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to remove cached token, %v\", err)\n\t}\n\n\tc.isPermSet = false\n\tc.key = nil\n\n\treturn nil\n}", "func (a *LocalKeyAgent) UnloadKey() error {\n\tagents := []agent.Agent{a.Agent}\n\tif a.sshAgent != nil {\n\t\tagents = append(agents, a.sshAgent)\n\t}\n\n\t// iterate over all agents we have and unload keys for this user\n\tfor _, agent := range agents {\n\t\t// get a list of all keys in the agent\n\t\tkeyList, err := agent.List()\n\t\tif err != nil {\n\t\t\ta.log.Warnf(\"Unable to communicate with agent and list keys: %v\", err)\n\t\t}\n\n\t\t// remove any teleport keys we currently have loaded in the agent for this user\n\t\tfor _, key := range keyList {\n\t\t\tif key.Comment == fmt.Sprintf(\"teleport:%v\", a.username) {\n\t\t\t\terr = agent.Remove(key)\n\t\t\t\tif err != nil {\n\t\t\t\t\ta.log.Warnf(\"Unable to communicate with agent and remove key: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (mph *MockPeerHandler) PrivKey() libp2pcry.PrivKey {\n\treturn nil\n}", "func RemoveSession(ctxid int64) {\n\tdelete(sessionBuf, ctxid)\n}", "func (st *MemSessionStore) Delete(key interface{}) error {\n\tst.lock.Lock()\n\tdefer st.lock.Unlock()\n\tdelete(st.value, key)\n\treturn nil\n}", "func (c Context) Del(key string) {\n\tdelete(c.data, key)\n}", "func (a *LocalKeyAgent) DeleteKey() error {\n\t// remove key from key store\n\terr := a.keyStore.DeleteKey(KeyIndex{ProxyHost: a.proxyHost, Username: a.username})\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\t// remove any keys that are loaded for this user from the teleport and\n\t// system agents\n\terr = a.UnloadKey()\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\treturn nil\n}", "func (st *MemSessionStore) Delete(key interface{}) error {\n\treturn (*session.MemSessionStore)(st).Delete(context.Background(), key)\n}", "func (s *server) Del(key string) {\n\tres := make(chan bool)\n\ts.ops <- func() {\n\t\tdelete(s.store, key)\n\t\tres <- true\n\t}\n\t<-res\n}", "func (ps *MemProfiles) Delete(key string) {\n\tps.Lock()\n\tdelete(ps.internal, key)\n\tps.Unlock()\n}", "func (this *mMap) Del(k string) (result int64, err error) {\n\tkey := this.Key(k)\n\tresult, err = this.Client.Del(key).Result()\n\treturn\n}", "func (g *GCache) Del(key string) error {\n\tg.db.Remove(key)\n\treturn nil\n}", "func PrivateKeyDecrypt(priv *rsa.PrivateKey, rand io.Reader, ciphertext []byte, opts crypto.DecrypterOpts) ([]byte, error)", "func (module *ShutUpModule) PrivMsg(srv *Server, msg *InputMessage) {\n\tsrv.SendToChannelMinions(msg.ReplyTo, ClientCommand{\"shutup\", nil})\n\tsrv.Reply(msg, \"ok...\")\n}", "func (s *Session) Remove(key *Key) (err error) {\n\tatomic.AddUint64(&cDeletes, 1)\n\n\tvar cflags C.uint64_t\n\tvar ioflags C.uint64_t\n\terr = Error(C.dnet_remove_object_now(s.session, &key.id, cflags, ioflags))\n\treturn\n}", "func GenPrivKey() crypto.PrivKey {\n\treturn sr25519.GenPrivKey()\n}", "func (cc *Client) UnlinkAuthorizedKey(key string) error {\n\ts, err := cc.sshSession()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer s.Close()\n\tk := Key{Key: key}\n\tin, err := s.StdinPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := json.NewEncoder(in).Encode(k); err != nil {\n\t\treturn err\n\t}\n\tj, err := json.Marshal(&k)\n\tif err != nil {\n\t\treturn err\n\t}\n\tb, err := s.Output(fmt.Sprintf(\"api-unlink %s\", string(j)))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(b) != 0 {\n\t\treturn ErrCouldNotUnlinkKey\n\t}\n\treturn nil\n}", "func (pk *JSONPasswordKeeper) Del(username string) error {\n\tpk.mutex.Lock()\n\tdefer pk.mutex.Unlock()\n\tif _, exists := pk.userInfo[username]; exists {\n\t\tdelete(pk.userInfo, username)\n\t\treturn pk.flushToDisk()\n\t}\n\treturn ErrNoSuchUser\n}", "func (m *MockCache) Del(key string) error {\n\treturn nil\n}", "func (c *SimpleMemoryCache) Del(ctx *Context, next Next) {\n\tdelete(c.data, ctx.Key)\n}", "func (db *MemoryStorage) Del(key []byte) error {\n\tdb.data.Delete(common.BytesToHex(key))\n\treturn nil\n}", "func (p *PgStore) DeleteByUserKey(ctx context.Context, key string, expID ...string) error {\n\tif len(expID) > 0 {\n\t\tq := fmt.Sprintf(\"DELETE FROM %s WHERE user_key = $1 AND id != ALL ($2);\", p.tName)\n\t\t_, err := p.db.ExecContext(ctx, q, append([]interface{}{key}, pq.Array(expID))...)\n\t\treturn err\n\t}\n\n\tq := fmt.Sprintf(\"DELETE FROM %s WHERE user_key = $1;\", p.tName)\n\t_, err := p.db.ExecContext(ctx, q, key)\n\treturn err\n}", "func (c *Controller) DelSession(name interface{}) error {\n\tif c.CruSession == nil {\n\t\tc.StartSession()\n\t}\n\treturn c.CruSession.Delete(context2.Background(), name)\n}", "func (ks *KeyStore) HardwareRemoveKey(session pkcs11.SessionHandle, hwslot common.HardwareSlot, passwd string, keyID string) error {\n\terr := pkcs11Ctx.Login(session, pkcs11.CKU_USER, passwd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer pkcs11Ctx.Logout(session)\n\tcertTemplate := []*pkcs11.Attribute{\n\t\tpkcs11.NewAttribute(pkcs11.CKA_TOKEN, true),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_ID, hwslot.KeyID),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_CERTIFICATE),\n\t}\n\n\tkeyTemplate := []*pkcs11.Attribute{\n\t\tpkcs11.NewAttribute(pkcs11.CKA_PRIVATE, true),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_KEY_TYPE, pkcs11.CKK_ECDSA),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_ID, hwslot.KeyID),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_PRIVATE_KEY),\n\t}\n\ttemplates := [][]*pkcs11.Attribute{certTemplate, keyTemplate}\n\tfor _, template := range templates {\n\t\tif err := pkcs11Ctx.FindObjectsInit(session, template); err != nil {\n\t\t\tlogrus.Debugf(\"Failed to init find objects: %s\", err.Error())\n\t\t\treturn err\n\t\t}\n\t\tobj, b, err := pkcs11Ctx.FindObjects(session, 1)\n\t\tif err != nil {\n\t\t\tlogrus.Debugf(\"Failed to find objects: %s %v\", err.Error(), b)\n\t\t\treturn err\n\t\t}\n\t\tif err := pkcs11Ctx.FindObjectsFinal(session); err != nil {\n\t\t\tlogrus.Debugf(\"Failed to finalize find objects: %s\", err.Error())\n\t\t\treturn err\n\t\t}\n\t\tif len(obj) != 1 {\n\t\t\tlogrus.Debugf(\"should have found exactly one object\")\n\t\t\treturn err\n\t\t}\n\n\t\terr = pkcs11Ctx.DestroyObject(session, obj[0])\n\t\tif err != nil {\n\t\t\tlogrus.Debugf(\"Failed to delete cert/privkey\")\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\treturn nil\n}", "func (c *cache) Del(key string) error {\n\terr := c.cacheConn.Del(key).Err()\n\tif err != nil {\n\t\tlogger.Log().Error(\"Error while deleting key\", zap.String(\"key\", key), zap.Error(err))\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *HTTPClient) GetPrivKey() crypto.PrivateKey {\n\treturn c.privKey\n}", "func (o SslCertificateSelfManagedSslCertificateOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SslCertificateSelfManagedSslCertificate) *string { return v.PrivateKey }).(pulumi.StringPtrOutput)\n}", "func (c *RedisCache) Del(ctx context.Context, key string) error {\n\treturn c.client.Del(ctx, key).Err()\n}", "func (service *service) decrKey(key string) (int64, error) {\n\treturn service.client.Decr(key).Result()\n}", "func (p Parameters) Del(key string) {\n\tdelete(p, key)\n}", "func delPatricia(ptr patricia, bucket string, cb db.CachedBatch) {\n\tkey := ptr.hash()\n\tlogger.Debug().Hex(\"key\", key[:8]).Msg(\"del\")\n\tcb.Delete(bucket, key[:], \"failed to delete key = %x\", key)\n}", "func (h *hashMap) Del(strKey string) {\n\tkey := GetHash(strKey)\n\tbucket := h.getBucket(key)\n\tbucket.remove(Regularkey(key))\n}", "func TestRemovedCredentialKey(t *testing.T) {\n\tvar _, f = GenUser() // generate user\n\n\t// remove credential_key\n\tremoveUserCredKey(s.db, f.Get(\"UUID\"))\n\n\tr := PostRequest(\"\", f, s.CredentialHandler)\n\tvar newCreds Credentials\n\t_ = json.Unmarshal(r.Body.Bytes(), &newCreds)\n\tif len(newCreds.Key) == 0 || len(newCreds.Value) != 0 {\n\t\tt.Errorf(\"Error fetching new Credentials for user %v. Expected new key\", newCreds)\n\t}\n}", "func (c *Config) UnmarshalPrivKey() (crypto.PrivKey, error) {\n\treturn crypto.UnmarshalPrivateKey(c.PrivKey)\n}", "func (s *service) Del(key string) error {\n\treturn s.redis.Del(key).Err()\n}", "func (st *SessionStoreMySQL) Delete(key interface{}) error {\n\tst.lock.Lock()\n\tdefer st.lock.Unlock()\n\tdelete(st.values, key)\n\treturn nil\n}", "func (s *RedisStore) delete(ctx context.Context, session *sessions.Session) error {\n\tif err := s.Cmd.Del(ctx, s.keyPrefix+session.ID).Err(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (e *Domain) Private() *PrivateKey {\n\tif e.ClearPrivateKey == nil {\n\t\te.decrypt_privatekey()\n\t}\n\treturn e.ClearPrivateKey\n}", "func (m *Uint64) Delete(key interface{}) {\n\tm.m.Delete(key)\n}", "func (t *Tkeyid) DelFromKey(key string) (id uint, ok bool) {\n\tid, ok = t.keytoid[key]\n\tif ok {\n\t\tdelete(t.idtokey, id)\n\t\tdelete(t.keytoid, key)\n\t}\n\treturn\n}", "func GenPrivKey(curve elliptic.Curve) (PrivKey, error) {\n\tkey, err := ecdsa.GenerateKey(curve, rand.Reader)\n\tif err != nil {\n\t\treturn PrivKey{}, err\n\t}\n\treturn PrivKey{*key}, nil\n}", "func DecryptWithPrivateKey(ciphertext []byte, priv *rsa.PrivateKey) []byte {\n\tplaintext, err := rsa.DecryptOAEP(sha512.New(), rand.Reader, priv, ciphertext, nil)\n\tif err != nil {\n\t\tlog.Panic(err.Error)\n\t}\n\treturn plaintext\n}", "func (s *RedisSession) DelKey(key string) (int64, error) {\r\n\tctx, cancel := context.WithTimeout(context.Background(), time.Duration(time.Second*5))\r\n\tdefer cancel()\r\n\r\n\tc, err := s.getClient()\r\n\tif err != nil {\r\n\t\treturn 0, err\r\n\t}\r\n\tcnt, err := c.Del(ctx, []string{s.config.KeyPrefix + key}...).Result()\r\n\tif err != nil {\r\n\t\treturn 0, err\r\n\t}\r\n\treturn cnt, nil\r\n}", "func (ctx *MqttSrvContext) RemoveSession(fd int) {\n\tctx.Clock.Lock()\n\tdelete(ctx.Connections, fd)\n\tctx.Clock.Unlock()\n}", "func (k Keeper) DelValue(ctx sdk.Context, accessPath *vm_grpc.VMAccessPath) {\n\tk.modulePerms.AutoCheck(types.PermStorageWrite)\n\n\tk.delValue(ctx, accessPath)\n}", "func DecryptPKCS1v15SessionKey(rand io.Reader, priv *PrivateKey, ciphertext []byte, key []byte) error {\n\tif err := checkPub(&priv.PublicKey); err != nil {\n\t\treturn err\n\t}\n\tk := (priv.N.BitLen() + 7) / 8\n\tif k-(len(key)+3+8) < 0 {\n\t\treturn rsa.ErrDecryption\n\t}\n\n\tvalid, em, index, err := decryptPKCS1v15(rand, priv, ciphertext)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(em) != k {\n\t\t// This should be impossible because decryptPKCS1v15 always\n\t\t// returns the full slice.\n\t\treturn rsa.ErrDecryption\n\t}\n\n\tvalid &= subtle.ConstantTimeEq(int32(len(em)-index), int32(len(key)))\n\tsubtle.ConstantTimeCopy(valid, key, em[len(em)-len(key):])\n\treturn nil\n}", "func (c *Cache) Del(key string) error {\n\tc.gc.Delete(key)\n\treturn nil\n}", "func DeleteSession(sessionID string) error {\n\tkey := stringutil.Build(\"sessionid:\", sessionID, \":userid\")\n\terr := Delete(key)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot delete key from Redis\")\n\t}\n\treturn nil\n}", "func (sm safeMap) Delete(key string) {\n\tsm <- commandData{action: REMOVE, key: key}\n}", "func (o ProviderOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Provider) pulumi.StringPtrOutput { return v.PrivateKey }).(pulumi.StringPtrOutput)\n}", "func (k Keeper) delValue(ctx sdk.Context, accessPath *vm_grpc.VMAccessPath) {\n\tstore := ctx.KVStore(k.storeKey)\n\tkey := common_vm.GetPathKey(accessPath)\n\n\tstore.Delete(key)\n}", "func (s *MemorySession) Delete(key string) error {\n\tdelete(s.data, key)\n\treturn nil\n}", "func (db *memorydb) Del(key []byte) error {\n\n\tif db.enableBatch {\n\t\tdb.batch.Del(key)\n\t} else {\n\t\tdb.writeLock <- struct{}{}\n\t\tdefer func() {\n\t\t\t<-db.writeLock\n\t\t}()\n\n\t\tdb.sm.Lock()\n\t\tdefer db.sm.Unlock()\n\n\t\tdelete(db.db, string(key))\n\t}\n\n\treturn nil\n}", "func RemKey(argv0 string, args ...string) error {\n\tfs := flag.NewFlagSet(argv0, flag.ContinueOnError)\n\tfs.Usage = func() {\n\t\tfmt.Fprintf(os.Stderr, \"Usage: %s pubkey\\n\", argv0)\n\t\tfmt.Fprintf(os.Stderr, \"Remove existing signer from hashchain.\\n\")\n\t\tfs.PrintDefaults()\n\t}\n\tverbose := fs.Bool(\"v\", false, \"Be verbose\")\n\tif err := fs.Parse(args); err != nil {\n\t\treturn err\n\t}\n\tif *verbose {\n\t\tlog.Std = log.NewStd(os.Stdout)\n\t}\n\tif fs.NArg() != 1 {\n\t\tfs.Usage()\n\t\treturn flag.ErrHelp\n\t}\n\tif err := secpkg.UpToDate(\"codechain\"); err != nil {\n\t\treturn err\n\t}\n\tpubkey := fs.Arg(0)\n\tpub, err := base64.Decode(pubkey, 32)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot decode pubkey: %s\", err)\n\t}\n\tc, err := hashchain.ReadFile(def.HashchainFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer c.Close()\n\tvar pubKey [32]byte\n\tcopy(pubKey[:], pub)\n\tline, err := c.RemoveKey(pubKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Println(line)\n\treturn nil\n}", "func DeleteSession(session *Session) {\r\n\tsessionListMutex.Lock()\r\n\tdefer sessionListMutex.Unlock()\r\n\r\n\tdelete(sessionList, session.Key)\r\n\tfmt.Printf(\"Delete session %d\\n\", session.Key)\r\n}", "func (m *RedisStore) Delete(key interface{}) error {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\tdelete(m.sessionData, key)\n\treturn nil\n}", "func (sim *SessionInterestManager) RemoveSession(ses uint64) []cid.Cid {\n\tsim.lk.Lock()\n\tdefer sim.lk.Unlock()\n\n\t// The keys that no session is interested in\n\tdeletedKs := make([]cid.Cid, 0)\n\n\t// For each known key\n\tfor c := range sim.wants {\n\t\t// Remove the session from the list of sessions that want the key\n\t\tdelete(sim.wants[c], ses)\n\n\t\t// If there are no more sessions that want the key\n\t\tif len(sim.wants[c]) == 0 {\n\t\t\t// Clean up the list memory\n\t\t\tdelete(sim.wants, c)\n\t\t\t// Add the key to the list of keys that no session is interested in\n\t\t\tdeletedKs = append(deletedKs, c)\n\t\t}\n\t}\n\n\treturn deletedKs\n}", "func (cfg *Config) PrivateKey() hotstuff.PrivateKey {\n\treturn cfg.privKey\n}", "func PrivateKey(p *big.Int) *big.Int {\n\n\t// calculate the max value to ensure the random number generated\n\t// lies in the range 1 < n < p.\n\tmax := big.NewInt(0)\n\tmax = max.Sub(p, big.NewInt(2))\n\n\t// generate the random number and adjust for the offest applied above\n\tprivKey, _ := rand.Int(rand.Reader, max)\n\tprivKey.Add(privKey, big.NewInt(2))\n\n\treturn privKey\n}", "func deleteAuthKey(ctx context.Context, secretName string) error {\n\t// m is a JSON Patch data structure, see https://jsonpatch.com/ or RFC 6902.\n\tm := []struct {\n\t\tOp string `json:\"op\"`\n\t\tPath string `json:\"path\"`\n\t}{\n\t\t{\n\t\t\tOp: \"remove\",\n\t\t\tPath: \"/data/authkey\",\n\t\t},\n\t}\n\tvar b bytes.Buffer\n\tif err := json.NewEncoder(&b).Encode(m); err != nil {\n\t\treturn err\n\t}\n\treq, err := http.NewRequest(\"PATCH\", fmt.Sprintf(\"/api/v1/namespaces/%s/secrets/%s?fieldManager=tailscale-container\", kubeNamespace, secretName), &b)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json-patch+json\")\n\tif resp, err := doKubeRequest(ctx, req); err != nil {\n\t\tif resp != nil && resp.StatusCode == http.StatusUnprocessableEntity {\n\t\t\t// This is kubernetes-ese for \"the field you asked to\n\t\t\t// delete already doesn't exist\", aka no-op.\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\treturn nil\n}", "func (x *Ed25519Credentials) PrivateKey() PrivateKey {\n\n\treturn PrivateKey{\n\t\tAlgorithm: AlgorithmEd25519,\n\t\tPrivate: base64.URLEncoding.EncodeToString(x.Private[:]),\n\t}\n\n}", "func (o SslCertificateSelfManagedSslCertificatePtrOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SslCertificateSelfManagedSslCertificate) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.PrivateKey\n\t}).(pulumi.StringPtrOutput)\n}", "func (rc *RedisClient) Del(key string) (int64, error) {\n\tconn := rc.pool.Get()\n\tdefer conn.Close()\n\treply, errDo := conn.Do(\"DEL\", key)\n\tif errDo == nil && reply == nil {\n\t\treturn 0, nil\n\t}\n\tval, err := redis.Int64(reply, errDo)\n\treturn val, err\n}", "func (s *Basememcached_protocolListener) ExitKey(ctx *KeyContext) {}", "func (ms *MemStore) CleanupSessionKeys(t uint64) error {\n\tvar oldKeys []string\n\tfor hash, sk := range ms.sessionKeys {\n\t\tif sk.cleanupTime < t {\n\t\t\toldKeys = append(oldKeys, hash)\n\t\t}\n\t}\n\tfor _, hash := range oldKeys {\n\t\tdelete(ms.sessionKeys, hash)\n\t}\n\treturn nil\n}", "func DEL(key string) (err error) {\n\tconn := pool.Get()\n\tdefer conn.Close()\n\n\t_, err = conn.Do(\"DEL\", key)\n\treturn\n}", "func (kb *Keybase) ExportPrivKey(name, decryptPassphrase, encryptPassphrase string) (armor string, err error) {\n\tkb.mx.Lock()\n\tdefer kb.mx.Unlock()\n\treturn kb.kb.ExportPrivKey(name, decryptPassphrase, encryptPassphrase)\n}", "func (ctx *RequestContext) DeleteSession(key string) {\n\tvars := ctx.token.Claims[\"vars\"].(map[string]interface{})\n\tdelete(vars, key)\n}", "func (s *session) Delete(key interface{}) {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\n\tdelete(s.values, key)\n}", "func PrivateKey(p *big.Int) *big.Int {\n\tkey := new(big.Int)\n\tlimit := new(big.Int).Sub(p, big.NewInt(2))\n\tseed := rand.New(rand.NewSource(time.Now().UnixNano()))\n\treturn key.Rand(seed, limit).Add(key, big.NewInt(2))\n}", "func (p *Parser) Del(key string) {\n\tm, err := p.Map()\n\tif err != nil {\n\t\treturn\n\t}\n\tdelete(m, key)\n}", "func (s *Session) Delete(key string) {\n\t// Better safe than sorry\n\tif s.data == nil {\n\t\treturn\n\t}\n\ts.data.Delete(key)\n}", "func removeSession(sessionId string) error {\n\treturn rd.Del(\"session:\" + sessionId).Err()\n}", "func (cd *ColumnDecryptionProperties) WipeOutDecryptionKey() { cd.key = \"\" }", "func (asr *sessionRegistry) deregister(clt *Client) {\n\tasr.lock.Lock()\n\tdelete(asr.registry, clt.Session.Key)\n\tasr.lock.Unlock()\n}", "func (d *Dao) DelCacheOrderUser(c context.Context, orderID string) (err error) {\n\tconn := d.mc.Get(c)\n\tdefer conn.Close()\n\tkey := orderKey(orderID)\n\tif err = conn.Delete(key); err != nil {\n\t\tif err == memcache.ErrNotFound {\n\t\t\terr = nil\n\t\t\treturn\n\t\t}\n\t\tprom.BusinessErrCount.Incr(\"mc:DelCacheOrderUser\")\n\t\tlog.Errorv(c, log.KV(\"DelCacheOrderUser\", fmt.Sprintf(\"%+v\", err)), log.KV(\"key\", key))\n\t\treturn\n\t}\n\treturn\n}", "func (o SslCertificateSelfManagedSslCertificateResponsePtrOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SslCertificateSelfManagedSslCertificateResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.PrivateKey\n\t}).(pulumi.StringPtrOutput)\n}", "func Unsetenv(key string) error", "func (znp *Znp) ZdoRemoveLinkKey(ieeeAddr string) (rsp *StatusResponse, err error) {\n\treq := &ZdoRemoveLinkKey{IEEEAddr: ieeeAddr}\n\terr = znp.ProcessRequest(unp.C_SREQ, unp.S_ZDO, 0x24, req, &rsp)\n\treturn\n}", "func closeCtx(k *http.Request) {\n\tpk := privateKey(k)\n\tif _, has := internalCtx.Get(pk); has {\n\t\tinternalCtx.Remove(pk)\n\t}\n}", "func NewPopulatedProtoPrivKey(_ randyNet) *ProtoPrivKey {\n\tk, _, _ := crypto.GenerateKeyPair(crypto.RSA, 512)\n\treturn &ProtoPrivKey{PrivKey: k}\n}", "func (d *identityManager) PrivateKey() []byte {\n\treturn d.key.PrivateKey\n}", "func (mm Uint64Uint64Map) Remove(k uint64) {\n\tdelete(mm, k)\n}" ]
[ "0.6715381", "0.6082555", "0.5926367", "0.5817727", "0.5523478", "0.551132", "0.54544395", "0.53445286", "0.530673", "0.52464896", "0.5220689", "0.52179104", "0.5181789", "0.51731354", "0.5166579", "0.51601577", "0.51547384", "0.51293325", "0.51090336", "0.51075536", "0.5104838", "0.5074049", "0.50711066", "0.50655556", "0.5053015", "0.5047415", "0.5041782", "0.50250906", "0.5023838", "0.50167286", "0.49967417", "0.4988325", "0.49725068", "0.4966697", "0.49508908", "0.494796", "0.49424967", "0.49167565", "0.49055684", "0.49051198", "0.489387", "0.48699278", "0.4861168", "0.4859998", "0.4846132", "0.48397592", "0.4836021", "0.483517", "0.48315078", "0.48312572", "0.48287177", "0.482567", "0.48110774", "0.48090157", "0.480747", "0.47996354", "0.47972035", "0.47947544", "0.478797", "0.47829452", "0.477999", "0.4776353", "0.47760895", "0.47752506", "0.47742933", "0.47702393", "0.47589365", "0.47559205", "0.4747116", "0.47469044", "0.47448215", "0.47325483", "0.4725974", "0.47208467", "0.47201958", "0.4718788", "0.47186714", "0.47125617", "0.4710377", "0.470968", "0.4709474", "0.47088873", "0.47054276", "0.4702825", "0.46987978", "0.4695994", "0.46955833", "0.4688246", "0.4686615", "0.46801066", "0.4674314", "0.46572384", "0.46570864", "0.46478516", "0.46476874", "0.4647084", "0.46464705", "0.46437952", "0.46418616", "0.46395755" ]
0.81617534
0
CleanupSessionKeys implemented in memory.
func (ms *MemStore) CleanupSessionKeys(t uint64) error { var oldKeys []string for hash, sk := range ms.sessionKeys { if sk.cleanupTime < t { oldKeys = append(oldKeys, hash) } } for _, hash := range oldKeys { delete(ms.sessionKeys, hash) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func SessionCleanup() {\n\tfor {\n\t\tselect {\n\t\tcase <-time.After(SessionManager.SessionCleanupTime * time.Minute):\n\t\t\tSessionManager.ReqSessionMem <- 1 // ask to access the shared mem, blocks until granted\n\t\t\t<-SessionManager.ReqSessionMemAck // make sure we got it\n\t\t\tss := make(map[string]*Session, 0) // here's the new Session list\n\t\t\tn := 0 // total number removed\n\t\t\tfor k, v := range Sessions { // look at every Session\n\t\t\t\tif time.Now().After(v.Expire) { // if it's still active...\n\t\t\t\t\tn++ // removed another\n\t\t\t\t} else {\n\t\t\t\t\tss[k] = v // ...copy it to the new list\n\t\t\t\t}\n\t\t\t}\n\t\t\tSessions = ss // set the new list\n\t\t\tSessionManager.ReqSessionMemAck <- 1 // tell SessionDispatcher we're done with the data\n\t\t\t//fmt.Printf(\"SessionCleanup completed. %d removed. Current Session list size = %d\\n\", n, len(Sessions))\n\t\t}\n\t}\n}", "func (b *BaseHandler) CleanSession() {\n\tb.sessionStore.Clean(b)\n}", "func (u *CryptohomeClient) CleanupSession(ctx context.Context, authSessionID string) error {\n\t// Kill the AuthSession.\n\tif _, err := u.binary.invalidateAuthSession(ctx, authSessionID); err != nil {\n\t\treturn errors.Wrap(err, \"failed to invaldiate AuthSession\")\n\t}\n\t// Clean up obsolete state, in case there's any.\n\tif err := u.UnmountAll(ctx); err != nil {\n\t\treturn errors.Wrap(err, \"failed to unmount vaults for cleanup\")\n\t}\n\treturn nil\n}", "func (sess Session) Clear() {\n\tfor k, _ := range sess {\n\t\tdelete(sess, k)\n\t}\n}", "func (m *MemoryStorer) Clean() {\n\tt := time.Now().UTC()\n\tm.mut.Lock()\n\tfor id, session := range m.sessions {\n\t\tif t.After(session.expires) {\n\t\t\tdelete(m.sessions, id)\n\t\t}\n\t}\n\tm.mut.Unlock()\n}", "func PurgeSessions() {\n\tsessions.Lock()\n\tdefer sessions.Unlock()\n\n\t// Update all sessions in the database.\n\tfor id, session := range sessions.sessions {\n\t\tPersistence.SaveSession(id, session)\n\t\t// We only do this to update the last access time. Errors are not that\n\t\t// bad.\n\t}\n\n\tsessions.sessions = make(map[string]*Session, MaxSessionCacheSize)\n}", "func (this *SessionStorage) StopClearingSessions() {\n this.done<-true\n}", "func (r *Redis) Cleanup() {\n\tos.RemoveAll(\"/tmp/go-harness\")\n}", "func CleanupSessions(path string, age time.Duration) error {\n\tfsMutex.Lock()\n\tdefer fsMutex.Unlock()\n\n\tfiles, err := ioutil.ReadDir(path)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, fi := range files {\n\t\tif age > 0 {\n\t\t\tmin := time.Now().Add(-age).UnixNano()\n\t\t\tif fi.ModTime().UnixNano() >= min {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif err := os.Remove(filepath.Join(path, fi.Name())); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (s *CacheLastPasswordSent) cleanup() {\n\ttickEvery := time.NewTicker(1 * time.Minute)\n\tdefer tickEvery.Stop()\n\n\tclearOutAfter := time.Duration(10 * time.Minute)\n\nLoop:\n\tfor {\n\t\tselect {\n\t\tcase <-s.stop:\n\t\t\tbreak Loop\n\t\tcase <-tickEvery.C:\n\t\t}\n\n\t\ts.mu.Lock()\n\t\tnow := time.Now().UTC()\n\t\tfor key, t := range s.data {\n\t\t\tif now.Sub(t) >= clearOutAfter {\n\t\t\t\tdelete(s.data, key)\n\t\t\t}\n\t\t}\n\t\ts.mu.Unlock()\n\t}\n}", "func (k *Keys) Clean() {\n\tif k != nil {\n\t\tif k.Admin != nil {\n\t\t\tk.Admin.Clean()\n\t\t\tk.Admin = nil\n\t\t}\n\t\tif k.Server != nil {\n\t\t\tk.Server.Clean()\n\t\t\tk.Server = nil\n\t\t}\n\t\tk.Nonce = nil\n\t}\n}", "func (s *session) Clear() {\n\ts.mu.Lock()\n\tfor key := range s.values {\n\t\tdelete(s.values, key)\n\t}\n\ts.mu.Unlock()\n\ts.provider.update(s.sid)\n}", "func (c *ChallengeProvider) CleanUp(ctx context.Context, _ acme.Challenge) error {\n\tfor _, s := range c.servers {\n\t\ts.PersonalKeyAuth = \"\"\n\t}\n\treturn nil\n}", "func (s *Sessions) CleanExpired() {\n\tsessForKill := []string{}\n\n\ts.RLock()\n\tfor k, v := range s.sessions {\n\t\t// if time.Now().Unix()-v.LastActivity >= int64(cfg.SessionLifeTime) {\n\t\t// \tdelete(s.sessions, k)\n\t\t// }\n\t\tif time.Now().After(time.Unix(v.LastActivity, 0).Add(time.Duration(cfg.SessionLifeTime) * time.Second)) {\n\t\t\tsessForKill = append(sessForKill, k)\n\t\t}\n\t}\n\ts.RUnlock()\n\n\tfor _, sessID := range sessForKill {\n\t\ts.DelByID(sessID)\n\t}\n}", "func (manager *KeysManager) Clear() {\n\tmanager.KeyList = make([]*jose.JSONWebKey, 0)\n\tmanager.KeyMap = make(map[string]*jose.JSONWebKey)\n}", "func (ConsumerGroupHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }", "func (s *s6aProxy) cleanupSession(sid string) chan interface{} {\n\ts.sessionsMu.Lock()\n\toldCh, ok := s.sessions[sid]\n\tif ok {\n\t\tdelete(s.sessions, sid)\n\t\ts.sessionsMu.Unlock()\n\t\tif oldCh != nil {\n\t\t\tclose(oldCh)\n\t\t}\n\t\treturn oldCh\n\t}\n\ts.sessionsMu.Unlock()\n\treturn nil\n}", "func (s *session) DeleteAll() {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\n\ts.values = SessionValues{}\n}", "func (mp *Provider) GC() {\n\tfor _, kv := range mp.memoryDB.D {\n\t\tstore := kv.Value.(*Store)\n\t\texpiration := store.GetExpiration()\n\t\t// Do not expire the session if expiration is set to 0\n\t\tif expiration == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tif time.Now().Unix() >= (store.lastActiveTime + int64(expiration)) {\n\t\t\tmp.Destroy(kv.Key)\n\t\t}\n\t}\n}", "func (p *Kafka) Cleanup(sarama.ConsumerGroupSession) error {\n\treturn nil\n}", "func (d *Abstraction) CloseSession() {\n\tfor k, v := range d.Sigmap {\n\t\tdelete(d.Sigmap, k)\n\t\tclose(v)\n\t}\n\td.Conn.RemoveSignal(d.Recv)\n\td.Conn.Close()\n}", "func (pdr *ProviderMySQL) SessionGC() {\n\tc := pdr.connectInit()\n\tdefer func() {\n\t\terr := c.Close()\n\t\tif err != nil {\n\t\t\tsession.SLogger.Println(err)\n\t\t}\n\t}()\n\n\t_, err := c.Exec(\"DELETE from \"+TableName+\" where session_expiry < ?\", time.Now().Unix()-pdr.lifetime)\n\tif err != nil {\n\t\tsession.SLogger.Println(err)\n\t}\n}", "func cleanup() {\n\tserver.Applications = []*types.ApplicationMetadata{}\n}", "func (ks *MemoryStore) RemoveAll() (err error) {\n\n\tfor key := range ks.Keys {\n\t\tdelete(ks.Keys, key)\n\t}\n\n\treturn\n}", "func (pp *Provider) GC() {\n\tpp.sessionDao.deleteSessionByMaxLifeTime(pp.maxLifeTime)\n}", "func (this *SessionStorage) StartClearingSessions() {\n go func() {\n for {\n select {\n case <-this.done:\n break\n default:\n this.cleanUp()\n time.Sleep(this.config.ClearInterval)\n }\n }\n }()\n}", "func (m *SqliteStore) cleanup(sessionName string, interval time.Duration, quit <-chan struct{}, done chan<- struct{}) {\n\tticker := time.NewTicker(interval)\n\n\tdefer func() {\n\t\tticker.Stop()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase <-quit:\n\t\t\t// Handle the quit signal.\n\t\t\tdone <- struct{}{}\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t\t// Delete expired sessions on each tick.\n\t\t\terr := m.deleteExpiredSessions(sessionName)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Unable to delete expired sessions: \", err.Error())\n\t\t\t}\n\t\t}\n\t}\n}", "func SessionDeleteAll() (err error) {\n\t_, err = Db.Exec(\"DELETE FROM sessions\")\n\treturn\n}", "func RemoveSessions() {\n\tus := models.UserSession{}\n\tc := dbSession.Find(bson.M{}).Iter()\n\tfor c.Next(&us) {\n\t\tif time.Now().Sub(us.CreatedAt).Seconds() >= 3600 {\n\t\t\tdbSession.Remove(struct{ UUID string }{UUID: string(us.UUID)})\n\t\t\tfmt.Println(\"dropping sessions...\")\n\t\t}\n\t}\n\tif err := c.Close(); err != nil {\n\t\tfmt.Println(\"Iterations completed\")\n\t\treturn\n\t}\n\tfmt.Println(\"Closed successfully\")\n}", "func Cleanup() {\n\tif pkcs11Ctx != nil {\n\t\tcommon.FinalizeAndDestroy(pkcs11Ctx)\n\t\tpkcs11Ctx = nil\n\t}\n}", "func (consumer *KafkaConsumer) Cleanup(sarama.ConsumerGroupSession) error {\n\tlog.Info().Msg(\"new session has been finished\")\n\treturn nil\n}", "func (authSvc *AuthService) clearAllSessions() {\n\tauthSvc.Sessions = make(map[string]*apitypes.Credentials)\n}", "func (hc *httpContext) clearSession() {\n\tsession := hc.getSession()\n\tif session == nil {\n\t\treturn\n\t}\n\n\tsession.Values[sv[\"provider\"]] = nil\n\tsession.Values[sv[\"name\"]] = nil\n\tsession.Values[sv[\"email\"]] = nil\n\tsession.Values[sv[\"user\"]] = nil\n\tsession.Values[sv[\"token\"]] = nil\n\n\thc.saveSession(session)\n}", "func (m *memoryStorage) sessionChecker() {\n\tfor {\n\t\tm.mutex.Lock()\n\t\tfor sessionID, v := range m.sessions {\n\t\t\tif v.expires < time.Now().Unix() {\n\t\t\t\tdelete(m.sessions, sessionID)\n\t\t\t}\n\t\t}\n\t\tfor nonce, expires := range m.nonces {\n\t\t\tif time.Now().After(expires) {\n\t\t\t\tdelete(m.nonces, nonce)\n\t\t\t}\n\t\t}\n\t\tm.mutex.Unlock()\n\t\ttime.Sleep(sessionCheckInterval * time.Second)\n\t}\n}", "func (rndr *Renderer) idleNATSessionCleanup() {\n\t// run only if requested\n\tif !rndr.Config.CleanupIdleNATSessions {\n\t\treturn\n\t}\n\n\ttcpTimeout := time.Duration(rndr.Config.TCPNATSessionTimeout) * time.Minute\n\totherTimeout := time.Duration(rndr.Config.OtherNATSessionTimeout) * time.Minute\n\tif tcpTimeout == 0 {\n\t\ttcpTimeout = defaultIdleTCPTimeout\n\t}\n\tif otherTimeout == 0 {\n\t\totherTimeout = defaultIdleOtherTimeout\n\t}\n\n\trndr.Log.Infof(\"NAT session cleanup enabled, TCP timeout=%v, other timeout=%v.\", tcpTimeout, otherTimeout)\n\n\t// register gauges\n\trndr.Stats.RegisterGaugeFunc(\"tcpNatSessions\", \"Total count of TCP NAT sessions\", tcpNatSessionsGauge)\n\trndr.Stats.RegisterGaugeFunc(\"otherNatSessions\", \"Total count of non-TCP NAT sessions\", otherNatSessionsGauge)\n\trndr.Stats.RegisterGaugeFunc(\"deletedTCPNatSessions\", \"Total count of deleted TCP NAT sessions\", deletedTCPNatSessionsGauge)\n\trndr.Stats.RegisterGaugeFunc(\"deletedOtherNatSessions\", \"Total count of deleted non-TCP NAT sessions\", deletedOtherNatSessionsGauge)\n\trndr.Stats.RegisterGaugeFunc(\"natSessionDeleteErrors\", \"Count of errors by NAT session delete\", natSessionDeleteErrorsGauge)\n\n\t// VPP counts the time from 0 since its start. Let's assume it is now\n\t// (it shouldn't be more than few seconds since its start).\n\tzeroTime := time.Now()\n\n\tfor {\n\t\t<-time.After(otherTimeout)\n\n\t\trndr.Log.Debugf(\"NAT session cleanup started.\")\n\n\t\tnatUsers := make([]*nat_api.Nat44UserDetails, 0)\n\t\tdelRules := make([]*nat_api.Nat44DelSession, 0)\n\t\tvar tcpCount uint64\n\t\tvar otherCount uint64\n\n\t\t// dump NAT users\n\t\treq1 := &nat_api.Nat44UserDump{}\n\t\treqCtx1 := rndr.GoVPPChan.SendMultiRequest(req1)\n\t\tfor {\n\t\t\tmsg := &nat_api.Nat44UserDetails{}\n\t\t\tstop, err := reqCtx1.ReceiveReply(msg)\n\t\t\tif stop {\n\t\t\t\tbreak // break out of the loop\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\trndr.Log.Errorf(\"Error by dumping NAT users: %v\", err)\n\t\t\t}\n\t\t\tnatUsers = append(natUsers, msg)\n\t\t}\n\n\t\t// dump NAT sessions per user\n\t\tfor _, natUser := range natUsers {\n\t\t\treq2 := &nat_api.Nat44UserSessionDump{\n\t\t\t\tIPAddress: natUser.IPAddress,\n\t\t\t\tVrfID: natUser.VrfID,\n\t\t\t}\n\t\t\treqCtx2 := rndr.GoVPPChan.SendMultiRequest(req2)\n\n\t\t\tfor {\n\t\t\t\tmsg := &nat_api.Nat44UserSessionDetails{}\n\t\t\t\tstop, err := reqCtx2.ReceiveReply(msg)\n\t\t\t\tif stop {\n\t\t\t\t\tbreak // break out of the loop\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\trndr.Log.Errorf(\"Error by dumping NAT sessions: %v\", err)\n\t\t\t\t}\n\t\t\t\tif msg.Protocol == 6 {\n\t\t\t\t\ttcpCount++\n\t\t\t\t} else {\n\t\t\t\t\totherCount++\n\t\t\t\t}\n\n\t\t\t\tlastHeard := zeroTime.Add(time.Duration(msg.LastHeard) * time.Second)\n\t\t\t\tif lastHeard.Before(time.Now()) {\n\t\t\t\t\tif (msg.Protocol == 6 && time.Since(lastHeard) > tcpTimeout) ||\n\t\t\t\t\t\t(msg.Protocol != 6 && time.Since(lastHeard) > otherTimeout) {\n\t\t\t\t\t\t// inactive session\n\t\t\t\t\t\tdelRule := &nat_api.Nat44DelSession{\n\t\t\t\t\t\t\tIsIn: 1,\n\t\t\t\t\t\t\tAddress: msg.InsideIPAddress,\n\t\t\t\t\t\t\tPort: msg.InsidePort,\n\t\t\t\t\t\t\tProtocol: uint8(msg.Protocol),\n\t\t\t\t\t\t\tVrfID: natUser.VrfID,\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif msg.ExtHostValid > 0 {\n\t\t\t\t\t\t\tdelRule.ExtHostValid = 1\n\n\t\t\t\t\t\t\tif msg.IsTwicenat > 0 {\n\t\t\t\t\t\t\t\tdelRule.ExtHostAddress = msg.ExtHostNatAddress\n\t\t\t\t\t\t\t\tdelRule.ExtHostPort = msg.ExtHostNatPort\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdelRule.ExtHostAddress = msg.ExtHostAddress\n\t\t\t\t\t\t\t\tdelRule.ExtHostPort = msg.ExtHostPort\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdelRules = append(delRules, delRule)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\trndr.Log.Debugf(\"There are %d TCP / %d other NAT sessions, %d will be deleted\", tcpCount, otherCount, len(delRules))\n\t\tatomic.StoreUint64(&tcpNatSessionCount, tcpCount)\n\t\tatomic.StoreUint64(&otherNatSessionCount, otherCount)\n\n\t\t// delete the old sessions\n\t\tfor _, r := range delRules {\n\t\t\tmsg := &nat_api.Nat44DelSessionReply{}\n\t\t\terr := rndr.GoVPPChan.SendRequest(r).ReceiveReply(msg)\n\t\t\tif err != nil || msg.Retval != 0 {\n\t\t\t\trndr.Log.Warnf(\"Error by deleting NAT session: %v, retval=%d, req: %v\", err, msg.Retval, r)\n\t\t\t\tatomic.AddUint64(&natSessionDeleteErrorCount, 1)\n\t\t\t} else {\n\t\t\t\tif r.Protocol == 6 {\n\t\t\t\t\tatomic.AddUint64(&deletedTCPNatSessionCount, 1)\n\t\t\t\t\tatomic.StoreUint64(&tcpNatSessionCount, atomic.LoadUint64(&tcpNatSessionCount)-1)\n\t\t\t\t} else {\n\t\t\t\t\tatomic.AddUint64(&deletedOtherNatSessionCount, 1)\n\t\t\t\t\tatomic.StoreUint64(&otherNatSessionCount, atomic.LoadUint64(&otherNatSessionCount)-1)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (s *SessionManager) UpdateSessionKeys(authKey, cryptKey []byte) {\n\ts.Store = sessions.NewCookieStore(authKey, cryptKey)\n}", "func cleanup() {\n\tlog.Verbose(\"Cleaning up sensitive and temp files\")\n\tif _, err := os.Stat(\"ca.crt\"); err == nil {\n\t\tdeleteFile(\"ca.crt\")\n\t}\n\n\tif _, err := os.Stat(\"ca.key\"); err == nil {\n\t\tdeleteFile(\"ca.key\")\n\t}\n\n\tif _, err := os.Stat(\"client.crt\"); err == nil {\n\t\tdeleteFile(\"client.crt\")\n\t}\n\n\tif _, err := os.Stat(\"bearer.token\"); err == nil {\n\t\tdeleteFile(\"bearer.token\")\n\t}\n\n\tfor _, app := range s.Apps {\n\t\tif _, err := os.Stat(app.SecretsFile + \".dec\"); err == nil {\n\t\t\tdeleteFile(app.SecretsFile + \".dec\")\n\t\t}\n\t\tfor _, secret := range app.SecretsFiles {\n\t\t\tif _, err := os.Stat(secret + \".dec\"); err == nil {\n\t\t\t\tdeleteFile(secret + \".dec\")\n\t\t\t}\n\t\t}\n\t}\n\n}", "func (h *ConsumerGroupHandler) Cleanup(sarama.ConsumerGroupSession) error {\n\treturn nil\n}", "func delayUnregister(session *model.Session) {\n\ttime.Sleep(time.Second * 5)\n\t//TODO do something better perhaps a seperate queue for the messages that will be deleted.\n\tdefer mutex.Unlock()\n\tmutex.Lock()\n\n\tdelete(tokenAvailable, session.SessionToken)\n\tdelete(sessionCache, session.SocketID)\n\tdelete(userCache, session.UserID)\n\tmodel.DB().Delete(session) //Remove the session\n\n}", "func (c *Cache) cleanup(ttl time.Duration) {\n\tvalids := map[string]*cacheEntry{}\n\tnow := time.Now()\n\tfor token, entry := range c.entries {\n\t\tif entry.jwt.IsValid(c.leeway) {\n\t\t\tif entry.accessed.Add(ttl).After(now) {\n\t\t\t\t// Everything fine.\n\t\t\t\tvalids[token] = entry\n\t\t\t}\n\t\t}\n\t}\n\tc.entries = valids\n}", "func (rp *Provider) SessionGC(ctx context.Context) {\n}", "func (c *Cache) CleanupExpired() {\n\tgo func() {\n\t\tfor {\n\t\t\tfor k, v := range c.Map {\n\t\t\t\tif v.RegTime.Add(time.Minute * 1).Before(time.Now()) {\n\t\t\t\t\tc.Remove(k)\n\t\t\t\t}\n\t\t\t}\n\t\t\ttime.Sleep(time.Second * 10)\n\t\t}\n\t}()\n}", "func (ch MqtConsumerGroupHandler) Cleanup(session sarama.ConsumerGroupSession) error {\n\tch.logger.With(\n\t\tzap.String(\"trigger\", ch.trigger.ObjectMeta.Name),\n\t\tzap.String(\"topic\", ch.trigger.Spec.Topic),\n\t\tzap.String(\"memberID\", session.MemberID()),\n\t\tzap.Int32(\"generationID\", session.GenerationID()),\n\t\tzap.String(\"claims\", fmt.Sprintf(\"%v\", session.Claims())),\n\t).Info(\"consumer group session cleanup\")\n\treturn nil\n}", "func (sess Session) Del(key string) {\n\tdelete(sess, key)\n}", "func DeleteAllOtherSessionsForUser(ctx context.Context, userID, keepSessionID int64) error {\r\n\tq := datastore.NewQuery(SessionTable).Filter(\"UserID =\", userID).KeysOnly()\r\n\tit := q.Run(ctx)\r\n\tfor {\r\n\t\tkey, err := it.Next(nil)\r\n\t\tif err == datastore.Done {\r\n\t\t\tbreak\r\n\t\t} else if err != nil {\r\n\t\t\treturn err\r\n\t\t}\r\n\t\tif key.IntID() != keepSessionID {\r\n\t\t\tretrievable.DeleteEntity(ctx, key)\r\n\t\t}\r\n\t}\r\n\treturn nil\r\n}", "func (pm partitionMap) cleanup() {\n\tfor ns, partitions := range pm {\n\t\tfor i := range partitions.Replicas {\n\t\t\tfor j := range partitions.Replicas[i] {\n\t\t\t\tpartitions.Replicas[i][j] = nil\n\t\t\t}\n\t\t\tpartitions.Replicas[i] = nil\n\t\t}\n\n\t\tpartitions.Replicas = nil\n\t\tpartitions.regimes = nil\n\n\t\tdelete(pm, ns)\n\t}\n}", "func (p *PostgresProvider) GC() {\n\tif _, err := p.c.Exec(\"DELETE FROM session WHERE EXTRACT(EPOCH FROM NOW()) - expiry > $1\", p.maxlifetime); err != nil {\n\t\tlog.Printf(\"session/postgres: error garbage collecting: %v\", err)\n\t}\n}", "func (a *LocalKeyAgent) UnloadKeys() error {\n\tagents := []agent.Agent{a.Agent}\n\tif a.sshAgent != nil {\n\t\tagents = append(agents, a.sshAgent)\n\t}\n\n\t// iterate over all agents we have\n\tfor _, agent := range agents {\n\t\t// get a list of all keys in the agent\n\t\tkeyList, err := agent.List()\n\t\tif err != nil {\n\t\t\ta.log.Warnf(\"Unable to communicate with agent and list keys: %v\", err)\n\t\t}\n\n\t\t// remove any teleport keys we currently have loaded in the agent\n\t\tfor _, key := range keyList {\n\t\t\tif strings.HasPrefix(key.Comment, \"teleport:\") {\n\t\t\t\terr = agent.Remove(key)\n\t\t\t\tif err != nil {\n\t\t\t\t\ta.log.Warnf(\"Unable to communicate with agent and remove key: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (session *Session) DestroyAllKeys() error {\n\tif session == nil || session.Ctx == nil {\n\t\treturn fmt.Errorf(\"session not initialized\")\n\t}\n\tdeleteTemplate := []*pkcs11.Attribute{\n\t\t//NewAttribute(CKA_KEY_TYPE, CKK_RSA),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_LABEL, session.Label),\n\t}\n\tobjects, err := session.FindObject(deleteTemplate)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(objects) > 0 {\n\t\tsession.Log.Printf(\"Keys found. Deleting...\\n\")\n\t\tfoundDeleteTemplate := []*pkcs11.Attribute{\n\t\t\tpkcs11.NewAttribute(pkcs11.CKA_LABEL, nil),\n\t\t\tpkcs11.NewAttribute(pkcs11.CKA_ID, nil),\n\t\t\tpkcs11.NewAttribute(pkcs11.CKA_CLASS, nil),\n\t\t}\n\n\t\tfor _, object := range objects {\n\t\t\tattr, _ := session.Ctx.GetAttributeValue(session.Handle, object, foundDeleteTemplate)\n\t\t\tclass := \"unknown\"\n\t\t\tif uint(attr[2].Value[0]) == pkcs11.CKO_PUBLIC_KEY {\n\t\t\t\tclass = \"public\"\n\t\t\t} else if uint(attr[2].Value[0]) == pkcs11.CKO_PRIVATE_KEY {\n\t\t\t\tclass = \"private\"\n\t\t\t}\n\t\t\tsession.Log.Printf(\"Deleting key with label=%s, id=%s and type=%s\\n\", string(attr[0].Value), string(attr[1].Value), class)\n\n\t\t\tif e := session.Ctx.DestroyObject(session.Handle, object); e != nil {\n\t\t\t\tsession.Log.Printf(\"Destroy Key failed %s\\n\", e)\n\t\t\t}\n\t\t}\n\t} else {\n\t\treturn fmt.Errorf(\"no keys found\")\n\t}\n\treturn nil\n}", "func (h *consumerHandlerImpl) Cleanup(sarama.ConsumerGroupSession) error {\n\treturn nil\n}", "func ClearSessionAPIKey(session *sessions.Session) {\n\tsessionClear(session, sessionKeyAPIKey)\n}", "func (mgr *MemorySessionManager) GarbageCollection() {\n\tfor k, v := range mgr.sessions {\n\t\tif v.isExpired() {\n\t\t\tdelete(mgr.sessions, k)\n\t\t}\n\t}\n\ttime.AfterFunc(time.Duration(gcTimeInterval)*time.Second, mgr.GarbageCollection)\n}", "func (s ec2sessions) DeleteExpiredInstances() {\n\tfor _, session := range s.sessions {\n\t\tsession.deleteExpiredInstances()\n\t}\n}", "func garbageCleaner() {\n\tfor _ = range time.Tick(1 * time.Minute) {\n\t\tstorage.Cleanup()\n\t}\n}", "func (handlerMapConsumerGroupHandler) Cleanup(_ sarama.ConsumerGroupSession) error {\n\treturn nil\n}", "func (*ConsumerGroupHandler) Cleanup(_ sarama.ConsumerGroupSession) error {\n\tlog.Infof(\"ConsumerGroupHandler.Cleanup() - start\")\n\tdefer log.Infof(\"ConsumerGroupHandler.Cleanup() - end\")\n\n\treturn nil\n}", "func (s PgTokenStore) Cleanup() *model.AppErr {\n\tif _, err := s.db.Exec(\"DELETE FROM public.token\"); err != nil {\n\t\treturn model.NewAppErr(\"PgTokenStore.Cleanup\", model.ErrInternal, locale.GetUserLocalizer(\"en\"), msgCleanup, http.StatusInternalServerError, nil)\n\t}\n\treturn nil\n}", "func cleanSessionsHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params, session *SessionData) {\n\tsessions.CleanSessions()\n\thttp.Redirect(w, req, \"/\", http.StatusSeeOther)\n}", "func (privKey *YubiHsmPrivateKey) UnloadYubiHsmPrivKey() {\n\tif privKey.sessionMgr == nil {\n\t\treturn\n\t}\n\tprivKey.sessionMgr.Destroy()\n}", "func maintainer() {\n\tconst SESSION_TIME_LIMIT = 3600 // seconds\n\n\tfor {\n\t\ttime.Sleep(5 * time.Second)\n\t\tnow := timestamp()\n\n\t\t/* user challenges */\n\t\tfor key, user_challenge := range global_user_challenges {\n\t\t\tif now > user_challenge.expire_timestamp {\n\t\t\t\tdelete(global_user_challenges, key)\n\t\t\t}\n\t\t}\n\n\t\t/* sessions */\n\t\tfor key, user_session := range global_user_sessions {\n\t\t\tif now > user_session.lastcheck_timestamp+SESSION_TIME_LIMIT {\n\t\t\t\tdelete(global_user_sessions, key)\n\t\t\t}\n\t\t}\n\t}\n}", "func SessionGC() {\n\t// Lock and defer unlock of session map\n\tSessionMapLock.Lock()\n\tdefer SessionMapLock.Unlock()\n\n\tlogging.Debug(&map[string]string{\n\t\t\"file\": \"session.go\",\n\t\t\"Function\": \"SessionGC\",\n\t\t\"event\": \"Run garbage collector job\",\n\t})\n\n\t// Destory session if last access older than configured session lifetime\n\tfor SID, value := range SessionMap {\n\t\tif value.TimeAccessed.Add(time.Duration(config.SessionLifetime)*time.Minute).Unix() <= time.Now().Unix() {\n\t\t\tSessionDestroy(SID)\n\t\t}\n\t}\n\n\t// Wait one minute to repeat job\n\ttime.AfterFunc(time.Duration(config.SessionLifetime+1)*time.Minute, func() { SessionGC() })\n}", "func (s *Session) Reset() {\n\n\ts.root.SetAPIKey(\"\")\n\n\tcurrentSession = nil\n}", "func ClearSavedSitemaps() {\n\tsavedSitemaps = []string{}\n}", "func Unsetenv(key string) error", "func (sta StandardAuthenticator) DestroySession(sessionId string) error {\n\treturn nil\n}", "func (dc *dc) Cleanup(session sarama.ConsumerGroupSession) error {\n\treturn nil\n}", "func (*adminCtrl) cleanSessionByID(c *elton.Context) (err error) {\n\tstore := cache.GetRedisSession()\n\terr = store.Destroy(c.Param(\"id\"))\n\tif err != nil {\n\t\treturn\n\t}\n\tc.NoContent()\n\treturn\n}", "func (p *MongodbProvider) GC() {\n\tdiff := time.Now().Unix() - p.expire\n\t_, err := p.c.RemoveAll(bson.M{\"expiry\": bson.M{\"$lt\": diff}})\n\tif err != nil {\n\t\tlog.Printf(\"session/mgoSession: error garbage collecting: %v\", err)\n\t}\n}", "func (t *DRMAATracker) DestroySession() error {\n\treturn t.session.Exit()\n}", "func deleteAllSessions(clientset kubernetes.Interface, namespace string) {\n\tsessionSecret := &corev1.Secret{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: \"v1\",\n\t\t\tKind: \"Secret\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: util.SessionsSecretName,\n\t\t\tNamespace: namespace,\n\t\t\tLabels: types.GetKotsadmLabels(),\n\t\t},\n\t\tData: map[string][]byte{},\n\t}\n\n\t_, err := clientset.CoreV1().Secrets(namespace).Update(context.TODO(), sessionSecret, metav1.UpdateOptions{})\n\tif err != nil {\n\t\t// as the password is already changed, log the error but don't fail (false positive case)\n\t\tlogger.Errorf(\"failed to delete all sessions: %s\", namespace, util.SessionsSecretName, err)\n\t}\n}", "func (c *Core) teardownPolicyStore() error {\n\tc.policyStore = nil\n\treturn nil\n}", "func (o *VirtualSessionProvider) GC() {\n\to.provider.GC()\n}", "func CleanupMongoSession() {\n\tif mongo == nil {\n\t\treturn\n\t}\n\tmongo.Close()\n\ttime.Sleep(time.Second)\n\n\tmongo = nil\n}", "func ClearSessions(db AutoscopeDB, duration int64) error {\n\t//TODO\n\treturn nil\n}", "func (db *PgDB) initTaskSessions() error {\n\t_, err := db.sql.Exec(\"DELETE FROM task_sessions\")\n\treturn err\n}", "func cleanExit(code int) {\n\tif *verbose {\n\t\tfmt.Println(\"Cleaning up private keys\")\n\t}\n\tfor k := range keys {\n\t\tsys.ClearBuffer(keys[k].Key)\n\t}\n\tif type2_secret != nil {\n\t\tsys.ClearBuffer(type2_secret)\n\t}\n\tos.Exit(code)\n}", "func AppStateCleanup(instanceName string) {\n\tmongo.DeleteInstance(types.M{\n\t\tmongo.NameKey: instanceName,\n\t\tmongo.InstanceTypeKey: mongo.AppInstance,\n\t})\n\tredis.RemoveApp(instanceName)\n}", "func (m *MemoryStorer) Del(key string) error {\n\tm.mut.Lock()\n\tdelete(m.sessions, key)\n\tm.mut.Unlock()\n\n\treturn nil\n}", "func (m *mapper) cleanup() {\n\tlevel.Info(m.logger).Log(\"msg\", \"cleaning up mapped rules directory\", \"path\", m.Path)\n\n\tusers, err := m.users()\n\tif err != nil {\n\t\tlevel.Error(m.logger).Log(\"msg\", \"unable to read rules directory\", \"path\", m.Path, \"err\", err)\n\t\treturn\n\t}\n\n\tfor _, u := range users {\n\t\tm.cleanupUser(u)\n\t}\n}", "func cleanSSHKeyPaths() error {\n\toldKeyExists, err := fileExists(constants.RHCOS8SSHKeyPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !oldKeyExists {\n\t\treturn nil\n\t}\n\n\tif err := os.RemoveAll(constants.RHCOS8SSHKeyPath); err != nil {\n\t\treturn fmt.Errorf(\"failed to remove path '%s': %w\", constants.RHCOS8SSHKeyPath, err)\n\t}\n\n\treturn nil\n}", "func (b *BoltAuthRepository) CleanUp() {\n\tb.db.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(b.bucket))\n\t\tc := b.Cursor()\n\t\tvar toDelete [][]byte\n\t\tfor k, v := c.First(); k != nil; k, v = c.Next() {\n\t\t\tvar tkn models.Token\n\t\t\tif json.Unmarshal(v, &tkn) != nil {\n\t\t\t\t// Prevents password from being cleaned with tokens.\n\t\t\t\t//\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfmt.Printf(\"key=%s, value=%s\\n\", k, tkn.Expires)\n\t\t\tif tkn.Expires.Before(time.Now()) {\n\t\t\t\ttoDelete = append(toDelete, k)\n\t\t\t}\n\t\t}\n\t\tfor _, key := range toDelete {\n\t\t\tb.Delete(key)\n\t\t}\n\t\treturn nil\n\t})\n}", "func (ms *MemStore) DelPrivSessionKey(hash string) error {\n\tsk, ok := ms.sessionKeys[hash]\n\tif !ok {\n\t\treturn nil\n\t}\n\tsk.privKey = \"\"\n\treturn nil\n}", "func Clean(sessions []session) []session {\n\tlist := make([]session, 0)\n\tfor _, s := range sessions {\n\t\tif s.Alive() {\n\t\t\tlist = append(list, s)\n\t\t}\n\t}\n\treturn list\n}", "func CleanupTestHarness() {\n\tcleanupCerts()\n}", "func (manager *SessionManager) GC() {\n\tmanager.provider.SessionGC()\n\ttime.AfterFunc(time.Duration(manager.config.GcLifetime)*time.Second, func() { manager.GC() })\n}", "func (tk *memSessionTokenKeeper) Clear() {\n\ttk.mutex.Lock()\n\tdefer tk.mutex.Unlock()\n\ttk.userTokens = make(map[string]string)\n}", "func (be *s3) removeKeys(t backend.Type) error {\n\tdone := make(chan struct{})\n\tdefer close(done)\n\tfor key := range be.List(backend.Data, done) {\n\t\terr := be.Remove(backend.Data, key)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (s *SessionStore) Delete() {\n\ts.session.Options.MaxAge = -1\n}", "func RemoveSession(ctxid int64) {\n\tdelete(sessionBuf, ctxid)\n}", "func (d *Daemon) Cleanup() error {\n\tif d.backend != nil {\n\t\td.backend.deleteAllStatus()\n\t}\n\tif err := os.Remove(util.DefaultRSAKeyPath); err != nil {\n\t\tlogrus.Info(\"Delete key failed\")\n\t}\n\td.deleteAllBuilders()\n\td.localStore.CleanContainers()\n\t_, err := d.localStore.Shutdown(false)\n\treturn err\n}", "func (ds *DictService) GC() {\n\tfor _, dict := range ds.dicts {\n\t\tdict.MDXHandler.Destroy()\n\t\tfor _, mdd := range dict.MDDHandler {\n\t\t\tmdd.Destroy()\n\t\t}\n\t}\n}", "func (r *SmscSessionRepository) DeleteAll() error {\n\tids := make([]string, 0)\n\terr := app.BuntDBInMemory.View(func(tx *buntdb.Tx) error {\n\t\treturn tx.Ascend(SMSC_SESSION_PREFIX, func(key, value string) bool {\n\t\t\tids = append(ids, key)\n\t\t\treturn true\n\t\t})\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn app.BuntDBInMemory.Update(func(tx *buntdb.Tx) error {\n\t\tfor _, id := range ids {\n\t\t\t_, err := tx.Delete(id)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n}", "func destroy() {\n\tif unique.natsconn != nil {\n\t\tunique.natsconn.Close()\n\t}\n\tfor _, dict := range unique.mdb {\n\t\tdict.Close()\n\t}\n\tunique = nil\n}", "func (ce *ColumnEncryptionProperties) WipeOutEncryptionKey() { ce.key = \"\" }", "func (session *SafeSession) Reset() {\n\tsession.mu.Lock()\n\tdefer session.mu.Unlock()\n\tsession.Session.InTransaction = false\n\tsession.ShardSessions = nil\n}", "func (sim *SessionInterestManager) RemoveSession(ses uint64) []cid.Cid {\n\tsim.lk.Lock()\n\tdefer sim.lk.Unlock()\n\n\t// The keys that no session is interested in\n\tdeletedKs := make([]cid.Cid, 0)\n\n\t// For each known key\n\tfor c := range sim.wants {\n\t\t// Remove the session from the list of sessions that want the key\n\t\tdelete(sim.wants[c], ses)\n\n\t\t// If there are no more sessions that want the key\n\t\tif len(sim.wants[c]) == 0 {\n\t\t\t// Clean up the list memory\n\t\t\tdelete(sim.wants, c)\n\t\t\t// Add the key to the list of keys that no session is interested in\n\t\t\tdeletedKs = append(deletedKs, c)\n\t\t}\n\t}\n\n\treturn deletedKs\n}", "func DeleteSession(session *Session) {\r\n\tsessionListMutex.Lock()\r\n\tdefer sessionListMutex.Unlock()\r\n\r\n\tdelete(sessionList, session.Key)\r\n\tfmt.Printf(\"Delete session %d\\n\", session.Key)\r\n}", "func (ctx *RequestContext) DestroySession() {\n\tctx.destroyingSession = true\n}", "func (m *Manager) Shutdown() error {\n\t// shutdown subscribers\n\tm.sessions.Range(func(k, v interface{}) bool {\n\t\twrap := v.(*container)\n\t\tif wrap.sub != nil {\n\t\t\tif err := m.persistSubscriber(wrap.sub); err != nil {\n\t\t\t\tm.log.Error(\"persist subscriber\", zap.Error(err))\n\t\t\t}\n\t\t}\n\n\t\tm.sessions.Delete(k)\n\n\t\treturn true\n\t})\n\n\treturn nil\n}", "func (s *session) garbageCollectStreams() {\n\ts.streamsMap.Iterate(func(str *stream) (bool, error) {\n\t\tid := str.StreamID()\n\t\tif str.finished() {\n\t\t\terr := s.streamsMap.RemoveStream(id)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\ts.flowControlManager.RemoveStream(id)\n\t\t}\n\t\treturn true, nil\n\t})\n}" ]
[ "0.7089904", "0.61599636", "0.58887005", "0.5850469", "0.57533306", "0.56555283", "0.5642214", "0.56363297", "0.5590619", "0.55601865", "0.55595326", "0.5538021", "0.551168", "0.5497634", "0.5470665", "0.544381", "0.54413", "0.5432986", "0.54288346", "0.53801996", "0.53740805", "0.53258777", "0.53130287", "0.53110874", "0.529426", "0.5278169", "0.52781314", "0.52572984", "0.52557045", "0.5254235", "0.52487403", "0.5238355", "0.5232748", "0.5227615", "0.5216114", "0.5213859", "0.521276", "0.52033186", "0.5188516", "0.51693773", "0.51692975", "0.5168888", "0.51677406", "0.5158241", "0.515257", "0.5150471", "0.5137512", "0.51348776", "0.51289994", "0.51205206", "0.5120366", "0.5108638", "0.51044184", "0.5102977", "0.5099875", "0.50935835", "0.5086133", "0.50860476", "0.50818557", "0.5077012", "0.50767", "0.5070421", "0.506289", "0.5054055", "0.5039262", "0.5037982", "0.5037133", "0.50270754", "0.5020278", "0.50201654", "0.5004508", "0.500187", "0.49974045", "0.49962422", "0.49815878", "0.49686915", "0.4966196", "0.495762", "0.49526203", "0.49445137", "0.49428514", "0.49380484", "0.4933382", "0.4926571", "0.4912662", "0.49083543", "0.49057826", "0.48994344", "0.488552", "0.4873043", "0.48723683", "0.4868872", "0.4866841", "0.48668194", "0.4857559", "0.48554885", "0.48534948", "0.48534098", "0.48402005", "0.48327613" ]
0.7981413
0
NewDatapoint creates a new Datapoint, inserts it to the database and returns it
func NewDatapoint(datasetID int64, imageURL string) (dp *Datapoint, err error) { var id int64 err = DB.QueryRow("INSERT INTO datapoint (dataset_id, image_url) VALUES ($1, $2) RETURNING id", datasetID, imageURL).Scan(&id) if err != nil { return // something went wrong! lets get out of here! } //blank space for readability dp = &Datapoint{ ID: id, DatasetID: datasetID, ImageURL: imageURL, } return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (db *PostgresDatapointRepo) CreateDatapoint(dp earthworks.Datapoint) (earthworks.Datapoint, error) {\n\tquery := `INSERT INTO datapoint (location) VALUES ($1) RETURNING id`\n\tcreated := earthworks.Datapoint{}\n\terr := db.Get(&created, query, wkt.MarshalString(dp.Location))\n\tif err != nil {\n\t\treturn earthworks.Datapoint{}, err\n\t}\n\n\treturn created, nil\n}", "func (ctrl *SensorController) CreateDatapoints(res http.ResponseWriter, req *http.Request) {\n\tsensorID := mux.Vars(req)[\"id\"]\n\tdatapoints := make([]model.Datapoint, 0)\n\tdec, _ := ioutil.ReadAll(req.Body)\n\terr := json.Unmarshal(dec, &datapoints)\n\n\t// save datapoints\n\tfor index := range datapoints {\n\t\tdatapoints[index].SensorID = bson.ObjectIdHex(sensorID)\n\t}\n\n\tdatapoints, err = model.BulkSaveDatapoints(ctrl.db, datapoints)\n\tif err != nil {\n\t\tctrl.r.JSON(res, http.StatusInternalServerError, err)\n\t\tlog.Fatal(err)\n\t}\n\n\tctrl.r.JSON(res, http.StatusCreated, datapoints)\n}", "func (a *Adapter) AddNewDataPoint(ma MetricAdapter, name string, tags map[string]string, fields map[string]interface{}, t time.Time) error {\n\tif a.Verbose {\n\t\tdumpDataPoint(name, tags, fields, t)\n\t}\n\treturn ma.AddDataPoint(name, tags, fields, t)\n}", "func NewDatapoint(data interface{}, points []float64) *Datapoint {\n\tif points == nil {\n\t\tpoints = []float64{}\n\t}\n\tf := make([]float64, len(points), len(points))\n\tcopy(f, points)\n\td := Datapoint{\n\t\tdata: data,\n\t\tset: f,\n\t}\n\treturn &d\n}", "func (dal *DataAccessLayer) CreateTimeSeriesDatum(tenantId int64, sensorId int64, value float64, timestamp int64) (*TimeSeriesDatum, error) {\n // Step 1: Generate SQL statement for creating a new `user` in `postgres`.\n statement := `INSERT INTO data (tenant_id, sensor_id, value, timestamp) VALUES ($1, $2, $3, $4)`\n\n // Step 2: Execute our SQL statement and either return our new user or\n // our error.\n _, err := dal.db.Exec(statement, tenantId, sensorId, value, timestamp)\n if err != nil {\n return nil, err\n }\n\n // Step 3:\n return dal.GetTimeSeriesDatumByTenantIdAndCreatedAt(tenantId, timestamp)\n}", "func (ts *Timeseries) AddNewPoint(v float64, x interface{}) error {\n\tts.Lock()\n\tdefer ts.Unlock() // unlocks at the end\n\n\tswitch T := x.(type) {\n\tcase int64:\n\t\tts.XY[T] = v\n\tcase time.Time:\n\t\tts.XY[T.UnixNano()] = v\n\tcase int:\n\t\tts.XY[int64(T)] = v\n\tdefault:\n\t\treturn fmt.Errorf(\"Adding point not possible\")\n\t}\n\n\treturn nil\n}", "func (self *Client) data(dataPoints models.DataPoints) {\n\tlog.WithFields(log.Fields{\n\t\t\"points\": dataPoints,\n\t}).Debug(\"New datapoints\")\n\t// TODO: Send dataPoints to remote\n}", "func AddPoint(db *gorm.DB, item *model.Point, DeviceUUID string) (*model.Point, error) {\n\tdevice := new(model.Device)\n\tif err := db.Where(\"uuid = ? \", DeviceUUID).First(&device).Error; err != nil {\n\t\treturn nil, &NotFoundError{deviceName, DeviceUUID, nil, \"not found\"}\n\t}\n\tif err := db.Create(&item).Error; err != nil {\n\t\treturn item, &NotFoundError{deviceName, \"na\", err, \"not found\"}\n\t}\n\treturn item, nil\n}", "func (ts *TimeSeries) AddPoint(value float64) Record {\n\trecord := newRecord(value)\n\tts.AddRecord(record)\n\treturn *record\n}", "func NewDataPoint(name string, value float64, unit Unit, dimensions ...Dimension) Point {\n\tp := Point{Name: name, Value: value, Unit: unit, Timestamp: time.Now().UTC()}\n\tp.AddDimensions(dimensions...)\n\treturn p\n}", "func NewPoint(latitude float64, longitude float64) *Point {\n return &Point{latitude: latitude, longitude: longitude}\n}", "func create_point(x float64, y float64) Point{\n\tp1 := Point{ x:x, y:y,}\n\treturn p1\n}", "func (dal *DataAccessLayer) CreateTimeSeriesDatumTable(dropExistingTable bool) {\n if dropExistingTable {\n drop_stmt := \"DROP TABLE data;\"\n results, err := dal.db.Exec(drop_stmt)\n if err != nil {\n fmt.Println(\"TimeSeriesDatum table dropped with error:\", results, err)\n } else {\n fmt.Println(\"TimeSeriesDatum table dropped and re-created\")\n }\n }\n\n // Special thanks:\n // * http://www.postgresqltutorial.com/postgresql-create-table/\n // * https://www.postgresql.org/docs/9.5/datatype.html\n\n stmt := `CREATE TABLE data (\n id bigserial PRIMARY KEY,\n tenant_id bigint NOT NULL,\n sensor_id BIGINT NOT NULL,\n value FLOAT NULL,\n timestamp BIGINT NOT NULL,\n unique (tenant_id, sensor_id, timestamp)\n );`\n results, err := dal.db.Exec(stmt)\n if err != nil {\n fmt.Println(\"TimeSeriesDatum Model\", results, err)\n }\n return\n}", "func (s *server) CreateData(ctx context.Context, in *pb.DataRequest) (*pb.DataResponse, error) {\r\n\t//connect to database\r\n\treq := in.Data\r\n\tDB, err := database.Connect()\r\n\t \r\n\tsqlStatement := `\r\n\tINSERT INTO t1 (data)\r\n\tVALUES ($1)\r\n\tON CONFLICT (data)\r\n\tDO NOTHING\r\n\tRETURNING key`\r\n\t \r\n\tvar key int32\r\n\t \r\n\t//insert row into t1 table\r\n\terr = DB.QueryRow(sqlStatement, req).Scan(&key)\r\n\tif err != nil && err != sql.ErrNoRows {\r\n\t panic(err)\r\n\t}\r\n\t\r\n\t//if a row was added to T1 then insert into T2\r\n\tif err != sql.ErrNoRows {\r\n\t\r\n\t\t//create t2 string made up of the data posted & the new key from the inserted t1 record\r\n\t\tt2Str := fmt.Sprintf(\"%s %d\", req, key)\r\n\r\n\t\tt2Key := 0\r\n\r\n\t\t//insert into t2 \r\n\t\tsqlStatement = `\r\n\t\tINSERT INTO t2 (t1key, data)\r\n\t\tVALUES ($1, $2)\r\n\t\tRETURNING key`\r\n\r\n\t\t//insert into t2 \r\n\t\terr = DB.QueryRow(sqlStatement, key, t2Str).Scan(&t2Key)\r\n\t\tif err != nil {\r\n\t\t panic(err)\r\n\t\t} \r\n\t\t\r\n\t\tfmt.Println(\"New key is:\", key)\r\n\t}\r\n\t \r\n\t \r\n\t//close database connection\r\n \tDB.Close()\r\n\t\r\n \r\n\treturn &pb.DataResponse{Data: req, Success: true, Key: key}, nil\r\n}", "func NewPoint(s data.Point) Point {\n\tvar time *time.Time\n\n\tif !s.Time.IsZero() {\n\t\ttime = &s.Time\n\t}\n\n\treturn Point{\n\t\tType: s.Type,\n\t\tKey: s.Key,\n\t\tValue: s.Value,\n\t\tTime: time,\n\t}\n}", "func newPoint(v *view.View, row *view.Row, start, end time.Time) *monitoringpb.Point {\n\tswitch v.Aggregation.Type {\n\tcase view.AggTypeLastValue:\n\t\treturn newGaugePoint(v, row, end)\n\tdefault:\n\t\treturn newCumulativePoint(v, row, start, end)\n\t}\n}", "func InsertRoutePoint(db *sql.DB, routeid string, Lat float64, Lon float64, P int) {\n\tid, err := GenerateRandomString(32)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tquery := fmt.Sprintf(\"INSERT INTO RoutePoints VALUES ('%s', '%s', %.10f, %.10f, %d, %d, %d, %d, %d, %d)\", id, routeid, Lat, Lon, time.Now().Day(), time.Now().Month(), time.Now().Year(), time.Now().Hour(), time.Now().Minute(), P)\n\t_, err = db.Query(query)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to execute SQL command:\", err)\n\t\tlog.Fatalln(\"Failed to execute SQL command:\", err)\n\t}\n\tfmt.Println(\"Point for Route ID - \", routeid, \"successfully inserted.\")\n}", "func CreatePlot(c *fiber.Ctx) error {\n\t/*\n\t * Getting the context\n\t * Fetching the request payload\n\t * Creating the plot in the database\n\t * Returning the response\n\t */\n\t//getting the context\n\tctx, err := config.GetContext(c)\n\tif err != nil {\n\t\t//error while getting the context\n\t\treturn err\n\t}\n\n\t//parsing the request body\n\tplotCtx := c.Context().UserValue(plotKey)\n\tplot, ok := plotCtx.(db.Plot)\n\tif !ok {\n\t\t//error while type converting the db plot instance\n\t\tctx.Log.WithFields(log.Fields{\"error\": err}).Error(\"error while processing the plot info\")\n\t\treturn c.Status(500).JSON(config.Error(\"error while procssing the plot info\"))\n\t}\n\n\t//creating the db entry\n\terr = (&plot).Create(ctx)\n\tif err != nil {\n\t\t//error while creating the database entry\n\t\tctx.Log.WithFields(log.Fields{\"error\": err}).Error(\"error while creating the database entry for the plot\")\n\t\treturn c.Status(500).JSON(config.Error(\"couldn't save the plot into the db\"))\n\t}\n\n\t//returning the response\n\treturn c.JSON(config.Success(dto.FromPlot(plot), \"plot\"))\n}", "func NewPoint(x, y float64, data interface{}) *Point {\n\treturn &Point{x, y, data}\n}", "func NewDatapointRepo(database *db.Datastore) *PostgresDatapointRepo {\n\treturn &PostgresDatapointRepo{\n\t\tdatabase,\n\t}\n}", "func DefaultCreateIntPoint(ctx context.Context, in *IntPoint, db *gorm1.DB) (*IntPoint, error) {\n\tif in == nil {\n\t\treturn nil, errors.New(\"Nil argument to DefaultCreateIntPoint\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func (p *Persistence) CreateNewMeasurement(thermometerId int64, porkSessionId int64, temperature int) (id int64) {\n\tvar err error\n\tvar rows *sqlx.Rows\n\n\trows, err = p.db.Queryx(\"INSERT INTO measurement (thermometer, pork_session, temperature) VALUES ($1, $2, $3) RETURNING id\", thermometerId, porkSessionId, temperature)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tmeasurement := Measurement{}\n\tfor rows.Next() {\n\t\terr := rows.StructScan(&measurement)\n\t\tif err != nil {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\t\treturn measurement.Id\n\t}\n\n\treturn 0\n}", "func (d Datapoints) Datapoints() []Datapoint { return d }", "func WritePoint(name string, tags map[string]string, fields map[string]interface{}) (*client.Point, error) {\n\tc, err := NewHTTPClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer c.Close()\n\n\t// Create a new point batch\n\tbp, err := client.NewBatchPoints(client.BatchPointsConfig{\n\t\tDatabase: Settings.Database,\n\t\tPrecision: \"s\",\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpt, err := client.NewPoint(name, tags, fields, time.Now())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbp.AddPoint(pt)\n\n\t// Write the batch and check for an error\n\tif err = c.Write(bp); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Debugf(\"WritePoint=%s\", pt.String())\n\treturn pt, nil\n}", "func makePoint(name string, value interface{}) *influxdb.Point {\n\tfields := map[string]interface{}{\n\t\tfieldValue: toSignedIfUnsigned(value),\n\t}\n\n\treturn &influxdb.Point{\n\t\tMeasurement: name,\n\t\tFields: fields,\n\t}\n}", "func InsertData(db *sql.DB, d Data) error {\n\tdataAddedSQL := d.DateAdded.Unix()\n\n\tif _, err := db.Exec(insertSQL, d.ID, d.Location.Lat, d.Location.Long, dataAddedSQL); err != nil {\n\t\t// TODO: Should be handle difference mysql error situations to the client.\n\t\t// Handle Duplicate Entry only for current version\n\t\tif mysqlErr, ok := err.(*mysql.MySQLError); ok {\n\t\t\tif mysqlErr.Number == common.MysqlErrDupEntry {\n\t\t\t\treturn errors.New(\"Duplicated ID\")\n\t\t\t}\n\t\t}\n\n\t\treturn fmt.Errorf(\"Insert Data Error: %w\", err)\n\t}\n\n\treturn nil\n}", "func CreateData(c *gin.Context) {\r\n\tvar predict Models.Predict\r\n\tc.BindJSON(&predict)\r\n\terr := Models.CreateData(&predict)\r\n\tif err != nil {\r\n\t\tfmt.Println(err.Error())\r\n\t\tc.AbortWithStatus(http.StatusNotFound)\r\n\t} else {\r\n\t\tc.JSON(http.StatusOK, predict)\r\n\t}\r\n}", "func SavePoint(db *gorm.DB, point *model.Point) (*model.Point, error) {\n\tif err := db.Save(&point).Error; err != nil {\n\t\treturn point, err\n\t}\n\treturn point, nil\n}", "func (geom Geometry) AddPoint(x, y, z float64) {\n\tC.OGR_G_AddPoint(geom.cval, C.double(x), C.double(y), C.double(z))\n}", "func (s *SerializerTimescaleSql) SerializePoint(w io.Writer, p *Point) (err error) {\n\ttimestampNanos := p.Timestamp.UTC().UnixNano()\n\tbuf := make([]byte, 0, 4096)\n\tbuf = append(buf, []byte(\"INSERT INTO \")...)\n\tbuf = append(buf, []byte(p.MeasurementName)...)\n\tbuf = append(buf, []byte(\" (time\")...)\n\n\tfor i := 0; i < len(p.TagKeys); i++ {\n\t\tbuf = append(buf, \",\"...)\n\t\tbuf = append(buf, p.TagKeys[i]...)\n\t}\n\n\tfor i := 0; i < len(p.FieldKeys); i++ {\n\t\tbuf = append(buf, \",\"...)\n\t\tbuf = append(buf, p.FieldKeys[i]...)\n\t}\n\tbuf = append(buf, []byte(\") VALUES (\")...)\n\tbuf = append(buf, []byte(fmt.Sprintf(\"%d\", timestampNanos))...)\n\n\tfor i := 0; i < len(p.TagValues); i++ {\n\t\tbuf = append(buf, \",'\"...)\n\t\tbuf = append(buf, p.TagValues[i]...)\n\t\tbuf = append(buf, byte('\\''))\n\t}\n\n\tfor i := 0; i < len(p.FieldValues); i++ {\n\t\tbuf = append(buf, \",\"...)\n\t\tv := p.FieldValues[i]\n\t\tbuf = fastFormatAppend(v, buf, true)\n\t}\n\tbuf = append(buf, []byte(\");\\n\")...)\n\n\t_, err = w.Write(buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (g *Gauge) DataPoint() *DataPoint {\n\treturn &DataPoint{\n\t\tMetric: g.metric,\n\t\tTimestamp: time.Now(),\n\t\tType: GaugeType,\n\t\tDimensions: g.dimensions,\n\t\tValue: atomic.LoadInt64(&g.value),\n\t}\n}", "func (h *HistoCounter) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint, next Sink) error {\n\th.DatapointBucket.Add(float64(len(points)))\n\treturn h.sink.AddDatapoints(ctx, points, next)\n}", "func NewNewData() *NewData {\n\tthis := NewData{}\n\treturn &this\n}", "func (d *Datapoint) Data() interface{} {\n\treturn d.data\n}", "func NewPoint(x, y, z float64) *Tuple {\n\treturn &Tuple{x, y, z, 1.0}\n}", "func (c Client) WritePoint(db, measurement string, data interface{}) error {\n\tt, tags, fields, err := encode(data)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.WritePointTagsFields(db, measurement, tags, fields, t)\n}", "func NewPoint(lat, lng float64) Location {\r\n\treturn Location{\r\n\t\t\"Point\",\r\n\t\t[]float64{lng, lat},\r\n\t}\r\n}", "func (self *influxdbStorage) newSeries(columns []string, points []interface{}) *influxdb.Series {\n\tout := &influxdb.Series{\n\t\tName: self.tableName,\n\t\tColumns: columns,\n\t\t// There's only one point for each stats\n\t\tPoints: make([][]interface{}, 1),\n\t}\n\tout.Points[0] = points\n\treturn out\n}", "func (c *WrappedGauge) DataPoint() *DataPoint {\n\tgottenValue, err := c.value.Get()\n\tif err != nil {\n\t\treturn nil\n\t}\n\tvalue, err := toInt64(gottenValue)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn &DataPoint{\n\t\tMetric: c.metric,\n\t\tTimestamp: time.Now(),\n\t\tType: GaugeType,\n\t\tDimensions: c.dimensions,\n\t\tValue: value,\n\t}\n}", "func (d *Distribution) AddPoint(timestamp time.Time, value float64) {\n\td.Values = append(d.Values, MetricValue{Timestamp: timestamp, Value: value})\n}", "func (d Datapoints) DatapointAt(n int) Datapoint { return d[n] }", "func NewPoint(x1, y1 int) Point {\n\treturn Point{X: x1, Y: y1}\n}", "func NewPoint() api.IPoint {\n\to := new(point)\n\treturn o\n}", "func NewSendPoints(portalURL, deviceID, authToken string, timeout time.Duration, debug bool) func(data.Points) error {\n\tvar netClient = &http.Client{\n\t\tTimeout: timeout,\n\t}\n\n\treturn func(points data.Points) error {\n\t\tpointURL := portalURL + \"/v1/devices/\" + deviceID + \"/points\"\n\n\t\ttempJSON, err := json.Marshal(NewPoints(points))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif debug {\n\t\t\tlog.Println(\"Sending points: \", string(tempJSON))\n\t\t}\n\n\t\treq, err := http.NewRequest(\"POST\", pointURL, bytes.NewBuffer(tempJSON))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t\treq.Header.Set(\"Authorization\", authToken)\n\t\tresp, err := netClient.Do(req)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdefer resp.Body.Close()\n\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\terrstring := \"Server error: \" + resp.Status + \" \" + pointURL\n\t\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\t\terrstring += \" \" + string(body)\n\t\t\treturn errors.New(errstring)\n\t\t}\n\n\t\treturn nil\n\t}\n}", "func (b *ServerBackend) AddDPointRecord(server string, user string, record *DPointRecord) bool {\n\t// Validate user and server\n\tuserdata := b.GetUserData(server, user)\n\tif userdata == nil {\n\t\tfmt.Println(\"ADD_DPOINT: Could not get userdata\")\n\t\treturn false\n\t}\n\n\tpoints, err := strconv.ParseInt(record.Points, 10, 32)\n\tif err != nil {\n\t\tfmt.Println(\"ADD_DPOINT: Could not parse int\")\n\t\treturn false\n\t}\n\n\tdata := fromilyclient.DPointRecord{\n\t\tPoints: int32(points),\n\t\tReason: record.Reason,\n\t}\n\n\tif b.Client.CreateDPointRecord(server, user, &data) != nil {\n\t\tfmt.Println(\"ADD_DPOINT: Could not create record\")\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (*SeatDataAccessObject) InsertOne(s *Seat) error {\n\t_, err := orm.InsertOne(s)\n\treturn err\n}", "func (o *SpanTagRemoval) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint) error {\n\treturn o.next.AddDatapoints(ctx, points)\n}", "func (c *Counter) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint, next Sink) error {\n\tatomic.AddInt64(&c.TotalDatapoints, int64(len(points)))\n\tatomic.AddInt64(&c.TotalProcessCalls, 1)\n\tatomic.AddInt64(&c.CallsInFlight, 1)\n\tstart := time.Now()\n\terr := next.AddDatapoints(ctx, points)\n\tatomic.AddInt64(&c.TotalProcessTimeNs, time.Since(start).Nanoseconds())\n\tatomic.AddInt64(&c.CallsInFlight, -1)\n\tif err != nil {\n\t\tatomic.AddInt64(&c.TotalProcessErrors, 1)\n\t\tatomic.AddInt64(&c.ProcessErrorPoints, int64(len(points)))\n\t\tc.logErrMsg(ctx, err, \"Unable to process datapoints\")\n\t}\n\treturn err\n}", "func NewPoint(x, y float64) *Point {\n\tp := Point{Type: \"point\", Coordinates: []float64{x, y}}\n\treturn &p\n}", "func (d *DBRepository) insertOne(ctx context.Context, travel *Travel) error {\n\ttravel.ObjectID = primitive.NewObjectID()\n\tif _, err := d.Collection.InsertOne(ctx, travel); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func CreateNewPatient(c *gin.Context) {\n\tvar patientRequest PatientRequest\n\tc.ShouldBind(&patientRequest)\n\tpatientResponse := PatientResponse{\n\t\tPatientID: \"2018-0001\",\n\t\tName: patientRequest.Name,\n\t\tLastname: patientRequest.Lastname,\n\t\tAge: patientRequest.Age,\n\t}\n\tc.JSON(201, patientResponse)\n\n}", "func (md *MapData) InsertNewMapData(session *mgo.Session) {\n\tmd.ID = bson.NewObjectId()\n\n\tsession.DB(\"scratch_map\").C(\"map_data\").Insert(md)\n}", "func (b *Bucket) AddData(dataPoint data.Point) error {\n\terr := b.shards[b.index].AddData(dataPoint)\n\n\tif err == nil {\n\t\treturn nil\n\t}\n\n\tif !errors.Is(err, ErrShardMaxReached) {\n\t\treturn err\n\t}\n\n\tvar m metrics.Metric\n\n\t// we have reached max timestamp for the current shard, make a new one\n\tif m, err = metrics.FromDescriptor(b.descriptor); err != nil {\n\t\treturn err\n\t}\n\tif err := m.AddData(dataPoint); err != nil {\n\t\treturn err\n\t}\n\n\tshard := NewShard(m, b.shardDuration)\n\n\tb.shards = append(b.shards, shard)\n\tb.index++\n\n\treturn nil\n}", "func NewPoint(x, y, z float64) Tuple {\n\treturn Tuple{\n\t\tX: x,\n\t\tY: y,\n\t\tZ: z,\n\t\tW: pointW,\n\t}\n}", "func (c *StepLookbackAccumulator) AddPoint(dp ts.Datapoint) {\n\tif dp.TimestampNanos.Before(c.earliestLookback) {\n\t\t// this datapoint is too far in the past, it can be dropped.\n\t\treturn\n\t}\n\n\tc.datapoints = append(c.datapoints, xts.Datapoint{\n\t\tTimestamp: dp.TimestampNanos,\n\t\tValue: dp.Value,\n\t})\n}", "func GetDatapointByID(id int64) (dp *Datapoint, err error) {\n\tvar datasetID int64\n\tvar imageURL string\n\n\terr = DB.QueryRow(\"SELECT id, dataset_id, image_url FROM datapoint WHERE id=$1\", id).Scan(&id, &datasetID, &imageURL)\n\n\tif err != nil {\n\t\treturn // something went wrong! lets get out of here!\n\t}\n\n\tdp = &Datapoint{\n\t\tID: id,\n\t\tDatasetID: datasetID,\n\t\tImageURL: imageURL,\n\t}\n\n\treturn\n}", "func InfluxDBInsert(addr *C.char, port C.int, user *C.char, pass *C.char,\n\tdb *C.char, ccolumns *C.struct_InfluxDBColumnInfo, tablename *C.char,\n\tctypes *C.InfluxDBType, cvalues *C.InfluxDBValue, cparamNum C.int) *C.char {\n\n\t//Create a new HTTPClient\n\tcl, err := client.NewHTTPClient(client.HTTPConfig{\n\t\tAddr: C.GoString(addr) + \":\" + strconv.Itoa(int(port)),\n\t\tUsername: C.GoString(user),\n\t\tPassword: C.GoString(pass),\n\t})\n\tif err != nil {\n\t\treturn C.CString(err.Error())\n\t}\n\tdefer cl.Close()\n\n\t//Create a new point batch\n\tbp, _ := client.NewBatchPoints(client.BatchPointsConfig{\n\t\tDatabase: C.GoString(db),\n\t})\n\n\t//Create tags, fields and time data\n\ttags, fields, timecol, err := makeColumnValue(ccolumns, ctypes, cvalues, cparamNum)\n\tif err != nil {\n\t\treturn C.CString(err.Error())\n\t}\n\n\t//Create a point and add to batch\n\tpt, err := client.NewPoint(C.GoString(tablename), tags, fields, timecol)\n\tif err != nil {\n\t\treturn C.CString(err.Error())\n\t}\n\n\tbp.AddPoint(pt)\n\n\t//Write the batch\n\terr = cl.Write(bp)\n\tif err != nil {\n\t\treturn C.CString(err.Error())\n\t}\n\n\treturn nil\n}", "func (s SmesherService) CreatePostData(context.Context, *pb.CreatePostDataRequest) (*pb.CreatePostDataResponse, error) {\n\tlog.Info(\"GRPC SmesherService.CreatePostData\")\n\treturn nil, status.Errorf(codes.Unimplemented, \"this endpoint is not implemented\")\n}", "func (ds *Datapoints) Import(I Importable) {\n\t*ds = append(*ds, I.ToDatapoint())\n}", "func NewPoint(x, y int) Point {\n\treturn Point{x, y}\n}", "func insertObject(object *remember.DataObject, connection *sql.DB) error {\n\tstatement, err := connection.Prepare(CREATE)\n\tif nil != err {\n\t\treturn err\n\t}\n\tdefer statement.Close()\n\n\tobject.CreatedAt = time.Now()\n\tobject.UpdatedAt = time.Now()\n\n\tresponse, err := statement.Exec(\n\t\tobject.Title,\n\t\tobject.GroupId,\n\t\tobject.Payload,\n\t\tobject.CreatedAt.Unix(),\n\t\tobject.UpdatedAt.Unix(),\n\t)\n\tif nil != err {\n\t\treturn err\n\t}\n\n\tobject.ID, err = response.LastInsertId()\n\treturn err\n}", "func (gdb *GostDatabase) PostDatastream(d *entities.Datastream) (*entities.Datastream, error) {\n\terr := CheckDatastreamRelationsExist(gdb, d)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttID, _ := ToIntID(d.Thing.ID)\n\tsID, _ := ToIntID(d.Sensor.ID)\n\toID, _ := ToIntID(d.ObservedProperty.ID)\n\tvar dsID int\n\n\tunitOfMeasurement, _ := json.Marshal(d.UnitOfMeasurement)\n\tgeom := \"NULL\"\n\tif len(d.ObservedArea) != 0 {\n\t\tobservedAreaBytes, _ := json.Marshal(d.ObservedArea)\n\t\tgeom = fmt.Sprintf(\"ST_SetSRID(ST_GeomFromGeoJSON('%s'),4326)\", string(observedAreaBytes[:]))\n\t}\n\n\tphenomenonTime := \"NULL\"\n\tif len(d.PhenomenonTime) != 0 {\n\t\tphenomenonTime = \"'\" + now.Iso8601ToPostgresPeriod(d.PhenomenonTime) + \"'\"\n\t}\n\n\tresultTime := \"NULL\"\n\tif len(d.ResultTime) != 0 {\n\t\tresultTime = \"'\" + now.Iso8601ToPostgresPeriod(d.ResultTime) + \"'\"\n\t}\n\t// get the ObservationType id in the lookup table\n\tobservationType, err := entities.GetObservationTypeByValue(d.ObservationType)\n\n\tif err != nil {\n\t\treturn nil, gostErrors.NewBadRequestError(errors.New(\"ObservationType does not exist\"))\n\t}\n\n\tsql2 := fmt.Sprintf(\"INSERT INTO %s.datastream (name, description, unitofmeasurement, observedarea, thing_id, sensor_id, observedproperty_id, observationtype, phenomenonTime, resulttime) VALUES ($1, $2, $3, %s, $4, $5, $6, $7, %s, %s) RETURNING id\", gdb.Schema, geom, phenomenonTime, resultTime)\n\terr = gdb.Db.QueryRow(sql2, d.Name, d.Description, unitOfMeasurement, tID, sID, oID, observationType.Code).Scan(&dsID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\td.ID = dsID\n\n\t// clear inner entities to serves links upon response\n\td.Thing = nil\n\td.Sensor = nil\n\td.ObservedProperty = nil\n\n\treturn d, nil\n}", "func RandomDatapoint(n uint) *Datapoint {\n\treturn RandomDatapointInRange(n, 0, 1)\n}", "func newDataInstance(repo datastore.Repo, t *testing.T, name dvid.DataString) *Data {\n\tconfig := dvid.NewConfig()\n\tconfig.SetVersioned(true)\n\tdataservice, err := repo.NewData(labelsT, name, config)\n\tif err != nil {\n\t\tt.Errorf(\"Unable to create labels64 instance %q: %s\\n\", name, err.Error())\n\t}\n\tlabels, ok := dataservice.(*Data)\n\tif !ok {\n\t\tt.Errorf(\"Can't cast labels data service into Data\\n\")\n\t}\n\treturn labels\n}", "func createData(client pb.DataClient, data *pb.DataRequest) {\r\n\tresp, err := client.CreateData(context.Background(), data)\r\n\tif err != nil {\r\n\t\tlog.Fatalf(\"Could not create Data: %v\", err)\r\n\t}\r\n\tif resp.Key < 1 {\r\n\t\tlog.Printf(\"%s already exists:\", resp.Data)\r\n\t}\r\n\tif resp.Success {\r\n\t\tlog.Printf(\"A new Data has been added for: %s\", resp.Data)\r\n\t}\r\n}", "func (g *StableGauge) DataPoint() *DataPoint {\n\tdp := g.gauge.DataPoint()\n\tif dp.Value == atomic.LoadInt64(&g.prevValue) {\n\t\t// Value is the same, don't report it\n\t\treturn nil\n\t}\n\tatomic.StoreInt64(&g.prevValue, dp.Value)\n\treturn dp\n}", "func insertIntoTable(ctx context.Context, sd StationData) error {\n\t// Get the current application ID, which is the same as the project ID.\n\t//projectID := appengine.AppID(ctx)\n\t//fmt.Println(projectID)\n\n\t// Create the BigQuery service.\n\tbq, err := bigquery.NewClient(ctx, \"pdxbike\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not create service: %v\", err)\n\t}\n\n\titems := []*Station{}\n\tfor _, st := range sd.Data.Stations {\n\t\tfmt.Println(st)\n\t\titems = append(items, &st)\n\t}\n\tu := bq.Dataset(\"StationData\").Table(\"testing1\").Uploader()\n\tif err := u.Put(ctx, items); err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *MeasurementService) Create(ctx context.Context, body MeasurementRepresentation) (*Measurement, *Response, error) {\n\tdata := new(Measurement)\n\tresp, err := s.client.SendRequest(ctx, RequestOptions{\n\t\tMethod: \"POST\",\n\t\tPath: \"measurement/measurements\",\n\t\tBody: body,\n\t\tResponseData: data,\n\t})\n\treturn data, resp, err\n}", "func (s *ReprTimeSeries) AddPoint(t int64, min float64, max float64, last float64, sum float64, count int64) error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\ts.Stats = append(s.Stats, &repr.StatRepr{\n\t\tTime: t,\n\t\tMin: repr.CheckFloat(min),\n\t\tMax: repr.CheckFloat(max),\n\t\tLast: repr.CheckFloat(last),\n\t\tSum: repr.CheckFloat(sum),\n\t\tCount: count,\n\t})\n\tif t > s.curTime {\n\t\ts.curTime = t\n\t}\n\tif t < s.T0 {\n\t\ts.T0 = t\n\t}\n\treturn nil\n}", "func createPerson(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"CREATE HIT\")\n\tstmt, err := db.Prepare(\"INSERT INTO Persons(pAge, pName) VALUES (?,?)\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tvar per Person\n\tjson.Unmarshal(body, &per)\n\tage := per.Age\n\tname := per.Name\n\t_, err = stmt.Exec(age, name)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Fprintf(w, \"New person was created\")\n}", "func newObject(db *DelegateDB, address common.Address, delegate Delegate, onDirty func(addr common.Address)) *delegateObject {\n\tif delegate.Vote == nil {\n\t\tdelegate.Vote = big.NewInt(0)\n\t}\n\tdObject := &delegateObject{\n\t\tdb: db,\n\t\taddress: address,\n\t\taddrHash: crypto.Keccak256Hash(address[:]),\n\t\tdata: delegate,\n\t\tcachedStorage: make(Storage),\n\t\tdirtyStorage: make(Storage),\n\t\tonDirty: onDirty,\n\t}\n\tdObject.tryMarkDirty()\n\treturn dObject\n}", "func (ts *Timeseries) AddNewPointKeepLen(v float64, x interface{}) error {\n\tts.orderIndex()\n\tl := len(ts.XY)\n\tswitch T := x.(type) {\n\tcase int64:\n\t\tts.XY[T] = v\n\tcase time.Time:\n\t\tts.XY[T.UnixNano()] = v\n\tcase int:\n\t\tts.XY[int64(T)] = v\n\tdefault:\n\t\treturn fmt.Errorf(\"Adding point not possible\")\n\t}\n\tnewl := len(ts.XY)\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\tif newl > l {\n\t\tdelete(ts.XY, int64(keys[0]))\n\t}\n\tts.orderIndex()\n\n\treturn nil\n}", "func NewData(uuid dvid.UUID, id dvid.InstanceID, name dvid.InstanceName, c dvid.Config) (*Data, error) {\n\t// Initialize the Data for this data type\n\tbasedata, err := datastore.NewDataService(dtype, uuid, id, name, c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata := &Data{\n\t\tData: basedata,\n\t\tProperties: Properties{},\n\t}\n\treturn data, nil\n}", "func (self *PhysicsP2) CreateParticle(x int, y int, mass int, addToWorld bool, options interface{}, points interface{}) {\n self.Object.Call(\"createParticle\", x, y, mass, addToWorld, options, points)\n}", "func NewPoint(x, y int) Point {\n\treturn Point{\n\t\tX: x,\n\t\tY: y,\n\t}\n}", "func (a *Activity) createActivity() error {\n\n\ttags := map[string]string{\n\t\t\"unit\": a.Unit,\n\t\t\"type\": \"activity\",\n\t}\n\tfields := map[string]interface{}{\n\t\t\"value\": a.Value,\n\t}\n\n\tbps, err := client.NewBatchPoints(client.BatchPointsConfig{\n\t\tDatabase: database.Dbname,\n\t\tPrecision: \"ms\",\n\t})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpoint, err := client.NewPoint(\n\t\ta.Name,\n\t\ttags,\n\t\tfields,\n\t\ttime.Now(),\n\t)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbps.AddPoint(point)\n\n\terr = database.InfluxDBcon.Write(bps)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (cpb *CachePointBag) Add(point common.Point) (expiredNum int) {\n\t// first delete point expired\n\tnow := time.Now().Unix()\n\tvar index int = 0\n\tfor i, p := range cpb.Data {\n\t\tif p.Timestamp >= now - cpb.duration {\n\t\t\tbreak\n\t\t}\n\t\tindex = i\n\t}\n\tcpb.Lock()\n\t\n\tif index > 0 {\n\t\tcpb.Data = cpb.Data[index:]\n\t}\n\texpiredNum = index\n\tlast := len(cpb.Data) -1\n\t\n\t// push point at right location, maybe some point reach delay\n\tcpb.Data = append(cpb.Data, point)\n\tfor i := last; i >0; i-- {\n\t\tif cpb.Data[i].Timestamp < point.Timestamp {\n\t\t\tbreak\n\t\t}\n\t\tcpb.Data[i+1] = cpb.Data[i]\n\t\tcpb.Data[i] = point\n\t}\n\t\n\tif cpb.PointsToDb == nil {\n\t\tcpb.PointsToDb = make([]common.Point, 0)\n\t}\n\tcpb.PointsToDb = append(cpb.PointsToDb, point)\n\tcpb.Unlock()\n\treturn\n}", "func (b *Blueprint) Point(column string) *ColumnDefinition {\n\treturn b.addColumn(\"point\", column, nil)\n}", "func addPerson(w http.ResponseWriter, r *http.Request) {\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\tvar person models.Person\r\n\t_ = json.NewDecoder(r.Body).Decode(&person)\r\n\tperson.UUID = primitive.NewObjectID()\r\n\r\n\tcollection := models.ConnectDB()\r\n\tnewPerson, err := collection.InsertOne(context.TODO(), person)\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\tjson.NewEncoder(w).Encode(newPerson.InsertedID.(primitive.ObjectID))\r\n}", "func NewPoint(x, y, z float64) Point {\n\treturn Point{x, y, z, pointW}\n}", "func DeletePoint(db *gorm.DB, id string) error {\n\tpoint := new(model.Point)\n\tif err := db.Where(\"id = ? \", id).Delete(&point).Error; err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\t//tag := new(model.Tag)\n\t//if err := db.Where(\"post_id = ? \", id).Delete(&tag).Error; err != nil {\n\t//\tlog.Println(err)\n\t//}\n\n\treturn nil\n}", "func CreatePDV(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tvar p *model.PDV\n\tb, _ := ioutil.ReadAll(r.Body)\n\terr := json.Unmarshal(b, &p)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write(jsonError(fmt.Sprintf(\"%s\", err)))\n\t\treturn\n\t}\n\tinput := &database.PDVCreateInput{\n\t\tDatabase: database.GetInstance(),\n\t\tPDV: p,\n\t}\n\t_, err = database.CreatePDV(input)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write(jsonError(fmt.Sprintf(\"%s\", err)))\n\t\treturn\n\t}\n\tjsonResponse(w, &successResponse{\"The PDV was inserted\"}, http.StatusOK)\n}", "func (endpoint *HNSEndpoint) Create() (*HNSEndpoint, error) {\n\toperation := \"Create\"\n\ttitle := \"hcsshim::HNSEndpoint::\" + operation\n\tlogrus.Debugf(title+\" id=%s\", endpoint.Id)\n\n\tjsonString, err := json.Marshal(endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn HNSEndpointRequest(\"POST\", \"\", string(jsonString))\n}", "func (o *CurrentChartDataMinutely) Insert(exec boil.Executor, columns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no current_chart_data_minutely provided for insertion\")\n\t}\n\n\tvar err error\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\tif o.UpdatedAt.IsZero() {\n\t\to.UpdatedAt = currTime\n\t}\n\n\tif err := o.doBeforeInsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(currentChartDataMinutelyColumnsWithDefault, o)\n\n\tkey := makeCacheKey(columns, nzDefaults)\n\tcurrentChartDataMinutelyInsertCacheMut.RLock()\n\tcache, cached := currentChartDataMinutelyInsertCache[key]\n\tcurrentChartDataMinutelyInsertCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl, returnColumns := columns.InsertColumnSet(\n\t\t\tcurrentChartDataMinutelyColumns,\n\t\t\tcurrentChartDataMinutelyColumnsWithDefault,\n\t\t\tcurrentChartDataMinutelyColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(currentChartDataMinutelyType, currentChartDataMinutelyMapping, wl)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcache.retMapping, err = queries.BindMapping(currentChartDataMinutelyType, currentChartDataMinutelyMapping, returnColumns)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(wl) != 0 {\n\t\t\tcache.query = fmt.Sprintf(\"INSERT INTO \\\"current_chart_data_minutely\\\" (\\\"%s\\\") %%sVALUES (%s)%%s\", strings.Join(wl, \"\\\",\\\"\"), strmangle.Placeholders(dialect.UseIndexPlaceholders, len(wl), 1, 1))\n\t\t} else {\n\t\t\tcache.query = \"INSERT INTO \\\"current_chart_data_minutely\\\" %sDEFAULT VALUES%s\"\n\t\t}\n\n\t\tvar queryOutput, queryReturning string\n\n\t\tif len(cache.retMapping) != 0 {\n\t\t\tqueryReturning = fmt.Sprintf(\" RETURNING \\\"%s\\\"\", strings.Join(returnColumns, \"\\\",\\\"\"))\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(cache.query, queryOutput, queryReturning)\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(queries.PtrsFromMapping(value, cache.retMapping)...)\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to insert into current_chart_data_minutely\")\n\t}\n\n\tif !cached {\n\t\tcurrentChartDataMinutelyInsertCacheMut.Lock()\n\t\tcurrentChartDataMinutelyInsertCache[key] = cache\n\t\tcurrentChartDataMinutelyInsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterInsertHooks(exec)\n}", "func NewPoint() *Point {\n\tx := rand.Float(-100, 101)\n\ty := rand.Float(-100, 101)\n\n\tlabel := -1\n\tif x > y { // f(x) = x (identity function)\n\t\tlabel = 1\n\t}\n\n\treturn &Point{\n\t\tX: x,\n\t\tY: y,\n\t\tLabel: label,\n\t\tBias: 1,\n\t}\n}", "func (p *Persistence) CreateNewMeatThermometer(thermometerName string) (id int64) {\n\tvar err error\n\tvar rows *sqlx.Rows\n\n\trows, err = p.db.Queryx(\"INSERT INTO thermometer (thermometer_name, thermometer_type) VALUES ($1, $2) RETURNING id\", thermometerName, \"meat\")\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tthermometer := Thermometer{}\n\tfor rows.Next() {\n\t\terr := rows.StructScan(&thermometer)\n\t\tif err != nil {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\t\treturn thermometer.Id\n\t}\n\n\treturn 0\n}", "func NewDatatypeGeoPoint(name string) *DatatypeGeoPoint {\n\treturn &DatatypeGeoPoint{\n\t\tname: name,\n\t}\n}", "func (p *Poet) Create(db *sql.DB) error {\n\tvar (\n\t\terr error\n\t)\n\n\t// assume id is already assigned\n\n\t// set birthday\n\tp.BirthDate = time.Now().Truncate(time.Millisecond)\n\n\t// prepare statement if not already done so.\n\tif poetCreateStmt == nil {\n\t\t// create statement\n\t\tstmt := `INSERT INTO poets (\n id, designer, name, birthDate, deathDate, description, language, programFileName, parameterFileName, parameterFileIncluded, path\n ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)`\n\t\tpoetCreateStmt, err = db.Prepare(stmt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t_, err = poetCreateStmt.Exec(\n\t\tp.Id,\n\t\tp.Designer.Id,\n\t\tp.Name,\n\t\tp.BirthDate,\n\t\tp.DeathDate,\n\t\tp.Description,\n\t\tp.Language,\n\t\tp.ProgramFileName,\n\t\tp.ParameterFileName,\n\t\tp.ParameterFileIncluded,\n\t\tp.Path,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (r *KNNRetriever) Insert(point *embedding.Embedding) error {\n\tif point.Dimensions() != r.vectorsDimension {\n\t\treturn trace.BadParameter(\"point has wrong dimension\")\n\t}\n\tr.tree.Insert(point)\n\tr.mapping[point.GetName()] = point\n\n\treturn nil\n}", "func NewDoubleDataPoint() DoubleDataPoint {\n\torig := (*otlpmetrics.DoubleDataPoint)(nil)\n\treturn newDoubleDataPoint(&orig)\n}", "func NewPoint(group Group) Point {\n\treturn C.EC_POINT_new(group)\n}", "func (gi *Sensor) Create(db *pg.DB) error {\r\n\tlog.Printf(\"===>sensorItem.Create()\")\r\n\tlog.Printf(\" sensorItem.Create():=%v\\n\", gi)\r\n\r\n\tinsertErr := db.Insert(gi)\r\n\tif insertErr != nil {\r\n\t\tlog.Printf(\"Error writing to DB in sensorItem.Create()\\n\")\r\n\t\tlog.Printf(\"Reason:%v\\n\", insertErr)\r\n\t\treturn insertErr\r\n\t}\r\n\tlog.Printf(\"Sensor %s inserted successfully into table\", gi.Sensorname)\r\n\treturn nil\r\n}", "func (self *averageCache) Insert(dataPoints []*whisper.TimeSeriesPoint) {\n\tlog.WithFields(log.Fields{\n\t\t\"cache\": self.name,\n\t}).Debug(\"Insert\")\n\tself.inputChan <- dataPoints\n}", "func (c *Curve) NewPoint(x, y float64) (CurvePoint, error) {\n\n\tvar point CurvePoint\n\n\tif !c.IsPointOnCurve(x, y) {\n\t\terr := fmt.Errorf(\"Point (%f, %f) is not on y^2 = x^3 + %fx + %f\", x, y, c.a, c.b)\n\t\treturn point, err\n\t}\n\n\tpoint.x = x\n\tpoint.y = y\n\tpoint.order = -1\n\tpoint.curve = c\n\n\treturn point, nil\n}", "func (l *GeoLoc) Insert() error {\n\t// Get db instance\n\tdb, err := dstore.NewDB()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error retrieving DB instance: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// Insert\n\tvar row *sql.Row\n\n\t// Check if GeoLoc has been parsed\n\tif l.Located {\n\t\t// Check accuracy value\n\t\tif l.Accuracy == AccuracyErr {\n\t\t\treturn fmt.Errorf(\"invalid accuracy value: %s\",\n\t\t\t\tl.Accuracy)\n\t\t}\n\n\t\t// If so, save all fields\n\t\trow = db.QueryRow(\"INSERT INTO geo_locs (located, gapi_success\"+\n\t\t\t\", lat, long, postal_addr, accuracy, bounds_provided, \"+\n\t\t\t\"bounds_id, viewport_bounds_id, gapi_place_id, raw) \"+\n\t\t\t\"VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) \"+\n\t\t\t\"RETURNING id\",\n\t\t\tl.Located, l.GAPISuccess, l.Lat, l.Long, l.PostalAddr,\n\t\t\tl.Accuracy, l.BoundsProvided, l.BoundsID,\n\t\t\tl.ViewportBoundsID, l.GAPIPlaceID, l.Raw)\n\t} else {\n\t\t// If not, only save a couple, and leave rest null\n\t\trow = db.QueryRow(\"INSERT INTO geo_locs (located, raw) VALUES\"+\n\t\t\t\" ($1, $2) RETURNING id\",\n\t\t\tl.Located, l.Raw)\n\t}\n\n\t// Get inserted row ID\n\terr = row.Scan(&l.ID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error inserting row, Located: %t, err: %s\",\n\t\t\tl.Located, err.Error())\n\t}\n\n\treturn nil\n}", "func NewPoints() Points {\n\treturn Points{\n\t\t\"P\": NewAttributes(Vector, 3),\n\t}\n}", "func (t *Table) Point(colNm string) *Table {\n\tt.columns = append(t.columns, &column{Name: colNm, ColumnType: TypePoint})\n\treturn t\n}", "func NewPoint(x, y int) *Point {\n\treturn &Point{\n\t\tX: x,\n\t\tY: y,\n\t}\n}", "func NewPoint(x, y int) *Point {\n\treturn &Point{\n\t\tX: x,\n\t\tY: y,\n\t}\n}", "func CreatePerson(db *sql.DB) {}" ]
[ "0.8000808", "0.6696262", "0.63995373", "0.6313884", "0.59810144", "0.58154607", "0.5605545", "0.5546164", "0.5510137", "0.54992396", "0.54607934", "0.54099196", "0.53961456", "0.53786576", "0.5377734", "0.5367833", "0.5366217", "0.5314214", "0.52989596", "0.5285048", "0.5267355", "0.52488554", "0.52215874", "0.52161396", "0.51843745", "0.51513386", "0.5132509", "0.5112632", "0.51056945", "0.50797504", "0.507138", "0.50458336", "0.5040891", "0.49869955", "0.49819845", "0.49806947", "0.49634108", "0.49607956", "0.49568594", "0.495304", "0.49500728", "0.49378654", "0.49290574", "0.49213684", "0.48999506", "0.48986834", "0.4890495", "0.4875781", "0.48644295", "0.48411977", "0.4822486", "0.48211443", "0.48060906", "0.47867575", "0.47860906", "0.4776399", "0.4760692", "0.4732837", "0.4728945", "0.47273123", "0.47203106", "0.47191814", "0.47172043", "0.4716681", "0.46882087", "0.46874237", "0.4683177", "0.46831584", "0.4682318", "0.46808082", "0.46789664", "0.46784222", "0.4675572", "0.46737212", "0.46588337", "0.46437305", "0.46353775", "0.46322095", "0.46163994", "0.46052074", "0.46011388", "0.45964146", "0.458849", "0.45811844", "0.45798042", "0.45750177", "0.4571821", "0.45709214", "0.4568247", "0.45677736", "0.4555961", "0.45551357", "0.45514542", "0.45494592", "0.45460033", "0.45450288", "0.4531142", "0.45222968", "0.45222968", "0.4513591" ]
0.7536382
1
GetDatapointByID fetches a datapoint from the database and returns it
func GetDatapointByID(id int64) (dp *Datapoint, err error) { var datasetID int64 var imageURL string err = DB.QueryRow("SELECT id, dataset_id, image_url FROM datapoint WHERE id=$1", id).Scan(&id, &datasetID, &imageURL) if err != nil { return // something went wrong! lets get out of here! } dp = &Datapoint{ ID: id, DatasetID: datasetID, ImageURL: imageURL, } return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetDataByID(c *gin.Context) {\r\n\tid := c.Params.ByName(\"id\")\r\n\tvar predict Models.Predict\r\n\terr := Models.GetDataByID(&predict, id)\r\n\tif err != nil {\r\n\t\tc.AbortWithStatus(http.StatusNotFound)\r\n\t} else {\r\n\t\tc.JSON(http.StatusOK, predict)\r\n\t}\r\n}", "func (c *MainController) getDataByID(PID int) {\n\to := orm.NewOrm()\n\tproduct := models.Product{PID: PID}\n\terr := o.Read(&product)\n\tif err != nil {\n\t\tbeego.Info(\"o.Read err=\", err)\n\t\treturn\n\t}\n\tc.Data[\"product\"] = product\n}", "func (d *DataSource) GetByID(id int64) (Model, bool) {\n\treturn d.GetBy(func(u Model) bool {\n\t\treturn u.ID == id\n\t})\n}", "func (db *PostgresDatapointRepo) CreateDatapoint(dp earthworks.Datapoint) (earthworks.Datapoint, error) {\n\tquery := `INSERT INTO datapoint (location) VALUES ($1) RETURNING id`\n\tcreated := earthworks.Datapoint{}\n\terr := db.Get(&created, query, wkt.MarshalString(dp.Location))\n\tif err != nil {\n\t\treturn earthworks.Datapoint{}, err\n\t}\n\n\treturn created, nil\n}", "func (gi *Sensor) GetByID(db *pg.DB) (Sensor, error) {\r\n\tlog.Printf(\"===>sensorItem.GetByID(SensorID=%d)\", gi.ID)\r\n\r\n\t//getErr := db.Select(gi)\r\n\tgetErr := db.Model(gi).Where(\"id = ?0\", gi.ID).Select()\r\n\tif getErr != nil {\r\n\t\tlog.Printf(\"Error while selecting item, Reason %v\\n\", getErr)\r\n\t\treturn *gi, getErr\r\n\t}\r\n\tlog.Printf(\"Select successful in sensorItem.GetById() sensor=%v\\n\", *gi)\r\n\treturn *gi, nil\r\n}", "func (dao PathProfileDAOPsql) GetByID(id int) (*models.PathProfile, error) {\n\tquery := \"SELECT id, profile_id, path_id, post, put, del, get, created_at, updated_at FROM path_profile WHERE id = $1\"\n\to := &models.PathProfile{}\n\tdb := get()\n\tdefer db.Close()\n\n\tstmt, err := db.Prepare(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer stmt.Close()\n\n\trow := stmt.QueryRow(id)\n\terr = dao.rowToPathProfile(row, o)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn o, nil\n}", "func DefaultReadIntPoint(ctx context.Context, in *IntPoint, db *gorm1.DB) (*IntPoint, error) {\n\tif in == nil {\n\t\treturn nil, errors.New(\"Nil argument to DefaultReadIntPoint\")\n\t}\n\tdb = db.Set(\"gorm:auto_preload\", true)\n\tormParams, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif ormParams.Id == 0 {\n\t\treturn nil, errors.New(\"Read requires a non-zero primary key\")\n\t}\n\tormResponse := IntPointORM{}\n\tif err = db.Where(&ormParams).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func (ds *KVStorage) GetByID(ID string) (graph.Graph, bool) {\n\tif val, ok := ds.data[ID]; ok {\n\t\treturn val, ok\n\t}\n\treturn graph.Graph{}, false\n}", "func (e Endpoints) GetByID(ctx context.Context, id string) (d io.Department, error error) {\n\trequest := GetByIDRequest{Id: id}\n\tresponse, err := e.GetByIDEndpoint(ctx, request)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn response.(GetByIDResponse).D, response.(GetByIDResponse).Error\n}", "func NewDatapoint(datasetID int64, imageURL string) (dp *Datapoint, err error) {\n\tvar id int64\n\n\terr = DB.QueryRow(\"INSERT INTO datapoint (dataset_id, image_url) VALUES ($1, $2) RETURNING id\", datasetID, imageURL).Scan(&id)\n\n\tif err != nil {\n\t\treturn // something went wrong! lets get out of here!\n\t}\n\n\t//blank space for readability\n\n\tdp = &Datapoint{\n\t\tID: id,\n\t\tDatasetID: datasetID,\n\t\tImageURL: imageURL,\n\t}\n\n\treturn\n}", "func (DiseaseUsecase *DiseaseUsecaseImpl) GetByID(id string) (*model.Disease, error) {\n\tDisease, err := DiseaseUsecase.DiseasetRepository.FindByID(id)\n\t//err:=UserUsecase.userRepository.FindByID(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn Disease, nil\n}", "func (ds *DataStore) GetByID(id, url string) (todos.Todo, error) {\n\tvar todo todos.Todo\n\trow, err := ds.DB.Get(ds.ctx, id, nil)\n\tif err != nil {\n\t\treturn todo, fmt.Errorf(\"error getting doc with ID %s: %s\", id, err)\n\t}\n\tvar doc todoDoc\n\tif err := row.ScanDoc(&doc); err != nil {\n\t\treturn todo, fmt.Errorf(\"error scanning doc: %s\", err)\n\t}\n\ttodo = convertDocToTodo(doc)\n\ttodo.URL = url\n\n\treturn todo, nil\n}", "func (dp *dataProvider) GetUserByID(user *models.User) error {\n\t//Where(\"id = ?id\")\n\treturn wrapError(dp.db.Select(user))\n}", "func (d Datapoints) DatapointAt(n int) Datapoint { return d[n] }", "func (server *Server) GetUserPointByUserID(c *gin.Context) {\n\tuserID := c.Param(\"id\")\n\tconvertedUserID, err := strconv.ParseUint(userID, 10, 64)\n\tif err != nil {\n\t\tlog.Printf(err.Error())\n\t\terrList[\"invalid_request\"] = \"Invalid request\"\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"error\": errList,\n\t\t})\n\t\treturn\n\t}\n\n\tuserPoint := models.UserPoint{}\n\tuserPoints, err := userPoint.FindPointHistoryByUserID(server.DB, convertedUserID)\n\tif err != nil {\n\t\tlog.Printf(err.Error())\n\t\terrList[\"no_user\"] = \"No user found\"\n\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\"error\": errList,\n\t\t})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"response\": userPoints,\n\t})\n}", "func (c *Client) DatacenterGetForUserByID(datacenterName string, userID int) (*Datacenter, error) {\n\treturn c.datacenterGetForUser(datacenterName, userID)\n}", "func (p *TodoDAOPersister) GetByID(id string) (Todo, error) {\n\tlog.Printf(\"Getting Todo by ID: %v\", id)\n\t// Initialize return variable\n\tvar todo Todo\n\tvar todoBytes []byte\n\n\t// Get Todo\n\tif p.CacheActive {\n\t\t// Get todo from cache\n\t\tif b, err := p.Cache.Get(id); err == nil {\n\t\t\ttodoBytes = b\n\t\t}\n\t}\n\tif err := retry.Do(3, time.Duration(time.Millisecond*400), func() error {\n\t\t// Get todo from datastore\n\t\tb, err := p.DataStore.Get(id)\n\t\tif err == nil {\n\t\t\ttodoBytes = b\n\t\t}\n\t\treturn err\n\t}); err != nil {\n\t\treturn todo, err\n\t}\n\n\t// Unmarshal Json\n\treturn todo, json.Unmarshal(todoBytes, &todo)\n}", "func (h *JourneyRepository) GetByID(id int) (*models.Journey, error) {\n\tjourney := &models.Journey{}\n\tlog.Println(id)\n\tif err := h.Db.Set(\"gorm:auto_preload\", true).First(&journey, id).Error; err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\n\treturn journey, nil\n\n}", "func (s *LiftingStorage) GetByID(id int) (*lifting.Repetition, error) {\n\treps, err := s.getCollectionWithStruct(getByID, byID{ID: id})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(reps) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tif len(reps) > 1 {\n\t\treturn nil, fmt.Errorf(\"Multiple return values for SqliteStorage#GetByID, %v\", reps)\n\t}\n\n\treturn &reps[0], nil\n}", "func GetByID(ctx context.Context, client *v1.ServiceClient, domainID int) (*View, *v1.ResponseResult, error) {\n\turl := strings.Join([]string{client.Endpoint, strconv.Itoa(domainID)}, \"/\")\n\tresponseResult, err := client.DoRequest(ctx, http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif responseResult.Err != nil {\n\t\treturn nil, responseResult, responseResult.Err\n\t}\n\n\t// Extract a domain from the response body.\n\tdomain := &View{}\n\terr = responseResult.ExtractResult(domain)\n\tif err != nil {\n\t\treturn nil, responseResult, err\n\t}\n\n\treturn domain, responseResult, nil\n}", "func (lightingEvent *LightingEvent) GetByID(id int64) error {\n\tdb := database.Open()\n\tdefer database.Close(db)\n\trows, err := db.Query(\"SELECT * FROM lightingEvents WHERE id = ?\", id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rows.Close()\n\n\tfound := false\n\tfor rows.Next() {\n\t\tfound = true\n\t\terr = lightingEvent.getRow(rows)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif !found {\n\t\treturn errors.New(\"Event not found\")\n\t}\n\n\treturn nil\n}", "func (dao CompanyDAOPsql) GetByID(id int) (*models.Company, error) {\n\tquery := `SELECT id, identification_type_id, identification_number, verification_digit, company, address, phone, departments_id, cities_id, web, email, activity, autorretenedor, person_type_id, regime_type_id, taxpayer_type_id, logo, created_at, updated_at\n\t\t\t\tFROM companies WHERE id = $1`\n\tobj := &models.Company{}\n\tdb := get()\n\tdefer db.Close()\n\n\tstmt, err := db.Prepare(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer stmt.Close()\n\n\trow := stmt.QueryRow(id)\n\terr = dao.rowToObject(row, obj)\n\treturn obj, err\n}", "func (conn *Connection) GetByID(id interface{}, i interface{}) error {\n\treturn conn.collection.FindId(id).One(i)\n}", "func (db *DB) GetPerson(id string) (*Person, error) {\n\n\trow := db.QueryRow(\"select * from PERSON where ID=?\", id)\n\n\tperson := new(Person)\n\n\terr := row.Scan(&person.ID, &person.Firstname, &person.Lastname)\n\n\tif err == sql.ErrNoRows {\n\t\treturn nil, errors.New(\"No Person found matching your ID\")\n\t} else if err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\treturn person, nil\n}", "func GetPropiedadByID(c *gin.Context) {\n\tid := c.Params.ByName(\"id\")\n\tvar prop Models.Propiedad\n\terr := Models.GetPropiedadByID(&prop, id)\n\tif err != nil {\n\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\"error\" : gin.H { \n\t\t\t\"status\": http.StatusNotFound,\n\t\t\t\"message\": err.Error(),\n\t\t}})\n\t\tc.AbortWithStatus(http.StatusNotFound)\n\t} else {\n\t\tc.JSON(http.StatusOK, prop)\n\t}\n}", "func (d *dsCache) getByIdent(ident *cachedIdent) *cachedDs {\n\td.RLock()\n\tdefer d.RUnlock()\n\treturn d.byIdent[ident.String()]\n}", "func (c *DefaultApiController) DataDataIdGet(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tdataId, err := parseInt32Parameter(params[\"dataId\"])\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tresult, err := c.service.DataDataIdGet(r.Context(), dataId)\n\t//If an error occured, encode the error with the status code\n\tif err != nil {\n\t\tEncodeJSONResponse(err.Error(), &result.Code, w)\n\t\treturn\n\t}\n\t//If no error, encode the body and the result code\n\tEncodeJSONResponse(result.Body, &result.Code, w)\n\n}", "func ByID(ds datastore.Datastore, id int) (CPD, error) {\n\treturn cpdByID(ds, id)\n}", "func (s *IdeaStorage) GetByID(ideaID int) (*models.Idea, error) {\n\tfor _, idea := range s.ideas {\n\t\tif idea.ID == ideaID {\n\t\t\treturn idea, nil\n\t\t}\n\t}\n\treturn nil, app.ErrNotFound\n}", "func (dal *DataAccessLayer) GetTimeSeriesDatumByTenantIdAndCreatedAt(tenantId int64, timestamp int64) (*TimeSeriesDatum, error) {\n thing := TimeSeriesDatum{} // The struct which will be populated from the database.\n\n // DEVELOPERS NOTE:\n // (1) Lookup the thing based on the id.\n // (2) PostgreSQL uses an enumerated $1, $2, etc bindvar syntax\n err := dal.db.Get(&thing, \"SELECT * FROM data WHERE timestamp = $1 AND tenant_id = $2\", timestamp, tenantId)\n\n // Handling non existing item\n if err == sql.ErrNoRows {\n return nil, nil\n } else if err != nil {\n return nil, err\n }\n\n return &thing, nil\n}", "func (gdb *GostDatabase) GetDatastreamByObservation(observationID interface{}, qo *odata.QueryOptions) (*entities.Datastream, error) {\n\tintID, ok := ToIntID(observationID)\n\tif !ok {\n\t\treturn nil, gostErrors.NewRequestNotFound(errors.New(\"Datastream does not exist\"))\n\t}\n\n\tquery, qi := gdb.QueryBuilder.CreateQuery(&entities.Datastream{}, &entities.Observation{}, intID, qo)\n\treturn processDatastream(gdb.Db, query, qi)\n}", "func (us *UserService) GetByID(userID int) (*User, error) {\n\tu, err := us.Datasource.Get(userID)\n\n\tif err != nil {\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\treturn nil, httperror.NotFound(\"user\", fmt.Errorf(\"the user with id %d was not found\", userID))\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn u, nil\n}", "func (o JobExtractSourceModelPtrOutput) DatasetId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobExtractSourceModel) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.DatasetId\n\t}).(pulumi.StringPtrOutput)\n}", "func (bl *postBusiness) GetByID(id uint64) (*models.Post, *apperror.AppError) {\n\treturn bl.service.GetByID(id)\n}", "func (gi *Sensor) GetByUserID(db *pg.DB) (Sensor, error) {\r\n\tlog.Printf(\"===>sensorItem.GetByUserID(ID=%d)\", gi.ID)\r\n\r\n\t//getErr := db.Select(gi)\r\n\tgetErr := db.Model(gi).Where(\"id = ?0\", gi.ID).Select()\r\n\tif getErr != nil {\r\n\t\tlog.Printf(\"Error in GetByUserID while selecting item\\n\")\r\n\t\tlog.Printf(\"Reason %v\\n\", getErr)\r\n\t\treturn *gi, getErr\r\n\t}\r\n\tlog.Printf(\"Select successful in sensorItem.GetByUserID() sensor=%v\\n\", *gi)\r\n\treturn *gi, nil\r\n}", "func (db *ImageDB) GetMetdataByID(id primitive.ObjectID) (map[string]interface{}, error) {\n\tmetadata := make(map[string]interface{})\n\tif err := db.collection.FindOne(timeoutContext(), bson.M{\"_id\": id}).Decode(&metadata); err != nil {\n\t\treturn metadata, err\n\t}\n\treturn metadata[\"metadata\"].(map[string]interface{}), nil\n}", "func (s *Service) GetByID(param string) (*entity.Pokemon, error) {\n\tr := csv.NewReader(s.csvFile)\n\tdefer s.csvFile.Seek(0, 0)\n\tfor {\n\t\trecord, err := r.Read()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif record[0] == param {\n\t\t\tpokemonID, err := strconv.Atoi(record[0])\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t\tpokemon := entity.Pokemon{\n\t\t\t\tID: pokemonID,\n\t\t\t\tName: record[1],\n\t\t\t\tBaseExperience: record[2],\n\t\t\t}\n\n\t\t\treturn &pokemon, nil\n\t\t}\n\t}\n\treturn nil, errors.New(\"Pokemon not found\")\n}", "func (d *Datapoint) Data() interface{} {\n\treturn d.data\n}", "func (es *EventStore) FindByID(id string) (*Event, error) {\n\tstart := time.Now()\n\tdefer func() {\n\t\tmetrics.EventStoreLatency(\"Find\", start)\n\t}()\n\tevt, err := es.ds.FindByID(id, true)\n\tif err != nil {\n\t\tmetrics.DBError(\"read\")\n\t\treturn nil, errors.Wrap(err, \"Error executing find in data source\")\n\t}\n\tif evt == nil {\n\t\treturn nil, errors.New(\"Could not find event matching id \" + id)\n\t}\n\tpropertiesSchema := es.getTopicSchemaProperties(evt.TopicID)\n\tif evt.Data == nil {\n\t\tevt.Data = make(map[string]interface{})\n\t}\n\tes.insertDefaults(propertiesSchema, evt.Data)\n\treturn evt, nil\n}", "func (a *TodoAdapter) GetByID(ctx context.Context, id domain.ID) (todo.Todo, error) {\n\tspan, _ := opentracing.StartSpanFromContext(ctx, \"TodoAdapter-GetByID\")\n\tdefer span.Finish()\n\n\tvar t Todo\n\n\toid, err := primitive.ObjectIDFromHex(string(id))\n\n\tif err != nil {\n\t\treturn todo.DefaultTodo, err\n\t}\n\n\tfilter := bson.M{\"_id\": bson.M{\"$eq\": oid}}\n\n\terr = a.collection.FindOne(ctx, filter).Decode(&t)\n\n\tif err != nil {\n\t\treturn todo.DefaultTodo, err\n\t}\n\n\treturn t.ToModel(), nil\n}", "func (dao AccountPUCDAOPsql) GetByID(id int) (*models.AccountPUC, error) {\n\tquery := \"SELECT id, account, account_name, account_puc_parent_id, account_class_id, account_level_id, created_at, updated_at FROM accounts_puc WHERE id = $1\"\n\tobj := &models.AccountPUC{}\n\tdb := get()\n\tdefer db.Close()\n\n\tstmt, err := db.Prepare(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer stmt.Close()\n\n\trow := stmt.QueryRow(id)\n\terr = dao.rowToObject(row, obj)\n\treturn obj, err\n}", "func (c *Controller) GetPatientByID(id string) (*store.Patient, error) {\n\tpnt, err := c.store.GetPatientByID(id)\n\tif err != nil && err == store.ErrSearch {\n\t\tlog.Println(err)\n\t\treturn nil, ErrSearchInput\n\t} else if err != nil && err != store.ErrNotFound {\n\t\t// avoid leaking sensitive info\n\t\tlog.Println(err)\n\t\treturn nil, ErrLookingUpInfo\n\t}\n\n\t// patient not found\n\tif pnt == nil && err == store.ErrNotFound {\n\t\treturn nil, ErrNotFound\n\t}\n\n\treturn pnt, nil\n}", "func GetByID(ctx *routing.Context) error {\n\tlogger := logger.GetLogInstance(\"\", \"\")\n\tdb := ctx.Get(\"db\").(*gorm.DB)\n\n\tcmp := models.CampaingModel{}\n\n\tif err := db.Model(&[]dbmodels.Campaign{}).Where(\"id = ?\", ctx.Param(\"id\")).Scan(&cmp).Error; err != nil {\n\t\tlogger.Error(err)\n\t\tctx.Response.SetStatusCode(404)\n\t\tres := models.NewResponse(false, nil, \"not found\")\n\t\treturn ctx.WriteData(res.MustMarshal())\n\t}\n\tres := models.NewResponse(true, cmp, \"OK\")\n\treturn ctx.WriteData(res.MustMarshal())\n}", "func GetByID(rw http.ResponseWriter, r *http.Request) {\n\tuserID := r.Header.Get(\"userid\")\n\n\turlParams := strings.Replace(r.URL.String(), \"/api/getEvent/\", \"\", 1)\n\teventID := strings.Split(urlParams, \"/\")[0]\n\n\tif strings.TrimSpace(eventID) == \"\" {\n\t\tlog.Printf(\"Missing event id\\n\")\n\t\trw.WriteHeader(http.StatusBadRequest)\n\t\trw.Write([]byte(\"Event ID must be provided\"))\n\t\treturn\n\t}\n\n\tquery := `SELECT * FROM events\n\t\tWHERE owner_id = $1 \n\t\tAND id = $2`\n\n\te := Event{}\n\tloc := sql.NullString{}\n\tnotes := sql.NullString{}\n\n\terr := conn.DB.QueryRow(query, userID, eventID).Scan(&e.EventID, &e.Title, &e.StartTime, &e.EndTime, &loc, &notes, &e.OwnerID)\n\tif err != nil {\n\t\tlog.Printf(\"DB error: %s\\n\", err)\n\t\trw.WriteHeader(http.StatusNoContent)\n\t\trw.Write([]byte(\"Event not found\"))\n\t\treturn\n\t}\n\n\te.Location = loc.String\n\te.Notes = notes.String\n\n\trw.WriteHeader(http.StatusOK)\n\trw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(rw).Encode(e)\n}", "func (st *StressTest) GetPoint(name, precision string) models.Point {\n\tp := st.communes[name].point(precision)\n\n\t// Function needs to return a point. Panic if it doesn't\n\tif p == nil {\n\t\tlog.Fatal(\"Commune not returning point\")\n\t}\n\n\treturn p\n}", "func (s *Service) GetUserByID(userID int) (*Model, error) {\n\treturn s.usersByIDs[userID], nil\n}", "func GetByID(ctx *routing.Context) error {\n\tlogger := logger.GetLogInstance(\"\", \"\")\n\tdb := ctx.Get(\"db\").(*gorm.DB)\n\n\timg := []models.ImageModel{}\n\n\tif err := db.Model(&dbmodels.Image{}).Where(\"id = ?\", ctx.Param(\"id\")).Scan(&img).Error; err != nil {\n\t\tlogger.Error(err)\n\t\tctx.Response.SetStatusCode(404)\n\t\tres := models.NewResponse(false, nil, \"not found\")\n\t\treturn ctx.WriteData(res.MustMarshal())\n\t}\n\tres := models.NewResponse(true, img, \"OK\")\n\treturn ctx.WriteData(res.MustMarshal())\n}", "func (d *DermagaUsecaseProcess) GetByID(id int) (*model.Dermaga, error) {\n\treturn d.dermagaRepo.GetByID(id)\n}", "func (st *Student) GetStudentByID(id string) (Student, error) {\n\n\tdb := database.GetInstance().GetConnection()\n\tdefer db.Close()\n\n\ts := Student{}\n\n\terr := db.Where(\"active <> ?\", false).Select(\"id, name, age\").First(&s, id)\n\n\tif err != nil {\n\t\treturn s, err.Error\n\t}\n\n\treturn s, nil\n}", "func (o DatasetAccessRoutinePtrOutput) DatasetId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DatasetAccessRoutine) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.DatasetId\n\t}).(pulumi.StringPtrOutput)\n}", "func (c *Client) GetByID(data *GetByIDParams) (*xendit.Disbursement, *xendit.Error) {\n\treturn c.GetByIDWithContext(context.Background(), data)\n}", "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (k *KapalRepoMysql) GetByID(id int) (*model.Kapal, error) {\n\tqry := \"select kapal_id, kode_kapal, muatan, status from kapal where kapal_id = ? and is_delete = 0\"\n\n\tkapal := model.Kapal{}\n\n\terr := k.db.QueryRow(qry, id).Scan(&kapal.ID, &kapal.Kode, &kapal.Muatan, &kapal.Status)\n\tif err != nil {\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"[KapalRepoMysql.CreateTableRepoMysqlImpl.GetByID.QueryRow] Error when running query '\"+qry+\"' : %w\", err)\n\t}\n\treturn &kapal, nil\n}", "func GetByID(db *mongo.Client, ID string) (Record, error) {\n\tfilter := bson.D{{Key: \"id\", Value: ID}}\n\tctx, _ := context.WithTimeout(context.Background(), 3*time.Second)\n\tresult := db.Database(\"url-shortener\").Collection(\"urls\").FindOne(ctx, filter)\n\n\tvar record Record\n\tif result.Err() != nil {\n\t\treturn record, result.Err()\n\t}\n\tresult.Decode(&record)\n\treturn record, nil\n}", "func GetByDataUUID(dataUUID dvid.UUID) (*Data, error) {\n\tsource, err := datastore.GetDataByDataUUID(dataUUID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata, ok := source.(*Data)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Instance '%s' is not an annotation datatype!\", source.DataName())\n\t}\n\treturn data, nil\n}", "func (c *PatientInfoClient) GetX(ctx context.Context, id int) *PatientInfo {\n\tpi, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pi\n}", "func GetByUUIDName(uuid dvid.UUID, name dvid.InstanceName) (*Data, error) {\n\tsource, err := datastore.GetDataByUUIDName(uuid, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata, ok := source.(*Data)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Instance '%s' is not an annotation datatype!\", name)\n\t}\n\treturn data, nil\n}", "func (c Cache) GetHistogramDataPoint(identifier string) (*pmetric.HistogramDataPoint, bool) {\n\tpoint, found := c.histogramCache[identifier]\n\tif found {\n\t\tpoint.used = true\n\t\tc.histogramCache[identifier] = point\n\t}\n\treturn point.point, found\n}", "func (dao *FilingDaoImpl) GetByID(filingID string) (exists bool, filing *model.Filing, err error) {\n\tf := &Filing{ID: filingID}\n\terr = dao.db.Select(f)\n\tif err != nil {\n\t\tif err == pg.ErrNoRows {\n\t\t\treturn false, nil, nil\n\t\t}\n\t\treturn false, nil, err\n\t}\n\treturn true, f.export(), nil\n}", "func GetUserByID(person *Person, id string) (err error) {\n\tif err = Config.DB.Where(\"id = ?\", id).First(person).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func GetByID(session *mgo.Session, collection *mgo.Collection, id interface{}, i interface{}) {\n\tsession.Refresh()\n\tcollection.FindId(id).One(i)\n}", "func (c *WrappedGauge) DataPoint() *DataPoint {\n\tgottenValue, err := c.value.Get()\n\tif err != nil {\n\t\treturn nil\n\t}\n\tvalue, err := toInt64(gottenValue)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn &DataPoint{\n\t\tMetric: c.metric,\n\t\tTimestamp: time.Now(),\n\t\tType: GaugeType,\n\t\tDimensions: c.dimensions,\n\t\tValue: value,\n\t}\n}", "func (mdb *MockDynamo) GetArticleByID(id int) (models.Article, error) {\n\tarticle := mdb.ArticlesTable[id]\n\t//Check to see if key contains non-zero value\n\tif article == (models.Article{}) {\n\t\treturn models.Article{}, ErrResourceNotFound\n\t}\n\treturn article, nil\n}", "func (t *Datastore) GetTracepoint(tracepointID uuid.UUID) (*storepb.TracepointInfo, error) {\n\tresp, err := t.ds.Get(getTracepointKey(tracepointID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp == nil {\n\t\treturn nil, nil\n\t}\n\n\ttracepointPb := &storepb.TracepointInfo{}\n\terr = proto.Unmarshal(resp, tracepointPb)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn tracepointPb, nil\n}", "func (e *Entity) GetElementByID(string) Object { return nil }", "func GetHNSEndpointByID(endpointID string) (*HNSEndpoint, error) {\n\treturn HNSEndpointRequest(\"GET\", endpointID, \"\")\n}", "func GetAwardByID(data, id interface{}) error {\n\tdb := common.GetDB()\n\terr := db.Where(\"id = ?\", id).First(data).Error\n\treturn err\n}", "func (r *PackageAggRow) GetID() string { return *r.Data.ID }", "func (db *ImageDB) DownloadByID(id primitive.ObjectID) (bytes.Buffer, error) {\n\tbucket, _ := gridfs.NewBucket(\n\t\tdb.database,\n\t)\n\tbuf := bytes.Buffer{}\n\t_, err := bucket.DownloadToStream(id, &buf)\n\treturn buf, err\n}", "func SeriesByID(id string, embeds string) (*Series, *Error) {\n\treturn fetchOneSeries(request{\"GET\", \"/series/\" + id, nil, nil, nil, embeds})\n}", "func (g *StableGauge) DataPoint() *DataPoint {\n\tdp := g.gauge.DataPoint()\n\tif dp.Value == atomic.LoadInt64(&g.prevValue) {\n\t\t// Value is the same, don't report it\n\t\treturn nil\n\t}\n\tatomic.StoreInt64(&g.prevValue, dp.Value)\n\treturn dp\n}", "func (*SeatDataAccessObject) FindByID(seatID int) *Seat {\n\tvar seat Seat\n\thas, err := orm.Table(seat).ID(seatID).Get(&seat)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif !has {\n\t\treturn nil\n\t}\n\treturn &seat\n}", "func GetByID(id string, doc interface{}) {\n\tif err := DB.GetDocument(id, doc, nil); err != nil {\n\t\tlog.Println(err)\n\t}\n}", "func (ds Dataset) ID() string {\n\treturn ds.id\n}", "func (s *PersonFieldsService) GetByID(ctx context.Context, id int) (*PersonFieldResponse, *Response, error) {\n\turi := fmt.Sprintf(\"/personFields/%v\", id)\n\treq, err := s.client.NewRequest(http.MethodGet, uri, nil, nil)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar record *PersonFieldResponse\n\n\tresp, err := s.client.Do(ctx, req, &record)\n\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn record, resp, nil\n}", "func (s *Service) GetPatientByID(id string) (*models.Patient, error) {\n\tpatient, err := s.db.GetPatientByID(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn patient, nil\n}", "func GetEventByID(id string) (EventCacheResponse, error) {\n\tdb, err := getDatabase()\n\tvar r EventCacheResponse\n\n\tif err != nil {\n\t\treturn r, err\n\t}\n\n\tdefer db.Close()\n\n\tstmt, err := db.Prepare(\"select id, json, transport, event from events where id = ?\")\n\tif err != nil {\n\t\treturn r, err\n\t}\n\tdefer stmt.Close()\n\n\terr = stmt.QueryRow(id).Scan(&r.ID, &r.JSON, &r.Transport, &r.Event)\n\tif err != nil {\n\t\treturn r, err\n\t}\n\n\treturn r, err\n}", "func (c *PatientofphysicianClient) GetX(ctx context.Context, id int) *Patientofphysician {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c Cache) GetSummaryDataPoint(identifier string) (*pmetric.SummaryDataPoint, bool) {\n\tpoint, found := c.summaryCache[identifier]\n\tif found {\n\t\tpoint.used = true\n\t\tc.summaryCache[identifier] = point\n\t}\n\treturn point.point, found\n}", "func (g *Gauge) DataPoint() *DataPoint {\n\treturn &DataPoint{\n\t\tMetric: g.metric,\n\t\tTimestamp: time.Now(),\n\t\tType: GaugeType,\n\t\tDimensions: g.dimensions,\n\t\tValue: atomic.LoadInt64(&g.value),\n\t}\n}", "func (c *PhysicianClient) GetX(ctx context.Context, id int) *Physician {\n\tph, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ph\n}", "func (c *PhysicianClient) GetX(ctx context.Context, id int) *Physician {\n\tph, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ph\n}", "func GetByUUID(uuid dvid.UUID, name dvid.InstanceName) (*Data, error) {\n\tsource, err := datastore.GetDataByUUID(uuid, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata, ok := source.(*Data)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Instance '%s' is not a labelsurf datatype!\", name)\n\t}\n\treturn data, nil\n}", "func (d *Data) GetLabelAtPoint(v dvid.VersionID, pt dvid.Point) (uint64, error) {\n\t/*\n\t\tuuid, err := datastore.UUIDFromVersion(v)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\t// Get the associated labelvol\n\t\tlabelvolData, err := labelvol.GetByUUID(uuid, d.SparseVol)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\t// Then see if we have an associated labelblk to this labelvol. If not we can't do point query.\n\t\tlabelblkName := labelvolData.Link\n\n\t\t// Get the associated labelblk data instance to do the point query\n\t\tlabelblkData, err := labelblk.GetByUUID(uuid, labelblkName)\n\n\t\t// Do the point query\n\t\tlabelBytes, err := labelblkData.GetLabelBytesAtPoint(v, pt)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\treturn binary.LittleEndian.Uint64(labelBytes), nil\n\t*/\n\treturn 0, nil\n}", "func (s *Instance) GetByID(instanceID string) (*internal.Instance, error) {\n\tsess := s.NewReadSession()\n\tinstanceDTO := dbmodel.InstanceDTO{}\n\tvar lastErr dberr.Error\n\terr := wait.PollImmediate(defaultRetryInterval, defaultRetryTimeout, func() (bool, error) {\n\t\tinstanceDTO, lastErr = sess.GetInstanceByID(instanceID)\n\t\tif lastErr != nil {\n\t\t\tif dberr.IsNotFound(lastErr) {\n\t\t\t\treturn false, dberr.NotFound(\"Instance with id %s not exist\", instanceID)\n\t\t\t}\n\t\t\tlog.Errorf(\"while getting instanceDTO by ID %s: %v\", instanceID, lastErr)\n\t\t\treturn false, nil\n\t\t}\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn nil, lastErr\n\t}\n\tinstance, err := s.toInstance(instanceDTO)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlastOp, err := s.operations.GetLastOperation(instanceID)\n\tif err != nil {\n\t\tif dberr.IsNotFound(err) {\n\t\t\treturn &instance, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\tinstance.InstanceDetails = lastOp.InstanceDetails\n\treturn &instance, nil\n}", "func (o JobExtractSourceTablePtrOutput) DatasetId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobExtractSourceTable) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DatasetId\n\t}).(pulumi.StringPtrOutput)\n}", "func (c *Client) SeriesByID(id int) (*Series, error) {\n\tvar data SeriesData\n\tfullURL := c.URL(fmt.Sprintf(\"/series/%d\", id))\n\tif err := c.get(fullURL, &data, withLanguage(c.options.Language)); err != nil {\n\t\treturn nil, err\n\t}\n\treturn data.Data, nil\n}", "func (c *DentistClient) GetX(ctx context.Context, id int) *Dentist {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "func (ec *EventController) GetByID(ctx context.Context, id primitive.ObjectID) (*Event, error) {\n\tvar event Event\n\teventResult := ec.collection.FindOne(ctx, bson.M{\"_id\": id})\n\tif eventResult.Err() != nil {\n\t\tif eventResult.Err() == mongo.ErrNoDocuments {\n\t\t\treturn nil, errors.NewServerError(\"No events found\", http.StatusNotFound)\n\t\t}\n\t\treturn nil, eventResult.Err()\n\t}\n\n\teventResult.Decode(&event)\n\n\treturn &event, nil\n}", "func (gdb *GostDatabase) GetDatastream(id interface{}, qo *odata.QueryOptions) (*entities.Datastream, error) {\n\tintID, ok := ToIntID(id)\n\tif !ok {\n\t\treturn nil, gostErrors.NewRequestNotFound(errors.New(\"Datastream does not exist\"))\n\t}\n\n\tquery, qi := gdb.QueryBuilder.CreateQuery(&entities.Datastream{}, nil, intID, qo)\n\tdatastream, err := processDatastream(gdb.Db, query, qi)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif qo != nil {\n\t\thasSelectQuery := (qo.Select != nil)\n\t\tvar containsObservedArea = true\n\t\tif hasSelectQuery {\n\t\t\tcontainsObservedArea = ContainsToLower(qo.Select.SelectItems, \"observedArea\")\n\t\t}\n\n\t\t// calculate observedArea on the fly when not present in database\n\t\tif containsObservedArea {\n\t\t\tif datastream.ObservedArea == nil {\n\t\t\t\tobservedArea, _ := gdb.GetObservedArea(intID)\n\t\t\t\tdatastream.ObservedArea = observedArea\n\t\t\t}\n\t\t}\n\t}\n\n\treturn datastream, nil\n}", "func (s *InstanceBindData) Get(iID internal.InstanceID) (*internal.InstanceBindData, error) {\n\tif iID.IsZero() {\n\t\treturn nil, errors.New(\"both instance and operation id must be set\")\n\t}\n\n\tresp, err := s.kv.Get(context.TODO(), s.key(iID))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"while calling database\")\n\t}\n\n\tswitch resp.Count {\n\tcase 1:\n\tcase 0:\n\t\treturn nil, notFoundError{}\n\tdefault:\n\t\treturn nil, errors.New(\"more than one element matching requested id, should never happen\")\n\t}\n\n\treturn s.decodeDSOToDM(resp.Kvs[0].Value)\n}", "func (a *paymentUsecase) GetByID(c context.Context, id int64) (*models.Payment, error) {\n\tctx, cancel := context.WithTimeout(c, a.contextTimeout)\n\tdefer cancel()\n\n\tres, err := a.repo.GetByID(ctx, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}", "func (r *CampaignRow) GetID() string { return r.Data.ID }", "func (r *CampaignRow) GetID() string { return r.Data.ID }", "func (s *ArticlesService) GetByID(id uint) (models.Article, error) {\n\tvar article models.Article\n\terr := s.db.First(&article, id).Error\n\treturn article, err\n}", "func GetPerson(id string) (*Person, error) {\n\tfor _, p := range all() {\n\t\tif p.ID == id {\n\t\t\treturn &p, nil\n\t\t}\n\t}\n\n\treturn nil, errors.New(\"Person not found\")\n}", "func (c *DoctorClient) GetX(ctx context.Context, id int) *Doctor {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "func (a *ArticleHandler) GetByID(c *gin.Context) {\n\ti, err := strconv.Atoi(c.Param(\"id\"))\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusNotFound, domain.ErrNotFound.Error())\n\t\treturn\n\t}\n\n\tid := int64(i)\n\tctx, cancel := context.WithCancel(c)\n\tdefer cancel()\n\n\tar, err := a.ArticleUsecase.GetByID(ctx, id)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(getStatusCode(err), ResponseError{Message: err.Error()})\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, ar)\n}" ]
[ "0.6412124", "0.6151225", "0.61227614", "0.5906473", "0.5903145", "0.5848986", "0.58184546", "0.57869554", "0.5733625", "0.5729925", "0.5715823", "0.56466913", "0.5554012", "0.55272156", "0.540155", "0.53998554", "0.5389559", "0.53856915", "0.5385416", "0.53666097", "0.53664446", "0.5357778", "0.53557104", "0.5354468", "0.5351102", "0.5321917", "0.5280269", "0.52787167", "0.5277667", "0.52768105", "0.5276115", "0.5249028", "0.52489144", "0.5247462", "0.5239536", "0.5235913", "0.52326685", "0.52287245", "0.52279675", "0.52256054", "0.5217893", "0.52172893", "0.52042365", "0.52030975", "0.5194718", "0.51902795", "0.5186559", "0.51857716", "0.51783276", "0.5166861", "0.5166772", "0.5159472", "0.5159472", "0.5159472", "0.51568264", "0.5154256", "0.51538914", "0.51483625", "0.5146537", "0.5144201", "0.5143684", "0.51423657", "0.5140925", "0.5132991", "0.51325834", "0.5124562", "0.5110759", "0.51035637", "0.5097755", "0.5095137", "0.5092811", "0.50818163", "0.5081", "0.50782907", "0.50710356", "0.5070677", "0.5063597", "0.5060149", "0.5060097", "0.50551534", "0.5054314", "0.50530165", "0.50470483", "0.50470483", "0.50468904", "0.5045355", "0.5042563", "0.50362605", "0.5036048", "0.503342", "0.50306934", "0.5028101", "0.50176674", "0.50091213", "0.50056714", "0.50056714", "0.5003974", "0.49998277", "0.49990124", "0.49973777" ]
0.81728685
0
NewDeleteCoreV1NamespacedPodOK creates DeleteCoreV1NamespacedPodOK with default headers values
func NewDeleteCoreV1NamespacedPodOK() *DeleteCoreV1NamespacedPodOK { return &DeleteCoreV1NamespacedPodOK{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewDeleteCoreV1NamespacedServiceOK() *DeleteCoreV1NamespacedServiceOK {\n\treturn &DeleteCoreV1NamespacedServiceOK{}\n}", "func NewCreateCoreV1NamespacedPodOK() *CreateCoreV1NamespacedPodOK {\n\treturn &CreateCoreV1NamespacedPodOK{}\n}", "func NewDeleteCoreV1NamespacedPodUnauthorized() *DeleteCoreV1NamespacedPodUnauthorized {\n\n\treturn &DeleteCoreV1NamespacedPodUnauthorized{}\n}", "func NewDeleteCoreV1NamespacedEventOK() *DeleteCoreV1NamespacedEventOK {\n\treturn &DeleteCoreV1NamespacedEventOK{}\n}", "func NewDeleteCoreV1NamespacedConfigMapOK() *DeleteCoreV1NamespacedConfigMapOK {\n\n\treturn &DeleteCoreV1NamespacedConfigMapOK{}\n}", "func (o *DeleteCoreV1NamespacedPodOK) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodOK {\n\to.Payload = payload\n\treturn o\n}", "func NewCreateCoreV1NamespacedPodUnauthorized() *CreateCoreV1NamespacedPodUnauthorized {\n\treturn &CreateCoreV1NamespacedPodUnauthorized{}\n}", "func NewReadCoreV1NamespacedPodOK() *ReadCoreV1NamespacedPodOK {\n\treturn &ReadCoreV1NamespacedPodOK{}\n}", "func NewDeleteCoreV1NamespacedPodAccepted() *DeleteCoreV1NamespacedPodAccepted {\n\n\treturn &DeleteCoreV1NamespacedPodAccepted{}\n}", "func NewDeleteCoreV1NamespacedServiceUnauthorized() *DeleteCoreV1NamespacedServiceUnauthorized {\n\treturn &DeleteCoreV1NamespacedServiceUnauthorized{}\n}", "func Delete(kind string, name string, namespace string, args ...string) (err error) {\n\tdeleteArgs := []string{\"delete\", kind, name, \"-n\", namespace}\n\t_, err = kubectl(append(deleteArgs, args...)...)\n\treturn\n}", "func NewCreateCoreV1NamespacedPodBindingOK() *CreateCoreV1NamespacedPodBindingOK {\n\n\treturn &CreateCoreV1NamespacedPodBindingOK{}\n}", "func NewDeleteCoreV1NamespacedServiceAccount(ctx *middleware.Context, handler DeleteCoreV1NamespacedServiceAccountHandler) *DeleteCoreV1NamespacedServiceAccount {\n\treturn &DeleteCoreV1NamespacedServiceAccount{Context: ctx, Handler: handler}\n}", "func NewDeleteCoreV1NamespacedConfigMapUnauthorized() *DeleteCoreV1NamespacedConfigMapUnauthorized {\n\n\treturn &DeleteCoreV1NamespacedConfigMapUnauthorized{}\n}", "func NewWatchCoreV1NamespacedEndpointsOK() *WatchCoreV1NamespacedEndpointsOK {\n\n\treturn &WatchCoreV1NamespacedEndpointsOK{}\n}", "func NewDeleteCoreV1NamespacedEventUnauthorized() *DeleteCoreV1NamespacedEventUnauthorized {\n\treturn &DeleteCoreV1NamespacedEventUnauthorized{}\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenOK() *CreateCoreV1NamespacedServiceAccountTokenOK {\n\n\treturn &CreateCoreV1NamespacedServiceAccountTokenOK{}\n}", "func newPod(ctx context.Context, cl client.Client, ns, name, image string, cmd []string) (*corev1.Pod, error) {\n\tc := corev1.Container{\n\t\tName: name,\n\t\tImage: image,\n\t\tCommand: cmd,\n\t}\n\tp := &corev1.Pod{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: ns,\n\t\t},\n\t\tSpec: corev1.PodSpec{\n\t\t\tContainers: []corev1.Container{c},\n\t\t\t// Kill the pod immediately so it exits quickly on deletion.\n\t\t\tTerminationGracePeriodSeconds: pointer.Int64Ptr(0),\n\t\t},\n\t}\n\tif err := cl.Create(ctx, p); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create pod %s/%s: %v\", p.Namespace, p.Name, err)\n\t}\n\treturn p, nil\n}", "func NewDeleteCommand() *cobra.Command {\n\tvar (\n\t\tall bool\n\t\tcompleted bool\n\t)\n\n\tvar command = &cobra.Command{\n\t\tUse: \"delete WORKFLOW\",\n\t\tShort: \"delete a managed and its associated pods\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\twfClient = InitManagedClient()\n\t\t\tif all {\n\t\t\t\tdeleteManageds(metav1.ListOptions{})\n\t\t\t\treturn\n\t\t\t} else if completed {\n\t\t\t\toptions := metav1.ListOptions{\n\t\t\t\t\tLabelSelector: fmt.Sprintf(\"%s=true\", common.LabelKeyCompleted),\n\t\t\t\t}\n\t\t\t\tdeleteManageds(options)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif len(args) == 0 {\n\t\t\t\tcmd.HelpFunc()(cmd, args)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tfor _, wfName := range args {\n\t\t\t\tdeleteManaged(wfName)\n\t\t\t}\n\t\t},\n\t}\n\n\tcommand.Flags().BoolVar(&all, \"all\", false, \"Delete all manageds\")\n\tcommand.Flags().BoolVar(&completed, \"completed\", false, \"Delete completed manageds\")\n\treturn command\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenOK() *CreateCoreV1NamespacedServiceAccountTokenOK {\n\treturn &CreateCoreV1NamespacedServiceAccountTokenOK{}\n}", "func NewPatchCoreV1NamespacedServiceAccountOK() *PatchCoreV1NamespacedServiceAccountOK {\n\treturn &PatchCoreV1NamespacedServiceAccountOK{}\n}", "func NewWatchCoreV1NamespacedPodTemplateListOK() *WatchCoreV1NamespacedPodTemplateListOK {\n\treturn &WatchCoreV1NamespacedPodTemplateListOK{}\n}", "func genericPodDelete(label, namespace string, clientset *kubernetes.Clientset) error {\n\n\tvar name string\n\t//Getting all pods in litmus Namespace\n\tpods, err := clientset.CoreV1().Pods(namespace).List(context.TODO(), metav1.ListOptions{})\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to get pods in %v namespace, err: %v\", err)\n\t}\n\n\tklog.Infof(\"[Info]: Selecting pod with label %v for reboot\", label)\n\tfor i := range pods.Items {\n\t\tif pods.Items[i].Labels[\"component\"] == label {\n\t\t\tname = pods.Items[i].Name\n\t\t}\n\t}\n\tklog.Infof(\"[Info]: Deleting the Pod : %v\", name)\n\terr = clientset.CoreV1().Pods(\"litmus\").Delete(context.TODO(), name, metav1.DeleteOptions{})\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to delete %v pod, err: %v\", name, err)\n\t}\n\tklog.Infof(\"[Info]: %v pod deleted successfully \\n\", name)\n\treturn nil\n}", "func NewCreateCoreV1NamespacedPodBindingUnauthorized() *CreateCoreV1NamespacedPodBindingUnauthorized {\n\n\treturn &CreateCoreV1NamespacedPodBindingUnauthorized{}\n}", "func NewDeleteCoreV1PersistentVolumeOK() *DeleteCoreV1PersistentVolumeOK {\n\treturn &DeleteCoreV1PersistentVolumeOK{}\n}", "func NewCreateCoreV1NamespacedPodCreated() *CreateCoreV1NamespacedPodCreated {\n\treturn &CreateCoreV1NamespacedPodCreated{}\n}", "func NewReadCoreV1NamespacedEndpointsOK() *ReadCoreV1NamespacedEndpointsOK {\n\treturn &ReadCoreV1NamespacedEndpointsOK{}\n}", "func deletePod(clientset kubernetes.Interface, namespace string, name string) error {\n\treturn clientset.CoreV1().Pods(namespace).Delete(name, &metav1.DeleteOptions{GracePeriodSeconds: &immediate})\n}", "func TestDeletePod(t *testing.T) {\n\tcluster := NewClusterState()\n\tvpa := addTestVpa(cluster)\n\tpod := addTestPod(cluster)\n\tassert.NoError(t, cluster.DeletePod(pod.ID))\n\tassert.Empty(t, vpa.Pods)\n}", "func NewCreateCoreV1NamespacedPodAccepted() *CreateCoreV1NamespacedPodAccepted {\n\treturn &CreateCoreV1NamespacedPodAccepted{}\n}", "func NewGcpKmsDeleteOK() *GcpKmsDeleteOK {\n\treturn &GcpKmsDeleteOK{}\n}", "func NewDelSubDeviceWithCoreRequestWithoutParam() *DelSubDeviceWithCoreRequest {\n\n return &DelSubDeviceWithCoreRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/instances/{instanceId}/products/{productKey}/edges/{edgeName}:delSubDevice\",\n Method: \"POST\",\n Header: nil,\n Version: \"v2\",\n },\n }\n}", "func DeletePod(ctx cli.Context) error {\n\tif len(ctx.Args) == 0 {\n\t\treturn fmt.Errorf(\"Usage: puctl infra delete-pod [patterns]\")\n\t}\n\n\twf := cli.NewWorkFlowEngine(\n\t\tcli.NewWorkflowStep(\"\", findPods),\n\t\tcli.NewWorkflowStep(\"Deleting pods\", deletePods),\n\t)\n\n\terr := wf.Run(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(\"Finished!\")\n\n\treturn nil\n}", "func (o *DeleteCoreV1NamespacedPodOK) 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}", "func NewDeleteAPIKeyDefault(code int) *DeleteAPIKeyDefault {\n\treturn &DeleteAPIKeyDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDeleteConsulDefault(code int) *DeleteConsulDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &DeleteConsulDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenUnauthorized() *CreateCoreV1NamespacedServiceAccountTokenUnauthorized {\n\n\treturn &CreateCoreV1NamespacedServiceAccountTokenUnauthorized{}\n}", "func Delete(k8sClient client.Client, obj client.Object) error {\n\treturn k8sClient.Delete(context.TODO(), obj)\n}", "func NewDeleteRegistryOK() *DeleteRegistryOK {\n\treturn &DeleteRegistryOK{}\n}", "func (client *PacketCoreDataPlanesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, packetCoreDataPlaneName string, options *PacketCoreDataPlanesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}\"\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 packetCoreControlPlaneName == \"\" {\n\t\treturn nil, errors.New(\"parameter packetCoreControlPlaneName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{packetCoreControlPlaneName}\", url.PathEscape(packetCoreControlPlaneName))\n\tif packetCoreDataPlaneName == \"\" {\n\t\treturn nil, errors.New(\"parameter packetCoreDataPlaneName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{packetCoreDataPlaneName}\", url.PathEscape(packetCoreDataPlaneName))\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, 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-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func NewPod(namespace, name, nodeName string, opts *NewPodOptions) *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\tName: name,\n\t\t\tNamespace: namespace,\n\t\t\tLabels: map[string]string{},\n\t\t\tAnnotations: map[string]string{},\n\t\t},\n\t\tSpec: corev1.PodSpec{\n\t\t\tNodeName: nodeName,\n\t\t\tAffinity: &corev1.Affinity{},\n\t\t\tContainers: []corev1.Container{\n\t\t\t\t{\n\t\t\t\t\tName: name,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tif opts != nil {\n\t\tpod.CreationTimestamp = opts.CreationTimestamp\n\n\t\tpod.Spec.Containers[0].Resources = opts.Resources\n\n\t\tif opts.Annotations != nil {\n\t\t\tfor key, value := range opts.Annotations {\n\t\t\t\tpod.Annotations[key] = value\n\t\t\t}\n\t\t}\n\t\tif opts.Labels != nil {\n\t\t\tfor key, value := range opts.Labels {\n\t\t\t\tpod.Labels[key] = value\n\t\t\t}\n\t\t}\n\t\tif opts.NodeSelector != nil {\n\t\t\tpod.Spec.NodeSelector = map[string]string{}\n\t\t\tfor key, value := range opts.NodeSelector {\n\t\t\t\tpod.Spec.NodeSelector[key] = value\n\t\t\t}\n\t\t}\n\t\tpod.Status.Phase = opts.Phase\n\t\tpod.Status.Reason = opts.Reason\n\t\tpod.Status.ContainerStatuses = opts.ContainerStatuses\n\t\tpod.Spec.Tolerations = append(pod.Spec.Tolerations, opts.Tolerations...)\n\t\tpod.Spec.Affinity = &opts.Affinity\n\t}\n\n\tif nodeName != \"\" {\n\t\tutilaffinity.ReplaceNodeNameNodeAffinity(pod.Spec.Affinity, nodeName)\n\t}\n\n\treturn pod\n}", "func NewDeleteCoreV1CollectionNamespacedLimitRangeOK() *DeleteCoreV1CollectionNamespacedLimitRangeOK {\n\n\treturn &DeleteCoreV1CollectionNamespacedLimitRangeOK{}\n}", "func NewDeleteRuntimeContainerOK() *DeleteRuntimeContainerOK {\n\n\treturn &DeleteRuntimeContainerOK{}\n}", "func NewDeleteZoneDefault(code int) *DeleteZoneDefault {\n\treturn &DeleteZoneDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenUnauthorized() *CreateCoreV1NamespacedServiceAccountTokenUnauthorized {\n\treturn &CreateCoreV1NamespacedServiceAccountTokenUnauthorized{}\n}", "func NewGcpKmsDeleteDefault(code int) *GcpKmsDeleteDefault {\n\treturn &GcpKmsDeleteDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewS3GroupDeleteDefault(code int) *S3GroupDeleteDefault {\n\treturn &S3GroupDeleteDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewPatchCoreV1NamespacedServiceAccountUnauthorized() *PatchCoreV1NamespacedServiceAccountUnauthorized {\n\treturn &PatchCoreV1NamespacedServiceAccountUnauthorized{}\n}", "func NewDeleteTagDefault(code int) *DeleteTagDefault {\n\treturn &DeleteTagDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDeleteTagDefault(code int) *DeleteTagDefault {\n\treturn &DeleteTagDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDeleteCrossConnectDefault(code int) *DeleteCrossConnectDefault {\n\treturn &DeleteCrossConnectDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (client *PrivateDNSZoneGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string, options *PrivateDNSZoneGroupsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}\"\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 privateEndpointName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateEndpointName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateEndpointName}\", url.PathEscape(privateEndpointName))\n\tif privateDNSZoneGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateDNSZoneGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateDnsZoneGroupName}\", url.PathEscape(privateDNSZoneGroupName))\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.MethodDelete, 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-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func DeleteOperator(namespace string) error {\n\tif namespace == \"\" {\n\t\tnamespace = DEFAULT_NAMESPACE\n\t}\n\tif err := sh.RunV(\"helm\", \"delete\", \"-n\", namespace, \"kedahttp\"); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (o *DeleteCoreV1NamespacedPodAccepted) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodAccepted {\n\to.Payload = payload\n\treturn o\n}", "func NewIpspaceDeleteOK() *IpspaceDeleteOK {\n\treturn &IpspaceDeleteOK{}\n}", "func DeletePod(repoName, namespace string, clientset *kubernetes.Clientset) error {\n\n\t//Setting the label for deleting a Pod\n\tswitch repoName {\n\tcase \"litmusportal-frontend\":\n\t\tif err := genericPodDelete(\"litmusportal-frontend\", namespace, clientset); err != nil {\n\t\t\treturn errors.Errorf(\"Failed to delete pod for repo %v, err: %v\", repoName, err)\n\t\t}\n\tcase \"litmusportal-server\", \"litmusportal-auth-server\":\n\t\tif err := genericPodDelete(\"litmusportal-server\", namespace, clientset); err != nil {\n\t\t\treturn errors.Errorf(\"Failed to delete pod for repo %v, err: %v\", repoName, err)\n\t\t}\n\tdefault:\n\t\treturn errors.Errorf(\"No Appropriate Operation Found!\")\n\t}\n\treturn nil\n}", "func NewDeleteCoreV1NamespacedServiceAccepted() *DeleteCoreV1NamespacedServiceAccepted {\n\treturn &DeleteCoreV1NamespacedServiceAccepted{}\n}", "func NewGroupDeletesOK() *GroupDeletesOK {\n\treturn &GroupDeletesOK{}\n}", "func (o *DeleteCoreV1NamespacedConfigMapOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteCoreV1NamespacedConfigMapOK {\n\to.Payload = payload\n\treturn o\n}", "func (k *kubectlContext) Delete(args ...string) error {\n\tout, err := k.do(append([]string{\"delete\"}, args...)...)\n\tk.t.Log(string(out))\n\treturn err\n}", "func NewIPServicePolicyDeleteOK() *IPServicePolicyDeleteOK {\n\treturn &IPServicePolicyDeleteOK{}\n}", "func (s *Server) DeletePods(ctx context.Context, in *datahub_v1alpha1.DeletePodsRequest) (*status.Status, error) {\n\tscope.Debug(\"Request received from DeletePods grpc function: \" + utils.InterfaceToString(in))\n\n\tvar containerDAO cluster_status_dao.ContainerOperation = &cluster_status_dao_impl.Container{\n\t\tInfluxDBConfig: *s.Config.InfluxDB,\n\t}\n\tif err := containerDAO.DeletePods(in.GetPods()); err != nil {\n\t\tscope.Errorf(\"DeletePods failed: %+v\", err)\n\t\treturn &status.Status{\n\t\t\tCode: int32(code.Code_INTERNAL),\n\t\t\tMessage: err.Error(),\n\t\t}, nil\n\t}\n\treturn &status.Status{\n\t\tCode: int32(code.Code_OK),\n\t}, nil\n}", "func DeletePod(ci coreclient.CoreV1Interface, pod *corev1.Pod, timeout time.Duration) error {\n\tctx, cancel := context.WithTimeout(context.Background(), timeout)\n\tdefer cancel()\n\terr := ci.Pods(pod.Namespace).Delete(ctx, pod.Name, metav1.DeleteOptions{})\n\treturn err\n}", "func (g genericPlugin) Delete(resource helm.KubernetesResource, namespace string, client plugin.KubernetesConnector) error {\n\tif namespace == \"\" {\n\t\tnamespace = \"default\"\n\t}\n\n\tdynClient := client.GetDynamicClient()\n\tmapper := client.GetMapper()\n\n\tmapping, err := mapper.RESTMapping(schema.GroupKind{\n\t\tGroup: resource.GVK.Group,\n\t\tKind: resource.GVK.Kind,\n\t}, resource.GVK.Version)\n\tif err != nil {\n\t\treturn pkgerrors.Wrap(err, \"Mapping kind to resource error\")\n\t}\n\n\tgvr := mapping.Resource\n\tdeletePolicy := metav1.DeletePropagationForeground\n\topts := &metav1.DeleteOptions{\n\t\tPropagationPolicy: &deletePolicy,\n\t}\n\n\tswitch mapping.Scope.Name() {\n\tcase meta.RESTScopeNameNamespace:\n\t\terr = dynClient.Resource(gvr).Namespace(namespace).Delete(resource.Name, opts)\n\tcase meta.RESTScopeNameRoot:\n\t\terr = dynClient.Resource(gvr).Delete(resource.Name, opts)\n\tdefault:\n\t\treturn pkgerrors.New(\"Got an unknown RESTSCopeName for mapping: \" + resource.GVK.String())\n\t}\n\n\tif err != nil {\n\t\treturn pkgerrors.Wrap(err, \"Delete object error\")\n\t}\n\treturn nil\n}", "func NewS3GroupDeleteOK() *S3GroupDeleteOK {\n\treturn &S3GroupDeleteOK{}\n}", "func TestDeleteWithRetry(t *testing.T) {\n\tscheme, codecs := testScheme(t)\n\tcodec := apitesting.TestCodec(codecs, examplev1.SchemeGroupVersion)\n\tserver := etcdtesting.NewEtcdTestClientServer(t)\n\tdefer server.Terminate(t)\n\tprefix := path.Join(\"/\", etcdtest.PathPrefix())\n\n\tobj := &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: \"foo\", UID: \"A\"}}\n\t// fakeGet returns a large ModifiedIndex to emulate the case that another\n\t// party has updated the object.\n\tfakeGet := func(ctx context.Context, key string, opts *etcd.GetOptions) (*etcd.Response, error) {\n\t\tdata, _ := runtime.Encode(codec, obj)\n\t\treturn &etcd.Response{Node: &etcd.Node{Value: defaultPrefixValue(data), ModifiedIndex: 99}}, nil\n\t}\n\texpectedRetries := 3\n\thelper := newEtcdHelper(server.Client, scheme, codec, prefix)\n\tfake := &fakeDeleteKeysAPI{KeysAPI: helper.etcdKeysAPI, fakeGetCap: expectedRetries, fakeGetFunc: fakeGet}\n\thelper.etcdKeysAPI = fake\n\n\treturnedObj := &example.Pod{}\n\terr := helper.Create(context.TODO(), \"/some/key\", obj, returnedObj, 0)\n\tif err != nil {\n\t\tt.Errorf(\"Unexpected error %#v\", err)\n\t}\n\n\terr = helper.Delete(context.TODO(), \"/some/key\", obj, storage.NewUIDPreconditions(\"A\"))\n\tif err != nil {\n\t\tt.Errorf(\"Unexpected error %#v\", err)\n\t}\n\tif fake.getCount != expectedRetries {\n\t\tt.Errorf(\"Expect %d retries, got %d\", expectedRetries, fake.getCount)\n\t}\n\terr = helper.Get(context.TODO(), \"/some/key\", \"\", obj, false)\n\tif !storage.IsNotFound(err) {\n\t\tt.Errorf(\"Expect an NotFound error, got %v\", err)\n\t}\n}", "func (client *ManagedClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}\"\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\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 resourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceName}\", url.PathEscape(resourceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, 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\", \"2020-11-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func (factory *Factory) DeletePod(pod *corev1.Pod) {\n\tgomega.Expect(factory.GetControllerRuntimeClient().Delete(ctx.TODO(), pod)).NotTo(gomega.HaveOccurred())\n}", "func NewReadCoreV1NamespacedPodUnauthorized() *ReadCoreV1NamespacedPodUnauthorized {\n\treturn &ReadCoreV1NamespacedPodUnauthorized{}\n}", "func KubeDelete(object string, name string) string {\n\tvar outputstring string\n\tif object == \"\" || name == \"\" {\n\t\toutputstring = \"\"\n\t} else {\n\t\toutputstring = fmt.Sprintf(\"delete %s %s\", object, name)\n\t}\n\treturn KubeCommand(outputstring)\n}", "func (client *DicomServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, dicomServiceName string, workspaceName string, options *DicomServicesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}\"\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\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 dicomServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter dicomServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{dicomServiceName}\", url.PathEscape(dicomServiceName))\n\tif workspaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter workspaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{workspaceName}\", url.PathEscape(workspaceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, 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-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func NewDeleteOneDefault(code int) *DeleteOneDefault {\n\treturn &DeleteOneDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDeleteUsingDELETE8OK() *DeleteUsingDELETE8OK {\n\treturn &DeleteUsingDELETE8OK{}\n}", "func createPod(clientset kubernetes.Interface, namespace string, image string, name string,\n\tlabels map[string]string, command []string, args []string) (*v1.Pod, error) {\n\tenv := []v1.EnvVar{\n\t\t{\n\t\t\tName: \"NAMESPACE\",\n\t\t\tValueFrom: &v1.EnvVarSource{\n\t\t\t\tFieldRef: &v1.ObjectFieldSelector{\n\t\t\t\t\tAPIVersion: \"v1\",\n\t\t\t\t\tFieldPath: \"metadata.namespace\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tspec := v1.PodSpec{\n\t\tContainers: []v1.Container{\n\t\t\t{\n\t\t\t\tEnv: env,\n\t\t\t\tName: fmt.Sprintf(\"%v-pod-container\", name),\n\t\t\t\tImage: image,\n\t\t\t},\n\t\t},\n\t}\n\n\tif len(command) > 0 {\n\t\tspec.Containers[0].Command = command\n\t\tif len(args) > 0 {\n\t\t\tspec.Containers[0].Args = args\n\t\t}\n\t}\n\n\tpod := &v1.Pod{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tLabels: labels,\n\t\t\tName: name,\n\t\t},\n\t\tSpec: spec,\n\t}\n\n\tif _, err := clientset.CoreV1().Pods(namespace).Create(pod); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn clientset.CoreV1().Pods(namespace).Get(name, metav1.GetOptions{})\n}", "func NewDeleteCmd(globalCfg *config.GlobalImpl) *cobra.Command {\n\tdeleteOptions := config.NewDeleteOptions()\n\n\tcmd := &cobra.Command{\n\t\tUse: \"delete\",\n\t\tShort: \"DEPRECATED: delete releases from state file (helm delete)\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tdeleteImpl := config.NewDeleteImpl(globalCfg, deleteOptions)\n\t\t\terr := config.NewCLIConfigImpl(deleteImpl.GlobalImpl)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif err := deleteImpl.ValidateConfig(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\ta := app.New(deleteImpl)\n\t\t\treturn toCLIError(deleteImpl.GlobalImpl, a.Delete(deleteImpl))\n\t\t},\n\t}\n\n\tf := cmd.Flags()\n\tf.StringVar(&globalCfg.GlobalOptions.Args, \"args\", \"\", \"pass args to helm exec\")\n\tf.StringVar(&deleteOptions.Cascade, \"cascade\", \"\", \"pass cascade to helm exec, default: background\")\n\tf.IntVar(&deleteOptions.Concurrency, \"concurrency\", 0, \"maximum number of concurrent helm processes to run, 0 is unlimited\")\n\tf.BoolVar(&deleteOptions.Purge, \"purge\", false, \"purge releases i.e. free release names and histories\")\n\tf.BoolVar(&deleteOptions.SkipCharts, \"skip-charts\", false, \"don't prepare charts when deleting releases\")\n\n\treturn cmd\n}", "func Delete(input DeleteInput) {\n\tExpect(input.Deleter).NotTo(BeNil(), \"input.Deleter is required for Pod.Delete\")\n\tExpect(input.Pod).NotTo(BeNil(), \"input.Pod is required for Pod.Delete\")\n\n\tBy(fmt.Sprintf(\"Deleting Pod \\\"%s\\\"\", input.Pod.Name))\n\tExpect(input.Deleter.Delete(context.TODO(), input.Pod)).Should(Succeed())\n}", "func NewWatchCoreV1NamespacedEndpointsUnauthorized() *WatchCoreV1NamespacedEndpointsUnauthorized {\n\n\treturn &WatchCoreV1NamespacedEndpointsUnauthorized{}\n}", "func NewDeleteScopeDefault(code int) *DeleteScopeDefault {\n\treturn &DeleteScopeDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteReplicationGroupInput, error) {\n\tres := &svcsdk.DeleteReplicationGroupInput{}\n\n\tif r.ko.Spec.ReplicationGroupID != nil {\n\t\tres.SetReplicationGroupId(*r.ko.Spec.ReplicationGroupID)\n\t}\n\n\treturn res, nil\n}", "func NewDelete(appName string) *commander.CommandWrapper {\n\treturn &commander.CommandWrapper{\n\t\tHandler: &Delete{},\n\t\tHelp: &commander.CommandDescriptor{\n\t\t\tName: \"delete\",\n\t\t\tShortDescription: \"Delete a server.\",\n\t\t\tLongDescription: `Delete a server will destroy the world and container and the version file.`,\n\t\t\tArguments: \"name\",\n\t\t\tExamples: []string{\"\", \"my_server\"},\n\t\t},\n\t}\n}", "func NewWeaviateSchemaActionsDeleteOK() *WeaviateSchemaActionsDeleteOK {\n\n\treturn &WeaviateSchemaActionsDeleteOK{}\n}", "func NewNvmeServiceDeleteOK() *NvmeServiceDeleteOK {\n\treturn &NvmeServiceDeleteOK{}\n}", "func NewDeleteCommand() *cobra.Command {\n\tvar (\n\t\tflags listFlags\n\t\tall bool\n\t\tallNamespaces bool\n\t\tdryRun bool\n\t)\n\tvar command = &cobra.Command{\n\t\tUse: \"delete [--dry-run] [WORKFLOW...|[--all] [--older] [--completed] [--resubmitted] [--prefix PREFIX] [--selector SELECTOR]]\",\n\t\tShort: \"delete workflows\",\n\t\tExample: `# Delete a workflow:\n\n argo delete my-wf\n\n# Delete the latest workflow:\n\n argo delete @latest\n`,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tctx, apiClient := client.NewAPIClient()\n\t\t\tserviceClient := apiClient.NewWorkflowServiceClient()\n\t\t\tvar workflows wfv1.Workflows\n\t\t\tif !allNamespaces {\n\t\t\t\tflags.namespace = client.Namespace()\n\t\t\t}\n\t\t\tfor _, name := range args {\n\t\t\t\tworkflows = append(workflows, wfv1.Workflow{\n\t\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: name, Namespace: flags.namespace},\n\t\t\t\t})\n\t\t\t}\n\t\t\tif all || flags.completed || flags.resubmitted || flags.prefix != \"\" || flags.labels != \"\" || flags.finishedAfter != \"\" {\n\t\t\t\tlisted, err := listWorkflows(ctx, serviceClient, flags)\n\t\t\t\terrors.CheckError(err)\n\t\t\t\tworkflows = append(workflows, listed...)\n\t\t\t}\n\t\t\tfor _, wf := range workflows {\n\t\t\t\tif !dryRun {\n\t\t\t\t\t_, err := serviceClient.DeleteWorkflow(ctx, &workflowpkg.WorkflowDeleteRequest{Name: wf.Name, Namespace: wf.Namespace})\n\t\t\t\t\tif err != nil && status.Code(err) == codes.NotFound {\n\t\t\t\t\t\tfmt.Printf(\"Workflow '%s' not found\\n\", wf.Name)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\terrors.CheckError(err)\n\t\t\t\t\tfmt.Printf(\"Workflow '%s' deleted\\n\", wf.Name)\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Printf(\"Workflow '%s' deleted (dry-run)\\n\", wf.Name)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}\n\n\tcommand.Flags().BoolVar(&allNamespaces, \"all-namespaces\", false, \"Delete workflows from all namespaces\")\n\tcommand.Flags().BoolVar(&all, \"all\", false, \"Delete all workflows\")\n\tcommand.Flags().BoolVar(&flags.completed, \"completed\", false, \"Delete completed workflows\")\n\tcommand.Flags().BoolVar(&flags.resubmitted, \"resubmitted\", false, \"Delete resubmitted workflows\")\n\tcommand.Flags().StringVar(&flags.prefix, \"prefix\", \"\", \"Delete workflows by prefix\")\n\tcommand.Flags().StringVar(&flags.finishedAfter, \"older\", \"\", \"Delete completed workflows finished before the specified duration (e.g. 10m, 3h, 1d)\")\n\tcommand.Flags().StringVarP(&flags.labels, \"selector\", \"l\", \"\", \"Selector (label query) to filter on, not including uninitialized ones\")\n\tcommand.Flags().BoolVar(&dryRun, \"dry-run\", false, \"Do not delete the workflow, only print what would happen\")\n\treturn command\n}", "func NewDeleteNamespaceParams() *DeleteNamespaceParams {\n\tvar ()\n\treturn &DeleteNamespaceParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteSecurityGroupOK() *DeleteSecurityGroupOK {\n\treturn &DeleteSecurityGroupOK{}\n}", "func Delete(ctx context.Context) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"delete <name>\",\n\t\tShort: \"Delete a namespace\",\n\t\tArgs: utils.MaximumNArgsAccepted(1, \"\"),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif err := contextCMD.NewContextCommand().Run(ctx, &contextCMD.ContextOptions{}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tnsToDelete := okteto.Context().Namespace\n\t\t\tif len(args) > 0 {\n\t\t\t\tnsToDelete = args[0]\n\t\t\t}\n\n\t\t\tif !okteto.IsOkteto() {\n\t\t\t\treturn oktetoErrors.ErrContextIsNotOktetoCluster\n\t\t\t}\n\n\t\t\tnsCmd, err := NewCommand()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = nsCmd.ExecuteDeleteNamespace(ctx, nsToDelete)\n\t\t\tanalytics.TrackDeleteNamespace(err == nil)\n\t\t\treturn err\n\t\t},\n\t}\n\treturn cmd\n}", "func (r PodTestRunner) deletePods(ctx context.Context, configMapName string) error {\n\tdo := metav1.DeleteOptions{}\n\tselector := fmt.Sprintf(\"testrun=%s\", configMapName)\n\tlo := metav1.ListOptions{LabelSelector: selector}\n\terr := r.Client.CoreV1().Pods(r.Namespace).DeleteCollection(ctx, do, lo)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error deleting pods (label selector %q): %w\", selector, err)\n\t}\n\treturn nil\n}", "func NewSystemDeleteOK() *SystemDeleteOK {\n\treturn &SystemDeleteOK{}\n}", "func newPod(name string) *corev1.Pod {\n\treturn &corev1.Pod{\n\t\tTypeMeta: metav1.TypeMeta{},\n\t\tObjectMeta: metav1.ObjectMeta{Name: name},\n\t\tSpec: corev1.PodSpec{},\n\t\tStatus: corev1.PodStatus{},\n\t}\n}", "func NewQtreeDeleteDefault(code int) *QtreeDeleteDefault {\n\treturn &QtreeDeleteDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDeleteNotFound(body *DeleteNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func NewDeleteNotFound(body *DeleteNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func NewDeleteClientByNamespaceNotFound() *DeleteClientByNamespaceNotFound {\n\treturn &DeleteClientByNamespaceNotFound{}\n}", "func NewConnectCoreV1PutNamespacedPodProxy(ctx *middleware.Context, handler ConnectCoreV1PutNamespacedPodProxyHandler) *ConnectCoreV1PutNamespacedPodProxy {\n\treturn &ConnectCoreV1PutNamespacedPodProxy{Context: ctx, Handler: handler}\n}", "func NewPostFirmwaresDeleteOK() *PostFirmwaresDeleteOK {\n\treturn &PostFirmwaresDeleteOK{}\n}", "func NewDeleteInstancesOK() *DeleteInstancesOK {\n\treturn &DeleteInstancesOK{}\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteVpnConnectionInput, error) {\n\tres := &svcsdk.DeleteVpnConnectionInput{}\n\n\tif r.ko.Spec.DryRun != nil {\n\t\tres.SetDryRun(*r.ko.Spec.DryRun)\n\t}\n\tif r.ko.Status.VPNConnectionID != nil {\n\t\tres.SetVpnConnectionId(*r.ko.Status.VPNConnectionID)\n\t}\n\n\treturn res, nil\n}", "func NewPcloudPvminstancesDeleteOK() *PcloudPvminstancesDeleteOK {\n\treturn &PcloudPvminstancesDeleteOK{}\n}", "func ExampleServiceDiscovery_DeleteNamespace_shared00() {\n\tsvc := servicediscovery.New(session.New())\n\tinput := &servicediscovery.DeleteNamespaceInput{\n\t\tId: aws.String(\"ns-ylexjili4cdxy3xm\"),\n\t}\n\n\tresult, err := svc.DeleteNamespace(input)\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\n\t\t\tcase servicediscovery.ErrCodeInvalidInput:\n\t\t\t\tfmt.Println(servicediscovery.ErrCodeInvalidInput, aerr.Error())\n\t\t\tcase servicediscovery.ErrCodeNamespaceNotFound:\n\t\t\t\tfmt.Println(servicediscovery.ErrCodeNamespaceNotFound, aerr.Error())\n\t\t\tcase servicediscovery.ErrCodeResourceInUse:\n\t\t\t\tfmt.Println(servicediscovery.ErrCodeResourceInUse, aerr.Error())\n\t\t\tcase servicediscovery.ErrCodeDuplicateRequest:\n\t\t\t\tfmt.Println(servicediscovery.ErrCodeDuplicateRequest, aerr.Error())\n\t\t\tdefault:\n\t\t\t\tfmt.Println(aerr.Error())\n\t\t\t}\n\t\t} else {\n\t\t\t// Print the error, cast err to awserr.Error to get the Code and\n\t\t\t// Message from an error.\n\t\t\tfmt.Println(err.Error())\n\t\t}\n\t\treturn\n\t}\n\n\tfmt.Println(result)\n}", "func (client Client) DeletePod(name string) error {\n\t_, err := client.rawRequest(\"DELETE\", \"pods/\"+name, nil, nil)\n\treturn err\n}" ]
[ "0.68976986", "0.68763286", "0.6668603", "0.66465414", "0.6645578", "0.6539118", "0.62248933", "0.61037683", "0.6061472", "0.5951946", "0.5913124", "0.5850097", "0.5843914", "0.5727536", "0.5688485", "0.5683131", "0.5660715", "0.5644126", "0.55773365", "0.5564169", "0.55473536", "0.5520597", "0.54743516", "0.537867", "0.53759956", "0.5366322", "0.53568673", "0.53510725", "0.53417015", "0.5341409", "0.53372633", "0.5332943", "0.5307109", "0.5305641", "0.53034425", "0.52667505", "0.5266526", "0.52553105", "0.5243223", "0.52405083", "0.5237857", "0.5229002", "0.52201414", "0.52074003", "0.5205936", "0.5204101", "0.5202935", "0.5201343", "0.5197907", "0.5197907", "0.5195699", "0.5189226", "0.5179698", "0.5165402", "0.5164645", "0.51646423", "0.5147279", "0.5137836", "0.51311034", "0.51283294", "0.5119111", "0.51157385", "0.5110725", "0.5100524", "0.5097958", "0.5096054", "0.50653946", "0.50599813", "0.5055961", "0.5053598", "0.50525856", "0.5039531", "0.5039094", "0.5036859", "0.5036831", "0.5035343", "0.50300163", "0.5026073", "0.5017665", "0.50142705", "0.50113523", "0.49970233", "0.4992421", "0.4992079", "0.49887317", "0.4979772", "0.4977303", "0.49403873", "0.49398056", "0.49386925", "0.49330506", "0.49330506", "0.49287277", "0.49267483", "0.49209198", "0.49200594", "0.49200282", "0.4916354", "0.49087057", "0.49055016" ]
0.7737533
0
WithPayload adds the payload to the delete core v1 namespaced pod o k response
func (o *DeleteCoreV1NamespacedPodOK) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodOK { o.Payload = payload return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *DeleteCoreV1NamespacedPodOK) SetPayload(payload *models.IoK8sAPICoreV1Pod) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1NamespacedPodAccepted) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedConfigMapOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteCoreV1NamespacedConfigMapOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeletePostbyIDOK) WithPayload(payload *models.Response) *DeletePostbyIDOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedPodAccepted) SetPayload(payload *models.IoK8sAPICoreV1Pod) {\n\to.Payload = payload\n}", "func Delete(kind string, name string, namespace string, args ...string) (err error) {\n\tdeleteArgs := []string{\"delete\", kind, name, \"-n\", namespace}\n\t_, err = kubectl(append(deleteArgs, args...)...)\n\treturn\n}", "func (o *DeleteCoreV1NamespacedConfigMapOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDInternalServerError) WithPayload(payload *models.Response) *DeletePostbyIDInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteRuntimeContainerInternalServerError) WithPayload(payload string) *DeleteRuntimeContainerInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *WeaviateSchemaActionsDeleteBadRequest) WithPayload(payload *models.ErrorResponse) *WeaviateSchemaActionsDeleteBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteUserOK) WithPayload(payload *models.DeletedResponse) *DeleteUserOK {\n\to.Payload = payload\n\treturn o\n}", "func DeleteOperator(namespace string) error {\n\tif namespace == \"\" {\n\t\tnamespace = DEFAULT_NAMESPACE\n\t}\n\tif err := sh.RunV(\"helm\", \"delete\", \"-n\", namespace, \"kedahttp\"); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (o *DeleteOrganizationOK) WithPayload(payload *models.DeletedResponse) *DeleteOrganizationOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *ThingsDeleteInternalServerError) WithPayload(payload *models.ErrorResponse) *ThingsDeleteInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeletePostbyIDUnauthorized) WithPayload(payload *models.Response) *DeletePostbyIDUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func (o *ThingsDeleteForbidden) WithPayload(payload *models.ErrorResponse) *ThingsDeleteForbidden {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteOrganizationUnauthorized) WithPayload(payload *models.ErrorResponse) *DeleteOrganizationUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func (o *PostOperationsDeleteP2PPathOK) WithPayload(payload *models.TapiPathComputationDeleteP2PPathOutput) *PostOperationsDeleteP2PPathOK {\n\to.Payload = payload\n\treturn o\n}", "func Delete(objectName string, payload interface{}) *Writer {\n\treturn &Writer{\n\t\tCmd: \"delete\",\n\t\tObjectName: objectName,\n\t\tPayload: payload,\n\t}\n}", "func (o *DeleteOrganizationForbidden) WithPayload(payload *models.ErrorResponse) *DeleteOrganizationForbidden {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteConsulDefault) WithPayload(payload *models.Error) *DeleteConsulDefault {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeletePostbyIDNotFound) WithPayload(payload *models.Response) *DeletePostbyIDNotFound {\n\to.Payload = payload\n\treturn o\n}", "func (k *kubectlContext) Delete(args ...string) error {\n\tout, err := k.do(append([]string{\"delete\"}, args...)...)\n\tk.t.Log(string(out))\n\treturn err\n}", "func (o *DeleteProjectUserUnauthorized) WithPayload(payload *models.ErrorResponse) *DeleteProjectUserUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteOrganizationInternalServerError) WithPayload(payload *models.ErrorResponse) *DeleteOrganizationInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteUserForbidden) WithPayload(payload *models.ErrorResponse) *DeleteUserForbidden {\n\to.Payload = payload\n\treturn o\n}", "func (o *WatchCoreV1NamespacedEndpointsOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1WatchEvent) *WatchCoreV1NamespacedEndpointsOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedConfigMapAccepted) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteUserUnauthorized) WithPayload(payload *models.ErrorResponse) *DeleteUserUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func NewDeletePayload(body *DeleteRequestBody, token string) *warehouse.DeletePayload {\n\tv := &warehouse.DeletePayload{}\n\tv.Ids = make([]string, len(body.Ids))\n\tfor i, val := range body.Ids {\n\t\tv.Ids[i] = val\n\t}\n\tv.Token = token\n\n\treturn v\n}", "func (o *DeleteCoreV1NamespacedConfigMapAccepted) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteCoreV1NamespacedConfigMapAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteVpnConnectionInput, error) {\n\tres := &svcsdk.DeleteVpnConnectionInput{}\n\n\tif r.ko.Spec.DryRun != nil {\n\t\tres.SetDryRun(*r.ko.Spec.DryRun)\n\t}\n\tif r.ko.Status.VPNConnectionID != nil {\n\t\tres.SetVpnConnectionId(*r.ko.Status.VPNConnectionID)\n\t}\n\n\treturn res, nil\n}", "func (m *kubePackage) kubeDelete(_ context.Context, r *apiResource, foreground bool) error {\n\tvar c dynamic.ResourceInterface = m.dynClient.Resource(r.GroupVersionResource())\n\tif r.Namespace != \"\" {\n\t\tc = c.(dynamic.NamespaceableResourceInterface).Namespace(r.Namespace)\n\t}\n\n\tdelPolicy := metav1.DeletePropagationBackground\n\tif foreground {\n\t\tdelPolicy = metav1.DeletePropagationForeground\n\t}\n\n\tlog.V(1).Infof(\"DELETE to %s\", m.Master+r.PathWithName())\n\n\tif m.dryRun {\n\t\treturn nil\n\t}\n\n\tif err := c.Delete(context.TODO(), r.Name, metav1.DeleteOptions{\n\t\tPropagationPolicy: &delPolicy,\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\tlog.Infof(\"%v deleted\", r)\n\n\treturn nil\n}", "func (o *DeleteOrganizationOK) SetPayload(payload *models.DeletedResponse) {\n\to.Payload = payload\n}", "func (o *DeleteUserInternalServerError) WithPayload(payload *models.ErrorResponse) *DeleteUserInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteOrgOK) WithPayload(payload *DeleteOrgOKBody) *DeleteOrgOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteApiextensionsV1CollectionCustomResourceDefinitionOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteApiextensionsV1CollectionCustomResourceDefinitionOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteProjectUserInternalServerError) WithPayload(payload *models.ErrorResponse) *DeleteProjectUserInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (c *Controller) delete(d *appsv1.Deployment) error {\n\tep := RegisteelEndpoint + \"/\" + string(d.UID)\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(http.MethodDelete, ep, nil)\n\treq.Header.Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.logger.Infof(\"removed deployment from api: %v\", d.Name)\n\n\treturn nil\n}", "func RunKubeDelete(log *LoggingConfig, args []string, dryrun bool) (string, error) {\n\tlog.Info.log(\"Attempting to delete resource from Kubernetes ...\")\n\tkargs := []string{\"delete\"}\n\tkargs = append(kargs, args...)\n\treturn RunKube(log, kargs, dryrun)\n}", "func (o *DeleteRuntimeContainerNotFound) WithPayload(payload string) *DeleteRuntimeContainerNotFound {\n\to.Payload = payload\n\treturn o\n}", "func RunDelete(cmd *cobra.Command, args []string) {\n\n\tlog := util.Logger()\n\n\tif len(args) != 1 || args[0] == \"\" {\n\t\tlog.Fatalf(`❌ Missing expected arguments: <namespace-store-name> %s`, cmd.UsageString())\n\t}\n\n\to := util.KubeObject(bundle.File_deploy_crds_noobaa_io_v1alpha1_namespacestore_cr_yaml)\n\tnamespaceStore := o.(*nbv1.NamespaceStore)\n\tnamespaceStore.Name = args[0]\n\tnamespaceStore.Namespace = options.Namespace\n\tnamespaceStore.Spec = nbv1.NamespaceStoreSpec{}\n\n\tnbClient := system.GetNBClient()\n\n\tnamespaceResourceinfo, err := nbClient.ReadNamespaceResourceAPI(nb.ReadNamespaceResourceParams{Name: namespaceStore.Name})\n\tif err != nil {\n\t\trpcErr, isRPCErr := err.(*nb.RPCError)\n\t\tif !isRPCErr || rpcErr.RPCCode != \"NO_SUCH_NAMESPACE_RESOURCE\" {\n\t\t\tlog.Fatalf(`❌ Failed to read NamespaceStore info: %s`, err)\n\t\t}\n\t} else if namespaceResourceinfo.Undeletable != \"\" && namespaceResourceinfo.Undeletable != \"IS_NAMESPACESTORE\" {\n\t\tswitch namespaceResourceinfo.Undeletable {\n\t\tcase \"CONNECTED_BUCKET_DELETING\":\n\t\t\tfallthrough\n\t\tcase \"IN_USE\":\n\t\t\tlog.Fatalf(`❌ Could not delete NamespaceStore %q in namespace %q as it is being used by one or more buckets`,\n\t\t\t\tnamespaceStore.Name, namespaceStore.Namespace)\n\t\tdefault:\n\t\t\tlog.Fatalf(`❌ Could not delete NamespaceStore %q in namespace %q, undeletable due to %q`,\n\t\t\t\tnamespaceStore.Name, namespaceStore.Namespace, namespaceResourceinfo.Undeletable)\n\t\t}\n\t}\n\tif !util.KubeDelete(namespaceStore) {\n\t\tlog.Fatalf(`❌ Could not delete NamespaceStore %q in namespace %q`,\n\t\t\tnamespaceStore.Name, namespaceStore.Namespace)\n\t}\n}", "func (o *DeleteUserInternalServerError) WithPayload(payload string) *DeleteUserInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func KubeDelete(object string, name string) string {\n\tvar outputstring string\n\tif object == \"\" || name == \"\" {\n\t\toutputstring = \"\"\n\t} else {\n\t\toutputstring = fmt.Sprintf(\"delete %s %s\", object, name)\n\t}\n\treturn KubeCommand(outputstring)\n}", "func (o *CreateCoreV1NamespacedPodBindingOK) WithPayload(payload *models.IoK8sAPICoreV1Binding) *CreateCoreV1NamespacedPodBindingOK {\n\to.Payload = payload\n\treturn o\n}", "func Delete(k8sClient client.Client, obj client.Object) error {\n\treturn k8sClient.Delete(context.TODO(), obj)\n}", "func (o *DeleteImageDefault) WithPayload(payload *models.Error) *DeleteImageDefault {\n\to.Payload = payload\n\treturn o\n}", "func NewDeleteCoreV1NamespacedPodOK() *DeleteCoreV1NamespacedPodOK {\n\n\treturn &DeleteCoreV1NamespacedPodOK{}\n}", "func genericPodDelete(label, namespace string, clientset *kubernetes.Clientset) error {\n\n\tvar name string\n\t//Getting all pods in litmus Namespace\n\tpods, err := clientset.CoreV1().Pods(namespace).List(context.TODO(), metav1.ListOptions{})\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to get pods in %v namespace, err: %v\", err)\n\t}\n\n\tklog.Infof(\"[Info]: Selecting pod with label %v for reboot\", label)\n\tfor i := range pods.Items {\n\t\tif pods.Items[i].Labels[\"component\"] == label {\n\t\t\tname = pods.Items[i].Name\n\t\t}\n\t}\n\tklog.Infof(\"[Info]: Deleting the Pod : %v\", name)\n\terr = clientset.CoreV1().Pods(\"litmus\").Delete(context.TODO(), name, metav1.DeleteOptions{})\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to delete %v pod, err: %v\", name, err)\n\t}\n\tklog.Infof(\"[Info]: %v pod deleted successfully \\n\", name)\n\treturn nil\n}", "func (o *DeleteApiextensionsV1CollectionCustomResourceDefinitionOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteAdmissionregistrationV1beta1CollectionMutatingWebhookConfigurationOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteAdmissionregistrationV1beta1CollectionMutatingWebhookConfigurationOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteConsulNotFound) WithPayload(payload *models.Error) *DeleteConsulNotFound {\n\to.Payload = payload\n\treturn o\n}", "func (m *PayloadResponseItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *PayloadResponseItemRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func (client IdentityClient) deleteTagNamespace(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodDelete, \"/tagNamespaces/{tagNamespaceId}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response DeleteTagNamespaceResponse\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}", "func (r *MacOSTrustedRootCertificateRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (m *TermStoreRequestBuilder) Delete(ctx context.Context, requestConfiguration *TermStoreRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.CreateDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.requestAdapter.SendNoContentAsync(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func (g genericPlugin) Delete(resource helm.KubernetesResource, namespace string, client plugin.KubernetesConnector) error {\n\tif namespace == \"\" {\n\t\tnamespace = \"default\"\n\t}\n\n\tdynClient := client.GetDynamicClient()\n\tmapper := client.GetMapper()\n\n\tmapping, err := mapper.RESTMapping(schema.GroupKind{\n\t\tGroup: resource.GVK.Group,\n\t\tKind: resource.GVK.Kind,\n\t}, resource.GVK.Version)\n\tif err != nil {\n\t\treturn pkgerrors.Wrap(err, \"Mapping kind to resource error\")\n\t}\n\n\tgvr := mapping.Resource\n\tdeletePolicy := metav1.DeletePropagationForeground\n\topts := &metav1.DeleteOptions{\n\t\tPropagationPolicy: &deletePolicy,\n\t}\n\n\tswitch mapping.Scope.Name() {\n\tcase meta.RESTScopeNameNamespace:\n\t\terr = dynClient.Resource(gvr).Namespace(namespace).Delete(resource.Name, opts)\n\tcase meta.RESTScopeNameRoot:\n\t\terr = dynClient.Resource(gvr).Delete(resource.Name, opts)\n\tdefault:\n\t\treturn pkgerrors.New(\"Got an unknown RESTSCopeName for mapping: \" + resource.GVK.String())\n\t}\n\n\tif err != nil {\n\t\treturn pkgerrors.Wrap(err, \"Delete object error\")\n\t}\n\treturn nil\n}", "func (c *Client) NamespaceDelete(org string) (models.Response, error) {\n\tresp := models.Response{}\n\n\tdata, err := c.delete(api.Routes.Path(\"NamespaceDelete\", org))\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\n\tif err := json.Unmarshal(data, &resp); err != nil {\n\t\treturn resp, err\n\t}\n\n\treturn resp, nil\n}", "func deletePod(clientset kubernetes.Interface, namespace string, name string) error {\n\treturn clientset.CoreV1().Pods(namespace).Delete(name, &metav1.DeleteOptions{GracePeriodSeconds: &immediate})\n}", "func DeleteWithPrefix(config *EtcdConfig, key string) (int, error) {\n\tindex, client, err := getClient(config)\n\tif err != nil {\n\t\tfmt.Println(\"put action failed\")\n\t\treturn 0, err\n\t}\n\tKV := client.KV\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second*10)\n\tdefer cancel()\n\tr, err := KV.Delete(ctx, key, clientv3.WithPrefix())\n\tif err != nil {\n\t\t_ = closeClient(index)\n\t\treturn 0, err\n\t}\n\tfmt.Println(\"delete action succeed\")\n\tres := int(r.Deleted)\n\treturn res, nil\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenOK) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (o *DeleteUserOK) WithPayload(payload *DeleteUserOKBody) *DeleteUserOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteServiceIDFailure) WithPayload(payload models.Error) *DeleteServiceIDFailure {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteRuntimeContainerBadRequest) WithPayload(payload string) *DeleteRuntimeContainerBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteUserUnauthorized) WithPayload(payload *DeleteUserUnauthorizedBody) *DeleteUserUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteUserForbidden) WithPayload(payload *DeleteUserForbiddenBody) *DeleteUserForbidden {\n\to.Payload = payload\n\treturn o\n}", "func DeletePod(ctx cli.Context) error {\n\tif len(ctx.Args) == 0 {\n\t\treturn fmt.Errorf(\"Usage: puctl infra delete-pod [patterns]\")\n\t}\n\n\twf := cli.NewWorkFlowEngine(\n\t\tcli.NewWorkflowStep(\"\", findPods),\n\t\tcli.NewWorkflowStep(\"Deleting pods\", deletePods),\n\t)\n\n\terr := wf.Run(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(\"Finished!\")\n\n\treturn nil\n}", "func TestObjectDeleted(t *testing.T) {\n\texpectedCard := TeamsMessageCard{\n\t\tType: messageType,\n\t\tContext: context,\n\t\tThemeColor: msTeamsColors[\"Danger\"],\n\t\tSummary: \"kubewatch notification received\",\n\t\tTitle: \"kubewatch\",\n\t\tText: \"\",\n\t\tSections: []TeamsMessageCardSection{\n\t\t\t{\n\t\t\t\tActivityTitle: \"A `pod` in namespace `new` has been `deleted`:\\n`foo`\",\n\t\t\t\tMarkdown: true,\n\t\t\t},\n\t\t},\n\t}\n\n\tts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusOK)\n\t\tif r.Method != \"POST\" {\n\t\t\tt.Errorf(\"expected a POST request for ObjectDeleted()\")\n\t\t}\n\t\tdecoder := json.NewDecoder(r.Body)\n\t\tvar c TeamsMessageCard\n\t\tif err := decoder.Decode(&c); err != nil {\n\t\t\tt.Errorf(\"%v\", err)\n\t\t}\n\t\tif !reflect.DeepEqual(c, expectedCard) {\n\t\t\tt.Errorf(\"expected %v, got %v\", expectedCard, c)\n\t\t}\n\t}))\n\n\tms := &MSTeams{TeamsWebhookURL: ts.URL}\n\tp := &v1.Pod{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Pod\",\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tUID: \"12345678\",\n\t\t\tName: \"foo\",\n\t\t\tNamespace: \"new\",\n\t\t},\n\t}\n\tms.ObjectDeleted(p)\n}", "func (s *server) Delete(ctx context.Context, body *pb.NameHolder) (*pb.DeletionResponse, error) {\n\tappName := body.GetName()\n\tfilter := types.M{\n\t\tmongo.NameKey: appName,\n\t\tmongo.InstanceTypeKey: mongo.AppInstance,\n\t}\n\n\tnode, _ := redis.FetchAppNode(appName)\n\tgo redis.DecrementServiceLoad(ServiceName, node)\n\tgo redis.RemoveApp(appName)\n\tgo diskCleanup(appName)\n\n\tif configs.CloudflareConfig.PlugIn {\n\t\tgo cloudflare.DeleteRecord(appName, mongo.AppInstance)\n\t}\n\n\t_, err := mongo.DeleteInstance(filter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pb.DeletionResponse{Success: true}, nil\n}", "func TestDeletePod(t *testing.T) {\n\tcluster := NewClusterState()\n\tvpa := addTestVpa(cluster)\n\tpod := addTestPod(cluster)\n\tassert.NoError(t, cluster.DeletePod(pod.ID))\n\tassert.Empty(t, vpa.Pods)\n}", "func (o *DeleteGroupByIDUnauthorized) WithPayload(payload *models.Error) *DeleteGroupByIDUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func (o *WatchCoreV1NamespacedEndpointsOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1WatchEvent) {\n\to.Payload = payload\n}", "func (c *Controller) Delete(typ, name, namespace string) error {\n\treturn errUnsupported\n}", "func (c *SubresourceClient) Delete(namespace, name string) (e error) {\n\tif c.Error != \"\" {\n\t\te = fmt.Errorf(c.Error)\n\t}\n\treturn\n}", "func (n *namespaceClient) Delete(namespace string) error {\n\turl := fmt.Sprintf(\"%s%s/%s\", n.url, nsh.AddURL, namespace)\n\t_, err := n.client.DoHTTPRequest(\"DELETE\", url, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn.logger.Info(\"successfully deleted namespace\")\n\treturn nil\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteReplicationGroupInput, error) {\n\tres := &svcsdk.DeleteReplicationGroupInput{}\n\n\tif r.ko.Spec.ReplicationGroupID != nil {\n\t\tres.SetReplicationGroupId(*r.ko.Spec.ReplicationGroupID)\n\t}\n\n\treturn res, nil\n}", "func (o *DeleteCertificatesV1CollectionCertificateSigningRequestOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteCertificatesV1CollectionCertificateSigningRequestOK {\n\to.Payload = payload\n\treturn o\n}", "func (kvclient *MockResKVClient) DeleteWithPrefix(ctx context.Context, prefix string) error {\n\treturn nil\n}", "func RunUninstall(cmd *cobra.Command, args []string) {\n\tc := LoadOperatorConf(cmd)\n\tLoadAdmissionConf(c)\n\tnoDeploy, _ := cmd.Flags().GetBool(\"no-deploy\")\n\tif !noDeploy {\n\t\tutil.KubeDelete(c.Deployment)\n\t\twaitForOperatorPodExit()\n\t\tutil.KubeDelete(c.ClusterRoleBinding)\n\t\tutil.KubeDelete(c.ClusterRole)\n\t\tutil.KubeDelete(c.RoleBindingEndpoint)\n\t\tutil.KubeDelete(c.RoleBinding)\n\t\tutil.KubeDelete(c.RoleEndpoint)\n\t\tutil.KubeDelete(c.Role)\n\t\tutil.KubeDelete(c.SAEndpoint)\n\t\tutil.KubeDelete(c.SA)\n\t} else {\n\t\tlog.Printf(\"Operator Delete: currently disabled with \\\"--no-deploy\\\" flag\")\n\t\tlog.Printf(\"Operator Deployment Status:\")\n\t\tutil.KubeCheck(c.Deployment)\n\t}\n\n\tutil.KubeDelete(c.WebhookConfiguration)\n\tutil.KubeDelete(c.WebhookSecret)\n\tutil.KubeDelete(c.WebhookService)\n\n\tcleanup, _ := cmd.Flags().GetBool(\"cleanup\")\n\treservedNS := c.NS.Name == \"default\" ||\n\t\tstrings.HasPrefix(c.NS.Name, \"openshift-\") ||\n\t\tstrings.HasPrefix(c.NS.Name, \"kubernetes-\") ||\n\t\tstrings.HasPrefix(c.NS.Name, \"kube-\")\n\tif reservedNS {\n\t\tlog.Printf(\"Namespace Delete: disabled for reserved namespace\")\n\t\tlog.Printf(\"Namespace Status:\")\n\t\tutil.KubeCheck(c.NS)\n\t} else if !cleanup {\n\t\tlog.Printf(\"Namespace Delete: currently disabled (enable with \\\"--cleanup\\\")\")\n\t\tlog.Printf(\"Namespace Status:\")\n\t\tutil.KubeCheck(c.NS)\n\t} else {\n\t\tlog.Printf(\"Namespace Delete:\")\n\t\tutil.KubeDelete(c.NS)\n\t}\n}", "func (c *client) Delete(_ context.Context, request *blobstore.DeleteRequest) (*blobstore.DeleteResponse, error) {\n\tif err := os.Remove(c.bodyPath(request.Key)); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := os.Remove(c.tagsPath(request.Key)); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &blobstore.DeleteResponse{}, nil\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenCreated) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (a *Agent) LabelDelete(labelId string) (err error) {\n\tif labelId == \"\" {\n\t\treturn\n\t}\n\tspec := (&api.LabelDeleteSpec{}).Init(labelId)\n\treturn a.pc.ExecuteApi(spec)\n}", "func (c *Client) Delete(ctx context.Context, obj runtime.Object) error {\n\tlocal, err := c.convert(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsecret := &corev1.Secret{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: local.Spec.Name,\n\t\t\tNamespace: local.ObjectMeta.Namespace,\n\t\t},\n\t}\n\treturn client.IgnoreNotFound((*c.kubeclient).Delete(ctx, secret))\n}", "func (o *DeleteUserOK) SetPayload(payload *models.DeletedResponse) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDBadRequest) WithPayload(payload *models.Response) *DeletePostbyIDBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func (o *WeaviateSchemaActionsDeleteBadRequest) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (n *NodeClient) Delete(twin, deployment uint32) (err error) {\n\turl := n.url(\"deployment\", fmt.Sprint(twin), fmt.Sprint(deployment))\n\n\trequest, err := http.NewRequest(http.MethodDelete, url, nil)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to build request\")\n\t}\n\n\tif err := n.client.authorize(request); err != nil {\n\t\treturn errors.Wrap(err, \"failed to sign request\")\n\t}\n\n\tresponse, err := http.DefaultClient.Do(request)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := n.response(response, nil, http.StatusAccepted); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *FederationSyncController) delete(obj pkgruntime.Object, kind string, namespacedName types.NamespacedName) error {\n\tglog.V(3).Infof(\"Handling deletion of %s %q\", kind, namespacedName)\n\t_, err := s.deletionHelper.HandleObjectInUnderlyingClusters(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = s.adapter.FedDelete(namespacedName, nil)\n\tif err != nil {\n\t\t// Its all good if the error is not found error. That means it is deleted already and we do not have to do anything.\n\t\t// This is expected when we are processing an update as a result of finalizer deletion.\n\t\t// The process that deleted the last finalizer is also going to delete the resource and we do not have to do anything.\n\t\tif !errors.IsNotFound(err) {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (ssc *StatefulSetController) deletePod(obj interface{}) {\n\tpod, ok := obj.(*v1.Pod)\n\n\t// When a delete is dropped, the relist will notice a pod in the store not\n\t// in the list, leading to the insertion of a tombstone object which contains\n\t// the deleted key/value. Note that this value might be stale. If the pod\n\t// changed labels the new StatefulSet will not be woken up till the periodic resync.\n\tif !ok {\n\t\ttombstone, ok := obj.(cache.DeletedFinalStateUnknown)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"couldn't get object from tombstone %+v\", obj))\n\t\t\treturn\n\t\t}\n\t\tpod, ok = tombstone.Obj.(*v1.Pod)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"tombstone contained object that is not a pod %+v\", obj))\n\t\t\treturn\n\t\t}\n\t}\n\n\tcontrollerRef := metav1.GetControllerOf(pod)\n\tif controllerRef == nil {\n\t\t// No controller should care about orphans being deleted.\n\t\treturn\n\t}\n\tset := ssc.resolveControllerRef(pod.Namespace, controllerRef)\n\tif set == nil {\n\t\treturn\n\t}\n\tklog.V(4).Infof(\"Pod %s/%s deleted through %v.\", pod.Namespace, pod.Name, utilruntime.GetCaller())\n\tssc.enqueueStatefulSet(set)\n}", "func (r *PolicyRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenOK) WithPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) *CreateCoreV1NamespacedServiceAccountTokenOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteAllRevisionsOK) WithPayload(payload string) *DeleteAllRevisionsOK {\n\to.Payload = payload\n\treturn o\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteModelPackageInput, error) {\n\tres := &svcsdk.DeleteModelPackageInput{}\n\n\tif r.ko.Spec.ModelPackageName != nil {\n\t\tres.SetModelPackageName(*r.ko.Spec.ModelPackageName)\n\t}\n\n\treturn res, nil\n}", "func (o *DeleteCoreV1NamespacedPodOK) 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}", "func (o *DeleteAddressesOK) WithPayload(payload models.AddressConfigMap) *DeleteAddressesOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteProjectUserBadRequest) WithPayload(payload *models.ErrorResponse) *DeleteProjectUserBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteOfferingByIDInternalServerError) WithPayload(payload *models.ErrorModel) *DeleteOfferingByIDInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeletePostbyIDOK) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteStageInput, error) {\n\tres := &svcsdk.DeleteStageInput{}\n\n\tif r.ko.Spec.APIID != nil {\n\t\tres.SetApiId(*r.ko.Spec.APIID)\n\t}\n\tif r.ko.Spec.StageName != nil {\n\t\tres.SetStageName(*r.ko.Spec.StageName)\n\t}\n\n\treturn res, nil\n}", "func (o *DeleteShipmentInternalServerError) WithPayload(payload *ghcmessages.Error) *DeleteShipmentInternalServerError {\n\to.Payload = payload\n\treturn o\n}" ]
[ "0.6468498", "0.64082247", "0.63500136", "0.61151206", "0.59689397", "0.5954123", "0.58461696", "0.58247715", "0.5803609", "0.5773006", "0.5763528", "0.5742729", "0.5729572", "0.57046115", "0.5686261", "0.5660893", "0.55726016", "0.55641377", "0.5547944", "0.5534036", "0.5494152", "0.5490391", "0.5467938", "0.5464655", "0.5461159", "0.54469866", "0.54461074", "0.5435707", "0.54117274", "0.5384202", "0.53668576", "0.5365109", "0.5363933", "0.53571236", "0.5336586", "0.5329413", "0.5323209", "0.5322713", "0.5306229", "0.5298607", "0.52888906", "0.528751", "0.5270989", "0.52696437", "0.526785", "0.52558196", "0.5244905", "0.52396166", "0.5231185", "0.5222776", "0.5197455", "0.51965153", "0.51922566", "0.518963", "0.51833063", "0.5181798", "0.5180584", "0.5132403", "0.5128007", "0.5123749", "0.5114589", "0.51087356", "0.50962394", "0.50892985", "0.50878835", "0.5084302", "0.5083175", "0.50794786", "0.50708807", "0.5070206", "0.50604033", "0.50584364", "0.5057387", "0.50573194", "0.5055191", "0.50542676", "0.5047997", "0.5041256", "0.5038569", "0.5031317", "0.5030641", "0.5029707", "0.5028462", "0.5019033", "0.50152445", "0.5012106", "0.5010823", "0.5001876", "0.5000478", "0.49987435", "0.49965855", "0.49936968", "0.49877268", "0.4984821", "0.49714684", "0.49625134", "0.49578208", "0.49427986", "0.49247983", "0.49198934" ]
0.7650072
0
SetPayload sets the payload to the delete core v1 namespaced pod o k response
func (o *DeleteCoreV1NamespacedPodOK) SetPayload(payload *models.IoK8sAPICoreV1Pod) { o.Payload = payload }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *DeleteCoreV1NamespacedPodAccepted) SetPayload(payload *models.IoK8sAPICoreV1Pod) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1NamespacedConfigMapOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationOK) SetPayload(payload *models.DeletedResponse) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1NamespacedPodOK) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedConfigMapAccepted) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDOK) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDInternalServerError) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *WeaviateSchemaActionsDeleteBadRequest) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *WatchCoreV1NamespacedEndpointsOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1WatchEvent) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedPodBindingOK) SetPayload(payload *models.IoK8sAPICoreV1Binding) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDUnauthorized) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeleteUserOK) SetPayload(payload *models.DeletedResponse) {\n\to.Payload = payload\n}", "func (o *DeleteRuntimeContainerInternalServerError) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *DeleteApiextensionsV1CollectionCustomResourceDefinitionOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDNotFound) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteRuntimeContainerNotFound) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *PostOperationsDeleteP2PPathOK) SetPayload(payload *models.TapiPathComputationDeleteP2PPathOutput) {\n\to.Payload = payload\n}", "func (o *DeleteConsulDefault) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1CollectionNamespacedLimitRangeOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *ThingsDeleteForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenOK) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (o *ThingsDeleteInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteOrgOK) SetPayload(payload *DeleteOrgOKBody) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteStorageByIDOK) SetPayload(payload *models.Storage) {\n\to.Payload = payload\n}", "func (o *DeleteCertificatesV1CollectionCertificateSigningRequestOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteProjectUserUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedPodBindingCreated) SetPayload(payload *models.IoK8sAPICoreV1Binding) {\n\to.Payload = payload\n}", "func (o *DeleteAllRevisionsOK) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *DeleteUserUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteStorageByIDUnauthorized) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDBadRequest) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeleteConsulNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteUserForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *PatchCoreV1PersistentVolumeOK) SetPayload(payload *models.IoK8sAPICoreV1PersistentVolume) {\n\to.Payload = payload\n}", "func (o *DeleteOfferingByIDInternalServerError) SetPayload(payload *models.ErrorModel) {\n\to.Payload = payload\n}", "func (o *DeleteAdmissionregistrationV1beta1CollectionMutatingWebhookConfigurationOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenCreated) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (o *DeleteGroupByIDUnauthorized) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteProjectUserInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteStorageByIDNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteUserInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteAddressesDefault) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *UpdateClusterUnauthorized) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "func (o *DeleteGroupByIDNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteOrgNotFound) SetPayload(payload *DeleteOrgNotFoundBody) {\n\to.Payload = payload\n}", "func (o *DeleteOfferingByIDForbidden) SetPayload(payload *models.ErrorModel) {\n\to.Payload = payload\n}", "func (o *DeleteServiceIDFailure) SetPayload(payload models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteImageDefault) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationNotFound) SetPayload(payload *models.MissingResponse) {\n\to.Payload = payload\n}", "func (o *CreateClusterCreated) SetPayload(payload *models.Kluster) {\n\to.Payload = payload\n}", "func (o *DeleteRuntimeContainerBadRequest) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *DeleteUserInternalServerError) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *DeleteProjectUserBadGateway) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *GetNamespacedNotebooksUnauthorized) SetPayload(payload *models.Error) {\r\n\to.Payload = payload\r\n}", "func (o *DeleteProjectUserConflict) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *GetCoreAPIVersionsOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1APIVersions) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedPodBindingAccepted) SetPayload(payload *models.IoK8sAPICoreV1Binding) {\n\to.Payload = payload\n}", "func (o *UpdateClusterNotFound) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "func (o *GetDataContextTopologyUUIDNodeNodeUUIDOK) SetPayload(payload *models.TapiTopologyTopologyNode) {\n\to.Payload = payload\n}", "func (o *ReplacePolicyV1beta1NamespacedPodDisruptionBudgetOK) SetPayload(payload *models.IoK8sAPIPolicyV1beta1PodDisruptionBudget) {\n\to.Payload = payload\n}", "func (o *WeaviateActionsPatchOK) SetPayload(payload *models.ActionGetResponse) {\n\to.Payload = payload\n}", "func (o *UpdateClusterInternalServerError) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "func (o *GetClusterMethodNotAllowed) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *GetNamespacedNotebooksOK) SetPayload(payload *models.GetNotebooksResponse) {\r\n\to.Payload = payload\r\n}", "func (o *ReplaceExtensionsV1beta1NamespacedIngressCreated) SetPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) {\n\to.Payload = payload\n}", "func (o *PutWorkpaceByIDOK) SetPayload(payload *models.Workspace) {\n\to.Payload = payload\n}", "func (o *DeleteGroupByIDOK) SetPayload(payload *models.Group) {\n\to.Payload = payload\n}", "func (o *ReplaceExtensionsV1beta1NamespacedIngressOK) SetPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) {\n\to.Payload = payload\n}", "func (o *DeleteProjectUserBadRequest) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *PostFriendsUpdatesListUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteOfferingByIDBadRequest) SetPayload(payload *models.InvalidParameterInput) {\n\to.Payload = payload\n}", "func (o *RemoveOneDefault) SetPayload(payload *rest_model.RestError) {\n\to.Payload = payload\n}", "func (o *CreateDiscoveryV1beta1NamespacedEndpointSliceOK) SetPayload(payload *models.IoK8sAPIDiscoveryV1beta1EndpointSlice) {\n\to.Payload = payload\n}", "func (o *GetNFTContractTokenOK) SetPayload(payload *models.NFTTokenRow) {\n\to.Payload = payload\n}", "func (o *DeleteAddressesOK) SetPayload(payload models.AddressConfigMap) {\n\to.Payload = payload\n}", "func (o *ObjectsPatchForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *CreateExtensionsV1beta1NamespacedIngressOK) SetPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) {\n\to.Payload = payload\n}", "func (o *CreateExtensionsV1beta1NamespacedIngressCreated) SetPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) {\n\to.Payload = payload\n}", "func (o *ListAppsV1NamespacedDeploymentOK) SetPayload(payload *models.IoK8sAPIAppsV1DeploymentList) {\n\to.Payload = payload\n}", "func (o *ConnectCoreV1OptionsNodeProxyOK) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *ObjectsClassPutForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *CreateCoordinationV1NamespacedLeaseOK) SetPayload(payload *models.IoK8sAPICoordinationV1Lease) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDOK) WithPayload(payload *models.Response) *DeletePostbyIDOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *WatchPolicyV1beta1PodSecurityPolicyOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1WatchEvent) {\n\to.Payload = payload\n}", "func (o *CreateNetworkingV1beta1NamespacedIngressCreated) SetPayload(payload *models.IoK8sAPINetworkingV1beta1Ingress) {\n\to.Payload = payload\n}", "func (o *ReplicateUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDUnauthorized) WithPayload(payload *models.Response) *DeletePostbyIDUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func (o *AddNamespaceToGroupOK) SetPayload(payload *models.GroupNamespace) {\n\to.Payload = payload\n}", "func (o *ObjectsPatchInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *AddNamespaceToGroupUnauthorized) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *GetServicesHaproxyRuntimeAclsIDOK) SetPayload(payload *models.ACLFile) {\n\to.Payload = payload\n}", "func (o *PutWorkpaceByIDInternalServerError) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenAccepted) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (o *GetClusterOK) SetPayload(payload *models.Cluster) {\n\to.Payload = payload\n}", "func (o *CreateRbacAuthorizationV1NamespacedRoleOK) SetPayload(payload *models.IoK8sAPIRbacV1Role) {\n\to.Payload = payload\n}", "func (o *PatchApiextensionsV1beta1CustomResourceDefinitionStatusOK) SetPayload(payload *models.IoK8sApiextensionsApiserverPkgApisApiextensionsV1beta1CustomResourceDefinition) {\n\to.Payload = payload\n}", "func (o *CreateHPCResourceUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}" ]
[ "0.73235345", "0.72438246", "0.7051416", "0.6964047", "0.67757857", "0.67754436", "0.6732913", "0.6657868", "0.6622713", "0.66210383", "0.6610833", "0.66014844", "0.65748113", "0.6540989", "0.6538674", "0.651376", "0.64942646", "0.6494105", "0.64776886", "0.64722115", "0.6457593", "0.6439711", "0.64336145", "0.6426071", "0.6420199", "0.6411984", "0.63631123", "0.63530844", "0.6344169", "0.6335957", "0.6333833", "0.63127965", "0.6260124", "0.62447745", "0.623714", "0.6236347", "0.6233496", "0.62263876", "0.62238306", "0.6211648", "0.6205968", "0.6198745", "0.6188893", "0.6165388", "0.6138117", "0.6137934", "0.6132594", "0.61272615", "0.61261857", "0.611947", "0.61149925", "0.6114952", "0.6105722", "0.60809827", "0.6077365", "0.6074932", "0.6073105", "0.6058764", "0.60454327", "0.6042046", "0.60401016", "0.6032232", "0.60192144", "0.60158795", "0.6012889", "0.6003131", "0.60001785", "0.59795976", "0.59760827", "0.5972015", "0.5969316", "0.5966095", "0.59653413", "0.5956718", "0.59558713", "0.5954815", "0.5953798", "0.59495324", "0.5949207", "0.5946517", "0.59293795", "0.5928929", "0.5927538", "0.5924853", "0.5919707", "0.5911592", "0.59113777", "0.59107", "0.5908711", "0.5903506", "0.5902604", "0.59018296", "0.58959633", "0.5895442", "0.5895259", "0.5890942", "0.5883707", "0.58825094", "0.5875471", "0.5873537" ]
0.78772104
0
WriteResponse to the client
func (o *DeleteCoreV1NamespacedPodOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(200) if o.Payload != nil { payload := o.Payload if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *Response) Write(w io.Writer) error", "func (c *Operation) writeResponse(rw http.ResponseWriter, status int, data []byte) { // nolint: unparam\n\trw.WriteHeader(status)\n\n\tif _, err := rw.Write(data); err != nil {\n\t\tlogger.Errorf(\"Unable to send error message, %s\", err)\n\t}\n}", "func WriteResponse(w http.ResponseWriter, mensaje string, code int) {\n\tmessage := myTypes.Respuesta{\n\t\tMessage: mensaje,\n\t}\n\tresponse, _ := json.Marshal(message)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(code)\n\tw.Write(response)\n}", "func WriteResponse(w http.ResponseWriter, object interface{}, rerr *irma.RemoteError) {\n\tstatus, bts := JsonResponse(object, rerr)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(status)\n\t_, err := w.Write(bts)\n\tif err != nil {\n\t\tLogWarning(errors.WrapPrefix(err, \"failed to write response\", 0))\n\t}\n}", "func (o *PingOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n}", "func WriteResponse(w http.ResponseWriter, v interface{}, statusCode int) {\n\tresBody, err := json.Marshal(v)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(statusCode)\n\t_, _ = w.Write(resBody)\n}", "func WriteResponse(w http.ResponseWriter, code int, object interface{}) {\n\tdata, err := json.Marshal(object)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(code)\n\tw.Write(data)\n}", "func (o *GetPingOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "func writeResponse(body []byte, w *http.ResponseWriter) {\n\t(*w).Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\t_, err := (*w).Write(body)\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\t(*w).WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func WriteResponse(w http.ResponseWriter, code int, resp interface{}) error {\n\tj, err := json.Marshal(resp)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn err\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(code)\n\n\t_, err = w.Write(j)\n\treturn err\n}", "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}", "func WriteResponse(w http.ResponseWriter, d string) {\n\tw.WriteHeader(200)\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.Write([]byte(d))\n\treturn\n}", "func (o *CreateFacilityUsersOK) 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}", "func writeResponse(w http.ResponseWriter, response Response) {\n\tjson, err := json.Marshal(&response)\n\n\tif err != nil {\n\t\tfmt.Fprint(w, \"There was an error processing the request.\")\n\t}\n\n\tcommon.Log(fmt.Sprintf(\"Returning response %s\", json))\n\tfmt.Fprintf(w, \"%s\", json)\n}", "func (o *CreateProgramOK) 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}", "func (o *DepositNewFileOK) 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}", "func (o *UpdateMedicineOK) 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}", "func (o *CreateTaskCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Location\n\n\tlocation := o.Location.String()\n\tif location != \"\" {\n\t\trw.Header().Set(\"Location\", location)\n\t}\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func writeResponse(r *http.Request, w http.ResponseWriter, code int, resp interface{}) {\n\n\t// Deal with CORS\n\tif origin := r.Header.Get(\"Origin\"); origin != \"\" {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", origin)\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"DELETE, GET, HEAD, OPTIONS, POST, PUT\")\n\t\tw.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n\t\t// Allow any headers\n\t\tif wantedHeaders := r.Header.Get(\"Access-Control-Request-Headers\"); wantedHeaders != \"\" {\n\t\t\tw.Header().Set(\"Access-Control-Allow-Headers\", wantedHeaders)\n\t\t}\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\n\tb, err := json.Marshal(resp)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprintln(w, `{\"error\":\"failed to marshal json\"}`)\n\t\treturn\n\t}\n\n\tw.WriteHeader(code)\n\tfmt.Fprintln(w, string(b))\n}", "func (o *VerifyAccountCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func writeResponse(w http.ResponseWriter, h int, p interface{}) {\n\t// I set the content type...\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t// ... I write the specified status code...\n\tw.WriteHeader(h)\n\t// ... and I write the response\n\tb, _ := json.Marshal(p)\n\tw.Write(b)\n}", "func (o *UpdateCatalogOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "func (c *SwitchVersion) WriteResponse(rw http.ResponseWriter, rp runtime.Producer) {\n\tswitch c.Request.Method {\n\tcase http.MethodPost:\n\t\tc.postSwitchVersion(rw, rp)\n\tdefault:\n\t\tc.notSupported(rw, rp)\n\t}\n}", "func (o *PutRecordingsOK) 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}", "func (o *BofaChkUpdateOK) 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}", "func (o *VerifyHealthCredentialOK) 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}", "func WriteResponse(w http.ResponseWriter, code int, err error, data interface{}, t0 time.Time) {\n\tw.WriteHeader(code)\n\tresp := &Response{Data: data, Dur: fmt.Sprint(time.Since(t0)), OK: false}\n\tif code < 300 {\n\t\tresp.OK = true\n\t}\n\tif err != nil {\n\t\tresp.Err = err.Error()\n\t}\n\terr = json.NewEncoder(w).Encode(resp)\n\tif err != nil {\n\t\tlog.Infof(\"failed to json encode response: %v\", err)\n\t\tif _, err = w.Write([]byte(spew.Sdump(resp))); err != nil {\n\t\t\tlog.Infof(\"failed to write dump of response: %v\", err)\n\t\t}\n\t}\n}", "func (o *NewDiscoveryOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "func writeResponse(data []byte, size int64, ctype string, w http.ResponseWriter) {\n\tw.Header().Set(\"Content-Type\", ctype)\n\tw.Header().Set(\"Content-Length\", fmt.Sprintf(\"%d\", size))\n\tw.Header().Set(\"Cache-Control\", \"no-transform,public,max-age=86400,s-maxage=2592000\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(data)\n}", "func writeResponse(w http.ResponseWriter, code int, object interface{}) {\n\tfmt.Println(\"writing response:\", code, object)\n\tdata, err := json.Marshal(object)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tw.Header().Set(\"content-type\", \"application/json\")\n\tw.WriteHeader(code)\n\tw.Write(data)\n}", "func writeResponse(w http.ResponseWriter, authZRes *authorization.Response) {\n\n\tdata, err := json.Marshal(authZRes)\n\tif err != nil {\n\t\tlog.Fatal(\"Failed to marshel authz response %q\", err.Error())\n\t} else {\n\t\tw.Write(data)\n\t}\n\n\tif authZRes == nil || authZRes.Err != \"\" {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t}\n}", "func (o *GetCharactersCharacterIDOpportunitiesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make(models.GetCharactersCharacterIDOpportunitiesOKBody, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "func (o *WeaviateThingsGetNotImplemented) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(501)\n}", "func (c *UpdateSwitch) WriteResponse(rw http.ResponseWriter, rp runtime.Producer) {\n\tswitch c.Request.Method {\n\tcase http.MethodPost:\n\t\tc.postUpdateSwitch(rw, rp)\n\tdefault:\n\t\tc.notSupported(rw, rp)\n\t}\n}", "func (c *UpdateSwitch) WriteResponse(rw http.ResponseWriter, rp runtime.Producer) {\n\tswitch c.Request.Method {\n\tcase http.MethodPost:\n\t\tc.postUpdateSwitch(rw, rp)\n\tdefault:\n\t\tc.notSupported(rw, rp)\n\t}\n}", "func (o *UpdateLinkInPostOK) 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}", "func (o *GetChatroomsIDOK) 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}", "func (o *GetEchoNameOK) 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}", "func (o *GetUIContentOK) 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}", "func (o *ListVsphereResourceOK) 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}", "func ResponseWrite(w http.ResponseWriter, responseCode int, responseData interface{}) {\n\t// Write Response\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(responseCode)\n\n\t// Write JSON to Response\n\tjson.NewEncoder(w).Encode(responseData)\n}", "func writeHTTPResponseInWriter(httpRes http.ResponseWriter, httpReq *http.Request, nobelPrizeWinnersResponse []byte, err error) {\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\thttp.Error(httpRes, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tlog.Printf(\"Request %s Succesfully Completed\", httpReq.RequestURI)\n\thttpRes.Header().Set(\"Content-Type\", \"application/json\")\n\thttpRes.Write(nobelPrizeWinnersResponse)\n}", "func (o *PostKeysKeyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "func (o *Operation) writeResponse(rw io.Writer, v interface{}) {\n\terr := json.NewEncoder(rw).Encode(v)\n\tif err != nil {\n\t\tlog.Errorf(\"Unable to send error response, %s\", err)\n\t}\n}", "func writeResponse(data interface{}, w http.ResponseWriter) error {\n\tvar (\n\t\tenc []byte\n\t\terr error\n\t)\n\tenc, err = json.Marshal(data)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn fmt.Errorf(\"Failure to marshal, err = %s\", err)\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tn, err := w.Write(enc)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn fmt.Errorf(\"Failure to write, err = %s\", err)\n\t}\n\tif n != len(enc) {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn fmt.Errorf(\"Short write sent = %d, wrote = %d\", len(enc), n)\n\t}\n\treturn nil\n}", "func (o *CreateUserOK) 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}", "func (o *UpdateMoveTaskOrderPostCounselingInformationOK) 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}", "func WriteResponse(rw io.Writer, v interface{}) {\n\terr := json.NewEncoder(rw).Encode(v)\n\tif err != nil {\n\t\tlogger.Errorf(\"Unable to send error response, %s\", err)\n\t}\n}", "func (o *PutQuestionOK) 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}", "func (r *response) Write(b []byte) (n int, err error) {\n\tif !r.headersSend {\n\t\tif r.status == 0 {\n\t\t\tr.status = http.StatusOK\n\t\t}\n\t\tr.WriteHeader(r.status)\n\t}\n\tn, err = r.ResponseWriter.Write(b)\n\tr.size += int64(n)\n\treturn\n}", "func (o *PostOperationsDeleteP2PPathCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func (o *HealthGetOK) 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}", "func (o *WeaviateThingsPatchNotImplemented) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(501)\n}", "func (o *VerifyEmailTokenOK) 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}", "func (o *DeleteServiceIDOK) 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}", "func (o *WeaviateThingsGetOK) 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}", "func (o *Operation) writeResponse(rw io.Writer, v interface{}) {\n\terr := json.NewEncoder(rw).Encode(v)\n\t// as of now, just log errors for writing response\n\tif err != nil {\n\t\tlogger.Errorf(\"Unable to send error response, %s\", err)\n\t}\n}", "func (o *PostOperationsGetNodeEdgePointDetailsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func (o *UserEditOK) 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}", "func (o *WeaviatePeersAnnounceOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "func (o *CertifyOK) 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}", "func writeResponse(writer http.ResponseWriter, response *http.Response) (int64, error) {\n\tdefer response.Body.Close()\n\twriteResponseHeaders(writer, response, false)\n\treturn io.Copy(writer, response.Body)\n}", "func (o *PutMeetupDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(o._statusCode)\n}", "func (o *FingerPathsPostCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func (o *PostPlaybookOK) 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}", "func (o *UpdateHostIgnitionCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func (o *GetCharactersCharacterIDLocationOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (o *GetPingDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n}", "func (o *PostManagementKubernetesIoV1NodesOK) 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}", "func (o *PutPerformancesOK) 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}", "func (o *StopAppAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\n}", "func (o *GetFleetsFleetIDMembersOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Content-Language\n\n\tcontentLanguage := o.ContentLanguage\n\tif contentLanguage != \"\" {\n\t\trw.Header().Set(\"Content-Language\", contentLanguage)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make(models.GetFleetsFleetIDMembersOKBody, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "func (o *GetMeetupsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(o._statusCode)\n}", "func (o *PostEventCreated) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(201)\n}", "func (o *GetTaskTaskIDOK) 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}", "func (o *CreateTCPCheckAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Reload-ID\n\n\treloadID := o.ReloadID\n\tif reloadID != \"\" {\n\t\trw.Header().Set(\"Reload-ID\", reloadID)\n\t}\n\n\trw.WriteHeader(202)\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}", "func (o *PostOperationsGetNetworkElementListCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func (o *ServiceInstanceLastOperationGetOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header RetryAfter\n\n\tretryAfter := o.RetryAfter\n\tif retryAfter != \"\" {\n\t\trw.Header().Set(\"RetryAfter\", retryAfter)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (o *GetPiecesIDOK) 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}", "func (o *GetTaskDetailsOK) 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}", "func (o *UpdateClusterOK) 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}", "func (o *GetDetailOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\trw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\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}", "func (o *GetServicesHaproxyRuntimeAclsIDOK) 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}", "func (r *responseInfoRecorder) Write(b []byte) (int, error) {\n\tr.ContentLength += int64(len(b))\n\tif r.statusCode == 0 {\n\t\tr.statusCode = http.StatusOK\n\t}\n\treturn r.ResponseWriter.Write(b)\n}", "func (o *LogoutOK) 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}", "func (o *UploadFileOK) 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}", "func WriteResponse(w http.ResponseWriter, data interface{}) error {\n\tenv := map[string]interface{}{\n\t\t\"meta\": map[string]interface{}{\n\t\t\t\"code\": http.StatusOK,\n\t\t},\n\t\t\"data\": data,\n\t}\n\treturn jsonResponse(w, env)\n}", "func (o *WeaviateThingTemplatesCreateNotImplemented) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(501)\n}", "func (r *Responder) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\tfor k, v := range r.headers {\n\t\tfor _, val := range v {\n\t\t\trw.Header().Add(k, val)\n\t\t}\n\t}\n\n\trw.WriteHeader(r.code)\n\n\tif r.response != nil {\n\t\tif err := producer.Produce(rw, r.response); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n}", "func (o *GetGateSourceByGateNameAndMntOK) 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}", "func (o *CreateSpoeCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(201)\n\tpayload := o.Payload\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "func (o *Output) writeResponse(response string) error {\r\n\t// write the response\r\n\tif _, err := o.writer.WriteString(response + \"\\n\"); err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\treturn nil\r\n}", "func (o *GetTransportByIDOK) 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}", "func (o *TransferOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n\tif err := producer.Produce(rw, o.Payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "func (o *CreateUserCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func (o *ViewOneOrderOK) 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}", "func (o *GetVisiblePruebasFromQuestionTestInternalServerError) 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}", "func (o *GetWhaleTranfersOK) 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 = make([]*models.OperationsRow, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "func (o *SearchTournamentsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make([]*models.Tournament, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "func (o *CreateTCPCheckCreated) 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}", "func (s *Server) writeInfoResponse(\n\tw http.ResponseWriter,\n\tr *http.Request,\n\tmessage []byte,\n\tstatus int,\n\theaders map[string]string,\n) {\n\tfor k, v := range headers {\n\t\tw.Header().Add(k, v)\n\t}\n\n\tw.WriteHeader(status)\n\tw.Write(message)\n}" ]
[ "0.81303823", "0.7882039", "0.77722245", "0.7771901", "0.7753117", "0.7740585", "0.76670325", "0.7638451", "0.76095873", "0.75798", "0.7579178", "0.7567389", "0.7560546", "0.75579476", "0.75447774", "0.7542929", "0.75416607", "0.753386", "0.7531158", "0.75192654", "0.75191355", "0.7513389", "0.7512029", "0.75050455", "0.7503395", "0.74984574", "0.74875605", "0.74839836", "0.74772394", "0.7467842", "0.746699", "0.7465759", "0.7464175", "0.746404", "0.746404", "0.7461224", "0.7460309", "0.74595356", "0.74463046", "0.7443478", "0.7435917", "0.7426582", "0.7425581", "0.74186546", "0.7413175", "0.7407469", "0.74063516", "0.74048966", "0.7398737", "0.7389631", "0.738607", "0.73806983", "0.7360552", "0.7360491", "0.7355327", "0.7354953", "0.73532444", "0.7347445", "0.734586", "0.732798", "0.732577", "0.73178244", "0.7316643", "0.7316071", "0.7315527", "0.7312546", "0.73114824", "0.7310336", "0.7309039", "0.73007035", "0.7297214", "0.7291373", "0.7291277", "0.72884554", "0.72845477", "0.72835207", "0.7281928", "0.7281033", "0.72751075", "0.7274423", "0.7273193", "0.72730565", "0.72695094", "0.7269139", "0.72690886", "0.7265927", "0.72615093", "0.72529227", "0.7251764", "0.72490144", "0.72479355", "0.72469014", "0.72407585", "0.72390425", "0.72367245", "0.7234706", "0.722777", "0.722197", "0.7215153", "0.72140837", "0.7213089" ]
0.0
-1
NewDeleteCoreV1NamespacedPodAccepted creates DeleteCoreV1NamespacedPodAccepted with default headers values
func NewDeleteCoreV1NamespacedPodAccepted() *DeleteCoreV1NamespacedPodAccepted { return &DeleteCoreV1NamespacedPodAccepted{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewCreateCoreV1NamespacedPodAccepted() *CreateCoreV1NamespacedPodAccepted {\n\treturn &CreateCoreV1NamespacedPodAccepted{}\n}", "func NewDeleteCoreV1NamespacedEventAccepted() *DeleteCoreV1NamespacedEventAccepted {\n\treturn &DeleteCoreV1NamespacedEventAccepted{}\n}", "func NewDeleteCoreV1NamespacedServiceAccepted() *DeleteCoreV1NamespacedServiceAccepted {\n\treturn &DeleteCoreV1NamespacedServiceAccepted{}\n}", "func (o *DeleteCoreV1NamespacedPodAccepted) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodAccepted {\n\to.Payload = payload\n\treturn o\n}", "func NewDeleteCoreV1NamespacedConfigMapAccepted() *DeleteCoreV1NamespacedConfigMapAccepted {\n\n\treturn &DeleteCoreV1NamespacedConfigMapAccepted{}\n}", "func NewCreateCoreV1NamespacedPodBindingAccepted() *CreateCoreV1NamespacedPodBindingAccepted {\n\n\treturn &CreateCoreV1NamespacedPodBindingAccepted{}\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenAccepted() *CreateCoreV1NamespacedServiceAccountTokenAccepted {\n\n\treturn &CreateCoreV1NamespacedServiceAccountTokenAccepted{}\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenAccepted() *CreateCoreV1NamespacedServiceAccountTokenAccepted {\n\treturn &CreateCoreV1NamespacedServiceAccountTokenAccepted{}\n}", "func NewDeleteCoreV1PersistentVolumeAccepted() *DeleteCoreV1PersistentVolumeAccepted {\n\treturn &DeleteCoreV1PersistentVolumeAccepted{}\n}", "func NewDeleteCoreV1NamespacedPodOK() *DeleteCoreV1NamespacedPodOK {\n\n\treturn &DeleteCoreV1NamespacedPodOK{}\n}", "func (o *DeleteCoreV1NamespacedConfigMapAccepted) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteCoreV1NamespacedConfigMapAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedPodAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\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}", "func NewCreateNetworkingV1beta1NamespacedIngressAccepted() *CreateNetworkingV1beta1NamespacedIngressAccepted {\n\n\treturn &CreateNetworkingV1beta1NamespacedIngressAccepted{}\n}", "func NewQtreeDeleteAccepted() *QtreeDeleteAccepted {\n\treturn &QtreeDeleteAccepted{}\n}", "func NewCreateExtensionsV1beta1NamespacedIngressAccepted() *CreateExtensionsV1beta1NamespacedIngressAccepted {\n\n\treturn &CreateExtensionsV1beta1NamespacedIngressAccepted{}\n}", "func (o *CreateCoreV1NamespacedPodBindingAccepted) WithPayload(payload *models.IoK8sAPICoreV1Binding) *CreateCoreV1NamespacedPodBindingAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenAccepted) WithPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) *CreateCoreV1NamespacedServiceAccountTokenAccepted {\n\to.Payload = payload\n\treturn o\n}", "func NewPcloudCloudconnectionsDeleteAccepted() *PcloudCloudconnectionsDeleteAccepted {\n\treturn &PcloudCloudconnectionsDeleteAccepted{}\n}", "func NewDeleteCertificatesV1beta1CertificateSigningRequestAccepted() *DeleteCertificatesV1beta1CertificateSigningRequestAccepted {\n\treturn &DeleteCertificatesV1beta1CertificateSigningRequestAccepted{}\n}", "func NewDeleteCoreV1NamespacedEventOK() *DeleteCoreV1NamespacedEventOK {\n\treturn &DeleteCoreV1NamespacedEventOK{}\n}", "func NewCreateRbacAuthorizationV1NamespacedRoleAccepted() *CreateRbacAuthorizationV1NamespacedRoleAccepted {\n\n\treturn &CreateRbacAuthorizationV1NamespacedRoleAccepted{}\n}", "func NewPcloudPvminstancesVolumesDeleteAccepted() *PcloudPvminstancesVolumesDeleteAccepted {\n\treturn &PcloudPvminstancesVolumesDeleteAccepted{}\n}", "func NewCreateCoreV1NamespacedPodOK() *CreateCoreV1NamespacedPodOK {\n\treturn &CreateCoreV1NamespacedPodOK{}\n}", "func NewDeleteFlowcontrolApiserverV1alpha1PriorityLevelConfigurationAccepted() *DeleteFlowcontrolApiserverV1alpha1PriorityLevelConfigurationAccepted {\n\treturn &DeleteFlowcontrolApiserverV1alpha1PriorityLevelConfigurationAccepted{}\n}", "func NewCreateDiscoveryV1beta1NamespacedEndpointSliceAccepted() *CreateDiscoveryV1beta1NamespacedEndpointSliceAccepted {\n\n\treturn &CreateDiscoveryV1beta1NamespacedEndpointSliceAccepted{}\n}", "func NewDeleteCoreV1NamespacedServiceOK() *DeleteCoreV1NamespacedServiceOK {\n\treturn &DeleteCoreV1NamespacedServiceOK{}\n}", "func NewPcloudCloudinstancesSnapshotsDeleteAccepted() *PcloudCloudinstancesSnapshotsDeleteAccepted {\n\treturn &PcloudCloudinstancesSnapshotsDeleteAccepted{}\n}", "func NewCreateRbacAuthorizationV1alpha1NamespacedRoleAccepted() *CreateRbacAuthorizationV1alpha1NamespacedRoleAccepted {\n\n\treturn &CreateRbacAuthorizationV1alpha1NamespacedRoleAccepted{}\n}", "func NewDeleteNodeV1alpha1RuntimeClassAccepted() *DeleteNodeV1alpha1RuntimeClassAccepted {\n\treturn &DeleteNodeV1alpha1RuntimeClassAccepted{}\n}", "func NewCreateCoreV1NamespacedPodBindingOK() *CreateCoreV1NamespacedPodBindingOK {\n\n\treturn &CreateCoreV1NamespacedPodBindingOK{}\n}", "func NewDeleteCoreV1NamespacedConfigMapOK() *DeleteCoreV1NamespacedConfigMapOK {\n\n\treturn &DeleteCoreV1NamespacedConfigMapOK{}\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteVpcPeeringConnectionInput, error) {\n\tres := &svcsdk.DeleteVpcPeeringConnectionInput{}\n\n\tif r.ko.Spec.DryRun != nil {\n\t\tres.SetDryRun(*r.ko.Spec.DryRun)\n\t}\n\tif r.ko.Status.VPCPeeringConnectionID != nil {\n\t\tres.SetVpcPeeringConnectionId(*r.ko.Status.VPCPeeringConnectionID)\n\t}\n\n\treturn res, nil\n}", "func NewCreateAutoscalingV2beta2NamespacedHorizontalPodAutoscalerAccepted() *CreateAutoscalingV2beta2NamespacedHorizontalPodAutoscalerAccepted {\n\treturn &CreateAutoscalingV2beta2NamespacedHorizontalPodAutoscalerAccepted{}\n}", "func NewCreateAppsV1NamespacedControllerRevisionAccepted() *CreateAppsV1NamespacedControllerRevisionAccepted {\n\treturn &CreateAppsV1NamespacedControllerRevisionAccepted{}\n}", "func NewCreateBatchV1NamespacedJobAccepted() *CreateBatchV1NamespacedJobAccepted {\n\n\treturn &CreateBatchV1NamespacedJobAccepted{}\n}", "func (o *DeleteCoreV1NamespacedConfigMapAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\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}", "func NewCreateCoreV1PersistentVolumeAccepted() *CreateCoreV1PersistentVolumeAccepted {\n\treturn &CreateCoreV1PersistentVolumeAccepted{}\n}", "func (o *CreateNetworkingV1beta1NamespacedIngressAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\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}", "func NewDeleteCoreV1NamespacedPodUnauthorized() *DeleteCoreV1NamespacedPodUnauthorized {\n\n\treturn &DeleteCoreV1NamespacedPodUnauthorized{}\n}", "func (o *DeleteCoreV1NamespacedPodOK) 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}", "func NewDeleteStorageV1VolumeAttachmentAccepted() *DeleteStorageV1VolumeAttachmentAccepted {\n\treturn &DeleteStorageV1VolumeAttachmentAccepted{}\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\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}", "func NewDeleteRuntimeContainerOK() *DeleteRuntimeContainerOK {\n\n\treturn &DeleteRuntimeContainerOK{}\n}", "func NewCreateCoordinationV1NamespacedLeaseAccepted() *CreateCoordinationV1NamespacedLeaseAccepted {\n\n\treturn &CreateCoordinationV1NamespacedLeaseAccepted{}\n}", "func (o *DeleteCoreV1NamespacedPodOK) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *CreateNetworkingV1beta1NamespacedIngressAccepted) WithPayload(payload *models.IoK8sAPINetworkingV1beta1Ingress) *CreateNetworkingV1beta1NamespacedIngressAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (o *CreateCoreV1NamespacedPodBindingAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\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}", "func (o *CreateExtensionsV1beta1NamespacedIngressAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\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}", "func NewCreateCoreV1NamespacedPodUnauthorized() *CreateCoreV1NamespacedPodUnauthorized {\n\treturn &CreateCoreV1NamespacedPodUnauthorized{}\n}", "func (o *CreateDiscoveryV1beta1NamespacedEndpointSliceAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\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}", "func Delete(kind string, name string, namespace string, args ...string) (err error) {\n\tdeleteArgs := []string{\"delete\", kind, name, \"-n\", namespace}\n\t_, err = kubectl(append(deleteArgs, args...)...)\n\treturn\n}", "func (o *CreateExtensionsV1beta1NamespacedIngressAccepted) WithPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) *CreateExtensionsV1beta1NamespacedIngressAccepted {\n\to.Payload = payload\n\treturn o\n}", "func NewWatchCoreV1NamespacedEndpointsOK() *WatchCoreV1NamespacedEndpointsOK {\n\n\treturn &WatchCoreV1NamespacedEndpointsOK{}\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteVpnConnectionInput, error) {\n\tres := &svcsdk.DeleteVpnConnectionInput{}\n\n\tif r.ko.Spec.DryRun != nil {\n\t\tres.SetDryRun(*r.ko.Spec.DryRun)\n\t}\n\tif r.ko.Status.VPNConnectionID != nil {\n\t\tres.SetVpnConnectionId(*r.ko.Status.VPNConnectionID)\n\t}\n\n\treturn res, nil\n}", "func (a *Client) CreatePolicyV1beta1NamespacedPodDisruptionBudget(params *CreatePolicyV1beta1NamespacedPodDisruptionBudgetParams) (*CreatePolicyV1beta1NamespacedPodDisruptionBudgetOK, *CreatePolicyV1beta1NamespacedPodDisruptionBudgetCreated, *CreatePolicyV1beta1NamespacedPodDisruptionBudgetAccepted, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewCreatePolicyV1beta1NamespacedPodDisruptionBudgetParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"createPolicyV1beta1NamespacedPodDisruptionBudget\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/apis/policy/v1beta1/namespaces/{namespace}/poddisruptionbudgets\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/vnd.kubernetes.protobuf\", \"application/yaml\"},\n\t\tConsumesMediaTypes: []string{\"*/*\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &CreatePolicyV1beta1NamespacedPodDisruptionBudgetReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\tswitch value := result.(type) {\n\tcase *CreatePolicyV1beta1NamespacedPodDisruptionBudgetOK:\n\t\treturn value, nil, nil, nil\n\tcase *CreatePolicyV1beta1NamespacedPodDisruptionBudgetCreated:\n\t\treturn nil, value, nil, nil\n\tcase *CreatePolicyV1beta1NamespacedPodDisruptionBudgetAccepted:\n\t\treturn nil, nil, value, nil\n\t}\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 policy_v1beta1: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func NewDeleteSecurityGroupOK() *DeleteSecurityGroupOK {\n\treturn &DeleteSecurityGroupOK{}\n}", "func NewCreateCoreV1NamespacedPodBindingUnauthorized() *CreateCoreV1NamespacedPodBindingUnauthorized {\n\n\treturn &CreateCoreV1NamespacedPodBindingUnauthorized{}\n}", "func NewReadCoreV1NamespacedPodOK() *ReadCoreV1NamespacedPodOK {\n\treturn &ReadCoreV1NamespacedPodOK{}\n}", "func NewWeaviateActionsPatchAccepted() *WeaviateActionsPatchAccepted {\n\n\treturn &WeaviateActionsPatchAccepted{}\n}", "func (client *PacketCoreDataPlanesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, packetCoreDataPlaneName string, options *PacketCoreDataPlanesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}\"\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 packetCoreControlPlaneName == \"\" {\n\t\treturn nil, errors.New(\"parameter packetCoreControlPlaneName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{packetCoreControlPlaneName}\", url.PathEscape(packetCoreControlPlaneName))\n\tif packetCoreDataPlaneName == \"\" {\n\t\treturn nil, errors.New(\"parameter packetCoreDataPlaneName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{packetCoreDataPlaneName}\", url.PathEscape(packetCoreDataPlaneName))\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, 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-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func (o *CreateDiscoveryV1beta1NamespacedEndpointSliceAccepted) WithPayload(payload *models.IoK8sAPIDiscoveryV1beta1EndpointSlice) *CreateDiscoveryV1beta1NamespacedEndpointSliceAccepted {\n\to.Payload = payload\n\treturn o\n}", "func NewDeleteTagDefault(code int) *DeleteTagDefault {\n\treturn &DeleteTagDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDeleteTagDefault(code int) *DeleteTagDefault {\n\treturn &DeleteTagDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (o *CreateRbacAuthorizationV1NamespacedRoleAccepted) WithPayload(payload *models.IoK8sAPIRbacV1Role) *CreateRbacAuthorizationV1NamespacedRoleAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteStageInput, error) {\n\tres := &svcsdk.DeleteStageInput{}\n\n\tif r.ko.Spec.APIID != nil {\n\t\tres.SetApiId(*r.ko.Spec.APIID)\n\t}\n\tif r.ko.Spec.StageName != nil {\n\t\tres.SetStageName(*r.ko.Spec.StageName)\n\t}\n\n\treturn res, nil\n}", "func NewDeleteCallsCallLogAccepted() *DeleteCallsCallLogAccepted {\n\treturn &DeleteCallsCallLogAccepted{}\n}", "func NewDeleteCoreV1NamespacedServiceUnauthorized() *DeleteCoreV1NamespacedServiceUnauthorized {\n\treturn &DeleteCoreV1NamespacedServiceUnauthorized{}\n}", "func (o *CreateCoordinationV1NamespacedLeaseAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\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}", "func (client *LongTermRetentionManagedInstanceBackupsClient) deleteCreateRequest(ctx context.Context, locationName string, managedInstanceName string, databaseName string, backupName string, options *LongTermRetentionManagedInstanceBackupsBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}\"\n\tif locationName == \"\" {\n\t\treturn nil, errors.New(\"parameter locationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{locationName}\", url.PathEscape(locationName))\n\tif managedInstanceName == \"\" {\n\t\treturn nil, errors.New(\"parameter managedInstanceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{managedInstanceName}\", url.PathEscape(managedInstanceName))\n\tif databaseName == \"\" {\n\t\treturn nil, errors.New(\"parameter databaseName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{databaseName}\", url.PathEscape(databaseName))\n\tif backupName == \"\" {\n\t\treturn nil, errors.New(\"parameter backupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{backupName}\", url.PathEscape(backupName))\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.MethodDelete, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-11-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treturn req, nil\n}", "func NewDelSubDeviceWithCoreRequestWithoutParam() *DelSubDeviceWithCoreRequest {\n\n return &DelSubDeviceWithCoreRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/instances/{instanceId}/products/{productKey}/edges/{edgeName}:delSubDevice\",\n Method: \"POST\",\n Header: nil,\n Version: \"v2\",\n },\n }\n}", "func (o *CreateRbacAuthorizationV1alpha1NamespacedRoleAccepted) WithPayload(payload *models.IoK8sAPIRbacV1alpha1Role) *CreateRbacAuthorizationV1alpha1NamespacedRoleAccepted {\n\to.Payload = payload\n\treturn o\n}", "func NewDeleteAPIKeyDefault(code int) *DeleteAPIKeyDefault {\n\treturn &DeleteAPIKeyDefault{\n\t\t_statusCode: code,\n\t}\n}", "func CreateDeleteDegradeControlResponse() (response *DeleteDegradeControlResponse) {\n\tresponse = &DeleteDegradeControlResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (client *PrivateDNSZoneGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string, options *PrivateDNSZoneGroupsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}\"\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 privateEndpointName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateEndpointName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateEndpointName}\", url.PathEscape(privateEndpointName))\n\tif privateDNSZoneGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateDNSZoneGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateDnsZoneGroupName}\", url.PathEscape(privateDNSZoneGroupName))\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.MethodDelete, 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-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func NewDeleteCoreV1NamespacedEventUnauthorized() *DeleteCoreV1NamespacedEventUnauthorized {\n\treturn &DeleteCoreV1NamespacedEventUnauthorized{}\n}", "func NewReadCoreV1NamespacedEndpointsOK() *ReadCoreV1NamespacedEndpointsOK {\n\treturn &ReadCoreV1NamespacedEndpointsOK{}\n}", "func (client *SourceControlConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, options *SourceControlConfigurationsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}\"\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\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 clusterRp == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterRp cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterRp}\", url.PathEscape(clusterRp))\n\tif clusterResourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterResourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterResourceName}\", url.PathEscape(clusterResourceName))\n\tif clusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterName}\", url.PathEscape(clusterName))\n\tif sourceControlConfigurationName == \"\" {\n\t\treturn nil, errors.New(\"parameter sourceControlConfigurationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{sourceControlConfigurationName}\", url.PathEscape(sourceControlConfigurationName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, 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\", \"2022-11-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func (o *PostManagementKubernetesIoV1NodesAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(202)\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenOK() *CreateCoreV1NamespacedServiceAccountTokenOK {\n\n\treturn &CreateCoreV1NamespacedServiceAccountTokenOK{}\n}", "func NewCreateTCPCheckAccepted() *CreateTCPCheckAccepted {\n\n\treturn &CreateTCPCheckAccepted{}\n}", "func (client *PeeringPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, managedNetworkName string, managedNetworkPeeringPolicyName string, options *PeeringPoliciesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkPeeringPolicies/{managedNetworkPeeringPolicyName}\"\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\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 managedNetworkName == \"\" {\n\t\treturn nil, errors.New(\"parameter managedNetworkName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{managedNetworkName}\", url.PathEscape(managedNetworkName))\n\tif managedNetworkPeeringPolicyName == \"\" {\n\t\treturn nil, errors.New(\"parameter managedNetworkPeeringPolicyName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{managedNetworkPeeringPolicyName}\", url.PathEscape(managedNetworkPeeringPolicyName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, 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\", \"2019-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func (a *Client) CreateNetworkingV1beta1NamespacedIngress(params *CreateNetworkingV1beta1NamespacedIngressParams) (*CreateNetworkingV1beta1NamespacedIngressOK, *CreateNetworkingV1beta1NamespacedIngressCreated, *CreateNetworkingV1beta1NamespacedIngressAccepted, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewCreateNetworkingV1beta1NamespacedIngressParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"createNetworkingV1beta1NamespacedIngress\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/apis/networking.k8s.io/v1beta1/namespaces/{namespace}/ingresses\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/vnd.kubernetes.protobuf\", \"application/yaml\"},\n\t\tConsumesMediaTypes: []string{\"*/*\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &CreateNetworkingV1beta1NamespacedIngressReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\tswitch value := result.(type) {\n\tcase *CreateNetworkingV1beta1NamespacedIngressOK:\n\t\treturn value, nil, nil, nil\n\tcase *CreateNetworkingV1beta1NamespacedIngressCreated:\n\t\treturn nil, value, nil, nil\n\tcase *CreateNetworkingV1beta1NamespacedIngressAccepted:\n\t\treturn nil, nil, value, nil\n\t}\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 networking_v1beta1: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (o *CreateCoordinationV1NamespacedLeaseAccepted) WithPayload(payload *models.IoK8sAPICoordinationV1Lease) *CreateCoordinationV1NamespacedLeaseAccepted {\n\to.Payload = payload\n\treturn o\n}", "func NewIPServicePolicyDeleteOK() *IPServicePolicyDeleteOK {\n\treturn &IPServicePolicyDeleteOK{}\n}", "func NewCreateCoreV1NamespacedPodBindingCreated() *CreateCoreV1NamespacedPodBindingCreated {\n\n\treturn &CreateCoreV1NamespacedPodBindingCreated{}\n}", "func NewDeleteCapabilityDefault(code int) *DeleteCapabilityDefault {\n\treturn &DeleteCapabilityDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDeleteScopeDefault(code int) *DeleteScopeDefault {\n\treturn &DeleteScopeDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (client *KeyVaultClient) purgeDeletedSecretCreateRequest(ctx context.Context, vaultBaseURL string, secretName string, options *KeyVaultClientPurgeDeletedSecretOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/deletedsecrets/{secret-name}\"\n\tif secretName == \"\" {\n\t\treturn nil, errors.New(\"parameter secretName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{secret-name}\", url.PathEscape(secretName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func addDelete(topLevel *cobra.Command) {\n\ttopLevel.AddCommand(&cobra.Command{\n\t\tUse: \"delete\",\n\t\tShort: `See \"kubectl help delete\" for detailed usage.`,\n\t\tRunE: passthru(\"kubectl\"),\n\t\t// We ignore unknown flags to avoid importing everything Go exposes\n\t\t// from our commands.\n\t\tFParseErrWhitelist: cobra.FParseErrWhitelist{\n\t\t\tUnknownFlags: true,\n\t\t},\n\t})\n}", "func TestCreatesAllowedDuringNamespaceDeletion(t *testing.T) {\n\tconfig := &origin.MasterConfig{\n\t\tKubeletClientConfig: &kclient.KubeletConfig{},\n\t\tEtcdHelper: etcdstorage.NewEtcdStorage(nil, nil, \"\"),\n\t}\n\tstorageMap := config.GetRestStorage()\n\tresources := sets.String{}\n\n\tfor resource := range storageMap {\n\t\tresources.Insert(strings.ToLower(resource))\n\t}\n\n\tfor resource := range recommendedCreatableResources {\n\t\tif !resources.Has(resource) {\n\t\t\tt.Errorf(\"recommendedCreatableResources has resource %v, but that resource isn't registered.\", resource)\n\t\t}\n\t}\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteReplicationGroupInput, error) {\n\tres := &svcsdk.DeleteReplicationGroupInput{}\n\n\tif r.ko.Spec.ReplicationGroupID != nil {\n\t\tres.SetReplicationGroupId(*r.ko.Spec.ReplicationGroupID)\n\t}\n\n\treturn res, nil\n}", "func (client *LiveOutputsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, liveOutputName string, options *LiveOutputsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}\"\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\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 accountName == \"\" {\n\t\treturn nil, errors.New(\"parameter accountName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{accountName}\", url.PathEscape(accountName))\n\tif liveEventName == \"\" {\n\t\treturn nil, errors.New(\"parameter liveEventName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{liveEventName}\", url.PathEscape(liveEventName))\n\tif liveOutputName == \"\" {\n\t\treturn nil, errors.New(\"parameter liveOutputName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{liveOutputName}\", url.PathEscape(liveOutputName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, 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\", \"2022-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func CreateDeleteApDeviceResponse() (response *DeleteApDeviceResponse) {\n\tresponse = &DeleteApDeviceResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func NewDeleteSharedDashboardResponseWithDefaults() *DeleteSharedDashboardResponse {\n\tthis := DeleteSharedDashboardResponse{}\n\treturn &this\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenOK() *CreateCoreV1NamespacedServiceAccountTokenOK {\n\treturn &CreateCoreV1NamespacedServiceAccountTokenOK{}\n}", "func NewCreateCoreV1NamespacedPodCreated() *CreateCoreV1NamespacedPodCreated {\n\treturn &CreateCoreV1NamespacedPodCreated{}\n}", "func (client *ConnectedEnvironmentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}\"\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\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 connectedEnvironmentName == \"\" {\n\t\treturn nil, errors.New(\"parameter connectedEnvironmentName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{connectedEnvironmentName}\", url.PathEscape(connectedEnvironmentName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, 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\", \"2022-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func ExampleBackupVaultsClient_BeginDelete() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armdataprotection.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.NewBackupVaultsClient().BeginDelete(ctx, \"SampleResourceGroup\", \"swaggerExample\", 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}", "func NewCreateApiregistrationV1beta1APIServiceAccepted() *CreateApiregistrationV1beta1APIServiceAccepted {\n\treturn &CreateApiregistrationV1beta1APIServiceAccepted{}\n}", "func NewPatchCoreV1NamespacedServiceAccountOK() *PatchCoreV1NamespacedServiceAccountOK {\n\treturn &PatchCoreV1NamespacedServiceAccountOK{}\n}" ]
[ "0.7400152", "0.71234435", "0.7122447", "0.70157105", "0.6747055", "0.6736624", "0.62136", "0.61368066", "0.6057876", "0.59432584", "0.58190614", "0.57760686", "0.5772118", "0.5759336", "0.5682018", "0.5618317", "0.55684346", "0.5558717", "0.5553073", "0.54162437", "0.5408024", "0.5396327", "0.5394652", "0.53666204", "0.5364611", "0.5354838", "0.5296893", "0.5277718", "0.52437615", "0.51370096", "0.5103567", "0.50722533", "0.5071671", "0.5026147", "0.50029737", "0.49972066", "0.49763402", "0.4958775", "0.4949994", "0.49382302", "0.4924234", "0.49182594", "0.4900659", "0.4894008", "0.4885936", "0.48424286", "0.48088828", "0.47826785", "0.47764865", "0.47370437", "0.47053152", "0.46964833", "0.46949172", "0.46855623", "0.46189505", "0.4615868", "0.4610079", "0.46050462", "0.45919243", "0.45779395", "0.456709", "0.45568916", "0.45568916", "0.4550069", "0.45426825", "0.4541487", "0.4540688", "0.4532757", "0.4531756", "0.45282584", "0.4519519", "0.4510085", "0.45058155", "0.448703", "0.44843236", "0.44781607", "0.44777822", "0.44753197", "0.44748136", "0.4471171", "0.44609386", "0.4456756", "0.44531837", "0.44531685", "0.44468257", "0.44372264", "0.44289443", "0.44227412", "0.441717", "0.44157746", "0.4398757", "0.4396786", "0.4393708", "0.4388897", "0.43831635", "0.43799326", "0.43742672", "0.43612987", "0.435349", "0.4353056" ]
0.7965179
0
WithPayload adds the payload to the delete core v1 namespaced pod accepted response
func (o *DeleteCoreV1NamespacedPodAccepted) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodAccepted { o.Payload = payload return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *DeleteCoreV1NamespacedPodOK) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedPodAccepted) SetPayload(payload *models.IoK8sAPICoreV1Pod) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1NamespacedConfigMapAccepted) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteCoreV1NamespacedConfigMapAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedPodOK) SetPayload(payload *models.IoK8sAPICoreV1Pod) {\n\to.Payload = payload\n}", "func (o *WeaviateSchemaActionsDeleteBadRequest) WithPayload(payload *models.ErrorResponse) *WeaviateSchemaActionsDeleteBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeletePostbyIDOK) WithPayload(payload *models.Response) *DeletePostbyIDOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedConfigMapOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteCoreV1NamespacedConfigMapOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedConfigMapAccepted) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteUserOK) WithPayload(payload *models.DeletedResponse) *DeleteUserOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedConfigMapOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *ThingsDeleteForbidden) WithPayload(payload *models.ErrorResponse) *ThingsDeleteForbidden {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeletePostbyIDInternalServerError) WithPayload(payload *models.Response) *DeletePostbyIDInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteUserForbidden) WithPayload(payload *models.ErrorResponse) *DeleteUserForbidden {\n\to.Payload = payload\n\treturn o\n}", "func (o *ThingsDeleteInternalServerError) WithPayload(payload *models.ErrorResponse) *ThingsDeleteInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteRuntimeContainerInternalServerError) WithPayload(payload string) *DeleteRuntimeContainerInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteOrganizationForbidden) WithPayload(payload *models.ErrorResponse) *DeleteOrganizationForbidden {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeletePostbyIDUnauthorized) WithPayload(payload *models.Response) *DeletePostbyIDUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteVpnConnectionInput, error) {\n\tres := &svcsdk.DeleteVpnConnectionInput{}\n\n\tif r.ko.Spec.DryRun != nil {\n\t\tres.SetDryRun(*r.ko.Spec.DryRun)\n\t}\n\tif r.ko.Status.VPNConnectionID != nil {\n\t\tres.SetVpnConnectionId(*r.ko.Status.VPNConnectionID)\n\t}\n\n\treturn res, nil\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenAccepted) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationOK) SetPayload(payload *models.DeletedResponse) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationOK) WithPayload(payload *models.DeletedResponse) *DeleteOrganizationOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteAdmissionregistrationV1beta1CollectionMutatingWebhookConfigurationOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteAdmissionregistrationV1beta1CollectionMutatingWebhookConfigurationOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteApiextensionsV1CollectionCustomResourceDefinitionOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteApiextensionsV1CollectionCustomResourceDefinitionOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteApiextensionsV1CollectionCustomResourceDefinitionOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *WeaviateSchemaActionsDeleteBadRequest) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (m *PayloadResponseItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *PayloadResponseItemRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func (o *PostOperationsDeleteP2PPathOK) WithPayload(payload *models.TapiPathComputationDeleteP2PPathOutput) *PostOperationsDeleteP2PPathOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteConsulDefault) WithPayload(payload *models.Error) *DeleteConsulDefault {\n\to.Payload = payload\n\treturn o\n}", "func (o *CreateCoreV1NamespacedPodBindingAccepted) WithPayload(payload *models.IoK8sAPICoreV1Binding) *CreateCoreV1NamespacedPodBindingAccepted {\n\to.Payload = payload\n\treturn o\n}", "func Delete(kind string, name string, namespace string, args ...string) (err error) {\n\tdeleteArgs := []string{\"delete\", kind, name, \"-n\", namespace}\n\t_, err = kubectl(append(deleteArgs, args...)...)\n\treturn\n}", "func NewDeletePayload(body *DeleteRequestBody, token string) *warehouse.DeletePayload {\n\tv := &warehouse.DeletePayload{}\n\tv.Ids = make([]string, len(body.Ids))\n\tfor i, val := range body.Ids {\n\t\tv.Ids[i] = val\n\t}\n\tv.Token = token\n\n\treturn v\n}", "func (o *DeleteUserInternalServerError) WithPayload(payload *models.ErrorResponse) *DeleteUserInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *CreateCoreV1NamespacedPodBindingOK) WithPayload(payload *models.IoK8sAPICoreV1Binding) *CreateCoreV1NamespacedPodBindingOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteUserUnauthorized) WithPayload(payload *models.ErrorResponse) *DeleteUserUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteOrganizationInternalServerError) WithPayload(payload *models.ErrorResponse) *DeleteOrganizationInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteOrganizationUnauthorized) WithPayload(payload *models.ErrorResponse) *DeleteOrganizationUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func Delete(objectName string, payload interface{}) *Writer {\n\treturn &Writer{\n\t\tCmd: \"delete\",\n\t\tObjectName: objectName,\n\t\tPayload: payload,\n\t}\n}", "func (o *DeletePostbyIDBadRequest) WithPayload(payload *models.Response) *DeletePostbyIDBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeletePostbyIDNotFound) WithPayload(payload *models.Response) *DeletePostbyIDNotFound {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteProjectUserUnauthorized) WithPayload(payload *models.ErrorResponse) *DeleteProjectUserUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteRuntimeContainerBadRequest) WithPayload(payload string) *DeleteRuntimeContainerBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func (o *WatchCoreV1NamespacedEndpointsOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1WatchEvent) *WatchCoreV1NamespacedEndpointsOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteUserForbidden) WithPayload(payload *DeleteUserForbiddenBody) *DeleteUserForbidden {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteUserOK) SetPayload(payload *models.DeletedResponse) {\n\to.Payload = payload\n}", "func (o *DeleteUserInternalServerError) WithPayload(payload string) *DeleteUserInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteVpcPeeringConnectionInput, error) {\n\tres := &svcsdk.DeleteVpcPeeringConnectionInput{}\n\n\tif r.ko.Spec.DryRun != nil {\n\t\tres.SetDryRun(*r.ko.Spec.DryRun)\n\t}\n\tif r.ko.Status.VPCPeeringConnectionID != nil {\n\t\tres.SetVpcPeeringConnectionId(*r.ko.Status.VPCPeeringConnectionID)\n\t}\n\n\treturn res, nil\n}", "func (o *DeleteProjectUserInternalServerError) WithPayload(payload *models.ErrorResponse) *DeleteProjectUserInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenAccepted) WithPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) *CreateCoreV1NamespacedServiceAccountTokenAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenOK) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (o *DeleteOrgOK) WithPayload(payload *DeleteOrgOKBody) *DeleteOrgOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *ReplacePolicyV1beta1NamespacedPodDisruptionBudgetOK) WithPayload(payload *models.IoK8sAPIPolicyV1beta1PodDisruptionBudget) *ReplacePolicyV1beta1NamespacedPodDisruptionBudgetOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteUserOK) WithPayload(payload *DeleteUserOKBody) *DeleteUserOK {\n\to.Payload = payload\n\treturn o\n}", "func (r *PolicyRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteStageInput, error) {\n\tres := &svcsdk.DeleteStageInput{}\n\n\tif r.ko.Spec.APIID != nil {\n\t\tres.SetApiId(*r.ko.Spec.APIID)\n\t}\n\tif r.ko.Spec.StageName != nil {\n\t\tres.SetStageName(*r.ko.Spec.StageName)\n\t}\n\n\treturn res, nil\n}", "func (o *DeleteOrgOK) SetPayload(payload *DeleteOrgOKBody) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedPodBindingAccepted) SetPayload(payload *models.IoK8sAPICoreV1Binding) {\n\to.Payload = payload\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteReplicationGroupInput, error) {\n\tres := &svcsdk.DeleteReplicationGroupInput{}\n\n\tif r.ko.Spec.ReplicationGroupID != nil {\n\t\tres.SetReplicationGroupId(*r.ko.Spec.ReplicationGroupID)\n\t}\n\n\treturn res, nil\n}", "func (c *Controller) delete(d *appsv1.Deployment) error {\n\tep := RegisteelEndpoint + \"/\" + string(d.UID)\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(http.MethodDelete, ep, nil)\n\treq.Header.Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.logger.Infof(\"removed deployment from api: %v\", d.Name)\n\n\treturn nil\n}", "func (r *MacOSTrustedRootCertificateRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (o *DeleteCoreV1NamespacedPodOK) 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}", "func (o *DeletePostbyIDOK) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeleteOfferingByIDInternalServerError) WithPayload(payload *models.ErrorModel) *DeleteOfferingByIDInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteProjectUserBadRequest) WithPayload(payload *models.ErrorResponse) *DeleteProjectUserBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteAllRevisionsOK) WithPayload(payload string) *DeleteAllRevisionsOK {\n\to.Payload = payload\n\treturn o\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteModelPackageInput, error) {\n\tres := &svcsdk.DeleteModelPackageInput{}\n\n\tif r.ko.Spec.ModelPackageName != nil {\n\t\tres.SetModelPackageName(*r.ko.Spec.ModelPackageName)\n\t}\n\n\treturn res, nil\n}", "func (o *DeleteAddressesOK) WithPayload(payload models.AddressConfigMap) *DeleteAddressesOK {\n\to.Payload = payload\n\treturn o\n}", "func (m *TermStoreRequestBuilder) Delete(ctx context.Context, requestConfiguration *TermStoreRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.CreateDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.requestAdapter.SendNoContentAsync(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func (n *NodeClient) Delete(twin, deployment uint32) (err error) {\n\turl := n.url(\"deployment\", fmt.Sprint(twin), fmt.Sprint(deployment))\n\n\trequest, err := http.NewRequest(http.MethodDelete, url, nil)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to build request\")\n\t}\n\n\tif err := n.client.authorize(request); err != nil {\n\t\treturn errors.Wrap(err, \"failed to sign request\")\n\t}\n\n\tresponse, err := http.DefaultClient.Do(request)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := n.response(response, nil, http.StatusAccepted); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenCreated) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func DeleteOperator(namespace string) error {\n\tif namespace == \"\" {\n\t\tnamespace = DEFAULT_NAMESPACE\n\t}\n\tif err := sh.RunV(\"helm\", \"delete\", \"-n\", namespace, \"kedahttp\"); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (o *DeleteConsulNotFound) WithPayload(payload *models.Error) *DeleteConsulNotFound {\n\to.Payload = payload\n\treturn o\n}", "func (o *ThingsDeleteForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (r *DeviceCompliancePolicyRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (o *CreateExtensionsV1beta1NamespacedIngressAccepted) WithPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) *CreateExtensionsV1beta1NamespacedIngressAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (o *ReplaceExtensionsV1beta1NamespacedIngressOK) WithPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) *ReplaceExtensionsV1beta1NamespacedIngressOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCertificatesV1CollectionCertificateSigningRequestOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1CollectionNamespacedLimitRangeOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *WatchCoreV1NamespacedEndpointsOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1WatchEvent) {\n\to.Payload = payload\n}", "func (o *PostOperationsDeleteP2PPathOK) SetPayload(payload *models.TapiPathComputationDeleteP2PPathOutput) {\n\to.Payload = payload\n}", "func (o *DeleteRuntimeContainerNotFound) WithPayload(payload string) *DeleteRuntimeContainerNotFound {\n\to.Payload = payload\n\treturn o\n}", "func TestObjectDeleted(t *testing.T) {\n\texpectedCard := TeamsMessageCard{\n\t\tType: messageType,\n\t\tContext: context,\n\t\tThemeColor: msTeamsColors[\"Danger\"],\n\t\tSummary: \"kubewatch notification received\",\n\t\tTitle: \"kubewatch\",\n\t\tText: \"\",\n\t\tSections: []TeamsMessageCardSection{\n\t\t\t{\n\t\t\t\tActivityTitle: \"A `pod` in namespace `new` has been `deleted`:\\n`foo`\",\n\t\t\t\tMarkdown: true,\n\t\t\t},\n\t\t},\n\t}\n\n\tts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusOK)\n\t\tif r.Method != \"POST\" {\n\t\t\tt.Errorf(\"expected a POST request for ObjectDeleted()\")\n\t\t}\n\t\tdecoder := json.NewDecoder(r.Body)\n\t\tvar c TeamsMessageCard\n\t\tif err := decoder.Decode(&c); err != nil {\n\t\t\tt.Errorf(\"%v\", err)\n\t\t}\n\t\tif !reflect.DeepEqual(c, expectedCard) {\n\t\t\tt.Errorf(\"expected %v, got %v\", expectedCard, c)\n\t\t}\n\t}))\n\n\tms := &MSTeams{TeamsWebhookURL: ts.URL}\n\tp := &v1.Pod{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Pod\",\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tUID: \"12345678\",\n\t\t\tName: \"foo\",\n\t\t\tNamespace: \"new\",\n\t\t},\n\t}\n\tms.ObjectDeleted(p)\n}", "func (o *DeleteVendorOK) WithPayload(payload *DeleteVendorOKBody) *DeleteVendorOK {\n\to.Payload = payload\n\treturn o\n}", "func (r *ExtensionRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (c *Controller) Delete(typ, name, namespace string) error {\n\treturn errUnsupported\n}", "func RunDelete(cmd *cobra.Command, args []string) {\n\n\tlog := util.Logger()\n\n\tif len(args) != 1 || args[0] == \"\" {\n\t\tlog.Fatalf(`❌ Missing expected arguments: <namespace-store-name> %s`, cmd.UsageString())\n\t}\n\n\to := util.KubeObject(bundle.File_deploy_crds_noobaa_io_v1alpha1_namespacestore_cr_yaml)\n\tnamespaceStore := o.(*nbv1.NamespaceStore)\n\tnamespaceStore.Name = args[0]\n\tnamespaceStore.Namespace = options.Namespace\n\tnamespaceStore.Spec = nbv1.NamespaceStoreSpec{}\n\n\tnbClient := system.GetNBClient()\n\n\tnamespaceResourceinfo, err := nbClient.ReadNamespaceResourceAPI(nb.ReadNamespaceResourceParams{Name: namespaceStore.Name})\n\tif err != nil {\n\t\trpcErr, isRPCErr := err.(*nb.RPCError)\n\t\tif !isRPCErr || rpcErr.RPCCode != \"NO_SUCH_NAMESPACE_RESOURCE\" {\n\t\t\tlog.Fatalf(`❌ Failed to read NamespaceStore info: %s`, err)\n\t\t}\n\t} else if namespaceResourceinfo.Undeletable != \"\" && namespaceResourceinfo.Undeletable != \"IS_NAMESPACESTORE\" {\n\t\tswitch namespaceResourceinfo.Undeletable {\n\t\tcase \"CONNECTED_BUCKET_DELETING\":\n\t\t\tfallthrough\n\t\tcase \"IN_USE\":\n\t\t\tlog.Fatalf(`❌ Could not delete NamespaceStore %q in namespace %q as it is being used by one or more buckets`,\n\t\t\t\tnamespaceStore.Name, namespaceStore.Namespace)\n\t\tdefault:\n\t\t\tlog.Fatalf(`❌ Could not delete NamespaceStore %q in namespace %q, undeletable due to %q`,\n\t\t\t\tnamespaceStore.Name, namespaceStore.Namespace, namespaceResourceinfo.Undeletable)\n\t\t}\n\t}\n\tif !util.KubeDelete(namespaceStore) {\n\t\tlog.Fatalf(`❌ Could not delete NamespaceStore %q in namespace %q`,\n\t\t\tnamespaceStore.Name, namespaceStore.Namespace)\n\t}\n}", "func (o *DeletePostbyIDInternalServerError) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (s *server) Delete(ctx context.Context, body *pb.NameHolder) (*pb.DeletionResponse, error) {\n\tappName := body.GetName()\n\tfilter := types.M{\n\t\tmongo.NameKey: appName,\n\t\tmongo.InstanceTypeKey: mongo.AppInstance,\n\t}\n\n\tnode, _ := redis.FetchAppNode(appName)\n\tgo redis.DecrementServiceLoad(ServiceName, node)\n\tgo redis.RemoveApp(appName)\n\tgo diskCleanup(appName)\n\n\tif configs.CloudflareConfig.PlugIn {\n\t\tgo cloudflare.DeleteRecord(appName, mongo.AppInstance)\n\t}\n\n\t_, err := mongo.DeleteInstance(filter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pb.DeletionResponse{Success: true}, nil\n}", "func BuildDeletePayload(groupDeleteBody string, groupDeleteToken string) (*group.DeletePayload, error) {\n\tvar err error\n\tvar body DeleteRequestBody\n\t{\n\t\terr = json.Unmarshal([]byte(groupDeleteBody), &body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid JSON for body, \\nerror: %s, \\nexample of valid JSON:\\n%s\", err, \"'{\\n \\\"ids\\\": [\\n \\\"91cc3eb9-ddc0-4cf7-a62b-c85df1a9166f\\\",\\n \\\"91cc3eb9-ddc0-4cf7-a62b-c85df1a9166f\\\",\\n \\\"91cc3eb9-ddc0-4cf7-a62b-c85df1a9166f\\\"\\n ]\\n }'\")\n\t\t}\n\t\tif body.Ids == nil {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"ids\", \"body\"))\n\t\t}\n\t\tif len(body.Ids) > 100 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(\"body.ids\", body.Ids, len(body.Ids), 100, false))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tvar token string\n\t{\n\t\ttoken = groupDeleteToken\n\t}\n\tv := &group.DeletePayload{}\n\tif body.Ids != nil {\n\t\tv.Ids = make([]string, len(body.Ids))\n\t\tfor i, val := range body.Ids {\n\t\t\tv.Ids[i] = val\n\t\t}\n\t}\n\tv.Token = token\n\n\treturn v, nil\n}", "func EncodeDeleteRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*warehouse.DeletePayload)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"Warehouse\", \"Delete\", \"*warehouse.DeletePayload\", v)\n\t\t}\n\t\t{\n\t\t\thead := p.Token\n\t\t\tif !strings.Contains(head, \" \") {\n\t\t\t\treq.Header.Set(\"Authorization\", \"Bearer \"+head)\n\t\t\t} else {\n\t\t\t\treq.Header.Set(\"Authorization\", head)\n\t\t\t}\n\t\t}\n\t\tbody := NewDeleteRequestBody(p)\n\t\tif err := encoder(req).Encode(&body); err != nil {\n\t\t\treturn goahttp.ErrEncodingError(\"Warehouse\", \"Delete\", err)\n\t\t}\n\t\treturn nil\n\t}\n}", "func (drc *DummyRectificationClient) DeleteRequest(\n\tcluster, reqid, message string) error {\n\tdrc.logf(\"Deleting application %s %s %s\", cluster, reqid, message)\n\tdrc.Deleted = append(drc.Deleted, dummyDelete{cluster, reqid, message})\n\treturn nil\n}", "func (o *CreateExtensionsV1beta1NamespacedIngressAccepted) SetPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) {\n\to.Payload = payload\n}", "func (o *DeleteImageDefault) WithPayload(payload *models.Error) *DeleteImageDefault {\n\to.Payload = payload\n\treturn o\n}", "func BuildDeletePayload(productDeleteBody string, productDeleteToken string) (*product.DeletePayload, error) {\n\tvar err error\n\tvar body DeleteRequestBody\n\t{\n\t\terr = json.Unmarshal([]byte(productDeleteBody), &body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid JSON for body, \\nerror: %s, \\nexample of valid JSON:\\n%s\", err, \"'{\\n \\\"ids\\\": [\\n \\\"91cc3eb9-ddc0-4cf7-a62b-c85df1a9166f\\\",\\n \\\"91cc3eb9-ddc0-4cf7-a62b-c85df1a9166f\\\",\\n \\\"91cc3eb9-ddc0-4cf7-a62b-c85df1a9166f\\\"\\n ]\\n }'\")\n\t\t}\n\t\tif body.Ids == nil {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"ids\", \"body\"))\n\t\t}\n\t\tif len(body.Ids) > 100 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(\"body.ids\", body.Ids, len(body.Ids), 100, false))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tvar token string\n\t{\n\t\ttoken = productDeleteToken\n\t}\n\tv := &product.DeletePayload{}\n\tif body.Ids != nil {\n\t\tv.Ids = make([]string, len(body.Ids))\n\t\tfor i, val := range body.Ids {\n\t\t\tv.Ids[i] = val\n\t\t}\n\t}\n\tv.Token = token\n\n\treturn v, nil\n}", "func (o *DeleteOrganizationForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (r *ExternalRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (o *DeleteUserUnauthorized) WithPayload(payload *DeleteUserUnauthorizedBody) *DeleteUserUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func decodeDeleteIndustryRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.DeleteIndustryRequest)\n\treturn endpoints.DeleteIndustryRequest{ID: req.Id}, nil\n}", "func (r *GroupPolicyPresentationRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (o *CreateCoreV1NamespacedPodBindingOK) SetPayload(payload *models.IoK8sAPICoreV1Binding) {\n\to.Payload = payload\n}", "func (o *DeleteShipmentInternalServerError) WithPayload(payload *ghcmessages.Error) *DeleteShipmentInternalServerError {\n\to.Payload = payload\n\treturn o\n}" ]
[ "0.71526045", "0.6462131", "0.6293177", "0.6276558", "0.61928785", "0.61641407", "0.6049591", "0.5963603", "0.58372116", "0.5814466", "0.5764856", "0.5737774", "0.56375915", "0.5615515", "0.5608715", "0.55636376", "0.55465573", "0.55429196", "0.5533813", "0.5521526", "0.5514231", "0.5501474", "0.54870665", "0.54719496", "0.5445806", "0.54051584", "0.5398762", "0.5385443", "0.5365867", "0.5350192", "0.5348473", "0.53198695", "0.5306343", "0.5304485", "0.5296885", "0.52897567", "0.52847844", "0.5272254", "0.5267981", "0.52485025", "0.5243748", "0.5241057", "0.52385384", "0.5221787", "0.52195287", "0.52032256", "0.52031606", "0.51906806", "0.5190247", "0.5179708", "0.5172667", "0.5169775", "0.5161905", "0.5161535", "0.5159125", "0.5155578", "0.515359", "0.5153357", "0.5152124", "0.51503897", "0.51221293", "0.5115532", "0.51124823", "0.5103594", "0.5099423", "0.50978166", "0.50895584", "0.5081613", "0.5081361", "0.50762117", "0.5063243", "0.50490856", "0.5045816", "0.50422513", "0.5040137", "0.50372875", "0.5035934", "0.5034285", "0.5033678", "0.50318974", "0.50283676", "0.5027458", "0.50192124", "0.50149655", "0.50085074", "0.50082004", "0.5000017", "0.49945724", "0.49878612", "0.49831462", "0.4969048", "0.49676257", "0.49636304", "0.4962196", "0.49560332", "0.4955556", "0.49514022", "0.49509525", "0.49484116", "0.4947682" ]
0.7290295
0
SetPayload sets the payload to the delete core v1 namespaced pod accepted response
func (o *DeleteCoreV1NamespacedPodAccepted) SetPayload(payload *models.IoK8sAPICoreV1Pod) { o.Payload = payload }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *DeleteCoreV1NamespacedPodOK) SetPayload(payload *models.IoK8sAPICoreV1Pod) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1NamespacedConfigMapOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1NamespacedConfigMapAccepted) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationOK) SetPayload(payload *models.DeletedResponse) {\n\to.Payload = payload\n}", "func (o *WeaviateSchemaActionsDeleteBadRequest) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDOK) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDInternalServerError) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeleteApiextensionsV1CollectionCustomResourceDefinitionOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *ThingsDeleteForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteUserOK) SetPayload(payload *models.DeletedResponse) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDUnauthorized) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedPodBindingOK) SetPayload(payload *models.IoK8sAPICoreV1Binding) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedPodBindingAccepted) SetPayload(payload *models.IoK8sAPICoreV1Binding) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteRuntimeContainerInternalServerError) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1CollectionNamespacedLimitRangeOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *ThingsDeleteInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *WatchCoreV1NamespacedEndpointsOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1WatchEvent) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDNotFound) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenAccepted) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (o *DeleteUserForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteAllRevisionsOK) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *DeleteConsulDefault) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteRuntimeContainerNotFound) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *DeleteOrgOK) SetPayload(payload *DeleteOrgOKBody) {\n\to.Payload = payload\n}", "func (o *PostOperationsDeleteP2PPathOK) SetPayload(payload *models.TapiPathComputationDeleteP2PPathOutput) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDBadRequest) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeleteProjectUserUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteUserUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1NamespacedPodOK) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenOK) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (o *DeleteCertificatesV1CollectionCertificateSigningRequestOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteAdmissionregistrationV1beta1CollectionMutatingWebhookConfigurationOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1NamespacedPodAccepted) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteStorageByIDOK) SetPayload(payload *models.Storage) {\n\to.Payload = payload\n}", "func (o *DeleteOfferingByIDForbidden) SetPayload(payload *models.ErrorModel) {\n\to.Payload = payload\n}", "func (o *DeleteOfferingByIDBadRequest) SetPayload(payload *models.InvalidParameterInput) {\n\to.Payload = payload\n}", "func (o *DeleteOfferingByIDInternalServerError) SetPayload(payload *models.ErrorModel) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedPodBindingCreated) SetPayload(payload *models.IoK8sAPICoreV1Binding) {\n\to.Payload = payload\n}", "func (o *DeleteRuntimeContainerBadRequest) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *DeleteUserInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *UpdateClusterUnauthorized) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "func (o *DeleteProjectUserInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *WeaviateActionsPatchOK) SetPayload(payload *models.ActionGetResponse) {\n\to.Payload = payload\n}", "func (o *DeleteConsulNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteGroupByIDUnauthorized) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteStorageByIDUnauthorized) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteAddressesDefault) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *PostFriendsUpdatesListUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *ObjectsPatchForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteProjectUserBadGateway) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *WeaviateActionsPatchAccepted) SetPayload(payload *models.ActionGetResponse) {\n\to.Payload = payload\n}", "func (o *ReplacePolicyV1beta1NamespacedPodDisruptionBudgetOK) SetPayload(payload *models.IoK8sAPIPolicyV1beta1PodDisruptionBudget) {\n\to.Payload = payload\n}", "func (o *DeleteProjectUserConflict) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *ObjectsClassPutForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *CreateHPCResourceForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *GetClusterMethodNotAllowed) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteProjectUserBadRequest) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *CreateExtensionsV1beta1NamespacedIngressAccepted) SetPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenCreated) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (o *PatchCoreV1PersistentVolumeOK) SetPayload(payload *models.IoK8sAPICoreV1PersistentVolume) {\n\to.Payload = payload\n}", "func (o *GetDataContextTopologyUUIDNodeNodeUUIDOK) SetPayload(payload *models.TapiTopologyTopologyNode) {\n\to.Payload = payload\n}", "func (o *GetCoreAPIVersionsOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1APIVersions) {\n\to.Payload = payload\n}", "func (o *DeleteGroupByIDNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *GetNFTContractTokenOK) SetPayload(payload *models.NFTTokenRow) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationNotFound) SetPayload(payload *models.MissingResponse) {\n\to.Payload = payload\n}", "func (o *DeleteUserInternalServerError) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *DeleteStorageByIDNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *ReplicateForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *PatchApiextensionsV1beta1CustomResourceDefinitionStatusOK) SetPayload(payload *models.IoK8sApiextensionsApiserverPkgApisApiextensionsV1beta1CustomResourceDefinition) {\n\to.Payload = payload\n}", "func (o *UpdateClusterInternalServerError) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "func (o *WeaviateActionsPatchUnprocessableEntity) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *GetClusterInstallConfigMethodNotAllowed) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *CreateClusterCreated) SetPayload(payload *models.Kluster) {\n\to.Payload = payload\n}", "func (o *ConnectCoreV1OptionsNodeProxyOK) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *GetNamespacedNotebooksUnauthorized) SetPayload(payload *models.Error) {\r\n\to.Payload = payload\r\n}", "func (o *DeleteAddressesOK) SetPayload(payload models.AddressConfigMap) {\n\to.Payload = payload\n}", "func (o *DeleteServiceIDFailure) SetPayload(payload models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteOrgNotFound) SetPayload(payload *DeleteOrgNotFoundBody) {\n\to.Payload = payload\n}", "func (o *CreateCoordinationV1NamespacedLeaseAccepted) SetPayload(payload *models.IoK8sAPICoordinationV1Lease) {\n\to.Payload = payload\n}", "func (o *PutWorkpaceByIDOK) SetPayload(payload *models.Workspace) {\n\to.Payload = payload\n}", "func (o *CreateHPCResourceUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *UpdateClusterNotFound) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "func (o *AddKeypairMethodNotAllowed) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "func (o *AddConsumptionForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *RemoveOneDefault) SetPayload(payload *rest_model.RestError) {\n\to.Payload = payload\n}", "func (o *DeleteGroupByIDOK) SetPayload(payload *models.Group) {\n\to.Payload = payload\n}", "func (o *PutQuestionForbidden) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *GetServicesHaproxyRuntimeAclsIDOK) SetPayload(payload *models.ACLFile) {\n\to.Payload = payload\n}", "func (o *DeleteShipmentForbidden) SetPayload(payload *ghcmessages.Error) {\n\to.Payload = payload\n}", "func (o *DeregisterInfraEnvMethodNotAllowed) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *ReplaceExtensionsV1beta1NamespacedIngressOK) SetPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) {\n\to.Payload = payload\n}", "func (o *GetPresignedForClusterFilesMethodNotAllowed) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *AddConsumptionUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *ReplicateUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *PartialUpdateAppForbidden) SetPayload(payload *models.Unauthorized) {\n\to.Payload = payload\n}", "func (o *ObjectsPatchInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteUserForbidden) SetPayload(payload *DeleteUserForbiddenBody) {\n\to.Payload = payload\n}" ]
[ "0.7707723", "0.7229816", "0.7217126", "0.71624154", "0.70172673", "0.69015056", "0.6838018", "0.67712045", "0.67628366", "0.67597437", "0.6754284", "0.6739403", "0.6705884", "0.6703655", "0.6668181", "0.66570735", "0.6654698", "0.66288686", "0.6608131", "0.65916646", "0.6590983", "0.6583476", "0.65585834", "0.65584284", "0.6558037", "0.6557092", "0.6555027", "0.65507716", "0.65342325", "0.6520585", "0.6515472", "0.65127116", "0.65074706", "0.65015924", "0.6496061", "0.6449174", "0.6440961", "0.6436528", "0.6426169", "0.6421038", "0.6398054", "0.63856906", "0.6363252", "0.63631296", "0.6362682", "0.63611376", "0.6355598", "0.6340934", "0.6334285", "0.6333019", "0.6331794", "0.63218933", "0.6310079", "0.6297415", "0.6293528", "0.62668765", "0.62656796", "0.62625915", "0.6255375", "0.6249628", "0.6245283", "0.6233272", "0.62206876", "0.6220461", "0.62153256", "0.6214831", "0.62141776", "0.62116545", "0.6210977", "0.6201147", "0.6198578", "0.6195039", "0.61888874", "0.61860204", "0.6185245", "0.61810625", "0.6175035", "0.6171095", "0.61678845", "0.6164326", "0.61604977", "0.61604893", "0.6156963", "0.6154757", "0.61504763", "0.61496073", "0.6147231", "0.61471057", "0.6144817", "0.61422205", "0.61389196", "0.6132785", "0.6132132", "0.6123971", "0.6120298", "0.6117999", "0.611655", "0.61063355", "0.61034226", "0.61011463" ]
0.77040833
1
WriteResponse to the client
func (o *DeleteCoreV1NamespacedPodAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(202) if o.Payload != nil { payload := o.Payload if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *Response) Write(w io.Writer) error", "func (c *Operation) writeResponse(rw http.ResponseWriter, status int, data []byte) { // nolint: unparam\n\trw.WriteHeader(status)\n\n\tif _, err := rw.Write(data); err != nil {\n\t\tlogger.Errorf(\"Unable to send error message, %s\", err)\n\t}\n}", "func WriteResponse(w http.ResponseWriter, mensaje string, code int) {\n\tmessage := myTypes.Respuesta{\n\t\tMessage: mensaje,\n\t}\n\tresponse, _ := json.Marshal(message)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(code)\n\tw.Write(response)\n}", "func WriteResponse(w http.ResponseWriter, object interface{}, rerr *irma.RemoteError) {\n\tstatus, bts := JsonResponse(object, rerr)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(status)\n\t_, err := w.Write(bts)\n\tif err != nil {\n\t\tLogWarning(errors.WrapPrefix(err, \"failed to write response\", 0))\n\t}\n}", "func (o *PingOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n}", "func WriteResponse(w http.ResponseWriter, v interface{}, statusCode int) {\n\tresBody, err := json.Marshal(v)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(statusCode)\n\t_, _ = w.Write(resBody)\n}", "func WriteResponse(w http.ResponseWriter, code int, object interface{}) {\n\tdata, err := json.Marshal(object)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(code)\n\tw.Write(data)\n}", "func (o *GetPingOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "func writeResponse(body []byte, w *http.ResponseWriter) {\n\t(*w).Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\t_, err := (*w).Write(body)\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\t(*w).WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func WriteResponse(w http.ResponseWriter, code int, resp interface{}) error {\n\tj, err := json.Marshal(resp)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn err\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(code)\n\n\t_, err = w.Write(j)\n\treturn err\n}", "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}", "func WriteResponse(w http.ResponseWriter, d string) {\n\tw.WriteHeader(200)\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.Write([]byte(d))\n\treturn\n}", "func (o *CreateFacilityUsersOK) 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}", "func writeResponse(w http.ResponseWriter, response Response) {\n\tjson, err := json.Marshal(&response)\n\n\tif err != nil {\n\t\tfmt.Fprint(w, \"There was an error processing the request.\")\n\t}\n\n\tcommon.Log(fmt.Sprintf(\"Returning response %s\", json))\n\tfmt.Fprintf(w, \"%s\", json)\n}", "func (o *CreateProgramOK) 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}", "func (o *DepositNewFileOK) 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}", "func (o *UpdateMedicineOK) 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}", "func (o *CreateTaskCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Location\n\n\tlocation := o.Location.String()\n\tif location != \"\" {\n\t\trw.Header().Set(\"Location\", location)\n\t}\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func writeResponse(r *http.Request, w http.ResponseWriter, code int, resp interface{}) {\n\n\t// Deal with CORS\n\tif origin := r.Header.Get(\"Origin\"); origin != \"\" {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", origin)\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"DELETE, GET, HEAD, OPTIONS, POST, PUT\")\n\t\tw.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n\t\t// Allow any headers\n\t\tif wantedHeaders := r.Header.Get(\"Access-Control-Request-Headers\"); wantedHeaders != \"\" {\n\t\t\tw.Header().Set(\"Access-Control-Allow-Headers\", wantedHeaders)\n\t\t}\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\n\tb, err := json.Marshal(resp)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprintln(w, `{\"error\":\"failed to marshal json\"}`)\n\t\treturn\n\t}\n\n\tw.WriteHeader(code)\n\tfmt.Fprintln(w, string(b))\n}", "func (o *VerifyAccountCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func writeResponse(w http.ResponseWriter, h int, p interface{}) {\n\t// I set the content type...\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t// ... I write the specified status code...\n\tw.WriteHeader(h)\n\t// ... and I write the response\n\tb, _ := json.Marshal(p)\n\tw.Write(b)\n}", "func (o *UpdateCatalogOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "func (c *SwitchVersion) WriteResponse(rw http.ResponseWriter, rp runtime.Producer) {\n\tswitch c.Request.Method {\n\tcase http.MethodPost:\n\t\tc.postSwitchVersion(rw, rp)\n\tdefault:\n\t\tc.notSupported(rw, rp)\n\t}\n}", "func (o *PutRecordingsOK) 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}", "func (o *BofaChkUpdateOK) 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}", "func (o *VerifyHealthCredentialOK) 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}", "func WriteResponse(w http.ResponseWriter, code int, err error, data interface{}, t0 time.Time) {\n\tw.WriteHeader(code)\n\tresp := &Response{Data: data, Dur: fmt.Sprint(time.Since(t0)), OK: false}\n\tif code < 300 {\n\t\tresp.OK = true\n\t}\n\tif err != nil {\n\t\tresp.Err = err.Error()\n\t}\n\terr = json.NewEncoder(w).Encode(resp)\n\tif err != nil {\n\t\tlog.Infof(\"failed to json encode response: %v\", err)\n\t\tif _, err = w.Write([]byte(spew.Sdump(resp))); err != nil {\n\t\t\tlog.Infof(\"failed to write dump of response: %v\", err)\n\t\t}\n\t}\n}", "func (o *NewDiscoveryOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "func writeResponse(data []byte, size int64, ctype string, w http.ResponseWriter) {\n\tw.Header().Set(\"Content-Type\", ctype)\n\tw.Header().Set(\"Content-Length\", fmt.Sprintf(\"%d\", size))\n\tw.Header().Set(\"Cache-Control\", \"no-transform,public,max-age=86400,s-maxage=2592000\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(data)\n}", "func writeResponse(w http.ResponseWriter, code int, object interface{}) {\n\tfmt.Println(\"writing response:\", code, object)\n\tdata, err := json.Marshal(object)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tw.Header().Set(\"content-type\", \"application/json\")\n\tw.WriteHeader(code)\n\tw.Write(data)\n}", "func writeResponse(w http.ResponseWriter, authZRes *authorization.Response) {\n\n\tdata, err := json.Marshal(authZRes)\n\tif err != nil {\n\t\tlog.Fatal(\"Failed to marshel authz response %q\", err.Error())\n\t} else {\n\t\tw.Write(data)\n\t}\n\n\tif authZRes == nil || authZRes.Err != \"\" {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t}\n}", "func (o *GetCharactersCharacterIDOpportunitiesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make(models.GetCharactersCharacterIDOpportunitiesOKBody, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "func (o *WeaviateThingsGetNotImplemented) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(501)\n}", "func (c *UpdateSwitch) WriteResponse(rw http.ResponseWriter, rp runtime.Producer) {\n\tswitch c.Request.Method {\n\tcase http.MethodPost:\n\t\tc.postUpdateSwitch(rw, rp)\n\tdefault:\n\t\tc.notSupported(rw, rp)\n\t}\n}", "func (c *UpdateSwitch) WriteResponse(rw http.ResponseWriter, rp runtime.Producer) {\n\tswitch c.Request.Method {\n\tcase http.MethodPost:\n\t\tc.postUpdateSwitch(rw, rp)\n\tdefault:\n\t\tc.notSupported(rw, rp)\n\t}\n}", "func (o *UpdateLinkInPostOK) 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}", "func (o *GetChatroomsIDOK) 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}", "func (o *GetEchoNameOK) 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}", "func (o *GetUIContentOK) 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}", "func (o *ListVsphereResourceOK) 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}", "func ResponseWrite(w http.ResponseWriter, responseCode int, responseData interface{}) {\n\t// Write Response\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(responseCode)\n\n\t// Write JSON to Response\n\tjson.NewEncoder(w).Encode(responseData)\n}", "func writeHTTPResponseInWriter(httpRes http.ResponseWriter, httpReq *http.Request, nobelPrizeWinnersResponse []byte, err error) {\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\thttp.Error(httpRes, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tlog.Printf(\"Request %s Succesfully Completed\", httpReq.RequestURI)\n\thttpRes.Header().Set(\"Content-Type\", \"application/json\")\n\thttpRes.Write(nobelPrizeWinnersResponse)\n}", "func (o *PostKeysKeyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "func (o *Operation) writeResponse(rw io.Writer, v interface{}) {\n\terr := json.NewEncoder(rw).Encode(v)\n\tif err != nil {\n\t\tlog.Errorf(\"Unable to send error response, %s\", err)\n\t}\n}", "func writeResponse(data interface{}, w http.ResponseWriter) error {\n\tvar (\n\t\tenc []byte\n\t\terr error\n\t)\n\tenc, err = json.Marshal(data)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn fmt.Errorf(\"Failure to marshal, err = %s\", err)\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tn, err := w.Write(enc)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn fmt.Errorf(\"Failure to write, err = %s\", err)\n\t}\n\tif n != len(enc) {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn fmt.Errorf(\"Short write sent = %d, wrote = %d\", len(enc), n)\n\t}\n\treturn nil\n}", "func (o *CreateUserOK) 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}", "func (o *UpdateMoveTaskOrderPostCounselingInformationOK) 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}", "func WriteResponse(rw io.Writer, v interface{}) {\n\terr := json.NewEncoder(rw).Encode(v)\n\tif err != nil {\n\t\tlogger.Errorf(\"Unable to send error response, %s\", err)\n\t}\n}", "func (o *PutQuestionOK) 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}", "func (r *response) Write(b []byte) (n int, err error) {\n\tif !r.headersSend {\n\t\tif r.status == 0 {\n\t\t\tr.status = http.StatusOK\n\t\t}\n\t\tr.WriteHeader(r.status)\n\t}\n\tn, err = r.ResponseWriter.Write(b)\n\tr.size += int64(n)\n\treturn\n}", "func (o *PostOperationsDeleteP2PPathCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func (o *HealthGetOK) 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}", "func (o *WeaviateThingsPatchNotImplemented) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(501)\n}", "func (o *VerifyEmailTokenOK) 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}", "func (o *DeleteServiceIDOK) 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}", "func (o *WeaviateThingsGetOK) 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}", "func (o *Operation) writeResponse(rw io.Writer, v interface{}) {\n\terr := json.NewEncoder(rw).Encode(v)\n\t// as of now, just log errors for writing response\n\tif err != nil {\n\t\tlogger.Errorf(\"Unable to send error response, %s\", err)\n\t}\n}", "func (o *PostOperationsGetNodeEdgePointDetailsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func (o *UserEditOK) 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}", "func (o *WeaviatePeersAnnounceOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "func (o *CertifyOK) 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}", "func writeResponse(writer http.ResponseWriter, response *http.Response) (int64, error) {\n\tdefer response.Body.Close()\n\twriteResponseHeaders(writer, response, false)\n\treturn io.Copy(writer, response.Body)\n}", "func (o *PutMeetupDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(o._statusCode)\n}", "func (o *FingerPathsPostCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func (o *PostPlaybookOK) 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}", "func (o *UpdateHostIgnitionCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func (o *GetCharactersCharacterIDLocationOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (o *GetPingDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n}", "func (o *PostManagementKubernetesIoV1NodesOK) 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}", "func (o *PutPerformancesOK) 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}", "func (o *StopAppAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\n}", "func (o *GetFleetsFleetIDMembersOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Content-Language\n\n\tcontentLanguage := o.ContentLanguage\n\tif contentLanguage != \"\" {\n\t\trw.Header().Set(\"Content-Language\", contentLanguage)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make(models.GetFleetsFleetIDMembersOKBody, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "func (o *GetMeetupsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(o._statusCode)\n}", "func (o *PostEventCreated) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(201)\n}", "func (o *GetTaskTaskIDOK) 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}", "func (o *CreateTCPCheckAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Reload-ID\n\n\treloadID := o.ReloadID\n\tif reloadID != \"\" {\n\t\trw.Header().Set(\"Reload-ID\", reloadID)\n\t}\n\n\trw.WriteHeader(202)\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}", "func (o *PostOperationsGetNetworkElementListCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func (o *ServiceInstanceLastOperationGetOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header RetryAfter\n\n\tretryAfter := o.RetryAfter\n\tif retryAfter != \"\" {\n\t\trw.Header().Set(\"RetryAfter\", retryAfter)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (o *GetPiecesIDOK) 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}", "func (o *GetTaskDetailsOK) 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}", "func (o *UpdateClusterOK) 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}", "func (o *GetDetailOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\trw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\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}", "func (o *GetServicesHaproxyRuntimeAclsIDOK) 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}", "func (r *responseInfoRecorder) Write(b []byte) (int, error) {\n\tr.ContentLength += int64(len(b))\n\tif r.statusCode == 0 {\n\t\tr.statusCode = http.StatusOK\n\t}\n\treturn r.ResponseWriter.Write(b)\n}", "func (o *LogoutOK) 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}", "func (o *UploadFileOK) 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}", "func WriteResponse(w http.ResponseWriter, data interface{}) error {\n\tenv := map[string]interface{}{\n\t\t\"meta\": map[string]interface{}{\n\t\t\t\"code\": http.StatusOK,\n\t\t},\n\t\t\"data\": data,\n\t}\n\treturn jsonResponse(w, env)\n}", "func (o *WeaviateThingTemplatesCreateNotImplemented) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(501)\n}", "func (r *Responder) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\tfor k, v := range r.headers {\n\t\tfor _, val := range v {\n\t\t\trw.Header().Add(k, val)\n\t\t}\n\t}\n\n\trw.WriteHeader(r.code)\n\n\tif r.response != nil {\n\t\tif err := producer.Produce(rw, r.response); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n}", "func (o *GetGateSourceByGateNameAndMntOK) 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}", "func (o *CreateSpoeCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(201)\n\tpayload := o.Payload\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "func (o *Output) writeResponse(response string) error {\r\n\t// write the response\r\n\tif _, err := o.writer.WriteString(response + \"\\n\"); err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\treturn nil\r\n}", "func (o *GetTransportByIDOK) 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}", "func (o *TransferOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n\tif err := producer.Produce(rw, o.Payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "func (o *CreateUserCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func (o *ViewOneOrderOK) 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}", "func (o *GetVisiblePruebasFromQuestionTestInternalServerError) 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}", "func (o *GetWhaleTranfersOK) 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 = make([]*models.OperationsRow, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "func (o *SearchTournamentsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make([]*models.Tournament, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "func (o *CreateTCPCheckCreated) 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}", "func (s *Server) writeInfoResponse(\n\tw http.ResponseWriter,\n\tr *http.Request,\n\tmessage []byte,\n\tstatus int,\n\theaders map[string]string,\n) {\n\tfor k, v := range headers {\n\t\tw.Header().Add(k, v)\n\t}\n\n\tw.WriteHeader(status)\n\tw.Write(message)\n}" ]
[ "0.81303823", "0.7882039", "0.77722245", "0.7771901", "0.7753117", "0.7740585", "0.76670325", "0.7638451", "0.76095873", "0.75798", "0.7579178", "0.7567389", "0.7560546", "0.75579476", "0.75447774", "0.7542929", "0.75416607", "0.753386", "0.7531158", "0.75192654", "0.75191355", "0.7513389", "0.7512029", "0.75050455", "0.7503395", "0.74984574", "0.74875605", "0.74839836", "0.74772394", "0.7467842", "0.746699", "0.7465759", "0.7464175", "0.746404", "0.746404", "0.7461224", "0.7460309", "0.74595356", "0.74463046", "0.7443478", "0.7435917", "0.7426582", "0.7425581", "0.74186546", "0.7413175", "0.7407469", "0.74063516", "0.74048966", "0.7398737", "0.7389631", "0.738607", "0.73806983", "0.7360552", "0.7360491", "0.7355327", "0.7354953", "0.73532444", "0.7347445", "0.734586", "0.732798", "0.732577", "0.73178244", "0.7316643", "0.7316071", "0.7315527", "0.7312546", "0.73114824", "0.7310336", "0.7309039", "0.73007035", "0.7297214", "0.7291373", "0.7291277", "0.72884554", "0.72845477", "0.72835207", "0.7281928", "0.7281033", "0.72751075", "0.7274423", "0.7273193", "0.72730565", "0.72695094", "0.7269139", "0.72690886", "0.7265927", "0.72615093", "0.72529227", "0.7251764", "0.72490144", "0.72479355", "0.72469014", "0.72407585", "0.72390425", "0.72367245", "0.7234706", "0.722777", "0.722197", "0.7215153", "0.72140837", "0.7213089" ]
0.0
-1
NewDeleteCoreV1NamespacedPodUnauthorized creates DeleteCoreV1NamespacedPodUnauthorized with default headers values
func NewDeleteCoreV1NamespacedPodUnauthorized() *DeleteCoreV1NamespacedPodUnauthorized { return &DeleteCoreV1NamespacedPodUnauthorized{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewCreateCoreV1NamespacedPodUnauthorized() *CreateCoreV1NamespacedPodUnauthorized {\n\treturn &CreateCoreV1NamespacedPodUnauthorized{}\n}", "func NewDeleteCoreV1NamespacedServiceUnauthorized() *DeleteCoreV1NamespacedServiceUnauthorized {\n\treturn &DeleteCoreV1NamespacedServiceUnauthorized{}\n}", "func NewDeleteCoreV1NamespacedEventUnauthorized() *DeleteCoreV1NamespacedEventUnauthorized {\n\treturn &DeleteCoreV1NamespacedEventUnauthorized{}\n}", "func NewReadCoreV1NamespacedPodUnauthorized() *ReadCoreV1NamespacedPodUnauthorized {\n\treturn &ReadCoreV1NamespacedPodUnauthorized{}\n}", "func NewDeleteCoreV1NamespacedConfigMapUnauthorized() *DeleteCoreV1NamespacedConfigMapUnauthorized {\n\n\treturn &DeleteCoreV1NamespacedConfigMapUnauthorized{}\n}", "func NewCreateCoreV1NamespacedPodBindingUnauthorized() *CreateCoreV1NamespacedPodBindingUnauthorized {\n\n\treturn &CreateCoreV1NamespacedPodBindingUnauthorized{}\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenUnauthorized() *CreateCoreV1NamespacedServiceAccountTokenUnauthorized {\n\n\treturn &CreateCoreV1NamespacedServiceAccountTokenUnauthorized{}\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenUnauthorized() *CreateCoreV1NamespacedServiceAccountTokenUnauthorized {\n\treturn &CreateCoreV1NamespacedServiceAccountTokenUnauthorized{}\n}", "func NewPatchCoreV1NamespacedServiceAccountUnauthorized() *PatchCoreV1NamespacedServiceAccountUnauthorized {\n\treturn &PatchCoreV1NamespacedServiceAccountUnauthorized{}\n}", "func NewWatchCoreV1NamespacedPodTemplateListUnauthorized() *WatchCoreV1NamespacedPodTemplateListUnauthorized {\n\treturn &WatchCoreV1NamespacedPodTemplateListUnauthorized{}\n}", "func NewWatchCoreV1NamespacedEndpointsUnauthorized() *WatchCoreV1NamespacedEndpointsUnauthorized {\n\n\treturn &WatchCoreV1NamespacedEndpointsUnauthorized{}\n}", "func NewDeleteCoreV1NamespacedPodOK() *DeleteCoreV1NamespacedPodOK {\n\n\treturn &DeleteCoreV1NamespacedPodOK{}\n}", "func NewReadCoreV1NamespacedEndpointsUnauthorized() *ReadCoreV1NamespacedEndpointsUnauthorized {\n\treturn &ReadCoreV1NamespacedEndpointsUnauthorized{}\n}", "func NewDeleteCrossConnectUnauthorized() *DeleteCrossConnectUnauthorized {\n\treturn &DeleteCrossConnectUnauthorized{}\n}", "func NewDeleteVersionControlRequestUnauthorized() *DeleteVersionControlRequestUnauthorized {\n\treturn &DeleteVersionControlRequestUnauthorized{}\n}", "func NewThingsDeleteUnauthorized() *ThingsDeleteUnauthorized {\n\n\treturn &ThingsDeleteUnauthorized{}\n}", "func NewDeleteAPIUnauthorized() *DeleteAPIUnauthorized {\n\treturn &DeleteAPIUnauthorized{}\n}", "func NewCreateNetworkingV1beta1NamespacedIngressUnauthorized() *CreateNetworkingV1beta1NamespacedIngressUnauthorized {\n\n\treturn &CreateNetworkingV1beta1NamespacedIngressUnauthorized{}\n}", "func NewDeleteCoreV1CollectionNamespacedLimitRangeUnauthorized() *DeleteCoreV1CollectionNamespacedLimitRangeUnauthorized {\n\n\treturn &DeleteCoreV1CollectionNamespacedLimitRangeUnauthorized{}\n}", "func NewDeleteCoreV1PersistentVolumeUnauthorized() *DeleteCoreV1PersistentVolumeUnauthorized {\n\treturn &DeleteCoreV1PersistentVolumeUnauthorized{}\n}", "func NewDeleteUsingDELETE8Unauthorized() *DeleteUsingDELETE8Unauthorized {\n\treturn &DeleteUsingDELETE8Unauthorized{}\n}", "func NewConnectCoreV1PutNamespacedPodProxyUnauthorized() *ConnectCoreV1PutNamespacedPodProxyUnauthorized {\n\treturn &ConnectCoreV1PutNamespacedPodProxyUnauthorized{}\n}", "func NewDeleteScopeUnauthorized() *DeleteScopeUnauthorized {\n\treturn &DeleteScopeUnauthorized{}\n}", "func NewConnectCoreV1PatchNamespacedServiceProxyUnauthorized() *ConnectCoreV1PatchNamespacedServiceProxyUnauthorized {\n\treturn &ConnectCoreV1PatchNamespacedServiceProxyUnauthorized{}\n}", "func (o *DeleteCoreV1NamespacedPodUnauthorized) 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}", "func NewDeleteLibraryAPIVersionUnauthorized() *DeleteLibraryAPIVersionUnauthorized {\n\treturn &DeleteLibraryAPIVersionUnauthorized{}\n}", "func NewDeleteMediaUnauthorized(body *DeleteMediaUnauthorizedResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func NewDeleteLibraryUnauthorized() *DeleteLibraryUnauthorized {\n\treturn &DeleteLibraryUnauthorized{}\n}", "func (suite *TenantTestSuite) TestDeleteUnauthorized() {\n\trequest, _ := http.NewRequest(\"DELETE\", \"/api/v2/admin/tenants/id\", strings.NewReader(\"\"))\n\trequest.Header.Set(\"x-api-key\", \"FOO\")\n\trequest.Header.Set(\"Accept\", \"application/json\")\n\tresponse := httptest.NewRecorder()\n\n\tsuite.router.ServeHTTP(response, request)\n\n\tcode := response.Code\n\toutput := response.Body.String()\n\n\tsuite.Equal(401, code, \"Internal Server Error\")\n\tsuite.Equal(suite.respUnauthorized, output, \"Response body mismatch\")\n}", "func NewListCoreV1NamespacedConfigMapUnauthorized() *ListCoreV1NamespacedConfigMapUnauthorized {\n\treturn &ListCoreV1NamespacedConfigMapUnauthorized{}\n}", "func NewDeleteCapabilityUnauthorized() *DeleteCapabilityUnauthorized {\n\treturn &DeleteCapabilityUnauthorized{}\n}", "func NewDeleteCompanyUnauthorized(body *DeleteCompanyUnauthorizedResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func NewDeleteDatasetUnauthorized() *DeleteDatasetUnauthorized {\n\treturn &DeleteDatasetUnauthorized{}\n}", "func (o *DeleteCoreV1NamespacedPodOK) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodOK {\n\to.Payload = payload\n\treturn o\n}", "func NewDeleteClientByNamespaceUnauthorized() *DeleteClientByNamespaceUnauthorized {\n\treturn &DeleteClientByNamespaceUnauthorized{}\n}", "func NewDeleteChannelHandlerUnauthorized() *DeleteChannelHandlerUnauthorized {\n\treturn &DeleteChannelHandlerUnauthorized{}\n}", "func NewDeleteVirtualCircuitUnauthorized() *DeleteVirtualCircuitUnauthorized {\n\treturn &DeleteVirtualCircuitUnauthorized{}\n}", "func NewCreateExtensionsV1beta1NamespacedIngressUnauthorized() *CreateExtensionsV1beta1NamespacedIngressUnauthorized {\n\n\treturn &CreateExtensionsV1beta1NamespacedIngressUnauthorized{}\n}", "func NewDeleteRegistryClientUnauthorized() *DeleteRegistryClientUnauthorized {\n\treturn &DeleteRegistryClientUnauthorized{}\n}", "func NewReplaceCoreV1NamespacedConfigMapUnauthorized() *ReplaceCoreV1NamespacedConfigMapUnauthorized {\n\treturn &ReplaceCoreV1NamespacedConfigMapUnauthorized{}\n}", "func NewConnectCoreV1OptionsNamespacedPodProxyWithPathUnauthorized() *ConnectCoreV1OptionsNamespacedPodProxyWithPathUnauthorized {\n\treturn &ConnectCoreV1OptionsNamespacedPodProxyWithPathUnauthorized{}\n}", "func NewWeaviateSchemaActionsDeleteUnauthorized() *WeaviateSchemaActionsDeleteUnauthorized {\n\n\treturn &WeaviateSchemaActionsDeleteUnauthorized{}\n}", "func NewAuthPrivilegeRequestWithoutParam() *AuthPrivilegeRequest {\n\n return &AuthPrivilegeRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/management:authPrivilege\",\n Method: \"POST\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "func NewPostFirmwaresDeleteUnauthorized() *PostFirmwaresDeleteUnauthorized {\n\treturn &PostFirmwaresDeleteUnauthorized{}\n}", "func NewPcloudPvminstancesDeleteUnauthorized() *PcloudPvminstancesDeleteUnauthorized {\n\treturn &PcloudPvminstancesDeleteUnauthorized{}\n}", "func NewDeleteCoreV1NamespacedServiceOK() *DeleteCoreV1NamespacedServiceOK {\n\treturn &DeleteCoreV1NamespacedServiceOK{}\n}", "func NewPatchEventsV1NamespacedEventUnauthorized() *PatchEventsV1NamespacedEventUnauthorized {\n\treturn &PatchEventsV1NamespacedEventUnauthorized{}\n}", "func NewDeleteArtifactUnauthorized() *DeleteArtifactUnauthorized {\n\treturn &DeleteArtifactUnauthorized{}\n}", "func NewDeleteFlowcontrolApiserverV1alpha1PriorityLevelConfigurationUnauthorized() *DeleteFlowcontrolApiserverV1alpha1PriorityLevelConfigurationUnauthorized {\n\treturn &DeleteFlowcontrolApiserverV1alpha1PriorityLevelConfigurationUnauthorized{}\n}", "func NewCreateCoreV1NamespacedPodOK() *CreateCoreV1NamespacedPodOK {\n\treturn &CreateCoreV1NamespacedPodOK{}\n}", "func newPod(ctx context.Context, cl client.Client, ns, name, image string, cmd []string) (*corev1.Pod, error) {\n\tc := corev1.Container{\n\t\tName: name,\n\t\tImage: image,\n\t\tCommand: cmd,\n\t}\n\tp := &corev1.Pod{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: ns,\n\t\t},\n\t\tSpec: corev1.PodSpec{\n\t\t\tContainers: []corev1.Container{c},\n\t\t\t// Kill the pod immediately so it exits quickly on deletion.\n\t\t\tTerminationGracePeriodSeconds: pointer.Int64Ptr(0),\n\t\t},\n\t}\n\tif err := cl.Create(ctx, p); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create pod %s/%s: %v\", p.Namespace, p.Name, err)\n\t}\n\treturn p, nil\n}", "func NewCreateDiscoveryV1beta1NamespacedEndpointSliceUnauthorized() *CreateDiscoveryV1beta1NamespacedEndpointSliceUnauthorized {\n\n\treturn &CreateDiscoveryV1beta1NamespacedEndpointSliceUnauthorized{}\n}", "func NewDeleteACLUnauthorized() *DeleteACLUnauthorized {\n\treturn &DeleteACLUnauthorized{}\n}", "func TestDeletePod(t *testing.T) {\n\tcluster := NewClusterState()\n\tvpa := addTestVpa(cluster)\n\tpod := addTestPod(cluster)\n\tassert.NoError(t, cluster.DeletePod(pod.ID))\n\tassert.Empty(t, vpa.Pods)\n}", "func NewDeleteNodeUsingDELETEUnauthorized() *DeleteNodeUsingDELETEUnauthorized {\n\treturn &DeleteNodeUsingDELETEUnauthorized{}\n}", "func NewDeleteVariableByNameUsingDELETEUnauthorized() *DeleteVariableByNameUsingDELETEUnauthorized {\n\treturn &DeleteVariableByNameUsingDELETEUnauthorized{}\n}", "func NewDeleteProjectUnauthorized() *DeleteProjectUnauthorized {\n\treturn &DeleteProjectUnauthorized{}\n}", "func NewDeleteOrgUnauthorized() *DeleteOrgUnauthorized {\n\n\treturn &DeleteOrgUnauthorized{}\n}", "func NewDeletePartmodelsUnauthorized() *DeletePartmodelsUnauthorized {\n\treturn &DeletePartmodelsUnauthorized{}\n}", "func NewConnectCoreV1GetNamespacedServiceProxyWithPathUnauthorized() *ConnectCoreV1GetNamespacedServiceProxyWithPathUnauthorized {\n\treturn &ConnectCoreV1GetNamespacedServiceProxyWithPathUnauthorized{}\n}", "func NewPcloudCloudconnectionsDeleteUnauthorized() *PcloudCloudconnectionsDeleteUnauthorized {\n\treturn &PcloudCloudconnectionsDeleteUnauthorized{}\n}", "func NewDeleteApiextensionsV1CollectionCustomResourceDefinitionUnauthorized() *DeleteApiextensionsV1CollectionCustomResourceDefinitionUnauthorized {\n\n\treturn &DeleteApiextensionsV1CollectionCustomResourceDefinitionUnauthorized{}\n}", "func NewUnauthorized(cause error) Unauthorized { return Unauthorized(cause.Error()) }", "func NewDeleteCommand() *cobra.Command {\n\tvar (\n\t\tall bool\n\t\tcompleted bool\n\t)\n\n\tvar command = &cobra.Command{\n\t\tUse: \"delete WORKFLOW\",\n\t\tShort: \"delete a managed and its associated pods\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\twfClient = InitManagedClient()\n\t\t\tif all {\n\t\t\t\tdeleteManageds(metav1.ListOptions{})\n\t\t\t\treturn\n\t\t\t} else if completed {\n\t\t\t\toptions := metav1.ListOptions{\n\t\t\t\t\tLabelSelector: fmt.Sprintf(\"%s=true\", common.LabelKeyCompleted),\n\t\t\t\t}\n\t\t\t\tdeleteManageds(options)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif len(args) == 0 {\n\t\t\t\tcmd.HelpFunc()(cmd, args)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tfor _, wfName := range args {\n\t\t\t\tdeleteManaged(wfName)\n\t\t\t}\n\t\t},\n\t}\n\n\tcommand.Flags().BoolVar(&all, \"all\", false, \"Delete all manageds\")\n\tcommand.Flags().BoolVar(&completed, \"completed\", false, \"Delete completed manageds\")\n\treturn command\n}", "func NewDelSubDeviceWithCoreRequestWithoutParam() *DelSubDeviceWithCoreRequest {\n\n return &DelSubDeviceWithCoreRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/instances/{instanceId}/products/{productKey}/edges/{edgeName}:delSubDevice\",\n Method: \"POST\",\n Header: nil,\n Version: \"v2\",\n },\n }\n}", "func NewUnauthorized(err error, msg ...string) *Errs {\n\tif err == nil {\n\t\terr = ErrUnauthorized\n\t}\n\treturn &Errs{\n\t\tcodeHTTP: http.StatusUnauthorized,\n\t\terr: err,\n\t\tkind: trace(2),\n\t\tmessage: msg,\n\t}\n}", "func NewDeleteMatchPoolUnauthorized() *DeleteMatchPoolUnauthorized {\n\treturn &DeleteMatchPoolUnauthorized{}\n}", "func NewDeleteCoreV1NamespacedPodAccepted() *DeleteCoreV1NamespacedPodAccepted {\n\n\treturn &DeleteCoreV1NamespacedPodAccepted{}\n}", "func NewDeleteBacsIDUnauthorized() *DeleteBacsIDUnauthorized {\n\treturn &DeleteBacsIDUnauthorized{}\n}", "func NewDeleteUserUnauthorized() *DeleteUserUnauthorized {\n\n\treturn &DeleteUserUnauthorized{}\n}", "func NewDeleteUserUnauthorized() *DeleteUserUnauthorized {\n\n\treturn &DeleteUserUnauthorized{}\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteReplicationGroupInput, error) {\n\tres := &svcsdk.DeleteReplicationGroupInput{}\n\n\tif r.ko.Spec.ReplicationGroupID != nil {\n\t\tres.SetReplicationGroupId(*r.ko.Spec.ReplicationGroupID)\n\t}\n\n\treturn res, nil\n}", "func NewDeleteDirectoryUsingPOSTUnauthorized() *DeleteDirectoryUsingPOSTUnauthorized {\n\treturn &DeleteDirectoryUsingPOSTUnauthorized{}\n}", "func NewWatchSettingsV1alpha1NamespacedPodPresetUnauthorized() *WatchSettingsV1alpha1NamespacedPodPresetUnauthorized {\n\treturn &WatchSettingsV1alpha1NamespacedPodPresetUnauthorized{}\n}", "func NewDeleteCoreV1NamespacedConfigMapOK() *DeleteCoreV1NamespacedConfigMapOK {\n\n\treturn &DeleteCoreV1NamespacedConfigMapOK{}\n}", "func NewDeleteProjectUserUnauthorized() *DeleteProjectUserUnauthorized {\n\n\treturn &DeleteProjectUserUnauthorized{}\n}", "func genericPodDelete(label, namespace string, clientset *kubernetes.Clientset) error {\n\n\tvar name string\n\t//Getting all pods in litmus Namespace\n\tpods, err := clientset.CoreV1().Pods(namespace).List(context.TODO(), metav1.ListOptions{})\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to get pods in %v namespace, err: %v\", err)\n\t}\n\n\tklog.Infof(\"[Info]: Selecting pod with label %v for reboot\", label)\n\tfor i := range pods.Items {\n\t\tif pods.Items[i].Labels[\"component\"] == label {\n\t\t\tname = pods.Items[i].Name\n\t\t}\n\t}\n\tklog.Infof(\"[Info]: Deleting the Pod : %v\", name)\n\terr = clientset.CoreV1().Pods(\"litmus\").Delete(context.TODO(), name, metav1.DeleteOptions{})\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to delete %v pod, err: %v\", name, err)\n\t}\n\tklog.Infof(\"[Info]: %v pod deleted successfully \\n\", name)\n\treturn nil\n}", "func NewDeleteUserUnauthorized() *DeleteUserUnauthorized {\n\treturn &DeleteUserUnauthorized{}\n}", "func NewCreateCoreV1PersistentVolumeUnauthorized() *CreateCoreV1PersistentVolumeUnauthorized {\n\treturn &CreateCoreV1PersistentVolumeUnauthorized{}\n}", "func NewPcloudSppplacementgroupsDeleteUnauthorized() *PcloudSppplacementgroupsDeleteUnauthorized {\n\treturn &PcloudSppplacementgroupsDeleteUnauthorized{}\n}", "func NewReplaceExtensionsV1beta1NamespacedIngressUnauthorized() *ReplaceExtensionsV1beta1NamespacedIngressUnauthorized {\n\n\treturn &ReplaceExtensionsV1beta1NamespacedIngressUnauthorized{}\n}", "func NewDeleteGroupByIDUnauthorized() *DeleteGroupByIDUnauthorized {\n\n\treturn &DeleteGroupByIDUnauthorized{}\n}", "func NewDeleteVendorUnauthorized() *DeleteVendorUnauthorized {\n\n\treturn &DeleteVendorUnauthorized{}\n}", "func NewDeleteNodeV1alpha1RuntimeClassUnauthorized() *DeleteNodeV1alpha1RuntimeClassUnauthorized {\n\treturn &DeleteNodeV1alpha1RuntimeClassUnauthorized{}\n}", "func NewUnauthorized(res calcsvc.Unauthorized) Unauthorized {\n\tbody := Unauthorized(res)\n\treturn body\n}", "func NewDeleteCertificatesV1beta1CertificateSigningRequestUnauthorized() *DeleteCertificatesV1beta1CertificateSigningRequestUnauthorized {\n\treturn &DeleteCertificatesV1beta1CertificateSigningRequestUnauthorized{}\n}", "func NewCreateBatchV1NamespacedJobUnauthorized() *CreateBatchV1NamespacedJobUnauthorized {\n\n\treturn &CreateBatchV1NamespacedJobUnauthorized{}\n}", "func NewDeleteCoreV1NamespacedServiceAccount(ctx *middleware.Context, handler DeleteCoreV1NamespacedServiceAccountHandler) *DeleteCoreV1NamespacedServiceAccount {\n\treturn &DeleteCoreV1NamespacedServiceAccount{Context: ctx, Handler: handler}\n}", "func NewUnauthorized(err error, msg string) error {\n\treturn &unauthorized{wrap(err, msg, \"\")}\n}", "func NewDeleteAPIKeyDefault(code int) *DeleteAPIKeyDefault {\n\treturn &DeleteAPIKeyDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (client *KeyVaultClient) purgeDeletedSecretCreateRequest(ctx context.Context, vaultBaseURL string, secretName string, options *KeyVaultClientPurgeDeletedSecretOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/deletedsecrets/{secret-name}\"\n\tif secretName == \"\" {\n\t\treturn nil, errors.New(\"parameter secretName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{secret-name}\", url.PathEscape(secretName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (client *LROSADsClient) delete202RetryInvalidHeaderCreateRequest(ctx context.Context, options *LROSADsClientBeginDelete202RetryInvalidHeaderOptions) (*policy.Request, error) {\n\turlPath := \"/lro/error/delete/202/retry/invalidheader\"\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func NewDeleteNotFound(body *DeleteNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func NewDeleteNotFound(body *DeleteNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func NewReadCoreV1NamespacedPodOK() *ReadCoreV1NamespacedPodOK {\n\treturn &ReadCoreV1NamespacedPodOK{}\n}", "func NewDeleteTokenDefault(code int) *DeleteTokenDefault {\n\treturn &DeleteTokenDefault{\n\t\t_statusCode: code,\n\t}\n}", "func Delete(kind string, name string, namespace string, args ...string) (err error) {\n\tdeleteArgs := []string{\"delete\", kind, name, \"-n\", namespace}\n\t_, err = kubectl(append(deleteArgs, args...)...)\n\treturn\n}", "func NewDeleteInstancesUnauthorized() *DeleteInstancesUnauthorized {\n\treturn &DeleteInstancesUnauthorized{}\n}", "func NewDeleteComponentForbidden() *DeleteComponentForbidden {\n\treturn &DeleteComponentForbidden{}\n}", "func (client *KeyVaultClient) purgeDeletedCertificateCreateRequest(ctx context.Context, vaultBaseURL string, certificateName string, options *KeyVaultClientPurgeDeletedCertificateOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/deletedcertificates/{certificate-name}\"\n\tif certificateName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificate-name}\", url.PathEscape(certificateName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}" ]
[ "0.740951", "0.6979649", "0.6803902", "0.67638403", "0.674884", "0.6690887", "0.6411087", "0.6345015", "0.62293595", "0.6227683", "0.6223361", "0.6140357", "0.60931987", "0.59411067", "0.59172565", "0.58970165", "0.58314055", "0.5726889", "0.57166153", "0.5705346", "0.5610533", "0.56045127", "0.5577667", "0.55506796", "0.5549633", "0.55434716", "0.5541593", "0.552961", "0.5524539", "0.55150187", "0.55049086", "0.5435711", "0.542774", "0.5426802", "0.54182994", "0.5411556", "0.539857", "0.53832483", "0.5375574", "0.5373131", "0.5367538", "0.5364443", "0.5359473", "0.53421134", "0.53267056", "0.53187335", "0.5313805", "0.53021914", "0.52982324", "0.529166", "0.5275319", "0.5244022", "0.524047", "0.522477", "0.52162004", "0.51947474", "0.5192106", "0.51913303", "0.5188557", "0.51510775", "0.51497066", "0.5138248", "0.5129325", "0.5119434", "0.50989383", "0.50786436", "0.507472", "0.5072627", "0.5059543", "0.5054817", "0.5054817", "0.5045154", "0.5043862", "0.5041565", "0.50405824", "0.5029146", "0.50139725", "0.5011698", "0.5009971", "0.5003165", "0.49975425", "0.4995782", "0.49892536", "0.49811625", "0.49768955", "0.49762967", "0.49742734", "0.4972614", "0.4972346", "0.49623084", "0.49611747", "0.49581328", "0.49554732", "0.49554732", "0.49403644", "0.49356982", "0.49304762", "0.49196276", "0.4916876", "0.49078754" ]
0.7787556
0
WriteResponse to the client
func (o *DeleteCoreV1NamespacedPodUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses rw.WriteHeader(401) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *Response) Write(w io.Writer) error", "func (c *Operation) writeResponse(rw http.ResponseWriter, status int, data []byte) { // nolint: unparam\n\trw.WriteHeader(status)\n\n\tif _, err := rw.Write(data); err != nil {\n\t\tlogger.Errorf(\"Unable to send error message, %s\", err)\n\t}\n}", "func WriteResponse(w http.ResponseWriter, mensaje string, code int) {\n\tmessage := myTypes.Respuesta{\n\t\tMessage: mensaje,\n\t}\n\tresponse, _ := json.Marshal(message)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(code)\n\tw.Write(response)\n}", "func WriteResponse(w http.ResponseWriter, object interface{}, rerr *irma.RemoteError) {\n\tstatus, bts := JsonResponse(object, rerr)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(status)\n\t_, err := w.Write(bts)\n\tif err != nil {\n\t\tLogWarning(errors.WrapPrefix(err, \"failed to write response\", 0))\n\t}\n}", "func (o *PingOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n}", "func WriteResponse(w http.ResponseWriter, v interface{}, statusCode int) {\n\tresBody, err := json.Marshal(v)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(statusCode)\n\t_, _ = w.Write(resBody)\n}", "func WriteResponse(w http.ResponseWriter, code int, object interface{}) {\n\tdata, err := json.Marshal(object)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(code)\n\tw.Write(data)\n}", "func (o *GetPingOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "func writeResponse(body []byte, w *http.ResponseWriter) {\n\t(*w).Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\t_, err := (*w).Write(body)\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\t(*w).WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func WriteResponse(w http.ResponseWriter, code int, resp interface{}) error {\n\tj, err := json.Marshal(resp)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn err\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(code)\n\n\t_, err = w.Write(j)\n\treturn err\n}", "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}", "func WriteResponse(w http.ResponseWriter, d string) {\n\tw.WriteHeader(200)\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.Write([]byte(d))\n\treturn\n}", "func (o *CreateFacilityUsersOK) 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}", "func writeResponse(w http.ResponseWriter, response Response) {\n\tjson, err := json.Marshal(&response)\n\n\tif err != nil {\n\t\tfmt.Fprint(w, \"There was an error processing the request.\")\n\t}\n\n\tcommon.Log(fmt.Sprintf(\"Returning response %s\", json))\n\tfmt.Fprintf(w, \"%s\", json)\n}", "func (o *CreateProgramOK) 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}", "func (o *DepositNewFileOK) 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}", "func (o *UpdateMedicineOK) 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}", "func (o *CreateTaskCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Location\n\n\tlocation := o.Location.String()\n\tif location != \"\" {\n\t\trw.Header().Set(\"Location\", location)\n\t}\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func writeResponse(r *http.Request, w http.ResponseWriter, code int, resp interface{}) {\n\n\t// Deal with CORS\n\tif origin := r.Header.Get(\"Origin\"); origin != \"\" {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", origin)\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"DELETE, GET, HEAD, OPTIONS, POST, PUT\")\n\t\tw.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n\t\t// Allow any headers\n\t\tif wantedHeaders := r.Header.Get(\"Access-Control-Request-Headers\"); wantedHeaders != \"\" {\n\t\t\tw.Header().Set(\"Access-Control-Allow-Headers\", wantedHeaders)\n\t\t}\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\n\tb, err := json.Marshal(resp)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprintln(w, `{\"error\":\"failed to marshal json\"}`)\n\t\treturn\n\t}\n\n\tw.WriteHeader(code)\n\tfmt.Fprintln(w, string(b))\n}", "func (o *VerifyAccountCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func writeResponse(w http.ResponseWriter, h int, p interface{}) {\n\t// I set the content type...\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t// ... I write the specified status code...\n\tw.WriteHeader(h)\n\t// ... and I write the response\n\tb, _ := json.Marshal(p)\n\tw.Write(b)\n}", "func (o *UpdateCatalogOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "func (c *SwitchVersion) WriteResponse(rw http.ResponseWriter, rp runtime.Producer) {\n\tswitch c.Request.Method {\n\tcase http.MethodPost:\n\t\tc.postSwitchVersion(rw, rp)\n\tdefault:\n\t\tc.notSupported(rw, rp)\n\t}\n}", "func (o *PutRecordingsOK) 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}", "func (o *BofaChkUpdateOK) 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}", "func (o *VerifyHealthCredentialOK) 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}", "func WriteResponse(w http.ResponseWriter, code int, err error, data interface{}, t0 time.Time) {\n\tw.WriteHeader(code)\n\tresp := &Response{Data: data, Dur: fmt.Sprint(time.Since(t0)), OK: false}\n\tif code < 300 {\n\t\tresp.OK = true\n\t}\n\tif err != nil {\n\t\tresp.Err = err.Error()\n\t}\n\terr = json.NewEncoder(w).Encode(resp)\n\tif err != nil {\n\t\tlog.Infof(\"failed to json encode response: %v\", err)\n\t\tif _, err = w.Write([]byte(spew.Sdump(resp))); err != nil {\n\t\t\tlog.Infof(\"failed to write dump of response: %v\", err)\n\t\t}\n\t}\n}", "func (o *NewDiscoveryOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "func writeResponse(data []byte, size int64, ctype string, w http.ResponseWriter) {\n\tw.Header().Set(\"Content-Type\", ctype)\n\tw.Header().Set(\"Content-Length\", fmt.Sprintf(\"%d\", size))\n\tw.Header().Set(\"Cache-Control\", \"no-transform,public,max-age=86400,s-maxage=2592000\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(data)\n}", "func writeResponse(w http.ResponseWriter, code int, object interface{}) {\n\tfmt.Println(\"writing response:\", code, object)\n\tdata, err := json.Marshal(object)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tw.Header().Set(\"content-type\", \"application/json\")\n\tw.WriteHeader(code)\n\tw.Write(data)\n}", "func writeResponse(w http.ResponseWriter, authZRes *authorization.Response) {\n\n\tdata, err := json.Marshal(authZRes)\n\tif err != nil {\n\t\tlog.Fatal(\"Failed to marshel authz response %q\", err.Error())\n\t} else {\n\t\tw.Write(data)\n\t}\n\n\tif authZRes == nil || authZRes.Err != \"\" {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t}\n}", "func (o *GetCharactersCharacterIDOpportunitiesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make(models.GetCharactersCharacterIDOpportunitiesOKBody, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "func (o *WeaviateThingsGetNotImplemented) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(501)\n}", "func (c *UpdateSwitch) WriteResponse(rw http.ResponseWriter, rp runtime.Producer) {\n\tswitch c.Request.Method {\n\tcase http.MethodPost:\n\t\tc.postUpdateSwitch(rw, rp)\n\tdefault:\n\t\tc.notSupported(rw, rp)\n\t}\n}", "func (c *UpdateSwitch) WriteResponse(rw http.ResponseWriter, rp runtime.Producer) {\n\tswitch c.Request.Method {\n\tcase http.MethodPost:\n\t\tc.postUpdateSwitch(rw, rp)\n\tdefault:\n\t\tc.notSupported(rw, rp)\n\t}\n}", "func (o *UpdateLinkInPostOK) 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}", "func (o *GetChatroomsIDOK) 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}", "func (o *GetEchoNameOK) 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}", "func (o *GetUIContentOK) 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}", "func (o *ListVsphereResourceOK) 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}", "func ResponseWrite(w http.ResponseWriter, responseCode int, responseData interface{}) {\n\t// Write Response\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(responseCode)\n\n\t// Write JSON to Response\n\tjson.NewEncoder(w).Encode(responseData)\n}", "func writeHTTPResponseInWriter(httpRes http.ResponseWriter, httpReq *http.Request, nobelPrizeWinnersResponse []byte, err error) {\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\thttp.Error(httpRes, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tlog.Printf(\"Request %s Succesfully Completed\", httpReq.RequestURI)\n\thttpRes.Header().Set(\"Content-Type\", \"application/json\")\n\thttpRes.Write(nobelPrizeWinnersResponse)\n}", "func (o *PostKeysKeyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "func (o *Operation) writeResponse(rw io.Writer, v interface{}) {\n\terr := json.NewEncoder(rw).Encode(v)\n\tif err != nil {\n\t\tlog.Errorf(\"Unable to send error response, %s\", err)\n\t}\n}", "func writeResponse(data interface{}, w http.ResponseWriter) error {\n\tvar (\n\t\tenc []byte\n\t\terr error\n\t)\n\tenc, err = json.Marshal(data)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn fmt.Errorf(\"Failure to marshal, err = %s\", err)\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tn, err := w.Write(enc)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn fmt.Errorf(\"Failure to write, err = %s\", err)\n\t}\n\tif n != len(enc) {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn fmt.Errorf(\"Short write sent = %d, wrote = %d\", len(enc), n)\n\t}\n\treturn nil\n}", "func (o *CreateUserOK) 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}", "func (o *UpdateMoveTaskOrderPostCounselingInformationOK) 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}", "func WriteResponse(rw io.Writer, v interface{}) {\n\terr := json.NewEncoder(rw).Encode(v)\n\tif err != nil {\n\t\tlogger.Errorf(\"Unable to send error response, %s\", err)\n\t}\n}", "func (o *PutQuestionOK) 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}", "func (r *response) Write(b []byte) (n int, err error) {\n\tif !r.headersSend {\n\t\tif r.status == 0 {\n\t\t\tr.status = http.StatusOK\n\t\t}\n\t\tr.WriteHeader(r.status)\n\t}\n\tn, err = r.ResponseWriter.Write(b)\n\tr.size += int64(n)\n\treturn\n}", "func (o *PostOperationsDeleteP2PPathCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func (o *HealthGetOK) 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}", "func (o *WeaviateThingsPatchNotImplemented) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(501)\n}", "func (o *VerifyEmailTokenOK) 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}", "func (o *DeleteServiceIDOK) 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}", "func (o *WeaviateThingsGetOK) 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}", "func (o *Operation) writeResponse(rw io.Writer, v interface{}) {\n\terr := json.NewEncoder(rw).Encode(v)\n\t// as of now, just log errors for writing response\n\tif err != nil {\n\t\tlogger.Errorf(\"Unable to send error response, %s\", err)\n\t}\n}", "func (o *PostOperationsGetNodeEdgePointDetailsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func (o *UserEditOK) 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}", "func (o *WeaviatePeersAnnounceOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "func (o *CertifyOK) 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}", "func writeResponse(writer http.ResponseWriter, response *http.Response) (int64, error) {\n\tdefer response.Body.Close()\n\twriteResponseHeaders(writer, response, false)\n\treturn io.Copy(writer, response.Body)\n}", "func (o *PutMeetupDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(o._statusCode)\n}", "func (o *FingerPathsPostCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func (o *PostPlaybookOK) 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}", "func (o *UpdateHostIgnitionCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func (o *GetCharactersCharacterIDLocationOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (o *GetPingDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n}", "func (o *PostManagementKubernetesIoV1NodesOK) 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}", "func (o *PutPerformancesOK) 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}", "func (o *StopAppAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\n}", "func (o *GetFleetsFleetIDMembersOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Content-Language\n\n\tcontentLanguage := o.ContentLanguage\n\tif contentLanguage != \"\" {\n\t\trw.Header().Set(\"Content-Language\", contentLanguage)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make(models.GetFleetsFleetIDMembersOKBody, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "func (o *GetMeetupsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(o._statusCode)\n}", "func (o *PostEventCreated) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(201)\n}", "func (o *GetTaskTaskIDOK) 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}", "func (o *CreateTCPCheckAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Reload-ID\n\n\treloadID := o.ReloadID\n\tif reloadID != \"\" {\n\t\trw.Header().Set(\"Reload-ID\", reloadID)\n\t}\n\n\trw.WriteHeader(202)\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}", "func (o *PostOperationsGetNetworkElementListCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func (o *ServiceInstanceLastOperationGetOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header RetryAfter\n\n\tretryAfter := o.RetryAfter\n\tif retryAfter != \"\" {\n\t\trw.Header().Set(\"RetryAfter\", retryAfter)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (o *GetPiecesIDOK) 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}", "func (o *GetTaskDetailsOK) 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}", "func (o *UpdateClusterOK) 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}", "func (o *GetDetailOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\trw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\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}", "func (o *GetServicesHaproxyRuntimeAclsIDOK) 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}", "func (r *responseInfoRecorder) Write(b []byte) (int, error) {\n\tr.ContentLength += int64(len(b))\n\tif r.statusCode == 0 {\n\t\tr.statusCode = http.StatusOK\n\t}\n\treturn r.ResponseWriter.Write(b)\n}", "func (o *LogoutOK) 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}", "func (o *UploadFileOK) 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}", "func WriteResponse(w http.ResponseWriter, data interface{}) error {\n\tenv := map[string]interface{}{\n\t\t\"meta\": map[string]interface{}{\n\t\t\t\"code\": http.StatusOK,\n\t\t},\n\t\t\"data\": data,\n\t}\n\treturn jsonResponse(w, env)\n}", "func (o *WeaviateThingTemplatesCreateNotImplemented) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(501)\n}", "func (r *Responder) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\tfor k, v := range r.headers {\n\t\tfor _, val := range v {\n\t\t\trw.Header().Add(k, val)\n\t\t}\n\t}\n\n\trw.WriteHeader(r.code)\n\n\tif r.response != nil {\n\t\tif err := producer.Produce(rw, r.response); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n}", "func (o *GetGateSourceByGateNameAndMntOK) 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}", "func (o *CreateSpoeCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(201)\n\tpayload := o.Payload\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "func (o *Output) writeResponse(response string) error {\r\n\t// write the response\r\n\tif _, err := o.writer.WriteString(response + \"\\n\"); err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\treturn nil\r\n}", "func (o *GetTransportByIDOK) 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}", "func (o *TransferOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n\tif err := producer.Produce(rw, o.Payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "func (o *CreateUserCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "func (o *ViewOneOrderOK) 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}", "func (o *GetVisiblePruebasFromQuestionTestInternalServerError) 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}", "func (o *GetWhaleTranfersOK) 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 = make([]*models.OperationsRow, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "func (o *SearchTournamentsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make([]*models.Tournament, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "func (o *CreateTCPCheckCreated) 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}", "func (s *Server) writeInfoResponse(\n\tw http.ResponseWriter,\n\tr *http.Request,\n\tmessage []byte,\n\tstatus int,\n\theaders map[string]string,\n) {\n\tfor k, v := range headers {\n\t\tw.Header().Add(k, v)\n\t}\n\n\tw.WriteHeader(status)\n\tw.Write(message)\n}" ]
[ "0.81303823", "0.7882039", "0.77722245", "0.7771901", "0.7753117", "0.7740585", "0.76670325", "0.7638451", "0.76095873", "0.75798", "0.7579178", "0.7567389", "0.7560546", "0.75579476", "0.75447774", "0.7542929", "0.75416607", "0.753386", "0.7531158", "0.75192654", "0.75191355", "0.7513389", "0.7512029", "0.75050455", "0.7503395", "0.74984574", "0.74875605", "0.74839836", "0.74772394", "0.7467842", "0.746699", "0.7465759", "0.7464175", "0.746404", "0.746404", "0.7461224", "0.7460309", "0.74595356", "0.74463046", "0.7443478", "0.7435917", "0.7426582", "0.7425581", "0.74186546", "0.7413175", "0.7407469", "0.74063516", "0.74048966", "0.7398737", "0.7389631", "0.738607", "0.73806983", "0.7360552", "0.7360491", "0.7355327", "0.7354953", "0.73532444", "0.7347445", "0.734586", "0.732798", "0.732577", "0.73178244", "0.7316643", "0.7316071", "0.7315527", "0.7312546", "0.73114824", "0.7310336", "0.7309039", "0.73007035", "0.7297214", "0.7291373", "0.7291277", "0.72884554", "0.72845477", "0.72835207", "0.7281928", "0.7281033", "0.72751075", "0.7274423", "0.7273193", "0.72730565", "0.72695094", "0.7269139", "0.72690886", "0.7265927", "0.72615093", "0.72529227", "0.7251764", "0.72490144", "0.72479355", "0.72469014", "0.72407585", "0.72390425", "0.72367245", "0.7234706", "0.722777", "0.722197", "0.7215153", "0.72140837", "0.7213089" ]
0.0
-1
NewDriver returns a new instance of pilosa.Driver which satisfies sql.IndexDriver interface
func NewDriver(root string) *Driver { return &Driver{ root: root, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewIndexDriver(root string) sql.IndexDriver {\n\treturn NewDriver(root, pilosa.DefaultClient())\n}", "func NewDriver() godfish.Driver { return &driver{} }", "func newDriver() *driver {\n\treturn &driver{\n\t\tnetworks: map[string]*bridgeNetwork{},\n\t\tportAllocator: portallocator.Get(),\n\t}\n}", "func NewDriver() Driver {\n\treturn &boltDriver{}\n}", "func New(path string) (ip *Indexio, err error) {\n\tvar i Indexio\n\t// Initialize functions map for marshaling and unmarshaling\n\tfm := turtleDB.NewFuncsMap(marshal, unmarshal)\n\t// Create new instance of turtleDB\n\tif i.db, err = turtleDB.New(\"indexio\", path, fm); err != nil {\n\t\treturn\n\t}\n\t// Initialize indexes bucket\n\tif err = i.db.Update(initBucket); err != nil {\n\t\treturn\n\t}\n\t// Assign ip as a pointer to i\n\tip = &i\n\treturn\n}", "func New(indexRegistry *registry.IndexRegistry, options ...func(*Index)) (I *Index, err error) {\n\tI = &Index{\n\t\tindexRegistry: indexRegistry,\n\t}\n\n\tfor _, option := range options {\n\t\toption(I)\n\t}\n\n\treturn\n}", "func New(dsn string, prefix string) (*Driver, error){\n return &Driver{\n DSN: dsn,\n TablePrefix: prefix,\n }, nil\n}", "func New(path string) (*Index, error) {\n\tkvdb, err := pudge.Open(path, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Index{\n\t\tdb: kvdb,\n\t\tpath: path,\n\t}, nil\n}", "func NewDriver(dialect string, c Conn) *Driver {\n\treturn &Driver{dialect: dialect, Conn: c}\n}", "func NewDriver(root string, client *pilosa.Client) *Driver {\n\treturn &Driver{\n\t\troot: root,\n\t\tclient: client,\n\t}\n}", "func New() (d *Driver) {\n\treturn &Driver{}\n}", "func NewDb(db *sql.DB, driverName string) *DB {\n return &DB{DB: db, driverName: driverName, Mapper: mapper()}\n}", "func NewIndex(addr, name, typ string, md *index.Metadata) (*Index, error) {\n\n\tfmt.Println(\"Get a new index: \", addr, name)\n client := &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\t//MaxIdleConnsPerHost: 200,\n\t\t\tMaxIdleConnsPerHost: 2000000,\n\t\t},\n\t\tTimeout: 2500000 * time.Millisecond,\n\t}\n\tconn, err := elastic.NewClient(elastic.SetURL(addr), elastic.SetHttpClient(client))\n\tif err != nil {\n fmt.Println(\"Get error here\");\n\t\treturn nil, err\n\t}\n\tret := &Index{\n\t\tconn: conn,\n\t\tmd: md,\n\t\tname: name,\n\t\ttyp: typ,\n\t}\n fmt.Println(\"get here ======\");\n\n\treturn ret, nil\n\n}", "func (d *Driver) Create(\n\tdb, table, id string,\n\texpressions []sql.Expression,\n\tconfig map[string]string,\n) (sql.Index, error) {\n\t_, err := mkdir(d.root, db, table, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif config == nil {\n\t\tconfig = make(map[string]string)\n\t}\n\n\texprs := make([]string, len(expressions))\n\tfor i, e := range expressions {\n\t\texprs[i] = e.String()\n\t}\n\n\tcfg := index.NewConfig(db, table, id, exprs, d.ID(), config)\n\terr = index.WriteConfigFile(d.configFilePath(db, table, id), cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tidx, err := d.newPilosaIndex(db, table)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmapping := newMapping(d.mappingFilePath(db, table, id))\n\tprocessingFile := d.processingFilePath(db, table, id)\n\tif err := index.WriteProcessingFile(\n\t\tprocessingFile,\n\t\t[]byte{processingFileOnCreate},\n\t); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newPilosaIndex(idx, mapping, cfg), nil\n}", "func NewDriver(cfg *config.Config) *Driver {\n\tdriver := &Driver{\n\t\tcfg: cfg,\n\t}\n\n\treturn driver\n}", "func New(ds datastore.TxnDatastore, api *apistruct.FullNodeStruct) (*Index, error) {\n\tcs := chainsync.New(api)\n\tstore, err := chainstore.New(txndstr.Wrap(ds, \"chainstore\"), cs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinitMetrics()\n\tctx, cancel := context.WithCancel(context.Background())\n\ts := &Index{\n\t\tapi: api,\n\t\tstore: store,\n\t\tsignaler: signaler.New(),\n\t\tindex: IndexSnapshot{\n\t\t\tMiners: make(map[string]Slashes),\n\t\t},\n\t\tctx: ctx,\n\t\tcancel: cancel,\n\t\tfinished: make(chan struct{}),\n\t}\n\tif err := s.loadFromDS(); err != nil {\n\t\treturn nil, err\n\t}\n\tgo s.start()\n\treturn s, nil\n}", "func (d *Driver) Create(db, table, id string, expressions []sql.Expression, config map[string]string) (sql.Index, error) {\n\t_, err := mkdir(d.root, db, table, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\texprs := make([]string, len(expressions))\n\tfor i, e := range expressions {\n\t\texprs[i] = e.String()\n\t}\n\n\tcfg := index.NewConfig(db, table, id, exprs, d.ID(), config)\n\terr = index.WriteConfigFile(d.configFilePath(db, table, id), cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newPilosaIndex(d.mappingFilePath(db, table, id), d.client, cfg), nil\n}", "func New(dsn string) (m.Driver, error) {\n\tparsedDSN, err := mysql.ParseDSN(dsn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tparsedDSN.MultiStatements = true\n\tdb, err := sql.Open(\"mysql\", parsedDSN.FormatDSN())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := db.Ping(); err != nil {\n\t\treturn nil, err\n\t}\n\n\td := &Driver{\n\t\tdb: db,\n\t}\n\tif err := d.ensureVersionTableExists(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn d, nil\n}", "func NewIndex(addrs []string, pass string, temporary int, name string, md *index.Metadata) *Index {\n\n\tret := &Index{\n\n\t\thosts: addrs,\n\n\t\tmd: md,\n\t\tpassword: pass,\n\t\ttemporary: temporary,\n\n\t\tname: name,\n\n\t\tcommandPrefix: \"FT\",\n\t}\n\tif md != nil && md.Options != nil {\n\t\tif opts, ok := md.Options.(IndexingOptions); ok {\n\t\t\tif opts.Prefix != \"\" {\n\t\t\t\tret.commandPrefix = md.Options.(IndexingOptions).Prefix\n\t\t\t}\n\t\t}\n\t}\n\t//ret.pool.MaxActive = ret.pool.MaxIdle\n\n\treturn ret\n\n}", "func newIndex(name string) (index *ind) {\n\tindex = new(ind)\n\tindex.name = name\n\tindex.Storage = map[string][]string{}\n\tindex.Domains = map[string]bool{}\n\treturn\n}", "func New(data []byte) *Index {}", "func NewDriver(client *redis.Client, prefix string) *Driver {\n\treturn &Driver{\n\t\tclient: client,\n\t\tprefix: prefix,\n\t}\n}", "func NewDriver(nodeID string, endpoint string, synoOption *options.SynologyOptions) (Driver, error) {\n\tglog.Infof(\"Driver: %v\", DriverName)\n\n\tsession, _, err := Login(synoOption)\n\tif err != nil {\n\t\tglog.V(3).Infof(\"Failed to login: %v\", err)\n\t\treturn nil, err\n\t}\n\n\td := &driver{\n\t\tendpoint: endpoint,\n\t\tsynologyHost: synoOption.Host,\n\t\tsession: *session,\n\t}\n\n\tcsiDriver := csicommon.NewCSIDriver(DriverName, version, nodeID)\n\tcsiDriver.AddControllerServiceCapabilities(\n\t\t[]csi.ControllerServiceCapability_RPC_Type{\n\t\t\tcsi.ControllerServiceCapability_RPC_LIST_VOLUMES,\n\t\t\tcsi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME,\n\t\t\tcsi.ControllerServiceCapability_RPC_PUBLISH_UNPUBLISH_VOLUME,\n\t\t\tcsi.ControllerServiceCapability_RPC_EXPAND_VOLUME,\n\t\t})\n\tcsiDriver.AddVolumeCapabilityAccessModes(\n\t\t[]csi.VolumeCapability_AccessMode_Mode{csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER})\n\n\td.csiDriver = csiDriver\n\n\treturn d, nil\n}", "func New() *Index {\n\treturn &Index{Version: Version}\n}", "func NewDriver(cfg *configv1.InfrastructureStatus, clnt client.Client) Driver {\n\n\tctx := context.Background()\n\tvar driver Driver\n\n\tif cfg.PlatformStatus.Type == \"AWS\" {\n\t\tdriver = s3.NewDriver(ctx, cfg, clnt)\n\t}\n\n\tif cfg.PlatformStatus.Type == \"GCP\" {\n\t\tdriver = gcs.NewDriver(ctx, cfg, clnt)\n\t}\n\n\treturn driver\n}", "func NewDriver(config dbmate.DriverConfig) dbmate.Driver {\n\treturn &Driver{\n\t\tmigrationsTableName: config.MigrationsTableName,\n\t\tdatabaseURL: config.DatabaseURL,\n\t\tlog: config.Log,\n\t}\n}", "func NewIndex(kind IndexKind, table string) Index {\n\treturn &index{\n\t\tkind: kind,\n\t\ttable: table,\n\t}\n}", "func New(data []byte) *Index", "func NewDriver(options *DriverOptions) *Driver {\n\td := Driver{\n\t\tvolLockMap: util.NewLockMap(),\n\t\tsubnetLockMap: util.NewLockMap(),\n\t\tvolumeLocks: newVolumeLocks(),\n\t\tcloudConfigSecretName: options.CloudConfigSecretName,\n\t\tcloudConfigSecretNamespace: options.CloudConfigSecretNamespace,\n\t\tcustomUserAgent: options.CustomUserAgent,\n\t\tuserAgentSuffix: options.UserAgentSuffix,\n\t\tblobfuseProxyEndpoint: options.BlobfuseProxyEndpoint,\n\t\tenableBlobfuseProxy: options.EnableBlobfuseProxy,\n\t\tblobfuseProxyConnTimout: options.BlobfuseProxyConnTimout,\n\t\tenableBlobMockMount: options.EnableBlobMockMount,\n\t\tallowEmptyCloudConfig: options.AllowEmptyCloudConfig,\n\t\tenableGetVolumeStats: options.EnableGetVolumeStats,\n\t\tmountPermissions: options.MountPermissions,\n\t}\n\td.Name = options.DriverName\n\td.Version = driverVersion\n\td.NodeID = options.NodeID\n\n\td.DefaultControllerServer.Driver = &d.CSIDriver\n\td.DefaultIdentityServer.Driver = &d.CSIDriver\n\td.DefaultNodeServer.Driver = &d.CSIDriver\n\n\tvar err error\n\tgetter := func(key string) (interface{}, error) { return nil, nil }\n\tif d.accountSearchCache, err = azcache.NewTimedcache(time.Minute, getter); err != nil {\n\t\tklog.Fatalf(\"%v\", err)\n\t}\n\treturn &d\n}", "func (b backend) New(ctx context.Context, l log.Interface, cfg *config.Config) (persist.Database, error) {\n\tusername, password, host, port, db :=\n\t\tcfg.Database.Postgres.Username,\n\t\tcfg.Database.Postgres.Password,\n\t\tcfg.Database.Postgres.Host,\n\t\tcfg.Database.Postgres.Port,\n\t\tcfg.Database.Postgres.DB\n\n\tconnString := fmt.Sprintf(\n\t\t\"postgres://%s:%s@%s:%d/%s\",\n\t\tusername,\n\t\tpassword,\n\t\thost,\n\t\tport,\n\t\tdb,\n\t)\n\n\tconn, err := pgxpool.Connect(ctx, connString)\n\tif err != nil {\n\t\treturn nil, errwrap.Wrap(err, \"failed to connect to postgres\")\n\t}\n\n\tq := gen.New(conn)\n\n\treturn &database{\n\t\tqueries: q,\n\t}, nil\n}", "func NewDriver(storage StorageDriver, mountPath string) Driver {\n\treturn &driverInfo{\n\t\tstorage: storage,\n\t\tmountPath: mountPath,\n\t\tvolumes: make(map[string]*Volume),\n\t}\n}", "func NewDBDriver(log *logrus.Logger) Driver {\n\treturn &DBDriver{log: log}\n}", "func New(data []byte) []*Index {\n\treturn NewWithReader(bytes.NewReader(data))\n}", "func newDocumentIndex(opts *iface.CreateDocumentDBOptions) iface.StoreIndex {\n\treturn &documentIndex{\n\t\tindex: map[string][]byte{},\n\t\topts: opts,\n\t}\n}", "func NewDriver(libType string) (Driver, bool) {\n\tvar ecosystem dbTypes.Ecosystem\n\tvar comparer compare.Comparer\n\n\tswitch libType {\n\tcase ftypes.Bundler, ftypes.GemSpec:\n\t\tecosystem = vulnerability.RubyGems\n\t\tcomparer = rubygems.Comparer{}\n\tcase ftypes.RustBinary, ftypes.Cargo:\n\t\tecosystem = vulnerability.Cargo\n\t\tcomparer = compare.GenericComparer{}\n\tcase ftypes.Composer:\n\t\tecosystem = vulnerability.Composer\n\t\tcomparer = compare.GenericComparer{}\n\tcase ftypes.GoBinary, ftypes.GoModule:\n\t\tecosystem = vulnerability.Go\n\t\tcomparer = compare.GenericComparer{}\n\tcase ftypes.Jar, ftypes.Pom, ftypes.Gradle:\n\t\tecosystem = vulnerability.Maven\n\t\tcomparer = maven.Comparer{}\n\tcase ftypes.Npm, ftypes.Yarn, ftypes.Pnpm, ftypes.NodePkg, ftypes.JavaScript:\n\t\tecosystem = vulnerability.Npm\n\t\tcomparer = npm.Comparer{}\n\tcase ftypes.NuGet, ftypes.DotNetCore:\n\t\tecosystem = vulnerability.NuGet\n\t\tcomparer = compare.GenericComparer{}\n\tcase ftypes.Pipenv, ftypes.Poetry, ftypes.Pip, ftypes.PythonPkg:\n\t\tecosystem = vulnerability.Pip\n\t\tcomparer = pep440.Comparer{}\n\tcase ftypes.Pub:\n\t\tecosystem = vulnerability.Pub\n\t\tcomparer = compare.GenericComparer{}\n\tcase ftypes.Hex:\n\t\tecosystem = vulnerability.Erlang\n\t\tcomparer = compare.GenericComparer{}\n\tcase ftypes.Conan:\n\t\tecosystem = vulnerability.Conan\n\t\t// Only semver can be used for version ranges\n\t\t// https://docs.conan.io/en/latest/versioning/version_ranges.html\n\t\tcomparer = compare.GenericComparer{}\n\tcase ftypes.Swift:\n\t\t// Swift uses semver\n\t\t// https://www.swift.org/package-manager/#importing-dependencies\n\t\tecosystem = vulnerability.Swift\n\t\tcomparer = compare.GenericComparer{}\n\tcase ftypes.Cocoapods:\n\t\t// CocoaPods uses RubyGems version specifiers\n\t\t// https://guides.cocoapods.org/making/making-a-cocoapod.html#cocoapods-versioning-specifics\n\t\tecosystem = vulnerability.Cocoapods\n\t\tcomparer = rubygems.Comparer{}\n\tcase ftypes.CondaPkg:\n\t\tlog.Logger.Warn(\"Conda package is supported for SBOM, not for vulnerability scanning\")\n\t\treturn Driver{}, false\n\tdefault:\n\t\tlog.Logger.Warnf(\"The %q library type is not supported for vulnerability scanning\", libType)\n\t\treturn Driver{}, false\n\t}\n\treturn Driver{\n\t\tecosystem: ecosystem,\n\t\tcomparer: comparer,\n\t\tdbc: db.Config{},\n\t}, true\n}", "func New(cfg *config.Config, log logger.Logger) (conn *Connection, name string, err error) {\n\tconn = &Connection{Config: cfg}\n\tpg, json, mock, stub := new(PostgreSQL), new(JSON), new(Mock), new(datastore.Stub)\n\tswitch cfg.DbType {\n\tcase config.PGDriver:\n\t\tpg, name, err = NewPostgreSQL(cfg, log)\n\t\tconn.SQLDriver, conn.Store = pg, pg\n\tcase config.JSONDriver:\n\t\tjson, name, err = NewJSON(cfg, log)\n\t\tconn.Controller, conn.Store = json, json\n\tcase config.MockDriver:\n\t\tconn.Controller, conn.Store, name = mock, mock, config.MockDriver\n\tdefault:\n\t\tconn.Controller, conn.Store, name = stub, stub, config.StubDriver\n\t}\n\n\treturn\n}", "func New() (database, error) {\n\tdb, err := sql.Open(driverName, databaseName)\n\tif err != nil {\n\t\treturn database{}, err\n\t}\n\n\treturn database{db}, nil\n}", "func New(fsys fs.FS, path string) (source.Driver, error) {\n\tvar i driver\n\tif err := i.Init(fsys, path); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to init driver with path %s: %w\", path, err)\n\t}\n\treturn &i, nil\n}", "func NewIndexed() *Indexed {\n\trand.Seed(time.Now().UTC().UnixNano())\n\treturn &Indexed{\n\t\tsize: 0,\n\t}\n}", "func New(config *connect.Config) Db {\n\tvar db Db\n\t// first find db in dbMap by DatabaseName\n\tdb = dbMap[config.DatabaseName]\n\t// find\n\tif db != nil {\n\t\treturn db\n\t}\n\t// not find in dbMap - New\n\tswitch config.DbType {\n\tcase connect.MONGODB:\n\t\t// init mongodb\n\t\tdb = mongo.New(config)\n\t}\n\tdbMap[config.DatabaseName] = db\n\treturn db\n}", "func NewIndex(physicalID int64, tblInfo *model.TableInfo, indexInfo *model.IndexInfo) table.Index {\n\tindex := &index{\n\t\tidxInfo: indexInfo,\n\t\ttblInfo: tblInfo,\n\t\t// The prefix can't encode from tblInfo.ID, because table partition may change the id to partition id.\n\t\tprefix: tablecodec.EncodeTableIndexPrefix(physicalID, indexInfo.ID),\n\t}\n\treturn index\n}", "func New(sqlDB *sql.DB) (db.Session, error) {\n\treturn registeredAdapter.New(sqlDB)\n}", "func Open(name string, settings Settings) (Database, error) {\n\n\tdriver, ok := wrappers[name]\n\tif ok == false {\n\t\t// Using panic instead of returning error because attemping to use an\n\t\t// nonexistent adapter will never result in a successful connection,\n\t\t// therefore should be considered a developer's mistake and must be catched\n\t\t// at compilation time.\n\t\tpanic(fmt.Sprintf(\"Open: Unknown adapter %s. (see: https://upper.io/db#database-adapters)\", name))\n\t}\n\n\t// Creating a new connection everytime Open() is called.\n\tdriverType := reflect.ValueOf(driver).Elem().Type()\n\tnewAdapter := reflect.New(driverType).Interface().(Database)\n\n\t// Setting up the connection.\n\terr := newAdapter.Setup(settings)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newAdapter, nil\n}", "func newDbIterator(typeName []byte, it iterator, db *leveldb.DB) (*DbIterator, error) {\n\n\tidx := &DbIterator{typeName: typeName, it: it, db: db}\n\n\treturn idx, nil\n}", "func NewIndexClient(name string, cfg Config, schemaCfg config.SchemaConfig, limits StoreLimits, cm ClientMetrics, ownsTenantFn downloads.IndexGatewayOwnsTenant, registerer prometheus.Registerer) (index.Client, error) {\n\tswitch name {\n\tcase config.StorageTypeInMemory:\n\t\tstore := testutils.NewMockStorage()\n\t\treturn store, nil\n\tcase config.StorageTypeAWS, config.StorageTypeAWSDynamo:\n\t\tif cfg.AWSStorageConfig.DynamoDB.URL == nil {\n\t\t\treturn nil, fmt.Errorf(\"Must set -dynamodb.url in aws mode\")\n\t\t}\n\t\tpath := strings.TrimPrefix(cfg.AWSStorageConfig.DynamoDB.URL.Path, \"/\")\n\t\tif len(path) > 0 {\n\t\t\tlevel.Warn(util_log.Logger).Log(\"msg\", \"ignoring DynamoDB URL path\", \"path\", path)\n\t\t}\n\t\treturn aws.NewDynamoDBIndexClient(cfg.AWSStorageConfig.DynamoDBConfig, schemaCfg, registerer)\n\tcase config.StorageTypeGCP:\n\t\treturn gcp.NewStorageClientV1(context.Background(), cfg.GCPStorageConfig, schemaCfg)\n\tcase config.StorageTypeGCPColumnKey, config.StorageTypeBigTable:\n\t\treturn gcp.NewStorageClientColumnKey(context.Background(), cfg.GCPStorageConfig, schemaCfg)\n\tcase config.StorageTypeBigTableHashed:\n\t\tcfg.GCPStorageConfig.DistributeKeys = true\n\t\treturn gcp.NewStorageClientColumnKey(context.Background(), cfg.GCPStorageConfig, schemaCfg)\n\tcase config.StorageTypeCassandra:\n\t\treturn cassandra.NewStorageClient(cfg.CassandraStorageConfig, schemaCfg, registerer)\n\tcase config.StorageTypeBoltDB:\n\t\treturn local.NewBoltDBIndexClient(cfg.BoltDBConfig)\n\tcase config.StorageTypeGrpc:\n\t\treturn grpc.NewStorageClient(cfg.GrpcConfig, schemaCfg)\n\tcase config.BoltDBShipperType:\n\t\tif boltDBIndexClientWithShipper != nil {\n\t\t\treturn boltDBIndexClientWithShipper, nil\n\t\t}\n\n\t\tif shouldUseIndexGatewayClient(cfg.BoltDBShipperConfig.Config) {\n\t\t\tgateway, err := gatewayclient.NewGatewayClient(cfg.BoltDBShipperConfig.IndexGatewayClientConfig, registerer, util_log.Logger)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tboltDBIndexClientWithShipper = gateway\n\t\t\treturn gateway, nil\n\t\t}\n\n\t\tobjectClient, err := NewObjectClient(cfg.BoltDBShipperConfig.SharedStoreType, cfg, cm)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttableRanges := getIndexStoreTableRanges(config.BoltDBShipperType, schemaCfg.Configs)\n\n\t\tboltDBIndexClientWithShipper, err = shipper.NewShipper(cfg.BoltDBShipperConfig, objectClient, limits,\n\t\t\townsTenantFn, tableRanges, registerer)\n\n\t\treturn boltDBIndexClientWithShipper, err\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Unrecognized storage client %v, choose one of: %v, %v, %v, %v, %v, %v\", name, config.StorageTypeAWS, config.StorageTypeCassandra, config.StorageTypeInMemory, config.StorageTypeGCP, config.StorageTypeBigTable, config.StorageTypeBigTableHashed)\n\t}\n}", "func NewBackend(config *Config, log *logger.Logger) (b *Backend, err error) {\n\tb = new(Backend)\n\tb.Config = config\n\n\t// Prepare database connection depending on driver type\n\tvar dial gorm.Dialector\n\tswitch config.Driver {\n\tcase \"sqlite3\":\n\t\tdial = sqlite.Open(config.ConnectionString)\n\tcase \"postgres\":\n\t\tdial = postgres.Open(config.ConnectionString)\n\tcase \"mysql\":\n\t\tdial = mysql.New(mysql.Config{\n\t\t\tDSN: config.ConnectionString,\n\t\t\tDefaultStringSize: 256, // default size for string fields\n\t\t\tSkipInitializeWithVersion: true, // auto configure based on currently MySQL version\n\t\t})\n\n\t//case \"sqlserver\":\n\t//\tdial = sqlserver.Open(config.ConnectionString)\n\t//\n\t// There is currently an issue with the reserved keyword user not being correctly escaped\n\t// \"SELECT count(*) FROM \"uploads\" WHERE uploads.user == \"user\" AND \"uploads\".\"deleted_at\" IS NULL\"\n\t// -> returns : Incorrect syntax near the keyword 'user'\n\t// \"SELECT count(*) FROM \"uploads\" WHERE uploads.[user] = \"user\" AND \"uploads\".\"deleted_at\" IS NULL\"\n\t// -> Would be OK\n\t// TODO investigate how the query is generated and maybe open issue in https://github.com/denisenkom/go-mssqldb ?\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Invalid metadata backend driver : %s\", config.Driver)\n\t}\n\n\t// Setup logging adaptor\n\tb.log = log\n\tgormLoggerAdapter := NewGormLoggerAdapter(log.Copy())\n\n\tif b.Config.Debug {\n\t\t// Display all Gorm log messages\n\t\tgormLoggerAdapter.logger.SetMinLevel(logger.DEBUG)\n\t} else {\n\t\t// Display only Gorm errors\n\t\tgormLoggerAdapter.logger.SetMinLevel(logger.WARNING)\n\t}\n\n\t// Set slow query threshold\n\tif config.SlowQueryThreshold != \"\" {\n\t\tduration, err := time.ParseDuration(config.SlowQueryThreshold)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Unable to parse SlowQueryThreshold : %s\", err)\n\t\t}\n\t\tgormLoggerAdapter.SlowQueryThreshold = duration\n\t}\n\n\t// Open database connection\n\tb.db, err = gorm.Open(dial, &gorm.Config{Logger: gormLoggerAdapter})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to open database : %s\", err)\n\t}\n\n\tif config.Driver == \"sqlite3\" {\n\t\terr = b.db.Exec(\"PRAGMA journal_mode=WAL;\").Error\n\t\tif err != nil {\n\t\t\tif err := b.Shutdown(); err != nil {\n\t\t\t\tb.log.Criticalf(\"Unable to shutdown metadata backend : %s\", err)\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"unable to set wal mode : %s\", err)\n\t\t}\n\n\t\terr = b.db.Exec(\"PRAGMA foreign_keys = ON\").Error\n\t\tif err != nil {\n\t\t\tif err := b.Shutdown(); err != nil {\n\t\t\t\tb.log.Criticalf(\"Unable to shutdown metadata backend : %s\", err)\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"unable to enable foreign keys : %s\", err)\n\t\t}\n\t}\n\n\t// Setup metrics\n\tdbMetrics := gormPrometheus.New(gormPrometheus.Config{})\n\terr = b.db.Use(dbMetrics)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to enable gorm metrics : %s\", err)\n\t}\n\tb.dbStats = dbMetrics.DBStats\n\n\t// For testing\n\tif config.EraseFirst {\n\t\terr = b.db.Migrator().DropTable(\"files\", \"uploads\", \"tokens\", \"users\", \"settings\", \"migrations\")\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to drop tables : %s\", err)\n\t\t}\n\t}\n\n\tif !b.Config.noMigrations {\n\t\t// Initialize database schema\n\t\terr = b.initializeSchema()\n\t\tif err != nil {\n\t\t\tif err := b.Shutdown(); err != nil {\n\t\t\t\tb.db.Logger.Error(context.Background(), \"Unable to shutdown metadata backend : %s\", err)\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"unable to initialize DB : %s\", err)\n\t\t}\n\t}\n\n\t// Adjust max idle/open connection pool size\n\terr = b.adjustConnectionPoolParameters()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn b, err\n}", "func NewIndexClient(name string, cfg Config, schemaCfg chunk.SchemaConfig, registerer prometheus.Registerer) (chunk.IndexClient, error) {\n\tif indexClientFactory, ok := customIndexStores[name]; ok {\n\t\tif indexClientFactory.indexClientFactoryFunc != nil {\n\t\t\treturn indexClientFactory.indexClientFactoryFunc()\n\t\t}\n\t}\n\n\tswitch name {\n\tcase StorageTypeInMemory:\n\t\tstore := chunk.NewMockStorage()\n\t\treturn store, nil\n\tcase StorageTypeAWS, StorageTypeAWSDynamo:\n\t\tif cfg.AWSStorageConfig.DynamoDB.URL == nil {\n\t\t\treturn nil, fmt.Errorf(\"Must set -dynamodb.url in aws mode\")\n\t\t}\n\t\tpath := strings.TrimPrefix(cfg.AWSStorageConfig.DynamoDB.URL.Path, \"/\")\n\t\tif len(path) > 0 {\n\t\t\tlevel.Warn(util_log.Logger).Log(\"msg\", \"ignoring DynamoDB URL path\", \"path\", path)\n\t\t}\n\t\treturn aws.NewDynamoDBIndexClient(cfg.AWSStorageConfig.DynamoDBConfig, schemaCfg, registerer)\n\tcase StorageTypeGCP:\n\t\treturn gcp.NewStorageClientV1(context.Background(), cfg.GCPStorageConfig, schemaCfg)\n\tcase StorageTypeGCPColumnKey, StorageTypeBigTable:\n\t\treturn gcp.NewStorageClientColumnKey(context.Background(), cfg.GCPStorageConfig, schemaCfg)\n\tcase StorageTypeBigTableHashed:\n\t\tcfg.GCPStorageConfig.DistributeKeys = true\n\t\treturn gcp.NewStorageClientColumnKey(context.Background(), cfg.GCPStorageConfig, schemaCfg)\n\tcase StorageTypeCassandra:\n\t\treturn cassandra.NewStorageClient(cfg.CassandraStorageConfig, schemaCfg, registerer)\n\tcase StorageTypeBoltDB:\n\t\treturn local.NewBoltDBIndexClient(cfg.BoltDBConfig)\n\tcase StorageTypeGrpc:\n\t\treturn grpc.NewStorageClient(cfg.GrpcConfig, schemaCfg)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Unrecognized storage client %v, choose one of: %v, %v, %v, %v, %v, %v\", name, StorageTypeAWS, StorageTypeCassandra, StorageTypeInMemory, StorageTypeGCP, StorageTypeBigTable, StorageTypeBigTableHashed)\n\t}\n}", "func NewIndex() Index {\n\tnewIndex := Index{}\n\tnewIndex.Setup()\n\treturn newIndex\n}", "func NewIndexer(keys []string, dateLayout string) *Indexer {\n\treturn &Indexer{\n\t\tdateLayout: dateLayout,\n\t\tkeys: keys,\n\t}\n}", "func New(name string) (s *SeriesDB, e error) {\n\tseriesList, err := findByName(name)\n\n\tif err != nil {\n\t\te = errors.New(\"Failed to initialize SeriesDB\")\n\t}\n\n\treturn &SeriesDB{SeriesName: name, seriesList: seriesList}, e\n}", "func NewDriver(options *DriverOptions) CSIDriver {\n\tif !*useDriverV2 {\n\t\treturn newDriverV1(options)\n\t} else {\n\t\treturn newDriverV2(options)\n\t}\n}", "func (es *Repository) NewIndex(ctx context.Context, index string) (error){\n\tsvc := es.client.CreateIndex(\"ethan\")\n\n\t_, err := svc.Do(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func newAnalyzer(dbName string, si SchemaInformation) *analyzer {\n\treturn &analyzer{\n\t\texprRecursiveDeps: map[sqlparser.Expr]TableSet{},\n\t\texprDeps: map[sqlparser.Expr]TableSet{},\n\t\texprTypes: map[sqlparser.Expr]querypb.Type{},\n\t\trScope: map[*sqlparser.Select]*scope{},\n\t\twScope: map[*sqlparser.Select]*scope{},\n\t\tcurrentDb: dbName,\n\t\tsi: si,\n\t}\n}", "func NewDriver(endpoint, driverName, nodeID string) *Driver {\n\tglog.Infof(\"NewDriver for CHDFS, driverName: %v version: %v nodeID: %v\", driverName, version, nodeID)\n\n\tcsiDriver := csicommon.NewCSIDriver(driverName, version, nodeID)\n\tcsiDriver.AddVolumeCapabilityAccessModes([]csi.VolumeCapability_AccessMode_Mode{\n\t\tcsi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER,\n\t})\n\n\treturn &Driver{\n\t\tcsiDriver: csiDriver,\n\t\tendpoint: endpoint,\n\t}\n}", "func New(params DriverParameters) (*Driver, error) {\n defer obs.CloseLog()\n //obs.SyncLog() \n\tclient, _ := obs.New(\n\t\tparams.AccessKey,\n\t\tparams.SecretKey,\n\t\tparams.Endpoint,\n\t\tobs.WithRegion(params.Region),\n\t\tobs.WithSslVerify(params.Secure),\n\t\tobs.WithSignature(params.V2Auth),\n\t\tobs.WithPathStyle(params.PathStyle),\n\t\t//obs.WithSecurityToken(params.SecurityToken),\n\t)\n \n\n\td := &driver{\n\t\tClient: client,\n\t\tBucket: params.Bucket,\n\t\tChunkSize: params.ChunkSize,\n\t\tMultipartCopyChunkSize: params.MultipartCopyChunkSize,\n\t\tMultipartCopyMaxConcurrency: params.MultipartCopyMaxConcurrency,\n\t\tMultipartCopyThresholdSize: params.MultipartCopyThresholdSize,\n\t\tRootDirectory: params.RootDirectory,\n\t\tStorageClass: params.StorageClass,\n\t\tObjectACL: params.ObjectACL,\n\t\tPathStyle: params.PathStyle,\n\t}\n\treturn &Driver{\n\t\tbaseEmbed: baseEmbed{\n\t\t\tBase: base.Base{\n\t\t\t\tStorageDriver: d,\n\t\t\t},\n\t\t},\n\t}, nil\n}", "func (d *Driver) Save(\n\tctx *sql.Context,\n\ti sql.Index,\n\titer sql.IndexKeyValueIter,\n) (err error) {\n\tvar colID uint64\n\tstart := time.Now()\n\n\tidx, ok := i.(*pilosaIndex)\n\tif !ok {\n\t\treturn errInvalidIndexType.New(i)\n\t}\n\n\tprocessingFile := d.processingFilePath(idx.Database(), idx.Table(), idx.ID())\n\tif err = index.CreateProcessingFile(processingFile); err != nil {\n\t\treturn err\n\t}\n\n\t// Retrieve the pilosa schema\n\tschema, err := d.client.Schema()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create a pilosa index and frame objects in memory\n\tpilosaIndex, err := schema.Index(indexName(idx.Database(), idx.Table()))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.frames = make([]*pilosa.Frame, len(idx.Expressions()))\n\tfor i, e := range idx.Expressions() {\n\t\tfrm, err := pilosaIndex.Frame(frameName(idx.ID(), e))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// make sure we delete the index in every run before inserting, since there may\n\t\t// be previous data\n\t\tif err = d.client.DeleteFrame(frm); err != nil {\n\t\t\treturn errDeletePilosaFrame.New(frm.Name(), err)\n\t\t}\n\n\t\td.frames[i] = frm\n\t}\n\n\t// Make sure the index and frames exists on the server\n\terr = d.client.SyncSchema(schema)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Open mapping in create mode. After finishing the transaction is rolled\n\t// back unless all goes well and rollback value is changed.\n\trollback := true\n\tidx.mapping.openCreate(true)\n\tdefer func() {\n\t\tif rollback {\n\t\t\tidx.mapping.rollback()\n\t\t} else {\n\t\t\te := d.saveMapping(ctx, idx.mapping, colID, false)\n\t\t\tif e != nil && err == nil {\n\t\t\t\terr = e\n\t\t\t}\n\t\t}\n\n\t\tidx.mapping.close()\n\t}()\n\n\td.bitBatches = make([]*bitBatch, len(d.frames))\n\tfor i := range d.bitBatches {\n\t\td.bitBatches[i] = newBitBatch(sql.IndexBatchSize)\n\t}\n\n\tfor colID = uint64(0); err == nil; colID++ {\n\t\t// commit each batch of objects (pilosa and boltdb)\n\t\tif colID%sql.IndexBatchSize == 0 && colID != 0 {\n\t\t\td.saveBatch(ctx, idx.mapping, colID)\n\t\t}\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\n\t\tdefault:\n\t\t\tvar (\n\t\t\t\tvalues []interface{}\n\t\t\t\tlocation []byte\n\t\t\t)\n\t\t\tvalues, location, err = iter.Next()\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tfor i, frm := range d.frames {\n\t\t\t\tif values[i] == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\trowID, err := idx.mapping.getRowID(frm.Name(), values[i])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\td.bitBatches[i].Add(rowID, colID)\n\t\t\t}\n\t\t\terr = idx.mapping.putLocation(pilosaIndex.Name(), colID, location)\n\t\t}\n\t}\n\n\tif err != nil && err != io.EOF {\n\t\treturn err\n\t}\n\n\trollback = false\n\n\terr = d.savePilosa(ctx, colID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogrus.WithFields(logrus.Fields{\n\t\t\"duration\": time.Since(start),\n\t\t\"pilosa\": d.timePilosa,\n\t\t\"mapping\": d.timeMapping,\n\t\t\"rows\": colID,\n\t\t\"id\": i.ID(),\n\t}).Debugf(\"finished pilosa indexing\")\n\n\treturn index.RemoveProcessingFile(processingFile)\n}", "func newDatabase(count int) (*database, error) {\n\tdb, err := sql.Open(\"postgres\", fmt.Sprintf(`host=%s port=%s user=%s\n\t\tpassword=%s dbname=%s sslmode=disable`,\n\t\thost, port, user, password, dbname))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := db.Ping(); err != nil {\n\t\treturn nil, err\n\t}\n\tlog.Printf(\"connected to psql client, host: %s\\n\", host)\n\n\treturn &database{\n\t\tdb: db,\n\t\terrChan: make(chan error, count),\n\t}, nil\n}", "func New(image, rootfs string) (Driver, error) {\n\tfor _, name := range drivers {\n\t\tv := reflect.New(driverRegistry[name])\n\t\td, ok := v.Interface().(Driver)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"%s driver doesn't seem to implement the fsdriver.Driver interface\")\n\t\t}\n\n\t\tif err := d.Init(image, rootfs); err == nil {\n\t\t\treturn d, nil\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"none of %v drivers are supported on the host\", drivers)\n}", "func NewDriver(p *Periph) *Driver {\n\treturn &Driver{p: p, timeoutRx: -1, timeoutTx: -1}\n}", "func New(cfg *Config, l *log.Logger) (*Backend, error) {\n\n\tvar err error\n\tb := &Backend{log: l, dbConfig: cfg.Mongo}\n\n\ta := 1\n\tfor {\n\t\terr = b.connectDB()\n\t\tif err == nil {\n\t\t\tbreak\n\t\t}\n\t\tif cfg.Debug {\n\t\t\treturn nil, err\n\t\t}\n\t\tlog.Printf(\"Database connection error! Attempt: %d\", a)\n\t\ta++\n\t\ttime.Sleep(3 * time.Second)\n\t}\n\n\tb.Model, err = model.New(b.session.DB(b.dbConfig.Name), l)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn b, nil\n}", "func newQueueIndex(dataDir string) (*queueIndex, error) {\n\tindexFile := path.Join(dataDir, cIndexFileName)\n\tindexArena, err := newArena(indexFile, cIndexFileSize)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &queueIndex{\n\t\tindexFile: indexFile,\n\t\tindexArena: indexArena,\n\t}, nil\n}", "func newMongoDriver(name string, opts MongoDBOptions) (*mongoDriver, error) {\n\thost, _ := os.Hostname() // nolint\n\n\tif err := opts.Validate(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"invalid mongo driver options\")\n\t}\n\n\treturn &mongoDriver{\n\t\tname: name,\n\t\topts: opts,\n\t\tinstanceID: fmt.Sprintf(\"%s.%s.%s\", name, host, uuid.New()),\n\t}, nil\n}", "func NewDriver(ca CABackend, client *client.Client) (*Driver, error) {\n\treturn &Driver{\n\t\tca: ca,\n\t\tclient: client,\n\t}, nil\n}", "func NewIndex(path, name string) (*Index, error) {\n\terr := validateName(name)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"validating name\")\n\t}\n\n\treturn &Index{\n\t\tpath: path,\n\t\tname: name,\n\t\tfields: make(map[string]*Field),\n\n\t\tnewAttrStore: newNopAttrStore,\n\t\tcolumnAttrs: nopStore,\n\n\t\tbroadcaster: NopBroadcaster,\n\t\tStats: stats.NopStatsClient,\n\t\tlogger: logger.NopLogger,\n\t\ttrackExistence: true,\n\t}, nil\n}", "func (server *SingleInstance) Driver() (neo4j.Driver, error) {\n\treturn neo4j.NewDriver(server.boltURI, server.authToken, server.config)\n}", "func NewSimpleDB() *SimpleDB {\n\tindex := make(map[string]int64)\n\treturn &SimpleDB{\n\t\tindex: index,\n\t}\n}", "func Open(driverName, dataSourceName string) (*DB, error) {\n db, err := sql.Open(driverName, dataSourceName)\n if err != nil {\n return nil, err\n }\n return &DB{DB: db, driverName: driverName, Mapper: mapper()}, err\n}", "func New(db *sql.DB, logger log.Logger) (todo.Repository, error) {\n\t// return repository\n\treturn &repository{\n\t\tdb: db,\n\t\tlogger: log.With(logger, \"rep\", \"cockroachdb\"),\n\t}, nil\n}", "func New(cfg config.Config, log *logrus.Logger) error {\n\tvar tpl bytes.Buffer\n\tvars := map[string]interface{}{\n\t\t\"typename\": getTypeName(cfg.Repository.URL),\n\t}\n\n\tindexMappingTemplate, _ := template.New(\"geo_mapping\").Parse(`{\n\t\t\"mappings\": {\n\t\t\t\"{{ .typename }}\": {\n\t\t\t\t\"properties\": {\n\t\t\t\t\t\"geometry\": {\n\t\t\t\t\t\t\"type\": \"geo_shape\"\n\t\t\t\t\t},\n \"collection\": {\n \"type\": \"text\",\n \"fielddata\": true\n }\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}`)\n\n\tindexMappingTemplate.Execute(&tpl, vars)\n\n\tctx := context.Background()\n\n\tclient, err := createClient(&cfg.Repository)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tindexName := getIndexName(cfg.Repository.URL)\n\n\tcreateIndex, err := client.CreateIndex(indexName).Body(tpl.String()).Do(ctx)\n\tif err != nil {\n\t\terrorText := fmt.Sprintf(\"Cannot create repository: %v\\n\", err)\n\t\tlog.Errorf(errorText)\n\t\treturn errors.New(errorText)\n\t}\n\tif !createIndex.Acknowledged {\n\t\treturn errors.New(\"CreateIndex was not acknowledged. Check that timeout value is correct.\")\n\t}\n\n\tlog.Debug(\"Creating Repository\" + cfg.Repository.URL)\n\tlog.Debug(\"Type: \" + cfg.Repository.Type)\n\tlog.Debug(\"URL: \" + cfg.Repository.URL)\n\n\treturn nil\n}", "func NewDriver() *Driver {\n\treturn &Driver{\n\t\tVMDriver: &drivers.VMDriver{\n\t\t\tBaseDriver: &drivers.BaseDriver{},\n\t\t\tCPU: DefaultCPUs,\n\t\t\tMemory: DefaultMemory,\n\t\t},\n\t}\n}", "func newIndexWithTempPath(name string) *Index {\n\tpath, err := ioutil.TempDir(\"\", \"pilosa-index-\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tindex, err := NewIndex(path, name)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn index\n}", "func Wrap(d driver.Driver) driver.Driver {\n\treturn &DriverWrapper{d}\n}", "func (b Factory) New(ctx context.Context, name string, l log.Interface, cfg *config.Config) (Database, error) {\n\tbackend, ok := b[name]\n\tif !ok {\n\t\treturn nil, errwrap.Wrap(ErrDatabaseNotFound, name)\n\t}\n\n\tdb, err := backend.New(ctx, l, cfg)\n\n\treturn db, errwrap.Wrap(err, \"failed to create backend\")\n}", "func New(db *sql.DB, logger log.Logger) (order.Repository, error) {\n\t// return repository\n\treturn &repository{\n\t\tdb: db,\n\t\tlogger: log.With(logger, \"rep\", \"cockroachdb\"),\n\t}, nil\n}", "func New(dsn string, maxConn int) dao.DB {\n\treturn &db{\n\t\tDB: open(dsn, maxConn),\n\t}\n}", "func CreateNewIndex(url string, alias string) (string, error) {\n\t// create our day-specific name\n\tphysicalIndex := fmt.Sprintf(\"%s_%s\", alias, time.Now().Format(\"2006_01_02\"))\n\tidx := 0\n\n\t// check if it exists\n\tfor true {\n\t\tresp, err := http.Get(fmt.Sprintf(\"%s/%s\", url, physicalIndex))\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\t// not found, great, move on\n\t\tif resp.StatusCode == http.StatusNotFound {\n\t\t\tbreak\n\t\t}\n\n\t\t// was found, increase our index and try again\n\t\tidx++\n\t\tphysicalIndex = fmt.Sprintf(\"%s_%s_%d\", alias, time.Now().Format(\"2006_01_02\"), idx)\n\t}\n\n\t// initialize our index\n\tcreateURL := fmt.Sprintf(\"%s/%s\", url, physicalIndex)\n\t_, err := MakeJSONRequest(http.MethodPut, createURL, indexSettings, nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// all went well, return our physical index name\n\tlog.WithField(\"index\", physicalIndex).Info(\"created index\")\n\treturn physicalIndex, nil\n}", "func newConnection() connection {\n\tdatabase := sqlx.MustOpen(driverName, \"user=erosai dbname=erosai password=Erosai11!! sslmode=disable\")\n\tc := connection{\n\t\tdb: database,\n\t}\n\n\tregisterConnection(&c)\n\n\treturn c\n}", "func NewDb() *Db { //s interface{}\n\td := &Db{\n\t\tarr: make(Lister, 0, 100),\n\t\tupdate: time.Now().UnixNano(),\n\t}\n\treturn d\n}", "func newDataStore(driver, dsn string) (*dataStore, error) {\r\n\r\n\tvar this *dataStore\r\n\r\n\tif db, err := sqlx.Open(driver, dsn); err != nil {\r\n\t\treturn nil, err\r\n\t} else if err := db.Ping(); err != nil {\r\n\t\treturn nil, err\r\n\t} else {\r\n\t\tthis = &dataStore{\r\n\t\t\tDB: db,\r\n\t\t\tconnPool: new(ConnPool),\r\n\t\t\tnamedStmts: make(map[string]map[string]*namedStmt),\r\n\t\t}\r\n\t}\r\n\r\n\treturn this, nil\r\n}", "func newSQLSyncable(sqlConfig sqlConfig) *sqlSyncable {\n\tif sqlConfig.driver == \"ql\" {\n\t\tql.RegisterDriver()\n\t}\n\n\tdb, err := sql.Open(sqlConfig.driver, sqlConfig.connectionString)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tinserts := unwrapMappings(db, sqlConfig.mappings)\n\n\treturn &sqlSyncable{sqlConfig, inserts, db}\n}", "func NewDriver() *Driver {\n\treturn &Driver{\n\t\tServer: http.Server{\n\t\t\tReadTimeout: 30 * time.Second,\n\t\t\tWriteTimeout: 30 * time.Second,\n\t\t\tIdleTimeout: 120 * time.Second,\n\t\t},\n\t}\n}", "func New(cfg postgres.Postgres) (*Provider, error) {\n\tp := &Provider{\n\t\tname: \"postgres.\" + cfg.Name,\n\t\tquery: cfg.Query,\n\t}\n\n\tif cfg.Timeout == 0 {\n\t\tcfg.Timeout = defaultTimeout\n\t}\n\n\tpgConnString := fmt.Sprintf(\"postgres://%s:%s@%s:%d/%s?sslmode=%s&sslrootcert=%s\",\n\t\tcfg.Username,\n\t\tcfg.Password,\n\t\tcfg.Host,\n\t\tcfg.Port,\n\t\tcfg.Database,\n\t\tcfg.SSLMode,\n\t\tcfg.SSLCertPath,\n\t)\n\tvar err error\n\n\tp.db, err = sqlx.Open(\"postgres\", pgConnString)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := p.db.Ping(); err != nil {\n\t\tp.db.Close()\n\t\treturn nil, err\n\t}\n\n\treturn p, nil\n}", "func NewDriver(baseURL string, token string) (*Driver, error) {\n\traw, err := hype.New(baseURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\td := &Driver{\n\t\traw,\n\t\ttoken,\n\t\thype.NewHeader(\"Accept\", \"application/json\"),\n\t\thype.NewHeader(\"Content-Type\", \"application/json\"),\n\t\thype.NewHeader(\"User-Agent\", \"fbz/0.1.0 (https://github.com/ess/fbz)\"),\n\t}\n\n\treturn d, nil\n}", "func newFileRepositoryIndex(ctxt context.Context, repoName string) (*fileRepositoryIndex, error) {\n\n\tindex := &fileRepositoryIndex{}\n\n\tindex.repoName = repoName\n\n\tindex.repoDir = filepath.Join(file.RepositoriesDirPath(ctxt), repoName)\n\n\tindex.path = filepath.Join(index.repoDir, file.IndexFileName)\n\n\tif !file.DirExists(index.repoDir) {\n\t\treturn nil, errors.NotFound.Newf(\"repository directory at %s does not exist\",\n\t\t\tindex.repoDir)\n\t}\n\n\treturn index, nil\n\n}", "func (factory DriverFactory) Driver() (*strata.Driver, error) {\n\toptions := factory.GetOptions().(*Options)\n\n\taccountName := os.Getenv(\"AZURE_ACCOUNT_NAME\")\n\taccountSecret := os.Getenv(\"AZURE_ACCOUNT_SECRET\")\n\tif accountName == \"\" || accountSecret == \"\" {\n\t\treturn nil, errors.New(\"Environment variables AZURE_ACCOUNT_NAME and AZURE_ACCOUNT_SECRET must be set\")\n\t}\n\n\tazureBloblStorage, err := azureblobstorage.NewAzureBlobStorage(\n\t\taccountName,\n\t\taccountSecret,\n\t\toptions.AzureBlobOptions.Container,\n\t\toptions.AzureBlobOptions.BlobPrefix)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treplica, err := lreplica.NewLocalReplica(\n\t\toptions.Replica.MaxBackgroundCopies,\n\t\tstrconv.Itoa(options.Replica.Port),\n\t\toptions.Replica.Username,\n\t\toptions.Replica.Password,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmanager, err := strata.NewSnapshotManager(replica, azureBloblStorage)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &strata.Driver{Manager: manager}, err\n}", "func (sw *scanWrap) Index(name string) Scan {\n\treturn &scanWrap{\n\t\tscan: sw.scan.Index(name),\n\t}\n}", "func NewIndexConnection(context Context) *IndexConnection {\n\tsize := context.GetScanCap()\n\tif size <= 0 {\n\t\tsize = _ENTRY_CAP\n\t}\n\n\trv := &IndexConnection{\n\t\tcontext: context,\n\t}\n\tnewEntryExchange(&rv.sender, size)\n\treturn rv\n}", "func New(ctx context.Context, opts *Options) (database *DB, err error) {\n\tif opts != nil && opts.DriverName != \"dexie\" {\n\t\treturn nil, fmt.Errorf(`unexpected driver name for js/wasm: %q (only \"dexie\" is supported)`, opts.DriverName)\n\t}\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = jsutil.RecoverError(r)\n\t\t}\n\t}()\n\tnewDexieDatabase := js.Global().Get(\"__mesh_dexie_newDatabase__\")\n\tif jsutil.IsNullOrUndefined(newDexieDatabase) {\n\t\treturn nil, errors.New(\"could not detect Dexie.js\")\n\t}\n\topts = parseOptions(opts)\n\tdexie := newDexieDatabase.Invoke(opts)\n\n\t// Automatically close the database connection when the context is canceled.\n\tgo func() {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\t_ = dexie.Call(\"close\")\n\t\t}\n\t}()\n\n\treturn &DB{\n\t\tctx: ctx,\n\t\tdexie: dexie,\n\t\topts: opts,\n\t}, nil\n}", "func connectToDatabase(host string, port int) {\n\tvar err error\n\n\t// connect to the db\n\tif db, err = as.NewClient(host, port); err != nil {\n\t\tpanic(err)\n\t}\n\n\treadPolicy = as.NewPolicy()\n\twritePolicy = as.NewWritePolicy(0, 0)\n\tscanPolicy = as.NewScanPolicy()\n\n\t// index on offer_id of bids, so we can find bids on a given offer\n\tif _, err := db.CreateIndex(writePolicy, \"test\", BIDS, \"idx:br:1\", \"offer_id\", as.NUMERIC); err != nil {\n\t\tfmt.Printf(\"Create Index Failed: %s\\n\", err.Error())\n\t}\n\n\t// index on broker_id of bids, so we can find bids by a particular broker\n\tif _, err := db.CreateIndex(writePolicy, \"test\", BIDS, \"idx:br:2\", \"broker_id\", as.NUMERIC); err != nil {\n\t\tfmt.Printf(\"Create Index Failed: %s\\n\", err.Error())\n\t}\n\n\t// index on broker_id of offers, so we can find offers by a particular broker\n\tif _, err := db.CreateIndex(writePolicy, \"test\", OFFERS, \"idx:br:3\", \"broker_id\", as.NUMERIC); err != nil {\n\t\tfmt.Printf(\"Create Index Failed: %s\\n\", err.Error())\n\t}\n\n\t// index on ticker of prices\n\tif _, err := db.CreateIndex(writePolicy, \"test\", PRICES, \"idx:br:4\", \"ticker\", as.STRING); err != nil {\n\t\tfmt.Printf(\"Create Index Failed: %s\\n\", err.Error())\n\t}\n\n}", "func NewIndexer(\n\tprojectRoot string,\n\trepositoryRoot string,\n\tmoduleName string,\n\tmoduleVersion string,\n\tdependencies map[string]string,\n\taddContents bool,\n\ttoolInfo protocol.ToolInfo,\n\tw io.Writer,\n) Indexer {\n\treturn &indexer{\n\t\tprojectRoot: projectRoot,\n\t\trepositoryRoot: repositoryRoot,\n\t\tmoduleName: moduleName,\n\t\tmoduleVersion: moduleVersion,\n\t\tdependencies: dependencies,\n\t\ttoolInfo: toolInfo,\n\t\tw: protocol.NewWriter(w, addContents),\n\n\t\t// Empty maps\n\t\tdefsIndexed: map[string]bool{},\n\t\tusesIndexed: map[string]bool{},\n\t\tranges: map[string]map[int]string{},\n\t\thoverResultCache: map[string]string{},\n\t\tfiles: map[string]*fileInfo{},\n\t\timports: map[token.Pos]*defInfo{},\n\t\tfuncs: map[string]*defInfo{},\n\t\tconsts: map[token.Pos]*defInfo{},\n\t\tvars: map[token.Pos]*defInfo{},\n\t\ttypes: map[string]*defInfo{},\n\t\tlabels: map[token.Pos]*defInfo{},\n\t\trefs: map[string]*refResultInfo{},\n\t\tpackageInformationIDs: map[string]string{},\n\t}\n}", "func (c *SpannerConnector) Driver() driver.Driver {\n\treturn &SpannerDriver{}\n}", "func NewDriver(name string, loader func(interface{}) error) (Driver, error) {\n\tfactorysMu.RLock()\n\tfactoryi, ok := factories[name]\n\tfactorysMu.RUnlock()\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"file: unknown driver %q (forgotten import?)\", name)\n\t}\n\treturn factoryi(loader)\n}", "func NewIndex() *Index {\n\treturn &Index{root: &node{}}\n}", "func New(options *pg.Options) *pg.DB {\n\n db := pg.Connect(options)\n db.AddQueryHook(dbLogger{})\n return db\n}", "func New(db SqlxDB) *DB {\n\treturn &DB{\n\t\tDB: db,\n\t}\n}", "func New(ctx context.Context, dirPath string, opts *Options) (*DB, error) {\n\tvar (\n\t\trepo storage.Repository\n\t\terr error\n\t\tdbCloser io.Closer\n\t)\n\tif opts == nil {\n\t\topts = defaultOptions()\n\t}\n\n\tif opts.Logger == nil {\n\t\topts.Logger = log.Noop\n\t}\n\n\tlock := multex.New()\n\tmetrics := newMetrics()\n\topts.LdbStats.CompareAndSwap(nil, &metrics.LevelDBStats)\n\n\tlocker := func(addr swarm.Address) func() {\n\t\tlock.Lock(addr.ByteString())\n\t\treturn func() {\n\t\t\tlock.Unlock(addr.ByteString())\n\t\t}\n\t}\n\n\tif dirPath == \"\" {\n\t\trepo, dbCloser, err = initInmemRepository(locker)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\t// only perform migration if not done already\n\t\tif _, err := os.Stat(path.Join(dirPath, indexPath)); err != nil {\n\t\t\terr = performEpochMigration(ctx, dirPath, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\trepo, dbCloser, err = initDiskRepository(ctx, dirPath, locker, opts)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tsharkyBasePath := \"\"\n\tif dirPath != \"\" {\n\t\tsharkyBasePath = path.Join(dirPath, sharkyPath)\n\t}\n\terr = migration.Migrate(\n\t\trepo.IndexStore(),\n\t\tlocalmigration.AllSteps(sharkyBasePath, sharkyNoOfShards, repo.ChunkStore()),\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcacheObj, err := initCache(ctx, opts.CacheCapacity, repo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlogger := opts.Logger.WithName(loggerName).Register()\n\n\tdb := &DB{\n\t\tmetrics: metrics,\n\t\tlogger: logger,\n\t\tbaseAddr: opts.Address,\n\t\trepo: repo,\n\t\tlock: lock,\n\t\tcacheObj: cacheObj,\n\t\tretrieval: noopRetrieval{},\n\t\tpusherFeed: make(chan *pusher.Op),\n\t\tquit: make(chan struct{}),\n\t\tbgCacheLimiter: make(chan struct{}, 16),\n\t\tdbCloser: dbCloser,\n\t\tbatchstore: opts.Batchstore,\n\t\tvalidStamp: opts.ValidStamp,\n\t\tevents: events.NewSubscriber(),\n\t\treserveBinEvents: events.NewSubscriber(),\n\t\topts: workerOpts{\n\t\t\twarmupDuration: opts.WarmupDuration,\n\t\t\twakeupDuration: opts.ReserveWakeUpDuration,\n\t\t},\n\t\tdirectUploadLimiter: make(chan struct{}, pusher.ConcurrentPushes),\n\t\tinFlight: new(util.WaitingCounter),\n\t}\n\n\tif db.validStamp == nil {\n\t\tdb.validStamp = postage.ValidStamp(db.batchstore)\n\t}\n\n\tif opts.ReserveCapacity > 0 {\n\t\trs, err := reserve.New(\n\t\t\topts.Address,\n\t\t\trepo.IndexStore(),\n\t\t\topts.ReserveCapacity,\n\t\t\topts.RadiusSetter,\n\t\t\tlogger,\n\t\t\tfunc(ctx context.Context, store internal.Storage, addrs ...swarm.Address) error {\n\t\t\t\tdefer func() { db.metrics.CacheSize.Set(float64(db.cacheObj.Size())) }()\n\n\t\t\t\tdb.lock.Lock(cacheAccessLockKey)\n\t\t\t\tdefer db.lock.Unlock(cacheAccessLockKey)\n\n\t\t\t\treturn cacheObj.MoveFromReserve(ctx, store, addrs...)\n\t\t\t},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdb.reserve = rs\n\n\t\tdb.metrics.StorageRadius.Set(float64(rs.Radius()))\n\t\tdb.metrics.ReserveSize.Set(float64(rs.Size()))\n\t}\n\tdb.metrics.CacheSize.Set(float64(db.cacheObj.Size()))\n\n\t// Cleanup any dirty state in upload and pinning stores, this could happen\n\t// in case of dirty shutdowns\n\terr = errors.Join(\n\t\tupload.CleanupDirty(db),\n\t\tpinstore.CleanupDirty(db),\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "func New(busNumber int) (ConnCloser, error) {\n\topener, err := find(busNumber)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn opener()\n}", "func New(driver, connectionString string) (*DBCleaner, error) {\n\tdb, err := sql.Open(driver, connectionString)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &DBCleaner{db, driver}, err\n}", "func NewIndex(unique bool, columns []Column) *Index {\n\treturn &Index{\n\t\tbtree: btree.NewBTreeG[Doc](func(a, b Doc) bool {\n\t\t\treturn Order(a, b, columns, !unique) < 0\n\t\t}),\n\t}\n}", "func New(cfg Config) (*SQLStore, error) {\n\n\tdb, err := sqlx.Open(string(cfg.Driver), cfg.DataSource)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to open db connection\")\n\t}\n\n\tbuilder := sq.StatementBuilder.PlaceholderFormat(sq.Question)\n\n\tswitch cfg.Driver {\n\tcase DBDriverMySQL: // mysql\n\t\tdb.MapperFunc(func(s string) string { return s })\n\n\t\t//case DBDriverPostgres: // postgres\n\t\t//\tbuilder = builder.PlaceholderFormat(sq.Dollar)\n\n\t}\n\n\treturn &SQLStore{\n\t\tcfg: cfg,\n\t\tdb: db,\n\t\tbuilder: builder,\n\t}, nil\n}" ]
[ "0.72023934", "0.627724", "0.6087702", "0.6054594", "0.6042574", "0.5936483", "0.5933362", "0.58980846", "0.5811265", "0.5788316", "0.5722886", "0.57088774", "0.5673194", "0.5624739", "0.5623983", "0.5612024", "0.5610115", "0.56064487", "0.5585477", "0.5568059", "0.5529486", "0.55284023", "0.54559726", "0.54518557", "0.5397084", "0.5362575", "0.5354373", "0.53434074", "0.53325844", "0.53243446", "0.52956295", "0.52870476", "0.5268194", "0.52677375", "0.52523327", "0.5252187", "0.5233186", "0.52277553", "0.52209145", "0.5203117", "0.5186445", "0.51852494", "0.5183646", "0.5182093", "0.51818484", "0.51743996", "0.51705015", "0.5169062", "0.516701", "0.51518464", "0.51492834", "0.5148507", "0.51383936", "0.51153165", "0.5106829", "0.509748", "0.50861925", "0.5072244", "0.5066105", "0.50605667", "0.50593096", "0.5054005", "0.5051466", "0.50490487", "0.5048449", "0.5045024", "0.5040087", "0.50361365", "0.5034531", "0.50342315", "0.5033565", "0.5028008", "0.5027562", "0.5026573", "0.501855", "0.50004315", "0.49927843", "0.49888587", "0.49858627", "0.4977854", "0.4969541", "0.49682766", "0.49670926", "0.49588394", "0.49580997", "0.4951012", "0.49481142", "0.49425504", "0.49411526", "0.49406922", "0.4939585", "0.4931354", "0.49275273", "0.49230492", "0.49216", "0.49115056", "0.49109033", "0.4908378", "0.4906832", "0.4906632" ]
0.5648367
13
ID returns the unique name of the driver.
func (*Driver) ID() string { return DriverID }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d *driver) Name() string {\n\treturn driverName\n}", "func (d *driver) Name() string {\n\treturn driverName\n}", "func (d *driver) Name() string {\n\treturn driverName\n}", "func (d *hdbDriver) Name() string { return DriverName }", "func ID() (string, error) {\n\tid, err := hardwareId()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"hardwareid: %v\", err)\n\t}\n\treturn id, nil\n}", "func (v VirtualSwitch) ID() (string, error) {\n\tid, err := v.virtualSwitch.GetProperty(\"Name\")\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"GetProperty(Name)\")\n\t}\n\treturn id.Value().(string), nil\n}", "func Name() string {\n\treturn driver.AppName()\n}", "func (d *Driver) DriverName() string {\n\treturn DriverName\n}", "func (drv StorageDriver) Driver() string {\n\treturn string(drv)\n}", "func (d *Driver) DriverName() string {\n\treturn driverName\n}", "func (db *DB) DriverName() string {\n return db.driverName\n}", "func DriverName() string {\n\tdriver, err := DriverNameByKey(DefaultConnectionName)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn driver\n}", "func (s *Server) ID() string {\n\treturn s.Config().GetUuid()\n}", "func (db *DB) Driver() string {\n\treturn driver\n}", "func (db *DB) Driver() string {\n\treturn driver\n}", "func (d *Driver) Name() string { return d.name }", "func (cc *Client) ID() (string, error) {\n\ts, err := cc.sshSession()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer s.Close()\n\tid, err := s.Output(\"id\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(id), nil\n}", "func (dev *SDRDevice) GetDriverKey() (driverKey string) {\n\n\tval := (*C.char)(C.SoapySDRDevice_getDriverKey(dev.device))\n\tdefer C.free(unsafe.Pointer(val))\n\n\treturn C.GoString(val)\n}", "func (h *Host) ID() string {\n\tif h.id == \"\" {\n\t\thash := md5.New()\n\t\t_, _ = io.WriteString(hash, h.IP+h.MAC)\n\t\th.id = fmt.Sprintf(\"%x\", hash.Sum(nil))\n\t}\n\n\treturn h.id\n}", "func (d *Driver) DriverName() string {\n\treturn \"vmwarevsphere\"\n}", "func (db *DB) DriverName() string {\n\treturn db.DB.DriverName()\n}", "func (s *DbRecorder) Driver() string {\n\treturn s.flavor\n}", "func (d *Driver) DriverName() string {\n\treturn \"bytemark\"\n}", "func (s *VirtualStore) ID() string {\n\treturn s.sid\n}", "func (decryptor *PgDecryptor) ID() string {\n\treturn \"PgDecryptor\"\n}", "func GetNameID() (nameID string) {\n\treturn\n}", "func (conn *Connection) ID() string {\n\treturn conn.id\n}", "func (d *Driver) DriverName() string {\n\treturn \"exoscale\"\n}", "func (c *ConnectionMock) ID() string {\n\targs := c.Called()\n\treturn args.String(0)\n}", "func (b *base) ID() string { return b.IDx }", "func getDockerID() (string){\n\tid, _ := os.Hostname()\n\treturn id\n}", "func ID() string {\n\treturn appid\n}", "func GetDriverName(driver driver.Driver) string {\n\tif driver == nil {\n\t\treturn \"\"\n\t}\n\tdriverType := fmt.Sprintf(\"%s\", reflect.TypeOf(driver))\n\tswitch driverType {\n\tcase \"*mysql.MySQLDriver\":\n\t\treturn \"mysql\"\n\tcase \"*pq.Driver\":\n\t\treturn \"postgres\"\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "func (us *UserStorage) IDByName(name string) (string, error) {\n\treturn randomdata.StringNumber(2, \"-\"), nil\n}", "func (v *Volume) Driver() string {\n\treturn v.config.Driver\n}", "func (r *regulator) Name() string {\n\tr.enter()\n\tdefer r.exit()\n\n\treturn r.StorageDriver.Name()\n}", "func (c *Connection) ID() string {\n\treturn fmt.Sprintf(\"[%s@%d_%d]\", c.url, c.id, c.cc)\n}", "func (c Client) GetIdentifier() network.Identifier { return c.identify }", "func getInstanceID(providerID string) string {\n\tproviderTokens := strings.Split(providerID, \"/\")\n\treturn providerTokens[len(providerTokens)-1]\n}", "func getInstanceID(providerID string) string {\n\tproviderTokens := strings.Split(providerID, \"/\")\n\treturn providerTokens[len(providerTokens)-1]\n}", "func (d Display) GetDriver() string {\n\treturn C.GoString(C.caca_get_display_driver(d.Dp))\n}", "func (w *deviceWrapper) GetID() string {\n\tif w.ID == \"\" {\n\t\tw.ID = fmt.Sprintf(\"%s.%s.%s\", utils.NormalizeDeviceName(w.Ctor.DeviceConfigName),\n\t\t\tutils.NormalizeDeviceName(w.Ctor.DeviceType.String()),\n\t\t\tutils.NormalizeDeviceName(w.Ctor.DeviceInterface.(device.IDevice).GetName()))\n\t}\n\treturn w.ID\n}", "func (r *RDBDriver) Name() string {\n\treturn r.name\n}", "func (pe *ProgramExt) UUID() string {\n\treturn fmt.Sprintf(\"%s_%s\", pe.Manager, pe.Config)\n}", "func (client *BaseClient) ID() string {\n\treturn client.id\n}", "func (bv *BaseVSphere) ID() string {\n\treturn fmt.Sprintf(\"%s[%s@%s]\", bv.Type, bv.Name, bv.Endpoint)\n}", "func (s *PostgresStore) ID() string {\n\treturn s.sid\n}", "func (r *Network) Driver() pulumi.StringOutput {\n\treturn (pulumi.StringOutput)(r.s.State[\"driver\"])\n}", "func (cons *VgaTextConsole) DriverName() string {\n\treturn \"vga_text_console\"\n}", "func (c *Chip) Identifier() string { return c.identifier }", "func (p *ResourcePool) ID() string {\n\treturn fmt.Sprintf(\"resourcepool(%s)\", p.manager.Name())\n}", "func (c *localComponent) ID() dependency.Instance {\n\treturn dependency.PolicyBackend\n}", "func (ph PackageHash) ID() string {\n\treturn hex.EncodeToString(ph[:16])\n}", "func (c *Component) ID() string {\n\tc.Cmu.Lock()\n\tdefer c.Cmu.Unlock()\n\treturn c.Id\n}", "func (h *Harness) UUID(id string) string { return h.uuidG.Get(id) }", "func (s *Server) Id() string {\n\treturn s.ID()\n}", "func (d *Driver) DriverName() string {\n\treturn \"proxmoxve\"\n}", "func (wlt Wallet) GetID() string {\n\treturn wlt.Meta[\"filename\"]\n}", "func (gpu *Device) UUID() (string, error) {\n\treturn gpu.textProperty(\"UUID\")\n}", "func ID(namespace, name string) string {\n\treturn fmt.Sprintf(\"%s/%s\", namespace, name)\n}", "func (o IopingSpecVolumeVolumeSourceCsiOutput) Driver() pulumi.StringOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceCsi) string { return v.Driver }).(pulumi.StringOutput)\n}", "func (w *W) ID() string {\n\treturn w.Config.URL\n}", "func (p *Peer) ID() string {\n\treturn fmt.Sprintf(\"%s.%s\", p.Organization, p.Name)\n}", "func (o *os) GetUniqueId() gdnative.String {\n\to.ensureSingleton()\n\t//log.Println(\"Calling _OS.GetUniqueId()\")\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(\"_OS\", \"get_unique_id\")\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}", "func (ca *NullClientAdapter) ID() string {\n\treturn ca.ClientID\n}", "func (inst *Instance) ID() string {\n\tif inst == nil || inst.inst == nil {\n\t\treturn \"\"\n\t}\n\treturn inst.inst.ID()\n}", "func (i *Instance) ID() string {\n\treturn i.MachineID\n}", "func (s *session) ID() string {\n\treturn s.sid\n}", "func (na *NetAdapter) ID() *id.ID {\n\treturn na.id\n}", "func getHardwareID() string {\n\tif hardwareID != \"\" {\n\t\treturn hardwareID\n\t}\n\taddress := \"\"\n\tinters, err := net.Interfaces()\n\tif err == nil {\n\t\tfor _, inter := range inters {\n\t\t\tif inter.HardwareAddr.String() != \"\" {\n\t\t\t\taddress = inter.HardwareAddr.String()\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif address == \"\" {\n\t\taddress = \"0\"\n\t}\n\tcheck32 := crc32.ChecksumIEEE([]byte(address))\n\tid58 := base58.EncodeBig(nil, big.NewInt(int64(check32)))\n\thardwareID = string(id58)\n\treturn hardwareID\n}", "func (c *WSClient) ID() string {\n\treturn c.id.String()\n}", "func (c *Config) Identifier(globals integrations_v2.Globals) (string, error) {\n\tif c.Common.InstanceKey != nil {\n\t\treturn *c.Common.InstanceKey, nil\n\t}\n\treturn c.Name(), nil\n}", "func (spec *MachineSpec) ID() string {\n\treturn spec.Machine.ObjectId.Hex()\n}", "func NameID(name string) (nm string, err error) {\n\ts, err := binary.Blake2bHash([]byte(name))\n\tif err != nil {\n\t\treturn\n\t}\n\treturn binary.Encode(binary.PrefixName, s), nil\n}", "func (o FioSpecVolumeVolumeSourceCsiOutput) Driver() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceCsi) string { return v.Driver }).(pulumi.StringOutput)\n}", "func (e *Etcd) BackendID() (result string) {\n\treturn e.etcd.Server.ID().String()\n}", "func (db *DB) GetDriverById(id int) (*Driver, error) {\n\tdb, err := GetPgConnection()\n\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tdefer db.Close()\n\n\trow, err := db.Query(\"SELECT * FROM users WHERE id = $1\", id)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer row.Close()\n\n\tdriver := new(Driver)\n\n\tfor row.Next() {\n\t\terr = row.Scan(&driver.Id, &driver.Username)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn driver, nil\n}", "func (n *DesktopNotificator) ID() string {\n\treturn \"DesktopNotificator\"\n}", "func (d *Directory) ID() string {\n\treturn d.id\n}", "func (d *Module) ID() string {\n\treturn ModuleID\n}", "func (a *Agent) ID() string {\n\n\tresult, err := a.sentry.PublicKeyBase64()\n\tif err != nil {\n\t\terr = stacktrace.Propagate(err, \"could not get node ID\")\n\t\tpanic(err)\n\t}\n\treturn result\n}", "func (d Disk) GetID() string {\n\treturn d.Serial\n}", "func (cracker *Firecracker) ID() (string, error) {\n\t_, err := cracker.State()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn cracker.id, nil\n}", "func (c *container) ID() string {\n\treturn c.name\n}", "func (u User) ID() string {\n\tif u.IsAnonymous() {\n\t\treturn \"user/anonymous\"\n\t}\n\treturn \"user/\" + string(u)\n}", "func (id ClientEncryptionKeyId) ID() string {\n\tfmtString := \"/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/sqlDatabases/%s/clientEncryptionKeys/%s\"\n\treturn fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.SqlDatabaseName, id.ClientEncryptionKeyName)\n}", "func (d *APA102Driver) Name() string { return d.name }", "func DriverNameByKey(key string) (string, error) {\n\n\tconn, err := GetConnectionWithKey(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn conn.DriverName(), nil\n}", "func (p ObjectID) ID() string {\n\treturn fmt.Sprintf(\"%d.%d.%d\",\n\t\tp.SpaceType(),\n\t\tp.ObjectType(),\n\t\tp.Instance(),\n\t)\n}", "func (f *FFS) ID(ctx context.Context) (ffs.APIID, error) {\n\tresp, err := f.client.ID(ctx, &rpc.IDRequest{})\n\tif err != nil {\n\t\treturn ffs.EmptyInstanceID, err\n\t}\n\treturn ffs.APIID(resp.Id), nil\n}", "func (l *RelayDriver) Name() string { return l.name }", "func (w *blobWriter) ID() string {\n\treturn w.BlobWriter.ID()\n}", "func (e *Exec) GetNameID() string { return e.nameID }", "func (s *Session) ID() string {\n\treturn s.id\n}", "func (c *Connector) ID() string {\n\tc.cmu.Lock()\n\tdefer c.cmu.Unlock()\n\treturn c.id\n}", "func (s *SOC) ID() []byte {\n\treturn s.id\n}", "func (llrb *LLRB) ID() string {\n\treturn llrb.name\n}", "func (d *Device) Id() uint32 { return d.DevId }", "func (m *Machine) Id() string {\n\treturn m.tag.Id()\n}" ]
[ "0.7027706", "0.7010078", "0.7010078", "0.69331926", "0.67615914", "0.6571657", "0.65653706", "0.65030783", "0.6484946", "0.6479828", "0.62847674", "0.62813586", "0.62324375", "0.6207377", "0.6207377", "0.61767435", "0.60884994", "0.60639834", "0.6063588", "0.60591555", "0.60532415", "0.6034294", "0.602093", "0.60125667", "0.59922236", "0.59848106", "0.5946331", "0.59421825", "0.59419423", "0.5940304", "0.5918061", "0.59162825", "0.59140384", "0.5910121", "0.58944225", "0.587069", "0.5858404", "0.58433473", "0.5835246", "0.5835246", "0.58332855", "0.5830521", "0.58301127", "0.58245915", "0.5803061", "0.5796447", "0.57886684", "0.57855296", "0.57838905", "0.5759296", "0.57591003", "0.5758986", "0.5755055", "0.5746744", "0.57435447", "0.574054", "0.5735592", "0.5716223", "0.5715785", "0.5707389", "0.5702112", "0.570105", "0.5662691", "0.5659358", "0.5650701", "0.5643778", "0.5643472", "0.56395054", "0.5624399", "0.5623376", "0.56205606", "0.5618645", "0.56147015", "0.560479", "0.5599722", "0.5591939", "0.55715543", "0.55693924", "0.5569361", "0.55688345", "0.5567512", "0.55668205", "0.55636394", "0.556332", "0.55632925", "0.55608964", "0.5558555", "0.5556648", "0.5554038", "0.55463535", "0.5545302", "0.5544668", "0.554362", "0.55383873", "0.55279607", "0.55279106", "0.55271804", "0.55236477", "0.55210865" ]
0.83944076
1
Create a new index.
func (d *Driver) Create( db, table, id string, expressions []sql.Expression, config map[string]string, ) (sql.Index, error) { _, err := mkdir(d.root, db, table, id) if err != nil { return nil, err } if config == nil { config = make(map[string]string) } exprs := make([]string, len(expressions)) for i, e := range expressions { exprs[i] = e.String() } cfg := index.NewConfig(db, table, id, exprs, d.ID(), config) err = index.WriteConfigFile(d.configFilePath(db, table, id), cfg) if err != nil { return nil, err } idx, err := d.newPilosaIndex(db, table) if err != nil { return nil, err } mapping := newMapping(d.mappingFilePath(db, table, id)) processingFile := d.processingFilePath(db, table, id) if err := index.WriteProcessingFile( processingFile, []byte{processingFileOnCreate}, ); err != nil { return nil, err } return newPilosaIndex(idx, mapping, cfg), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CreateIndex(context *web.AppContext) *web.AppError {\n\n\tdb := context.MDB\n\tvar input model.Index\n\tjson.NewDecoder(context.Body).Decode(&input)\n\n\terr := db.Session.DB(\"\").C(input.Target).EnsureIndex(input.Index)\n\tif err != nil {\n\t\tmessage := fmt.Sprintf(\"Error creating index [%+v]\", input)\n\t\treturn &web.AppError{err, message, http.StatusInternalServerError}\n\t}\n\n\treturn nil\n}", "func CreateNewIndex(url string, alias string) (string, error) {\n\t// create our day-specific name\n\tphysicalIndex := fmt.Sprintf(\"%s_%s\", alias, time.Now().Format(\"2006_01_02\"))\n\tidx := 0\n\n\t// check if it exists\n\tfor true {\n\t\tresp, err := http.Get(fmt.Sprintf(\"%s/%s\", url, physicalIndex))\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\t// not found, great, move on\n\t\tif resp.StatusCode == http.StatusNotFound {\n\t\t\tbreak\n\t\t}\n\n\t\t// was found, increase our index and try again\n\t\tidx++\n\t\tphysicalIndex = fmt.Sprintf(\"%s_%s_%d\", alias, time.Now().Format(\"2006_01_02\"), idx)\n\t}\n\n\t// initialize our index\n\tcreateURL := fmt.Sprintf(\"%s/%s\", url, physicalIndex)\n\t_, err := MakeJSONRequest(http.MethodPut, createURL, indexSettings, nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// all went well, return our physical index name\n\tlog.WithField(\"index\", physicalIndex).Info(\"created index\")\n\treturn physicalIndex, nil\n}", "func (es *Repository) NewIndex(ctx context.Context, index string) (error){\n\tsvc := es.client.CreateIndex(\"ethan\")\n\n\t_, err := svc.Do(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func CreateIndex(excludedPaths []string) (Index, error) {\n\tglog.V(1).Infof(\"CreateIndex(%v)\", excludedPaths)\n\n\tmapping := bleve.NewIndexMapping()\n\tif len(excludedPaths) > 0 {\n\t\tcustomMapping := bleve.NewDocumentMapping()\n\t\tfor _, path := range excludedPaths {\n\t\t\tpaths := strings.Split(path, \".\")\n\t\t\tpathToMapping(paths, customMapping)\n\t\t}\n\t\tmapping.DefaultMapping = customMapping\n\t}\n\tindex, err := bleve.NewMemOnly(mapping)\n\n\tif err != nil {\n\t\tglog.Error(err)\n\t\treturn nil, err\n\t}\n\n\tbatch := index.NewBatch()\n\n\treturn &bleveIndex{\n\t\tindex: index,\n\t\taddInc: 0,\n\t\tbatch: batch,\n\t}, nil\n}", "func NewIndex(addr, name, typ string, md *index.Metadata) (*Index, error) {\n\n\tfmt.Println(\"Get a new index: \", addr, name)\n client := &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\t//MaxIdleConnsPerHost: 200,\n\t\t\tMaxIdleConnsPerHost: 2000000,\n\t\t},\n\t\tTimeout: 2500000 * time.Millisecond,\n\t}\n\tconn, err := elastic.NewClient(elastic.SetURL(addr), elastic.SetHttpClient(client))\n\tif err != nil {\n fmt.Println(\"Get error here\");\n\t\treturn nil, err\n\t}\n\tret := &Index{\n\t\tconn: conn,\n\t\tmd: md,\n\t\tname: name,\n\t\ttyp: typ,\n\t}\n fmt.Println(\"get here ======\");\n\n\treturn ret, nil\n\n}", "func (db *Database) CreateIndex(label, property string) (*Index, error) {\n\turi := join(db.Url, \"schema/index\", label)\n\tpayload := indexRequest{[]string{property}}\n\tresult := Index{db: db}\n\tne := NeoError{}\n\tresp, err := db.Session.Post(uri, payload, &result, &ne)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tswitch resp.Status() {\n\tcase 200:\n\t\treturn &result, nil // Success\n\tcase 405:\n\t\treturn nil, NotAllowed\n\t}\n\treturn nil, ne\n}", "func CreateIndex(i string) {\n\tcreateIndex, err := client.CreateIndex(indexName).\n\t\tBody(indexMapping).\n\t\tDo(context.Background())\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tif !createIndex.Acknowledged {\n\t\tlog.Println(\"CreateIndex was not acknowledged. Check that timeout value is correct.\")\n\t}\n}", "func (cc *TicketsChaincode) createIndex(stub shim.ChaincodeStubInterface, indexName string, attributes []string) error {\n\tfmt.Println(\"- start create index\")\n\tvar err error\n\n\tindexKey, err := stub.CreateCompositeKey(indexName, attributes)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvalue := []byte{0x00}\n\tstub.PutState(indexKey, value)\n\n\tfmt.Println(\"created index\")\n\treturn nil\n}", "func NewIndex(addrs []string, pass string, temporary int, name string, md *index.Metadata) *Index {\n\n\tret := &Index{\n\n\t\thosts: addrs,\n\n\t\tmd: md,\n\t\tpassword: pass,\n\t\ttemporary: temporary,\n\n\t\tname: name,\n\n\t\tcommandPrefix: \"FT\",\n\t}\n\tif md != nil && md.Options != nil {\n\t\tif opts, ok := md.Options.(IndexingOptions); ok {\n\t\t\tif opts.Prefix != \"\" {\n\t\t\t\tret.commandPrefix = md.Options.(IndexingOptions).Prefix\n\t\t\t}\n\t\t}\n\t}\n\t//ret.pool.MaxActive = ret.pool.MaxIdle\n\n\treturn ret\n\n}", "func (ac *AdminClient) CreateIndex(ctx context.Context, db, table string, indexMeta *tspb.IndexMeta) error {\n\tin := &tspb.CreateIndexRequest{\n\t\tDatabase: db,\n\t\tTable: table,\n\t\tIndexes: indexMeta,\n\t}\n\treturn retry.Invoke(ctx, func(ctx context.Context, settings retry.CallSettings) error {\n\t\t_, err := ac.pbCli.CreateIndex(ctx, in)\n\t\treturn err\n\t})\n}", "func (ec *ElasticClient) Create(indexname string, indextype string, jsondata interface{}) (string, error) {\n\tctx := ec.ctx\n\tid := genHashedID(jsondata)\n\n\tdebuges(\"Debug:Printing body %s\\n\", jsondata)\n\tresult, err := ec.client.Index().\n\t\tIndex(string(indexname)).\n\t\tType(string(indextype)).\n\t\tId(id).\n\t\tBodyJson(jsondata).\n\t\tDo(ctx)\n\tif err != nil {\n\t\t// Handle error\n\t\tdebuges(\"Create document Error %#v\", err)\n\t\treturn id, err\n\t}\n\tdebuges(\"Debug:Indexed %s to index %s, type %s\\n\", result.Id, result.Index, result.Type)\n\t// Flush to make sure the documents got written.\n\t// Flush asks Elasticsearch to free memory from the index and\n\t// flush data to disk.\n\t_, err = ec.client.Flush().Index(string(indexname)).Do(ctx)\n\treturn id, err\n\n}", "func (es *Connection) CreateIndex(index string, body interface{}) (int, *QueryResult, error) {\n\treturn withQueryResult(es.apiCall(\"PUT\", index, \"\", \"\", \"\", nil, body))\n}", "func (c *Client) CreateIndex(name string, mapping interface{}) (*Response, error) {\n\tr := Request{\n\t\tQuery: mapping,\n\t\tIndexList: []string{name},\n\t\tMethod: \"PUT\",\n\t}\n\n\treturn c.Do(&r)\n}", "func (c *esClientV7) createIndex(args ElasticsearchArgs) error {\n\tres, err := c.Indices.ResolveIndex([]string{args.Index})\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\n\tvar v map[string]interface{}\n\tfound := false\n\tif err := json.NewDecoder(res.Body).Decode(&v); err != nil {\n\t\treturn fmt.Errorf(\"Error parsing response body: %v\", err)\n\t}\n\n\tindices := v[\"indices\"].([]interface{})\n\tfor _, index := range indices {\n\t\tname := index.(map[string]interface{})[\"name\"]\n\t\tif name == args.Index {\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif !found {\n\t\tresp, err := c.Indices.Create(args.Index)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\tif resp.IsError() {\n\t\t\terr := fmt.Errorf(\"Create index err: %s\", res.String())\n\t\t\treturn err\n\t\t}\n\t\tio.Copy(ioutil.Discard, resp.Body)\n\t\treturn nil\n\t}\n\treturn nil\n}", "func (api *ElasticAPI) CreateSearchIndex(ctx context.Context, instanceID, dimension string) (int, error) {\n\t*api.NumberOfCalls++\n\n\tif api.InternalServerError {\n\t\treturn 0, errorInternalServer\n\t}\n\n\treturn 201, nil\n}", "func CreateNewIndex(rawItems PointArray, dim, nTree, k int, m Metric) (Index, error) {\n\t// verify that given items have same dimension\n\tl := rawItems.Len()\n\tif l < 2 {\n\t\treturn nil, errNotEnoughItems\n\t}\n\tits := make([]*item, l)\n\t//idToItem := make(map[itemId]*item, l)\n\tfor i:=0; i < l; i++{\n\t\tv := rawItems.At(i)\n\t\tif v.Dimension() != dim {\n\t\t\treturn nil, errDimensionMismatch\n\t\t}\n\t\tit := &item{\n\t\t\tid: itemId(i),\n\t\t\tvector: v,\n\t\t}\n\t\tits[i] = it\n\t\t//idToItem[it.id] = it\n\t}\n\tidx := &index{\n\t\tmetric: m,\n\t\tdim: dim,\n\t\tk: k,\n\t\titemIDToItem: rawItems,\n\t\troots: make([]*node, nTree),\n\t\tnodeIDToNode: map[nodeId]*node{},\n\t\tmux: &sync.Mutex{},\n\t}\n\n\t// build\n\tidx.build(its, nTree)\n\treturn idx, nil\n}", "func New() *Index {\n\treturn &Index{Version: Version}\n}", "func CreateIndexIfNotExists(e *elastic.Client, index string) error {\n\t// Use the IndexExists service to check if a specified index exists.\n\texists, err := e.IndexExists(index).Do(context.Background())\n\tif err != nil {\n\t\tlog.Printf(\"elastic: unable to check if Index exists - %s\\n\", err)\n\t\treturn err\n\t}\n\n\tif exists {\n\t\treturn nil\n\t}\n\n\t// Create a new index.\n\tv := reflect.TypeOf(Point{})\n\n\tmapping := MapStr{\n\t\t\"settings\": MapStr{\n\t\t\t\"number_of_shards\": 1,\n\t\t\t\"number_of_replicas\": 1,\n\t\t},\n\t\t\"mappings\": MapStr{\n\t\t\t\"doc\": MapStr{\n\t\t\t\t\"properties\": MapStr{},\n\t\t\t},\n\t\t},\n\t}\n\tfor i := 0; i < v.NumField(); i++ {\n\t\tfield := v.Field(i)\n\t\ttag := field.Tag.Get(\"elastic\")\n\t\tif len(tag) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\ttagfields := strings.Split(tag, \",\")\n\t\tmapping[\"mappings\"].(MapStr)[\"doc\"].(MapStr)[\"properties\"].(MapStr)[field.Name] = MapStr{}\n\t\tfor _, tagfield := range tagfields {\n\t\t\ttagfieldValues := strings.Split(tagfield, \":\")\n\t\t\tmapping[\"mappings\"].(MapStr)[\"doc\"].(MapStr)[\"properties\"].(MapStr)[field.Name].(MapStr)[tagfieldValues[0]] = tagfieldValues[1]\n\t\t}\n\t}\n\tmappingJSON, err := json.Marshal(mapping)\n\tif err != nil {\n\t\tlog.Printf(\"elastic: error on json marshal - %s\\n\", err)\n\t\treturn err\n\t}\n\n\t_, err = e.CreateIndex(index).BodyString(string(mappingJSON)).Do(context.Background())\n\tif err != nil {\n\t\tlog.Printf(\"elastic: error creating elastic index %s - %s\\n\", index, err)\n\t\treturn err\n\t}\n\tlog.Printf(\"elastic: index %s created\\n\", index)\n\treturn nil\n}", "func (idx *ExistsAddrIndex) Create(dbTx database.Tx) error {\n\t_, err := dbTx.Metadata().CreateBucket(existsAddrIndexKey)\n\treturn err\n}", "func NewIndex(path, name string) (*Index, error) {\n\terr := validateName(name)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"validating name\")\n\t}\n\n\treturn &Index{\n\t\tpath: path,\n\t\tname: name,\n\t\tfields: make(map[string]*Field),\n\n\t\tnewAttrStore: newNopAttrStore,\n\t\tcolumnAttrs: nopStore,\n\n\t\tbroadcaster: NopBroadcaster,\n\t\tStats: stats.NopStatsClient,\n\t\tlogger: logger.NopLogger,\n\t\ttrackExistence: true,\n\t}, nil\n}", "func NewIndex(physicalID int64, tblInfo *model.TableInfo, indexInfo *model.IndexInfo) table.Index {\n\tindex := &index{\n\t\tidxInfo: indexInfo,\n\t\ttblInfo: tblInfo,\n\t\t// The prefix can't encode from tblInfo.ID, because table partition may change the id to partition id.\n\t\tprefix: tablecodec.EncodeTableIndexPrefix(physicalID, indexInfo.ID),\n\t}\n\treturn index\n}", "func (c *esClientV56) createIndex(args ElasticsearchArgs) error {\n\texists, err := c.IndexExists(args.Index).Do(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !exists {\n\t\tvar createIndex *elastic.IndicesCreateResult\n\t\tif createIndex, err = c.CreateIndex(args.Index).Do(context.Background()); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif !createIndex.Acknowledged {\n\t\t\treturn fmt.Errorf(\"index %v not created\", args.Index)\n\t\t}\n\t}\n\treturn nil\n}", "func New(indexRegistry *registry.IndexRegistry, options ...func(*Index)) (I *Index, err error) {\n\tI = &Index{\n\t\tindexRegistry: indexRegistry,\n\t}\n\n\tfor _, option := range options {\n\t\toption(I)\n\t}\n\n\treturn\n}", "func NewIndex() Index {\n\tnewIndex := Index{}\n\tnewIndex.Setup()\n\treturn newIndex\n}", "func MakeIndex() error {\n\n\treturn nil\n}", "func NewIndex(kind IndexKind, table string) Index {\n\treturn &index{\n\t\tkind: kind,\n\t\ttable: table,\n\t}\n}", "func (i *Index) Create() error {\n\n\targs := redis.Args{i.name}\n\tif i.temporary != -1{\n\t\tt := strconv.Itoa(i.temporary)\n\t\targs = append(args, \"TEMPORARY\", t)\n\t}\n\targs = append(args, \"SCHEMA\")\n\n\tfor _, f := range i.md.Fields {\n\n\t\tswitch f.Type {\n\t\tcase index.TextField:\n\n\t\t\topts, ok := f.Options.(index.TextFieldOptions)\n\t\t\tif !ok {\n\t\t\t\treturn errors.New(\"Invalid text field options type\")\n\t\t\t}\n\t\t\targs = append(args, f.Name, \"TEXT\", \"WEIGHT\", opts.Weight)\n\t\t\tif opts.Sortable {\n\t\t\t\targs = append(args, \"SORTABLE\")\n\t\t\t}\n\n\t\t\t// stemming per field not supported yet\n\n\t\tcase index.NumericField:\n\t\t\targs = append(args, f.Name, \"NUMERIC\")\n\n\t\tcase index.NoIndexField:\n\t\t\tcontinue\n\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"Unsupported field type %v\", f.Type)\n\t\t}\n\n\t}\n\n\tconn := i.getConn()\n\tdefer conn.Close()\n\t_, err := conn.Do(i.commandPrefix+\".CREATE\", args...)\n\treturn err\n}", "func (d *Driver) Create(db, table, id string, expressions []sql.Expression, config map[string]string) (sql.Index, error) {\n\t_, err := mkdir(d.root, db, table, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\texprs := make([]string, len(expressions))\n\tfor i, e := range expressions {\n\t\texprs[i] = e.String()\n\t}\n\n\tcfg := index.NewConfig(db, table, id, exprs, d.ID(), config)\n\terr = index.WriteConfigFile(d.configFilePath(db, table, id), cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newPilosaIndex(d.mappingFilePath(db, table, id), d.client, cfg), nil\n}", "func (c *Client) createIndex(mapping string) error {\n\tinfo, err := c.Client.NodesInfo().Do(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcreateIndexService := c.Client.CreateIndex(c.IndexName).BodyString(mapping)\n\n\tfor _, node := range info.Nodes {\n\t\t// Grab the first character of the version string and turn it into an int\n\t\tversion, _ := strconv.Atoi(string(node.Version[0]))\n\t\tif version == 7 {\n\t\t\t// include_type_name defaults to false in ES7. This will ensure ES7\n\t\t\t// behaves like ES6 when creating mappings. See\n\t\t\t// https://www.elastic.co/blog/moving-from-types-to-typeless-apis-in-elasticsearch-7-0\n\t\t\t// for more information. We also can't set this for any versions before\n\t\t\t// 6.8 as this parameter was not supported. Since it defaults to true in\n\t\t\t// all 6.x it's safe to only set it for 7.x.\n\t\t\tcreateIndexService = createIndexService.IncludeTypeName(true)\n\t\t}\n\n\t\t// We only look at the first node and assume they're all the same version\n\t\tbreak\n\t}\n\n\tcreateIndex, err := createIndexService.Do(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !createIndex.Acknowledged {\n\t\treturn timeoutError\n\t}\n\n\treturn nil\n}", "func CreateIndex(fromKind string, fromKindFieldName string, toKind string,\n\textractor ForeignKeyExtractor) {\n\n\ti := Indexes[fromKind]\n\tif i == nil {\n\t\ti = make(map[string]string)\n\t\tIndexes[fromKind] = i\n\t}\n\ti[fromKindFieldName] = toKind\n\n\tfkv := ForeignKeyExtractors[fromKind]\n\tif fkv == nil {\n\t\tfkv = make(map[string]ForeignKeyExtractor)\n\t\tForeignKeyExtractors[fromKind] = fkv\n\t}\n\tfkv[fromKindFieldName] = extractor\n}", "func NewIndex(name string, columns []string, indexType IndexType) Index {\n\treturn Index{\n\t\tName: name,\n\t\tColumns: columns,\n\t\tType: indexType,\n\t}\n}", "func (c *index) Create(sctx sessionctx.Context, rm kv.RetrieverMutator, indexedValues []types.Datum, h int64, opts ...table.CreateIdxOptFunc) (int64, error) {\n\tvar opt table.CreateIdxOpt\n\tfor _, fn := range opts {\n\t\tfn(&opt)\n\t}\n\tss := opt.AssertionProto\n\twriteBufs := sctx.GetSessionVars().GetWriteStmtBufs()\n\tskipCheck := sctx.GetSessionVars().LightningMode || sctx.GetSessionVars().StmtCtx.BatchCheck\n\tkey, distinct, err := c.GenIndexKey(sctx.GetSessionVars().StmtCtx, indexedValues, h, writeBufs.IndexKeyBuf)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tctx := opt.Ctx\n\tif opt.Untouched {\n\t\ttxn, err1 := sctx.Txn(true)\n\t\tif err1 != nil {\n\t\t\treturn 0, err1\n\t\t}\n\t\t// If the index kv was untouched(unchanged), and the key/value already exists in mem-buffer,\n\t\t// should not overwrite the key with un-commit flag.\n\t\t// So if the key exists, just do nothing and return.\n\t\t_, err = txn.GetMemBuffer().Get(ctx, key)\n\t\tif err == nil {\n\t\t\treturn 0, nil\n\t\t}\n\t}\n\n\t// save the key buffer to reuse.\n\twriteBufs.IndexKeyBuf = key\n\tif !distinct {\n\t\t// non-unique index doesn't need store value, write a '0' to reduce space\n\t\tvalue := []byte{'0'}\n\t\tif opt.Untouched {\n\t\t\tvalue[0] = kv.UnCommitIndexKVFlag\n\t\t}\n\t\terr = rm.Set(key, value)\n\t\tif ss != nil {\n\t\t\tss.SetAssertion(key, kv.None)\n\t\t}\n\t\treturn 0, err\n\t}\n\n\tif skipCheck {\n\t\tvalue := EncodeHandle(h)\n\t\tif opt.Untouched {\n\t\t\tvalue = append(value, kv.UnCommitIndexKVFlag)\n\t\t}\n\t\terr = rm.Set(key, value)\n\t\tif ss != nil {\n\t\t\tss.SetAssertion(key, kv.None)\n\t\t}\n\t\treturn 0, err\n\t}\n\n\tif ctx != nil {\n\t\tif span := opentracing.SpanFromContext(ctx); span != nil && span.Tracer() != nil {\n\t\t\tspan1 := span.Tracer().StartSpan(\"index.Create\", opentracing.ChildOf(span.Context()))\n\t\t\tdefer span1.Finish()\n\t\t\tctx = opentracing.ContextWithSpan(ctx, span1)\n\t\t}\n\t} else {\n\t\tctx = context.TODO()\n\t}\n\n\tvar value []byte\n\tvalue, err = rm.Get(ctx, key)\n\t// If (opt.Untouched && err == nil) is true, means the key is exists and exists in TiKV, not in txn mem-buffer,\n\t// then should also write the untouched index key/value to mem-buffer to make sure the data\n\t// is consistent with the index in txn mem-buffer.\n\tif kv.IsErrNotFound(err) || (opt.Untouched && err == nil) {\n\t\tv := EncodeHandle(h)\n\t\tif opt.Untouched {\n\t\t\tv = append(v, kv.UnCommitIndexKVFlag)\n\t\t}\n\t\terr = rm.Set(key, v)\n\t\tif ss != nil {\n\t\t\tss.SetAssertion(key, kv.NotExist)\n\t\t}\n\t\treturn 0, err\n\t}\n\n\thandle, err := DecodeHandle(value)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn handle, kv.ErrKeyExists\n}", "func CreateIndexer(root string, nbuckets, seqLen int) (*Indexer, error) {\n\tcfg, err := NewConfig(root, nbuckets, seqLen)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn IndexerFromConfig(cfg)\n}", "func CreateIndex(collectionName, indexName string, indexType IndexType, fd *feed.API, user utils.Address, client blockstore.Client, mutable bool) error {\n\tif fd.IsReadOnlyFeed() {\n\t\treturn ErrReadOnlyIndex\n\t}\n\tactualIndexName := collectionName + indexName\n\ttopic := utils.HashString(actualIndexName)\n\t_, oldData, err := fd.GetFeedData(topic, user)\n\tif err == nil && len(oldData) != 0 {\n\t\t// if the feed is present and it has some data means there index is still valid\n\t\treturn ErrIndexAlreadyPresent\n\t}\n\n\tmanifest := NewManifest(actualIndexName, time.Now().Unix(), indexType, mutable)\n\n\t// marshall and store the Manifest as new feed\n\tdata, err := json.Marshal(manifest)\n\tif err != nil {\n\t\treturn ErrManifestUnmarshall\n\t}\n\n\tref, err := client.UploadBlob(data, true, true)\n\tif err != nil {\n\t\treturn ErrManifestUnmarshall\n\t}\n\n\t_, err = fd.CreateFeed(topic, user, ref)\n\tif err != nil {\n\t\treturn ErrManifestCreate\n\t}\n\treturn nil\n}", "func (i *Index) Create() error {\n\n\tdoc := mapping{Properties: map[string]mappingProperty{}}\n\tfor _, f := range i.md.Fields {\n\t\tdoc.Properties[f.Name] = mappingProperty{}\n\t\tfs, err := fieldTypeString(f.Type)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdoc.Properties[f.Name][\"type\"] = fs\n\t}\n\n // Added for apple to apple benchmark\n doc.Properties[\"body\"][\"type\"] = \"text\"\n doc.Properties[\"body\"][\"analyzer\"] = \"my_english_analyzer\"\n doc.Properties[\"body\"][\"search_analyzer\"] = \"whitespace\"\n doc.Properties[\"body\"][\"index_options\"] = \"offsets\"\n //doc.Properties[\"body\"][\"test\"] = \"test\"\n index_map := map[string]int{\n \"number_of_shards\" : 1,\n \"number_of_replicas\" : 0,\n }\n analyzer_map := map[string]interface{}{\n \"my_english_analyzer\": map[string]interface{}{\n \"tokenizer\": \"standard\",\n \"char_filter\": []string{ \"html_strip\" } ,\n \"filter\" : []string{\"english_possessive_stemmer\", \n \"lowercase\", \"english_stop\", \n \"english_stemmer\", \n \"asciifolding\", \"icu_folding\"},\n },\n }\n filter_map := map[string]interface{}{\n \"english_stop\": map[string]interface{}{\n \"type\": \"stop\",\n \"stopwords\": \"_english_\",\n },\n \"english_possessive_stemmer\": map[string]interface{}{\n \"type\": \"stemmer\",\n \"language\": \"possessive_english\",\n },\n \"english_stemmer\" : map[string]interface{}{\n \"type\" : \"stemmer\",\n \"name\" : \"english\",\n },\n \"my_folding\": map[string]interface{}{\n \"type\": \"asciifolding\",\n \"preserve_original\": \"false\",\n },\n }\n analysis_map := map[string]interface{}{\n \"analyzer\": analyzer_map,\n \"filter\" : filter_map,\n }\n settings := map[string]interface{}{\n \"index\": index_map,\n \"analysis\": analysis_map,\n }\n\n // TODO delete?\n\t// we currently manually create the autocomplete mapping\n\t/*ac := mapping{\n\t\tProperties: map[string]mappingProperty{\n\t\t\t\"sugg\": mappingProperty{\n\t\t\t\t\"type\": \"completion\",\n\t\t\t\t\"payloads\": true,\n\t\t\t},\n\t\t},\n\t}*/\n\n\tmappings := map[string]mapping{\n\t\ti.typ: doc,\n //\t\"autocomplete\": ac,\n\t}\n\n fmt.Println(mappings)\n\n\t//_, err := i.conn.CreateIndex(i.name).BodyJson(map[string]interface{}{\"mappings\": mappings}).Do()\n\t_, err := i.conn.CreateIndex(i.name).BodyJson(map[string]interface{}{\"mappings\": mappings, \"settings\": settings}).Do()\n\n if err != nil {\n fmt.Println(\"Error \", err)\n\t\tfmt.Println(\"!!!!Get Error when using client to create index\")\n\t}\n\n\treturn err\n}", "func NewIndex() *Index {\n\treturn &Index{root: &node{}}\n}", "func (st *Store) CreateIndex(index string) error {\n\tif index == \"\" {\n\t\treturn errNoIndexName\n\t}\n\t_, ok := st.indexes[index]\n\tif ok {\n\t\treturn fmt.Errorf(\"index with name %s already exist\", index)\n\t}\n\treturn nil\n}", "func (_e *MockDataCoord_Expecter) CreateIndex(ctx interface{}, req interface{}) *MockDataCoord_CreateIndex_Call {\n\treturn &MockDataCoord_CreateIndex_Call{Call: _e.mock.On(\"CreateIndex\", ctx, req)}\n}", "func (msg MsgCreateIndex) Type() string { return \"create_index\" }", "func NewIndex(texts []string, name string) *Index {\n\treturn &Index{texts: texts, name: name}\n}", "func newDocumentIndex(opts *iface.CreateDocumentDBOptions) iface.StoreIndex {\n\treturn &documentIndex{\n\t\tindex: map[string][]byte{},\n\t\topts: opts,\n\t}\n}", "func (r *Results) CreateIndex(mapping string) error {\n\tres, err := r.es.Indices.Create(r.indexName, r.es.Indices.Create.WithBody(strings.NewReader((mapping))))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif res.IsError() {\n\t\treturn fmt.Errorf(\"error: %s\", res)\n\t}\n\n\treturn nil\n}", "func (dbclient *CouchDatabase) CreateNewIndexWithRetry(indexdefinition string, designDoc string) error {\n\t//get the number of retries\n\tmaxRetries := dbclient.CouchInstance.Conf.MaxRetries\n\n\t_, err := retry.Invoke(\n\t\tfunc() (interface{}, error) {\n\t\t\texists, err := dbclient.IndexDesignDocExists(designDoc)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif exists {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\n\t\t\treturn dbclient.CreateIndex(indexdefinition)\n\t\t},\n\t\tretry.WithMaxAttempts(maxRetries),\n\t)\n\treturn err\n}", "func New(ds datastore.TxnDatastore, api *apistruct.FullNodeStruct) (*Index, error) {\n\tcs := chainsync.New(api)\n\tstore, err := chainstore.New(txndstr.Wrap(ds, \"chainstore\"), cs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinitMetrics()\n\tctx, cancel := context.WithCancel(context.Background())\n\ts := &Index{\n\t\tapi: api,\n\t\tstore: store,\n\t\tsignaler: signaler.New(),\n\t\tindex: IndexSnapshot{\n\t\t\tMiners: make(map[string]Slashes),\n\t\t},\n\t\tctx: ctx,\n\t\tcancel: cancel,\n\t\tfinished: make(chan struct{}),\n\t}\n\tif err := s.loadFromDS(); err != nil {\n\t\treturn nil, err\n\t}\n\tgo s.start()\n\treturn s, nil\n}", "func CreateBleveIndex(indexPath string, forceCreate, allowAppend bool) (bleve.Index, error) {\n\t// Create a new index.\n\tmapping := bleve.NewIndexMapping()\n\tindex, err := bleve.New(indexPath, mapping)\n\tif err == bleve.ErrorIndexPathExists {\n\t\tcommon.Log.Error(\"Bleve index %q exists.\", indexPath)\n\t\tif forceCreate {\n\t\t\tcommon.Log.Info(\"Removing %q.\", indexPath)\n\t\t\tremoveIndex(indexPath)\n\t\t\tindex, err = bleve.New(indexPath, mapping)\n\t\t} else if allowAppend {\n\t\t\tcommon.Log.Info(\"Opening existing %q.\", indexPath)\n\t\t\tindex, err = bleve.Open(indexPath)\n\t\t}\n\t}\n\treturn index, err\n}", "func (s *BasePlSqlParserListener) EnterCreate_index(ctx *Create_indexContext) {}", "func NewIndex(f *os.File, c Config) (*Index, error) {\n\tidx := &Index{\n\t\tfile: f,\n\t}\n\n\tfi, err := os.Stat(f.Name())\n\tif err != nil {\n\t\treturn nil, lib.Wrap(err, \"Unable to get file stats\")\n\t}\n\n\tidx.size = uint64(fi.Size())\n\tif err = os.Truncate(\n\t\tf.Name(), int64(c.Segment.MaxIndexBytes),\n\t); err != nil {\n\t\treturn nil, lib.Wrap(err, \"Unable to truncate file\")\n\t}\n\n\tif idx.mmap, err = gommap.Map(\n\t\tidx.file.Fd(),\n\t\tgommap.PROT_READ|gommap.PROT_WRITE,\n\t\tgommap.MAP_SHARED,\n\t); err != nil {\n\t\treturn nil, lib.Wrap(err, \"Unable to create gommap map\")\n\t}\n\n\treturn idx, nil\n}", "func New(data []byte) *Index", "func New(data []byte) *Index {}", "func Create(r *Repo) error {\n\tlog := logger()\n\tlog.Debugf(\"create a repository with index file at %s\", r.indexFileURL)\n\n\to, err := gcs.Object(r.gcs, r.indexFileURL)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"object\")\n\t}\n\n\t_, err = o.NewReader(context.Background())\n\tif err == storage.ErrObjectNotExist {\n\t\ti := repo.NewIndexFile()\n\t\treturn r.uploadIndexFile(i)\n\t} else if err == nil {\n\t\tlog.Debugf(\"file %s already exists\", r.indexFileURL)\n\t\treturn nil\n\t}\n\treturn err\n}", "func NewIndex(unique bool, columns []Column) *Index {\n\treturn &Index{\n\t\tbtree: btree.NewBTreeG[Doc](func(a, b Doc) bool {\n\t\t\treturn Order(a, b, columns, !unique) < 0\n\t\t}),\n\t}\n}", "func (s *Store) CreateUserIndex(token string) error {\n\n\tj := indexSettingsAndMapping()\n\n\tif _, err := s.ES.CreateIndex(token).BodyJson(j).Do(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func NewIndex(storage storages.Storage) Index {\n\treturn &multiIndex{index: storage}\n}", "func (elasticCluster *ElasticCluster) createType() error {\n\n\tmappingPath, err := path.GetPath(elasticCluster.MappingPath)\n\tif err != nil {\n\t\tlog.Logger.WithFields(logrus.Fields{\n\t\t\tIndex: elasticCluster.Index,\n\t\t}).Error(\"get mapping path error\")\n\t\treturn err\n\t}\n\t//加载mapping file\n\tvar mapping map[string]interface{}\n\tif err := jsonUtil.Unmarshal(&mapping, mappingPath); err != nil {\n\t\tlog.Logger.WithFields(logrus.Fields{\n\t\t\tIndex: elasticCluster.Index,\n\t\t}).Error(\"unmarshal mapping file error\")\n\t\treturn err\n\t}\n\n\t//client赋值\n\tclient := elasticCluster.Client\n\n\t//检测index是否存在\n\tindexExist, err := client.IndexExists().Index([]string{elasticCluster.Index}).Do(context.Background())\n\tif err != nil {\n\t\tlog.Logger.WithFields(logrus.Fields{\n\t\t\tIndex: elasticCluster.Index,\n\t\t}).Error(\"check index exist error\")\n\t\treturn err\n\t}\n\n\tif !indexExist {\n\t\t//index不存在创建index\n\t\tlog.Logger.WithFields(logrus.Fields{\n\t\t\tIndex: elasticCluster.Index,\n\t\t}).Warn(\"index not exist,create...\")\n\t\tresult, err := client.CreateIndex(elasticCluster.Index).Do(context.Background())\n\t\tif err != nil {\n\t\t\tlog.Logger.WithFields(logrus.Fields{\n\t\t\t\tIndex: elasticCluster.Index,\n\t\t\t}).Error(\"create index error\")\n\t\t\treturn err\n\t\t}\n\t\tif result.Acknowledged && result.ShardsAcknowledged {\n\t\t\tlog.Logger.WithFields(logrus.Fields{\n\t\t\t\tIndex: elasticCluster.Index,\n\t\t\t}).Info(\"create index success\")\n\t\t} else {\n\t\t\tlog.Logger.WithFields(logrus.Fields{\n\t\t\t\tIndex: elasticCluster.Index,\n\t\t\t}).Error(\"create index error\")\n\t\t\treturn errors.New(\"Acknowledged or ShardsAcknowledged is false when create index\")\n\t\t}\n\t} else {\n\t\t//index存在,打印日志\n\t\tlog.Logger.WithFields(logrus.Fields{\n\t\t\tIndex: elasticCluster.Index,\n\t\t}).Info(\"index already exist\")\n\t}\n\t//创建type\n\tresult, err := client.PutMapping().Index(elasticCluster.Index).Type(elasticCluster.TypeAlias).\n\t\tBodyJson(mapping).Do(context.Background())\n\tif err != nil {\n\t\tlog.Logger.WithFields(logrus.Fields{\n\t\t\tIndex: elasticCluster.Index,\n\t\t}).Error(\"put mapping error\")\n\t\treturn err\n\t}\n\tif result.Acknowledged {\n\t\tlog.Logger.WithFields(logrus.Fields{\n\t\t\tIndex: elasticCluster.Index,\n\t\t}).Info(\"put mapping success\")\n\t} else {\n\t\tlog.Logger.WithFields(logrus.Fields{\n\t\t\tIndex: elasticCluster.Index,\n\t\t}).Error(\"put mapping error\")\n\t\treturn errors.New(\"Acknowledged is false when put mapping\")\n\t}\n\n\treturn nil\n}", "func (b *mysql) Index(table *Table, index *Index) string {\n\tlog.Printf(\"create index:%+v\", index)\n\tvar obj = \"INDEX\"\n\tif index.Unique {\n\t\tobj = \"UNIQUE INDEX\"\n\t}\n\treturn fmt.Sprintf(\"CREATE %s %s ON %s (%s);\", obj, index.Name, table.Name, b.columns(nil, index.Fields, true, false, false))\n}", "func (m *MongoDB) CreateIndex(name, key string, order int) (string, error) {\n\tcoll, ok := m.coll[name]\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"not defined collection %s\", name)\n\t}\n\n\tasscending := 1\n\tif order == -1 {\n\t\tasscending = -1\n\t}\n\n\tmodel := mongo.IndexModel{\n\t\tKeys: bson.D{{Key: key, Value: asscending}},\n\t\t//Options: options.Index().SetBackground(true),\n\t}\n\n\topts := options.CreateIndexes().SetMaxTime(2 * time.Second)\n\n\treturn coll.Indexes().CreateOne(m.ctx, model, opts)\n}", "func (c ClientWrapper) CreateIndex(index string) es.IndicesCreateService {\n\treturn WrapESIndicesCreateService(c.client.CreateIndex(index))\n}", "func New(path string) (*Index, error) {\n\tkvdb, err := pudge.Open(path, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Index{\n\t\tdb: kvdb,\n\t\tpath: path,\n\t}, nil\n}", "func NewLogIndex() indices.Index { return &logIndex{} }", "func newIndex(name string) (index *ind) {\n\tindex = new(ind)\n\tindex.name = name\n\tindex.Storage = map[string][]string{}\n\tindex.Domains = map[string]bool{}\n\treturn\n}", "func NewIndexed() *Indexed {\n\trand.Seed(time.Now().UTC().UnixNano())\n\treturn &Indexed{\n\t\tsize: 0,\n\t}\n}", "func newQueueIndex(dataDir string) (*queueIndex, error) {\n\tindexFile := path.Join(dataDir, cIndexFileName)\n\tindexArena, err := newArena(indexFile, cIndexFileSize)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &queueIndex{\n\t\tindexFile: indexFile,\n\t\tindexArena: indexArena,\n\t}, nil\n}", "func (s *searcher) CreateIndex() error {\n\tcolor.Cyan(\"[start] initialize index.\")\n\t// get user\n\tuser, reload, err := s.getUser()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"[err] createIndex %w\", err)\n\t}\n\n\t// check to whether exist starred items or not.\n\tvar isNewIndex bool\n\tif err := s.db.Update(func(tx *bolt.Tx) error {\n\t\tvar err error\n\t\tbucket := tx.Bucket([]byte(starredBucketName(s.gitToken)))\n\t\tif bucket == nil {\n\t\t\tbucket, err = tx.CreateBucket([]byte(starredBucketName(s.gitToken)))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tisNewIndex = true\n\t\t} else {\n\t\t\tisNewIndex = false\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tClearAll()\n\t\tcolor.Yellow(\"[err] collapse db file, so delete db file\")\n\t\treturn fmt.Errorf(\"[err] createIndex %w\", err)\n\t}\n\n\t// read old database.\n\tvar oldStarredList []*git.Starred\n\toldStarredMap := map[string]*git.Starred{}\n\tif !isNewIndex {\n\t\t// read old starred from db\n\t\ts.db.View(func(tx *bolt.Tx) error {\n\t\t\tbucket := tx.Bucket([]byte(starredBucketName(s.gitToken)))\n\t\t\tbucket.ForEach(func(k, v []byte) error {\n\t\t\t\tvar starred *git.Starred\n\t\t\t\tif err := json.Unmarshal(v, &starred); err != nil {\n\t\t\t\t\tcolor.Yellow(\"[err] parsing %s\", string(k))\n\t\t\t\t} else {\n\t\t\t\t\toldStarredList = append(oldStarredList, starred)\n\t\t\t\t\toldStarredMap[starred.FullName] = starred\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t})\n\t\t\treturn nil\n\t\t})\n\n\t\t// write old starred to index\n\t\tfor _, starred := range oldStarredList {\n\t\t\tif err := s.index.Index(starred.FullName, starred); err != nil {\n\t\t\t\tcolor.Yellow(\"[err] indexing %s\", starred.FullName)\n\t\t\t}\n\t\t}\n\t}\n\n\t// are you all ready?\n\tif !reload && !isNewIndex {\n\t\tcount, _ := s.index.DocCount()\n\t\tcolor.Green(\"[success][using cache] %d items\", count)\n\t\treturn nil\n\t}\n\n\t// reload new starred list.\n\tnewStarredList, err := s.git.ListStarredAll()\n\tif err != nil {\n\t\tcolor.Yellow(\"[err] don't getting starred list %s\", err.Error())\n\t\tif !isNewIndex {\n\t\t\tcount, _ := s.index.DocCount()\n\t\t\tcolor.Yellow(\"[fail][using cache] %d items\", count)\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"[err] CreateIndex %w\", err)\n\t}\n\tnewStarredMap := map[string]*git.Starred{}\n\tfor _, starred := range newStarredList {\n\t\tnewStarredMap[starred.FullName] = starred\n\t}\n\n\t// update and insert\n\tif isNewIndex {\n\t\tcolor.White(\"[refresh] all repositories\")\n\t\ts.git.SetReadme(newStarredList)\n\t\ts.writeDBAndIndex(newStarredList)\n\t} else {\n\t\t// insert or update starred\n\t\tvar insertList []*git.Starred\n\t\tvar updateList []*git.Starred\n\t\tfor _, newStarred := range newStarredList {\n\t\t\tif oldStarred, ok := oldStarredMap[newStarred.FullName]; !ok {\n\t\t\t\tinsertList = append(insertList, newStarred)\n\t\t\t\tcolor.White(\"[insert] %s repository pushed_at %s\",\n\t\t\t\t\tnewStarred.FullName, newStarred.PushedAt.Format(time.RFC3339))\n\t\t\t} else {\n\t\t\t\tif oldStarred.PushedAt.Unix() != newStarred.PushedAt.Unix() &&\n\t\t\t\t\toldStarred.CachedAt.Unix() < time.Now().Add(-24*7*time.Hour).Unix() { // after 7 days.\n\t\t\t\t\tupdateList = append(updateList, newStarred)\n\t\t\t\t\tcolor.White(\"[update] %s repository pushed_at %s\",\n\t\t\t\t\t\tnewStarred.FullName, newStarred.PushedAt.Format(time.RFC3339))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// insert\n\t\ts.git.SetReadme(insertList)\n\t\ts.writeDBAndIndex(insertList)\n\n\t\t// update\n\t\ts.git.SetReadme(updateList)\n\t\ts.writeDBAndIndex(updateList)\n\n\t\t// delete starred\n\t\tvar deleteList []*git.Starred\n\t\tfor _, oldStarred := range oldStarredList {\n\t\t\tif _, ok := newStarredMap[oldStarred.FullName]; !ok {\n\t\t\t\tdeleteList = append(deleteList, oldStarred)\n\t\t\t\tcolor.White(\"[delete] %s repository pushed_at %s\",\n\t\t\t\t\toldStarred.FullName, oldStarred.PushedAt.Format(time.RFC3339))\n\t\t\t}\n\t\t}\n\t\t// delete\n\t\ts.deleteDBAndIndex(deleteList)\n\t}\n\n\t// rewrite a user to db\n\tuserData, err := json.Marshal(user)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"[err] createIndex %w\", err)\n\t}\n\ts.db.Update(func(tx *bolt.Tx) error {\n\t\tbucket := tx.Bucket([]byte(userBucketName))\n\t\tbucket.Put([]byte(s.gitToken), userData)\n\t\treturn nil\n\t})\n\n\tcount, _ := s.index.DocCount()\n\tcolor.Green(\"[success][new reload] %d items\", count)\n\treturn nil\n}", "func (c *Client) CreateWorkingIndex() error {\n\tmapping := strings.Replace(IndexMapping, \"__PROPERTIES__\", IndexProperties, -1)\n\n\treturn c.createIndex(mapping)\n}", "func (m *DataRepositoryMongo) CreateIndex(collectionName string, indexes map[string]interface{}) <-chan error {\n\tresult := make(chan error)\n\tgo func() {\n\n\t\tvar (\n\t\t\terr error\n\t\t\tcollection *mongo.Collection\n\t\t\tctx context.Context\n\t\t)\n\n\t\tcollection, err = m.Client.GetCollection(collectionName)\n\t\tif err != nil {\n\t\t\tlog.Error(\"Get collection %s err (%s)! \\n\", collectionName, err.Error())\n\t\t\tresult <- err\n\t\t}\n\n\t\tctx, err = m.Client.GetContext()\n\t\tif err != nil {\n\t\t\tlog.Error(\"Get context err (%s)! \\n\", err.Error())\n\t\t\tresult <- err\n\t\t}\n\n\t\tvar indexList []mongo.IndexModel\n\n\t\tfor key, value := range indexes {\n\t\t\tindexOption := &options.IndexOptions{}\n\t\t\tindexOption = indexOption.SetBackground(true)\n\t\t\tindex := mongo.IndexModel{Keys: bson.M{key: value}, Options: indexOption}\n\t\t\tindexList = append(indexList, index)\n\t\t}\n\n\t\t_, err = collection.Indexes().CreateMany(ctx, indexList)\n\t\tresult <- err\n\t\tclose(result)\n\t}()\n\n\treturn result\n}", "func NewMsgCreateIndex(owner sdk.AccAddress, tableName string, field string) MsgCreateIndex {\n return MsgCreateIndex {\n Owner: owner,\n TableName: tableName,\n Field: field,\n }\n}", "func New(data []byte) []*Index {\n\treturn NewWithReader(bytes.NewReader(data))\n}", "func NewAutoincrementIndex(o ...option.Option) index.Index {\n\topts := &option.Options{}\n\tfor _, opt := range o {\n\t\topt(opts)\n\t}\n\n\tu := &Autoincrement{\n\t\tindexBy: opts.IndexBy,\n\t\ttypeName: opts.TypeName,\n\t\tfilesDir: opts.FilesDir,\n\t\tbound: opts.Bound,\n\t\tindexBaseDir: path.Join(opts.DataDir, \"index.cs3\"),\n\t\tindexRootDir: path.Join(path.Join(opts.DataDir, \"index.cs3\"), strings.Join([]string{\"autoincrement\", opts.TypeName, opts.IndexBy}, \".\")),\n\t\tcs3conf: &Config{\n\t\t\tProviderAddr: opts.ProviderAddr,\n\t\t\tDataURL: opts.DataURL,\n\t\t\tDataPrefix: opts.DataPrefix,\n\t\t\tJWTSecret: opts.JWTSecret,\n\t\t\tServiceUser: opts.ServiceUser,\n\t\t},\n\t\tdataProvider: dataProviderClient{\n\t\t\tbaseURL: singleJoiningSlash(opts.DataURL, opts.DataPrefix),\n\t\t\tclient: http.Client{\n\t\t\t\tTransport: http.DefaultTransport,\n\t\t\t},\n\t\t},\n\t}\n\n\treturn u\n}", "func (conf *Config) CreateIndexes(client *pilosa.Client) error {\n\treturn conf.CompareIndexes(client, true, true)\n}", "func NewIndex(mapping IndexMapping, opts ...IndexOption) *Index {\n\tindex := &Index{\n\t\tIndexMapping: mapping,\n\t\tpopulateBatchSize: defaultPopulateBatchSize,\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(index)\n\t}\n\n\treturn index\n}", "func Create(clientId, apikey, index string) error {\n\n\tca, err := solr.NewCoreAdmin(solrUrl)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// add apikey and index to clientindices\n\t// start of clientindices region\n\tclientIndicesExist, err := Exists(\"clientindices\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !clientIndicesExist {\n\t\tv := url.Values{}\n\t\tv.Add(\"name\", \"clientindices\")\n\t\tv.Add(\"instanceDir\", \"clientindices\")\n\t\tv.Add(\"configSet\", \"_default\")\n\n\t\t_, err := ca.Action(\"CREATE\", &v)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tci := \"clientindices\"\n\n\tindicescore, err := solr.NewSolrInterface(solrUrl, ci)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar documents []solr.Document\n\tclientIndice := make(solr.Document)\n\tclientIndice.Set(\"apikey\", apikey)\n\tclientIndice.Set(\"index\", index)\n\tdocuments = append(documents, clientIndice)\n\n\t_, err = indicescore.Add(documents, 1, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = Reload(ci)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// end of clientindices region\n\n\tclientDocumentsExist, err := Exists(\"clientdocuments_\" + clientId)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !clientDocumentsExist {\n\t\tv := url.Values{}\n\t\tv.Add(\"name\", \"clientdocuments_\"+clientId)\n\t\tv.Add(\"instanceDir\", \"clientdocuments_\"+clientId)\n\t\tv.Add(\"configSet\", \"_default\")\n\n\t\t_, err = ca.Action(\"CREATE\", &v)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c *CouchDBStore) CreateIndex(createIndexRequest storage.CreateIndexRequest) error {\n\treturn c.db.CreateIndex(context.Background(), createIndexRequest.IndexStorageLocation,\n\t\tcreateIndexRequest.IndexName, createIndexRequest.WhatToIndex)\n}", "func NewIndexer(\n\tprojectRoot string,\n\trepositoryRoot string,\n\tmoduleName string,\n\tmoduleVersion string,\n\tdependencies map[string]string,\n\taddContents bool,\n\ttoolInfo protocol.ToolInfo,\n\tw io.Writer,\n) Indexer {\n\treturn &indexer{\n\t\tprojectRoot: projectRoot,\n\t\trepositoryRoot: repositoryRoot,\n\t\tmoduleName: moduleName,\n\t\tmoduleVersion: moduleVersion,\n\t\tdependencies: dependencies,\n\t\ttoolInfo: toolInfo,\n\t\tw: protocol.NewWriter(w, addContents),\n\n\t\t// Empty maps\n\t\tdefsIndexed: map[string]bool{},\n\t\tusesIndexed: map[string]bool{},\n\t\tranges: map[string]map[int]string{},\n\t\thoverResultCache: map[string]string{},\n\t\tfiles: map[string]*fileInfo{},\n\t\timports: map[token.Pos]*defInfo{},\n\t\tfuncs: map[string]*defInfo{},\n\t\tconsts: map[token.Pos]*defInfo{},\n\t\tvars: map[token.Pos]*defInfo{},\n\t\ttypes: map[string]*defInfo{},\n\t\tlabels: map[token.Pos]*defInfo{},\n\t\trefs: map[string]*refResultInfo{},\n\t\tpackageInformationIDs: map[string]string{},\n\t}\n}", "func (db *Database) createTimestampIndex() {\n\tindexView := db.database.Collection(TRACKS.String()).Indexes()\n\n\tindexModel := mongo.IndexModel{\n\t\tKeys: bson.NewDocument(bson.EC.Int32(\"ts\", -1))}\n\n\t_, err := indexView.CreateOne(context.Background(), indexModel, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func NewCreateIndexStatement(model *models.EntityModel, index *models.IndexDescriptor, connection *sql.DB, connectioninfo connection.IConnectionInfo) *CreateIndexStatement {\n\treturn &CreateIndexStatement{\n\t\tmodel: model,\n\t\tindex: index,\n\t\tconnection: connection,\n\t\tconnectioninfo: connectioninfo}\n}", "func NewIndexer(keys []string, dateLayout string) *Indexer {\n\treturn &Indexer{\n\t\tdateLayout: dateLayout,\n\t\tkeys: keys,\n\t}\n}", "func generateIndex(textsNumber int, wordsNumber int) *Index {\n\ttitles := make([]string, textsNumber)\n\tentries := make(map[string]Set)\n\tfor i := 0; i < textsNumber; i++ {\n\t\ttitles[i] = fmt.Sprintf(\"title-with-number-%d\", i)\n\t}\n\tfor i := 0; i < wordsNumber; i++ {\n\t\tset := Set{}\n\t\tfor j := 0; j < textsNumber; j++ {\n\t\t\tset.Put(j)\n\t\t}\n\t\tentries[fmt.Sprintf(\"w%d\", i)] = set\n\t}\n\treturn &Index{\n\t\tTitles: titles,\n\t\tData: entries,\n\t}\n}", "func createIndex(name string, paths []interface{}, wildcards []string) {\r\n\tf, err := os.Create(name)\r\n\tcheck(err)\r\n\tdefer f.Close()\r\n\tw := bufio.NewWriter(f)\r\n\tindexContents := []string{}\r\n\tfor _, path := range paths {\r\n\t\tp := path.(string)\r\n\t\tfilepath.Walk(p, walker(&indexContents, wildcards))\r\n\t}\r\n\tfor i := range indexContents {\r\n\t\ts := fmt.Sprintln(indexContents[i])\r\n\t\tbc, err := w.WriteString(s)\r\n\t\tcheck(err)\r\n\t\tif bc < len(s) {\r\n\t\t\tpanic(fmt.Sprintf(\"Couldn't write to %s\", name))\r\n\t\t}\r\n\t}\r\n\tw.Flush()\r\n\treturn\r\n}", "func NewIndexBuilder() *IndexBuilder {\n\treturn &IndexBuilder{\n\t\tcontentPostings: make(map[ngram][]uint32),\n\t\tnamePostings: make(map[ngram][]uint32),\n\t\tbranches: make(map[string]int),\n\t}\n}", "func createIndexMigration(cmd *cobra.Command, args []string) error {\n\t// Caller should supply a table name as the first argument and a column name\n\t// as the second argument.\n\tif len(args) < 2 {\n\t\treturn errors.New(\"requires a tablename argument followed by a columnname argument\")\n\t}\n\n\t// Set index data.\n\tidx := new(sqlt.Index)\n\tidx.SetTableName(args[0])\n\tidx.SetColumnName(args[1])\n\n\t// Process SQL template for \"up\" migration.\n\tupSQL, err := sqlt.ProcessTmpl(idx, sqlt.CreateDefaultIndexTmpl)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Process SQL template for \"down\" migration.\n\tdownSQL, err := sqlt.ProcessTmpl(idx, sqlt.DropIndexTmpl)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create migration file.\n\tmigrationName := fmt.Sprintf(\"CreateIndexOn_%s_%s\", idx.TableName(), idx.ColumnName())\n\terr = createMigration(migrationName, upSQL, downSQL)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn err\n}", "func (es *ElasticSearch) CreateIndexIfNotExists(esIndex string, esType string, mapping string) {\n\t// Use the IndexExists service to check if the index exists\n\texists, err := client.IndexExists(esIndex).Do()\n\tif err != nil {\n\t\t// Handle error\n\t\tpanic(err)\n\t}\n\tif !exists {\n\t\t// Create a new index.\n\t\tcreateIndex, err := client.CreateIndex(esIndex).Do()\n\t\tif err != nil {\n\t\t\t// TODO: Handle error\n\t\t\tpanic(err)\n\t\t}\n\t\tif !createIndex.Acknowledged {\n\t\t\t// TODO: Handle not acknowledged\n\t\t\tpanic(\"not acked\")\n\t\t}\n\n\t\tresponse, err := client.PutMapping().Index(esIndex).Type(esType).BodyString(mapping).Do()\n\t\tif err != nil {\n\t\t\t// TODO: Handle error\n\t\t\tpanic(err)\n\t\t}\n\t\tif response == nil {\n\t\t\t// TODO: Handle error\n\t\t\tpanic(err)\n\t\t}\n\t}\n}", "func NewIndex(data []byte) (*Index, error) {\n\tvar i Index\n\tdec := gob.NewDecoder(bytes.NewBuffer(data))\n\tif err := dec.Decode(&i); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &i, nil\n}", "func (s *EsStorage) NewESIndex(name, mapping string) (bool, error) {\n\tb := strings.NewReader(mapping)\n\tr := &esapi.IndicesCreateRequest{\n\t\tIndex: name,\n\t\tBody: b,\n\t}\n\tctx := context.Background()\n\tresp, err := r.Do(ctx, s.c)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn false, err\n\t}\n\tif resp.IsError() {\n\t\terr = fmt.Errorf(\"Failed to create index: %d %s\", resp.StatusCode, name)\n\t\treturn false, err\n\t}\n\tfmt.Println(resp.String())\n\treturn true, nil\n}", "func NewIndexDefinition() *IndexDefinition {\n\tprefixArray := make([]string, 0)\n\treturn &IndexDefinition{HASH.String(), false, prefixArray, \"\", \"\", \"\", -1, \"\", \"\"}\n}", "func (al *AccessLayer) CreateIndices(temp bool) error {\n\n\tidxMap := map[string][]string{\n\t\tstopsTable: []string{\"stop_name\"},\n\t\tstopTimesTable: []string{\"trip_id\", \"arrival_time\"},\n\t\ttripsTable: []string{\"trip_id\", \"service_id\"},\n\t}\n\tfor t, indices := range idxMap {\n\t\tfor _, c := range indices {\n\t\t\tt := getTableName(t, temp)\n\t\t\ti := fmt.Sprintf(\"idx_%s\", c)\n\t\t\tif al.indexExists(t, i) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tq := fmt.Sprintf(\"CREATE INDEX %s ON %s(%s)\", i, t, c)\n\t\t\t_, err := al.AL.Exec(q)\n\t\t\tif err != nil {\n\t\t\t\tal.logger.Errorf(\"Error creating index %s against %s\", i, t)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tal.logger.Infof(\"Created index %s against %s\", i, t)\n\t\t}\n\t}\n\n\treturn nil\n}", "func CreateIndexDB(langName string, dbT DBType) IndexDB {\n\t// TODO 暂时只实现了内存存储,一次性的。\n\treturn initMenDB(langName)\n}", "func NewIndexFile() *IndexFile {\n\treturn &IndexFile{\n\t\tAPIVersion: APIVersionV1,\n\t\tGenerated: time.Now(),\n\t\tEntries: map[string]VersionedBundle{},\n\t\tPublicKeys: []string{},\n\t}\n}", "func (es *ElasticSearch) Index(esIndex string, esType string, body interface{}) {\n\t// Add a document to the index\n\t_, err := client.Index().\n\t\tIndex(esIndex).\n\t\tType(\"project\").\n\t\tBodyJson(body).\n\t\tRefresh(true).\n\t\tDo()\n\tif err != nil {\n\t\t// TODO: Handle error\n\t\tpanic(err)\n\t}\n}", "func NewIndex(index Constant) *Index {\n\treturn &Index{Constant: index}\n}", "func NewIndex(docID, word string, count int64) *Index {\n\tindex := new(Index)\n\tindex.IndexID = uuid.NewV4().String()\n\tindex.DocID = docID\n\tindex.Word = word\n\tindex.Count = count\n\n\treturn index\n}", "func (r *Results) Create(item *TestDocument) error {\n\tpayload, err := json.Marshal(item)\n\tif err != nil {\n\t\treturn err\n\t}\n\tctx := context.Background()\n\tres, err := esapi.IndexRequest{\n\t\tIndex: r.indexName,\n\t\tBody: bytes.NewReader(payload),\n\t}.Do(ctx, r.es)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.IsError() {\n\t\tvar e map[string]interface{}\n\t\tif err := json.NewDecoder(res.Body).Decode(&e); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn fmt.Errorf(\"[%s] %s: %s\", res.Status(), e[\"error\"].(map[string]interface{})[\"type\"], e[\"error\"].(map[string]interface{})[\"reason\"])\n\t}\n\treturn nil\n}", "func createIndexes(ts *Schema, ti *Info, idxs []schema.Index, store *stor.Stor) {\n\tif len(idxs) == 0 {\n\t\treturn\n\t}\n\tts.Indexes = slices.Clip(ts.Indexes) // copy on write\n\tnold := len(ts.Indexes)\n\tfor i := range idxs {\n\t\tix := &idxs[i]\n\t\tif ts.FindIndex(ix.Columns) != nil {\n\t\t\tpanic(\"duplicate index: \" +\n\t\t\t\tstr.Join(\"(,)\", ix.Columns) + \" in \" + ts.Table)\n\t\t}\n\t\tts.Indexes = append(ts.Indexes, *ix)\n\t}\n\tidxs = ts.SetupNewIndexes(nold)\n\tn := len(ti.Indexes)\n\tti.Indexes = slices.Clip(ti.Indexes) // copy on write\n\tfor i := range idxs {\n\t\tbt := btree.CreateBtree(store, &ts.Indexes[n+i].Ixspec)\n\t\tti.Indexes = append(ti.Indexes, index.OverlayFor(bt))\n\t}\n}", "func (p *planner) CreateIndex(n *parser.CreateIndex) (planNode, error) {\n\ttableDesc, err := p.getTableDesc(n.Table)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif _, err := tableDesc.FindIndexByName(string(n.Name)); err == nil {\n\t\tif n.IfNotExists {\n\t\t\t// Noop.\n\t\t\treturn &valuesNode{}, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"index %q already exists\", string(n.Name))\n\t}\n\n\tif err := p.checkPrivilege(tableDesc, privilege.CREATE); err != nil {\n\t\treturn nil, err\n\t}\n\n\tindexDesc := IndexDescriptor{\n\t\tName: string(n.Name),\n\t\tUnique: n.Unique,\n\t\tColumnNames: n.Columns,\n\t}\n\ttableDesc.Indexes = append(tableDesc.Indexes, indexDesc)\n\n\tif err := tableDesc.AllocateIDs(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// `indexDesc` changed on us when we called `tableDesc.AllocateIDs()`.\n\tindexDesc = tableDesc.Indexes[len(tableDesc.Indexes)-1]\n\n\t// Get all the rows affected.\n\t// TODO(vivek): Avoid going through Select.\n\t// TODO(tamird): Support partial indexes?\n\trow, err := p.Select(&parser.Select{\n\t\tExprs: parser.SelectExprs{parser.StarSelectExpr()},\n\t\tFrom: parser.TableExprs{&parser.AliasedTableExpr{Expr: n.Table}},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Construct a map from column ID to the index the value appears at within a\n\t// row.\n\tcolIDtoRowIndex := map[ColumnID]int{}\n\tfor i, name := range row.Columns() {\n\t\tc, err := tableDesc.FindColumnByName(name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcolIDtoRowIndex[c.ID] = i\n\t}\n\n\t// TODO(tamird): This will fall down in production use. We need to do\n\t// something better (see #2036). In particular, this implementation\n\t// has the following problems:\n\t// - Very large tables will generate an enormous batch here. This\n\t// isn't really a problem in itself except that it will exacerbate\n\t// the other issue:\n\t// - Any non-quiescent table that this runs against will end up with\n\t// an inconsistent index. This is because as inserts/updates continue\n\t// to roll in behind this operation's read front, the written index\n\t// will become incomplete/stale before it's written.\n\tvar b client.Batch\n\tb.Put(MakeDescMetadataKey(tableDesc.GetID()), tableDesc)\n\n\t// We need a dummy element in this slice to account for the `Put`\n\t// above; the `Put` won't fail, but if we don't add an entry for it,\n\t// we'll end up with out-of-bounds error when we iterate over the\n\t// writes in the error case.\n\twrites := []write{{}}\n\n\tfor row.Next() {\n\t\trowVals := row.Values()\n\n\t\tsecondaryIndexEntries, err := encodeSecondaryIndexes(\n\t\t\ttableDesc.ID, []IndexDescriptor{indexDesc}, colIDtoRowIndex, rowVals)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, secondaryIndexEntry := range secondaryIndexEntries {\n\t\t\tif log.V(2) {\n\t\t\t\tlog.Infof(\"CPut %q -> %v\", secondaryIndexEntry.key, secondaryIndexEntry.value)\n\t\t\t}\n\t\t\tb.CPut(secondaryIndexEntry.key, secondaryIndexEntry.value, nil)\n\n\t\t\tvar w write\n\n\t\t\tfor i, columnID := range indexDesc.ColumnIDs {\n\t\t\t\tw.values = append(w.values, writePair{\n\t\t\t\t\tcol: indexDesc.ColumnNames[i],\n\t\t\t\t\tval: rowVals[colIDtoRowIndex[columnID]],\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tw.constraint = &indexDesc\n\n\t\t\twrites = append(writes, w)\n\t\t}\n\t}\n\n\tif err := row.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Mark transaction as operating on the system DB.\n\tp.txn.SetSystemDBTrigger()\n\tif err := p.txn.Run(&b); err != nil {\n\t\tfor i, result := range b.Results {\n\t\t\tif _, ok := result.Err.(*proto.ConditionFailedError); ok {\n\t\t\t\tw := writes[i]\n\n\t\t\t\treturn nil, fmt.Errorf(\"duplicate key value %s violates unique constraint %q\", w.values, w.constraint.Name)\n\t\t\t}\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn &valuesNode{}, nil\n}", "func (ns *EsIndexer) CreateIndexIfNotExists(documentType string) {\n\tinitialized := true\n\taliasName := ns.aliasNamePrefix + documentType\n\tctx := context.Background()\n\t// Check for existing index to find out current indexNamePrefix\n\tif !ns.reindexing {\n\t\tres, err := ns.client.Aliases().Index(\"_all\").Do(ctx)\n\t\tif err != nil {\n\t\t\tns.log.Warn().Err(err).Msg(\"Error when checking for alias\")\n\t\t}\n\t\tindices := res.IndicesByAlias(aliasName)\n\t\tif len(indices) > 0 {\n\t\t\tindexName := indices[0]\n\t\t\tns.log.Info().Str(\"aliasName\", aliasName).Str(\"indexName\", indexName).Msg(\"Alias found\")\n\t\t\tns.indexNamePrefix = strings.TrimRight(indices[0], documentType)\n\t\t} else {\n\t\t\tinitialized = false\n\t\t\tns.reindexing = false\n\t\t}\n\t}\n\t// Create new index\n\tif ns.reindexing || !initialized {\n\t\tindexName := ns.indexNamePrefix + documentType\n\t\tns.log.Info().Str(\"aliasName\", aliasName).Str(\"indexName\", indexName).Msg(\"Initializing alias\")\n\t\tcreateIndex, err := ns.client.CreateIndex(indexName).BodyString(mappings[documentType]).Do(ctx)\n\t\tif err != nil || !createIndex.Acknowledged {\n\t\t\tns.log.Warn().Err(err).Str(\"indexName\", indexName).Msg(\"Error when creating index\")\n\t\t}\n\t\tns.log.Info().Str(\"indexName\", indexName).Msg(\"Created index\")\n\t\t// Update alias, only when not reindexing\n\t\tif !ns.reindexing {\n\t\t\terr = ns.UpdateAlias(aliasName, indexName)\n\t\t\tif err != nil {\n\t\t\t\tns.log.Warn().Err(err).Str(\"aliasName\", aliasName).Str(\"indexName\", indexName).Msg(\"Error when updating alias\")\n\t\t\t} else {\n\t\t\t\tns.log.Info().Str(\"aliasName\", aliasName).Str(\"indexName\", indexName).Msg(\"Updated alias\")\n\t\t\t}\n\t\t}\n\t}\n}", "func (a *Adapter) ensureIndex(ctx context.Context) error {\n\t_, err := a.c.IndexPutTemplate(activeIndexAlias).BodyString(activeIndexTemplate).Do(ctx)\n\tif err != nil {\n\t\tlog.Fatal(\"Failed to create index template\", zap.Error(err))\n\t}\n\n\texists, err := a.c.IndexExists(activeIndexAlias).Do(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !exists {\n\t\ta.c.CreateIndex(activeIndexAlias + \"-000001\").Do(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Failed to create initial index\", zap.Error(err))\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func New(c *config.Config) *Indexer {\n\tcli, err := elastic.NewClient(\n\t\telastic.SetURL(c.Elastic.URL),\n\t\telastic.SetBasicAuth(c.Elastic.Username, c.Elastic.Password),\n\t\telastic.SetScheme(elasticScheme),\n\t\telastic.SetSniff(elasticSniffing),\n\t)\n\n\tif err != nil {\n\t\tglog.Fatalf(\"Failed creating indexer: %v\", err)\n\t}\n\n\treturn &Indexer{\n\t\tContext: context.Background(),\n\t\tClient: cli,\n\t\tConfig: c,\n\t}\n}", "func New(transport *transport.Transport) *Indices {\n\treturn &Indices{\n\n\t\ttransport: transport,\n\t}\n}", "func newIndexWithTempPath(name string) *Index {\n\tpath, err := ioutil.TempDir(\"\", \"pilosa-index-\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tindex, err := NewIndex(path, name)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn index\n}", "func New(path string) (ip *Indexio, err error) {\n\tvar i Indexio\n\t// Initialize functions map for marshaling and unmarshaling\n\tfm := turtleDB.NewFuncsMap(marshal, unmarshal)\n\t// Create new instance of turtleDB\n\tif i.db, err = turtleDB.New(\"indexio\", path, fm); err != nil {\n\t\treturn\n\t}\n\t// Initialize indexes bucket\n\tif err = i.db.Update(initBucket); err != nil {\n\t\treturn\n\t}\n\t// Assign ip as a pointer to i\n\tip = &i\n\treturn\n}", "func (tbl DbCompoundTable) CreateIndexes(ifNotExist bool) (err error) {\n\n\terr = tbl.CreateAlphaBetaIndex(ifNotExist)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}" ]
[ "0.7451471", "0.73931766", "0.7387334", "0.73535496", "0.7331499", "0.72258705", "0.71987957", "0.71313417", "0.71217936", "0.7087117", "0.7081512", "0.70770717", "0.70503527", "0.7039608", "0.7037315", "0.69063324", "0.6902682", "0.68916285", "0.68763065", "0.6869368", "0.6845229", "0.68326753", "0.68320537", "0.6822217", "0.68191284", "0.6812455", "0.67795587", "0.67513025", "0.67461807", "0.67438036", "0.6732109", "0.6728684", "0.6724409", "0.67221624", "0.67077327", "0.6690504", "0.66839415", "0.6683363", "0.66783607", "0.6652656", "0.6641591", "0.6635207", "0.66337335", "0.6619032", "0.6599903", "0.65628546", "0.6537285", "0.6527299", "0.64989793", "0.6498977", "0.64708465", "0.6439753", "0.6419518", "0.63907754", "0.6390498", "0.63730097", "0.6363595", "0.6352399", "0.6349672", "0.63249576", "0.6318436", "0.6312337", "0.63072914", "0.63006854", "0.62731695", "0.6262123", "0.62613434", "0.6257711", "0.62566745", "0.62417096", "0.62240124", "0.62233186", "0.62212944", "0.6211667", "0.62009287", "0.6200601", "0.6197813", "0.61822784", "0.61818135", "0.616878", "0.61634946", "0.61496884", "0.6139826", "0.61395943", "0.61280406", "0.61276615", "0.61268705", "0.6118898", "0.60985786", "0.6092754", "0.6074995", "0.6067372", "0.6058263", "0.6057768", "0.6057624", "0.60498375", "0.6036581", "0.6031936", "0.6031931", "0.60183656" ]
0.6787004
26
LoadAll loads all indexes for given db and table
func (d *Driver) LoadAll(db, table string) ([]sql.Index, error) { var ( indexes []sql.Index errors []string root = filepath.Join(d.root, db, table) ) dirs, err := ioutil.ReadDir(root) if err != nil { if os.IsNotExist(err) { return indexes, nil } return nil, err } for _, info := range dirs { if info.IsDir() && !strings.HasPrefix(info.Name(), ".") { idx, err := d.loadIndex(db, table, info.Name()) if err != nil { if !errCorruptedIndex.Is(err) { errors = append(errors, err.Error()) } continue } indexes = append(indexes, idx) } } if len(errors) > 0 { return nil, fmt.Errorf(strings.Join(errors, "\n")) } return indexes, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d *Driver) LoadAll(db, table string) ([]sql.Index, error) {\n\tvar (\n\t\tindexes []sql.Index\n\t\terrors []string\n\t\troot = filepath.Join(d.root, db, table)\n\t)\n\n\tdirs, err := ioutil.ReadDir(root)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn indexes, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\tfor _, info := range dirs {\n\t\tif info.IsDir() && !strings.HasPrefix(info.Name(), \".\") {\n\t\t\tidx, err := d.loadIndex(db, table, info.Name())\n\t\t\tif err != nil {\n\t\t\t\tif !errCorruptedIndex.Is(err) {\n\t\t\t\t\terrors = append(errors, err.Error())\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tindexes = append(indexes, idx)\n\t\t}\n\t}\n\n\tif len(errors) > 0 {\n\t\treturn nil, fmt.Errorf(strings.Join(errors, \"\\n\"))\n\t}\n\n\treturn indexes, nil\n}", "func loadIndexs() {\n\tdb := open()\n\tindexs = make(map[string][]*Index)\n\tdb.View(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(INDEX_BUCKET))\n\t\tif b == nil {\n\t\t\tlogger.Infof(\"bucket[%s] not exist\", INDEX_BUCKET)\n\t\t\treturn nil\n\t\t}\n\t\tc := b.Cursor()\n\t\tfor k, v := c.First(); k != nil; k, v = c.Next() {\n\t\t\tkey := string(k)\n\t\t\tvar _indexs []string\n\t\t\terr := json.Unmarshal(v, &_indexs)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Errorf(\"parse index[%s] error -> %v\", k, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t__indexs := make([]*Index, len(_indexs)) \n\t\t\t// parse index\n\t\t\tfor i, _index := range _indexs {\n\t\t\t\tsps :=strings.Split(_index, INDEX_SPLIT) \n\t\t\t\tindex := &Index {\n\t\t\t\t\tbucket: key,\n\t\t\t\t\tindexs: sps,\n\t\t\t\t}\n\t\t\t\t__indexs[i] = index\n\t\t\t}\n\t\t\tindexs[key] = __indexs\n\t\t}\n\t\treturn nil\n\t})\n}", "func LoadDatabase() {\n\tdb.load()\n\tfor host := range db.Hosts {\n\t\tindex.Put(host)\n\t}\n}", "func TestSQLSmith_LoadIndexes(t *testing.T) {\n\te := Executor{\n\t\tconn: nil,\n\t\tdb: dbname,\n\t\ttables: make(map[string]*types.Table),\n\t}\n\tindexes[\"users\"] = []types.CIStr{\"idx1\", \"idx2\"}\n\te.loadSchema(schema, indexes)\n\n\tassert.Equal(t, len(e.tables), 6)\n\tassert.Equal(t, len(e.tables[\"users\"].Indexes), 2)\n}", "func ReloadAllTableInfo(ctx context.Context, filePath string) error {\n\tconf, err := getConfig(ctx, filePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, db := range conf.Databases {\n\t\tfor _, h := range conf.Hosts {\n\t\t\tif db.HostKey != h.Key {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\terr := openAdditional(ctx, h.User, h.Password, h.Address, db.Name, h.Port, h.Protocol)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\ttables, err := showtables(db.Name)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tdb.Tables = tables\n\t\t}\n\t}\n\n\treturn setConfig(ctx, conf, filePath)\n}", "func LoadAll(args ...interface{}) error {\n\treturn doAll(Load, args...)\n}", "func (o *PublisherSearchIdxSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := PublisherSearchIdxSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), publisherSearchIdxPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"publisher_search_idx\\\".* FROM \\\"publisher_search_idx\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, publisherSearchIdxPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in PublisherSearchIdxSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (DBM *DBManager) loadAllDatabases(path string) (err error) {\n\tdatabasesFiles, err := listDatabases(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, databaseFile := range databasesFiles {\n\t\tdb, err := data.LoadDatabase(filepath.Join(path, databaseFile.Name()))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tDBM.databases.Store(databaseFile.Name(), db)\n\t}\n\treturn nil\n}", "func (st *Store) LoadAll(aa []string) error {\n\tlogins := make(map[string]*Login, 0)\n\n\tfor _, a := range aa {\n\t\tregistry, login, err := loadOne(strings.TrimSpace(a))\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tlogins[registry] = login\n\t}\n\n\tst.logins = logins\n\n\treturn nil\n}", "func (s *Store) loadAll() error {\n\tfiles, err := s.ListFiles(s.Dir)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to list %s: %v\", s.Dir, err)\n\t}\n\n\tfor _, file := range files {\n\t\tfilepath := path.Join(s.Dir, file)\n\t\terr := s.loadPath(filepath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to load %s: %v\", filepath, err)\n\t\t}\n\t}\n\treturn nil\n}", "func InitDB(db *mgo.Database) {\n\tfor i := range workIndexes {\n\t\terr := db.C(workIndexes[i].Name).EnsureIndex(workIndexes[i].Index)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t}\n\t}\n}", "func OrTableIndexes(db models.XODB, schema string, table string) ([]*models.Index, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`LOWER(i.index_name) AS index_name, ` +\n\t\t`CASE WHEN i.uniqueness = 'UNIQUE' THEN '1' ELSE '0' END AS is_unique, ` +\n\t\t`CASE WHEN c.constraint_type = 'P' THEN '1' ELSE '0' END AS is_primary ` +\n\t\t`FROM user_indexes i ` +\n\t\t`LEFT JOIN user_constraints c on i.INDEX_NAME = c.constraint_name ` +\n\t\t`WHERE i.TABLE_OWNER = UPPER(:1) AND i.TABLE_NAME = :2`\n\n\t// run query\n\tmodels.XOLog(sqlstr, schema, table)\n\tq, err := db.Query(sqlstr, schema, table)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer q.Close()\n\n\t// load results\n\tres := []*models.Index{}\n\tfor q.Next() {\n\t\ti := models.Index{}\n\n\t\t// scan\n\t\terr = q.Scan(&i.IndexName, &i.IsUnique, &i.IsPrimary)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres = append(res, &i)\n\t}\n\n\treturn res, nil\n}", "func (o *TenantSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := TenantSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), tenantPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `tenants`.* FROM `tenants` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, tenantPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"dbmodel: unable to reload all in TenantSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (mi *MasterIndex) All() []*Index {\n\tmi.idxMutex.Lock()\n\tdefer mi.idxMutex.Unlock()\n\n\treturn mi.idx\n}", "func (o *KvstoreSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := KvstoreSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), kvstorePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"kvstore\\\".* FROM \\\"kvstore\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, kvstorePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in KvstoreSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *StoreSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := StoreSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), storePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"stores\\\".* FROM \\\"stores\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, storePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in StoreSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (e *engine) load() error {\n\tdatabaseNames, err := listDir(e.cfg.Dir)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, databaseName := range databaseNames {\n\t\t_, err := e.CreateDatabase(databaseName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func loadAll(bi *Bi) (*Bi, error) {\n\n\tvar err error\n\n\tbi.allstops, err = bi.gtfs.AllStops()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbi.allroutes, err = bi.gtfs.Routes()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn bi, nil\n}", "func (ifile *Indexfile) Load() (lfindex *Index, err error) {\n\tlfindex = new(Index)\n\tf := func(rec *GenericRecord) error {\n\t\tif rec.ksz > 0 {\n\t\t\tirec := rec.ToIndexRecord(ifile.debug)\n\t\t\tlfindex.List = append(lfindex.List, irec)\n\t\t}\n\t\treturn nil\n\t}\n\terr = ifile.Process(f, INDEX_RECORD, false)\n\treturn\n}", "func (o *StorestateSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := StorestateSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), storestatePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"storestate\\\".* FROM \\\"storestate\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, storestatePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(nil, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"stellarcore: unable to reload all in StorestateSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *SegmentSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := SegmentSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), segmentPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"segment\\\".* FROM \\\"segment\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, segmentPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"boiler: unable to reload all in SegmentSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func ForAllIndexes(ctx context.Context, repo restic.Repository,\n\tfn func(id restic.ID, index *Index, oldFormat bool, err error) error) error {\n\n\tdebug.Log(\"Start\")\n\n\ttype FileInfo struct {\n\t\trestic.ID\n\t\tSize int64\n\t}\n\n\tvar m sync.Mutex\n\n\t// track spawned goroutines using wg, create a new context which is\n\t// cancelled as soon as an error occurs.\n\twg, ctx := errgroup.WithContext(ctx)\n\n\tch := make(chan FileInfo)\n\t// send list of index files through ch, which is closed afterwards\n\twg.Go(func() error {\n\t\tdefer close(ch)\n\t\treturn repo.List(ctx, restic.IndexFile, func(id restic.ID, size int64) error {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn nil\n\t\t\tcase ch <- FileInfo{id, size}:\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t})\n\n\t// a worker receives an index ID from ch, loads the index, and sends it to indexCh\n\tworker := func() error {\n\t\tvar buf []byte\n\t\tfor fi := range ch {\n\t\t\tdebug.Log(\"worker got file %v\", fi.ID.Str())\n\t\t\tvar err error\n\t\t\tvar idx *Index\n\t\t\toldFormat := false\n\n\t\t\tbuf, err = repo.LoadAndDecrypt(ctx, buf[:0], restic.IndexFile, fi.ID)\n\t\t\tif err == nil {\n\t\t\t\tidx, oldFormat, err = DecodeIndex(buf, fi.ID)\n\t\t\t}\n\n\t\t\tm.Lock()\n\t\t\terr = fn(fi.ID, idx, oldFormat, err)\n\t\t\tm.Unlock()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\t// run workers on ch\n\twg.Go(func() error {\n\t\treturn RunWorkers(loadIndexParallelism, worker)\n\t})\n\n\treturn wg.Wait()\n}", "func (d *DBV0) load(db *DB) error {\n\tfn := func(tx *sql.Tx) error {\n\t\tvar err error\n\t\td.aciinfos, err = getAllACIInfosV0_1(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\td.remotes, err = getAllRemoteV0_1(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\tif err := db.Do(fn); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (db *ldb) loadAll() {\n\tf, err := os.Open(game_data_file)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\trd := bufio.NewReader(f)\n\n\tvar l = 0\n\tvar matrix = make([]string, 0)\n\tfor {\n\t\tline, err := rd.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tdb.data = append(db.data, matrix)\n\t\t\t\tdb.maxLevel = len(db.data)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tpanic(err)\n\t\t}\n\t\tline = strings.TrimRight(line, \"\\t\\n\\f\\r\")\n\t\tif len(line) == 0 {\n\t\t\tdb.data = append(db.data, matrix)\n\t\t\tl = l + 1\n\t\t\tmatrix = make([]string, 0)\n\t\t} else {\n\t\t\tmatrix = append(matrix, line)\n\t\t}\n\t}\n}", "func (s *InMemoryHandler) Load() ([]*model.FunctionConfig, error) {\n\tresults := []*model.FunctionConfig{}\n\tfor _, v := range s.functions {\n\t\tresults = append(results, &v)\n\t}\n\tlog.Infof(\"load database table size %d\", len(results))\n\treturn results, nil\n}", "func initTableIndices(t *tableCommon) error {\n\ttrace_util_0.Count(_tables_00000, 29)\n\ttblInfo := t.meta\n\tfor _, idxInfo := range tblInfo.Indices {\n\t\ttrace_util_0.Count(_tables_00000, 31)\n\t\tif idxInfo.State == model.StateNone {\n\t\t\ttrace_util_0.Count(_tables_00000, 33)\n\t\t\treturn table.ErrIndexStateCantNone.GenWithStack(\"index %s can't be in none state\", idxInfo.Name)\n\t\t}\n\n\t\t// Use partition ID for index, because tableCommon may be table or partition.\n\t\ttrace_util_0.Count(_tables_00000, 32)\n\t\tidx := NewIndex(t.physicalTableID, tblInfo, idxInfo)\n\t\tt.indices = append(t.indices, idx)\n\t}\n\ttrace_util_0.Count(_tables_00000, 30)\n\treturn nil\n}", "func (o *SkinSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tskins := SkinSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), skinPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `skin`.* FROM `skin` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, skinPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&skins)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in SkinSlice\")\n\t}\n\n\t*o = skins\n\n\treturn nil\n}", "func (rcv *databaseReader) ReadAll() ([]*model.Database, error) {\n\tdatabaseNames, err := rcv.db.ListDatabaseNames(context.Background(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := make([]*model.Database, len(databaseNames))\n\n\tfor i, name := range databaseNames {\n\t\tdbStats, err := rcv.db.Database(name).RunCommand(\n\t\t\tcontext.Background(),\n\t\t\tbson.NewDocument(bson.EC.Int32(\"dbStats\", 1)),\n\t\t)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar collections, indexesNumber, storageSize int\n\n\t\tif collectionsRaw, _ := dbStats.Lookup(\"collections\"); collectionsRaw != nil {\n\t\t\tcollections = int(collectionsRaw.Value().Int32())\n\t\t}\n\n\t\tif indexes, _ := dbStats.Lookup(\"indexes\"); indexes != nil {\n\t\t\tindexesNumber = int(indexes.Value().Int32())\n\t\t}\n\n\t\tif storageSizeRaw, _ := dbStats.Lookup(\"storageSize\"); storageSizeRaw != nil {\n\t\t\tstorageSize = int(storageSizeRaw.Value().Double())\n\t\t}\n\n\t\tresult[i] = model.NewDatabase(name, storageSize, indexesNumber, collections)\n\t}\n\n\treturn result, nil\n}", "func (c *Client) LoadAll() ([]*eskip.Route, error) {\n\trouteInfo, err := c.LoadAndParseAll()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn infoToRoutesLogged(routeInfo), nil\n}", "func (o *IllnessSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := IllnessSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), illnessPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"illness\\\".* FROM \\\"illness\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, illnessPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in IllnessSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *SourceSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := SourceSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), sourcePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"sources\\\".* FROM \\\"sources\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, sourcePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(nil, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mdbmodels: unable to reload all in SourceSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (db *Database) Indexes(label string) ([]*Index, error) {\n\turi := join(db.Url, \"schema/index\", label)\n\tresult := []*Index{}\n\tne := NeoError{}\n\tresp, err := db.Session.Get(uri, nil, &result, &ne)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\tif resp.Status() == 404 {\n\t\treturn result, NotFound\n\t}\n\tif resp.Status() != 200 {\n\t\treturn result, ne\n\t}\n\tfor _, idx := range result {\n\t\tidx.db = db\n\t}\n\treturn result, nil\n}", "func DbLoadAllTickets(dbTx database.Tx, ticketBucket []byte) (*tickettreap.Immutable, error) {\n\tmeta := dbTx.Metadata()\n\tbucket := meta.Bucket(ticketBucket)\n\n\ttreap := tickettreap.NewImmutable()\n\terr := bucket.ForEach(func(k []byte, v []byte) error {\n\t\tif len(v) < 5 {\n\t\t\treturn ticketDBError(ErrLoadAllTickets, fmt.Sprintf(\"short \"+\n\t\t\t\t\"read for ticket key %x when loading tickets\", k))\n\t\t}\n\n\t\th, err := chainhash.NewHash(k)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttreapKey := tickettreap.Key(*h)\n\t\tmissed, revoked, spent, expired := undoBitFlagsFromByte(v[4])\n\t\ttreapValue := &tickettreap.Value{\n\t\t\tHeight: dbnamespace.ByteOrder.Uint32(v[0:4]),\n\t\t\tMissed: missed,\n\t\t\tRevoked: revoked,\n\t\t\tSpent: spent,\n\t\t\tExpired: expired,\n\t\t}\n\n\t\ttreap = treap.Put(treapKey, treapValue)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, ticketDBError(ErrLoadAllTickets, fmt.Sprintf(\"failed to \"+\n\t\t\t\"load all tickets for the bucket %s\", string(ticketBucket)))\n\t}\n\n\treturn treap, nil\n}", "func (o *FilesStorageSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := FilesStorageSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), filesStoragePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `files_storages`.* FROM `files_storages` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, filesStoragePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(nil, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in FilesStorageSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *TransactionSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\ttransactions := TransactionSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), transactionPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `transaction`.* FROM `transaction` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, transactionPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&transactions)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to reload all in TransactionSlice\")\n\t}\n\n\t*o = transactions\n\n\treturn nil\n}", "func (o *TransactionSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\ttransactions := TransactionSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), transactionPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `transactions`.* FROM `transactions` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, transactionPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&transactions)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in TransactionSlice\")\n\t}\n\n\t*o = transactions\n\n\treturn nil\n}", "func (o *ShelfSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tshelves := ShelfSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), shelfPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"SELECT `shelf`.* FROM `shelf` WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, shelfPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(*o)*len(shelfPrimaryKeyColumns), 1, len(shelfPrimaryKeyColumns)),\n\t)\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&shelves)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in ShelfSlice\")\n\t}\n\n\t*o = shelves\n\n\treturn nil\n}", "func (client *Client) LoadIndexersList() error {\n var result Indexers\n response, err := client.sendGetRequest(&result, \"indexers\", \"\", nil, nil)\n if err != nil {\n return errors.JackettUnableToLoadIndexers.ToError(err)\n }\n client.indexers = response.(*Indexers)\n configuredIndexers := make([]Indexer, 0)\n for _, indexer := range result {\n if indexer.Configured {\n configuredIndexers = append(configuredIndexers, indexer)\n }\n }\n client.configuredIndexers = configuredIndexers\n return nil\n}", "func (mt *MetaTable) reloadWithNonDatabase() error {\n\tcollectionNum := int64(0)\n\tpartitionNum := int64(0)\n\toldCollections, err := mt.catalog.ListCollections(mt.ctx, util.NonDBID, typeutil.MaxTimestamp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, collection := range oldCollections {\n\t\tmt.collID2Meta[collection.CollectionID] = collection\n\t\tif collection.Available() {\n\t\t\tmt.names.insert(util.DefaultDBName, collection.Name, collection.CollectionID)\n\t\t\tcollectionNum++\n\t\t\tpartitionNum += int64(collection.GetPartitionNum(true))\n\t\t}\n\t}\n\n\tif collectionNum > 0 {\n\t\tlog.Info(\"recover collections without db\", zap.Int64(\"collection_num\", collectionNum), zap.Int64(\"partition_num\", partitionNum))\n\t}\n\n\taliases, err := mt.catalog.ListAliases(mt.ctx, util.NonDBID, typeutil.MaxTimestamp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, alias := range aliases {\n\t\tmt.aliases.insert(util.DefaultDBName, alias.Name, alias.CollectionID)\n\t}\n\n\tmetrics.RootCoordNumOfCollections.Add(float64(collectionNum))\n\tmetrics.RootCoordNumOfPartitions.WithLabelValues().Add(float64(partitionNum))\n\treturn nil\n}", "func (ec *ElasticClient) InitAllMappings() {\n\tec.DeleteIndex(string(\"collectd_*\"))\n\tec.DeleteIndex(string(\"ceilometer_*\"))\n\tec.DeleteIndex(string(\"generic_*\"))\n}", "func (o *DocSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := DocSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), docPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `doc`.* FROM `doc` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, docPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in DocSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *SmallblogSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := SmallblogSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), smallblogPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `smallblog`.* FROM `smallblog` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, smallblogPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in SmallblogSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *AuthSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tauths := AuthSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), authPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"auths\\\".* FROM \\\"auths\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, authPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&auths)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in AuthSlice\")\n\t}\n\n\t*o = auths\n\n\treturn nil\n}", "func (b *QueryBuilder) Load() []map[string]interface{} {\n\treturn nil\n}", "func (o *SourceSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tsources := SourceSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), sourcePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"sources\\\".* FROM \\\"sources\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, sourcePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&sources)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mdbmdbmodels: unable to reload all in SourceSlice\")\n\t}\n\n\t*o = sources\n\n\treturn nil\n}", "func (o *CvtermsynonymSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tcvtermsynonyms := CvtermsynonymSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cvtermsynonymPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"SELECT \\\"cvtermsynonym\\\".* FROM \\\"cvtermsynonym\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, cvtermsynonymPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(*o)*len(cvtermsynonymPrimaryKeyColumns), 1, len(cvtermsynonymPrimaryKeyColumns)),\n\t)\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&cvtermsynonyms)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to reload all in CvtermsynonymSlice\")\n\t}\n\n\t*o = cvtermsynonyms\n\n\treturn nil\n}", "func (o *LatencySlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := LatencySlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), latencyPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"latencies\\\".* FROM \\\"latencies\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, latencyPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in LatencySlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *VendorSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := VendorSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), vendorPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `vendors`.* FROM `vendors` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, vendorPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in VendorSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (p *ThriftHiveMetastoreClient) GetIndexes(ctx context.Context, db_name string, tbl_name string, max_indexes int16) (r []*Index, err error) {\n var _args114 ThriftHiveMetastoreGetIndexesArgs\n _args114.DbName = db_name\n _args114.TblName = tbl_name\n _args114.MaxIndexes = max_indexes\n var _result115 ThriftHiveMetastoreGetIndexesResult\n if err = p.Client_().Call(ctx, \"get_indexes\", &_args114, &_result115); err != nil {\n return\n }\n switch {\n case _result115.O1!= nil:\n return r, _result115.O1\n case _result115.O2!= nil:\n return r, _result115.O2\n }\n\n return _result115.GetSuccess(), nil\n}", "func spansForAllRestoreTableIndexes(\n\tcodec keys.SQLCodec, tables []catalog.TableDescriptor, revs []BackupManifest_DescriptorRevision,\n) []roachpb.Span {\n\n\tadded := make(map[tableAndIndex]bool, len(tables))\n\tsstIntervalTree := interval.NewTree(interval.ExclusiveOverlapper)\n\tfor _, table := range tables {\n\t\t// We only import spans for physical tables.\n\t\tif !table.IsPhysicalTable() {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, index := range table.ActiveIndexes() {\n\t\t\tif err := sstIntervalTree.Insert(intervalSpan(table.IndexSpan(codec, index.GetID())), false); err != nil {\n\t\t\t\tpanic(errors.NewAssertionErrorWithWrappedErrf(err, \"IndexSpan\"))\n\t\t\t}\n\t\t\tadded[tableAndIndex{tableID: table.GetID(), indexID: index.GetID()}] = true\n\t\t}\n\t}\n\t// If there are desc revisions, ensure that we also add any index spans\n\t// in them that we didn't already get above e.g. indexes or tables that are\n\t// not in latest because they were dropped during the time window in question.\n\tfor _, rev := range revs {\n\t\t// If the table was dropped during the last interval, it will have\n\t\t// at least 2 revisions, and the first one should have the table in a PUBLIC\n\t\t// state. We want (and do) ignore tables that have been dropped for the\n\t\t// entire interval. DROPPED tables should never later become PUBLIC.\n\t\t// TODO(pbardea): Consider and test the interaction between revision_history\n\t\t// backups and OFFLINE tables.\n\t\trawTbl, _, _, _ := descpb.FromDescriptor(rev.Desc)\n\t\tif rawTbl != nil && rawTbl.State != descpb.DescriptorState_DROP {\n\t\t\ttbl := tabledesc.NewBuilder(rawTbl).BuildImmutableTable()\n\t\t\t// We only import spans for physical tables.\n\t\t\tif !tbl.IsPhysicalTable() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, idx := range tbl.ActiveIndexes() {\n\t\t\t\tkey := tableAndIndex{tableID: tbl.GetID(), indexID: idx.GetID()}\n\t\t\t\tif !added[key] {\n\t\t\t\t\tif err := sstIntervalTree.Insert(intervalSpan(tbl.IndexSpan(codec, idx.GetID())), false); err != nil {\n\t\t\t\t\t\tpanic(errors.NewAssertionErrorWithWrappedErrf(err, \"IndexSpan\"))\n\t\t\t\t\t}\n\t\t\t\t\tadded[key] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tvar spans []roachpb.Span\n\t_ = sstIntervalTree.Do(func(r interval.Interface) bool {\n\t\tspans = append(spans, roachpb.Span{\n\t\t\tKey: roachpb.Key(r.Range().Start),\n\t\t\tEndKey: roachpb.Key(r.Range().End),\n\t\t})\n\t\treturn false\n\t})\n\treturn spans\n}", "func (t *TableStruct) All(limit ...int) (data map[int]map[string]string, err error) {\n\tif t == nil {\n\t\terr = fmt.Errorf(\"%s\", \"Requested table does not exist\")\n\t\treturn\n\t}\n\n\tvar doc map[string]string\n\tdata = make(map[int]map[string]string)\n\tl := t.IndexNum\n\tif len(limit) != 0 && limit[0] <= t.IndexNum {\n\t\tl = limit[0]\n\t}\n\n\tfor id := 0; id < l; id++ {\n\t\tdoc, err = t.Read(id)\n\t\tif empty(doc) {\n\t\t\tcontinue\n\t\t}\n\t\tdata[id] = doc\n\t}\n\treturn\n}", "func (o *HoldenAtSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := HoldenAtSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), holdenAtPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"HoldenAt\\\".* FROM \\\"HoldenAt\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, holdenAtPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in HoldenAtSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (c *Client) LoadAndParseAll() ([]*RouteInfo, error) {\n\tresponse, err := c.etcd.Get(c.routesRoot, false, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata, etcdIndex := c.iterateDefs(response.Node, 0)\n\tif response.EtcdIndex > etcdIndex {\n\t\tetcdIndex = response.EtcdIndex\n\t}\n\n\tc.etcdIndex = etcdIndex\n\treturn parseRoutes(data), nil\n}", "func (indexStore *IndexStore) InitIndex() {\n\tdocs := indexStore.db.getAllDocs()\n\tuniqueIndexes := make(map[string]int)\n\ti := 0\n\tfor _, doc := range docs {\n\t\tif _, present := indexStore.store[doc.Index]; !present {\n\t\t\tindexStore.NewIndex(doc.Index)\n\t\t}\n\t\tindexStore.AddDocument(doc.Index, doc.Title, doc.Contents, doc.Id)\n\t\tuniqueIndexes[doc.Index] = 1\n\n\t\tif i%50 == 0 {\n\t\t\tfmt.Printf(\"%v documents indexed\\n\", i)\n\t\t}\n\t\ti++\n\t}\n\n\tfor index := range uniqueIndexes {\n\t\tindexStore.UpdateIndex(index)\n\t}\n}", "func LoadAll(ctx context.Context, cfg Config) ([]*Person, error) {\n\tdb, err := getDB(cfg)\n\tif err != nil {\n\t\tcfg.Logger().Error(\"failed to get DB connection. err: %s\", err)\n\t\treturn nil, err\n\t}\n\n\t// set latency budget for the database call\n\tsubCtx, cancel := context.WithTimeout(ctx, 1*time.Second)\n\tdefer cancel()\n\n\t// perform DB select\n\trows, err := db.QueryContext(subCtx, sqlLoadAll)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\t_ = rows.Close()\n\t}()\n\n\tvar out []*Person\n\n\tfor rows.Next() {\n\t\t// retrieve columns and populate the person object\n\t\trecord, err := populatePerson(rows.Scan)\n\t\tif err != nil {\n\t\t\tcfg.Logger().Error(\"failed to convert query result. err: %s\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tout = append(out, record)\n\t}\n\n\tif len(out) == 0 {\n\t\tcfg.Logger().Warn(\"no people found in the database.\")\n\t\treturn nil, ErrNotFound\n\t}\n\n\treturn out, nil\n}", "func CreateAllIndexes() error {\n\terr := questionAnswerDAO.CreateIndexes()\n\n\treturn err\n}", "func (o *FeatureCvtermDbxrefSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tfeatureCvtermDbxrefs := FeatureCvtermDbxrefSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), featureCvtermDbxrefPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"SELECT \\\"feature_cvterm_dbxref\\\".* FROM \\\"feature_cvterm_dbxref\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, featureCvtermDbxrefPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(*o)*len(featureCvtermDbxrefPrimaryKeyColumns), 1, len(featureCvtermDbxrefPrimaryKeyColumns)),\n\t)\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&featureCvtermDbxrefs)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to reload all in FeatureCvtermDbxrefSlice\")\n\t}\n\n\t*o = featureCvtermDbxrefs\n\n\treturn nil\n}", "func (b *Bolt) LoadAll(data interface{}) error {\n\n\tbuf := &bytes.Buffer{}\n\terr := b.client.View(func(tx *bolt.Tx) error {\n\t\tbkt := tx.Bucket([]byte(b.bucket))\n\t\tbuf.WriteByte('[')\n\t\tif bkt != nil {\n\t\t\tfirst := true\n\t\t\tif err := bkt.ForEach(func(_, v []byte) error {\n\t\t\t\tif len(v) > 0 {\n\t\t\t\t\tif first {\n\t\t\t\t\t\tfirst = false\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbuf.WriteByte(',')\n\t\t\t\t\t}\n\n\t\t\t\t\tbuf.Write(v)\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t}\n\t\tbuf.WriteByte(']')\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Printf(\"Buffer: %s\\n\", buf.Bytes())\n\tif err = json.Unmarshal(buf.Bytes(), data); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (o *UtxoSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := UtxoSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), utxoPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"utxo\\\".* FROM \\\"utxo\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, utxoPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in UtxoSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (s *shard) initIndexDatabase() error {\n\tvar err error\n\tstoreOption := kv.DefaultStoreOption(filepath.Join(s.path, indexParentDir))\n\ts.indexStore, err = newKVStoreFunc(storeOption.Path, storeOption)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.forwardFamily, err = s.indexStore.CreateFamily(\n\t\tforwardIndexDir,\n\t\tkv.FamilyOption{\n\t\t\tCompactThreshold: 0,\n\t\t\tMerger: string(invertedindex.SeriesForwardMerger)})\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.invertedFamily, err = s.indexStore.CreateFamily(\n\t\tinvertedIndexDir,\n\t\tkv.FamilyOption{\n\t\t\tCompactThreshold: 0,\n\t\t\tMerger: string(invertedindex.SeriesInvertedMerger)})\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.indexDB, err = newIndexDBFunc(\n\t\tcontext.TODO(),\n\t\tfilepath.Join(s.path, metaDir),\n\t\ts.metadata, s.forwardFamily,\n\t\ts.invertedFamily)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (d *Dataset) Indexes() []string {\n\t//grab indexes\n\tvar indexes []string\n\n\tindexFiles, err := ioutil.ReadDir(filepath.Join(path.Dir(d.path), \".gitdb/index/\", d.Name()))\n\tif err != nil {\n\t\treturn indexes\n\t}\n\n\tfor _, indexFile := range indexFiles {\n\t\tindexes = append(indexes, strings.TrimSuffix(indexFile.Name(), \".json\"))\n\t}\n\n\treturn indexes\n}", "func Initialize(db *sql.DB, Schema schema.DBSchema) {\n\tfor table, schema := range Schema {\n\t\t// fmt.Println(db.QueryRow(`DROP TABLE pages cascade;`))\n\t\tfor _, scheme := range schema {\n\t\t\tif debugging {\n\t\t\t\tfmt.Printf(\"\\ndb.QueryRow: %s:\\n%s\\n\", table, scheme)\n\t\t\t}\n\t\t\t_, err := db.Exec(scheme)\n\t\t\tif err != nil {\n\t\t\t\tpanic(fmt.Sprintf(\"%v\", err))\n\t\t\t}\n\t\t}\n\t}\n}", "func (o *NodeSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := NodeSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), nodePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"node\\\".* FROM \\\"node\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, nodePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in NodeSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (s *shard) initIndexDatabase() error {\n\tvar err error\n\tstoreOption := kv.DefaultStoreOption(filepath.Join(s.path, indexParentDir))\n\ts.indexStore, err = newKVStoreFunc(storeOption.Path, storeOption)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.forwardFamily, err = s.indexStore.CreateFamily(\n\t\tforwardIndexDir,\n\t\tkv.FamilyOption{\n\t\t\tCompactThreshold: 0,\n\t\t\tMerger: string(tagindex.SeriesForwardMerger)})\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.invertedFamily, err = s.indexStore.CreateFamily(\n\t\tinvertedIndexDir,\n\t\tkv.FamilyOption{\n\t\t\tCompactThreshold: 0,\n\t\t\tMerger: string(tagindex.SeriesInvertedMerger)})\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.indexDB, err = newIndexDBFunc(\n\t\tcontext.TODO(),\n\t\tfilepath.Join(s.path, metaDir),\n\t\ts.metadata, s.forwardFamily,\n\t\ts.invertedFamily)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func LoadShards(dataDir string, walDir string, database string, retentionPolicy string, shardFilter string) ([]ShardInfo, error) {\n\tdbDirs, err := ioutil.ReadDir(dataDir)\n\tvar shards []ShardInfo\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, db := range dbDirs {\n\t\tdbPath := filepath.Join(dataDir, db.Name())\n\t\tif !db.IsDir() {\n\t\t\tlog.Println(\"Skipping database directory\")\n\t\t\tcontinue\n\t\t}\n\n\t\tif database != \"\" && database != db.Name() {\n\t\t\tcontinue\n\t\t}\n\n\t\trpDirs, err := ioutil.ReadDir(dbPath)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, rp := range rpDirs {\n\t\t\trpPath := filepath.Join(dataDir, db.Name(), rp.Name())\n\t\t\tif !rp.IsDir() {\n\t\t\t\tlog.Println(\"Skipping retention policy directory\")\n\t\t\t}\n\n\t\t\tif rp.Name() == _seriesFileDirectory {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif retentionPolicy != \"\" && retentionPolicy != rp.Name() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tshardDirs, err := ioutil.ReadDir(rpPath)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tfor _, sh := range shardDirs {\n\t\t\t\tif sh.Name() == _seriesFileDirectory {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif shardFilter != \"\" && shardFilter != sh.Name() {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tshPath := filepath.Join(dataDir, db.Name(), rp.Name(), sh.Name())\n\t\t\t\twalPath := filepath.Join(walDir, db.Name(), rp.Name(), sh.Name())\n\n\t\t\t\tshardID, err := strconv.ParseUint(sh.Name(), 10, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"invalid shard ID found at path '%s'\", shPath)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tlog.Printf(\"Found shard '%s' (%d) with WAL '%s'\\n\", shPath, shardID, walPath)\n\n\t\t\t\tfieldsIndexPath := filepath.Join(shPath, _fieldIndexFileName)\n\t\t\t\tfieldsIndex, err := tsdb.NewMeasurementFieldSet(fieldsIndexPath)\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\ttsmFiles, err := filepath.Glob(filepath.Join(shPath, fmt.Sprintf(\"*.%s\", tsm1.TSMFileExtension)))\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\twalFiles, err := filepath.Glob(filepath.Join(walPath, fmt.Sprintf(\"%s*.%s\", tsm1.WALFilePrefix, tsm1.WALFileExtension)))\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\tshardInfo := ShardInfo{\n\t\t\t\t\tPath: shPath,\n\t\t\t\t\tID: shardID,\n\t\t\t\t\tDatabase: db.Name(),\n\t\t\t\t\tRetentionPolicy: rp.Name(),\n\t\t\t\t\tTsmFiles: tsmFiles,\n\t\t\t\t\tFieldsIndex: fieldsIndex,\n\t\t\t\t\tWalFiles: walFiles,\n\t\t\t\t}\n\n\t\t\t\tshards = append(shards, shardInfo)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn shards, nil\n}", "func createIndexes(db *sql.DB, table string) error {\n\tindexes := []string{}\n\n\tswitch table {\n\tcase \"dfp\":\n\t\tindexes = []string{\n\t\t\t\"CREATE INDEX IF NOT EXISTS dfp_metrics ON dfp (CODE, ID_CIA, YEAR, VL_CONTA);\",\n\t\t\t\"CREATE INDEX IF NOT EXISTS dfp_year_ver ON dfp (ID_CIA, YEAR, VERSAO);\",\n\t\t}\n\tcase \"itr\":\n\t\tindexes = []string{\n\t\t\t\"CREATE INDEX IF NOT EXISTS itr_metrics ON itr (CODE, ID_CIA, YEAR, VL_CONTA);\",\n\t\t\t\"CREATE INDEX IF NOT EXISTS itr_quarter_ver ON itr (ID_CIA, DT_FIM_EXERC, VERSAO);\",\n\t\t}\n\tcase \"stock_quotes\":\n\t\tindexes = []string{\n\t\t\t\"CREATE UNIQUE INDEX IF NOT EXISTS stock_quotes_stockdate ON stock_quotes (stock, date);\",\n\t\t}\n\tcase \"fii_dividends\":\n\t\tindexes = []string{\n\t\t\t\"CREATE UNIQUE INDEX IF NOT EXISTS fii_dividends_pk ON fii_dividends (trading_code, base_date);\",\n\t\t}\n\t}\n\n\tfor _, idx := range indexes {\n\t\t_, err := db.Exec(idx)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"erro ao criar índice\")\n\t\t}\n\t}\n\n\treturn nil\n}", "func (w *WorkflowInstances) LoadAll(opt *db.Options) error {\n\tif err := db.SelectStruct(constants.TableCoreBPMInstances, w, opt); err != nil {\n\t\treturn customerror.New(http.StatusInternalServerError, \"workflow instances load\", err.Error())\n\t}\n\treturn nil\n}", "func (osm *ObjectStoreMapper) Load(src io.Reader) (*types.Database, error) {\n\t// XXX needs refactor\n\traw, err := osm.store.Read(src)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tschemata, ok := raw[schemataTableName]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"missing schema table\")\n\t}\n\t// field index is non deterministic which will lead to random output\n\t// we could have another attribute for \"_presentation\" which contains\n\t// column order and widths\n\tfieldsByTable := map[string][]string{}\n\tprimariesByTable := map[string]string{}\n\tconstructorsByTable := map[string](map[string]types.FieldValueConstructor){}\n\tfeaturesByColumnByTable := map[string](map[string](map[string]interface{})){}\n\tfor name, schema := range schemata {\n\t\tparts := strings.Split(name, \".\")\n\t\tif len(parts) != 2 {\n\t\t\treturn nil, fmt.Errorf(\"invalid column name: %s\", name)\n\t\t}\n\t\ttable := parts[0]\n\t\tcolumn := parts[1]\n\t\t// TODO schema validation outside of loop -- this is inefficient\n\t\tfieldTypeRaw, ok := schema[\"type\"]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"missing type for %s.%s\", table, column)\n\t\t}\n\t\tfieldType, ok := fieldTypeRaw.(string)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"invalid type %#v\", fieldTypeRaw)\n\t\t}\n\t\tif strings.HasPrefix(fieldType, \"dynamic.\") {\n\t\t\t// TODO implement dymanic columns\n\t\t\t// ignoring for now\n\t\t\tcontinue\n\t\t}\n\t\tif primary, ok := schema[\"primary\"]; ok {\n\t\t\tif primaryB, ok := primary.(bool); ok && primaryB {\n\t\t\t\tif currentPrimary, ok := primariesByTable[table]; ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Duplicate primary keys for %s: %s %s\", table, currentPrimary, column)\n\t\t\t\t}\n\t\t\t\tprimariesByTable[table] = column\n\t\t\t}\n\t\t}\n\t\tvar constructor types.FieldValueConstructor\n\t\tif strings.HasPrefix(fieldType, \"foreign.\") {\n\t\t\t// TODO(rabrams) double check scoping of this variable\n\t\t\t// also would be good to validate foriegn values\n\t\t\ttable := fieldType[len(\"foreign.\"):]\n\t\t\tconstructor = func(i interface{}, features map[string]interface{}) (types.Entry, error) {\n\t\t\t\tif features == nil {\n\t\t\t\t\tfeatures = map[string]interface{}{}\n\t\t\t\t}\n\t\t\t\tfeatures[\"table\"] = table\n\t\t\t\treturn types.NewForeignKey(i, features)\n\t\t\t}\n\t\t} else if strings.HasPrefix(fieldType, \"foreigns.\") {\n\t\t\t// TODO(rabrams) double check scoping of this variable\n\t\t\t// also would be good to validate foriegn values\n\t\t\ttable := fieldType[len(\"foreigns.\"):]\n\t\t\tconstructor = func(i interface{}, features map[string]interface{}) (types.Entry, error) {\n\t\t\t\tif features == nil {\n\t\t\t\t\tfeatures = map[string]interface{}{}\n\t\t\t\t}\n\t\t\t\tfeatures[\"table\"] = table\n\t\t\t\treturn types.NewForeignList(i, features)\n\t\t\t}\n\t\t} else {\n\t\t\tconstructor, ok = constructors[fieldType]\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid type '%s'\", fieldType)\n\t\t\t}\n\t\t}\n\t\tbyTable, ok := fieldsByTable[table]\n\t\tif !ok {\n\t\t\tfieldsByTable[table] = []string{column}\n\t\t\tconstructorsByTable[table] = map[string]types.FieldValueConstructor{\n\t\t\t\tcolumn: constructor,\n\t\t\t}\n\t\t\tfeaturesByColumnByTable[table] = map[string](map[string]interface{}){}\n\t\t} else {\n\t\t\tfieldsByTable[table] = append(byTable, column)\n\t\t\tconstructorsByTable[table][column] = constructor\n\t\t}\n\t\tfeatures := map[string]interface{}{}\n\t\tfeaturesUncast, ok := schema[\"features\"]\n\t\tif ok {\n\t\t\tfeatures, ok = featuresUncast.(map[string]interface{})\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid type for `features`\")\n\t\t\t}\n\t\t}\n\t\tfeaturesByColumnByTable[table][column] = features\n\t}\n\n\tindexMap := map[string]int{}\n\tfor table, byTable := range fieldsByTable {\n\t\tsort.Slice(byTable, func(i, j int) bool { return byTable[i] < byTable[j] })\n\t\tfor index, column := range byTable {\n\t\t\tindexMap[fmt.Sprintf(\"%s.%s\", table, column)] = index\n\t\t}\n\t\tif _, ok := primariesByTable[table]; !ok {\n\t\t\treturn nil, fmt.Errorf(\"No primary key for table: %s\", table)\n\t\t}\n\t}\n\n\tdelete(raw, schemataTableName)\n\tdb := &types.Database{\n\t\tSchemata: schemata,\n\t\tTables: map[string]*types.Table{},\n\t}\n\tfor name, encoded := range raw {\n\t\tprimary, ok := primariesByTable[name]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"Unknown table: %s\", name)\n\t\t}\n\t\t// TODO use a constructor and Inserts -- that way the able can map\n\t\t// columns by name\n\t\ttable := types.NewTable(fieldsByTable[name], map[string][]types.Entry{}, primary, constructorsByTable[name], featuresByColumnByTable[name])\n\t\tallFields := fieldsByTable[name]\n\n\t\tdb.Tables[name] = table\n\t\tfor pk, fields := range encoded {\n\t\t\trow := make([]types.Entry, len(fieldsByTable[name]))\n\t\t\ttable.Entries[pk] = row\n\t\t\tfields[primary] = pk\n\t\t\tfor _, column := range allFields {\n\t\t\t\tvalue := fields[column]\n\t\t\t\tfullName := fmt.Sprintf(\"%s.%s\", name, column)\n\t\t\t\tindex, ok := indexMap[fullName]\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unknown column: %s\", fullName)\n\t\t\t\t}\n\t\t\t\tconstructor := constructorsByTable[name][column]\n\n\t\t\t\ttypedVal, err := constructor(value, featuresByColumnByTable[name][column])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"failed to init %s.%s for %s: %s\", name, column, pk, err)\n\t\t\t\t}\n\t\t\t\trow[index] = typedVal\n\t\t\t}\n\t\t}\n\t}\n\treturn db, nil\n}", "func (o *CMFTurntableSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := CMFTurntableSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cmfTurntablePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `cmf_turntable`.* FROM `cmf_turntable` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, cmfTurntablePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in CMFTurntableSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *AuthUserSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tauthUsers := AuthUserSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), authUserPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"SELECT `auth_user`.* FROM `auth_user` WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, authUserPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(*o)*len(authUserPrimaryKeyColumns), 1, len(authUserPrimaryKeyColumns)),\n\t)\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&authUsers)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in AuthUserSlice\")\n\t}\n\n\t*o = authUsers\n\n\treturn nil\n}", "func addAllFieldIndexes(ctx context.Context, indexer client.FieldIndexer) error {\n\tif err := indexer.IndexField(ctx, &gardencorev1beta1.Project{}, gardencore.ProjectNamespace, func(obj client.Object) []string {\n\t\tproject, ok := obj.(*gardencorev1beta1.Project)\n\t\tif !ok {\n\t\t\treturn []string{\"\"}\n\t\t}\n\t\tif project.Spec.Namespace == nil {\n\t\t\treturn []string{\"\"}\n\t\t}\n\t\treturn []string{*project.Spec.Namespace}\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"failed to add indexer to Project Informer: %w\", err)\n\t}\n\n\tif err := indexer.IndexField(ctx, &gardencorev1beta1.Shoot{}, gardencore.ShootSeedName, func(obj client.Object) []string {\n\t\tshoot, ok := obj.(*gardencorev1beta1.Shoot)\n\t\tif !ok {\n\t\t\treturn []string{\"\"}\n\t\t}\n\t\tif shoot.Spec.SeedName == nil {\n\t\t\treturn []string{\"\"}\n\t\t}\n\t\treturn []string{*shoot.Spec.SeedName}\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"failed to add indexer to Shoot Informer: %w\", err)\n\t}\n\n\tif err := indexer.IndexField(ctx, &seedmanagementv1alpha1.ManagedSeed{}, seedmanagement.ManagedSeedShootName, func(obj client.Object) []string {\n\t\tms, ok := obj.(*seedmanagementv1alpha1.ManagedSeed)\n\t\tif !ok {\n\t\t\treturn []string{\"\"}\n\t\t}\n\t\tif ms.Spec.Shoot == nil {\n\t\t\treturn []string{\"\"}\n\t\t}\n\t\treturn []string{ms.Spec.Shoot.Name}\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"failed to add indexer to ManagedSeed Informer: %w\", err)\n\t}\n\n\treturn nil\n}", "func GetIndexesFromDB(client *mongo.Client, dbName string) string {\n\tvar err error\n\tvar cur *mongo.Cursor\n\tvar icur *mongo.Cursor\n\tvar scur *mongo.Cursor\n\tvar buffer bytes.Buffer\n\tvar ctx = context.Background()\n\t// var pipeline = mongo.Pipeline{{{Key: \"$indexStats\", Value: bson.M{}}}}\n\tvar pipeline = MongoPipeline(`{\"$indexStats\": {}}`)\n\tif cur, err = client.Database(dbName).ListCollections(ctx, bson.M{}); err != nil {\n\t\treturn err.Error()\n\t}\n\tdefer cur.Close(ctx)\n\n\tfor cur.Next(ctx) {\n\t\tvar elem = bson.M{}\n\t\tif err = cur.Decode(&elem); err != nil {\n\t\t\tfmt.Println(\"0.1\", err)\n\t\t\tcontinue\n\t\t}\n\t\tcoll := fmt.Sprintf(\"%v\", elem[\"name\"])\n\t\tcollType := fmt.Sprintf(\"%v\", elem[\"type\"])\n\t\tif strings.Index(coll, \"system.\") == 0 || (elem[\"type\"] != nil && collType != \"collection\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tbuffer.WriteString(\"\\n\")\n\t\tbuffer.WriteString(dbName)\n\t\tbuffer.WriteString(\".\")\n\t\tbuffer.WriteString(coll)\n\t\tbuffer.WriteString(\":\\n\")\n\n\t\tif scur, err = client.Database(dbName).Collection(coll).Aggregate(ctx, pipeline); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tvar indexStats = []bson.M{}\n\t\tfor scur.Next(ctx) {\n\t\t\tvar result = bson.M{}\n\t\t\tif err = scur.Decode(&result); err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tindexStats = append(indexStats, result)\n\t\t}\n\t\tscur.Close(ctx)\n\t\tindexView := client.Database(dbName).Collection(coll).Indexes()\n\t\tif icur, err = indexView.List(ctx); err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tdefer icur.Close(ctx)\n\t\tvar list []IndexStatsDoc\n\n\t\tfor icur.Next(ctx) {\n\t\t\tvar idx = bson.D{}\n\t\t\tif err = icur.Decode(&idx); err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvar keys bson.D\n\t\t\tvar indexName string\n\t\t\tfor _, v := range idx {\n\t\t\t\tif v.Key == \"name\" {\n\t\t\t\t\tindexName = v.Value.(string)\n\t\t\t\t} else if v.Key == \"key\" {\n\t\t\t\t\tkeys = v.Value.(bson.D)\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar strbuf bytes.Buffer\n\t\t\tfor n, value := range keys {\n\t\t\t\tif n == 0 {\n\t\t\t\t\tstrbuf.WriteString(\"{ \")\n\t\t\t\t}\n\t\t\t\tstrbuf.WriteString(value.Key + \": \" + fmt.Sprint(value.Value))\n\t\t\t\tif n == len(keys)-1 {\n\t\t\t\t\tstrbuf.WriteString(\" }\")\n\t\t\t\t} else {\n\t\t\t\t\tstrbuf.WriteString(\", \")\n\t\t\t\t}\n\t\t\t}\n\t\t\to := IndexStatsDoc{Key: strbuf.String()}\n\t\t\to.EffectiveKey = strings.Replace(o.Key[:len(o.Key)-2], \": -1\", \": 1\", -1)\n\t\t\to.Usage = []UsageDoc{}\n\t\t\tfor _, result := range indexStats {\n\t\t\t\tif result[\"name\"].(string) == indexName {\n\t\t\t\t\tdoc := result[\"accesses\"].(bson.M)\n\t\t\t\t\thost := result[\"host\"].(string)\n\t\t\t\t\tb, _ := bson.Marshal(doc)\n\t\t\t\t\tvar accesses UsageDoc\n\t\t\t\t\tbson.Unmarshal(b, &accesses)\n\t\t\t\t\taccesses.Hostname = host\n\t\t\t\t\to.Usage = append(o.Usage, accesses)\n\t\t\t\t}\n\t\t\t}\n\t\t\tlist = append(list, o)\n\t\t}\n\t\ticur.Close(ctx)\n\t\tsort.Slice(list, func(i, j int) bool { return (list[i].EffectiveKey <= list[j].EffectiveKey) })\n\t\tfor i, o := range list {\n\t\t\tfont := \"\\x1b[0m \"\n\t\t\tif o.Key != \"{ _id: 1 }\" {\n\t\t\t\tif i < len(list)-1 && strings.Index(list[i+1].EffectiveKey, o.EffectiveKey) == 0 {\n\t\t\t\t\tfont = \"\\x1b[31;1mx \" // red\n\t\t\t\t} else {\n\t\t\t\t\tsum := 0\n\t\t\t\t\tfor _, u := range o.Usage {\n\t\t\t\t\t\tsum += u.Ops\n\t\t\t\t\t}\n\t\t\t\t\tif sum == 0 {\n\t\t\t\t\t\tfont = \"\\x1b[34;1m? \" // blue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuffer.WriteString(font + o.Key + \"\\x1b[0m\")\n\t\t\tfor _, u := range o.Usage {\n\t\t\t\tbuffer.Write([]byte(\"\\n\\thost: \" + u.Hostname + \", ops: \" + fmt.Sprintf(\"%v\", u.Ops) + \", since: \" + fmt.Sprintf(\"%v\", u.Since)))\n\t\t\t}\n\t\t\tbuffer.WriteString(\"\\n\")\n\t\t}\n\t}\n\treturn buffer.String()\n}", "func (o *InventorySlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tinventories := InventorySlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), inventoryPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `inventory`.* FROM `inventory` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, inventoryPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&inventories)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in InventorySlice\")\n\t}\n\n\t*o = inventories\n\n\treturn nil\n}", "func spansForAllTableIndexes(\n\ttables []*sqlbase.TableDescriptor, revs []BackupDescriptor_DescriptorRevision,\n) []roachpb.Span {\n\n\tadded := make(map[tableAndIndex]bool, len(tables))\n\tsstIntervalTree := interval.NewTree(interval.ExclusiveOverlapper)\n\tfor _, table := range tables {\n\t\tfor _, index := range table.AllNonDropIndexes() {\n\t\t\tif err := sstIntervalTree.Insert(intervalSpan(table.IndexSpan(index.ID)), false); err != nil {\n\t\t\t\tpanic(errors.Wrap(err, \"IndexSpan\"))\n\t\t\t}\n\t\t\tadded[tableAndIndex{tableID: table.ID, indexID: index.ID}] = true\n\t\t}\n\t}\n\t// If there are desc revisions, ensure that we also add any index spans\n\t// in them that we didn't already get above e.g. indexes or tables that are\n\t// not in latest because they were dropped during the time window in question.\n\tfor _, rev := range revs {\n\t\tif tbl := rev.Desc.GetTable(); tbl != nil {\n\t\t\tfor _, idx := range tbl.AllNonDropIndexes() {\n\t\t\t\tkey := tableAndIndex{tableID: tbl.ID, indexID: idx.ID}\n\t\t\t\tif !added[key] {\n\t\t\t\t\tif err := sstIntervalTree.Insert(intervalSpan(tbl.IndexSpan(idx.ID)), false); err != nil {\n\t\t\t\t\t\tpanic(errors.Wrap(err, \"IndexSpan\"))\n\t\t\t\t\t}\n\t\t\t\t\tadded[key] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tvar spans []roachpb.Span\n\t_ = sstIntervalTree.Do(func(r interval.Interface) bool {\n\t\tspans = append(spans, roachpb.Span{\n\t\t\tKey: roachpb.Key(r.Range().Start),\n\t\t\tEndKey: roachpb.Key(r.Range().End),\n\t\t})\n\t\treturn false\n\t})\n\treturn spans\n}", "func (d *Dao) All(ctx context.Context) ([]*region.Region, error) {\n\trows, err := d.get.Query(ctx)\n\tif err != nil {\n\t\tlog.Error(\"mysqlDB.Query error(%v)\", err)\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\tapps := []*region.Region{}\n\tfor rows.Next() {\n\t\ta := &region.Region{}\n\t\tif err = rows.Scan(&a.Rid, &a.Reid, &a.Name, &a.Logo, &a.Rank, &a.Goto, &a.Param, &a.Plat, &a.Area, &a.Build, &a.Condition, &a.URI, &a.Islogo, &a.Language); err != nil {\n\t\t\tlog.Error(\"row.Scan error(%v)\", err)\n\t\t\treturn nil, err\n\t\t}\n\t\tapps = append(apps, a)\n\t}\n\treturn apps, err\n}", "func (o *BlockSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := BlockSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), blockPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"block\\\".* FROM \\\"block\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, blockPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in BlockSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *EmailSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := EmailSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), emailPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `email`.* FROM `email` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, emailPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mysql: unable to reload all in EmailSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (this *AppCollection) loadAll(items []storage.Item) error {\n var err error\n\n for _, item := range items {\n this.load(item.(*storage.AppItem))\n }\n\n return err\n}", "func (o *APIKeySlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tapiKeys := APIKeySlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), apiKeyPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"api_keys\\\".* FROM \\\"api_keys\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, apiKeyPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&apiKeys)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in APIKeySlice\")\n\t}\n\n\t*o = apiKeys\n\n\treturn nil\n}", "func (o *OauthClientSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := OauthClientSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), oauthClientPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `oauth_clients`.* FROM `oauth_clients` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, oauthClientPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(nil, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in OauthClientSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *RepositorySlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := RepositorySlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), repositoryPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `repositories`.* FROM `repositories` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, repositoryPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in RepositorySlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *TreeSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := TreeSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), treePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"trees\\\".* FROM \\\"trees\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, treePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in TreeSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (i *Index) readEntireIndex(ctx context.Context, store Store) (map[string]map[string]struct{}, error) {\n\tkvs, err := consumeBucket(ctx, store, i.indexBucket)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tindex := map[string]map[string]struct{}{}\n\tfor _, kv := range kvs {\n\t\tfk, pk, err := indexKeyParts(kv[0])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif fkm, ok := index[string(fk)]; ok {\n\t\t\tfkm[string(pk)] = struct{}{}\n\t\t\tcontinue\n\t\t}\n\n\t\tindex[string(fk)] = map[string]struct{}{string(pk): {}}\n\t}\n\n\treturn index, nil\n}", "func (s *Storage) LoadAndIterate(file string, fn storage.IterationFunc) error {\n\tnewDB, err := openDB(file)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = iterate(newDB, s.bucket, fn)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.mux.Lock()\n\tdefer s.mux.Unlock()\n\n\toldDB := s.getDB()\n\ts.db.Store(newDB)\n\tif oldDB != nil {\n\t\toldDB.Close()\n\t}\n\treturn nil\n}", "func LoadAll(loader ValuesLoader) (Values, error) {\n\treturn nil, nil\n}", "func LoadAllEndpoints(endpoints []string) {\n\tfor _, ep := range endpoints {\n\t\tloadEndpoint(ep)\n\t}\n}", "func (s *SQLiteStore) loadAllResourcesForStack(stackname string) ([]Resource, error) {\n\tresources := make([]Resource, 0)\n\treturn resources, nil\n}", "func (o *VoteSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := VoteSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), votePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"vote\\\".* FROM \\\"vote\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, votePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in VoteSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func IndexOptionsAll() IndexOptions {\n\tresult := IndexOptions{\n\t\tPath: \"/\",\n\t\tRescan: true,\n\t\tConvert: true,\n\t}\n\n\treturn result\n}", "func LoadMany(db *sql.DB, query string, Kind interface{}, args ...interface{}) (interface{}, error) {\n\tt := reflect.TypeOf(Kind)\n\ts2 := reflect.Zero(reflect.SliceOf(t))\n\trows, err := db.Query(query, args...)\n\tif err == nil {\n\t\tfor rows.Next() {\n\t\t\tv := reflect.New(t)\n\t\t\tdest := sPtrs(v.Interface())\n\t\t\terr = rows.Scan(dest...)\n\t\t\ts2 = reflect.Append(s2, v.Elem())\n\t\t}\n\t}\n\trows.Close()\n\treturn s2.Interface(), err\n}", "func (o *StockCvtermSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tstockCvterms := StockCvtermSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), stockCvtermPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"SELECT \\\"stock_cvterm\\\".* FROM \\\"stock_cvterm\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, stockCvtermPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(*o)*len(stockCvtermPrimaryKeyColumns), 1, len(stockCvtermPrimaryKeyColumns)),\n\t)\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&stockCvterms)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to reload all in StockCvtermSlice\")\n\t}\n\n\t*o = stockCvterms\n\n\treturn nil\n}", "func (o *TaskSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := TaskSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), taskPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"tasks\\\".* FROM \\\"tasks\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, taskPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in TaskSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (g *GLTF) loadIndices(ai int) (math32.ArrayU32, error) {\n\n\treturn g.loadAccessorU32(ai, \"indices\", []string{SCALAR}, []int{UNSIGNED_BYTE, UNSIGNED_SHORT, UNSIGNED_INT}) // TODO verify that it's ELEMENT_ARRAY_BUFFER\n}", "func (o *OriginSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := OriginSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), originPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"origins\\\".* FROM \\\"origins\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, originPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in OriginSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (a *AmbientIndex) All() []*model.WorkloadInfo {\n\ta.mu.RLock()\n\tdefer a.mu.RUnlock()\n\tres := make([]*model.WorkloadInfo, 0, len(a.byPod))\n\t// byPod will not have any duplicates, so we can just iterate over that.\n\tfor _, wl := range a.byPod {\n\t\tres = append(res, wl)\n\t}\n\treturn res\n}", "func (o *AddressSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\taddresses := AddressSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), addressPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `address`.* FROM `address` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, addressPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&addresses)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sqlboiler: unable to reload all in AddressSlice\")\n\t}\n\n\t*o = addresses\n\n\treturn nil\n}", "func (o *InstrumentClassSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tinstrumentClasses := InstrumentClassSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), instrumentClassPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"instruments\\\".\\\"instrument_class\\\".* FROM \\\"instruments\\\".\\\"instrument_class\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, instrumentClassPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&instrumentClasses)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in InstrumentClassSlice\")\n\t}\n\n\t*o = instrumentClasses\n\n\treturn nil\n}", "func updateDBIndexes(mi *modelInfo) {\n\tadapter := adapters[db.DriverName()]\n\t// update column indexes\n\tfor colName, fi := range mi.fields.registryByJSON {\n\t\tif !fi.index {\n\t\t\tcontinue\n\t\t}\n\t\tif !adapter.indexExists(mi.tableName, fmt.Sprintf(\"%s_%s_index\", mi.tableName, colName)) {\n\t\t\tcreateColumnIndex(mi.tableName, colName)\n\t\t}\n\t}\n}", "func DBIndexer(db *sql.DB, dbPipe <-chan RollupState) {\n\n\tdbInsertMap := make(map[string]*bulkinsert.BulkInsert)\n\tfor data := range dbPipe {\n\t\ttableName := fmt.Sprintf(\"monitor_metrics_%s_%s\", data.granularity.windowName, data.msg.PluginName)\n\t\tcolumnNames, err := plugins.GetColumnsForTable(tableName, db)\n\t\tif len(columnNames) == 0 || err != nil {\n\t\t\tlog.Error().Err(err).Msgf(\"Table %s does not exist \", tableName)\n\t\t\tcontinue\n\t\t}\n\n\t\tif _, ok := dbInsertMap[tableName]; !ok { //New DB Bulk inserter\n\t\t\tdbInsertMap[tableName] = bulkinsert.NewBulkInsert(\n\t\t\t\tdb,\n\t\t\t\ttableName,\n\t\t\t\tdbConfigMap[data.granularity.windowName].maxBatchSize,\n\t\t\t\tdbConfigMap[data.granularity.windowName].maxBatchAge,\n\t\t\t\tcolumnNames)\n\t\t}\n\t\tmetricNames := []string{\n\t\t\t\"ConnectTimeAvg\",\n\t\t\t\"Es\",\n\t\t\t\"EsResponse\",\n\t\t\t\"EsTimeout\",\n\t\t\t\"FirstByteTimeAvg\",\n\t\t\t\"ResponseTimeAvg\",\n\t\t\t\"ResponseTimeMax\",\n\t\t\t\"ResponseTimeMin\",\n\t\t\t\"SizeAvg\",\n\t\t\t\"SpeedAvg\",\n\t\t}\n\t\tcolumnValues := metricsToString(metricNames,data.msg)\n\t\tif err := dbInsertMap[tableName].Insert(columnValues); err != nil {\n\t\t\tlog.Error().Err(err).Msgf(\"Error Inserting column values to table %s \", tableName)\n\t\t}\n\t}\n}", "func (o *TrainingCostSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := TrainingCostSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), trainingCostPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"training_costs\\\".* FROM \\\"training_costs\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, trainingCostPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in TrainingCostSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}" ]
[ "0.78944623", "0.68740505", "0.6471731", "0.603011", "0.59038955", "0.5777211", "0.57490975", "0.57390857", "0.56201786", "0.5588074", "0.54888165", "0.5481768", "0.5458776", "0.544559", "0.54259926", "0.5420168", "0.53962743", "0.5382967", "0.533865", "0.5331422", "0.53273255", "0.5322979", "0.529983", "0.5280305", "0.52790624", "0.52644837", "0.52631783", "0.5259709", "0.5248272", "0.5238153", "0.5237168", "0.52310604", "0.52144855", "0.520933", "0.52056783", "0.5202071", "0.5194381", "0.51941574", "0.51931417", "0.5186737", "0.51804566", "0.5173678", "0.51721865", "0.517038", "0.51567155", "0.5136257", "0.51208246", "0.5116519", "0.5107146", "0.5105347", "0.5104091", "0.50887483", "0.5087225", "0.507713", "0.5073162", "0.5058347", "0.5055203", "0.5049494", "0.50478387", "0.5029008", "0.50239205", "0.50235873", "0.5013463", "0.5010287", "0.50078034", "0.50019383", "0.500115", "0.499527", "0.49945933", "0.49900734", "0.49850315", "0.49719864", "0.4966477", "0.49553236", "0.49541983", "0.49518862", "0.49476272", "0.4938052", "0.49366733", "0.49346927", "0.49284276", "0.492005", "0.4912443", "0.49117893", "0.491178", "0.49095535", "0.49034396", "0.48996928", "0.48979133", "0.48929256", "0.48880675", "0.48809245", "0.48783833", "0.4875026", "0.4872441", "0.48722517", "0.48715737", "0.4869427", "0.48687625", "0.4866827" ]
0.790122
0
Save the given index (mapping and bitmap)
func (d *Driver) Save( ctx *sql.Context, i sql.Index, iter sql.PartitionIndexKeyValueIter, ) (err error) { start := time.Now() idx, ok := i.(*pilosaIndex) if !ok { return errInvalidIndexType.New(i) } if err := idx.index.Open(); err != nil { return err } defer idx.index.Close() idx.wg.Add(1) defer idx.wg.Done() var b = batch{ fields: make([]*pilosa.Field, len(idx.Expressions())), bitBatches: make([]*bitBatch, len(idx.Expressions())), } ctx.Context, idx.cancel = context.WithCancel(ctx.Context) processingFile := d.processingFilePath(i.Database(), i.Table(), i.ID()) if err := index.WriteProcessingFile( processingFile, []byte{processingFileOnSave}, ); err != nil { return err } pilosaIndex := idx.index var rows uint64 for { p, kviter, err := iter.Next() if err != nil { if err == io.EOF { break } return err } numRows, err := d.savePartition(ctx, p, kviter, idx, pilosaIndex, rows, &b) if err != nil { return err } rows += numRows } logrus.WithFields(logrus.Fields{ "duration": time.Since(start), "pilosa": b.timePilosa, "mapping": b.timeMapping, "rows": rows, "id": i.ID(), }).Debugf("finished pilosa indexing") return index.RemoveProcessingFile(processingFile) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func writeBitmap(file *os.File, index int64, bitMap []byte) {\n\tfile.Seek(index, 0)\n\t//Empezamos el proceso de guardar en binario la data en memoria del struct\n\tvar binaryDisc bytes.Buffer\n\tbinary.Write(&binaryDisc, binary.BigEndian, &bitMap)\n\twriteNextBytes(file, binaryDisc.Bytes())\n}", "func (p *Buffer) saveIndex(ptr unsafe.Pointer, idx uint) {\n\tif p.array_indexes == nil {\n\t\t// the 1st time we need to allocate\n\t\tp.array_indexes = make(map[unsafe.Pointer]uint)\n\t}\n\tp.array_indexes[ptr] = idx\n}", "func (index *ind) writeIndexFile() {\n\tif _, err := os.Stat(index.name); os.IsNotExist(err) {\n\t\tindexFile, err := os.Create(index.name)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t\tindexFile.Close()\n\t}\n\n\tb := new(bytes.Buffer)\n\te := gob.NewEncoder(b)\n\n\terr := e.Encode(index)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tioutil.WriteFile(index.name, b.Bytes(), 7777)\n}", "func (d *Driver) Save(\n\tctx *sql.Context,\n\ti sql.Index,\n\titer sql.IndexKeyValueIter,\n) (err error) {\n\tvar colID uint64\n\tstart := time.Now()\n\n\tidx, ok := i.(*pilosaIndex)\n\tif !ok {\n\t\treturn errInvalidIndexType.New(i)\n\t}\n\n\tprocessingFile := d.processingFilePath(idx.Database(), idx.Table(), idx.ID())\n\tif err = index.CreateProcessingFile(processingFile); err != nil {\n\t\treturn err\n\t}\n\n\t// Retrieve the pilosa schema\n\tschema, err := d.client.Schema()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create a pilosa index and frame objects in memory\n\tpilosaIndex, err := schema.Index(indexName(idx.Database(), idx.Table()))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.frames = make([]*pilosa.Frame, len(idx.Expressions()))\n\tfor i, e := range idx.Expressions() {\n\t\tfrm, err := pilosaIndex.Frame(frameName(idx.ID(), e))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// make sure we delete the index in every run before inserting, since there may\n\t\t// be previous data\n\t\tif err = d.client.DeleteFrame(frm); err != nil {\n\t\t\treturn errDeletePilosaFrame.New(frm.Name(), err)\n\t\t}\n\n\t\td.frames[i] = frm\n\t}\n\n\t// Make sure the index and frames exists on the server\n\terr = d.client.SyncSchema(schema)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Open mapping in create mode. After finishing the transaction is rolled\n\t// back unless all goes well and rollback value is changed.\n\trollback := true\n\tidx.mapping.openCreate(true)\n\tdefer func() {\n\t\tif rollback {\n\t\t\tidx.mapping.rollback()\n\t\t} else {\n\t\t\te := d.saveMapping(ctx, idx.mapping, colID, false)\n\t\t\tif e != nil && err == nil {\n\t\t\t\terr = e\n\t\t\t}\n\t\t}\n\n\t\tidx.mapping.close()\n\t}()\n\n\td.bitBatches = make([]*bitBatch, len(d.frames))\n\tfor i := range d.bitBatches {\n\t\td.bitBatches[i] = newBitBatch(sql.IndexBatchSize)\n\t}\n\n\tfor colID = uint64(0); err == nil; colID++ {\n\t\t// commit each batch of objects (pilosa and boltdb)\n\t\tif colID%sql.IndexBatchSize == 0 && colID != 0 {\n\t\t\td.saveBatch(ctx, idx.mapping, colID)\n\t\t}\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\n\t\tdefault:\n\t\t\tvar (\n\t\t\t\tvalues []interface{}\n\t\t\t\tlocation []byte\n\t\t\t)\n\t\t\tvalues, location, err = iter.Next()\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tfor i, frm := range d.frames {\n\t\t\t\tif values[i] == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\trowID, err := idx.mapping.getRowID(frm.Name(), values[i])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\td.bitBatches[i].Add(rowID, colID)\n\t\t\t}\n\t\t\terr = idx.mapping.putLocation(pilosaIndex.Name(), colID, location)\n\t\t}\n\t}\n\n\tif err != nil && err != io.EOF {\n\t\treturn err\n\t}\n\n\trollback = false\n\n\terr = d.savePilosa(ctx, colID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogrus.WithFields(logrus.Fields{\n\t\t\"duration\": time.Since(start),\n\t\t\"pilosa\": d.timePilosa,\n\t\t\"mapping\": d.timeMapping,\n\t\t\"rows\": colID,\n\t\t\"id\": i.ID(),\n\t}).Debugf(\"finished pilosa indexing\")\n\n\treturn index.RemoveProcessingFile(processingFile)\n}", "func save(object interface{}, c Configuration) error {\n\tfile, err := os.Create(c.StorageLocation + \"/index.gob\")\n\tif err == nil {\n\t\tencoder := gob.NewEncoder(file)\n\t\tencoder.Encode(object)\n\t} else {\n\t\tpanic(err)\n\t}\n\n\tfile.Close()\n\treturn err\n}", "func writeDumpIndex(filepath string, dumpInfo *blockDumpInfo) error {\n\tdumpInfoData, err := json.Marshal(dumpInfo)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn ioutil.WriteFile(filepath, dumpInfoData, 0666)\n}", "func saveIndex(repoIndex *index.Index, dir string) {\n\tindexPath := path.Join(dir, INDEX_NAME)\n\n\tfmtc.Printf(\"Saving index… \")\n\n\terr := jsonutil.Write(indexPath, repoIndex)\n\n\tif err != nil {\n\t\tfmtc.Println(\"{r}ERROR{!}\")\n\t\tprintErrorAndExit(\"Can't save index as %s: %v\", indexPath, err)\n\t}\n\n\tfmtc.Println(\"{g}DONE{!}\")\n}", "func SaveIndex(target string, source QueryList, verbose bool) {\n\tlogm(\"INFO\", fmt.Sprintf(\"saving index to %s...\", target), verbose)\n\tfile, err := os.Create(target)\n\tcheckResult(err)\n\tdefer file.Close()\n\n\tgr := gzip.NewWriter(file)\n\tdefer gr.Close()\n\n\tencoder := gob.NewEncoder(gr)\n\n\terr = encoder.Encode(source.Names)\n\tcheckResult(err)\n\tlogm(\"INFO\", fmt.Sprintf(\"%v sequence names saved\", len(source.Names)), verbose)\n\n\terr = encoder.Encode(source.SeedSize)\n\tcheckResult(err)\n\n\terr = encoder.Encode(source.Cgst)\n\tcheckResult(err)\n\n\t// save the index, but go has a size limit\n\tindexSize := len(source.Index)\n\terr = encoder.Encode(indexSize)\n\tcheckResult(err)\n\tlogm(\"INFO\", fmt.Sprintf(\"%v queries to save...\", indexSize), verbose)\n\n\tcount := 0\n\tfor key, value := range source.Index {\n\t\terr = encoder.Encode(key)\n\t\tcheckResult(err)\n\t\terr = encoder.Encode(value)\n\t\tcheckResult(err)\n\t\tcount++\n\t\tif count%10000 == 0 {\n\t\t\tlogm(\"INFO\", fmt.Sprintf(\"processing: saved %v items\", count), false)\n\t\t}\n\t}\n\n\tlogm(\"INFO\", fmt.Sprintf(\"saving index to %s: done\", target), verbose)\n}", "func WriteBitMap(path string, btes []byte, position int64) {\n\tfile, err := os.OpenFile(path, os.O_RDWR, os.ModePerm)\n\tif err != nil {\n\t\tlog.Println(\"[!] Error al abrir disco. \", err)\n\t\treturn\n\t}\n\tdefer file.Close()\n\t//Posición donde se inicia a escribir\n\tfile.Seek(position, 1)\n\tbts := &btes\n\t//Escritura del struct MBR\n\tvar bin bytes.Buffer\n\tbinary.Write(&bin, binary.BigEndian, bts)\n\tstate := writeBytes(file, bin.Bytes())\n\tif state {\n\t\t//fmt.Println(\"*** Se ha escrito en BitMap ***\")\n\t} else {\n\t\tfmt.Println(\"[!] Ha ocurrido un error al escribir en BitMap.\")\n\t}\n}", "func (ifile *Indexfile) Save(lfindex *Index) error {\n\tifile.Open(CREATE | WRITE_ONLY | APPEND)\n\tdefer ifile.Close()\n\t_, err := ifile.LockedWriteAt(lfindex.ToBytes(), 0)\n\treturn err\n}", "func (bitmap *bitmap) Set(index int) {\n\tbitmap.set(index, 1)\n}", "func indexWrite(key string, p *pkg) {\n\tlocker.Lock()\n\tdefer locker.Unlock()\n\n\tindexedPkgs[key] = p\n}", "func (i *index) Write(off uint32, pos uint64) error {\n\tif uint64(len(i.mmap)) < i.size+entWidth {\n\t\treturn io.EOF\n\t}\n\n\tenc.PutUint32(i.mmap[i.size:i.size+offWidth], off)\n\tenc.PutUint64(i.mmap[i.size+offWidth:i.size+entWidth], pos)\n\ti.size += uint64(entWidth)\n\treturn nil\n}", "func IndexWrite(x *suffixarray.Index, w io.Writer) error", "func (i *Index) saveMeta() error {\n\t// Marshal metadata.\n\tbuf, err := proto.Marshal(&internal.IndexMeta{\n\t\tKeys: i.keys,\n\t\tTrackExistence: i.trackExistence,\n\t})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"marshalling\")\n\t}\n\n\t// Write to meta file.\n\tif err := ioutil.WriteFile(filepath.Join(i.path, \".meta\"), buf, 0666); err != nil {\n\t\treturn errors.Wrap(err, \"writing\")\n\t}\n\n\treturn nil\n}", "func (w *Writer) writeIndex() (int64, error) {\n\tw.written = true\n\n\tbuf := new(bytes.Buffer)\n\tst := sst.NewWriter(buf)\n\n\tw.spaceIds.Sort()\n\n\t// For each defined space, we index the space's\n\t// byte offset in the file and the length in bytes\n\t// of all data in the space.\n\tfor _, spaceId := range w.spaceIds {\n\t\tb := new(bytes.Buffer)\n\n\t\tbinary.WriteInt64(b, w.spaceOffsets[spaceId])\n\t\tbinary.WriteInt64(b, w.spaceLengths[spaceId])\n\n\t\tif err := st.Set([]byte(spaceId), b.Bytes()); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tif err := st.Close(); err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn buf.WriteTo(w.file)\n}", "func (vectorizer *Vectorizer) indexMap(src Map) {\n\tfor _, key := range src.orderedKeys() {\n\t\telem := src[key]\n\t\tif vectorizer.indexes[key] == nil {\n\t\t\tvectorizer.indexes[key] = index{}\n\t\t}\n\t\tif vectorizer.indexes[key][elem] == 0 {\n\t\t\tvectorizer.indexes[key][elem] = vectorizer.nextID(key)\n\t\t}\n\t}\n}", "func WriteJSON(logger log.Logger, indexFn string, fn string) error {\n\tindexFile, err := fileutil.OpenMmapFile(indexFn)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"open mmap index file %s\", indexFn)\n\t}\n\tdefer runutil.CloseWithLogOnErr(logger, indexFile, \"close index cache mmap file from %s\", indexFn)\n\n\tb := realByteSlice(indexFile.Bytes())\n\tindexr, err := index.NewReader(b)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"open index reader\")\n\t}\n\tdefer runutil.CloseWithLogOnErr(logger, indexr, \"load index cache reader\")\n\n\t// We assume reader verified index already.\n\tsymbols, err := getSymbolTable(b)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf, err := os.Create(fn)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"create index cache file\")\n\t}\n\tdefer runutil.CloseWithLogOnErr(logger, f, \"index cache writer\")\n\n\tv := indexCache{\n\t\tVersion: indexr.Version(),\n\t\tCacheVersion: JSONVersion1,\n\t\tSymbols: symbols,\n\t\tLabelValues: map[string][]string{},\n\t}\n\n\t// Extract label value indices.\n\tlnames, err := indexr.LabelNames()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"read label indices\")\n\t}\n\tfor _, ln := range lnames {\n\t\tvals, err := indexr.LabelValues(ln)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"get label values\")\n\t\t}\n\t\tv.LabelValues[ln] = vals\n\t}\n\n\t// Extract postings ranges.\n\tpranges, err := indexr.PostingsRanges()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"read postings ranges\")\n\t}\n\tfor l, rng := range pranges {\n\t\tv.Postings = append(v.Postings, postingsRange{\n\t\t\tName: l.Name,\n\t\t\tValue: l.Value,\n\t\t\tStart: rng.Start,\n\t\t\tEnd: rng.End,\n\t\t})\n\t}\n\n\tif err := json.NewEncoder(f).Encode(&v); err != nil {\n\t\treturn errors.Wrap(err, \"encode file\")\n\t}\n\treturn nil\n}", "func writeBitacora(file *os.File, index int64, log *bitacora) {\n\tfile.Seek(index, 0)\n\t//Empezamos el proceso de guardar en binario la data en memoria del struct\n\tvar binaryDisc bytes.Buffer\n\tbinary.Write(&binaryDisc, binary.BigEndian, log)\n\twriteNextBytes(file, binaryDisc.Bytes())\n}", "func (g *Gpks) Backup(index string) error {\n\tfl, err := os.OpenFile(index, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer fl.Close()\n\tfor id, off := range g.sid {\n\t\tel := &pb3.Element{\n\t\t\tWtf: true, // string index\n\t\t\tSid: id, // Nid: 0\n\t\t\tPos: off,\n\t\t}\n\t\tbt, err := proto.Marshal(el)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = fl.Write(int_to_bytes(len(bt)))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = fl.Write(bt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tfor id, off := range g.nid {\n\t\tel := &pb3.Element{\n\t\t\tWtf: false, // int64 index\n\t\t\tNid: id, // Sid: \"\"\n\t\t\tPos: off,\n\t\t}\n\t\tbt, err := proto.Marshal(el)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = fl.Write(int_to_bytes(len(bt)))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = fl.Write(bt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (g Index) WriteIndex(file io.Writer) error {\n\tsort.Sort(ByPath(g.Objects))\n\ts := sha1.New()\n\tw := io.MultiWriter(file, s)\n\tbinary.Write(w, binary.BigEndian, g.fixedGitIndex)\n\tfor _, entry := range g.Objects {\n\t\tbinary.Write(w, binary.BigEndian, entry.FixedIndexEntry)\n\t\tbinary.Write(w, binary.BigEndian, []byte(entry.PathName))\n\t\tpadding := 8 - ((82 + len(entry.PathName) + 4) % 8)\n\t\tp := make([]byte, padding)\n\t\tbinary.Write(w, binary.BigEndian, p)\n\t}\n\tbinary.Write(w, binary.BigEndian, s.Sum(nil))\n\treturn nil\n}", "func savePageMemory_(index int) {\n\tsite := fmt.Sprintf(\"http://c.api.globo.com/news/%s.json\", ufs[index])\n\tfile, err := http.Get(site)\n\t//connection error\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t//get all data from website\n\tdataByte, err := ioutil.ReadAll(file.Body)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t//split the data\n\tdataSplit := split(dataByte)\n\tsession := connectionDB()\n\tdefer session.Close()\n\tc := session.DB(\"apidb\").C(\"news\")\n\tvar ufPage UfPage\n\tufPage.Uf = ufs[index]\n\tufPage.Pageuf = make([]Page, len(dataSplit))\n\tfor i := 0; i < len(dataSplit); i++ {\n\t\tufPage.Pageuf[i] = unMarshal([]byte(dataSplit[i]))\n\t}\n\t_, err = c.Upsert(bson.M{\"uf\": ufs[index]}, &ufPage)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func (i *Index) Write(off uint32, pos uint64) error {\n\tif uint64(len(i.mmap)) < i.size+entWidth {\n\t\treturn lib.Wrap(io.EOF, \"Not enough space to append index data\")\n\t}\n\n\tenc.PutUint32(i.mmap[i.size:i.size+offWidth], off)\n\tenc.PutUint64(i.mmap[i.size+offWidth:i.size+entWidth], pos)\n\n\ti.size += entWidth\n\n\treturn nil\n}", "func (w *exportWriter) writeIndex(index map[types.Object]uint64) {\n\ttype pkgObj struct {\n\t\tobj types.Object\n\t\tname string // qualified name; differs from obj.Name for type params\n\t}\n\t// Build a map from packages to objects from that package.\n\tpkgObjs := map[*types.Package][]pkgObj{}\n\n\t// For the main index, make sure to include every package that\n\t// we reference, even if we're not exporting (or reexporting)\n\t// any symbols from it.\n\tif w.p.localpkg != nil {\n\t\tpkgObjs[w.p.localpkg] = nil\n\t}\n\tfor pkg := range w.p.allPkgs {\n\t\tpkgObjs[pkg] = nil\n\t}\n\n\tfor obj := range index {\n\t\tname := w.p.exportName(obj)\n\t\tpkgObjs[obj.Pkg()] = append(pkgObjs[obj.Pkg()], pkgObj{obj, name})\n\t}\n\n\tvar pkgs []*types.Package\n\tfor pkg, objs := range pkgObjs {\n\t\tpkgs = append(pkgs, pkg)\n\n\t\tsort.Slice(objs, func(i, j int) bool {\n\t\t\treturn objs[i].name < objs[j].name\n\t\t})\n\t}\n\n\tsort.Slice(pkgs, func(i, j int) bool {\n\t\treturn w.exportPath(pkgs[i]) < w.exportPath(pkgs[j])\n\t})\n\n\tw.uint64(uint64(len(pkgs)))\n\tfor _, pkg := range pkgs {\n\t\tw.string(w.exportPath(pkg))\n\t\tw.string(pkg.Name())\n\t\tw.uint64(uint64(0)) // package height is not needed for go/types\n\n\t\tobjs := pkgObjs[pkg]\n\t\tw.uint64(uint64(len(objs)))\n\t\tfor _, obj := range objs {\n\t\t\tw.string(obj.name)\n\t\t\tw.uint64(index[obj.obj])\n\t\t}\n\t}\n}", "func (pal *CGBPalette) updateIndex(value byte) {\n\tpal.index = value & 0x3F\n\tpal.inc = bits.Test(value, 7)\n}", "func (bitmap *bitmap) set(index int, bit int) {\n\tif index >= bitmap.Size {\n\t\tpanic(\"index out of range\")\n\t}\n\n\tdiv, mod := index/8, index%8\n\tshift := byte(1 << uint(7-mod))\n\n\tbitmap.data[div] &= ^shift\n\tif bit > 0 {\n\t\tbitmap.data[div] |= shift\n\t}\n}", "func (x *Index) Write(w io.Writer) error", "func WriteIndex(index common.Index) error {\n\tbytes, err := json.Marshal(index)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = ioutil.WriteFile(indexCachePath, bytes, 0600)\n\treturn err\n}", "func writeSB(file *os.File, index int64, sb *superBoot) {\n\tfile.Seek(index, 0)\n\t//Empezamos el proceso de guardar en binario la data en memoria del struct\n\tvar binaryDisc bytes.Buffer\n\tbinary.Write(&binaryDisc, binary.BigEndian, sb)\n\twriteNextBytes(file, binaryDisc.Bytes())\n}", "func getBitmap(file *os.File, index int64, size int64) []byte {\n\tbitMap := make([]byte, size)\n\tfile.Seek(index, 0)\n\t//Se obtiene la data del archivo binarios\n\tdata := readNextBytes(file, size)\n\tbuffer := bytes.NewBuffer(data)\n\t//Se asigna al mbr declarado para leer la informacion de ese disco\n\terr := binary.Read(buffer, binary.BigEndian, &bitMap)\n\tif err != nil {\n\t\tlog.Fatal(\"binary.Read failed\", err)\n\t}\n\treturn bitMap\n}", "func (obj *LineFile) writeToIndexPage(indexPageNumber int) {\n\tindexFilePath := obj.getIndexFilePath(indexPageNumber)\n\tfile, err := os.Create(indexFilePath)\n\tobj.checkError(err)\n\tw := bufio.NewWriter(file)\n\t_, err = w.WriteString(ConvertIntArrayToString(obj.indexPage))\n\tobj.checkError(err)\n\terr = w.Flush()\n\tobj.checkError(err)\n\tfile.Close()\n}", "func (bg *bufferedGroup) updateLocationIndex() {\n bg.locationIndex = make(map[string]int)\n for i, bi := range bg.images {\n if _, found := bg.locationIndex[bi.nearestCityKey]; found == false {\n locationTimekey := bi.LocationTimekey()\n bg.locationIndex[locationTimekey] = i\n }\n }\n}", "func SaveIndexesOfUsers(path string, indexes *IndexesOfUsers) error {\n\tbyteVal, err := json.Marshal(indexes)\n\tif err != nil {\n\t\treturn nil\n\t}\n\terr = ioutil.WriteFile(path, byteVal, 0644)\n\treturn err\n}", "func (x *Index) Write(w io.Writer) error {}", "func (fcb *FileCacheBackend) Save(ob types.OutgoingBatch) error {\n\tfilename := fcb.getFilename(fcb.getCacheFilename(ob))\n\tlog.Printf(\"Saving to %s\", filename)\n\tfile, err := os.OpenFile(filename, os.O_CREATE|os.O_WRONLY|os.O_EXCL, 0600)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to save to %s - %s\", filename, err)\n\t}\n\tdefer file.Close()\n\tfor _, item := range ob.Values {\n\t\tfile.WriteString(item + \"\\n\")\n\t}\n\treturn nil\n}", "func writeMapToFile(m map[string]int, filename string) {\n\tfile, buf := CreateFileAndBuf(filename)\n\tfor k, v := range m {\n\t\tbuf.Write([]byte(k + \",\" + strconv.Itoa(v) + \"\\n\"))\n\t}\n\tSafeClose(file, buf)\n}", "func (self *botStats) save(t db.Table, index int) error {\n\tkey := fmt.Sprintf(\"%s-%2d\",botStatsRecordKey,index)\n\treturn t.Put(key,self)\n}", "func (s *SmartContract) SaveMap(stub shim.ChaincodeStubInterface, segment *cs.Segment) error {\n\tmapDoc := MapDoc{\n\t\tObjectTypeMap,\n\t\tsegment.Link.GetMapID(),\n\t\tsegment.Link.GetProcess(),\n\t}\n\tmapDocBytes, err := json.Marshal(mapDoc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn stub.PutState(segment.Link.GetMapID(), mapDocBytes)\n}", "func writeIndexChanges(tx *bolt.Tx, changes map[string][]string, op indexOp) error {\n\tfor idxName, indexEntries := range changes {\n\t\tbucket := tx.Bucket([]byte(idxName))\n\t\tfor _, entry := range indexEntries {\n\t\t\tif err := op(bucket, []byte(entry)); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func SavingIndex(addr string, iName string, size int, t int, o string) {\n\tlog.SetOutput(os.Stdout)\n\n\t_, err := os.Stat(o)\n\tif !os.IsNotExist(err) {\n\t\tlog.SetOutput(os.Stderr)\n\t\tlog.Println(\"The file already exists.\")\n\t\tos.Exit(0)\n\t}\n\n\tcfg := elasticsearch.Config{\n\t\tAddresses: []string{\n\t\t\taddr,\n\t\t},\n\t}\n\tes, err := elasticsearch.NewClient(cfg)\n\tif err != nil {\n\t\tlog.SetOutput(os.Stderr)\n\t\tlog.Fatal(err)\n\t}\n\n\tcnt := indices.GetDocCount(es, iName)\n\tif cnt != 0 {\n\t\tcnt = cnt/size + 1\n\t} else {\n\t\tlog.SetOutput(os.Stderr)\n\t\tlog.Println(\"The document does not exist in the target index.\")\n\t\tos.Exit(0)\n\t}\n\n\teg, ctx := errgroup.WithContext(context.Background())\n\n\tchRes := make(chan map[string]interface{}, 10)\n\tchResDone := make(chan struct{})\n\tchDoc := make(chan []map[string]string, 10)\n\n\tvar scrollID string\n\n\tscrollID, err = getScrollID(es, iName, size, t, chRes)\n\tif err != nil {\n\t\tlog.SetOutput(os.Stderr)\n\t\tlog.Fatal(err)\n\t}\n\n\tvar mu1 sync.Mutex\n\n\tfor i := 0; i < cnt; i++ {\n\t\teg.Go(func() error {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn nil\n\t\t\tdefault:\n\t\t\t\tmu1.Lock()\n\t\t\t\tdefer mu1.Unlock()\n\t\t\t\terr := getScrollRes(es, iName, scrollID, t, chRes, chResDone)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\treturn nil\n\t\t\t}\n\t\t})\n\t}\n\n\teg.Go(func() error {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\tcase <-chResDone:\n\t\t\tclose(chRes)\n\t\t\treturn nil\n\t\t}\n\t})\n\n\teg.Go(func() error {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\tdefault:\n\t\t\tdefer close(chDoc)\n\t\t\treturn processing.GetDocsData(chRes, chDoc)\n\t\t}\n\t})\n\n\tvar mu2 sync.Mutex\n\n\teg.Go(func() error {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\tdefault:\n\t\t\tmu2.Lock()\n\t\t\tdefer mu2.Unlock()\n\t\t\treturn saveDocToFile(o, chDoc)\n\t\t}\n\t})\n\n\tif err := eg.Wait(); err != nil {\n\t\tlog.SetOutput(os.Stderr)\n\t\tlog.Fatal(err)\n\t}\n\n\tdeleteScrollID(es, scrollID)\n\n\tlog.Println(\"The index was saved successfully.\")\n}", "func onebitwritesymbol(arr []Bvec, sym *Sym) {\n\tvar i int\n\tvar j int\n\tvar word uint32\n\n\tn := len(arr)\n\toff := 0\n\toff += 4 // number of bitmaps, to fill in later\n\tbv := arr[0]\n\toff = duint32(sym, off, uint32(bv.n)) // number of bits in each bitmap\n\tfor i = 0; i < n; i++ {\n\t\t// bitmap words\n\t\tbv = arr[i]\n\n\t\tif bv.b == nil {\n\t\t\tbreak\n\t\t}\n\t\tfor j = 0; int32(j) < bv.n; j += 32 {\n\t\t\tword = bv.b[j/32]\n\n\t\t\t// Runtime reads the bitmaps as byte arrays. Oblige.\n\t\t\toff = duint8(sym, off, uint8(word))\n\n\t\t\toff = duint8(sym, off, uint8(word>>8))\n\t\t\toff = duint8(sym, off, uint8(word>>16))\n\t\t\toff = duint8(sym, off, uint8(word>>24))\n\t\t}\n\t}\n\n\tduint32(sym, 0, uint32(i)) // number of bitmaps\n\tggloblsym(sym, int32(off), obj.RODATA)\n}", "func (vr *vectorRenderer) Save(w io.Writer) error {\n\tvr.c.End()\n\t_, err := w.Write(vr.b.Bytes())\n\treturn err\n}", "func MapBitmapToIndices(bitmap []byte) []int64 {\n\tif len(bitmap) == 0 {\n\t\treturn []int64{}\n\t}\n\n\toutput := make([]int64, len(bitmap)*8)\n\tcount := 0\n\n\tfor i, byte_at := range bitmap {\n\t\t// Skip empty bytes\n\t\tif byte_at == 0x00 {\n\t\t\tcontinue\n\t\t}\n\n\t\t// All the bits are on!\n\t\tif byte_at == 0xFF {\n\t\t\ti_8 := int64(i * 8)\n\t\t\tj := 0\n\n\t\t\t// 0\n\t\t\toutput[count+j] = i_8 + int64(j)\n\t\t\tj++\n\n\t\t\t// 1\n\t\t\toutput[count+j] = i_8 + int64(j)\n\t\t\tj++\n\n\t\t\t// 2\n\t\t\toutput[count+j] = i_8 + int64(j)\n\t\t\tj++\n\n\t\t\t// 3\n\t\t\toutput[count+j] = i_8 + int64(j)\n\t\t\tj++\n\n\t\t\t// 4\n\t\t\toutput[count+j] = i_8 + int64(j)\n\t\t\tj++\n\n\t\t\t// 5\n\t\t\toutput[count+j] = i_8 + int64(j)\n\t\t\tj++\n\n\t\t\t// 6\n\t\t\toutput[count+j] = i_8 + int64(j)\n\t\t\tj++\n\n\t\t\t// 7\n\t\t\toutput[count+j] = i_8 + int64(j)\n\t\t\tj++\n\n\t\t\tcount += j\n\t\t\tcontinue\n\t\t}\n\n\t\t// Perform BitShift operations and figure out which bits are on\n\t\tfor j := 0; j < 8; j++ {\n\t\t\t//\n\t\t\t// WARNING!! We are counting from Left --> Right here!\n\t\t\t//\n\t\t\tmask := byte(1) << uint(7-j)\n\n\t\t\tposition := i*8 + j\n\n\t\t\tif mask&(byte_at) != 0 {\n\t\t\t\toutput[count] = int64(position)\n\t\t\t\tcount++\n\t\t\t} else {\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the slice of live ids\n\treturn output[0:count]\n}", "func (hm *HashMap) getIndex(key string) uint64 {\n\thasher := hm.hasher.Get().(hash.Hash64)\n\thasher.Reset()\n\thasher.Write([]byte(key))\n\tindex := hasher.Sum64() % hm.size\n\thm.hasher.Put(hasher)\n\treturn index\n}", "func readtreeSaveIndex(c *Client, opt ReadTreeOptions, i *Index) error {\n\tif !opt.DryRun {\n\t\tif opt.IndexOutput == \"\" {\n\t\t\topt.IndexOutput = \"index\"\n\t\t}\n\t\tf, err := c.GitDir.Create(File(opt.IndexOutput))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer f.Close()\n\t\treturn i.WriteIndex(f)\n\t}\n\treturn nil\n}", "func (m *Matrix) Save(path string) error {\n\tbs, err := m.Compress()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn ioutil.WriteFile(path, bs, 0644)\n}", "func (i ImageIndexer) ExportFromIndex(request ExportFromIndexRequest) error {\n\t// set a temp directory\n\tworkingDir, err := ioutil.TempDir(\"./\", tmpDirPrefix)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer os.RemoveAll(workingDir)\n\n\t// extract the index database to the file\n\tdatabaseFile, err := i.getDatabaseFile(workingDir, request.Index, request.CaFile, request.SkipTLSVerify, request.PlainHTTP)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdb, err := sqlite.Open(databaseFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer db.Close()\n\n\tdbQuerier := sqlite.NewSQLLiteQuerierFromDb(db)\n\n\t// fetch all packages from the index image if packages is empty\n\tif len(request.Packages) == 0 {\n\t\trequest.Packages, err = dbQuerier.ListPackages(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tbundles, err := getBundlesToExport(dbQuerier, request.Packages)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ti.Logger.Infof(\"Preparing to pull bundles %+q\", bundles)\n\n\t// Creating downloadPath dir\n\tif err := os.MkdirAll(request.DownloadPath, 0777); err != nil {\n\t\treturn err\n\t}\n\n\tvar errs []error\n\tvar wg sync.WaitGroup\n\twg.Add(len(bundles))\n\tvar mu = &sync.Mutex{}\n\n\tsem := make(chan struct{}, concurrencyLimitForExport)\n\n\tfor bundleImage, bundleDir := range bundles {\n\t\tgo func(bundleImage string, bundleDir bundleDirPrefix) {\n\t\t\tdefer wg.Done()\n\n\t\t\tsem <- struct{}{}\n\t\t\tdefer func() {\n\t\t\t\t<-sem\n\t\t\t}()\n\n\t\t\t// generate a random folder name if bundle version is empty\n\t\t\tif bundleDir.bundleVersion == \"\" {\n\t\t\t\tbundleDir.bundleVersion = strconv.Itoa(rand.Intn(10000))\n\t\t\t}\n\t\t\texporter := bundle.NewExporterForBundle(bundleImage, filepath.Join(request.DownloadPath, bundleDir.pkgName, bundleDir.bundleVersion), request.ContainerTool)\n\t\t\tif err := exporter.Export(request.SkipTLSVerify, request.PlainHTTP); err != nil {\n\t\t\t\terr = fmt.Errorf(\"exporting bundle image:%s failed with %s\", bundleImage, err)\n\t\t\t\tmu.Lock()\n\t\t\t\terrs = append(errs, err)\n\t\t\t\tmu.Unlock()\n\t\t\t}\n\t\t}(bundleImage, bundleDir)\n\t}\n\t// Wait for all the go routines to finish export\n\twg.Wait()\n\n\tif errs != nil {\n\t\treturn utilerrors.NewAggregate(errs)\n\t}\n\n\tfor _, packageName := range request.Packages {\n\t\terr := generatePackageYaml(dbQuerier, packageName, filepath.Join(request.DownloadPath, packageName))\n\t\tif err != nil {\n\t\t\terrs = append(errs, err)\n\t\t}\n\t}\n\treturn utilerrors.NewAggregate(errs)\n}", "func (vbm VolumeBitMap) Write(devicebytes []byte) error {\n\tfor i, bp := range vbm {\n\t\tif err := disk.MarshalBlock(devicebytes, bp); err != nil {\n\t\t\treturn fmt.Errorf(\"cannot write block %d (device block %d) of Volume Bit Map: %v\", i, bp.GetBlock(), err)\n\t\t}\n\t}\n\treturn nil\n}", "func (store *FileTileStore) Put(scale, index int, tile *tiling.Tile) error {\n\tsklog.Info(\"Put()\")\n\t// Make sure the scale and tile index are correct.\n\tif tile.Scale != scale || tile.TileIndex != index {\n\t\treturn fmt.Errorf(\"Tile scale %d and index %d do not match real tile scale %d and index %d\", scale, index, tile.Scale, tile.TileIndex)\n\t}\n\n\tif index < 0 {\n\t\treturn fmt.Errorf(\"Can't write Tiles with an index < 0: %d\", index)\n\t}\n\n\t// Begin by writing the Tile out into a temporary location.\n\tf, err := store.fileTileTemp(scale, index)\n\tif err != nil {\n\t\treturn err\n\t}\n\tenc := gob.NewEncoder(f)\n\tif err := enc.Encode(tile); err != nil {\n\t\treturn fmt.Errorf(\"Failed to encode tile %s: %s\", f.Name(), err)\n\t}\n\tif err := f.Close(); err != nil {\n\t\treturn fmt.Errorf(\"Failed to close temporary file: %v\", err)\n\t}\n\n\t// Now rename the completed file to the real tile name. This is atomic and\n\t// doesn't affect current readers of the old tile contents.\n\ttargetName, err := store.tileFilename(scale, index)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := os.MkdirAll(filepath.Dir(targetName), 0755); err != nil {\n\t\treturn fmt.Errorf(\"Error creating directory for tile %s: %s\", targetName, err)\n\t}\n\tsklog.Infof(\"Renaming: %q %q\", f.Name(), targetName)\n\tif err := os.Rename(f.Name(), targetName); err != nil {\n\t\treturn fmt.Errorf(\"Failed to rename tile: %s\", err)\n\t}\n\tfiledata, err := os.Stat(targetName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to stat new tile: %s\", err)\n\n\t}\n\tstore.lock.Lock()\n\tdefer store.lock.Unlock()\n\n\tentry := &CacheEntry{\n\t\ttile: tile,\n\t\tlastModified: filedata.ModTime(),\n\t}\n\tkey := CacheKey{\n\t\tstartIndex: index,\n\t\tscale: scale,\n\t}\n\tstore.cache.Add(key, entry)\n\n\treturn nil\n}", "func saveImage(nodeMap [][]node, file string) {\n\tsolved := image.NewRGBA(image.Rect(0, 0, sizeX, sizeY))\n\tfor x := 0; x < sizeX; x++ {\n\t\tfor y := 0; y < sizeY; y++ {\n\t\t\tif nodeMap[x][y].nodeType == \"wall\" {\n\t\t\t\tsolved.Set(x, y, color.Black)\n\n\t\t\t} else {\n\t\t\t\tsolved.Set(x, y, color.White)\n\t\t\t}\n\t\t}\n\t}\n\tfor i := 0; i < len(path)-1; i++ {\n\t\tsolved.Set(path[i].pos[0], path[i].pos[1], color.RGBA{0, 255, 0, 255})\n\n\t\t//x++\n\t\tx := path[i].pos[0]\n\t\ty := path[i].pos[1]\n\n\t\tif path[i+1].pos[0] > path[i].pos[0] {\n\t\t\tfor x <= path[i+1].pos[0] {\n\t\t\t\tsolved.Set(x, y, color.RGBA{0, 255, 0, 255})\n\t\t\t\tx++\n\t\t\t}\n\t\t}\n\t\t//x--\n\t\tx = path[i].pos[0]\n\t\ty = path[i].pos[1]\n\n\t\tif path[i+1].pos[0] < path[i].pos[0] {\n\t\t\tfor x >= path[i+1].pos[0] {\n\t\t\t\tsolved.Set(x, y, color.RGBA{0, 255, 0, 255})\n\t\t\t\tx--\n\t\t\t}\n\t\t}\n\t\t//y++\n\t\tx = path[i].pos[0]\n\t\ty = path[i].pos[1]\n\n\t\tif path[i+1].pos[1] > path[i].pos[1] {\n\t\t\tfor y <= path[i+1].pos[1] {\n\t\t\t\tsolved.Set(x, y, color.RGBA{0, 255, 0, 255})\n\t\t\t\ty++\n\t\t\t}\n\t\t}\n\t\t//y--\n\t\tx = path[i].pos[0]\n\t\ty = path[i].pos[1]\n\n\t\tif path[i+1].pos[1] < path[i].pos[1] {\n\t\t\tfor y >= path[i+1].pos[1] {\n\t\t\t\tsolved.Set(x, y, color.RGBA{0, 255, 0, 255})\n\t\t\t\ty--\n\t\t\t}\n\t\t}\n\n\t}\n\n\tout, err := os.Create(file)\n\tif err == nil {\n\t\tpng.Encode(out, solved)\n\t\tout.Close()\n\t}\n}", "func (c *Collection) saveIndexes() error {\n\tib, err := json.Marshal(c.indexes)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.db.datastore.Put(dsIndexes.ChildString(c.name), ib)\n}", "func (r *ImageRef) Mapim(index *ImageRef) error {\n\tout, err := vipsMapim(r.image, index.image)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.setImage(out)\n\treturn nil\n}", "func (f genHelperEncoder) EncWriteMapElemKey() { f.e.mapElemKey() }", "func (w *diskTableWriter) write(key, value []byte) error {\n\tdataBytes, err := encode(key, value, w.dataFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to write to the data file: %w\", err)\n\t}\n\n\tindexBytes, err := encodeKeyOffset(key, w.dataPos, w.indexFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to write to the index file: %w\", err)\n\t}\n\n\tif w.keyNum%w.sparseKeyDistance == 0 {\n\t\tif _, err := encodeKeyOffset(key, w.indexPos, w.sparseIndexFile); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to write to the file: %w\", err)\n\t\t}\n\t}\n\n\tw.dataPos += dataBytes\n\tw.indexPos += indexBytes\n\tw.keyNum++\n\n\treturn nil\n}", "func (s *storageMgr) updateIndexSnapMapForIndex(idxInstId common.IndexInstId, idxInst common.IndexInst,\n\tpartnMap PartitionInstMap, streamId common.StreamId, keyspaceId string) {\n\n\tpartitionIDs, _ := idxInst.Pc.GetAllPartitionIds()\n\tlogging.Infof(\"StorageMgr::updateIndexSnapMapForIndex IndexInst %v Partitions %v\",\n\t\tidxInstId, partitionIDs)\n\n\tneedRestart := false\n\t//if keyspace and stream have been provided\n\tif keyspaceId != \"\" && streamId != common.ALL_STREAMS {\n\t\t//skip the index if either keyspaceId or stream don't match\n\t\tif idxInst.Defn.KeyspaceId(idxInst.Stream) != keyspaceId || idxInst.Stream != streamId {\n\t\t\treturn\n\t\t}\n\t\t//skip deleted indexes\n\t\tif idxInst.State == common.INDEX_STATE_DELETED {\n\t\t\treturn\n\t\t}\n\t}\n\n\tindexSnapMap := s.indexSnapMap.Clone()\n\tsnapC := indexSnapMap[idxInstId]\n\tif snapC != nil {\n\t\tsnapC.Lock()\n\t\tDestroyIndexSnapshot(snapC.snap)\n\t\tdelete(indexSnapMap, idxInstId)\n\t\ts.indexSnapMap.Set(indexSnapMap)\n\t\tsnapC.Unlock()\n\t\ts.notifySnapshotDeletion(idxInstId)\n\t}\n\n\tvar tsVbuuid *common.TsVbuuid\n\tvar err error\n\tpartnSnapMap := make(PartnSnapMap)\n\n\tfor _, partnInst := range partnMap {\n\t\tpartnSnapMap, tsVbuuid, err = s.openSnapshot(idxInstId, partnInst, partnSnapMap)\n\t\tif err != nil {\n\t\t\tif err == errStorageCorrupted {\n\t\t\t\tneedRestart = true\n\t\t\t} else {\n\t\t\t\tpanic(\"Unable to open snapshot -\" + err.Error())\n\t\t\t}\n\t\t}\n\n\t\tif partnSnapMap == nil {\n\t\t\tbreak\n\t\t}\n\n\t\t//if OSO snapshot, rollback all partitions to 0\n\t\tif tsVbuuid != nil && tsVbuuid.GetSnapType() == common.DISK_SNAP_OSO {\n\t\t\tfor _, partnInst := range partnMap {\n\t\t\t\tpartnId := partnInst.Defn.GetPartitionId()\n\t\t\t\tsc := partnInst.Sc\n\n\t\t\t\tfor _, slice := range sc.GetAllSlices() {\n\t\t\t\t\t_, err := s.rollbackToSnapshot(idxInstId, partnId,\n\t\t\t\t\t\tslice, nil, false)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tpanic(\"Unable to rollback to 0 - \" + err.Error())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tpartnSnapMap = nil\n\t\t\tbreak\n\t\t}\n\t}\n\n\tbucket, _, _ := SplitKeyspaceId(keyspaceId)\n\tif len(partnSnapMap) != 0 {\n\t\tis := &indexSnapshot{\n\t\t\tinstId: idxInstId,\n\t\t\tts: tsVbuuid,\n\t\t\tpartns: partnSnapMap,\n\t\t}\n\t\tindexSnapMap = s.indexSnapMap.Clone()\n\t\tif snapC == nil {\n\t\t\tsnapC = &IndexSnapshotContainer{snap: is}\n\t\t} else {\n\t\t\tsnapC.Lock()\n\t\t\tsnapC.snap = is\n\t\t\tsnapC.Unlock()\n\t\t}\n\n\t\tindexSnapMap[idxInstId] = snapC\n\t\ts.indexSnapMap.Set(indexSnapMap)\n\t\ts.notifySnapshotCreation(is)\n\t} else {\n\t\tlogging.Infof(\"StorageMgr::updateIndexSnapMapForIndex IndexInst %v Adding Nil Snapshot.\",\n\t\t\tidxInstId)\n\t\ts.addNilSnapshot(idxInstId, bucket)\n\t}\n\n\tif needRestart {\n\t\tos.Exit(1)\n\t}\n}", "func SaveTrie(tr *Trie, path string) error {\n\tf, err := os.Create(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\tbinary.Write(f, binary.LittleEndian, MagicNumber)\n\n\t// Write each of the arrays to the file (preceded by its length).\n\tfor _, arr := range [][]int64{tr.base, tr.check, tr.dict, tr.fail, tr.suff} {\n\t\tif err = binary.Write(f, binary.LittleEndian, int64(len(arr))); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err = binary.Write(f, binary.LittleEndian, arr); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (mm *MMapRWManager) WriteAt(b []byte, off int64) (n int, err error) {\n\tif mm.m == nil {\n\t\treturn 0, ErrUnmappedMemory\n\t} else if off >= int64(len(mm.m)) || off < 0 {\n\t\treturn 0, ErrIndexOutOfBound\n\t}\n\n\treturn copy(mm.m[off:], b), nil\n}", "func (r *Renderer) Save(fileName string) {\n\tfile, err := os.Create(fileName)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer file.Close()\n\tpng.Encode(file, flipper.FlipV(r.img))\n}", "func (m Db) Save(n int, p architecture.Version) {\n\tm.Dbm[n] = p\n}", "func (mapping *ApplicationAccountStoreMapping) Save() error {\n\turl := buildRelativeURL(\"accountStoreMappings\")\n\tif mapping.Href != \"\" {\n\t\turl = mapping.Href\n\t}\n\n\treturn client.post(url, mapping, mapping)\n}", "func (s *DbStore) Export(out io.Writer) (int64, error) {\n\ttw := tar.NewWriter(out)\n\tdefer tw.Close()\n\n\tit := s.db.NewIterator()\n\tdefer it.Release()\n\tvar count int64\n\tfor ok := it.Seek([]byte{kpIndex}); ok; ok = it.Next() {\n\t\tkey := it.Key()\n\t\tif (key == nil) || (key[0] != kpIndex) {\n\t\t\tbreak\n\t\t}\n\n\t\tvar index dpaDBIndex\n\t\tdecodeIndex(it.Value(), &index)\n\n\t\tdata, err := s.db.Get(getDataKey(index.Idx))\n\t\tif err != nil {\n\t\t\tlog.Warn(fmt.Sprintf(\"Chunk %x found but could not be accessed: %v\", key[:], err))\n\t\t\tcontinue\n\t\t}\n\n\t\thdr := &tar.Header{\n\t\t\tName: hex.EncodeToString(key[1:]),\n\t\t\tMode: 0644,\n\t\t\tSize: int64(len(data)),\n\t\t}\n\t\tif err := tw.WriteHeader(hdr); err != nil {\n\t\t\treturn count, err\n\t\t}\n\t\tif _, err := tw.Write(data); err != nil {\n\t\t\treturn count, err\n\t\t}\n\t\tcount++\n\t}\n\n\treturn count, nil\n}", "func (index *GpuIndex) WriteToDeviceIndex(resource interface{}) (dsc.SearchIndex, error) {\n\tif index == nil {\n\t\treturn nil, fmt.Errorf(\"WriteToDeviceIndex Fail: nil GpuIndex\")\n\t}\n\treturn index, nil\n}", "func writeBlock(file *os.File, index int64, data *dataBlock) {\n\tfile.Seek(index, 0)\n\t//Empezamos el proceso de guardar en binario la data en memoria del struct\n\tvar binaryDisc bytes.Buffer\n\tbinary.Write(&binaryDisc, binary.BigEndian, data)\n\twriteNextBytes(file, binaryDisc.Bytes())\n}", "func writeFormat(file *os.File, index int64, size int64) {\n\tformat := make([]int8, size)\n\tfile.Seek(index, 0)\n\t//Empezamos el proceso de guardar en binario la data en memoria del struct\n\tvar binaryDisc bytes.Buffer\n\tbinary.Write(&binaryDisc, binary.BigEndian, &format)\n\twriteNextBytes(file, binaryDisc.Bytes())\n}", "func (w *Writer) BitIndex() int64", "func (b *Set) hashIndex(item interface{}) (index int) {\n\n\trepString := \"\"\n\tswitch item.(type) {\n\tcase string:\n\t\trepString, _ = item.(string)\n\tcase int:\n\t\ttempString, _ := item.(int)\n\t\trepString = strconv.Itoa(tempString)\n\tdefault:\n\t\tpanic(\"type not support\")\n\t}\n\n\th := fnv.New32()\n\th.Write([]byte(repString))\n\tindex = int(h.Sum32() % uint32(b.m))\n\treturn\n}", "func dbPutBlockIndex(dbTx database.Tx, hash *common.Hash, height int32) error {\n\t// Serialize the height for use in the index entries.\n\tvar serializedHeight [4]byte\n\tbyteOrder.PutUint32(serializedHeight[:], uint32(height))\n\n\t// Add the block hash to height mapping to the index.\n\tmeta := dbTx.Metadata()\n\thashIndex := meta.Bucket(hashIndexBucketName)\n\tif err := hashIndex.Put(hash[:], serializedHeight[:]); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func savePageMemory() {\n\tvar wait sync.WaitGroup\n\tfmt.Println(\"Update start ...\")\n\tfor index := range ufs {\n\t\twait.Add(1)\n\t\tcopy := index\n\t\tgo func() {\n\t\t\tsavePageMemory_(copy)\n\t\t\twait.Done()\n\t\t}()\n\t}\n\twait.Wait()\n\tfmt.Println(\" ...Update done\")\n}", "func setBit(bitmap []byte, idx int) {\n\tbitmap[idx/8] = bitmap[idx/8] | (1 << uint(idx%8))\n}", "func writeMapFile(filename string, target interface{}) error {\n\tf, err := os.Create(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err = toml.NewEncoder(f).Encode(target); err != nil {\n\t\treturn err\n\t}\n\tif err := f.Close(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func encodeBWData(w io.Writer, img image.Image, opts *EncodeOptions) error {\n\t// In the background, write each index value into a channel.\n\trect := img.Bounds()\n\twidth := rect.Max.X - rect.Min.X\n\tsamples := make(chan uint16, width)\n\tgo func() {\n\t\tbwImage := NewBW(image.ZR)\n\t\tcm := bwImage.ColorModel().(color.Palette)\n\t\tfor y := rect.Min.Y; y < rect.Max.Y; y++ {\n\t\t\tfor x := rect.Min.X; x < rect.Max.X; x++ {\n\t\t\t\tsamples <- uint16(cm.Index(img.At(x, y)))\n\t\t\t}\n\t\t}\n\t\tclose(samples)\n\t}()\n\n\t// In the foreground, consume index values (either 0 or 1) and\n\t// write them to the image file as individual bits. Pack 8\n\t// bits to a byte, pad each row, and output.\n\tif opts.Plain {\n\t\treturn writePlainData(w, samples)\n\t}\n\twb, ok := w.(*bufio.Writer)\n\tif !ok {\n\t\twb = bufio.NewWriter(w)\n\t}\n\tvar b byte // Next byte to write\n\tvar bLen uint // Valid bits in b\n\tvar rowBits int // Bits written to the current row\n\tfor s := range samples {\n\t\tb = b<<1 | byte(s)\n\t\tbLen++\n\t\trowBits++\n\t\tif rowBits == width {\n\t\t\t// Pad the last byte in the row.\n\t\t\tb <<= 8 - bLen\n\t\t\tbLen = 8\n\t\t\trowBits = 0\n\t\t}\n\t\tif bLen == 8 {\n\t\t\t// Write a full byte to the output.\n\t\t\tif err := wb.WriteByte(b); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tb = 0\n\t\t\tbLen = 0\n\t\t}\n\t}\n\twb.Flush()\n\treturn nil\n}", "func (master *MasterIndex) Write() error {\n\tf, err := os.OpenFile(master.Filename, os.O_RDWR|os.O_CREATE, 0600)\n\tif err != nil {\n\t\treturn err\n\t}\n\tenc := gob.NewEncoder(f)\n\terr = enc.Encode(master)\n\tf.Close()\n\treturn err\n}", "func (kmeans *KMeansClustering) writeToFile(filePath string, csvDfCopyMatrix *mat.Dense, dataPoints *mat.Dense,\n\tindexes []int) {\n\trows, _ := csvDfCopyMatrix.Dims()\n\n\tfile, err := os.OpenFile(filePath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tdefer file.Close()\n\n\tfor i := 0; i < rows; i++ {\n\t\ts := 0\n\n\t\tfString := fmt.Sprintf(\"%f\", csvDfCopyMatrix.At(i, 0))\n\t\tfString = fString + \" \" + fmt.Sprintf(\"%f\", csvDfCopyMatrix.At(i, 1))\n\n\t\tfor c := 0; c < len(indexes); c++ {\n\t\t\tif indexes[c] == i {\n\t\t\t\tfString = fString + \" \" + fmt.Sprintf(\"%d\", 1)\n\t\t\t\ts = 1\n\t\t\t}\n\t\t}\n\n\t\tif s != 1 {\n\t\t\tfString = fString + \" \" + fmt.Sprintf(\"%d\", 0)\n\t\t}\n\n\t\tfString = fString + \" \" + fmt.Sprintf(\"%d\", int(dataPoints.At(i, 0)))\n\n\t\tif i != (rows - 1) {\n\t\t\tfString = fString + \"|\"\n\t\t}\n\n\t\t_, err2 := file.WriteString(fString)\n\n\t\tif err2 != nil {\n\t\t\tfmt.Println(err2)\n\t\t}\n\n\t\ts = 0\n\t\tfString = \"\"\n\t}\n\n}", "func (f genHelperEncoder) EncWriteMapElemValue() { f.e.mapElemValue() }", "func saveMatches(matches []*Match) {\n\tfile := openWriterAndBackup(*flag_saveMatches)\n\tenc := gob.NewEncoder(file)\n\tfor _, match := range matches {\n\t\tmatch.Encode(enc)\n\t}\n\tfile.Close()\n\trenameToFinal(*flag_saveMatches)\n}", "func (m *metricsMap) save(id string, metrics *docker.ContainerStats) {\n\tm.Lock()\n\tdefer m.Unlock()\n\n\tm.metrics[id] = metrics\n}", "func transformIndex(n *ir.IndexExpr) {\n\tassert(n.Type() != nil && n.Typecheck() == 1)\n\tn.X = implicitstar(n.X)\n\tl := n.X\n\tt := l.Type()\n\tif t.Kind() == types.TMAP {\n\t\tn.Index = assignconvfn(n.Index, t.Key())\n\t\tn.SetOp(ir.OINDEXMAP)\n\t\t// Set type to just the map value, not (value, bool). This is\n\t\t// different from types2, but fits the later stages of the\n\t\t// compiler better.\n\t\tn.SetType(t.Elem())\n\t\tn.Assigned = false\n\t}\n}", "func (s Serializer) indexValue(buf cmpbin.WriteableBytesBuffer, v any) (err error) {\n\tswitch t := v.(type) {\n\tcase nil:\n\tcase bool:\n\t\tb := byte(0)\n\t\tif t {\n\t\t\tb = 1\n\t\t}\n\t\terr = buf.WriteByte(b)\n\tcase int64:\n\t\t_, err = cmpbin.WriteInt(buf, t)\n\tcase float64:\n\t\t_, err = cmpbin.WriteFloat64(buf, t)\n\tcase string:\n\t\t_, err = cmpbin.WriteString(buf, t)\n\tcase []byte:\n\t\t_, err = cmpbin.WriteBytes(buf, t)\n\tcase GeoPoint:\n\t\terr = s.GeoPoint(buf, t)\n\tcase PropertyMap:\n\t\terr = s.PropertyMap(buf, t)\n\tcase *Key:\n\t\terr = s.Key(buf, t)\n\n\tdefault:\n\t\terr = fmt.Errorf(\"unsupported type: %T\", t)\n\t}\n\treturn\n}", "func (s ConsoleIndexStore) StoreIndex(name string, idx Index) error {\n\t_, err := idx.WriteTo(os.Stdout)\n\treturn err\n}", "func FileWriteAt(f *os.File, b []byte, off int64) (int, error)", "func (c *Chip8) SetIndex() {\n\tc.index = c.inst & 0x0FFF\n}", "func (s *LDBStore) Export(out io.Writer) (int64, error) {\n\ttw := tar.NewWriter(out)\n\tdefer tw.Close()\n\n\tit := s.db.NewIterator()\n\tdefer it.Release()\n\tvar count int64\n\tfor ok := it.Seek([]byte{keyIndex}); ok; ok = it.Next() {\n\t\tkey := it.Key()\n\t\tif (key == nil) || (key[0] != keyIndex) {\n\t\t\tbreak\n\t\t}\n\n\t\tvar index dpaDBIndex\n\n\t\thash := key[1:]\n\t\tdecodeIndex(it.Value(), &index)\n\t\tpo := s.po(hash)\n\t\tdatakey := getDataKey(index.Idx, po)\n\t\tlog.Trace(\"store.export\", \"dkey\", fmt.Sprintf(\"%x\", datakey), \"dataidx\", index.Idx, \"po\", po)\n\t\tdata, err := s.db.Get(datakey)\n\t\tif err != nil {\n\t\t\tlog.Warn(fmt.Sprintf(\"Chunk %x found but could not be accessed: %v\", key, err))\n\t\t\tcontinue\n\t\t}\n\n\t\thdr := &tar.Header{\n\t\t\tName: hex.EncodeToString(hash),\n\t\t\tMode: 0644,\n\t\t\tSize: int64(len(data)),\n\t\t}\n\t\tif err := tw.WriteHeader(hdr); err != nil {\n\t\t\treturn count, err\n\t\t}\n\t\tif _, err := tw.Write(data); err != nil {\n\t\t\treturn count, err\n\t\t}\n\t\tcount++\n\t}\n\n\treturn count, nil\n}", "func (pw *PixelWand) SetIndex(index *IndexPacket) {\n\tC.PixelSetIndex(pw.pw, C.IndexPacket(*index))\n\truntime.KeepAlive(pw)\n}", "func SaveAnalyzedGraph(graph chart.Chart, fileNamePrefix string) string {\n\tcollector := &chart.ImageWriter{}\n\tgraph.Render(chart.PNG, collector)\n\n\timage, err := collector.Image()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tcurTime := time.Now()\n\tfileName := \"/tmp/\" + fileNamePrefix + \"-image-\" + curTime.Format(constants.IMAGE_FORMAT) + \".png\"\n\tf, _ := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE, 0600)\n\tdefer f.Close()\n\tpng.Encode(f, image)\n\treturn fileName\n}", "func (app *service) Save(state State) error {\n\tjs, err := app.adapter.ToJSON(state)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tchainHash := state.Chain()\n\tindex := state.Height()\n\tpath := filePath(chainHash, index)\n\treturn app.fileService.Save(path, js)\n}", "func (pal *CGBPalette) write(value byte) {\n\tpal.palette[pal.index] = value\n\tif pal.inc {\n\t\tpal.index = (pal.index + 1) & 0x3F\n\t}\n}", "func (ids *Storage) updateMap(key, action string) (string, error) {\n\tvar id string\n\tf, err := os.OpenFile(ids.fn, os.O_WRONLY|os.O_TRUNC, 0600)\n\tif err != nil {\n\t\tlog.Printf(\"Error opening the file %s: %v\\n\", ids.fn, err)\n\t\treturn \"\", err\n\t}\n\tdefer f.Close()\n\tswitch action {\n\tcase \"del\":\n\t\tdelete(ids.IDs, key)\n\tcase \"put\":\n\t\tid = fmt.Sprintf(\"%x\", md5.Sum([]byte(key)))\n\t\tids.IDs[id] = key\n\t}\n\ttmp, err := json.Marshal(ids.IDs)\n\tif err != nil {\n\t\tlog.Printf(\"Error Marshalling the map to json %s: %v\\n\", ids.IDs, err)\n\t\treturn \"\", err\n\t}\n\n\tn, err := f.Write(tmp)\n\tif err != nil {\n\t\tlog.Printf(\"Error writing in the file %s: %v\\n\", ids.fn, err)\n\t\treturn \"\", err\n\t}\n\n\tlog.Printf(\"Updated file %v, written %d bytes, err: %v\\n\", ids.fn, n, err)\n\treturn id, nil\n}", "func (pv *PixView) SaveAllInfo() error {\n\tif len(pv.AllInfo) == 0 {\n\t\treturn nil\n\t}\n\tifn := filepath.Join(pv.ImageDir, \"info.json\")\n\tos.Rename(ifn, ifn+\"~\")\n\tpv.AllMu.Lock()\n\tdefer pv.AllMu.Unlock()\n\terr := pv.AllInfo.SaveJSON(ifn)\n\treturn err\n}", "func writeInode(file *os.File, index int64, inode *iNode) {\n\tfile.Seek(index, 0)\n\t//Empezamos el proceso de guardar en binario la data en memoria del struct\n\tvar binaryDisc bytes.Buffer\n\tbinary.Write(&binaryDisc, binary.BigEndian, inode)\n\twriteNextBytes(file, binaryDisc.Bytes())\n}", "func Save(path string, v interface{}, opts Options) (err error) {\n\tvar (\n\t\tzw *lz4.Writer\n\t\tencoder *jsoniter.Encoder\n\t\th hash.Hash\n\t\tmw io.Writer\n\t\tprefix [prefLen]byte\n\t\toff, l int\n\t\tfile *os.File\n\t\ttmp = path + \".tmp.\" + cmn.GenTie()\n\t)\n\tif file, err = cmn.CreateFile(tmp); err != nil {\n\t\treturn\n\t}\n\tdefer func() {\n\t\t_ = file.Close()\n\t\tif err != nil {\n\t\t\tos.Remove(tmp)\n\t\t}\n\t}()\n\tif opts.Signature {\n\t\toff = prefLen\n\t}\n\tif opts.Checksum {\n\t\th = xxhash.New64()\n\t\toff += h.Size()\n\t}\n\tif off > 0 {\n\t\tif _, err = file.Seek(int64(off), io.SeekStart); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\tif opts.Compression {\n\t\tif opts.Checksum {\n\t\t\tmw = io.MultiWriter(h, file)\n\t\t\tzw = lz4.NewWriter(mw)\n\t\t} else {\n\t\t\tzw = lz4.NewWriter(file)\n\t\t}\n\t\tencoder = jsoniter.NewEncoder(zw)\n\t} else {\n\t\tif opts.Checksum {\n\t\t\tmw = io.MultiWriter(h, file)\n\t\t\tencoder = jsoniter.NewEncoder(mw)\n\t\t} else {\n\t\t\tencoder = jsoniter.NewEncoder(file)\n\t\t}\n\t}\n\tencoder.SetIndent(\"\", \" \")\n\tif err = encoder.Encode(v); err != nil {\n\t\treturn\n\t}\n\tif opts.Compression {\n\t\t_ = zw.Close()\n\t}\n\tif opts.Signature {\n\t\tif _, err = file.Seek(0, io.SeekStart); err != nil {\n\t\t\treturn\n\t\t}\n\t\t// 1st 64-bit word\n\t\tcopy(prefix[:], signature)\n\t\tl = len(signature)\n\t\tcmn.Assert(l < prefLen/2)\n\t\tprefix[l] = version\n\n\t\t// 2nd 64-bit word as of version == 1\n\t\tvar packingInfo uint64\n\t\tif opts.Compression {\n\t\t\tpackingInfo |= 1 << 0\n\t\t}\n\t\tif opts.Checksum {\n\t\t\tpackingInfo |= 1 << 1\n\t\t}\n\t\tbinary.BigEndian.PutUint64(prefix[cmn.SizeofI64:], packingInfo)\n\n\t\t// write prefix\n\t\tfile.Write(prefix[:])\n\t}\n\tif opts.Checksum {\n\t\tif !opts.Signature {\n\t\t\tif _, err = file.Seek(0, io.SeekStart); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tfile.Write(h.Sum(nil))\n\t}\n\tif err = file.Close(); err != nil {\n\t\treturn\n\t}\n\terr = os.Rename(tmp, path)\n\treturn\n}", "func (m *MemoryStore) Save(target string) (string, error) {\n\tb := make([]byte, 4)\n\trand.Read(b)\n\tid := hex.EncodeToString(b)\n\tm.URLs[id] = target\n\treturn id, nil\n}", "func (cm *ClosestMatch) Save(filename string) error {\n\tf, err := os.Create(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\tenc := gob.NewEncoder(f)\n\treturn enc.Encode(cm)\n}", "func saveValues(v map[float64]float64) {\n\tvar data []byte\n\tfor t, y := range v {\n\t\tdata = append(data, []byte(fmt.Sprintf(\"%f, %f\\n\", t, y))...)\n\t}\n\tioutil.WriteFile(*filename, data, 0644)\n}", "func (store *DiskImageStore) Save(laptopID string, imageType string, imageData bytes.Buffer) (string, error) {\n\timageID, err := uuid.NewRandom()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"cannot generate image id : %w\", err)\n\t}\n\n\t// imagePath := fmt.Sprintf(\"image path %s/%s%s\", store.imageFolder, imageID, imageType)\n\timagePath := filepath.Join(store.imageFolder, imageID.String()+imageType)\n\tfile, err := os.Create(imagePath)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"cannot create image file: %w\", err)\n\t}\n\n\tlog.Print(\"filepath is: \", imagePath)\n\t_, err = imageData.WriteTo(file)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"cannot write image to file: %w\", err)\n\t}\n\n\tstore.mutex.Lock()\n\tdefer store.mutex.Unlock()\n\n\tstore.images[imageID.String()] = &ImageInfo{\n\t\tLaptopID: laptopID,\n\t\tType: imageType,\n\t\tPath: imagePath,\n\t}\n\n\treturn imageID.String(), nil\n}", "func (d *Data) writeXYImage(v dvid.VersionID, vox *Voxels, b storage.TKeyValues) (err error) {\n\n\t// Setup concurrency in image -> block transfers.\n\tvar wg sync.WaitGroup\n\tdefer wg.Wait()\n\n\t// Iterate through index space for this data using ZYX ordering.\n\tblockSize := d.BlockSize()\n\tvar startingBlock int32\n\n\tfor it, err := vox.NewIndexIterator(blockSize); err == nil && it.Valid(); it.NextSpan() {\n\t\tindexBeg, indexEnd, err := it.IndexSpan()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tptBeg := indexBeg.Duplicate().(dvid.ChunkIndexer)\n\t\tptEnd := indexEnd.Duplicate().(dvid.ChunkIndexer)\n\n\t\t// Do image -> block transfers in concurrent goroutines.\n\t\tbegX := ptBeg.Value(0)\n\t\tendX := ptEnd.Value(0)\n\n\t\tserver.CheckChunkThrottling()\n\t\twg.Add(1)\n\t\tgo func(blockNum int32) {\n\t\t\tc := dvid.ChunkPoint3d{begX, ptBeg.Value(1), ptBeg.Value(2)}\n\t\t\tfor x := begX; x <= endX; x++ {\n\t\t\t\tc[0] = x\n\t\t\t\tcurIndex := dvid.IndexZYX(c)\n\t\t\t\tb[blockNum].K = NewTKey(&curIndex)\n\n\t\t\t\t// Write this slice data into the block.\n\t\t\t\tvox.WriteBlock(&(b[blockNum]), blockSize)\n\t\t\t\tblockNum++\n\t\t\t}\n\t\t\tserver.HandlerToken <- 1\n\t\t\twg.Done()\n\t\t}(startingBlock)\n\n\t\tstartingBlock += (endX - begX + 1)\n\t}\n\treturn\n}", "func (t *BenchmarkerChaincode) updateIndex(stub shim.ChaincodeStubInterface, key, indexName string, indexValueSpace [][]string) error {\n\tif indexName == \"\" {\n\t\treturn nil\n\t}\n\n\tvar indexValues []string\n\tfor _, validValues := range indexValueSpace {\n\t\tchoice := rand.Intn(len(validValues))\n\t\tindexValues = append(indexValues, validValues[choice])\n\t}\n\n\tindexKey, err := stub.CreateCompositeKey(indexName+\"~id\", append(indexValues, key))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvalue := []byte{0x00}\n\tif err := stub.PutState(indexKey, value); err != nil {\n\t\treturn err\n\t}\n\tfmt.Printf(\"Set composite key '%s' to '%s' for key '%s'\\n\", indexKey, value, key)\n\n\treturn nil\n}", "func ScissorIndexed(index uint32, left int32, bottom int32, width int32, height int32) {\n C.glowScissorIndexed(gpScissorIndexed, (C.GLuint)(index), (C.GLint)(left), (C.GLint)(bottom), (C.GLsizei)(width), (C.GLsizei)(height))\n}", "func (c *Cache) SaveMutable(ctx context.Context, key string, forceTimeout time.Duration, f func(old *Entry) (Blob, error)) error {\n\tvar blocked time.Duration\nloop0:\n\tfor {\n\t\tce, err := c.Load(ctx, key+\"#\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tb, err := f(ce)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer b.Close()\n\t\tif ce != nil {\n\t\t\t// check if index changed while loading\n\t\t\tce2, err := c.Load(ctx, key+\"#\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif ce2 == nil || ce2.Key != ce.Key {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tidx := 0\n\t\tif ce != nil {\n\t\t\tidxs := strings.TrimPrefix(ce.Key, key+\"#\")\n\t\t\tif idxs == \"\" {\n\t\t\t\treturn errors.Errorf(\"corrupt empty index for %s\", key)\n\t\t\t}\n\t\t\tidx, err = strconv.Atoi(idxs)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"failed to parse %s index\", key)\n\t\t\t}\n\t\t}\n\t\tvar cacheID int\n\t\tfor {\n\t\t\tidx++\n\t\t\tcacheID, err = c.reserve(ctx, fmt.Sprintf(\"%s#%d\", key, idx))\n\t\t\tif err != nil {\n\t\t\t\tif errors.Is(err, os.ErrExist) {\n\t\t\t\t\tif blocked <= forceTimeout {\n\t\t\t\t\t\tblocked += 2 * time.Second\n\t\t\t\t\t\tselect {\n\t\t\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\t\t\treturn ctx.Err()\n\t\t\t\t\t\tcase <-time.After(2 * time.Second):\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue loop0\n\t\t\t\t\t}\n\t\t\t\t\tcontinue // index has been blocked a long time, maybe crashed, skip to next number\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tif err := c.upload(ctx, cacheID, b); err != nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn c.commit(ctx, cacheID, b.Size())\n\t}\n}", "func (self *TileSprite) SetChildIndex(child *DisplayObject, index int) {\n self.Object.Call(\"setChildIndex\", child, index)\n}", "func (r *RPC) IndexIcon(c context.Context, a *struct{}, res *map[string][]*model.IndexIcon) (err error) {\n\t*res = r.s.IndexIcon(c)\n\treturn\n}" ]
[ "0.71930915", "0.69759154", "0.6161804", "0.60840106", "0.6021097", "0.5984564", "0.59675753", "0.5964417", "0.5816666", "0.57352865", "0.57342404", "0.5704661", "0.5688048", "0.56743187", "0.5582231", "0.55643815", "0.5542597", "0.54274356", "0.53837913", "0.5376069", "0.53600115", "0.53495795", "0.53080726", "0.5227973", "0.5203302", "0.519245", "0.5157814", "0.5146814", "0.5094647", "0.5091626", "0.50793284", "0.50714797", "0.50592315", "0.50331295", "0.5024497", "0.499061", "0.49777263", "0.49764693", "0.49602234", "0.49597675", "0.49510372", "0.49509412", "0.49458417", "0.4938497", "0.48999813", "0.48948136", "0.48694187", "0.48632365", "0.48555303", "0.48512676", "0.48490375", "0.48466763", "0.48464775", "0.48414284", "0.48351562", "0.483295", "0.48184735", "0.4814744", "0.48101294", "0.48030677", "0.4788995", "0.47769397", "0.47632423", "0.47605443", "0.47575542", "0.47574204", "0.47507262", "0.47394884", "0.47361603", "0.47135645", "0.47055453", "0.46991104", "0.46990687", "0.46972263", "0.4685515", "0.467477", "0.46696827", "0.46549135", "0.46419293", "0.46417376", "0.4641127", "0.46396172", "0.46358037", "0.46316284", "0.46205497", "0.46191716", "0.4617946", "0.4613764", "0.46121883", "0.46117836", "0.46110526", "0.46031955", "0.46017918", "0.4597422", "0.4597058", "0.45946977", "0.45841664", "0.45820668", "0.4576171", "0.45752385" ]
0.56505734
14
Delete the given index for all partitions in the iterator.
func (d *Driver) Delete(i sql.Index, partitions sql.PartitionIter) error { idx, ok := i.(*pilosaIndex) if !ok { return errInvalidIndexType.New(i) } if idx.cancel != nil { idx.cancel() idx.wg.Wait() } if err := idx.index.Open(); err != nil { return err } defer idx.index.Close() if err := os.RemoveAll(filepath.Join(d.root, i.Database(), i.Table(), i.ID())); err != nil { return err } for { p, err := partitions.Next() if err != nil { if err == io.EOF { break } return err } for _, ex := range idx.Expressions() { name := fieldName(idx.ID(), ex, p) field := idx.index.Field(name) if field == nil { continue } if err = idx.index.DeleteField(name); err != nil { return err } } } return partitions.Close() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func deleteAllInt(index int, testMode bool) error {\n\tallPaths, errPaths := getPaths()\n\tif errPaths != nil {\n\t\tcolor.Red(\":: Error while reading .tempestcf\")\n\t\treturn errPaths\n\t}\n\tif index >= 0 && index < len(allPaths) {\n\t\tfor indx, indPath := range allPaths {\n\t\t\tif index == indx {\n\t\t\t\t// color.Cyan(indPath)\n\t\t\t\tfInt, fInfo, eInt := fetchAll(indPath)\n\t\t\t\tif eInt != nil {\n\t\t\t\t\tfmt.Println(\"-----\", eInt)\n\t\t\t\t}\n\t\t\t\tif fInfo != nil {\n\t\t\t\t\treturn emptyFile(indPath, fInfo, testMode)\n\t\t\t\t}\n\t\t\t\treturn deleteAllStr(indPath, fInt, testMode)\n\t\t\t}\n\t\t}\n\t}\n\treturn errors.New(\"Nothing to purge\")\n}", "func (a *Array) DeleteByIndex(index uint) error {\n\tif a.IsIndexOutOfRange(index) {\n\t\treturn errors.New(\"out of index range\")\n\t}\n\tfor i := index; i < a.length; i++ {\n\t\ta.data[i] = a.data[i+1]\n\t}\n\ta.length--\n\treturn nil\n}", "func DeleteIndex(a interface{}, index int) interface{} {\n\tswitch a.(type) {\n\tcase []int:\n\t\treturn DeleteIndexInt(a.([]int), index)\n\tdefault:\n\t\tpanic(\"not support type\")\n\t}\n}", "func (d *Driver) Delete(idx sql.Index) error {\n\tif err := os.RemoveAll(filepath.Join(d.root, idx.Database(), idx.Table(), idx.ID())); err != nil {\n\t\treturn err\n\t}\n\n\tindex, err := pilosa.NewIndex(indexName(idx.Database(), idx.Table()))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tframes := index.Frames()\n\tfor _, ex := range idx.Expressions() {\n\t\tfrm, ok := frames[frameName(idx.ID(), ex)]\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tif err = d.client.DeleteFrame(frm); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (c *Collection) indexDelete(tx ds.Txn, key ds.Key, originalData []byte) error {\n\tfor path, index := range c.indexes {\n\t\terr := c.indexUpdate(path, index, tx, key, originalData, true)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (c *Collection) DeleteIndex(name string) {\n\tvar index *BleveIndex\n\tfor i, tmpIndex := range c.bleveIndexes {\n\t\tif tmpIndex.name == name {\n\t\t\tindex = tmpIndex\n\n\t\t\tcopy(c.bleveIndexes[i:], c.bleveIndexes[i+1:])\n\t\t\tc.bleveIndexes[len(c.bleveIndexes)-1] = nil // or the zero value of T\n\t\t\tc.bleveIndexes = c.bleveIndexes[:len(c.bleveIndexes)-1]\n\n\t\t\tbreak\n\t\t}\n\t}\n\n\tindex.close()\n\tindex.delete()\n\n\tc.db.badger.DropPrefix(index.prefix)\n}", "func clearIndex(\n\tctx context.Context,\n\texecCfg *sql.ExecutorConfig,\n\ttableDesc catalog.TableDescriptor,\n\tindex descpb.IndexDescriptor,\n) error {\n\tlog.Infof(ctx, \"clearing index %d from table %d\", index.ID, tableDesc.GetID())\n\tif index.IsInterleaved() {\n\t\treturn errors.Errorf(\"unexpected interleaved index %d\", index.ID)\n\t}\n\n\tsp := tableDesc.IndexSpan(execCfg.Codec, index.ID)\n\tstart, err := keys.Addr(sp.Key)\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to addr index start: %v\", err)\n\t}\n\tend, err := keys.Addr(sp.EndKey)\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to addr index end: %v\", err)\n\t}\n\trSpan := roachpb.RSpan{Key: start, EndKey: end}\n\treturn clearSpanData(ctx, execCfg.DB, execCfg.DistSender, rSpan)\n}", "func (this *MyLinkedList) DeleteAtIndex(index int) {\n\tif index < 0 || index >= this.Length {\n\t\treturn\n\t}\n\tcurrent := this.Head\n\tfor i := 0; i < index; i++ {\n\t\tcurrent = current.Next\n\t}\n\tcurrent.Next = current.Next.Next\n\tthis.Length--\n}", "func SliceDeleteAtIndex(sl *[]Ki, idx int) error {\n\tif err := SliceIsValidIndex(sl, idx); err != nil {\n\t\treturn err\n\t}\n\t// this copy makes sure there are no memory leaks\n\tsz := len(*sl)\n\tcopy((*sl)[idx:], (*sl)[idx+1:])\n\t(*sl)[sz-1] = nil\n\t(*sl) = (*sl)[:sz-1]\n\treturn nil\n}", "func (c *index) Drop(rm kv.RetrieverMutator) error {\n\tit, err := rm.Iter(c.prefix, c.prefix.PrefixNext())\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer it.Close()\n\n\t// remove all indices\n\tfor it.Valid() {\n\t\tif !it.Key().HasPrefix(c.prefix) {\n\t\t\tbreak\n\t\t}\n\t\terr := rm.Delete(it.Key())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = it.Next()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (p *IntArray) Delete_at(del_index int) {\n\ttmp := *p\n\tvar new_array IntArray\n\tfor i := 0; i < len(tmp); i++ {\n\t\tif i != del_index {\n\t\t\tnew_array = append(new_array, tmp[i])\n\t\t}\n\t}\n\t*p = new_array\n}", "func (sl *Slice) DeleteAtIndex(idx int) error {\n\treturn SliceDeleteAtIndex((*[]Ki)(sl), idx)\n}", "func (b *Bag) DeleteAt(index int) {\n\tb.items[index] = b.items[len(b.items)-1]\n\tb.items = b.items[:len(b.items)-1]\n}", "func (a Slice[T]) DeleteAt(index int) Slice[T] {\n\treturn append(a[:index], a[index+1:]...)\n}", "func (this *MyLinkedList) DeleteAtIndex(index int) {\n\tif index < 0 || index >= this.size {\n\t\treturn\n\t}\n\tcurr := this.GetNode(index)\n\tprev := curr.Prev\n\tnext := curr.Next\n\tif prev == nil {\n\t\tthis.Head = next\n\t} else {\n\t\tprev.Next = next\n\t}\n\tif next == nil {\n\t\tthis.Tail = prev\n\t} else {\n\t\tnext.Prev = prev\n\t}\n\tthis.size -= 1\n}", "func (c *OrderedMap) DeleteIndex(index int) (string, interface{}) {\n\tkey := c.Keys[index]\n\tvalue := c.Map[key]\n\tdelete(c.Map, key)\n\tc.Keys = append(c.Keys[:index], c.Keys[index+1:]...)\n\treturn key, value\n}", "func (this *MyLinkedList) DeleteAtIndex(index int) {\n\n\tif index == 0 {\n\t\tif this.next != nil {\n\t\t\tthis.val = this.next.val\n\t\t\tthis.next = this.next.next\n\t\t} else {\n\t\t\tthis.val = -1\n\t\t\tthis.next = nil\n\t\t\tthis.use = false\n\t\t}\n\t\treturn\n\t}\n\ti := 1\n\tnode := this\n\tfor node.next != nil {\n\t\tif i == index {\n\t\t\tnode.next = node.next.next\n\t\t\tbreak\n\t\t}\n\t\ti++\n\t\tnode = node.next\n\t}\n}", "func (h *binaryHeap) removeIdx(idx int) {\n\tif h.invalidNode(idx) {\n\t\treturn\n\t}\n\th.swapIdx(idx, h.len)\n\th.tree[h.len] = 0\n\th.len--\n\th.bubbleDown(idx)\n}", "func (this *MyLinkedList) DeleteAtIndex(index int) {\n\tif index == 0 {\n\t\tif this.next == nil {\n\t\t\tthis.val = nil\n\t\t}else{\n\t\t\ttmp:= this.next\n\t\t\tthis.val = tmp.val\n\t\t\tthis.next = tmp.next\n\t\t}\n\t}else{\n\t\tcurrent := this\n\t\tpred := this\n\t\tfor i := 0; i < index; i++ {\n\t\t\tpred = current\n\t\t\tif current.next == nil{\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcurrent = current.next\n\t\t}\n\t\tpred.next = current.next\n\t}\n\n}", "func (c *index) Delete(sc *stmtctx.StatementContext, m kv.Mutator, indexedValues []types.Datum, h int64, ss kv.Transaction) error {\n\tkey, _, err := c.GenIndexKey(sc, indexedValues, h, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = m.Delete(key)\n\tif ss != nil {\n\t\tswitch c.idxInfo.State {\n\t\tcase model.StatePublic:\n\t\t\t// If the index is in public state, delete this index means it must exists.\n\t\t\tss.SetAssertion(key, kv.Exist)\n\t\tdefault:\n\t\t\tss.SetAssertion(key, kv.None)\n\t\t}\n\t}\n\treturn err\n}", "func (idx *Index) DeleteIndex() error {\n\tif idx.isReadOnlyFeed() {\n\t\treturn ErrReadOnlyIndex\n\t}\n\tmanifest := getRootManifestOfIndex(idx.name, idx.feed, idx.user, idx.client)\n\tif manifest == nil {\n\t\treturn ErrIndexNotPresent\n\t}\n\n\t// erase the top Manifest\n\ttopic := utils.HashString(idx.name)\n\t_, err := idx.feed.UpdateFeed(topic, idx.user, []byte(\"\"))\n\tif err != nil {\n\t\treturn ErrDeleteingIndex\n\t}\n\treturn nil\n}", "func DeleteIndexWithoutOrder(a interface{}, index int) interface{} {\n\tswitch a.(type) {\n\tcase []int:\n\t\treturn DeleteIndexWithoutOrderInt(a.([]int), index)\n\tdefault:\n\t\tpanic(\"not support type\")\n\t}\n}", "func deleteIndexOp(bucket *bolt.Bucket, k []byte) error {\n\treturn bucket.Delete(k)\n}", "func (a *Array) Delete(index uint) (int, error) {\n\tif a.isIndexOutOfRange(index) {\n\t\treturn 0, errors.New(\"out of index range\")\n\t}\n\tv := a.data[index]\n\tfor i := index; i < a.Len()-1; i++ {\n\t\ta.data[i] = a.data[i+1]\n\t}\n\ta.length--\n\treturn v, nil\n}", "func (list *MyLinkedList) DeleteAtIndex(index int) {\n\tif index < 0 || index >= list.len {\n\t\treturn\n\t}\n\n\tif 0 == index { // delete head\n\t\tlist.head = list.head.next\n\t\tif 1 == list.len {\n\t\t\tlist.tail = nil\n\t\t}\n\t} else {\n\t\tp := list.head\n\t\tfor i := 0; i < index-1; i++ {\n\t\t\tp = p.next\n\t\t}\n\t\tp.next = p.next.next\n\t\tif list.len-1 == index {\n\t\t\tlist.tail = p\n\t\t}\n\t}\n\n\tlist.len--\n}", "func deleteIterationKey(clientStore sdk.KVStore, height exported.Height) {\n\tkey := IterationKey(height)\n\tclientStore.Delete(key)\n}", "func (q *chunkQueue) discard(index uint32) error {\n\tif q.snapshot == nil {\n\t\treturn nil\n\t}\n\tpath := q.chunkFiles[index]\n\tif path == \"\" {\n\t\treturn nil\n\t}\n\terr := os.Remove(path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to remove chunk %v: %w\", index, err)\n\t}\n\tdelete(q.chunkFiles, index)\n\tdelete(q.chunkReturned, index)\n\tdelete(q.chunkAllocated, index)\n\treturn nil\n}", "func (this *MyLinkedList) DeleteAtIndex(index int) {\n\tif this.head == nil || index < 0 {\n\t\treturn\n\t}\n\ttable := make(map[int]*ListNode)\n\ttail, i := this.head, 0\n\tfor tail != nil && i <= index {\n\t\ttable[i] = tail\n\t\ttail = tail.next\n\t\ti++\n\t}\n\tremoveElement := table[index]\n\tif removeElement == nil {\n\t\treturn\n\t}\n\tprev := table[index-1]\n\tvar next *ListNode\n\tif removeElement != nil {\n\t\tnext = removeElement.next\n\t}\n\tif prev == nil && next == nil {\n\t\tthis.head = nil\n\t\tthis.tail = nil\n\t} else {\n\t\tif prev == nil {\n\t\t\tthis.head = next\n\t\t} else {\n\t\t\tprev.next = next\n\t\t}\n\t}\n}", "func (i *Index) Delete(tr fdb.Transaction, primaryTuple tuple.Tuple, key tuple.Tuple) {\n\tif key == nil {\n\t\tfmt.Println(\"index key is NIL strange behavior\")\n\t\t// no need to clean, this field wasn't indexed\n\t\treturn\n\t}\n\tsub := i.dir.Sub(key...)\n\tif i.Unique {\n\t\tfmt.Println(\"+++ delete the index\", sub)\n\t\ttr.Clear(sub)\n\t} else {\n\t\t// Add primary here\n\t\tsub = sub.Sub(primaryTuple...)\n\t\ttr.Clear(sub) // removing old keys\n\t}\n}", "func (this *Array) Delete(index uint) (int, error){\n\tif this.isIndexOutOfRange(index){\n\t\treturn 0, errors.New(\"index out of range\")\n\t}\n\tv := this.data[index]\n\tfor i := index; i < this.Len()-1; i++{\n\t\tthis.data[i] = this.data[i+1]\n\t}\n\tthis.length --\n\treturn v, nil\n}", "func (this *MyLinkedList) DeleteAtIndex(index int) {\n\tif index < 0 || index >= this.length {\n\t\treturn\n\t}\n\n\tnode := this.getNode(index)\n\tif node.Prev == nil {\n\t\tthis.head = node.Next\n\n\t} else {\n\t\tnode.Prev.Next = node.Next\n\n\t}\n\n\tif node.Next == nil {\n\t\tthis.tail = node.Prev\n\n\t} else {\n\t\tnode.Next.Prev = node.Prev\n\n\t}\n\n\tthis.length = this.length - 1\n\n}", "func (this *MyLinkedList) DeleteAtIndex(index int) {\n\tif this.size == 0 {\n\t\treturn\n\t} else if index < 0 || index > this.size-1 {\n\t\treturn\n\t} else {\n\t\tif this.size == 1 {\n\t\t\tthis.head = nil\n\t\t\tthis.tail = nil\n\t\t\tthis.listMap = []*ListNode{}\n\t\t} else {\n\t\t\tthis.listMap[index-1].Next = this.listMap[index].Next\n\t\t\tthis.listMap = append(this.listMap[:index], this.listMap[index+1:]...)\n\t\t}\n\t\tthis.size--\n\t}\n}", "func indexTruncateInTxn(\n\tctx context.Context,\n\ttxn *kv.Txn,\n\texecCfg *ExecutorConfig,\n\tevalCtx *tree.EvalContext,\n\ttableDesc catalog.TableDescriptor,\n\tidx *descpb.IndexDescriptor,\n\ttraceKV bool,\n) error {\n\talloc := &rowenc.DatumAlloc{}\n\tvar sp roachpb.Span\n\tfor done := false; !done; done = sp.Key == nil {\n\t\trd := row.MakeDeleter(execCfg.Codec, tableDesc, nil /* requestedCols */)\n\t\ttd := tableDeleter{rd: rd, alloc: alloc}\n\t\tif err := td.init(ctx, txn, evalCtx); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvar err error\n\t\tsp, err = td.deleteIndex(\n\t\t\tctx, idx, sp, indexTruncateChunkSize, traceKV,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Remove index zone configs.\n\treturn RemoveIndexZoneConfigs(ctx, txn, execCfg, tableDesc, []descpb.IndexDescriptor{*idx})\n}", "func (o *KeyValueOrdered) RemoveIndex(idx int) (cell KeyValueCapsule) {\n\tcell = o.s[idx]\n\tdelete(o.m, o.s[idx].K)\n\to.shift(idx+1, len(o.s), -1)\n\to.s = append(o.s[:idx], o.s[idx+1:]...)\n\treturn\n}", "func (i *Index) Delete() error {\n\treturn i.Drop()\n}", "func (l *LinkedList) Delete(index int) {\n\t// Abort if index is not valid\n\tif index > l.length || index <= 0 {\n\t\treturn\n\t}\n\n\tif index == 1 {\n\t\tl.head = l.head.next\n\t\tl.length--\n\t\treturn\n\t}\n\n\tp := l.head\n\t// loop until the place right before the node that is going away\n\tfor i := 0; i < index-2; i++ {\n\t\tp = p.next\n\t}\n\tp.next = p.next.next\n\tl.length--\n}", "func (a *DynamicArray) EraseAt(index int) error {\n\tif index < 0 || index >= a.len {\n\t\treturn ErrArrIndexOutOfBound\n\t}\n\n\tcopy(a.data[index:], a.data[index+1:])\n\ta.len--\n\n\t// if the length of the array is 1/4 of current capacity, resize the array to half of the space\n\tif a.len < a.cap/4 {\n\t\ta.resize(a.cap / 2)\n\t}\n\treturn nil\n}", "func (sc *SchemaChanger) truncateIndexes(\n\tctx context.Context, version descpb.DescriptorVersion, dropped []descpb.IndexDescriptor,\n) error {\n\tlog.Infof(ctx, \"clearing data for %d indexes\", len(dropped))\n\n\tchunkSize := sc.getChunkSize(indexTruncateChunkSize)\n\tif sc.testingKnobs.BackfillChunkSize > 0 {\n\t\tchunkSize = sc.testingKnobs.BackfillChunkSize\n\t}\n\talloc := &rowenc.DatumAlloc{}\n\tfor _, desc := range dropped {\n\t\tvar resume roachpb.Span\n\t\tfor rowIdx, done := int64(0), false; !done; rowIdx += chunkSize {\n\t\t\tresumeAt := resume\n\t\t\tif log.V(2) {\n\t\t\t\tlog.Infof(ctx, \"drop index (%d, %d) at row: %d, span: %s\",\n\t\t\t\t\tsc.descID, sc.mutationID, rowIdx, resume)\n\t\t\t}\n\n\t\t\t// Make a new txn just to drop this chunk.\n\t\t\tif err := sc.db.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error {\n\t\t\t\tif fn := sc.execCfg.DistSQLRunTestingKnobs.RunBeforeBackfillChunk; fn != nil {\n\t\t\t\t\tif err := fn(resume); 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\tif fn := sc.execCfg.DistSQLRunTestingKnobs.RunAfterBackfillChunk; fn != nil {\n\t\t\t\t\tdefer fn()\n\t\t\t\t}\n\n\t\t\t\t// Retrieve a lease for this table inside the current txn.\n\t\t\t\ttc := descs.NewCollection(sc.settings, sc.leaseMgr, nil /* hydratedTables */)\n\t\t\t\tdefer tc.ReleaseAll(ctx)\n\t\t\t\ttableDesc, err := sc.getTableVersion(ctx, txn, tc, version)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\trd := row.MakeDeleter(sc.execCfg.Codec, tableDesc, nil /* requestedCols */)\n\t\t\t\ttd := tableDeleter{rd: rd, alloc: alloc}\n\t\t\t\tif err := td.init(ctx, txn, nil /* *tree.EvalContext */); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif !canClearRangeForDrop(&desc) {\n\t\t\t\t\tresume, err = td.deleteIndex(\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\t&desc,\n\t\t\t\t\t\tresumeAt,\n\t\t\t\t\t\tchunkSize,\n\t\t\t\t\t\tfalse, /* traceKV */\n\t\t\t\t\t)\n\t\t\t\t\tdone = resume.Key == nil\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tdone = true\n\t\t\t\treturn td.clearIndex(ctx, &desc)\n\t\t\t}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t// All the data chunks have been removed. Now also removed the\n\t\t// zone configs for the dropped indexes, if any.\n\t\tif err := sc.db.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error {\n\t\t\ttable, err := catalogkv.MustGetTableDescByID(ctx, txn, sc.execCfg.Codec, sc.descID)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn RemoveIndexZoneConfigs(ctx, txn, sc.execCfg, table, dropped)\n\t\t}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tlog.Info(ctx, \"finished clearing data for indexes\")\n\treturn nil\n}", "func (s store) Remove(index string) {\n\n\trunThreadSafe(func() {\n\t\tdelete(s, index)\n\t})\n\n\ts.writeToDisk()\n}", "func (b *Indexer) Delete(_ context.Context, ids ...int64) error {\n\tbatch := inner_bleve.NewFlushingBatch(b.inner.Indexer, maxBatchSize)\n\tfor _, id := range ids {\n\t\tif err := batch.Delete(indexer_internal.Base36(id)); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn batch.Flush()\n}", "func (f *factory) TruncatePages(index int64) {\n\tf.mutex.Lock()\n\tdefer f.mutex.Unlock()\n\n\tif f.closed.Load() {\n\t\treturn\n\t}\n\n\tfor pageID := range f.pages {\n\t\tif pageID < index {\n\t\t\tif page, ok := f.pages[pageID]; ok {\n\t\t\t\tif err := page.Close(); err != nil {\n\t\t\t\t\tf.logger.Warn(\"close page failure\",\n\t\t\t\t\t\tlogger.String(\"path\", f.path), logger.Any(\"page\", pageID), logger.Error(err))\n\t\t\t\t}\n\t\t\t\tif err := removeFileFunc(f.pageFileName(pageID)); err != nil {\n\t\t\t\t\tf.logger.Warn(\"remove page failure\",\n\t\t\t\t\t\tlogger.String(\"path\", f.path), logger.Any(\"page\", pageID), logger.Error(err))\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tdelete(f.pages, pageID)\n\t\t\t\tf.size.Sub(int64(f.pageSize))\n\n\t\t\t\tf.logger.Info(\"remove page successfully\",\n\t\t\t\t\tlogger.String(\"path\", f.path), logger.Any(\"page\", pageID))\n\t\t\t}\n\t\t}\n\t}\n}", "func (idx *Autoincrement) Delete() error {\n\tctx, err := idx.getAuthenticatedContext(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn deleteIndexRoot(ctx, idx.storageProvider, idx.indexRootDir)\n}", "func (s *BasePlSqlParserListener) ExitDrop_index_partition(ctx *Drop_index_partitionContext) {}", "func (t *txLookUp) RemoveByIndex(i int) {\n\tt.mu.Lock()\n\tdefer t.mu.Unlock()\n\n\tt.removeByIndex(i)\n}", "func Delete(slice []int, index int) []int {\n\treturn append(slice[:index], slice[index+1:]...)\n}", "func (i ImageIndexer) DeleteFromIndex(request DeleteFromIndexRequest) error {\n\tbuildDir, outDockerfile, cleanup, err := buildContext(request.Generate, request.OutDockerfile)\n\tdefer cleanup()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdatabasePath, err := i.ExtractDatabase(buildDir, request.FromIndex, request.CaFile, request.SkipTLSVerify, request.PlainHTTP)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Run opm registry delete on the database\n\tdeleteFromRegistryReq := registry.DeleteFromRegistryRequest{\n\t\tPackages: request.Operators,\n\t\tInputDatabase: databasePath,\n\t\tPermissive: request.Permissive,\n\t}\n\n\t// Delete the bundles from the registry\n\terr = i.RegistryDeleter.DeleteFromRegistry(deleteFromRegistryReq)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// generate the dockerfile\n\tdockerfile := i.DockerfileGenerator.GenerateIndexDockerfile(request.BinarySourceImage, databasePath)\n\terr = write(dockerfile, outDockerfile, i.Logger)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif request.Generate {\n\t\treturn nil\n\t}\n\n\t// build the dockerfile\n\terr = build(outDockerfile, request.Tag, i.CommandRunner, i.Logger)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (idx *Unique) Delete() error {\n\tctx, err := idx.getAuthenticatedContext(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn deleteIndexRoot(ctx, idx.storageProvider, idx.indexRootDir)\n}", "func (kf *KafkaIndexer) Delete(skey *repr.StatName) error {\n\t// noop if not writing indexes\n\tif !kf.writeIndex {\n\t\treturn nil\n\t}\n\n\titem := &KafkaPath{\n\t\tType: \"delete\",\n\t\tId: skey.UniqueId(),\n\t\tPath: skey.Key,\n\t\tSegments: strings.Split(skey.Key, \".\"),\n\t\tTags: skey.SortedTags().Tags(),\n\t\tMetaTags: skey.SortedMetaTags().Tags(),\n\t\tSentTime: time.Now().UnixNano(),\n\t}\n\n\tstats.StatsdClientSlow.Incr(\"writer.kafka.indexer.delete\", 1)\n\n\tkf.conn.Input() <- &sarama.ProducerMessage{\n\t\tTopic: kf.db.IndexTopic(),\n\t\tKey: sarama.StringEncoder(skey.Key), // hash on metric key\n\t\tValue: item,\n\t}\n\treturn nil\n}", "func (xs *Sheet) DelMergeByIndex(index int) int {\n\ttmp, _, _ := xs.xb.lib.NewProc(\"xlSheetDelMergeByIndexW\").\n\t\tCall(xs.self, I(index))\n\treturn int(tmp)\n}", "func (s *TattooStorage) DeleteArticleTagIndex(name string) {\n\t// detach\n\tmeta, err := s.GetMeta(name)\n\tif err != nil {\n\t\treturn\n\t}\n\tfor _, t := range meta.Tags {\n\t\tif s.TagIndexDB.Has(t) {\n\t\t\tlst_buff, _ := s.TagIndexDB.GetJSON(t)\n\t\t\tarticleList := lst_buff.([]interface{})\n\t\t\tnewList := make([]string, 0)\n\t\t\tfor _, n := range articleList {\n\t\t\t\tif n.(string) != name {\n\t\t\t\t\tnewList = append(newList, n.(string))\n\t\t\t\t}\n\t\t\t}\n\t\t\ts.TagIndexDB.SetJSON(t, newList)\n\t\t}\n\t}\n\ts.TagIndexDB.SaveIndex()\n}", "func (tds ToDos) Delete(i int) ToDos {\n\tcopy(tds[i:], tds[i+1:])\n\ttds[len(tds)-1] = nil\n\treturn tds[:len(tds)-1]\n}", "func (i *Index) Delete(tx Tx, foreignKey, primaryKey []byte) error {\n\tbkt, err := i.indexBucket(tx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn bkt.Delete(indexKey(foreignKey, primaryKey))\n}", "func (l *list) delete(i int) {\n\n\tif l.begin == nil {\n\t\tpanic(\"list empty\")\n\t}\n\n\t// List over/underflow\n\tif i > l.nodes || i < 0 {\n\t\tpanic(\"not exists\")\n\t}\n\n\t// Removing the last node\n\tif l.nodes == 1 && i == 0 {\n\t\tl.begin = nil\n\t\tl.nodes = 0\n\t\treturn\n\t}\n\n\t// Removing at the end of the list\n\tif i == l.nodes-1 {\n\t\tn := l.begin\n\n\t\tfor j := 0; j < l.nodes-1; j++ {\n\t\t\tn = n.right\n\t\t}\n\n\t\tn.left.right = nil\n\t\tn = nil\n\t\tl.nodes--\n\t\treturn\n\t}\n\n\t// Removing the first node\n\tif i == 0 {\n\t\tn := l.begin.right\n\t\tl.begin = n\n\t\tl.begin.left = nil\n\t\tl.nodes--\n\t\treturn\n\t}\n\n\n\t// Removing in somewhere between\n\tc := l.begin\n\n\tfor j := 0; j < i; j++ {\n\t\tc = c.right\n\t}\n\n\tc.left.right, c.right.left = c.right, c.left\n\tl.nodes--\n}", "func (del *Delete) deleteVindexEntries(ctx context.Context, vcursor VCursor, bindVars map[string]*querypb.BindVariable, rss []*srvtopo.ResolvedShard) error {\n\tif del.OwnedVindexQuery == \"\" {\n\t\treturn nil\n\t}\n\tqueries := make([]*querypb.BoundQuery, len(rss))\n\tfor i := range rss {\n\t\tqueries[i] = &querypb.BoundQuery{Sql: del.OwnedVindexQuery, BindVariables: bindVars}\n\t}\n\tsubQueryResults, errors := vcursor.ExecuteMultiShard(ctx, del, rss, queries, false /* rollbackOnError */, false /* canAutocommit */)\n\tfor _, err := range errors {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(subQueryResults.Rows) == 0 {\n\t\treturn nil\n\t}\n\n\tfor _, row := range subQueryResults.Rows {\n\t\tksid, err := resolveKeyspaceID(ctx, vcursor, del.KsidVindex, row[0:del.KsidLength])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcolnum := del.KsidLength\n\t\tfor _, colVindex := range del.Vindexes {\n\t\t\t// Fetch the column values. colnum must keep incrementing.\n\t\t\tfromIds := make([]sqltypes.Value, 0, len(colVindex.Columns))\n\t\t\tfor range colVindex.Columns {\n\t\t\t\tfromIds = append(fromIds, row[colnum])\n\t\t\t\tcolnum++\n\t\t\t}\n\t\t\tif err := colVindex.Vindex.(vindexes.Lookup).Delete(ctx, vcursor, [][]sqltypes.Value{fromIds}, ksid); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (i *Index) DeleteAll(ctx context.Context, store Store) error {\n\tdiff, err := i.verify(ctx, store, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor k, v := range diff.MissingFromSource {\n\t\tif fkm, ok := diff.PresentInIndex[k]; ok {\n\t\t\tfor pk := range v {\n\t\t\t\tfkm[pk] = struct{}{}\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tdiff.PresentInIndex[k] = v\n\t}\n\n\treturn i.remove(ctx, store, diff.PresentInIndex)\n}", "func (list *List) removeByIndex(idx int) error {\n\tlist_ := []interface{}(*list)\n\t*list = append(list_[:idx], list_[idx+1:]...)\n\treturn nil\n}", "func (a *Array) Delete(index int) interface{} {\n\tdefer func() {\n\t\ta.Data = append(a.Data[:index], a.Data[index+1:]...)\n\t\ta.Length--\n\t}()\n\treturn a.Data[index]\n}", "func (obj *LineFile) deleteIndexFiles() {\n\tfilePrefix := obj.filePathHash\n\tindexFolder := path.Join(obj.fileDir, \"index\")\n\tos.MkdirAll(indexFolder, 0755)\n\tDeleteFiles(indexFolder, filePrefix+\"_*.idx\")\n}", "func (it *Dppdpp1intfifoMetricsIterator) Delete(key uint64) error {\n\n\treturn it.iter.Delete(gometrics.EncodeScalarKey(key))\n\n}", "func (s *LDBStore) CleanGCIndex() error {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tbatch := leveldb.Batch{}\n\n\tvar okEntryCount uint64\n\tvar totalEntryCount uint64\n\n\t// throw out all gc indices, we will rebuild from cleaned index\n\tit := s.db.NewIterator()\n\tit.Seek([]byte{keyGCIdx})\n\tvar gcDeletes int\n\tfor it.Valid() {\n\t\trowType, _ := parseIdxKey(it.Key())\n\t\tif rowType != keyGCIdx {\n\t\t\tbreak\n\t\t}\n\t\tbatch.Delete(it.Key())\n\t\tgcDeletes++\n\t\tit.Next()\n\t}\n\tlog.Debug(\"gc\", \"deletes\", gcDeletes)\n\tif err := s.db.Write(&batch); err != nil {\n\t\treturn err\n\t}\n\tbatch.Reset()\n\n\tit.Release()\n\n\t// corrected po index pointer values\n\tvar poPtrs [256]uint64\n\n\t// set to true if chunk count not on 4096 iteration boundary\n\tvar doneIterating bool\n\n\t// last key index in previous iteration\n\tlastIdxKey := []byte{keyIndex}\n\n\t// counter for debug output\n\tvar cleanBatchCount int\n\n\t// go through all key index entries\n\tfor !doneIterating {\n\t\tcleanBatchCount++\n\t\tvar idxs []dpaDBIndex\n\t\tvar chunkHashes [][]byte\n\t\tvar pos []uint8\n\t\tit := s.db.NewIterator()\n\n\t\tit.Seek(lastIdxKey)\n\n\t\t// 4096 is just a nice number, don't look for any hidden meaning here...\n\t\tvar i int\n\t\tfor i = 0; i < 4096; i++ {\n\n\t\t\t// this really shouldn't happen unless database is empty\n\t\t\t// but let's keep it to be safe\n\t\t\tif !it.Valid() {\n\t\t\t\tdoneIterating = true\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// if it's not keyindex anymore we're done iterating\n\t\t\trowType, chunkHash := parseIdxKey(it.Key())\n\t\t\tif rowType != keyIndex {\n\t\t\t\tdoneIterating = true\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// decode the retrieved index\n\t\t\tvar idx dpaDBIndex\n\t\t\terr := decodeIndex(it.Value(), &idx)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"corrupt index: %v\", err)\n\t\t\t}\n\t\t\tpo := s.po(chunkHash)\n\t\t\tlastIdxKey = it.Key()\n\n\t\t\t// if we don't find the data key, remove the entry\n\t\t\t// if we find it, add to the array of new gc indices to create\n\t\t\tdataKey := getDataKey(idx.Idx, po)\n\t\t\t_, err = s.db.Get(dataKey)\n\t\t\tif err != nil {\n\t\t\t\tlog.Warn(\"deleting inconsistent index (missing data)\", \"key\", chunkHash)\n\t\t\t\tbatch.Delete(it.Key())\n\t\t\t} else {\n\t\t\t\tidxs = append(idxs, idx)\n\t\t\t\tchunkHashes = append(chunkHashes, chunkHash)\n\t\t\t\tpos = append(pos, po)\n\t\t\t\tokEntryCount++\n\t\t\t\tif idx.Idx > poPtrs[po] {\n\t\t\t\t\tpoPtrs[po] = idx.Idx\n\t\t\t\t}\n\t\t\t}\n\t\t\ttotalEntryCount++\n\t\t\tit.Next()\n\t\t}\n\t\tit.Release()\n\n\t\t// flush the key index corrections\n\t\terr := s.db.Write(&batch)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbatch.Reset()\n\n\t\t// add correct gc indices\n\t\tfor i, okIdx := range idxs {\n\t\t\tgcIdxKey := getGCIdxKey(&okIdx)\n\t\t\tgcIdxData := getGCIdxValue(&okIdx, pos[i], chunkHashes[i])\n\t\t\tbatch.Put(gcIdxKey, gcIdxData)\n\t\t\tlog.Trace(\"clean ok\", \"key\", chunkHashes[i], \"gcKey\", gcIdxKey, \"gcData\", gcIdxData)\n\t\t}\n\n\t\t// flush them\n\t\terr = s.db.Write(&batch)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbatch.Reset()\n\n\t\tlog.Debug(\"clean gc index pass\", \"batch\", cleanBatchCount, \"checked\", i, \"kept\", len(idxs))\n\t}\n\n\tlog.Debug(\"gc cleanup entries\", \"ok\", okEntryCount, \"total\", totalEntryCount, \"batchlen\", batch.Len())\n\n\t// lastly add updated entry count\n\tvar entryCount [8]byte\n\tbinary.BigEndian.PutUint64(entryCount[:], okEntryCount)\n\tbatch.Put(keyEntryCnt, entryCount[:])\n\n\t// and add the new po index pointers\n\tvar poKey [2]byte\n\tpoKey[0] = keyDistanceCnt\n\tfor i, poPtr := range poPtrs {\n\t\tpoKey[1] = uint8(i)\n\t\tif poPtr == 0 {\n\t\t\tbatch.Delete(poKey[:])\n\t\t} else {\n\t\t\tvar idxCount [8]byte\n\t\t\tbinary.BigEndian.PutUint64(idxCount[:], poPtr)\n\t\t\tbatch.Put(poKey[:], idxCount[:])\n\t\t}\n\t}\n\n\t// if you made it this far your harddisk has survived. Congratulations\n\treturn s.db.Write(&batch)\n}", "func (root *mTreap) erase(i treapIter) {\n\troot.removeNode(i.t)\n}", "func (idx *Unique) Delete() error {\n\treturn os.RemoveAll(idx.indexRootDir)\n}", "func (l *LinkedList) Delete(index int) error {\n // lock searchers\n // lock inserters\n\n var prev *LLNode\n n := l.Root\n\n if index == 0 {\n if l.Root.Next != nil {\n l.Root = l.Root.Next\n } else {\n l.Root = nil\n }\n\n return nil\n }\n\n i := 0\n\n for ; n != nil && i != index; i++ {\n prev = n\n n = n.Next\n }\n\n if i != index {\n return errors.New(\"index does not exist\")\n fmt.Println(\"error\")\n }\n\n if n.Next != nil {\n prev.Next = n.Next\n } else {\n prev.Next = nil\n }\n\n return nil\n}", "func (w *WidgetImplement) RemoveChildByIndex(index int) {\n\tw.children[index].SetParent(nil)\n\t// w.children, w.children[len(w.children)-1] = append(w.children[:i], w.children[i+1:]...), nil\n\t// https://github.com/gopherjs/gopherjs/issues/358\n\t// The following code is work around of the above issue\n\tvar newChildren []Widget\n\tfor i, child := range w.children {\n\t\tif i != index {\n\t\t\tnewChildren = append(newChildren, child)\n\t\t}\n\t}\n\tw.children = newChildren\n}", "func (l *list) delete(i int) {\n\tif i < 0 || i >= l.size {\n\t\tpanic(\"list index out of bounds\")\n\t}\n\n\tvar n *node\n\tmid := l.size/2\n\tif mid >= i {\n\t\tn = l.root\n\t\tfor ; i!=0; i-- {\n\t\t\tn = n.next\n\t\t}\n\t} else {\n\t\tn = l.tail\n\t\tfor i=l.size-i-1; i!=0; i-- {\n\t\t\tn = n.prev\n\t\t}\n\t}\n\tif n.prev != nil {\n\t\tn.prev.next = n.next\n\t} else {\n\t\tl.root = n.next\n\t}\n\tif n.next != nil {\n\t\tn.next.prev = n.prev\n\t} else {\n\t\tl.tail = n.prev\n\t}\n\tl.size--\t\n}", "func (it *Dppdpp1intsramseccMetricsIterator) Delete(key uint64) error {\n\n\treturn it.iter.Delete(gometrics.EncodeScalarKey(key))\n\n}", "func (r *Root) Delete(ctx context.Context, i uint64) (bool, error) {\n\tif i > MaxIndex {\n\t\treturn false, fmt.Errorf(\"index %d is out of range for the amt\", i)\n\t}\n\n\t// shortcut, index is greater than what we hold so we know it's not there\n\tif i >= nodesForHeight(r.bitWidth, r.height+1) {\n\t\treturn false, nil\n\t}\n\n\tfound, err := r.node.delete(ctx, r.store, r.bitWidth, r.height, i)\n\tif err != nil {\n\t\treturn false, err\n\t} else if !found {\n\t\treturn false, nil\n\t}\n\n\t// The AMT invariant dictates that for any non-empty AMT, the root node must\n\t// not address only its left-most child node. Where a deletion has created a\n\t// state where the current root node only consists of a link to the left-most\n\t// child and no others, that child node must become the new root node (i.e.\n\t// the height is reduced by 1). We perform the same check on the new root node\n\t// such that we reduce the AMT to canonical form for this data set.\n\t// In the extreme case, it is possible to perform a collapse from a large\n\t// `height` to height=0 where the index being removed is very large and there\n\t// remains no other indexes or the remaining indexes are in the range of 0 to\n\t// bitWidth^8.\n\t// See node.collapse() for more notes.\n\tnewHeight, err := r.node.collapse(ctx, r.store, r.bitWidth, r.height)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tr.height = newHeight\n\n\t// Something is very wrong but there's not much we can do. So we perform\n\t// the operation and then tell the user that something is wrong.\n\tif r.count == 0 {\n\t\treturn false, errInvalidCount\n\t}\n\n\tr.count--\n\treturn true, nil\n}", "func (o PublisherSearchIdxSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(publisherSearchIdxBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), publisherSearchIdxPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"publisher_search_idx\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, publisherSearchIdxPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from publisherSearchIdx slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for publisher_search_idx\")\n\t}\n\n\tif len(publisherSearchIdxAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (w *worker) cleanupPhysicalTableIndex(t table.PhysicalTable, reorgInfo *reorgInfo) error {\n\tlogutil.BgLogger().Info(\"start to clean up index\", zap.String(\"category\", \"ddl\"), zap.String(\"job\", reorgInfo.Job.String()), zap.String(\"reorgInfo\", reorgInfo.String()))\n\treturn w.writePhysicalTableRecord(w.sessPool, t, typeCleanUpIndexWorker, reorgInfo)\n}", "func (it *Dppdpp0intfifoMetricsIterator) Delete(key uint64) error {\n\n\treturn it.iter.Delete(gometrics.EncodeScalarKey(key))\n\n}", "func (ix *IndexedBucket) deleteIndices(tx *bolt.Tx, entries []Record) error {\n\tchanges := make(map[string][]string, len(ix.indices))\n\tvar idxValsMap map[string][]string\n\tvar err error\n\tfor _, entry := range entries {\n\t\tif entry != nil {\n\t\t\tparentId := entry.Key()\n\t\t\tif idxValsMap, err = ix.getIndexValues(entry, ix.indices); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfor idxName, indexVals := range idxValsMap {\n\t\t\t\tfor _, indexVal := range indexVals {\n\t\t\t\t\tchanges[idxName] = append(changes[idxName], toIndexEntry(indexVal, parentId))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn writeIndexChanges(tx, changes, deleteIndexOp)\n}", "func (it *Dprdpr1intfifoMetricsIterator) Delete(key uint64) error {\n\n\treturn it.iter.Delete(gometrics.EncodeScalarKey(key))\n\n}", "func (e *ObservableEditableBuffer) DeleteAt(rp0, rp1 int) {\n\tp0 := e.f.RuneTuple(rp0)\n\tp1 := e.f.RuneTuple(rp1)\n\n\te.Delete(p0, p1)\n}", "func (buf *ListBuffer) Delete(idx BufferIndex) *error.Error {\n\tinRange, initialized := buf.legalIndex(idx)\n\tif !inRange {\n\t\tdesc := fmt.Sprintf(\n\t\t\t\"idx, %d, is out of range for IndexBuffer of length %d.\",\n\t\t\tidx, len(buf.Buffer),\n\t\t)\n\t\treturn error.New(error.Value, desc)\n\t} else if !initialized {\n\t\tdesc := fmt.Sprintf(\n\t\t\t\"Item at idx, %d, has the Type value Uninitialized.\", idx,\n\t\t)\n\t\treturn error.New(error.Value, desc)\n\t}\n\n\tbuf.internalDelete(idx)\n\treturn nil\n}", "func (O ObjectCollection) Delete(i int) error {\n\tif C.dpiObject_deleteElementByIndex(O.dpiObject, C.int32_t(i)) == C.DPI_FAILURE {\n\t\treturn errors.Errorf(\"delete(%d): %w\", i, O.getError())\n\t}\n\treturn nil\n}", "func (ix *IndexedBucket) Delete(keys []string) error {\n\treturn ix.deleteRecs(keys, nil)\n}", "func (it *Dprdpr1intsramseccMetricsIterator) Delete(key uint64) error {\n\n\treturn it.iter.Delete(gometrics.EncodeScalarKey(key))\n\n}", "func (l *List) Delete(i int) {\n\tli := l.rootItem\n\tli.Delete(i)\n}", "func gcIndexes(\n\tctx context.Context,\n\texecCfg *sql.ExecutorConfig,\n\tparentID descpb.ID,\n\tprogress *jobspb.SchemaChangeGCProgress,\n) error {\n\tdroppedIndexes := progress.Indexes\n\tif log.V(2) {\n\t\tlog.Infof(ctx, \"GC is being considered on table %d for indexes indexes: %+v\", parentID, droppedIndexes)\n\t}\n\n\t// Before deleting any indexes, ensure that old versions of the table descriptor\n\t// are no longer in use. This is necessary in the case of truncate, where we\n\t// schedule a GC Job in the transaction that commits the truncation.\n\tif err := sql.WaitToUpdateLeases(ctx, execCfg.LeaseManager, parentID); err != nil {\n\t\treturn err\n\t}\n\n\tvar parentTable catalog.TableDescriptor\n\tif err := execCfg.DB.Txn(ctx, func(ctx context.Context, txn *kv.Txn) (err error) {\n\t\tparentTable, err = catalogkv.MustGetTableDescByID(ctx, txn, execCfg.Codec, parentID)\n\t\treturn err\n\t}); err != nil {\n\t\treturn errors.Wrapf(err, \"fetching parent table %d\", parentID)\n\t}\n\n\tfor _, index := range droppedIndexes {\n\t\tif index.Status != jobspb.SchemaChangeGCProgress_DELETING {\n\t\t\tcontinue\n\t\t}\n\n\t\tindexDesc := descpb.IndexDescriptor{ID: index.IndexID}\n\t\tif err := clearIndex(ctx, execCfg, parentTable, indexDesc); err != nil {\n\t\t\treturn errors.Wrapf(err, \"clearing index %d\", indexDesc.ID)\n\t\t}\n\n\t\t// All the data chunks have been removed. Now also removed the\n\t\t// zone configs for the dropped indexes, if any.\n\t\tremoveIndexZoneConfigs := func(\n\t\t\tctx context.Context, txn *kv.Txn, descriptors *descs.Collection,\n\t\t) error {\n\t\t\tfreshParentTableDesc, err := descriptors.GetMutableTableByID(\n\t\t\t\tctx, txn, parentID, tree.ObjectLookupFlags{\n\t\t\t\t\tCommonLookupFlags: tree.CommonLookupFlags{\n\t\t\t\t\t\tAvoidCached: true,\n\t\t\t\t\t\tRequired: true,\n\t\t\t\t\t\tIncludeDropped: true,\n\t\t\t\t\t\tIncludeOffline: true,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttoRemove := []descpb.IndexDescriptor{indexDesc}\n\t\t\treturn sql.RemoveIndexZoneConfigs(\n\t\t\t\tctx, txn, execCfg, freshParentTableDesc, toRemove,\n\t\t\t)\n\t\t}\n\t\tlm, ie, db := execCfg.LeaseManager, execCfg.InternalExecutor, execCfg.DB\n\t\tif err := descs.Txn(\n\t\t\tctx, execCfg.Settings, lm, ie, db, removeIndexZoneConfigs,\n\t\t); err != nil {\n\t\t\treturn errors.Wrapf(err, \"removing index %d zone configs\", indexDesc.ID)\n\t\t}\n\n\t\tif err := completeDroppedIndex(\n\t\t\tctx, execCfg, parentTable, index.IndexID, progress,\n\t\t); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (it *Dprdpr1intflopfifo0MetricsIterator) Delete(key uint64) error {\n\n\treturn it.iter.Delete(gometrics.EncodeScalarKey(key))\n\n}", "func (dm *DMap) deleteOnCluster(hkey uint64, key string, f *fragment) error {\n\towners := dm.s.primary.PartitionOwnersByHKey(hkey)\n\tif len(owners) == 0 {\n\t\tpanic(\"partition owners list cannot be empty\")\n\t}\n\n\terr := dm.deleteFromPreviousOwners(key, owners)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif dm.s.config.ReplicaCount != 0 {\n\t\terr := dm.deleteBackupOnCluster(hkey, key)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = f.storage.Delete(hkey)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// DeleteHits is the number of deletion reqs resulting in an item being removed.\n\tDeleteHits.Increase(1)\n\n\treturn nil\n}", "func (l *list) delete(i int) {\n n := l.first\n\n j := 0\n for n.next != nil && j < i {\n n = n.next\n j++\n }\n\n if j == 0 && n != nil {\n l.first = n.next\n }\n\n tmp := n.next\n\n if (n.prev != nil) {\n n.prev.next = tmp\n }\n\n if (n.next != nil) {\n n.next.prev = n.prev\n }\n\n}", "func (it *Dprdpr1intflopfifo1MetricsIterator) Delete(key uint64) error {\n\n\treturn it.iter.Delete(gometrics.EncodeScalarKey(key))\n\n}", "func (it *Dprdpr0intflopfifo1MetricsIterator) Delete(key uint64) error {\n\n\treturn it.iter.Delete(gometrics.EncodeScalarKey(key))\n\n}", "func (q *chunkQueue) Retry(index uint32) {\n\tq.Lock()\n\tdefer q.Unlock()\n\tdelete(q.chunkReturned, index)\n}", "func (c *Client) Delete(indexName string) {\n\tclient := c.client\n\n\tr, err := client.DeleteIndex(indexName).Do()\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"%s\\n\", err.Error())\n\t\tos.Exit(1)\n\t}\n\tfmt.Fprintf(os.Stdout, \"%+v\\n\", r)\n}", "func (vector *Vector) Delete(i int) {\n\t//a = append(a[:i], a[i+1:]...)\n\t// or\n\t//a = a[:i+copy(a[i:], a[i+1:])]\n\t// NOTE If the type of the element is a pointer or a struct with pointer fields,\n\t// which need to be garbage collected, the above implementation of Delete has a potential\n\t// memory leak problem: some elements with values are still referenced by slice a and\n\t// thus can not be collected. The following code can fix this problem:\n\n\tcopy((*vector)[i:], (*vector)[i+1:])\n\t(*vector)[len(*vector)-1] = nil // or the zero value of T\n\t*vector = (*vector)[:len(*vector)-1]\n}", "func (it *Dppdpp0intsramseccMetricsIterator) Delete(key uint64) error {\n\n\treturn it.iter.Delete(gometrics.EncodeScalarKey(key))\n\n}", "func (rd *Deleter) DeleteIndexRow(\n\tctx context.Context, b *kv.Batch, idx *descpb.IndexDescriptor, values []tree.Datum, traceKV bool,\n) error {\n\t// We want to include empty k/v pairs because we want\n\t// to delete all k/v's for this row. By setting includeEmpty\n\t// to true, we will get a k/v pair for each family in the row,\n\t// which will guarantee that we delete all the k/v's in this row.\n\tsecondaryIndexEntry, err := rowenc.EncodeSecondaryIndex(\n\t\trd.Helper.Codec,\n\t\trd.Helper.TableDesc,\n\t\tidx,\n\t\trd.FetchColIDtoRowIndex,\n\t\tvalues,\n\t\ttrue, /* includeEmpty */\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, entry := range secondaryIndexEntry {\n\t\tif traceKV {\n\t\t\tlog.VEventf(ctx, 2, \"Del %s\", entry.Key)\n\t\t}\n\t\tb.Del(entry.Key)\n\t}\n\treturn nil\n}", "func (dict *Dictionary) DropIndex() {\n\tdict.shortIndex = nil\n\tdict.longIndex = nil\n}", "func TruncateInterleavedIndexes(\n\tctx context.Context,\n\texecCfg *ExecutorConfig,\n\ttable catalog.TableDescriptor,\n\tindexes []descpb.IndexDescriptor,\n) error {\n\tlog.Infof(ctx, \"truncating %d interleaved indexes\", len(indexes))\n\tchunkSize := int64(indexTruncateChunkSize)\n\talloc := &rowenc.DatumAlloc{}\n\tcodec, db := execCfg.Codec, execCfg.DB\n\tfor _, desc := range indexes {\n\t\tvar resume roachpb.Span\n\t\tfor rowIdx, done := int64(0), false; !done; rowIdx += chunkSize {\n\t\t\tlog.VEventf(ctx, 2, \"truncate interleaved index (%d) at row: %d, span: %s\", table.GetID(), rowIdx, resume)\n\t\t\tresumeAt := resume\n\t\t\t// Make a new txn just to drop this chunk.\n\t\t\tif err := db.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error {\n\t\t\t\trd := row.MakeDeleter(codec, table, nil /* requestedCols */)\n\t\t\t\ttd := tableDeleter{rd: rd, alloc: alloc}\n\t\t\t\tif err := td.init(ctx, txn, nil /* *tree.EvalContext */); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tresume, err := td.deleteIndex(\n\t\t\t\t\tctx,\n\t\t\t\t\t&desc,\n\t\t\t\t\tresumeAt,\n\t\t\t\t\tchunkSize,\n\t\t\t\t\tfalse, /* traceKV */\n\t\t\t\t)\n\t\t\t\tdone = resume.Key == nil\n\t\t\t\treturn err\n\t\t\t}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\t// All the data chunks have been removed. Now also removed the\n\t\t// zone configs for the dropped indexes, if any.\n\t\tif err := db.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error {\n\t\t\tfreshTableDesc, err := catalogkv.MustGetTableDescByID(ctx, txn, execCfg.Codec, table.GetID())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn RemoveIndexZoneConfigs(ctx, txn, execCfg, freshTableDesc, indexes)\n\t\t}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tlog.Infof(ctx, \"finished truncating interleaved indexes\")\n\treturn nil\n}", "func (s *BasePlSqlParserListener) ExitIndex_partitioning_clause(ctx *Index_partitioning_clauseContext) {\n}", "func (it *Dppdpp1intspareMetricsIterator) Delete(key uint64) error {\n\n\treturn it.iter.Delete(gometrics.EncodeScalarKey(key))\n\n}", "func (f *Controller) delete(indexName string, objectID string) error {\n\tindex, err := f.indexes.GetIndex(indexName)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = index.DeleteObject(objectID)\n\treturn err\n}", "func (sll *SingleLinkedList) Delete(index int) {\n\tsll.Pop(index)\n}", "func (si *SyncIndexJob) Delete(enable bool) {\n\tsi.SyncJob.Delete(enable)\n\tsi.IndexJob.Delete(enable)\n}", "func (it *Mcmc1intmcMetricsIterator) Delete(key uint64) error {\n\n\treturn it.iter.Delete(gometrics.EncodeScalarKey(key))\n\n}", "func (it *Dprdpr0intflopfifo0MetricsIterator) Delete(key uint64) error {\n\n\treturn it.iter.Delete(gometrics.EncodeScalarKey(key))\n\n}", "func (t *BinaryTree) Delete(i int) error {\n\tif t.root == nil {\n\t\treturn fmt.Errorf(\"EmptyTree\")\n\t}\n\tt.root = delete(t.root, i)\n\treturn nil\n}", "func removeItemByIndex(slice []string, idx int) []string {\n\n\tcopy(slice[idx:], slice[idx+1:]) // Shift slice[idx+1:] left one index.\n\tslice[len(slice)-1] = \"\" // Erase last element (write zero value).\n\treturn slice[:len(slice)-1] // Truncate slice.\n}" ]
[ "0.5937287", "0.5925396", "0.58589005", "0.5849641", "0.5842001", "0.58279634", "0.5782409", "0.573398", "0.5665251", "0.5616104", "0.55277663", "0.5515673", "0.54987186", "0.544783", "0.5431024", "0.5401115", "0.53936225", "0.53904444", "0.538792", "0.5361978", "0.5354139", "0.535174", "0.5343526", "0.53392935", "0.5333842", "0.5309717", "0.52785236", "0.5278103", "0.527408", "0.5243892", "0.5237321", "0.5203409", "0.5189358", "0.5184821", "0.51591593", "0.515708", "0.5155134", "0.5140513", "0.5139424", "0.5107865", "0.50988096", "0.50879097", "0.50867337", "0.5081806", "0.50811636", "0.50788206", "0.506247", "0.50311846", "0.50070035", "0.5003481", "0.5000847", "0.49831638", "0.49796996", "0.49781325", "0.49722853", "0.49625784", "0.4956271", "0.49397305", "0.49370342", "0.49185303", "0.49038678", "0.4902617", "0.48970443", "0.48963532", "0.48939654", "0.48907414", "0.48903278", "0.48882565", "0.488811", "0.48754147", "0.48691598", "0.4863917", "0.4846584", "0.48464438", "0.48420227", "0.48236647", "0.48158073", "0.48133174", "0.4809956", "0.48090848", "0.4805431", "0.47990212", "0.47953048", "0.47944432", "0.4782832", "0.477939", "0.47752857", "0.47708726", "0.4755114", "0.4749971", "0.47442812", "0.47403425", "0.47333726", "0.47262356", "0.47197172", "0.47012916", "0.46993482", "0.4689676", "0.46893784", "0.4688054" ]
0.6939409
0
mkdir makes an empty index directory (if doesn't exist) and returns a path.
func mkdir(elem ...string) (string, error) { path := filepath.Join(elem...) return path, os.MkdirAll(path, 0750) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (f *Fs) _mkdir(ctx context.Context, dirPath string) error {\n\t// We assume the root is already created\n\tif dirPath == \"\" {\n\t\treturn nil\n\t}\n\t// Collections must end with /\n\tif !strings.HasSuffix(dirPath, \"/\") {\n\t\tdirPath += \"/\"\n\t}\n\topts := rest.Opts{\n\t\tMethod: \"MKCOL\",\n\t\tPath: dirPath,\n\t\tNoResponse: true,\n\t}\n\terr := f.pacer.Call(func() (bool, error) {\n\t\tresp, err := f.srv.Call(ctx, &opts)\n\t\treturn f.shouldRetry(ctx, resp, err)\n\t})\n\tif apiErr, ok := err.(*api.Error); ok {\n\t\t// Check if it already exists. The response code for this isn't\n\t\t// defined in the RFC so the implementations vary wildly.\n\t\t//\n\t\t// owncloud returns 423/StatusLocked if the create is already in progress\n\t\tif apiErr.StatusCode == http.StatusMethodNotAllowed || apiErr.StatusCode == http.StatusNotAcceptable || apiErr.StatusCode == http.StatusLocked {\n\t\t\treturn nil\n\t\t}\n\t\t// 4shared returns a 409/StatusConflict here which clashes\n\t\t// horribly with the intermediate paths don't exist meaning. So\n\t\t// check to see if actually exists. This will correct other\n\t\t// error codes too.\n\t\tif f._dirExists(ctx, dirPath) {\n\t\t\treturn nil\n\t\t}\n\n\t}\n\treturn err\n}", "func (storage *B2Storage) CreateDirectory(threadIndex int, dir string) (err error) {\n return nil\n}", "func (f *FileUtil) mkdir() {\n\tfor _, path := range f.Paths {\n\t\tpath = FixPath(path)\n\t\tif f.Verbose {\n\t\t\tfmt.Println(\"Creating\", path)\n\t\t}\n\t\t_, err := f.dbx.CreateFolder(files.NewCreateFolderArg(path))\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n}", "func (c *cache) mkdir(name string) (string, error) {\n\tparent := path.Dir(name)\n\tif parent == \".\" {\n\t\tparent = \"\"\n\t}\n\tleaf := path.Base(name)\n\tparentPath := filepath.Join(c.root, filepath.FromSlash(parent))\n\terr := os.MkdirAll(parentPath, 0700)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"make cache directory failed\")\n\t}\n\treturn filepath.Join(parentPath, leaf), nil\n}", "func (f *fsDocWriter) mkdir(dir string, mode os.FileMode) error {\n\treturn os.MkdirAll(dir, mode)\n}", "func CreateOrUpdateHelmIndex(rootFs billy.Filesystem) error {\n\tabsRepositoryAssetsDir := filesystem.GetAbsPath(rootFs, path.RepositoryAssetsDir)\n\tabsRepositoryHelmIndexFile := filesystem.GetAbsPath(rootFs, path.RepositoryHelmIndexFile)\n\n\tvar helmIndexFile *helmRepo.IndexFile\n\n\t// Load index file from disk if it exists\n\texists, err := filesystem.PathExists(rootFs, path.RepositoryHelmIndexFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Encountered error while checking if Helm index file already exists in repository: %s\", err)\n\t} else if exists {\n\t\thelmIndexFile, err = helmRepo.LoadIndexFile(absRepositoryHelmIndexFile)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Encountered error while trying to load existing index file: %s\", err)\n\t\t}\n\t} else {\n\t\thelmIndexFile = helmRepo.NewIndexFile()\n\t}\n\n\t// Generate the current index file from the assets/ directory\n\tnewHelmIndexFile, err := helmRepo.IndexDirectory(absRepositoryAssetsDir, path.RepositoryAssetsDir)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Encountered error while trying to generate new Helm index: %s\", err)\n\t}\n\n\t// Merge the indices and sort them\n\thelmIndexFile.Merge(newHelmIndexFile)\n\thelmIndexFile.SortEntries()\n\n\t// Write new index to disk\n\terr = helmIndexFile.WriteFile(absRepositoryHelmIndexFile, os.ModePerm)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Encountered error while trying to write updated Helm index into index.yaml: %s\", err)\n\t}\n\treturn nil\n}", "func create_dirs() {\n\tif !exists(\"./templates/\") {\n\t\tos.Mkdir(\"./templates/\", 0777)\n\t}\n\tif !exists(\"./files/\") {\n\t\tos.Mkdir(\"./files/\", 0777)\n\t}\n\tif !exists(\"./output/\") {\n\t\tos.Mkdir(\"./output/\", 0777)\n\t}\n\tif !exists(\"./output/posts/\") {\n\t\tos.Mkdir(\"./output/posts/\", 0777)\n\t}\n\tif !exists(\"./output/pages/\") {\n\t\tos.Mkdir(\"./output/pages/\", 0777)\n\t}\n\tif !exists(\"./output/categories/\") {\n\t\tos.MkdirAll(\"./output/categories/\", 0777)\n\t}\n\tif !exists(\"./posts/\") {\n\t\tos.Mkdir(\"./posts/\", 0777)\n\t}\n\tif !exists(\"./pages/\") {\n\t\tos.Mkdir(\"./pages/\", 0777)\n\t}\n\tif !exists(\"./assets/css\") {\n\t\tos.MkdirAll(\"./assets/css\", 0777)\n\t}\n\tif !exists(\"./assets/css/images/ie6\") {\n\t\tos.MkdirAll(\"./assets/css/images/ie6\", 0777)\n\t}\n\tif !exists(\"./assets/js\") {\n\t\tos.Mkdir(\"./assets/js\", 0777)\n\t}\n\tif !exists(\"./assets/img\") {\n\t\tos.Mkdir(\"./assets/img\", 0777)\n\t}\n\tif !exists(\"./assets/img/icons\") {\n\t\tos.Mkdir(\"./assets/img/icons\", 0777)\n\t}\n}", "func createIndex(name string, paths []interface{}, wildcards []string) {\r\n\tf, err := os.Create(name)\r\n\tcheck(err)\r\n\tdefer f.Close()\r\n\tw := bufio.NewWriter(f)\r\n\tindexContents := []string{}\r\n\tfor _, path := range paths {\r\n\t\tp := path.(string)\r\n\t\tfilepath.Walk(p, walker(&indexContents, wildcards))\r\n\t}\r\n\tfor i := range indexContents {\r\n\t\ts := fmt.Sprintln(indexContents[i])\r\n\t\tbc, err := w.WriteString(s)\r\n\t\tcheck(err)\r\n\t\tif bc < len(s) {\r\n\t\t\tpanic(fmt.Sprintf(\"Couldn't write to %s\", name))\r\n\t\t}\r\n\t}\r\n\tw.Flush()\r\n\treturn\r\n}", "func (f *Fs) mkdir(ctx context.Context, dirPath string) (err error) {\n\t// defer log.Trace(dirPath, \"\")(\"err=%v\", &err)\n\terr = f._mkdir(ctx, dirPath)\n\tif apiErr, ok := err.(*api.Error); ok {\n\t\t// parent does not exist so create it first then try again\n\t\tif apiErr.StatusCode == http.StatusConflict {\n\t\t\terr = f.mkParentDir(ctx, dirPath)\n\t\t\tif err == nil {\n\t\t\t\terr = f._mkdir(ctx, dirPath)\n\t\t\t}\n\t\t}\n\t}\n\treturn err\n}", "func createdir(dirname string) error {\n\tvar err error\n\t_, err = os.Stat(dirname)\n\tif err != nil {\n\t\t// Create bucket-path directory for non existent paths.\n\t\tif os.IsNotExist(err) {\n\t\t\terr = os.MkdirAll(dirname, 0755)\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"Failed to create dir %q, err: %v\", dirname, err)\n\t\t\t}\n\t\t} else {\n\t\t\tglog.Errorf(\"Failed to stat %s, err: %v\", dirname, err)\n\t\t}\n\t}\n\treturn err\n}", "func MakeIndex() error {\n\n\treturn nil\n}", "func createDirIfNotExist(path string) error {\n\tconst mode = 0755\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\terr := os.Mkdir(path, mode)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func mkdir(p string) error {\n\tstat, err := os.Stat(p)\n\tif trace.IsNotFound(err) {\n\t\tif err := os.MkdirAll(p, botfs.DefaultDirMode); err != nil {\n\t\t\tif errors.Is(err, fs.ErrPermission) {\n\t\t\t\treturn trace.Wrap(err, \"Teleport does not have permission to write to %v. Ensure that you are running as a user with appropriate permissions.\", p)\n\t\t\t}\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\n\t\tlog.Infof(\"Created directory %q\", p)\n\t} else if err != nil {\n\t\t// this can occur if we are unable to read the data dir\n\t\tif errors.Is(err, fs.ErrPermission) {\n\t\t\treturn trace.Wrap(err, \"Teleport does not have permission to access: %v. Ensure that you are running as a user with appropriate permissions.\", p)\n\t\t}\n\t\treturn trace.Wrap(err)\n\t} else if !stat.IsDir() {\n\t\treturn trace.BadParameter(\"Path %q already exists and is not a directory\", p)\n\t}\n\n\treturn nil\n}", "func createIfNotExists(path string, isDir bool) error {\n\tif _, err := os.Stat(path); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tif isDir {\n\t\t\t\treturn os.MkdirAll(path, 0755)\n\t\t\t}\n\t\t\tif err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tf, err := os.OpenFile(path, os.O_CREATE, 0755)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tf.Close()\n\t\t}\n\t}\n\treturn nil\n}", "func createDirIfNotExists(dirPath string) {\n\tif err := os.MkdirAll(dirPath, os.ModePerm); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func (p *Path) create() error {\n\tif _, err := fs.Stat(p.name); os.IsNotExist(err) {\n\t\terr := fs.MkdirAll(p.name, os.ModePerm)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlog.Println(\"Created missing directory:\", p.name)\n\t}\n\treturn nil\n}", "func MakeEmptyDirInMemory() FileSystem { return filesys.MakeEmptyDirInMemory() }", "func mkdirat(directory int, path string, mode uint32) error {\n\treturn unix.Mkdirat(directory, path, mode)\n}", "func createDirectories() error {\n\n\tvar brickPath = glusterBrickPath + \"/\" + glusterVolumeName\n\tvar mountPath = glusterMountPath + \"/\" + glusterVolumeName\n\tvar volumePath = glusterDockerVolumePath\n\n\tdirPath := []string{brickPath, mountPath, volumePath}\n\n\tfor i := 0; i < len(dirPath); i++ {\n\t\tif helpers.Exists(dirPath[i]) == false {\n\t\t\terr := helpers.CreateDir(dirPath[i])\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}", "func (cmd *MkDirCommand) createDirectory(client secrethub.ClientInterface, path string) error {\n\tdirPath, err := api.NewDirPath(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif dirPath.IsRepoPath() {\n\t\treturn ErrMkDirOnRootDir\n\t}\n\tif cmd.parents {\n\t\treturn client.Dirs().CreateAll(dirPath.Value())\n\t}\n\t_, err = client.Dirs().Create(dirPath.Value())\n\treturn err\n}", "func CreateDirIfNotExist(dir string) {\n\tif _, err := os.Stat(dir); os.IsNotExist(err) {\n\t\tlog.Printf(\"Creating directory for helm: %v\", dir)\n\t\terr = os.MkdirAll(dir, 0755)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Unable to create directory for helm: %v\", dir)\n\t\t\tpanic(err)\n\t\t}\n\t}\n}", "func makeIndexes(c Config) error {\n\treturn filepath.Walk(c.Outdir, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tif _, stat := os.Stat(filepath.Join(path, \"/index.html\")); stat == nil {\n\t\t\treturn nil\n\t\t}\n\n\t\tif path == c.Outdir {\n\t\t\treturn nil\n\t\t}\n\n\t\tpath, err = filepath.Abs(path)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"cannot get Abs of %v: %v\", path, err)\n\t\t}\n\n\t\tif err := makeIndex(c, path); err != nil {\n\t\t\treturn fmt.Errorf(\"cannot make index for %v: %v\", path, err)\n\t\t}\n\n\t\treturn nil\n\t})\n}", "func (u *uploader) createDirectory(entry files.TreeEntry) {\n\tdirPath := filepath.ToSlash(entry.Path)\n\treq := mcstoreapi.DirectoryRequest{\n\t\tProjectName: u.project.Name,\n\t\tProjectID: u.project.ProjectID,\n\t\tPath: dirPath,\n\t}\n\tdirID, _ := u.getDirectory(req)\n\tdir := &Directory{\n\t\tDirectoryID: dirID,\n\t\tPath: dirPath,\n\t}\n\tif _, err := u.db.InsertDirectory(dir); err != nil {\n\t\tapp.Log.Panicf(\"Local database returned err, panic!: %s\", err)\n\t}\n}", "func createTemplatePath(filepath string) {\n\tfilepath = path.Dir(filepath)\n\terr := os.MkdirAll(filepath, 0744)\n\tcheck(err)\n}", "func newIndexWithTempPath(name string) *Index {\n\tpath, err := ioutil.TempDir(\"\", \"pilosa-index-\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tindex, err := NewIndex(path, name)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn index\n}", "func createOutputPathIfNotExist(outputPathArray []string) {\n\toutputPath := filepath.Join(outputPathArray...)\n\tos.MkdirAll(outputPath, os.ModePerm)\n}", "func (c *Checkpoint) createDir() error {\n\tdir := filepath.Dir(c.file)\n\tlogp.Info(\"Creating %s if it does not exist.\", dir)\n\treturn os.MkdirAll(dir, os.FileMode(0750))\n}", "func createLocalDir(forPath string) error {\n\tdirs := path.Dir(forPath)\n\treturn os.MkdirAll(dirs, 0750)\n}", "func MkDirIfNotExists(path string) error {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\terr := os.MkdirAll(path, 0777)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Cannot create directory:\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (h *fs) Mkdir(dirname string) error {\n\treturn os.Mkdir(dirname, 0700)\n}", "func ExampleCreateDirs() {\n\tm := map[string]string{\n\t\t\"uploadDir\": \"./uploads\",\n\t\t\"photoDir\": \"/tmp/photos\",\n\t}\n\n\t// Create absolute dirs with 0755 permission bits.\n\tif err := pathhelper.CreateDirs(m, 0755); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"CreateDirs() error: %v\\n\", err)\n\t}\n\n\tfmt.Fprintf(os.Stderr, \"CreateDirs() successfully.\\n\")\n\tfor k, v := range m {\n\t\tfmt.Fprintf(os.Stderr, \"k: %v, v: %v\\n\", k, v)\n\t}\n\t// Output:\n}", "func CreateNewIndex(url string, alias string) (string, error) {\n\t// create our day-specific name\n\tphysicalIndex := fmt.Sprintf(\"%s_%s\", alias, time.Now().Format(\"2006_01_02\"))\n\tidx := 0\n\n\t// check if it exists\n\tfor true {\n\t\tresp, err := http.Get(fmt.Sprintf(\"%s/%s\", url, physicalIndex))\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\t// not found, great, move on\n\t\tif resp.StatusCode == http.StatusNotFound {\n\t\t\tbreak\n\t\t}\n\n\t\t// was found, increase our index and try again\n\t\tidx++\n\t\tphysicalIndex = fmt.Sprintf(\"%s_%s_%d\", alias, time.Now().Format(\"2006_01_02\"), idx)\n\t}\n\n\t// initialize our index\n\tcreateURL := fmt.Sprintf(\"%s/%s\", url, physicalIndex)\n\t_, err := MakeJSONRequest(http.MethodPut, createURL, indexSettings, nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// all went well, return our physical index name\n\tlog.WithField(\"index\", physicalIndex).Info(\"created index\")\n\treturn physicalIndex, nil\n}", "func ensureDir(path string) (err error) {\n\tif _, err = os.Stat(path); os.IsNotExist(err) {\n\t\t// Try to make 0700\n\t\tif err = os.MkdirAll(path, os.ModePerm); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create root dir: %s\", path)\n\t\t}\n\t}\n\n\treturn err\n}", "func (nm DatastoreNamespaceManager) CreateDirectory(ctx context.Context, ds *Datastore, displayName string, policy string) (string, error) {\n\n\treq := &types.CreateDirectory{\n\t\tThis: nm.Reference(),\n\t\tDatastore: ds.Reference(),\n\t\tDisplayName: displayName,\n\t\tPolicy: policy,\n\t}\n\n\tresp, err := methods.CreateDirectory(ctx, nm.c, req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn resp.Returnval, nil\n}", "func MustExist(dirpath string) string {\n\terr := os.MkdirAll(dirpath, 0700)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Couldn't create directory `%s` : %v\", dirpath, err))\n\t}\n\treturn dirpath\n}", "func createFolderIfNotExist() error {\n\texist, err := folderExist()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !exist {\n\t\terr := os.MkdirAll(datasetFolder, os.ModePerm)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (env Env) createNewMountPath(volumeFamily string, volumeName string) (string, error) {\n\tpath := fmt.Sprintf(\"%s/%ss/%s\", *mountedVolumesPathPrefixFlag, volumeFamily, volumeName)\n\tlog.Printf(\"Creating directory %s as a mount point for volume %s.\", path, volumeName)\n\tif err := env.OsCommandRunner.MkdirAll(path, 0755); err != nil {\n\t\treturn \"\", fmt.Errorf(\"Failed to create directory %s: %s\", path, err)\n\t} else {\n\t\treturn path, nil\n\t}\n}", "func (fr *FileResource) createDirectory() error {\n\tswitch {\n\tcase !fr.Recursive:\n\t\treturn os.Mkdir(fr.Path, 0755)\n\tcase fr.Recursive && fr.Source != \"\":\n\t\tsrcPath := filepath.Join(fr.Config.SiteRepo, fr.Source)\n\t\treturn utils.CopyDir(srcPath, fr.Path)\n\tcase fr.Recursive && fr.Source == \"\":\n\t\treturn os.MkdirAll(fr.Path, 0755)\n\t}\n\n\t// Not reached\n\treturn nil\n}", "func createDir(path string, host string) error {\n\tsshCmd := fmt.Sprintf(\"mkdir -p %s\", path)\n\tframework.Logf(\"Invoking command '%v' on ESX host %v\", sshCmd, host)\n\tresult, err := fssh.SSH(sshCmd, host+\":22\", framework.TestContext.Provider)\n\tif err != nil || result.Code != 0 {\n\t\tfssh.LogResult(result)\n\t\treturn fmt.Errorf(\"couldn't execute command: '%s' on ESX host: %v\", sshCmd, err)\n\t}\n\treturn nil\n}", "func createDirectoryIfMissing(path string) error {\n\tif _, err := os.Stat(path); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tlog.Logger.Debugf(\"Creating dir '%s'\", path)\n\t\t\terr := os.MkdirAll(path, 0755)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.WithStack(err)\n\t\t\t}\n\t\t} else {\n\t\t\treturn errors.Wrapf(err, \"Error creating dir '%s'\", path)\n\t\t}\n\t}\n\n\treturn nil\n}", "func MkDirIfNotExist(dir string) error {\n\tif _, e := os.Stat(dir); os.IsNotExist(e) {\n\t\treturn os.MkdirAll(dir, 511)\n\t}\n\treturn nil\n}", "func mkdirStore(cacheBaseDir string) string {\n\tdir := \"/var/run/marconi\"\n\tif cacheBaseDir != \"\" {\n\t\tdir = path.Join(cacheBaseDir, \".marconi\")\n\t}\n\t// Ignore errors.\n\tos.MkdirAll(dir, 0750)\n\n\tif s, err := os.Stat(dir); err != nil {\n\t\tlog.Fatal(\"stat config dir\", err)\n\t} else if !s.IsDir() {\n\t\tlog.Fatalf(\"Dir %v expected directory, got %v\", dir, s)\n\t}\n\treturn dir\n}", "func CreateIfNotExists(dir string, perm os.FileMode) error {\n\tif Exists(dir) {\n\t\treturn nil\n\t}\n\n\tif err := os.MkdirAll(dir, perm); err != nil {\n\t\treturn fmt.Errorf(\"failed to create directory: '%s', error: '%s'\", dir, err.Error())\n\t}\n\n\treturn nil\n}", "func ensureDirectory(fs utilfs.Filesystem, path string) error {\n\tif _, err := fs.Stat(path); err != nil {\n\t\t// MkdirAll returns nil if directory already exists.\n\t\treturn fs.MkdirAll(path, 0755)\n\t}\n\treturn nil\n}", "func (c *C) MkDir() string {\n path := c.tempDir.newPath()\n if err := os.Mkdir(path, 0700); err != nil {\n panic(fmt.Sprintf(\"Couldn't create temporary directory %s: %s\",\n path, err.String()))\n }\n return path\n}", "func (fs *Filesystem) Mkdir(name string, perm os.FileMode) error {\n\tfs.Lock()\n\tdefer fs.Unlock()\n\t_, err := fs.root.lookupFile(name, name)\n\tif err == nil {\n\t\treturn &os.PathError{\n\t\t\tOp: \"mkdir\",\n\t\t\tPath: name,\n\t\t\tErr: errors.New(\"File exists\"), // 0x11\n\t\t}\n\t}\n\tdirName := path.Dir(name)\n\tfParent, errParent := fs.root.lookupFile(dirName, dirName)\n\tif errParent != nil {\n\t\treturn &os.PathError{\n\t\t\tOp: \"mkdir\",\n\t\t\tPath: name,\n\t\t\tErr: errParent.(*os.PathError).Err,\n\t\t}\n\t}\n\tNewFile(fs, fParent, path.Base(name), perm, time.Now(), true)\n\treturn nil\n}", "func mkdirAll(path string, perm os.FileMode) error {\n\tpath = preparePath(path)\n\t// Fast path: if we can tell whether path is a directory or file, stop with success or error.\n\tdir, err := os.Stat(path)\n\tif err == nil {\n\t\tif dir.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\treturn &os.PathError{\n\t\t\tOp: \"mkdir\",\n\t\t\tPath: path,\n\t\t\tErr: syscall.ENOTDIR,\n\t\t}\n\t}\n\n\t// Slow path: make sure parent exists and then call Mkdir for path.\n\ti := len(path)\n\tfor i > 0 && os.IsPathSeparator(path[i-1]) { // Skip trailing path separator.\n\t\ti--\n\t}\n\n\tj := i\n\tfor j > 0 && !os.IsPathSeparator(path[j-1]) { // Scan backward over element.\n\t\tj--\n\t}\n\n\tif j > 1 {\n\t\t// Create parent\n\t\tparent := path[0 : j-1]\n\t\tif parent != filepath.VolumeName(parent) {\n\t\t\terr = mkdirAll(parent, perm)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Parent now exists; invoke Mkdir and use its result.\n\terr = os.Mkdir(path, perm)\n\tif err != nil {\n\t\t// Handle arguments like \"foo/.\" by\n\t\t// double-checking that directory doesn't exist.\n\t\tdir, err1 := os.Lstat(path)\n\t\tif err1 == nil && dir.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\treturn nil\n}", "func newFileSystem(basedir string, mkdir osMkdirAll) (*FS, error) {\n\tif err := mkdir(basedir, 0700); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &FS{basedir: basedir}, nil\n}", "func makeDir(dirPath string) {\n\tos.Mkdir(dirPath, 0777)\n}", "func createAppDirectory(basePath, appName string) (string, error) {\n\n\tvar err error\n\n\tif basePath == \".\" {\n\t\tbasePath, err = os.Getwd()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\tappPath := filepath.Join(basePath, appName)\n\terr = os.Mkdir(appPath, os.ModePerm)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn appPath, nil\n}", "func prepareDir(t *testing.T, fs *fs.FileSystem) bool {\n\tif !errors.AssertNil(t, fs.CreateDirectory(\"/foo\")) {\n\t\treturn false\n\t}\n\tif !errors.AssertNil(t, fs.CreateDirectory(\"/foo/bar\")) {\n\t\treturn false\n\t}\n\tif !errors.AssertNil(t, fs.CreateDirectory(\"/foo/test\")) {\n\t\treturn false\n\t}\n\tif !errors.AssertNil(t, fs.CreateDirectory(\"/foo/bar/hello\")) {\n\t\treturn false\n\t}\n\tif !errors.AssertNil(t, fs.WriteString(\"/foo/test.txt\", \"foo1\")) {\n\t\treturn false\n\t}\n\tif !errors.AssertNil(t, fs.WriteString(\"/foo/bar/hello/blub.txt\", \"bar2\")) {\n\t\treturn false\n\t}\n\treturn true\n}", "func CreateDirIfNotExists(path string) error {\n\t_, err := os.Stat(path)\n\tif os.IsNotExist(err) {\n\t\tos.MkdirAll(path, 0777)\n\t\treturn nil\n\t}\n\treturn err\n}", "func (c *Client) Mkdir(path string) (err error) {\n\tvar ret string\n\terr = c.server.Call(\"mkdir\", &ret, path, c.session)\n\tif err != nil {\n\t\treturn client.MakeFatalError(err)\n\t}\n\tif ret != \"\" {\n\t\treturn fmt.Errorf(ret)\n\t}\n\treturn nil\n}", "func emptyDir(ctx context.Context, msrc *fs.MountSource) *fs.Inode {\n\tdir := NewDir(ctx, make(map[string]*fs.Inode), fs.RootOwner, fs.FilePermsFromMode(0777))\n\treturn fs.NewInode(ctx, dir, msrc, fs.StableAttr{\n\t\tDeviceID: anon.PseudoDevice.DeviceID(),\n\t\tInodeID: anon.PseudoDevice.NextIno(),\n\t\tBlockSize: usermem.PageSize,\n\t\tType: fs.Directory,\n\t})\n}", "func ensureDirExists(path string) {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\tos.Mkdir(path, 0755)\n\t}\n}", "func ensureHomeDir(rootfsPath string, policy def.Policy) {\n\tuinfo := UserinfoForPolicy(policy)\n\tpth := filepath.Join(rootfsPath, uinfo.Home)\n\tfs.MkdirAllWithAttribs(pth, fs.Metadata{\n\t\tMode: 0755,\n\t\tModTime: fs.Epochwhen,\n\t\tAccessTime: fs.Epochwhen,\n\t\tUid: uinfo.Uid,\n\t\tGid: uinfo.Gid,\n\t})\n}", "func generateDir(path string) {\n\tpath = filepath.FromSlash(filepath.Dir(path))\n\terr := os.MkdirAll(path, os.ModePerm)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: cannot create resource %s.\\n\"+\n\t\t\t\"The error is: %v\", path, err)\n\t}\n}", "func newRootDir(t *testing.T) (string, error) {\n\tdir := filepath.Join(os.TempDir(), \"siadirs\", t.Name())\n\terr := os.RemoveAll(dir)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn dir, nil\n}", "func ensureDirectoryExists(logger *logrus.Logger, dirName string) error {\n\tif files.IsDir(dirName) {\n\t\tlogger.Infof(\"Directory %s already exists\", dirName)\n\t\treturn nil\n\t}\n\tlogger.Infof(\"Creating directory %s\", dirName)\n\terr := os.MkdirAll(dirName, os.ModePerm)\n\tif err != nil {\n\t\tlogger.Errorf(\"Error making directory %s: %s\", dirName, err)\n\t\treturn errors.WithStackTrace(err)\n\t}\n\treturn nil\n}", "func (p *nfsProvisioner) createDirectory(directory, gid string) error {\n\t// TODO quotas\n\tpath := path.Join(p.exportDir, directory)\n\tif _, err := os.Stat(path); !os.IsNotExist(err) {\n\t\treturn fmt.Errorf(\"the path already exists\")\n\t}\n\n\tperm := os.FileMode(0777 | os.ModeSetgid)\n\tif gid != \"none\" {\n\t\t// Execute permission is required for stat, which kubelet uses during unmount.\n\t\tperm = os.FileMode(0071 | os.ModeSetgid)\n\t}\n\tif err := os.MkdirAll(path, perm); err != nil {\n\t\treturn err\n\t}\n\t// Due to umask, need to chmod\n\tif err := os.Chmod(path, perm); err != nil {\n\t\tos.RemoveAll(path)\n\t\treturn err\n\t}\n\n\tif gid != \"none\" {\n\t\tgroupID, err := strconv.ParseUint(gid, 10, 64)\n\t\tif err != nil {\n\t\t\tos.RemoveAll(path)\n\t\t\treturn fmt.Errorf(\"strconv.ParseUint failed with error: %v\", err)\n\t\t}\n\t\tcmd := exec.Command(\"chgrp\", strconv.FormatUint(groupID, 10), path)\n\t\tout, err := cmd.CombinedOutput()\n\t\tif err != nil {\n\t\t\tos.RemoveAll(path)\n\t\t\treturn fmt.Errorf(\"chgrp failed with error: %v, output: %s\", err, out)\n\t\t}\n\t}\n\n\treturn nil\n}", "func CreateIndex(excludedPaths []string) (Index, error) {\n\tglog.V(1).Infof(\"CreateIndex(%v)\", excludedPaths)\n\n\tmapping := bleve.NewIndexMapping()\n\tif len(excludedPaths) > 0 {\n\t\tcustomMapping := bleve.NewDocumentMapping()\n\t\tfor _, path := range excludedPaths {\n\t\t\tpaths := strings.Split(path, \".\")\n\t\t\tpathToMapping(paths, customMapping)\n\t\t}\n\t\tmapping.DefaultMapping = customMapping\n\t}\n\tindex, err := bleve.NewMemOnly(mapping)\n\n\tif err != nil {\n\t\tglog.Error(err)\n\t\treturn nil, err\n\t}\n\n\tbatch := index.NewBatch()\n\n\treturn &bleveIndex{\n\t\tindex: index,\n\t\taddInc: 0,\n\t\tbatch: batch,\n\t}, nil\n}", "func CreateIndexByScanDir(targetDir string, indexFileName string, public_url string) (index Index) {\n\n\tindex = Index{Sitemaps: []Sitemap{}}\n\n\tfs, err := ioutil.ReadDir(targetDir)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor _, f := range fs {\n\t\tif strings.HasSuffix(f.Name(), \".xml.gz\") && !strings.HasSuffix(indexFileName, f.Name()) {\n\t\t\tlastModified := f.ModTime()\n\t\t\tindex.Sitemaps = append(index.Sitemaps, Sitemap{Loc: public_url + f.Name(), LastMod: &lastModified})\n\t\t}\n\t}\n\treturn\n}", "func Mkdir(dirname string) error {\n\treturn os.Mkdir(dirname, 0755)\n}", "func create_directories(root string, paths []string) error{\n // Creater root directory\n err:=os.MkdirAll(root, 0766)\n if err!=nil{\n fmt.Fprintln(os.Stderr, \"Error (os.MkdirAll) (1):\", err)\n return err\n }\n\n // Create the rest of the directories\n for _,a_path:=range paths{\n a_path=path.Join(root, a_path)\n err:=os.MkdirAll(a_path, 0766)\n if err!=nil{\n fmt.Fprintln(os.Stderr, \"Error (os.MkdirAll) (2):\", err)\n return err\n }\n }\n return nil\n}", "func newDir(t *testing.T) (string, func()) {\n\tdir, err := os.MkdirTemp(\"\", \"lxd-db-node-test-\")\n\trequire.NoError(t, err)\n\n\tcleanup := func() {\n\t\trequire.NoError(t, os.RemoveAll(dir))\n\t}\n\n\treturn dir, cleanup\n}", "func CreateIndex(context *web.AppContext) *web.AppError {\n\n\tdb := context.MDB\n\tvar input model.Index\n\tjson.NewDecoder(context.Body).Decode(&input)\n\n\terr := db.Session.DB(\"\").C(input.Target).EnsureIndex(input.Index)\n\tif err != nil {\n\t\tmessage := fmt.Sprintf(\"Error creating index [%+v]\", input)\n\t\treturn &web.AppError{err, message, http.StatusInternalServerError}\n\t}\n\n\treturn nil\n}", "func TestMakePluginNoPath(t *testing.T) {\n\ttempDir, err := ioutil.TempDir(\"\", \"\")\n\trequire.Empty(t, err, \"cannot create temp dir\")\n\n\tpluginDir := filepath.Join(tempDir, \"plugin\")\n\terr = os.MkdirAll(pluginDir, os.ModePerm)\n\trequire.Empty(t, err, \"cannot create plugin dir\")\n\n\tfiles := []string{\"hello.plugin.zsh\", \"world.plugin.zsh\", \"impretty.zsh-theme\"}\n\tfor _, filename := range files {\n\t\t_, err = os.Create(filepath.Join(pluginDir, filename))\n\t\trequire.Empty(t, err, \"cannot create plugin file\")\n\t}\n\n\t_, err = MakeDir(\"\", map[string]string{})\n\tassert.NotEmpty(t, err, \"must return error\")\n}", "func pathExists(path string, create bool) (err error) {\n\tif _, err = os.Stat(path); err == nil {\n\t\treturn\n\t}\n\n\tif os.IsNotExist(err) && create == true {\n\t\treturn os.MkdirAll(path, os.ModePerm)\n\t}\n\treturn\n}", "func (sshConfig *SSHConfig) CreateDirectory(path string) (err error) {\n\tcmd := fmt.Sprintf(\"%smkdir -p %s\", sshConfig.sudo, path)\n\t_, err = sshConfig.Run(cmd)\n\treturn\n}", "func CreateDirIfNotExist(dir string) error {\n\tif PathExists(dir) {\n\t\treturn nil\n\t}\n\treturn os.MkdirAll(dir, os.ModePerm)\n}", "func createDiskTable(memTable *memTable, dbDir string, index, sparseKeyDistance int) error {\n\tprefix := strconv.Itoa(index) + \"-\"\n\n\tw, err := newDiskTableWriter(dbDir, prefix, sparseKeyDistance)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create disk table writer: %w\", err)\n\t}\n\n\tfor it := memTable.iterator(); it.hasNext(); {\n\t\tkey, value := it.next()\n\t\tif err := w.write(key, value); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to write to disk table %d: %w\", index, err)\n\t\t}\n\t}\n\n\tif err := w.sync(); err != nil {\n\t\treturn fmt.Errorf(\"failed to sync disk table: %w\", err)\n\t}\n\n\tif err := w.close(); err != nil {\n\t\treturn fmt.Errorf(\"failed to close disk table: %w\", err)\n\t}\n\n\treturn nil\n}", "func createDirMetadata(siaPath modules.SiaPath, rootDir string) (Metadata, writeaheadlog.Update, error) {\n\t// Check if metadata file exists\n\t_, err := os.Stat(siaPath.SiaDirMetadataSysPath(rootDir))\n\tif err == nil || !os.IsNotExist(err) {\n\t\treturn Metadata{}, writeaheadlog.Update{}, err\n\t}\n\n\t// Initialize metadata, set Health and StuckHealth to DefaultDirHealth so\n\t// empty directories won't be viewed as being the most in need. Initialize\n\t// ModTimes.\n\tmd := Metadata{\n\t\tAggregateHealth: DefaultDirHealth,\n\t\tAggregateModTime: time.Now(),\n\t\tAggregateStuckHealth: DefaultDirHealth,\n\n\t\tHealth: DefaultDirHealth,\n\t\tModTime: time.Now(),\n\t\tStuckHealth: DefaultDirHealth,\n\t}\n\tpath := siaPath.SiaDirMetadataSysPath(rootDir)\n\tupdate, err := createMetadataUpdate(path, md)\n\treturn md, update, err\n}", "func initializeDir(path string) {\n\tif _, err := os.Stat(path); err != nil && os.IsNotExist(err) {\n\t\tos.MkdirAll(path, 0o700)\n\t}\n}", "func createImgDir(imgStore string) {\n\tfor f := 0; f < 16; f++ {\n\t\tfor s := 0; s < 16; s++ {\n\t\t\tos.MkdirAll(filepath.Join(imgStore, fmt.Sprintf(\"%x/%x\", f, s)), 0755)\n\t\t}\n\t}\n\tfmt.Println(\"Finished making/Verifying the directories!\")\n}", "func CreateIndexIfNotExists(e *elastic.Client, index string) error {\n\t// Use the IndexExists service to check if a specified index exists.\n\texists, err := e.IndexExists(index).Do(context.Background())\n\tif err != nil {\n\t\tlog.Printf(\"elastic: unable to check if Index exists - %s\\n\", err)\n\t\treturn err\n\t}\n\n\tif exists {\n\t\treturn nil\n\t}\n\n\t// Create a new index.\n\tv := reflect.TypeOf(Point{})\n\n\tmapping := MapStr{\n\t\t\"settings\": MapStr{\n\t\t\t\"number_of_shards\": 1,\n\t\t\t\"number_of_replicas\": 1,\n\t\t},\n\t\t\"mappings\": MapStr{\n\t\t\t\"doc\": MapStr{\n\t\t\t\t\"properties\": MapStr{},\n\t\t\t},\n\t\t},\n\t}\n\tfor i := 0; i < v.NumField(); i++ {\n\t\tfield := v.Field(i)\n\t\ttag := field.Tag.Get(\"elastic\")\n\t\tif len(tag) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\ttagfields := strings.Split(tag, \",\")\n\t\tmapping[\"mappings\"].(MapStr)[\"doc\"].(MapStr)[\"properties\"].(MapStr)[field.Name] = MapStr{}\n\t\tfor _, tagfield := range tagfields {\n\t\t\ttagfieldValues := strings.Split(tagfield, \":\")\n\t\t\tmapping[\"mappings\"].(MapStr)[\"doc\"].(MapStr)[\"properties\"].(MapStr)[field.Name].(MapStr)[tagfieldValues[0]] = tagfieldValues[1]\n\t\t}\n\t}\n\tmappingJSON, err := json.Marshal(mapping)\n\tif err != nil {\n\t\tlog.Printf(\"elastic: error on json marshal - %s\\n\", err)\n\t\treturn err\n\t}\n\n\t_, err = e.CreateIndex(index).BodyString(string(mappingJSON)).Do(context.Background())\n\tif err != nil {\n\t\tlog.Printf(\"elastic: error creating elastic index %s - %s\\n\", index, err)\n\t\treturn err\n\t}\n\tlog.Printf(\"elastic: index %s created\\n\", index)\n\treturn nil\n}", "func createFolderIfNonExisted(message MJmessage) {\n\n\tfolders := [5]string{\n\t\tlocal_folder_path + message.Command.Prefix + \"/\",\n\t\tsdfs_folder_path + message.Command.Prefix + \"/\",\n\t\tlocal_folder_path + message.Command.Dir + \"/\",\n\t\tlocal_folder_path + message.Command.Prefix + \"_immediate/\",\n\t\tlocal_folder_path + message.Command.Prefix + \"_immediate/\",\n\t}\n\n\tfor _, path := range folders {\n\t\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\t\t// if prefix directory does not exist at local\n\t\t\terr := os.Mkdir(path, 0755)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t}\n\t}\n}", "func TestRenterCreateDirectories(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\trt, err := newRenterTester(t.Name())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer rt.Close()\n\n\t// Test creating directory\n\terr = rt.renter.CreateDir(\"foo/bar/baz\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Confirm that direcotry metadata files were created in all directories\n\tif err := rt.checkDirInitialized(\"\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := rt.checkDirInitialized(\"foo\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := rt.checkDirInitialized(\"foo/bar\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := rt.checkDirInitialized(\"foo/bar/baz\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "func createLocalDir(dir string, mode os.FileMode) error {\n\t// Check whether dir exists.\n\t// If not, we create it with all parent directories.\n\t// If yes, we check if dir is a directory or not.\n\t// If yes, dir remains as it is. Otherwise an error will be returned.\n\tfileInfo, err := os.Stat(dir)\n\tif os.IsNotExist(err) {\n\t\treturn os.MkdirAll(dir, mode)\n\t}\n\n\tif !fileInfo.IsDir() {\n\t\treturn fmt.Errorf(\"%s already exists but not a directory\", dir)\n\t}\n\n\treturn nil\n}", "func (s Store) ensureFolderExists(path string) {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\terr = os.MkdirAll(path, 0700)\n\t\tif err != nil {\n\t\t\ts.Logger.Err(err).Msgf(\"Error creating folder %v\", path)\n\t\t}\n\t}\n}", "func (m *FileSystem) CreateDirIfNotExist(dir string) error {\n\tret := m.ctrl.Call(m, \"CreateDirIfNotExist\", dir)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func CreateDirIfNotExist(dir string) error {\n\tif CheckPathIfNotExist(dir) {\n\t\treturn nil\n\t}\n\treturn os.MkdirAll(dir, os.ModePerm)\n}", "func prepDir(job *RegistrationJob) error {\n\tconf := job.Config\n\tmetadata := job.Metadata\n\tstoragedir := conf.Storage.TargetDirectory\n\tdoi := metadata.Identifier.ID\n\terr := os.MkdirAll(filepath.Join(storagedir, doi), os.ModePerm)\n\tif err != nil {\n\t\tlog.Print(\"Could not create the target directory\")\n\t\treturn err\n\t}\n\t// Deny access per default\n\tfile, err := os.Create(filepath.Join(storagedir, doi, \".htaccess\"))\n\tif err != nil {\n\t\tlog.Print(\"Could not create .htaccess\")\n\t\treturn err\n\t}\n\tdefer file.Close()\n\t// todo check\n\t_, err = file.Write([]byte(\"deny from all\"))\n\tif err != nil {\n\t\tlog.Print(\"Could not write to .htaccess\")\n\t\treturn err\n\t}\n\treturn nil\n}", "func mkdirForFile(path string) error {\n\treturn os.MkdirAll(filepath.Dir(path), DefaultDirectoryPermissions)\n}", "func TestEngine_WriteIndex_NoKeys(t *testing.T) {\n\te := OpenDefaultEngine()\n\tdefer e.Close()\n\tif err := e.WriteIndex(nil, nil, nil); err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "func CreateDirIfNotExist(dir string) {\n\tif _, err := os.Stat(dir); os.IsNotExist(err) {\n\t\terr = os.MkdirAll(dir, 0755)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n}", "func CreateDirIfNotExist(dir string) error {\n\tif _, err := os.Stat(dir); os.IsNotExist(err) {\n\t\terr = os.MkdirAll(dir, 0700)\n\t\treturn err\n\t}\n\treturn nil\n}", "func CreateIndexer(root string, nbuckets, seqLen int) (*Indexer, error) {\n\tcfg, err := NewConfig(root, nbuckets, seqLen)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn IndexerFromConfig(cfg)\n}", "func CreateDirectory(path string) {\n\n\t_ = os.MkdirAll(path, 0750|os.ModeDir)\n\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\tpanic(err)\n\t}\n\n}", "func (m *wasiSnapshotPreview1Impl) pathCreateDirectory(pfd wasiFd, ppath list) (err wasiErrno) {\n\tpath, err := m.loadPath(ppath)\n\tif err != wasiErrnoSuccess {\n\t\treturn err\n\t}\n\n\tdir, err := m.files.getDirectory(pfd, wasiRightsPathCreateDirectory)\n\tif err != wasiErrnoSuccess {\n\t\treturn err\n\t}\n\n\tif ferr := dir.Mkdir(path); ferr != nil {\n\t\treturn fileErrno(ferr)\n\t}\n\treturn wasiErrnoSuccess\n}", "func (c AppConfig) IndexDir() string {\n\treturn c.ProjectHome + \"/index\"\n}", "func NewDirectoryIndex(rdr io.Reader) (DirIndex, error) {\n\tvar index DirIndex\n\terr := binary.Read(rdr, binary.LittleEndian, &index.DirIndexInit)\n\tif err != nil {\n\t\treturn index, err\n\t}\n\ttmp := make([]byte, index.NameSize+1, index.NameSize+1)\n\terr = binary.Read(rdr, binary.LittleEndian, &tmp)\n\tif err != nil {\n\t\treturn index, err\n\t}\n\tindex.Name = string(tmp)\n\treturn index, nil\n}", "func mkSubDirs(t *testing.T) (string, string, string, func()) {\n\ttmp, cleanup := TempDir(t)\n\tbinDir := filepath.Join(tmp, \"bin\")\n\terr := os.MkdirAll(binDir, 0700)\n\tOk(t, err)\n\n\tcachedir := filepath.Join(tmp, \"plugin-cache\")\n\terr = os.MkdirAll(cachedir, 0700)\n\tOk(t, err)\n\n\treturn tmp, binDir, cachedir, cleanup\n}", "func makeTempDir() (name string, err error) {\n\t// A multiple of 3 for the length prevents padding.\n\tbuf := make([]byte, 15)\n\n\tfor retry := 0; retry < 5; retry++ {\n\t\tvar n int\n\t\tn, err = io.ReadFull(rand.Reader, buf)\n\t\tif n != len(buf) || err != nil {\n\t\t\tif err == nil {\n\t\t\t\terr = errors.New(\"Error generating random number\")\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tname = fmt.Sprintf(\"%s/test-%s\", os.TempDir(),\n\t\t\tbase64.URLEncoding.EncodeToString(buf))\n\n\t\terr = os.Mkdir(name, 0755)\n\t\tif err == nil {\n\t\t\t// If no error, return success.\n\t\t\treturn\n\t\t}\n\t}\n\t// Too many retries, go ahead and leave the EEXIST.\n\treturn\n}", "func (idx *Unique) Init() error {\n\tif _, err := os.Stat(idx.filesDir); err != nil {\n\t\treturn err\n\t}\n\n\tif err := os.MkdirAll(idx.indexRootDir, 0777); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (app *Application) createContainer () {\n appPath := GOPATH_SRC + app.Name\n if err := os.Mkdir(appPath, 0776); err == nil {\n fmt.Println(green, \" create:\", reset, appPath)\n } else {\n log.Fatal (err)\n }\n}", "func (m *Maildir) createDirectories() {\n\tfor i := 0; i < len(lib.Subdirs); i++ {\n\t\tos.MkdirAll(path.Join(m.path, lib.Subdirs[i]), os.ModePerm)\n\t}\n}", "func TestFileTreeCreateEmpty(t *testing.T) {\n\twant, got := setupFileTreeTestDir(\"empty\", t)\n\tif !got.equal(want) {\n\t\tt.Errorf(\"%v(): got %v, want %v\", t.Name(), got, want)\n\t}\n}", "func CreateDirAll(dir string) error {\n\terr := TouchDirAll(dir)\n\tif err == nil {\n\t\tvar ns []string\n\t\tns, err = ReadDir(dir)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ns) != 0 {\n\t\t\terr = fmt.Errorf(\"expected %q to be empty, got %q\", dir, ns)\n\t\t}\n\t}\n\treturn err\n}", "func (fs *FileSystem) Mkdir(name string, perm os.FileMode) error {\n\tlogger.Println(\"Mkdir\", name)\n\tclean := filepath.Clean(name)\n\n\tfs.RLock()\n\tfileData, ok := fs.data[clean]\n\tfs.RUnlock()\n\n\tif ok {\n\t\treturn &os.PathError{Op: \"mkdir\", Path: name, Err: ErrFileExists}\n\t}\n\n\tfs.Lock()\n\tdefer fs.Unlock()\n\n\tfileData = CreateDir(clean)\n\tfileData.Mode = int64(perm)\n\n\tif err := fs.saveFileData(fileData); err != nil {\n\t\treturn &os.PathError{Op: \"mkdir\", Path: name, Err: err}\n\t}\n\n\tfs.data[clean] = fileData\n\n\treturn nil\n}" ]
[ "0.6038284", "0.59488344", "0.5914573", "0.58726186", "0.5827066", "0.58112764", "0.5776086", "0.577299", "0.5670937", "0.5577498", "0.55641913", "0.5538944", "0.5530562", "0.5509765", "0.5497098", "0.5447239", "0.54208314", "0.5413843", "0.5393368", "0.53671104", "0.53648835", "0.52914494", "0.5290676", "0.52778685", "0.525652", "0.52547765", "0.5248375", "0.52081895", "0.5203193", "0.51680475", "0.51631325", "0.5161545", "0.51532066", "0.51400304", "0.5132963", "0.51285386", "0.51181823", "0.511106", "0.51063126", "0.5099368", "0.509464", "0.5092863", "0.5092471", "0.50916624", "0.508706", "0.50787157", "0.50732934", "0.5061946", "0.50408477", "0.5036626", "0.50315744", "0.50248224", "0.5019089", "0.5005768", "0.5005627", "0.5004278", "0.49895805", "0.49855343", "0.49776235", "0.49709398", "0.4960657", "0.4957827", "0.49560317", "0.4943245", "0.4942848", "0.49422625", "0.49403915", "0.49305624", "0.49293545", "0.49008834", "0.4897443", "0.4897195", "0.48936275", "0.4893602", "0.4893275", "0.4892782", "0.4891054", "0.488667", "0.48828351", "0.48807028", "0.4877301", "0.48762888", "0.48657358", "0.4865441", "0.48641783", "0.48641506", "0.48498148", "0.48489574", "0.4848011", "0.48406383", "0.48395893", "0.48378485", "0.4832547", "0.48268947", "0.48238155", "0.48065954", "0.4805087", "0.48045525", "0.48028198" ]
0.5145812
34
dedupLiveResources handles removes live resource duplicates with the same UID. Duplicates are created in a separate resource groups. E.g. apps/Deployment produces duplicate in extensions/Deployment, authorization.openshift.io/ClusterRole produces duplicate in rbac.authorization.k8s.io/ClusterRole etc. The method removes such duplicates unless it was defined in git ( exists in target resources list ). At least one duplicate stays. If non of duplicates are in git at random one stays
func dedupLiveResources(targetObjs []*unstructured.Unstructured, liveObjsByKey map[kubeutil.ResourceKey]*unstructured.Unstructured) { targetObjByKey := make(map[kubeutil.ResourceKey]*unstructured.Unstructured) for i := range targetObjs { targetObjByKey[kubeutil.GetResourceKey(targetObjs[i])] = targetObjs[i] } liveObjsById := make(map[types.UID][]*unstructured.Unstructured) for k := range liveObjsByKey { obj := liveObjsByKey[k] if obj != nil { liveObjsById[obj.GetUID()] = append(liveObjsById[obj.GetUID()], obj) } } for id := range liveObjsById { objs := liveObjsById[id] if len(objs) > 1 { duplicatesLeft := len(objs) for i := range objs { obj := objs[i] resourceKey := kubeutil.GetResourceKey(obj) if _, ok := targetObjByKey[resourceKey]; !ok { delete(liveObjsByKey, resourceKey) duplicatesLeft-- if duplicatesLeft == 1 { break } } } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *ContainerizedWorkloadReconciler) cleanupResources(ctx context.Context,\n\tworkload *oamv1alpha2.ContainerizedWorkload, deployUID, serviceUID *types.UID) error {\n\tlog := r.Log.WithValues(\"gc deployment\", workload.Name)\n\tvar deploy appsv1.Deployment\n\tvar service corev1.Service\n\tfor _, res := range workload.Status.Resources {\n\t\tuid := res.UID\n\t\tif res.Kind == KindDeployment {\n\t\t\tif uid != *deployUID {\n\t\t\t\tlog.Info(\"Found an orphaned deployment\", \"deployment UID\", *deployUID, \"orphaned UID\", uid)\n\t\t\t\tdn := client.ObjectKey{Name: res.Name, Namespace: workload.Namespace}\n\t\t\t\tif err := r.Get(ctx, dn, &deploy); err != nil {\n\t\t\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err := r.Delete(ctx, &deploy); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tlog.Info(\"Removed an orphaned deployment\", \"deployment UID\", *deployUID, \"orphaned UID\", uid)\n\t\t\t}\n\t\t} else if res.Kind == KindService {\n\t\t\tif uid != *serviceUID {\n\t\t\t\tlog.Info(\"Found an orphaned service\", \"orphaned UID\", uid)\n\t\t\t\tsn := client.ObjectKey{Name: res.Name, Namespace: workload.Namespace}\n\t\t\t\tif err := r.Get(ctx, sn, &service); err != nil {\n\t\t\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err := r.Delete(ctx, &service); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tlog.Info(\"Removed an orphaned service\", \"orphaned UID\", uid)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func removeDuplicateResources(resources []puppetquery.Resource) []puppetquery.Resource {\n\t// no duplicates possible\n\tif len(resources) < 2 {\n\t\treturn resources\n\t}\n\n\tseen := make(map[string]bool, len(resources))\n\tuniq := make([]puppetquery.Resource, 0, len(resources))\n\n\tseen[resources[0].Title] = true\n\tuniq = append(uniq, resources[0])\n\tfor _, r := range resources[1:] {\n\t\tif seen[r.Title] {\n\t\t\tcontinue\n\t\t}\n\t\tseen[r.Title] = true\n\t\tuniq = append(uniq, r)\n\t}\n\treturn uniq\n}", "func (r *FooReconciler) cleanupOwnedResources(ctx context.Context, log logr.Logger, foo *batchv1.Foo) error {\n\tlog.Info(\"finding existing Deployments for MyKind resource\")\n\n\t// List all deployment resources owned by this MyKind\n\tvar deployments apps.DeploymentList\n\t//if err := r.List(ctx, &deployments, client.InNamespace(foo.Namespace), client.MatchingField(deploymentOwnerKey, foo.Name)); err != nil {\n\t//\treturn err\n\t//}\n\n\tdeleted := 0\n\tfor _, depl := range deployments.Items {\n\t\tif depl.Name == foo.Spec.Name {\n\t\t\t// If this deployment's name matches the one on the MyKind resource\n\t\t\t// then do not delete it.\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := r.Client.Delete(ctx, &depl); err != nil {\n\t\t\tlog.Error(err, \"failed to delete Deployment resource\")\n\t\t\treturn err\n\t\t}\n\n\t\tr.Recorder.Eventf(foo, core.EventTypeNormal, \"Deleted\", \"Deleted deployment %q\", depl.Name)\n\t\tdeleted++\n\t}\n\n\tlog.Info(\"finished cleaning up old Deployment resources\", \"number_deleted\", deleted)\n\n\treturn nil\n}", "func uniqResources(resources []metav1.APIResource) []metav1.APIResource {\n\tseen := make(map[string]struct{}, len(resources))\n\ti := 0\n\tfor _, k := range resources {\n\t\tif _, ok := seen[k.Name]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tseen[k.Name] = struct{}{}\n\t\tresources[i] = k\n\n\t\ti++\n\t}\n\treturn resources[:i]\n}", "func TestListResources_DuplicateResourceFilterByLabel(t *testing.T) {\n\tt.Parallel()\n\tctx := context.Background()\n\n\tbackend, err := lite.NewWithConfig(ctx, lite.Config{\n\t\tPath: t.TempDir(),\n\t\tClock: clockwork.NewFakeClock(),\n\t})\n\trequire.NoError(t, err)\n\n\tpresence := NewPresenceService(backend)\n\n\t// Same resource name, but have different labels.\n\tnames := []string{\"a\", \"a\", \"a\", \"a\"}\n\tlabels := []map[string]string{\n\t\t{\"env\": \"prod\"},\n\t\t{\"env\": \"dev\"},\n\t\t{\"env\": \"qa\"},\n\t\t{\"env\": \"dev\"},\n\t}\n\n\ttests := []struct {\n\t\tname string\n\t\tkind string\n\t\tinsertResources func()\n\t\twantNames []string\n\t}{\n\t\t{\n\t\t\tname: \"KindDatabaseServer\",\n\t\t\tkind: types.KindDatabaseServer,\n\t\t\tinsertResources: func() {\n\t\t\t\tfor i := 0; i < len(names); i++ {\n\t\t\t\t\tdb, err := types.NewDatabaseServerV3(types.Metadata{\n\t\t\t\t\t\tName: fmt.Sprintf(\"name-%v\", i),\n\t\t\t\t\t}, types.DatabaseServerSpecV3{\n\t\t\t\t\t\tHostID: \"_\",\n\t\t\t\t\t\tHostname: \"_\",\n\t\t\t\t\t\tDatabase: &types.DatabaseV3{\n\t\t\t\t\t\t\tMetadata: types.Metadata{\n\t\t\t\t\t\t\t\tName: names[i],\n\t\t\t\t\t\t\t\tLabels: labels[i],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tSpec: types.DatabaseSpecV3{\n\t\t\t\t\t\t\t\tProtocol: \"_\",\n\t\t\t\t\t\t\t\tURI: \"_\",\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\trequire.NoError(t, err)\n\t\t\t\t\t_, err = presence.UpsertDatabaseServer(ctx, db)\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"KindAppServer\",\n\t\t\tkind: types.KindAppServer,\n\t\t\tinsertResources: func() {\n\t\t\t\tfor i := 0; i < len(names); i++ {\n\t\t\t\t\tserver, err := types.NewAppServerV3(types.Metadata{\n\t\t\t\t\t\tName: fmt.Sprintf(\"name-%v\", i),\n\t\t\t\t\t}, types.AppServerSpecV3{\n\t\t\t\t\t\tHostID: \"_\",\n\t\t\t\t\t\tApp: &types.AppV3{\n\t\t\t\t\t\t\tMetadata: types.Metadata{\n\t\t\t\t\t\t\t\tName: names[i],\n\t\t\t\t\t\t\t\tLabels: labels[i],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tSpec: types.AppSpecV3{URI: \"_\"},\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t\t_, err = presence.UpsertApplicationServer(ctx, server)\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"KindKubernetesCluster\",\n\t\t\tkind: types.KindKubernetesCluster,\n\t\t\tinsertResources: func() {\n\t\t\t\tfor i := 0; i < len(names); i++ {\n\n\t\t\t\t\tkube, err := types.NewKubernetesClusterV3(\n\t\t\t\t\t\ttypes.Metadata{\n\t\t\t\t\t\t\tName: names[i],\n\t\t\t\t\t\t\tLabels: labels[i],\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttypes.KubernetesClusterSpecV3{},\n\t\t\t\t\t)\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t\tkubeServer, err := types.NewKubernetesServerV3FromCluster(\n\t\t\t\t\t\tkube,\n\t\t\t\t\t\tfmt.Sprintf(\"host-%v\", i),\n\t\t\t\t\t\tfmt.Sprintf(\"hostID-%v\", i),\n\t\t\t\t\t)\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t\t// Upsert server.\n\t\t\t\t\t_, err = presence.UpsertKubernetesServer(ctx, kubeServer)\n\t\t\t\t\trequire.NoError(t, err)\n\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, tc := range tests {\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\ttc.insertResources()\n\n\t\t\t// Look among the duplicated resource by label\n\t\t\tresp, err := presence.ListResources(ctx, proto.ListResourcesRequest{\n\t\t\t\tResourceType: tc.kind,\n\t\t\t\tNeedTotalCount: true,\n\t\t\t\tLimit: 5,\n\t\t\t\tSearchKeywords: []string{\"dev\"},\n\t\t\t})\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Len(t, resp.Resources, 1)\n\t\t\trequire.Equal(t, 1, resp.TotalCount)\n\t\t\trequire.Equal(t, map[string]string{\"env\": \"dev\"}, resp.Resources[0].GetAllLabels())\n\t\t})\n\t}\n}", "func (c *Canary) CleanPreviousCanaryResources(region schemas.RegionConfig, completeCanary bool) error {\n\tclient, err := selectClientFromList(c.AWSClients, region.Region)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprefix := tool.BuildPrefixName(c.AwsConfig.Name, c.Stack.Env, region.Region)\n\n\tasgList, err := client.EC2Service.GetAllMatchingAutoscalingGroupsWithPrefix(prefix)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, asg := range asgList {\n\t\tif (completeCanary && *asg.AutoScalingGroupName == c.LatestAsg[region.Region]) || !tool.IsStringInArray(*asg.AutoScalingGroupName, c.PrevAsgs[region.Region]) {\n\t\t\tcontinue\n\t\t}\n\n\t\tc.Logger.Debugf(\"[Resizing] target autoscaling group : %s\", *asg.AutoScalingGroupName)\n\t\tif err := c.ResizingAutoScalingGroupCount(client, *asg.AutoScalingGroupName, 0); err != nil {\n\t\t\tc.Logger.Errorf(err.Error())\n\t\t}\n\t\tc.Logger.Debugf(\"Resizing autoscaling group finished: %s\", *asg.AutoScalingGroupName)\n\n\t\tfor _, tg := range asg.TargetGroupARNs {\n\t\t\tif tool.IsCanaryTargetGroupArn(*tg, region.Region) {\n\t\t\t\tc.Logger.Debugf(\"Try to delete target group: %s\", *tg)\n\t\t\t\tif err := client.ELBV2Service.DeleteTargetGroup(tg); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tc.Logger.Debugf(\"Deleted target group: %s\", *tg)\n\t\t\t}\n\t\t}\n\t}\n\n\tc.Logger.Debugf(\"Start to delete load balancer and security group for canary\")\n\tif completeCanary {\n\t\tif err := c.DeleteLoadBalancer(region); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := c.LoadBalancerDeletionChecking(region); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := c.DeleteEC2IngressRules(region); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := c.DeleteEC2SecurityGroup(region); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := c.DeleteLBSecurityGroup(region); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func FixupDepends(subscriptionID, resourceGroup string, template map[string]interface{}, ignoreMap map[string]struct{}) {\n\tmyResources := map[string]struct{}{}\n\tfor _, resource := range jsonpath.MustCompile(\"$.resources.*\").Get(template) {\n\t\ttyp := jsonpath.MustCompile(\"$.type\").MustGetString(resource)\n\t\tname := jsonpath.MustCompile(\"$.name\").MustGetString(resource)\n\t\tmyResources[resourceid.ResourceID(subscriptionID, resourceGroup, typ, name)] = struct{}{}\n\t}\n\n\tvar recurse func(myResourceID string, i interface{}, dependsMap map[string]struct{})\n\n\t// walk the data structure collecting \"id\" fields whose values look like\n\t// Azure resource IDs. Trim sub-resources from IDs. Ignore IDs that are\n\t// self-referent\n\trecurse = func(myResourceID string, i interface{}, dependsMap map[string]struct{}) {\n\t\tswitch i := i.(type) {\n\t\tcase map[string]interface{}:\n\t\t\tif id, ok := i[\"id\"]; ok {\n\t\t\t\tif id, ok := id.(string); ok {\n\t\t\t\t\tparts := strings.Split(id, \"/\")\n\t\t\t\t\tif len(parts) > 9 {\n\t\t\t\t\t\tparts = parts[:9]\n\t\t\t\t\t}\n\t\t\t\t\tif len(parts) == 9 {\n\t\t\t\t\t\tid = strings.Join(parts, \"/\")\n\t\t\t\t\t\t_, ignoreIt := ignoreMap[id]\n\t\t\t\t\t\tif id != myResourceID && !ignoreIt {\n\t\t\t\t\t\t\tdependsMap[id] = struct{}{}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor _, v := range i {\n\t\t\t\trecurse(myResourceID, v, dependsMap)\n\t\t\t}\n\t\tcase []interface{}:\n\t\t\tfor _, v := range i {\n\t\t\t\trecurse(myResourceID, v, dependsMap)\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, resource := range jsonpath.MustCompile(\"$.resources.*\").Get(template) {\n\t\ttyp := jsonpath.MustCompile(\"$.type\").MustGetString(resource)\n\t\tname := jsonpath.MustCompile(\"$.name\").MustGetString(resource)\n\n\t\tdependsMap := map[string]struct{}{}\n\n\t\t// if we're a child resource, depend on our parent\n\t\tif strings.Count(typ, \"/\") == 2 {\n\t\t\tid := resourceid.ResourceID(subscriptionID, resourceGroup, typ[:strings.LastIndexByte(typ, '/')], name[:strings.LastIndexByte(name, '/')])\n\t\t\tdependsMap[id] = struct{}{}\n\t\t}\n\n\t\trecurse(resourceid.ResourceID(subscriptionID, resourceGroup, typ, name), resource, dependsMap)\n\n\t\tdepends := make([]string, 0, len(dependsMap))\n\t\tfor k := range dependsMap {\n\t\t\tif _, found := myResources[k]; found {\n\t\t\t\tdepends = append(depends, k)\n\t\t\t}\n\t\t}\n\n\t\tif len(depends) > 0 {\n\t\t\tsort.Strings(depends)\n\n\t\t\tjsonpath.MustCompile(\"$.dependsOn\").Set(resource, depends)\n\t\t}\n\t}\n}", "func (c *Client) Push(resources []APIResource) error {\n\tfor _, res := range resources {\n\t\t// REVISIT: maybe we should save updates (and thus zk and\n\t\t// midolman loads) by performing GET and compare first.\n\t\t// Or we can make the MidoNet API detect and ignore no-op updates.\n\t\tresp, body, err := c.post(res)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif resp.StatusCode == 404 || resp.StatusCode == 400 {\n\t\t\t// There are a few cases we can see 404 here.\n\t\t\t// - The resource is HasParent and the parent has not been\n\t\t\t// created yet\n\t\t\t// - The resource has a reference to the other resources (e.g.\n\t\t\t// filter chains for a Bridge) and they have not been created\n\t\t\t// yet\n\t\t\t// Also, MidoNet API returns 400 in a similar cases.\n\t\t\t// - When the port referenced by Route.nextHopPort doesn't exist.\n\t\t\t// (ROUTE_NEXT_HOP_PORT_NOT_NULL)\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"resource\": res,\n\t\t\t}).Info(\"Referent doesn't exist yet?\")\n\t\t\treturn fmt.Errorf(\"Referent doesn't exist yet?\")\n\t\t}\n\t\tif resp.StatusCode == 409 || (resp.StatusCode == 500 && mna1315(res)) {\n\t\t\tif res.Path(\"PUT\") != \"\" {\n\t\t\t\tresp, body, err = c.put(res)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif resp.StatusCode == 409 {\n\t\t\t\t\tif _, ok := res.(*TunnelZone); ok {\n\t\t\t\t\t\t// Workaound for UNIQUE_TUNNEL_ZONE_NAME_TYPE issue.\n\t\t\t\t\t\t// https://midonet.atlassian.net/browse/MNA-1293\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif res.Path(\"GET\") != \"\" {\n\t\t\t\t\texists, err := c.exists(res)\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\tif !exists {\n\t\t\t\t\t\t// assume a transient error\n\t\t\t\t\t\treturn fmt.Errorf(\"Unexpected 409\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// assume 409 meant ok\n\t\t\t\t// REVISIT: confirm that the existing resource is\n\t\t\t\t// same enough as what we want.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif resp.StatusCode/100 != 2 {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"statusCode\": resp.StatusCode,\n\t\t\t\t\"body\": body,\n\t\t\t}).Fatal(\"Unexpected status code\")\n\t\t}\n\t}\n\treturn nil\n}", "func (r *ReconcileGitTrack) deleteResources(leftovers map[string]farosv1alpha1.GitTrackObjectInterface) error {\n\tif len(leftovers) > 0 {\n\t\tr.log.V(0).Info(\"Found leftover resources to clean up\", \"leftover resources\", string(len(leftovers)))\n\t}\n\tfor name, obj := range leftovers {\n\t\tif err := r.Delete(context.TODO(), obj); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to delete child for '%s': '%s'\", name, err)\n\t\t}\n\t\tr.log.V(0).Info(\"Child deleted\", \"child name\", name)\n\t}\n\treturn nil\n}", "func (client *Client) UntagResources(request *UntagResourcesRequest) (_result *UntagResourcesResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &UntagResourcesResponse{}\n\t_body, _err := client.UntagResourcesWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func (client *Client) UntagResources(request *UntagResourcesRequest) (_result *UntagResourcesResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &UntagResourcesResponse{}\n\t_body, _err := client.UntagResourcesWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func (sc *syncContext) getSyncTasks() (_ syncTasks, successful bool) {\n\tresourceTasks := syncTasks{}\n\tsuccessful = true\n\n\tfor _, resource := range sc.compareResult.managedResources {\n\t\tif !sc.containsResource(resource) {\n\t\t\tlog.WithFields(log.Fields{\"group\": resource.Group, \"kind\": resource.Kind, \"name\": resource.Name}).\n\t\t\t\tDebug(\"skipping\")\n\t\t\tcontinue\n\t\t}\n\n\t\tobj := obj(resource.Target, resource.Live)\n\n\t\t// this creates garbage tasks\n\t\tif hook.IsHook(obj) {\n\t\t\tlog.WithFields(log.Fields{\"group\": obj.GroupVersionKind().Group, \"kind\": obj.GetKind(), \"namespace\": obj.GetNamespace(), \"name\": obj.GetName()}).\n\t\t\t\tDebug(\"skipping hook\")\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, phase := range syncPhases(obj) {\n\t\t\tresourceTasks = append(resourceTasks, &syncTask{phase: phase, targetObj: resource.Target, liveObj: resource.Live})\n\t\t}\n\t}\n\n\tsc.log.WithFields(log.Fields{\"resourceTasks\": resourceTasks}).Debug(\"tasks from managed resources\")\n\n\thookTasks := syncTasks{}\n\tif !sc.skipHooks() {\n\t\tfor _, obj := range sc.compareResult.hooks {\n\t\t\tfor _, phase := range syncPhases(obj) {\n\t\t\t\t// Hook resources names are deterministic, whether they are defined by the user (metadata.name),\n\t\t\t\t// or formulated at the time of the operation (metadata.generateName). If user specifies\n\t\t\t\t// metadata.generateName, then we will generate a formulated metadata.name before submission.\n\t\t\t\ttargetObj := obj.DeepCopy()\n\t\t\t\tif targetObj.GetName() == \"\" {\n\t\t\t\t\tpostfix := strings.ToLower(fmt.Sprintf(\"%s-%s-%d\", sc.syncRes.Revision[0:7], phase, sc.opState.StartedAt.UTC().Unix()))\n\t\t\t\t\tgenerateName := obj.GetGenerateName()\n\t\t\t\t\ttargetObj.SetName(fmt.Sprintf(\"%s%s\", generateName, postfix))\n\t\t\t\t}\n\n\t\t\t\thookTasks = append(hookTasks, &syncTask{phase: phase, targetObj: targetObj})\n\t\t\t}\n\t\t}\n\t}\n\n\tsc.log.WithFields(log.Fields{\"hookTasks\": hookTasks}).Debug(\"tasks from hooks\")\n\n\ttasks := resourceTasks\n\ttasks = append(tasks, hookTasks...)\n\n\t// enrich target objects with the namespace\n\tfor _, task := range tasks {\n\t\tif task.targetObj == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif task.targetObj.GetNamespace() == \"\" {\n\t\t\t// If target object's namespace is empty, we set namespace in the object. We do\n\t\t\t// this even though it might be a cluster-scoped resource. This prevents any\n\t\t\t// possibility of the resource from unintentionally becoming created in the\n\t\t\t// namespace during the `kubectl apply`\n\t\t\ttask.targetObj = task.targetObj.DeepCopy()\n\t\t\ttask.targetObj.SetNamespace(sc.namespace)\n\t\t}\n\t}\n\n\t// enrich task with live obj\n\tfor _, task := range tasks {\n\t\tif task.targetObj == nil || task.liveObj != nil {\n\t\t\tcontinue\n\t\t}\n\t\ttask.liveObj = sc.liveObj(task.targetObj)\n\t}\n\n\t// enrich tasks with the result\n\tfor _, task := range tasks {\n\t\t_, result := sc.syncRes.Resources.Find(task.group(), task.kind(), task.namespace(), task.name(), task.phase)\n\t\tif result != nil {\n\t\t\ttask.syncStatus = result.Status\n\t\t\ttask.operationState = result.HookPhase\n\t\t\ttask.message = result.Message\n\t\t}\n\t}\n\n\t// check permissions\n\tfor _, task := range tasks {\n\t\tserverRes, err := kube.ServerResourceForGroupVersionKind(sc.disco, task.groupVersionKind())\n\t\tif err != nil {\n\t\t\t// Special case for custom resources: if CRD is not yet known by the K8s API server,\n\t\t\t// skip verification during `kubectl apply --dry-run` since we expect the CRD\n\t\t\t// to be created during app synchronization.\n\t\t\tif apierr.IsNotFound(err) && sc.hasCRDOfGroupKind(task.group(), task.kind()) {\n\t\t\t\tsc.log.WithFields(log.Fields{\"task\": task}).Debug(\"skip dry-run for custom resource\")\n\t\t\t\ttask.skipDryRun = true\n\t\t\t} else {\n\t\t\t\tsc.setResourceResult(task, v1alpha1.ResultCodeSyncFailed, \"\", err.Error())\n\t\t\t\tsuccessful = false\n\t\t\t}\n\t\t} else {\n\t\t\tif !sc.proj.IsResourcePermitted(metav1.GroupKind{Group: task.group(), Kind: task.kind()}, serverRes.Namespaced) {\n\t\t\t\tsc.setResourceResult(task, v1alpha1.ResultCodeSyncFailed, \"\", fmt.Sprintf(\"Resource %s:%s is not permitted in project %s.\", task.group(), task.kind(), sc.proj.Name))\n\t\t\t\tsuccessful = false\n\t\t\t}\n\t\t\tif serverRes.Namespaced && !sc.proj.IsDestinationPermitted(v1alpha1.ApplicationDestination{Namespace: task.namespace(), Server: sc.server}) {\n\t\t\t\tsc.setResourceResult(task, v1alpha1.ResultCodeSyncFailed, \"\", fmt.Sprintf(\"namespace %v is not permitted in project '%s'\", task.namespace(), sc.proj.Name))\n\t\t\t\tsuccessful = false\n\t\t\t}\n\t\t}\n\t}\n\n\tsort.Sort(tasks)\n\n\treturn tasks, successful\n}", "func (m manager) CleanupRelease(ctx context.Context, manifest string) (bool, error) {\n\tdc, err := m.actionConfig.RESTClientGetter.ToDiscoveryClient()\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to get Kubernetes discovery client: %w\", err)\n\t}\n\tapiVersions, err := action.GetVersionSet(dc)\n\tif err != nil && !discovery.IsGroupDiscoveryFailedError(err) {\n\t\treturn false, fmt.Errorf(\"failed to get apiVersions from Kubernetes: %w\", err)\n\t}\n\tmanifests := releaseutil.SplitManifests(manifest)\n\t_, files, err := releaseutil.SortManifests(manifests, apiVersions, releaseutil.UninstallOrder)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to sort manifests: %w\", err)\n\t}\n\t// do not delete resources that are annotated with the Helm resource policy 'keep'\n\t_, filesToDelete := manifestutil.FilterManifestsToKeep(files)\n\tvar builder strings.Builder\n\tfor _, file := range filesToDelete {\n\t\tbuilder.WriteString(\"\\n---\\n\" + file.Content)\n\t}\n\tresources, err := m.kubeClient.Build(strings.NewReader(builder.String()), false)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to build resources from manifests: %w\", err)\n\t}\n\tif resources == nil || len(resources) <= 0 {\n\t\treturn true, nil\n\t}\n\tfor _, resource := range resources {\n\t\terr = resource.Get()\n\t\tif err != nil {\n\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\tcontinue // resource is already delete, check the next one.\n\t\t\t}\n\t\t\treturn false, fmt.Errorf(\"failed to get resource: %w\", err)\n\t\t}\n\t\t// found at least one resource that is not deleted so just delete everything again.\n\t\t_, errs := m.kubeClient.Delete(resources)\n\t\tif len(errs) > 0 {\n\t\t\treturn false, fmt.Errorf(\"failed to delete resources: %v\", apiutilerrors.NewAggregate(errs))\n\t\t}\n\t\treturn false, nil\n\t}\n\treturn true, nil\n}", "func mergeResource(res *Resource, resources map[Version][]*Resource, version *Version) *Resource {\n\tresourceAcrossVersions := make(map[Version]*Resource)\n\tfor v, resList := range resources {\n\t\tfor _, r := range resList {\n\t\t\t// Name is not unique, TerraformName must be\n\t\t\tif r.TerraformName() == res.TerraformName() {\n\t\t\t\tresourceAcrossVersions[v] = r\n\t\t\t}\n\t\t}\n\t}\n\tga, gaExists := resourceAcrossVersions[GA_VERSION]\n\tbeta, betaExists := resourceAcrossVersions[BETA_VERSION]\n\talpha, alphaExists := resourceAcrossVersions[ALPHA_VERSION]\n\tif alphaExists {\n\t\treturn alpha\n\t}\n\tif gaExists {\n\t\tif betaExists {\n\t\t\treturn mergeResources(ga, beta)\n\t\t}\n\t\treturn ga\n\t}\n\tbeta.Description = fmt.Sprintf(\"Beta only: %s\", beta.Description)\n\treturn beta\n}", "func DeployResources(testRunner base.ClusterTestRunner) error {\n\t// Deploys a static set of resources\n\tlog.Printf(\"Deploying resources\")\n\n\tpub, _ := testRunner.GetPublicContext(1)\n\tprv, _ := testRunner.GetPrivateContext(1)\n\n\t// Deploys the same set of resources against both clusters\n\t// resources will have index (1 or 2), depending on the\n\t// cluster they are being deployed to\n\tfor i, cluster := range []*client.VanClient{pub.VanClient, prv.VanClient} {\n\t\tclusterIdx := i + 1\n\n\t\t// Annotations (optional) to deployment and services\n\t\tdepAnnotations := map[string]string{}\n\t\tstatefulSetAnnotations := map[string]string{}\n\t\tdaemonSetAnnotations := map[string]string{}\n\t\tsvcNoTargetAnnotations := map[string]string{}\n\t\tsvcTargetAnnotations := map[string]string{}\n\t\tpopulateAnnotations(clusterIdx, depAnnotations, svcNoTargetAnnotations, svcTargetAnnotations,\n\t\t\tstatefulSetAnnotations, daemonSetAnnotations)\n\n\t\t// Create a service without annotations to be taken by Skupper as a deployment will be annotated with this service address\n\t\tif _, err := createService(cluster, fmt.Sprintf(\"nginx-%d-dep-not-owned\", clusterIdx), map[string]string{}); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// One single deployment will be created (for the nginx http server)\n\t\tif _, err := createDeployment(cluster, depAnnotations); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err := createStatefulSet(cluster, statefulSetAnnotations); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err := createDaemonSet(cluster, daemonSetAnnotations); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Now create two services. One that does not have a target address,\n\t\t// and another that provides a target address.\n\t\tif _, err := createService(cluster, fmt.Sprintf(\"nginx-%d-svc-exp-notarget\", clusterIdx), svcNoTargetAnnotations); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// This service with the target should not be exposed (only the target service will be)\n\t\tif _, err := createService(cluster, fmt.Sprintf(\"nginx-%d-svc-target\", clusterIdx), svcTargetAnnotations); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Wait for pods to be running\n\tfor _, cluster := range []*client.VanClient{pub.VanClient, prv.VanClient} {\n\t\tlog.Printf(\"waiting on pods to be running on %s\", cluster.Namespace)\n\t\t// Get all pod names\n\t\tpodList, err := cluster.KubeClient.CoreV1().Pods(cluster.Namespace).List(context.TODO(), metav1.ListOptions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(podList.Items) == 0 {\n\t\t\treturn fmt.Errorf(\"no pods running\")\n\t\t}\n\n\t\tfor _, pod := range podList.Items {\n\t\t\t_, err := kube.WaitForPodStatus(cluster.Namespace, cluster.KubeClient, pod.Name, corev1.PodRunning, timeout, interval)\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}", "func DeleteResources(f *os.File, cfg *rest.Config, dynamicClient dynamic.Interface, waitForDeletion bool) error {\n\tdeletionPropagation := metav1.DeletePropagationForeground\n\tgracePeriodSeconds := int64(0)\n\n\tdecoder, mapper, err := parseObjects(f, cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor {\n\t\tresource, unstructuredObj, err := getResource(decoder, mapper, dynamicClient)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif err := resource.Delete(context.Background(), unstructuredObj.GetName(),\n\t\t\tmetav1.DeleteOptions{GracePeriodSeconds: &gracePeriodSeconds,\n\t\t\t\tPropagationPolicy: &deletionPropagation}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif waitForDeletion {\n\t\t// verify deleted\n\t\tdecoder, mapper, err := parseObjects(f, cfg)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor {\n\t\t\tresource, unstructuredObj, err := getResource(decoder, mapper, dynamicClient)\n\t\t\tif err != nil {\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfmt.Fprintln(ginkgo.GinkgoWriter, \"wait for deletion\", unstructuredObj.GetName())\n\t\t\tif err := wait.Poll(time.Second*5, time.Second*10, func() (done bool, err error) {\n\t\t\t\tobj, err := resource.Get(context.Background(), unstructuredObj.GetName(), metav1.GetOptions{})\n\n\t\t\t\tif err == nil {\n\t\t\t\t\tfmt.Fprintln(ginkgo.GinkgoWriter, \"remove finalizers\", obj.GetFinalizers(), unstructuredObj.GetName())\n\t\t\t\t\tobj.SetFinalizers(nil)\n\t\t\t\t\t_, err = resource.Update(context.Background(), obj, metav1.UpdateOptions{})\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn false, err\n\t\t\t\t\t}\n\t\t\t\t\treturn false, nil\n\t\t\t\t}\n\t\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\t\treturn true, nil\n\t\t\t\t}\n\t\t\t\treturn false, err\n\t\t\t}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (h *HelmReconciler) PruneResources(gvks []schema.GroupVersionKind, all bool, namespace string) error {\n\tallErrors := []error{}\n\townerLabels := h.customizer.PruningDetails().GetOwnerLabels()\n\townerAnnotations := h.customizer.PruningDetails().GetOwnerAnnotations()\n\tfor _, gvk := range gvks {\n\t\tobjects := &unstructured.UnstructuredList{}\n\t\tobjects.SetGroupVersionKind(gvk)\n\t\terr := h.client.List(context.TODO(), objects, client.MatchingLabels(ownerLabels), client.InNamespace(namespace))\n\t\tif err != nil {\n\t\t\t// we only want to retrieve resources clusters\n\t\t\tlog.Warnf(\"retrieving resources to prune type %s: %s not found\", gvk.String(), err)\n\t\t\tcontinue\n\t\t}\n\tobjectLoop:\n\t\tfor _, object := range objects.Items {\n\t\t\tannotations := object.GetAnnotations()\n\t\t\tfor ownerKey, ownerValue := range ownerAnnotations {\n\t\t\t\t// we only want to delete objects that contain the annotations\n\t\t\t\t// if we're not pruning all objects, we only want to prune those whose annotation value does not match what is expected\n\t\t\t\tif value, ok := annotations[ownerKey]; !ok || (!all && value == ownerValue) {\n\t\t\t\t\tcontinue objectLoop\n\t\t\t\t}\n\t\t\t}\n\t\t\terr = h.client.Delete(context.TODO(), &object, client.PropagationPolicy(metav1.DeletePropagationBackground))\n\t\t\tif err == nil {\n\t\t\t\tif listenerErr := h.customizer.Listener().ResourceDeleted(&object); listenerErr != nil {\n\t\t\t\t\tlog.Errorf(\"error calling listener: %s\", err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif listenerErr := h.customizer.Listener().ResourceError(&object, err); listenerErr != nil {\n\t\t\t\t\tlog.Errorf(\"error calling listener: %s\", err)\n\t\t\t\t}\n\t\t\t\tallErrors = append(allErrors, err)\n\t\t\t}\n\t\t}\n\t}\n\treturn utilerrors.NewAggregate(allErrors)\n}", "func CheckDupe(domain, instance, class, id string) error {\n\n\tfileName := strings.ToLower(fileName(domain, instance, class, id))\n\n\tmux.Lock()\n\tdefer mux.Unlock()\n\n\t_, found := sources[fileName]\n\tif found {\n\t\treturn ErrDup\n\t}\n\n\tsources[fileName] = true\n\n\treturn nil\n}", "func (c *resourceCache) UpdateResources(resources []NamedProtoMessage) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tfor _, res := range resources {\n\t\tname := GetResourceName(res)\n\t\tc.cache[name] = res\n\t}\n}", "func mergeObjects(live, obj runtime.Object) error {\n\t// Service's clusterIP needs to be re-set to the value provided\n\t// by controller or mutation will be denied.\n\tif liveSvc, ok := live.(*corev1.Service); ok {\n\t\tsvc := obj.(*corev1.Service)\n\t\tsvc.Spec.ClusterIP = liveSvc.Spec.ClusterIP\n\n\t\tgotPort := liveSvc.Spec.HealthCheckNodePort\n\t\twantPort := svc.Spec.HealthCheckNodePort\n\t\t// If port is set (non-zero) and doesn't match the existing port (also non-zero), error out.\n\t\tif wantPort != 0 && gotPort != 0 && wantPort != gotPort {\n\t\t\treturn ErrImmutableRessource(\".spec.healthCheckNodePort\", obj)\n\t\t}\n\t\tsvc.Spec.HealthCheckNodePort = gotPort\n\t}\n\n\tif liveClusterRoleBinding, ok := live.(*rbacv1.ClusterRoleBinding); ok {\n\t\tclusterRoleBinding := obj.(*rbacv1.ClusterRoleBinding)\n\t\tif liveClusterRoleBinding.RoleRef.APIGroup != clusterRoleBinding.RoleRef.APIGroup ||\n\t\t\tliveClusterRoleBinding.RoleRef.Kind != clusterRoleBinding.RoleRef.Kind ||\n\t\t\tliveClusterRoleBinding.RoleRef.Name != clusterRoleBinding.RoleRef.Name {\n\t\t\treturn ErrImmutableRessource(\"roleRef\", obj)\n\t\t}\n\t}\n\n\t// Set metadata.resourceVersion for updates as required by\n\t// Kubernetes API (http://go/k8s-concurrency).\n\tif gotRV := live.(metav1.Object).GetResourceVersion(); gotRV != \"\" {\n\t\tobj.(metav1.Object).SetResourceVersion(gotRV)\n\t}\n\n\treturn nil\n}", "func TestActiveReplicatorPullPurgeOnRemoval(t *testing.T) {\n\n\tbase.RequireNumTestBuckets(t, 2)\n\n\tbase.SetUpTestLogging(t, logger.LevelInfo, logger.KeyHTTP, logger.KeySync, logger.KeyReplicate)\n\n\t// Passive\n\ttb2 := base.GetTestBucket(t)\n\n\trt2 := NewRestTester(t, &RestTesterConfig{\n\t\tTestBucket: tb2,\n\t\tDatabaseConfig: &DatabaseConfig{DbConfig: DbConfig{\n\t\t\tUsers: map[string]*db.PrincipalConfig{\n\t\t\t\t\"alice\": {\n\t\t\t\t\tPassword: base.StringPtr(\"pass\"),\n\t\t\t\t\tExplicitChannels: utils.SetOf(\"alice\"),\n\t\t\t\t},\n\t\t\t},\n\t\t}},\n\t})\n\tdefer rt2.Close()\n\n\tdocID := t.Name() + \"rt2doc1\"\n\tresp := rt2.SendAdminRequest(http.MethodPut, \"/db/\"+docID, `{\"source\":\"rt2\",\"channels\":[\"alice\"]}`)\n\tassertStatus(t, resp, http.StatusCreated)\n\trevID := respRevID(t, resp)\n\n\t// Make rt2 listen on an actual HTTP port, so it can receive the blipsync request from rt1.\n\tsrv := httptest.NewServer(rt2.TestPublicHandler())\n\tdefer srv.Close()\n\n\tpassiveDBURL, err := url.Parse(srv.URL + \"/db\")\n\trequire.NoError(t, err)\n\n\t// Add basic auth creds to target db URL\n\tpassiveDBURL.User = url.UserPassword(\"alice\", \"pass\")\n\n\t// Active\n\ttb1 := base.GetTestBucket(t)\n\n\trt1 := NewRestTester(t, &RestTesterConfig{\n\t\tTestBucket: tb1,\n\t})\n\tdefer rt1.Close()\n\n\tar := db.NewActiveReplicator(&db.ActiveReplicatorConfig{\n\t\tID: t.Name(),\n\t\tDirection: db.ActiveReplicatorTypePull,\n\t\tRemoteDBURL: passiveDBURL,\n\t\tActiveDB: &db.Database{\n\t\t\tDatabaseContext: rt1.GetDatabase(),\n\t\t},\n\t\tChangesBatchSize: 200,\n\t\tContinuous: true,\n\t\tPurgeOnRemoval: true,\n\t\tReplicationStatsMap: base.SyncGatewayStats.NewDBStats(t.Name(), false, false, false).DBReplicatorStats(t.Name()),\n\t})\n\tdefer func() { assert.NoError(t, ar.Stop()) }()\n\n\t// Start the replicator (implicit connect)\n\tassert.NoError(t, ar.Start())\n\n\t// wait for the document originally written to rt2 to arrive at rt1\n\tchangesResults, err := rt1.WaitForChanges(1, \"/db/_changes?since=0\", \"\", true)\n\trequire.NoError(t, err)\n\trequire.Len(t, changesResults.Results, 1)\n\tassert.Equal(t, docID, changesResults.Results[0].ID)\n\n\tdoc, err := rt1.GetDatabase().GetDocument(logger.TestCtx(t), docID, db.DocUnmarshalAll)\n\tassert.NoError(t, err)\n\n\tassert.Equal(t, revID, doc.SyncData.CurrentRev)\n\n\tbody, err := doc.GetDeepMutableBody()\n\trequire.NoError(t, err)\n\tassert.Equal(t, \"rt2\", body[\"source\"])\n\n\tresp = rt2.SendAdminRequest(http.MethodPut, \"/db/\"+docID+\"?rev=\"+revID, `{\"source\":\"rt2\",\"channels\":[\"bob\"]}`)\n\tassertStatus(t, resp, http.StatusCreated)\n\n\t// wait for the channel removal written to rt2 to arrive at rt1 - we can't monitor _changes, because we've purged, not removed. But we can monitor the associated stat.\n\tbase.WaitForStat(func() int64 {\n\t\tstats := ar.GetStatus()\n\t\treturn stats.DocsPurged\n\t}, 1)\n\n\tdoc, err = rt1.GetDatabase().GetDocument(logger.TestCtx(t), docID, db.DocUnmarshalAll)\n\tassert.Error(t, err)\n\tassert.True(t, base.IsDocNotFoundError(err), \"Error returned wasn't a DocNotFound error\")\n\tassert.Nil(t, doc)\n}", "func TestDeleteResource(t *testing.T) {\n\ttestName := \"TestDeleteResource\"\n\tbeforeTest()\n\t// kinds to check for status\n\tvar kindsToCheckStatus = map[string]bool{\n\t\tAPPLICATION: true,\n\t\t\"Ingress\": true,\n\t\t\"Service\": true,\n\t\t\"Deployment\": true,\n\t\t\"StatefulSet\": true,\n\t\t\"NetworkPolicy\": true,\n\t}\n\n\t// resources to pre-populate\n\tvar files = []string{\n\t\t/* 0 */ KappnavConfigFile,\n\t\t/* 1 */ CrdApplication,\n\t\t/* 4 */ appBookinfo,\n\t\t/* 5 */ appProductpage,\n\t\t/* 6 */ appDetails,\n\t\t/* 7 */ appRatings,\n\t\t/* 8 */ deploymentDetailsV1,\n\t\t/* 9 */ deploymentProcuctpageV1,\n\t\t/* 10 */ deploymentRatingsV1,\n\t\t/* 11 */ ingressBookinfo,\n\t\t/* 12 */ networkpolicyProductpage,\n\t\t/* 13 */ networkpolicyReviews,\n\t\t/* 14 */ serviceDetails,\n\t\t/* 15 */ serviceProductpage,\n\t\t/* 16 */ serviceRatings,\n\t\t/* 17 */ serviceReview,\n\t\t/* 18 */ deploymentReviewsV1,\n\t\t/* 19 */ appReviews,\n\t\t/* 20 */ deploymentReviewsV2,\n\t\t/* 21 */ deploymentReviewsV3,\n\t}\n\titeration0IDs, err := readResourceIDs(files)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttestActions := newTestActions(testName, kindsToCheckStatus)\n\n\t/* Iteration 0 */\n\titeration0IDs[2].expectedStatus = problem // bookinfo problem due to review app\n\titeration0IDs[17].expectedStatus = problem // review app problem due to deploymentReviewsV3\n\titeration0IDs[18].expectedStatus = warning // deploymentReviewsV2 is WARING\n\titeration0IDs[19].expectedStatus = problem // deploymentReviewsV3 is problem\n\tvar emptyIDs = []resourceID{}\n\ttestActions.addIteration(iteration0IDs, emptyIDs)\n\n\t/* iteration 1: delete deploymentReviewsV3 */\n\tarrayLength := len(iteration0IDs) - 1\n\tvar iteration1IDs = make([]resourceID, arrayLength, arrayLength)\n\tcopy(iteration1IDs, iteration0IDs)\n\titeration1IDs[2].expectedStatus = warning // bookfino now warning\n\titeration1IDs[17].expectedStatus = warning // review app now warning deu to deploymentReviewsV3 being deleted\n\ttestActions.addIteration(iteration1IDs, emptyIDs)\n\n\t/* iteration 2: delete deploymentReviewsV2 */\n\tarrayLength = len(iteration1IDs) - 1\n\tvar iteration2IDs = make([]resourceID, arrayLength, arrayLength)\n\tcopy(iteration2IDs, iteration1IDs)\n\titeration2IDs[2].expectedStatus = Normal // bookfino now Normal\n\titeration2IDs[17].expectedStatus = Normal // reviews now Normal deu to deploymentReviewsV2 being deleted\n\ttestActions.addIteration(iteration2IDs, emptyIDs)\n\n\t/* iteration 3: set deploymentReviewsV1 to warning */\n\tarrayLength = len(iteration2IDs)\n\tvar iteration3IDs = make([]resourceID, arrayLength, arrayLength)\n\tcopy(iteration3IDs, iteration2IDs)\n\titeration3IDs[2].expectedStatus = warning // bookfino now Normal\n\titeration3IDs[16].expectedStatus = warning // deploymentReviewsV1 now warning\n\titeration3IDs[17].expectedStatus = warning // reviews now Normal deu to deploymentReviewsV1 being warning\n\ttestActions.addIteration(iteration3IDs, emptyIDs)\n\n\t/* iteration 4: delet review app */\n\tarrayLength = len(iteration3IDs) - 1\n\tvar iteration4IDs = make([]resourceID, arrayLength, arrayLength)\n\tcopy(iteration4IDs, iteration3IDs)\n\titeration4IDs[2].expectedStatus = Normal // bookfino now Normal due to review app being deleted\n\ttestActions.addIteration(iteration4IDs, emptyIDs)\n\n\t/* iteration 5: clean up */\n\ttestActions.addIteration(emptyIDs, emptyIDs)\n\n\tclusterWatcher, err := createClusterWatcher(iteration0IDs, testActions, StatusFailureRate)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer clusterWatcher.shutDown()\n\n\t// make all trasition of testAction\n\terr = testActions.transitionAll()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "func RemovePreUnifiedResources(kube kubernetes.Interface, oldName string) error {\n\tif err := kube.AppsV1().Deployments(system.Namespace()).Delete(oldName, &metav1.DeleteOptions{}); err != nil && !apierrs.IsNotFound(err) {\n\t\treturn fmt.Errorf(\"failed to remove old deployment %s: %w\", oldName, err)\n\t}\n\tif err := kube.CoreV1().ServiceAccounts(system.Namespace()).Delete(oldName, &metav1.DeleteOptions{}); err != nil && !apierrs.IsNotFound(err) {\n\t\treturn fmt.Errorf(\"failed to remove old serviceaccount %s: %w\", oldName, err)\n\t}\n\n\treturn nil\n}", "func KeepResources() bool {\n\treturn keepResources\n}", "func KeepResources() bool {\n\treturn keepResources\n}", "func applyTags(data *schema.ResourceData, apiClient *compute.Client, assetType string, providerSettings ProviderSettings) error {\n\tvar (\n\t\tresponse *compute.APIResponseV2\n\t\terr error\n\t)\n\n\tresourceID := data.Id()\n\n\tlog.Printf(\"Configuring tags for resource '%s'...\", resourceID)\n\n\tpropertyHelper := propertyHelper(data)\n\tconfiguredTags := propertyHelper.GetTags(resourceKeyTag)\n\n\ttags, err := getTags(apiClient, resourceID, assetType)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Capture any tags that are no-longer needed.\n\tunusedTags := &schema.Set{\n\t\tF: schema.HashString,\n\t}\n\tfor _, tag := range tags {\n\t\tunusedTags.Add(tag.Name)\n\t}\n\tfor _, tag := range configuredTags {\n\t\tunusedTags.Remove(tag.Name)\n\t}\n\n\tif len(configuredTags) > 0 {\n\t\tlog.Printf(\"Applying %d tags to resource '%s'...\", len(configuredTags), resourceID)\n\n\t\tresponse, err = apiClient.ApplyAssetTags(resourceID, assetType, configuredTags...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif response.ResponseCode != compute.ResponseCodeOK {\n\t\t\treturn response.ToError(\"Failed to apply %d tags to resource:'%s' asset_type:'%s' (response code '%s'): %s\", len(configuredTags), resourceID, assetType, response.ResponseCode, response.Message)\n\t\t}\n\t} else {\n\t\tlog.Printf(\"No tags need to be added to resource '%s'.\", resourceID)\n\t}\n\n\t// Trim unused tags (currently-configured tags will overwrite any existing values).\n\tif unusedTags.Len() > 0 {\n\t\tunusedTagNames := make([]string, unusedTags.Len())\n\t\tfor index, unusedTagName := range unusedTags.List() {\n\t\t\tunusedTagNames[index] = unusedTagName.(string)\n\t\t}\n\n\t\tlog.Printf(\"Removing %d unused tags from resource '%s'...\", len(unusedTagNames), resourceID)\n\n\t\tresponse, err = apiClient.RemoveAssetTags(resourceID, assetType, unusedTagNames...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif response.ResponseCode != compute.ResponseCodeOK {\n\t\t\treturn response.ToError(\"Failed to remove %d tags from resource '%s' (response code '%s'): %s\", len(configuredTags), resourceID, response.ResponseCode, response.Message)\n\t\t}\n\t}\n\n\treturn nil\n}", "func unsetExistingResources(existingStack *gjson.Result, clusterConfig *api.ClusterConfig) {\n\tcontrolPlaneSG := existingStack.Get(cfnControlPlaneSGResource)\n\tif controlPlaneSG.Exists() {\n\t\tclusterConfig.VPC.SecurityGroup = \"\"\n\t}\n\tsharedNodeSG := existingStack.Get(cfnSharedNodeSGResource)\n\tif sharedNodeSG.Exists() {\n\t\tclusterConfig.VPC.SharedNodeSecurityGroup = \"\"\n\t}\n}", "func (res *ruleMatchResults) unique() *ruleMatchResults {\n\tif len(res.pipelines) == 0 {\n\t\treturn res\n\t}\n\n\t// Otherwise merge as per usual\n\tcurr := 0\n\tfor i := 1; i < len(res.pipelines); i++ {\n\t\tfoundDup := false\n\t\tfor j := 0; j <= curr; j++ {\n\t\t\tif res.pipelines[j].Equal(res.pipelines[i]) {\n\t\t\t\tfoundDup = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif foundDup {\n\t\t\tcontinue\n\t\t}\n\t\tcurr++\n\t\tres.pipelines[curr] = res.pipelines[i]\n\t}\n\tfor i := curr + 1; i < len(res.pipelines); i++ {\n\t\tres.pipelines[i] = metadata.PipelineMetadata{}\n\t}\n\tres.pipelines = res.pipelines[:curr+1]\n\treturn res\n}", "func (pv *PixView) CleanDupes(dryRun bool) {\n\tpv.UpdtMu.Lock()\n\tdefer pv.UpdtMu.Unlock()\n\n\t// adir := filepath.Join(pv.ImageDir, \"All\")\n\tpv.UpdateFolders()\n\n\tsmap := make(map[int64]picinfo.Pics, len(pv.AllInfo))\n\n\tsmax := int64(0)\n\tfor _, pi := range pv.AllInfo {\n\t\tfi, err := os.Stat(pi.Thumb)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tsz := fi.Size()\n\t\tif sz > smax {\n\t\t\tsmax = sz\n\t\t}\n\t\tpis, has := smap[sz]\n\t\tif has {\n\t\t\tpis = append(pis, pi)\n\t\t\tsmap[sz] = pis\n\t\t} else {\n\t\t\tsmap[sz] = picinfo.Pics{pi}\n\t\t}\n\t}\n\n\tmx := len(smap)\n\tpv.PProg.Start(mx)\n\n\tszs := make([]int64, mx)\n\tidx := 0\n\tfor sz := range smap {\n\t\tszs[idx] = sz\n\t\tidx++\n\t}\n\n\tncp := runtime.NumCPU()\n\tnper := mx / ncp\n\tst := 0\n\tfor i := 0; i < ncp; i++ {\n\t\ted := st + nper\n\t\tif i == ncp-1 {\n\t\t\ted = mx\n\t\t}\n\t\tgo pv.CleanDupesThr(dryRun, smax, szs, smap, st, ed)\n\t\tpv.WaitGp.Add(1)\n\t\tst = ed\n\t}\n\tpv.WaitGp.Wait()\n\tpv.SaveAllInfo()\n\tfmt.Println(\"...Done\\n\")\n\tgi.PromptDialog(nil, gi.DlgOpts{Title: \"Done\", Prompt: \"Done Cleaning Duplicates\"}, gi.AddOk, gi.NoCancel, nil, nil)\n\tpv.DirInfo(false)\n}", "func testResourceDeletionIgnored(t *testing.T, initialResource func(string) e2e.UpdateOptions, updateResource func(r *e2e.UpdateOptions)) {\n\tctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)\n\tt.Cleanup(cancel)\n\tmgmtServer := startManagementServer(t)\n\tnodeID := uuid.New().String()\n\tbs := generateBootstrapContents(t, mgmtServer.Address, true, nodeID)\n\txdsR := xdsResolverBuilder(t, bs)\n\tresources := initialResource(nodeID)\n\n\t// Update the management server with initial resources setup.\n\tif err := mgmtServer.Update(ctx, resources); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tcc, err := grpc.Dial(fmt.Sprintf(\"xds:///%s\", serviceName), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(xdsR))\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to dial local test server: %v.\", err)\n\t}\n\tt.Cleanup(func() { cc.Close() })\n\n\tif err := verifyRPCtoAllEndpoints(cc); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Mutate resource and update on the server.\n\tupdateResource(&resources)\n\tif err := mgmtServer.Update(ctx, resources); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Make an RPC every 50ms for the next 500ms. This is to ensure that the\n\t// updated resource is received from the management server and is processed by\n\t// gRPC. Since resource deletions are ignored by the xDS client, we expect RPCs\n\t// to all endpoints to keep succeeding.\n\ttimer := time.NewTimer(500 * time.Millisecond)\n\tticker := time.NewTicker(50 * time.Millisecond)\n\tt.Cleanup(ticker.Stop)\n\tfor {\n\t\tif err := verifyRPCtoAllEndpoints(cc); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase <-timer.C:\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t}\n\t}\n}", "func (s *Sync) fixDupes(claims []jsonrpc.Claim) (bool, error) {\n\tstart := time.Now()\n\tdefer func(start time.Time) {\n\t\ttiming.TimedComponent(\"fixDupes\").Add(time.Since(start))\n\t}(start)\n\tabandonedClaims := false\n\tvideoIDs := make(map[string]jsonrpc.Claim)\n\tfor _, c := range claims {\n\t\tif !isYtsyncClaim(c, s.DbChannelData.ChannelClaimID) {\n\t\t\tcontinue\n\t\t}\n\t\ttn := c.Value.GetThumbnail().GetUrl()\n\t\tvideoID := tn[strings.LastIndex(tn, \"/\")+1:]\n\n\t\tcl, ok := videoIDs[videoID]\n\t\tif !ok || cl.ClaimID == c.ClaimID {\n\t\t\tvideoIDs[videoID] = c\n\t\t\tcontinue\n\t\t}\n\t\t// only keep the most recent one\n\t\tclaimToAbandon := c\n\t\tvideoIDs[videoID] = cl\n\t\tif c.Height > cl.Height {\n\t\t\tclaimToAbandon = cl\n\t\t\tvideoIDs[videoID] = c\n\t\t}\n\t\t//it's likely that all we need is s.DbChannelData.PublishAddress.IsMine but better be safe than sorry I guess\n\t\tif (claimToAbandon.Address != s.DbChannelData.PublishAddress.Address || s.DbChannelData.PublishAddress.IsMine) && !s.syncedVideos[videoID].Transferred {\n\t\t\tlog.Debugf(\"abandoning %+v\", claimToAbandon)\n\t\t\t_, err := s.daemon.StreamAbandon(claimToAbandon.Txid, claimToAbandon.Nout, nil, true)\n\t\t\tif err != nil {\n\t\t\t\treturn true, err\n\t\t\t}\n\t\t\tabandonedClaims = true\n\t\t} else {\n\t\t\tlog.Debugf(\"claim is not ours. Have the user run this: lbrynet stream abandon --txid=%s --nout=%d\", claimToAbandon.Txid, claimToAbandon.Nout)\n\t\t}\n\t}\n\treturn abandonedClaims, nil\n}", "func mergeResources(src, dst *model.PdfPageResources) error {\n\t// Merge colorspaces.\n\tcolorspaces, _ := src.GetColorspaces()\n\tif colorspaces != nil && len(colorspaces.Colorspaces) > 0 {\n\t\tfor name, colorspace := range colorspaces.Colorspaces {\n\t\t\tcolorspaceName := *core.MakeName(name)\n\t\t\tif dst.HasColorspaceByName(colorspaceName) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\terr := dst.SetColorspaceByName(colorspaceName, colorspace)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func removeSourcesUsed(bld *build.File, ruleKind, attrName string, srcs srcSet) {\n\tfor _, rule := range buildRules(bld, ruleKind) {\n\t\tfor s := range srcs {\n\t\t\tpkg := filepath.Dir(bld.Path)\n\t\t\t// Handles \":foo.ts\" references, and concatenated lists [foo.ts] + [bar.ts]\n\t\t\t// TODO(martinprobst): What to do about sources that don't seem to exist?\n\t\t\tif edit.ListFind(rule.Attr(attrName), s, pkg) != nil {\n\t\t\t\tdelete(srcs, s)\n\t\t\t}\n\t\t}\n\t}\n}", "func resourceHostUpdate(d *schema.ResourceData, m interface{}) error {\n\tapi := m.(*zabbix.API)\n\n\titem, err := buildHostObject(d, m)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// templates may need a bit extra effort\n\tif d.HasChange(\"templates\") {\n\t\told, new := d.GetChange(\"templates\")\n\t\tdiff := old.(*schema.Set).Difference(new.(*schema.Set))\n\n\t\t// removals, we need to unlink and clear\n\t\tif diff.Len() > 0 {\n\t\t\titem.TemplateIDsClear = buildTemplateIds(diff)\n\t\t}\n\t}\n\n\titem.HostID = d.Id()\n\n\titems := []zabbix.Host{*item}\n\n\terr = api.HostsUpdate(items)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn resourceHostRead(d, m)\n}", "func (c *Client) updateResources(ctx context.Context, id string, resources types.Resources) error {\n\tif !c.lock.TrylockWithRetry(ctx, id) {\n\t\treturn errtypes.ErrLockfailed\n\t}\n\tdefer c.lock.Unlock(id)\n\n\tpack, err := c.watch.get(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr, err := toLinuxResources(resources)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn pack.task.Update(ctx, containerd.WithResources(r))\n}", "func (c *CLI) SyncResources(filePath string) (string, error) {\n\tvar req syncListRequest\n\tif err := fileutil.LoadFile(filePath, &req); err != nil {\n\t\treturn \"\", err\n\t}\n\tfor i := range req.Resources {\n\t\treq.Resources[i].Data = fileutil.YAMLtoJSONCompat(req.Resources[i].Data)\n\t}\n\n\tvar response []syncResponse\n\tif _, err := c.Create(context.Background(), \"/sync\", req, &response); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn encodeToYAML(syncListResponse{Resources: response})\n}", "func (sp *schemaPuller) PullCRDs(context context.Context, resourceNames ...string) (map[schema.GroupResource]*apiextensionsv1.CustomResourceDefinition, error) {\n\tcrds := map[schema.GroupResource]*apiextensionsv1.CustomResourceDefinition{}\n\t_, apiResourcesLists, err := sp.discoveryClient.ServerGroupsAndResources()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpullAllResources := len(resourceNames) == 0\n\tresourcesToPull := sets.NewString(resourceNames...)\n\n\tapiResourceNames := map[schema.GroupVersion]sets.String{}\n\tfor _, apiResourcesList := range apiResourcesLists {\n\t\tgv, err := schema.ParseGroupVersion(apiResourcesList.GroupVersion)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tapiResourceNames[gv] = sets.NewString()\n\t\tfor _, apiResource := range apiResourcesList.APIResources {\n\t\t\tapiResourceNames[gv].Insert(apiResource.Name)\n\t\t}\n\n\t}\n\n\tapiResourcesLists, err = sp.discoveryClient.ServerPreferredResources()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, apiResourcesList := range apiResourcesLists {\n\t\tgv, err := schema.ParseGroupVersion(apiResourcesList.GroupVersion)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"skipping discovery due to error parsing GroupVersion %s: %v\", apiResourcesList.GroupVersion, err)\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, apiResource := range apiResourcesList.APIResources {\n\t\t\tgroupResource := schema.GroupResource{\n\t\t\t\tGroup: gv.Group,\n\t\t\t\tResource: apiResource.Name,\n\t\t\t}\n\t\t\tif !pullAllResources && !resourcesToPull.Has(groupResource.String()) && !resourcesToPull.Has(apiResource.Name) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif genericcontrolplanescheme.Scheme.IsGroupRegistered(gv.Group) && !genericcontrolplanescheme.Scheme.IsVersionRegistered(gv) {\n\t\t\t\tklog.Warningf(\"ignoring an apiVersion since it is part of the core KCP resources, but not compatible with KCP version: %s\", gv.String())\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tgvk := gv.WithKind(apiResource.Kind)\n\t\t\tif genericcontrolplanescheme.Scheme.Recognizes(gvk) || extensionsapiserver.Scheme.Recognizes(gvk) {\n\t\t\t\tklog.Infof(\"ignoring a resource since it is part of the core KCP resources: %s (%s)\", apiResource.Name, gvk.String())\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tcrdName := apiResource.Name\n\t\t\tif gv.Group == \"\" {\n\t\t\t\tcrdName = crdName + \".core\"\n\t\t\t} else {\n\t\t\t\tcrdName = crdName + \".\" + gv.Group\n\t\t\t}\n\n\t\t\tvar resourceScope apiextensionsv1.ResourceScope\n\t\t\tif apiResource.Namespaced {\n\t\t\t\tresourceScope = apiextensionsv1.NamespaceScoped\n\t\t\t} else {\n\t\t\t\tresourceScope = apiextensionsv1.ClusterScoped\n\t\t\t}\n\n\t\t\tklog.Infof(\"processing discovery for resource %s (%s)\", apiResource.Name, crdName)\n\t\t\tvar schemaProps apiextensionsv1.JSONSchemaProps\n\t\t\tvar additionalPrinterColumns []apiextensionsv1.CustomResourceColumnDefinition\n\t\t\tcrd, err := sp.crdClient.CustomResourceDefinitions().Get(context, crdName, metav1.GetOptions{})\n\t\t\tif err == nil {\n\t\t\t\tif apihelpers.IsCRDConditionTrue(crd, apiextensionsv1.NonStructuralSchema) {\n\t\t\t\t\tklog.Warningf(\"non-structural schema for resource %s (%s): the resources will not be validated\", apiResource.Name, gvk.String())\n\t\t\t\t\tschemaProps = apiextensionsv1.JSONSchemaProps{\n\t\t\t\t\t\tType: \"object\",\n\t\t\t\t\t\tXPreserveUnknownFields: boolPtr(true),\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tvar versionFound bool\n\t\t\t\t\tfor _, version := range crd.Spec.Versions {\n\t\t\t\t\t\tif version.Name == gv.Version {\n\t\t\t\t\t\t\tschemaProps = *version.Schema.OpenAPIV3Schema\n\t\t\t\t\t\t\tadditionalPrinterColumns = version.AdditionalPrinterColumns\n\t\t\t\t\t\t\tversionFound = 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\tif !versionFound {\n\t\t\t\t\t\tklog.Errorf(\"expected version not found in CRD %s: %s\", crdName, gv.Version)\n\t\t\t\t\t\tschemaProps = apiextensionsv1.JSONSchemaProps{\n\t\t\t\t\t\t\tType: \"object\",\n\t\t\t\t\t\t\tXPreserveUnknownFields: boolPtr(true),\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif !errors.IsNotFound(err) {\n\t\t\t\t\tklog.Errorf(\"error looking up CRD for %s: %v\", crdName, err)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tprotoSchema := sp.models[gvk]\n\t\t\t\tif protoSchema == nil {\n\t\t\t\t\tklog.Infof(\"ignoring a resource that has no OpenAPI Schema: %s (%s)\", apiResource.Name, gvk.String())\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tswaggerSpecDefinitionName := protoSchema.GetPath().String()\n\n\t\t\t\tvar errors []error\n\t\t\t\tconverter := &SchemaConverter{\n\t\t\t\t\tschemaProps: &schemaProps,\n\t\t\t\t\tschemaName: swaggerSpecDefinitionName,\n\t\t\t\t\tvisited: sets.NewString(),\n\t\t\t\t\terrors: &errors,\n\t\t\t\t}\n\t\t\t\tprotoSchema.Accept(converter)\n\t\t\t\tif len(*converter.errors) > 0 {\n\t\t\t\t\tklog.Errorf(\"error during the OpenAPI schema import of resource %s (%s) : %v\", apiResource.Name, gvk.String(), *converter.errors)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\thasSubResource := func(subResource string) bool {\n\t\t\t\tgroupResourceNames := apiResourceNames[gv]\n\t\t\t\tif groupResourceNames != nil {\n\t\t\t\t\treturn groupResourceNames.Has(apiResource.Name + \"/\" + subResource)\n\t\t\t\t}\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tstatusSubResource := &apiextensionsv1.CustomResourceSubresourceStatus{}\n\t\t\tif !hasSubResource(\"status\") {\n\t\t\t\tstatusSubResource = nil\n\t\t\t}\n\n\t\t\tscaleSubResource := &apiextensionsv1.CustomResourceSubresourceScale{\n\t\t\t\tSpecReplicasPath: \".spec.replicas\",\n\t\t\t\tStatusReplicasPath: \".status.replicas\",\n\t\t\t}\n\t\t\tif !hasSubResource(\"scale\") {\n\t\t\t\tscaleSubResource = nil\n\t\t\t}\n\n\t\t\tcrd = &apiextensionsv1.CustomResourceDefinition{\n\t\t\t\tTypeMeta: metav1.TypeMeta{\n\t\t\t\t\tKind: \"CustomResourceDefinition\",\n\t\t\t\t\tAPIVersion: \"apiextensions.k8s.io/v1\",\n\t\t\t\t},\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: crdName,\n\t\t\t\t\tLabels: map[string]string{},\n\t\t\t\t\tAnnotations: map[string]string{},\n\t\t\t\t},\n\t\t\t\tSpec: apiextensionsv1.CustomResourceDefinitionSpec{\n\t\t\t\t\tGroup: gv.Group,\n\t\t\t\t\tVersions: []apiextensionsv1.CustomResourceDefinitionVersion{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: gv.Version,\n\t\t\t\t\t\t\tSchema: &apiextensionsv1.CustomResourceValidation{\n\t\t\t\t\t\t\t\tOpenAPIV3Schema: &schemaProps,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tSubresources: &apiextensionsv1.CustomResourceSubresources{\n\t\t\t\t\t\t\t\tStatus: statusSubResource,\n\t\t\t\t\t\t\t\tScale: scaleSubResource,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tServed: true,\n\t\t\t\t\t\t\tStorage: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tScope: resourceScope,\n\t\t\t\t\tNames: apiextensionsv1.CustomResourceDefinitionNames{\n\t\t\t\t\t\tPlural: apiResource.Name,\n\t\t\t\t\t\tKind: apiResource.Kind,\n\t\t\t\t\t\tCategories: apiResource.Categories,\n\t\t\t\t\t\tShortNames: apiResource.ShortNames,\n\t\t\t\t\t\tSingular: apiResource.SingularName,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\t\t\tif len(additionalPrinterColumns) != 0 {\n\t\t\t\tcrd.Spec.Versions[0].AdditionalPrinterColumns = additionalPrinterColumns\n\t\t\t}\n\t\t\tapiextensionsv1.SetDefaults_CustomResourceDefinition(crd)\n\n\t\t\t// In Kubernetes, to make it clear to the API consumer that APIs in *.k8s.io or *.kubernetes.io domains\n\t\t\t// should be following all quality standards of core Kubernetes, CRDs under these domains\n\t\t\t// are expected to go through the API Review process and so must link the API review approval PR\n\t\t\t// in an `api-approved.kubernetes.io` annotation.\n\t\t\t// Without this annotation, a CRD under the *.k8s.io or *.kubernetes.io domains is rejected by the API server\n\t\t\t//\n\t\t\t// Of course here we're simply adding already-known resources of existing physical clusters as CRDs in KCP.\n\t\t\t// But to please this Kubernetes approval requirement, let's add the required annotation in imported CRDs\n\t\t\t// with one of the KCP PRs that hacked Kubernetes CRD support for KCP.\n\t\t\tif apihelpers.IsProtectedCommunityGroup(gv.Group) {\n\t\t\t\tcrd.ObjectMeta.Annotations[\"api-approved.kubernetes.io\"] = \"https://github.com/kcp-dev/kubernetes/pull/4\"\n\t\t\t}\n\t\t\tcrds[groupResource] = crd\n\t\t}\n\t}\n\treturn crds, nil\n}", "func (r *ResourceHandler) UpdateStageResources(project string, stage string, resources []*models.Resource) (string, error) {\n\tr.ensureHandlerIsSet()\n\treturn r.resourceHandler.UpdateResourcesByURI(context.TODO(), r.Scheme+\"://\"+r.BaseURL+v1ProjectPath+\"/\"+project+pathToStage+\"/\"+stage+pathToResource, resources)\n}", "func DestroyResources(resources []DestroyableResource, dryRun bool, parallel int) int {\n\tnumOfResourcesToDelete := len(resources)\n\tnumOfDeletedResources := 0\n\n\tvar retryableResourceErrors []RetryDestroyError\n\n\tjobQueue := make(chan DestroyableResource, numOfResourcesToDelete)\n\n\tworkerResults := make(chan workerResult, numOfResourcesToDelete)\n\n\tfor workerID := 1; workerID <= parallel; workerID++ {\n\t\tgo worker(workerID, dryRun, jobQueue, workerResults)\n\t}\n\n\tlog.Debug(\"start distributing resources to workers for this run\")\n\n\tfor _, r := range resources {\n\t\tjobQueue <- r\n\t}\n\n\tclose(jobQueue)\n\n\tfor i := 1; i <= numOfResourcesToDelete; i++ {\n\t\tresult := <-workerResults\n\n\t\tif result.resourceHasBeenDeleted {\n\t\t\tnumOfDeletedResources++\n\n\t\t\tcontinue\n\t\t}\n\n\t\tif result.Err != nil {\n\t\t\tretryableResourceErrors = append(retryableResourceErrors, *result.Err)\n\t\t}\n\t}\n\n\tif len(retryableResourceErrors) > 0 && numOfDeletedResources > 0 {\n\t\tvar resourcesToRetry []DestroyableResource\n\t\tfor _, retryErr := range retryableResourceErrors {\n\t\t\tresourcesToRetry = append(resourcesToRetry, retryErr.Resource)\n\t\t}\n\n\t\tnumOfDeletedResources += DestroyResources(resourcesToRetry, dryRun, parallel)\n\t}\n\n\tif len(retryableResourceErrors) > 0 && numOfDeletedResources == 0 {\n\t\tinternal.LogTitle(fmt.Sprintf(\"failed to delete the following resources (retries exceeded): %d\",\n\t\t\tlen(retryableResourceErrors)))\n\n\t\tfor _, err := range retryableResourceErrors {\n\t\t\tlog.WithError(err).WithField(\"id\", err.Resource.ID()).Warn(internal.Pad(err.Resource.Type()))\n\t\t}\n\t}\n\n\treturn numOfDeletedResources\n}", "func (s *Synchronizer) checkDuplicated(ctx context.Context) error {\n\toldFacts := s.option.Cache.FactsByKey()\n\n\tif err := s.factsUpdateList(ctx); err != nil {\n\t\treturn fmt.Errorf(\"update facts list: %w\", err)\n\t}\n\n\tnewFacts := s.option.Cache.FactsByKey()\n\n\tisDuplicated, message := isDuplicatedUsingFacts(s.startedAt, oldFacts[s.agentID], newFacts[s.agentID])\n\n\tif !isDuplicated {\n\t\treturn nil\n\t}\n\n\tlogger.Printf(message)\n\tlogger.Printf(\n\t\t\"The following links may be relevant to solve the issue: https://go.bleemeo.com/l/doc-duplicated-agent\",\n\t)\n\n\tuntil := s.now().Add(delay.JitterDelay(15*time.Minute, 0.05))\n\ts.Disable(until, bleemeoTypes.DisableDuplicatedAgent)\n\n\tif s.option.DisableCallback != nil {\n\t\ts.option.DisableCallback(bleemeoTypes.DisableDuplicatedAgent, until)\n\t}\n\n\t// The agent is duplicated, update the last duplication date on the API.\n\tparams := map[string]string{\n\t\t\"fields\": \"last_duplication_date\",\n\t}\n\n\tdata := map[string]time.Time{\n\t\t\"last_duplication_date\": time.Now(),\n\t}\n\n\t_, err := s.client.Do(s.ctx, \"PATCH\", fmt.Sprintf(\"v1/agent/%s/\", s.agentID), params, data, nil)\n\tif err != nil {\n\t\tlogger.V(1).Printf(\"Failed to update duplication date: %s\", err)\n\t}\n\n\treturn errConnectorTemporaryDisabled\n}", "func (g *Group) RemoveFiles(dst string) error {\n\tif dst == \"\" {\n\t\treturn fmt.Errorf(\"Empty destination string\")\n\t}\n\tvar assets []string\n\tpattern := path.Join(dst, ASSETS, SCRIPTS, g.name+\"-*.min.js\")\n\tfiles, err := filepath.Glob(pattern)\n\tif err != nil {\n\t\treturn err\n\t}\n\tassets = append(assets, files...)\n\tpattern = path.Join(dst, ASSETS, STYLES, g.name+\"-*.min.css\")\n\tfiles, err = filepath.Glob(pattern)\n\tif err != nil {\n\t\treturn err\n\t}\n\tassets = append(assets, files...)\n\tfor _, a := range assets {\n\t\terr = os.Remove(a)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func isSafeDeleteTemplate(st *defs, use attrVal, hgrpDeleted attrVal, hostname string) bool {\n for _, v := range use {\n if (*st)[v].attrExist(\"host_name\") {\n // check if host_name contain any values other than hostname, if so, dont delete\n if !(*st)[v][\"host_name\"].HasOnly(hostname){\n return false\n }\n }\n if (*st)[v].attrExist(\"hostgroup_name\") {\n // check if hostgroup_name contain any values other than the deleted hostgroups, if so, dont delete\n if !hgrpDeleted.HasAll(*(*st)[v][\"hostgroup_name\"]...) {\n return false\n }\n }\n if (*st)[v].attrExist(\"use\") {\n isSafeDeleteTemplate(st, *(*st)[v][\"use\"], hgrpDeleted, hostname)\n }\n }\n return true\n}", "func ConcatTiles(tileset1, tileset2 *Tileset, metasprite2 *Metasprite, delMirror, delFlip bool) {\n\tif metasprite2 != nil {\n\t\tlen := byte(tileset1.Size())\n\t\tfor _, spr := range metasprite2.sprites {\n\t\t\tspr.Idx += len\n\t\t}\n\t}\n\n\ttileset1.tiles = append(tileset1.tiles, tileset2.tiles...)\n\n\tif tileset1.tiledim == Tile8x16 {\n\t\tremoveDuplicated8x16Tiles(tileset1, metasprite2, delMirror, delFlip)\n\t} else {\n\t\tremoveDuplicated8x8Tiles(tileset1, metasprite2, delMirror, delFlip)\n\t}\n}", "func (p *DockerPod) UpdateResources(id string, resource *schedTypes.TaskResources) error {\n\tvar exist bool\n\tvar conTask *container.BcsContainerTask\n\n\tfor _, con := range p.conTasks {\n\t\tif con.RuntimeConf.ID == id {\n\t\t\texist = true\n\t\t\tconTask = con\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif !exist {\n\t\treturn fmt.Errorf(\"container id %s is invalid\", id)\n\t}\n\n\terr := p.conClient.UpdateResources(id, resource)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconTask.RuntimeConf.Resource.Cpus = *resource.ReqCpu\n\tconTask.RuntimeConf.Resource.Mem = *resource.ReqMem\n\treturn nil\n}", "func prepareCopyURLs(sourceURLs []string, targetURL string, isRecursive bool, encKeyDB map[string][]prefixSSEPair, olderThan, newerThan string) chan URLs {\n\tcopyURLsCh := make(chan URLs)\n\tgo func(sourceURLs []string, targetURL string, copyURLsCh chan URLs, encKeyDB map[string][]prefixSSEPair) {\n\t\tdefer close(copyURLsCh)\n\t\tcpType, err := guessCopyURLType(sourceURLs, targetURL, isRecursive, encKeyDB)\n\t\tfatalIf(err.Trace(), \"Unable to guess the type of copy operation.\")\n\n\t\tswitch cpType {\n\t\tcase copyURLsTypeA:\n\t\t\tcopyURLsCh <- prepareCopyURLsTypeA(sourceURLs[0], targetURL, encKeyDB)\n\t\tcase copyURLsTypeB:\n\t\t\tcopyURLsCh <- prepareCopyURLsTypeB(sourceURLs[0], targetURL, encKeyDB)\n\t\tcase copyURLsTypeC:\n\t\t\tfor cURLs := range prepareCopyURLsTypeC(sourceURLs[0], targetURL, isRecursive, encKeyDB) {\n\t\t\t\tcopyURLsCh <- cURLs\n\t\t\t}\n\t\tcase copyURLsTypeD:\n\t\t\tfor cURLs := range prepareCopyURLsTypeD(sourceURLs, targetURL, isRecursive, encKeyDB) {\n\t\t\t\tcopyURLsCh <- cURLs\n\t\t\t}\n\t\tdefault:\n\t\t\tcopyURLsCh <- URLs{Error: errInvalidArgument().Trace(sourceURLs...)}\n\t\t}\n\t}(sourceURLs, targetURL, copyURLsCh, encKeyDB)\n\n\tfinalCopyURLsCh := make(chan URLs)\n\tgo func() {\n\t\tdefer close(finalCopyURLsCh)\n\t\tfor cpURLs := range copyURLsCh {\n\t\t\t// Skip objects older than --older-than parameter if specified\n\t\t\tif olderThan != \"\" && isOlder(cpURLs.SourceContent.Time, olderThan) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Skip objects newer than --newer-than parameter if specified\n\t\t\tif newerThan != \"\" && isNewer(cpURLs.SourceContent.Time, newerThan) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfinalCopyURLsCh <- cpURLs\n\t\t}\n\t}()\n\n\treturn finalCopyURLsCh\n}", "func (e WorkloadGenerator) GenerateDeltas(\n\tproxy *model.Proxy,\n\treq *model.PushRequest,\n\tw *model.WatchedResource,\n) (model.Resources, model.DeletedResources, model.XdsLogDetails, bool, error) {\n\tupdatedAddresses := model.ConfigNameOfKind(req.ConfigsUpdated, kind.Address)\n\tisReq := req.IsRequest()\n\tif len(updatedAddresses) == 0 && len(req.ConfigsUpdated) > 0 {\n\t\t// Nothing changed..\n\t\treturn nil, nil, model.XdsLogDetails{}, false, nil\n\t}\n\tsubs := sets.New(w.ResourceNames...)\n\n\taddresses := updatedAddresses\n\tif !w.Wildcard {\n\t\t// If it;s not a wildcard, filter out resources we are not subscribed to\n\t\taddresses = updatedAddresses.Intersection(subs)\n\t}\n\t// Specific requested resource: always include\n\taddresses = addresses.Merge(req.Delta.Subscribed)\n\n\tif !w.Wildcard {\n\t\t// We only need this for on-demand. This allows us to subscribe the client to resources they\n\t\t// didn't explicitly request.\n\t\t// For wildcard, they subscribe to everything already.\n\t\tadditional := e.s.Env.ServiceDiscovery.AdditionalPodSubscriptions(proxy, addresses, subs)\n\t\taddresses.Merge(additional)\n\t}\n\n\t// TODO: it is needlessly wasteful to do a full sync just because the rest of Istio thought it was \"full\"\n\t// The only things that can really trigger a \"full\" push here is trust domain or network changing, which is extremely rare\n\t// We do a full push for wildcard requests (initial proxy sync) or for full pushes with no ConfigsUpdates (since we don't know what changed)\n\tfull := (isReq && w.Wildcard) || (!isReq && req.Full && len(req.ConfigsUpdated) == 0)\n\n\t// Nothing to do\n\tif len(addresses) == 0 && !full {\n\t\tif isReq {\n\t\t\t// We need to respond for requests, even if we have nothing to respond with\n\t\t\treturn make(model.Resources, 0), nil, model.XdsLogDetails{}, false, nil\n\t\t}\n\t\t// For NOP pushes, no need\n\t\treturn nil, nil, model.XdsLogDetails{}, false, nil\n\t}\n\n\tresources := make(model.Resources, 0)\n\taddrs, removed := e.s.Env.ServiceDiscovery.AddressInformation(addresses)\n\t// Note: while \"removed\" is a weird name for a resource that never existed, this is how the spec works:\n\t// https://www.envoyproxy.io/docs/envoy/latest/api-docs/xds_protocol#id2\n\n\thave := sets.New[string]()\n\tfor _, addr := range addrs {\n\t\taliases := addr.Aliases()\n\t\tn := addr.ResourceName()\n\t\thave.Insert(n)\n\t\tswitch w.TypeUrl {\n\t\tcase v3.WorkloadType:\n\t\t\tif addr.GetWorkload() != nil {\n\t\t\t\tresources = append(resources, &discovery.Resource{\n\t\t\t\t\tName: n,\n\t\t\t\t\tAliases: aliases,\n\t\t\t\t\tResource: protoconv.MessageToAny(addr.GetWorkload()), // TODO: pre-marshal\n\t\t\t\t})\n\t\t\t}\n\t\tcase v3.ServiceType:\n\t\t\tif addr.GetService() != nil {\n\t\t\t\tresources = append(resources, &discovery.Resource{\n\t\t\t\t\tName: n,\n\t\t\t\t\tAliases: aliases,\n\t\t\t\t\tResource: protoconv.MessageToAny(addr.GetService()), // TODO: pre-marshal\n\t\t\t\t})\n\t\t\t}\n\t\tcase v3.AddressType:\n\t\t\tresources = append(resources, &discovery.Resource{\n\t\t\t\tName: n,\n\t\t\t\tAliases: aliases,\n\t\t\t\tResource: protoconv.MessageToAny(addr), // TODO: pre-marshal\n\t\t\t})\n\t\t}\n\t}\n\n\tif !w.Wildcard {\n\t\t// For on-demand, we may have requested a VIP but gotten Pod IPs back. We need to update\n\t\t// the internal book-keeping to subscribe to the Pods, so that we push updates to those Pods.\n\t\tw.ResourceNames = sets.SortedList(sets.New(w.ResourceNames...).Merge(have))\n\t}\n\tif full {\n\t\t// If it's a full push, AddressInformation won't have info to compute the full set of removals.\n\t\t// Instead, we need can see what resources are missing that we were subscribe to; those were removed.\n\t\tremoves := subs.Difference(have).InsertAll(removed...)\n\t\tremoved = sets.SortedList(removes)\n\t}\n\treturn resources, removed, model.XdsLogDetails{}, true, nil\n}", "func (cp *statusConnectionPool) resurrect(c *Connection, removeDead bool) error {\n\tif debugLogger != nil {\n\t\tdebugLogger.Logf(\"Resurrecting %s\\n\", c.URL)\n\t}\n\n\tc.markAsLive()\n\tcp.live = append(cp.live, c)\n\n\tif removeDead {\n\t\tindex := -1\n\t\tfor i, conn := range cp.dead {\n\t\t\tif conn == c {\n\t\t\t\tindex = i\n\t\t\t}\n\t\t}\n\t\tif index >= 0 {\n\t\t\t// Remove item; https://github.com/golang/go/wiki/SliceTricks\n\t\t\tcopy(cp.dead[index:], cp.dead[index+1:])\n\t\t\tcp.dead = cp.dead[:len(cp.dead)-1]\n\t\t}\n\t}\n\n\treturn nil\n}", "func genericCleanupResource(\n\tresourceName string,\n\tlistFunc func() ([]interface{}, error),\n\ttoStrFunc func(interface{}) string,\n\tdeleteFunc func(interface{}) (int, error)) {\n\n\tfmt.Printf(\"Getting %s list ...\\n\", resourceName)\n\tall, err := listFunc()\n\tif err != nil {\n\t\tfmt.Printf(\"Failed getting %s list: %s\\n\", resourceName, err.Error())\n\t}\n\n\tfmt.Printf(\"Found %d %ss created by tests\\n\", len(all), resourceName)\n\tif len(all) == 0 {\n\t\treturn\n\t}\n\tfor _, res := range all {\n\t\tfmt.Println(toStrFunc(res))\n\t}\n\n\tdelete := deleteListPrompt()\n\tif delete == deleteNone {\n\t\tfmt.Printf(\"Not deleting any %ss\\n\", resourceName)\n\t} else {\n\t\tdeleted := 0\n\t\tfor _, d := range all {\n\t\t\tdeleteOne := deleteYes\n\t\t\tif delete == deleteOneByOne {\n\t\t\t\tdeleteOne = deleteOnePrompt(fmt.Sprintf(\"%s %s\", resourceName, toStrFunc(d)))\n\t\t\t}\n\t\t\tif deleteOne == deleteYes {\n\t\t\t\tfmt.Printf(\"Deleting %s %s ... \", resourceName, toStrFunc(d))\n\t\t\t\tstatusCode, err := deleteFunc(d)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Printf(\"failed: %s\\n\", err.Error())\n\t\t\t\t} else {\n\t\t\t\t\tdeleted++\n\t\t\t\t\tfmt.Printf(\"success (code %d)\\n\", statusCode)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfmt.Printf(\"Successfully deleted %d %ss\\n\", deleted, resourceName)\n\t}\n}", "func maybeRecreate(ctx context.Context, live, obj runtime.Object, m *kubePackage, r *apiResource) error {\n\terr := mergeObjects(live, obj)\n\tif errors.Is(errors.Unwrap(err), ErrUpdateImmutable) && m.force {\n\t\tif m.dryRun {\n\t\t\tfmt.Fprintf(os.Stdout, \"\\n\\n**WARNING** %s %s is immutable and will be deleted and recreated.\\n\", strings.ToLower(r.GVK.Kind), maybeNamespaced(r.Name, r.Namespace))\n\t\t}\n\t\t// kubeDelete() already properly handles a dry run, so the resource won't be deleted if -force is set, but in dry run mode\n\t\tif err := m.kubeDelete(ctx, r, true); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else if err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *BranchedResourceCache) UpdateBranchedResources(updated, deleted map[string][]NamedProtoMessage) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\t// update ResourceCache with new or updated resources\n\tfor branch, resources := range updated {\n\t\tc.renewResourceCache(branch)\n\t\tif _, ok := c.cache[branch]; !ok {\n\t\t\tinitResources := append(c.staticResources, c.dynamicResources...)\n\t\t\tc.cache[branch] = NewResourceCache(c.typeURL, initResources)\n\t\t}\n\t\tc.cache[branch].UpdateResources(resources)\n\t}\n\n\t// 2. delete resources from ResourceCache\n\tfor branch, resources := range deleted {\n\t\tif _, ok := c.cache[branch]; !ok {\n\t\t\tcontinue\n\t\t}\n\t\tc.cache[branch].DeleteResources(resources)\n\t}\n}", "func mergeResources(mtaObj MTA, mtaExtResources []*ResourceExt) error {\n\tfor _, extResource := range mtaExtResources {\n\t\tif resource := mtaObj.GetResourceByName(extResource.Name); resource != nil {\n\t\t\terr := chain().\n\t\t\t\textendBoolPtr(&resource.Active, &extResource.Active, mergeResourceActiveErrorMsg, resource.Name).\n\t\t\t\textendMap(&resource.Properties, resource.PropertiesMetaData, extResource.Properties, mergeResourcePropertiesErrorMsg, resource.Name).\n\t\t\t\textendMap(&resource.Parameters, resource.ParametersMetaData, extResource.Parameters, mergeResourceParametersErrorMsg, resource.Name).\n\t\t\t\terr\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err = mergeRequires(extResource.Requires, resource,\n\t\t\t\tmsg{unknownResourceRequiresErrorMsg, []interface{}{extResource.Name}},\n\t\t\t\tmsg{mergeResourceRequiresPropertiesErrorMsg, []interface{}{resource.Name}},\n\t\t\t\tmsg{mergeResourceRequiresParametersErrorMsg, []interface{}{resource.Name}}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\treturn errors.Errorf(unknownResourceErrorMsg, extResource.Name)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (e *Eval) reviseResources(ctx context.Context, tasks []*sched.Task, flows []*Flow) {\n\tpredictions := make(map[*sched.Task]predictor.Prediction)\n\tif e.Predictor != nil {\n\t\t// Compute predictions if applicable\n\t\tpredictions = e.Predictor.Predict(ctx, tasks...)\n\t}\n\tfor i, task := range tasks {\n\t\tif predicted, ok := predictions[task]; ok {\n\t\t\t// Set predicted resources for each task (and flow).\n\t\t\toldResources := task.Config.Resources.String()\n\t\t\tf := flows[i]\n\t\t\tnewReserved := make(reflow.Resources)\n\t\t\tnewReserved.Set(f.Reserved)\n\t\t\tfor k, v := range predicted.Resources {\n\t\t\t\tnewReserved[k] = v\n\t\t\t}\n\t\t\tnewReserved[\"mem\"] = math.Max(newReserved[\"mem\"], minExecMemory)\n\t\t\te.Mutate(f, SetReserved(newReserved))\n\t\t\ttask.Config = f.ExecConfig()\n\t\t\te.Log.Debugf(\"(flow %s): modifying resources from %s to %s\", task.FlowID.Short(), oldResources, task.Config.Resources)\n\t\t\ttask.ExpectedDuration = predicted.Duration\n\t\t\te.Log.Debugf(\"(flow %s): predicted duration %s\", task.FlowID.Short(), predicted.Duration.Round(time.Second))\n\t\t}\n\n\t\t// Whether resources were modified by predictor or not, check if they need to be capped.\n\t\toldResources := task.Config.Resources\n\t\tcappedR, capped, err := e.capMemory(oldResources)\n\t\tswitch {\n\t\tcase err != nil:\n\t\t\te.Log.Errorf(\"(flow %s): reviseResources %s: %v\", task.FlowID.Short(), oldResources, err)\n\t\tcase capped:\n\t\t\tf := flows[i]\n\t\t\te.Mutate(f, SetReserved(cappedR))\n\t\t\ttask.Config = f.ExecConfig()\n\t\t\te.Log.Printf(\"(flow %s): capping resources from %s to %s (max available %s)\", task.FlowID.Short(), oldResources, task.Config.Resources, e.MaxResources)\n\t\t}\n\t}\n}", "func (b *Botanist) DeleteStaleContainerRuntimeResources(ctx context.Context) error {\n\twantedContainerRuntimeTypes := sets.NewString()\n\tfor _, worker := range b.Shoot.Info.Spec.Provider.Workers {\n\t\tif worker.CRI != nil {\n\t\t\tfor _, containerRuntime := range worker.CRI.ContainerRuntimes {\n\t\t\t\tkey := getContainerRuntimeKey(containerRuntime.Type, worker.Name)\n\t\t\t\twantedContainerRuntimeTypes.Insert(key)\n\t\t\t}\n\t\t}\n\t}\n\treturn b.deleteContainerRuntimeResources(ctx, wantedContainerRuntimeTypes)\n}", "func (client *Client) UntagResourcesWithOptions(request *UntagResourcesRequest, runtime *util.RuntimeOptions) (_result *UntagResourcesResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.All)) {\n\t\tquery[\"All\"] = request.All\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceId)) {\n\t\tquery[\"ResourceId\"] = request.ResourceId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceType)) {\n\t\tquery[\"ResourceType\"] = request.ResourceType\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.TagKey)) {\n\t\tquery[\"TagKey\"] = request.TagKey\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"UntagResources\"),\n\t\tVersion: tea.String(\"2020-03-31\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &UntagResourcesResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func collectCRDResources(discovery discovery.DiscoveryInterface) ([]*metav1.APIResourceList, error) {\n\tresources, err := discovery.ServerResources()\n\tcrdResources := []*metav1.APIResourceList{}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, res := range resources {\n\t\tgv, err := schema.ParseGroupVersion(res.GroupVersion)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tif gv.Group != \"apiextensions.k8s.io\" {\n\t\t\tcontinue\n\t\t}\n\t\temptyAPIResourceList := metav1.APIResourceList{\n\t\t\tGroupVersion: res.GroupVersion,\n\t\t}\n\t\temptyAPIResourceList.APIResources = findCRDGVRs(res.APIResources)\n\t\tcrdResources = append(crdResources, &emptyAPIResourceList)\n\t}\n\n\treturn crdResources, nil\n}", "func CopyStaticResources(dir string, copyFiles bool) error {\n\n\tstaticDir, err := staticBuildDir(dir)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfullPkgPath, err := absoluteStaticServerPath()\n\tif err != nil {\n\t\treturn errors.New(\"Couldn't get full package path: \" + err.Error())\n\t}\n\n\tworkingDirectory, err := os.Getwd()\n\n\tif err != nil {\n\t\treturn errors.New(\"Can't get working directory: \" + err.Error())\n\t}\n\n\tinfos, err := ioutil.ReadDir(fullPkgPath)\n\n\tif err != nil {\n\t\treturn errors.New(\"Couldn't list files in remote directory: \" + err.Error())\n\t}\n\n\tabsLocalDirPath := filepath.Join(workingDirectory, staticDir) + string(filepath.Separator)\n\n\tfor _, info := range infos {\n\n\t\tname := info.Name()\n\n\t\tif filesToExclude[name] {\n\t\t\tcontinue\n\t\t}\n\n\t\tlocalPath := filepath.Join(staticDir, name)\n\n\t\tabsRemotePath := filepath.Join(fullPkgPath, name)\n\t\trelRemotePath, err := path.RelativizePaths(absLocalDirPath, absRemotePath)\n\n\t\tif err != nil {\n\t\t\treturn errors.New(\"Couldn't relativize paths: \" + err.Error())\n\t\t}\n\n\t\trejoinedPath := filepath.Join(absLocalDirPath, relRemotePath)\n\n\t\tif _, err := os.Stat(rejoinedPath); os.IsNotExist(err) {\n\n\t\t\treturn errors.New(\"Unexpected error: relRemotePath of \" + relRemotePath + \" doesn't exist \" + absLocalDirPath + \" : \" + absRemotePath + \"(\" + rejoinedPath + \")\")\n\t\t}\n\n\t\tif _, err := os.Stat(localPath); err == nil {\n\t\t\t//Must already exist, so can skip\n\t\t\tcontinue\n\t\t}\n\n\t\tif copyFiles && !info.IsDir() {\n\t\t\tfmt.Println(\"Copying \" + localPath + \" to \" + relRemotePath)\n\t\t\tif err := copyFile(absRemotePath, localPath); err != nil {\n\t\t\t\treturn errors.New(\"Couldn't copy \" + name + \": \" + err.Error())\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Println(\"Linking \" + localPath + \" to \" + relRemotePath)\n\t\t\tif err := os.Symlink(relRemotePath, localPath); err != nil {\n\t\t\t\treturn errors.New(\"Couldn't link \" + name + \": \" + err.Error())\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func PushRegionResources(req *restful.Request, resp *restful.Response) {\n\tresourcesReq := new(types.RegionResourcesReq)\n\terr := req.ReadEntity(&resourcesReq)\n\tif err != nil {\n\t\tklog.Errorf(\"Failed to unmarshall region resources from request body, err: %s\", err)\n\t\tutils.WriteFailedJSONResponse(resp, http.StatusBadRequest, utils.RequestBodyParamInvalid(err.Error()))\n\t\treturn\n\t}\n\tklog.Infof(\"RegionResourceReq: %s\", utils.GetJSONString(resourcesReq))\n\tresources := resourcesReq.RegionResources\n\tsched := scheduler.GetScheduler()\n\tif sched == nil {\n\t\tklog.Errorf(\"Scheduler is not initialized, please wait...\")\n\t\tutils.WriteFailedJSONResponse(resp, http.StatusInternalServerError, utils.InternalServerError())\n\t\treturn\n\t}\n\tfor _, resource := range resources {\n\t\terr = sched.UpdateSiteDynamicResource(resource.RegionName, &types.SiteResource{CPUMemResources: resource.CPUMemResources, VolumeResources: resource.VolumeResources})\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"Schedule to update site dynamic resource for region %s with err %v\", resource.RegionName, err)\n\t\t\tutils.WriteFailedJSONResponse(resp, http.StatusInternalServerError, utils.InternalServerWithError(err.Error()))\n\t\t\treturn\n\t\t}\n\t}\n\tresourceResp := types.SiteResourceRes{Result: \"ok\"}\n\tresp.WriteHeaderAndEntity(http.StatusCreated, resourceResp)\n}", "func removeEscalatingResources(in rbacv1.PolicyRule) rbacv1.PolicyRule {\n\tvar ruleCopy *rbacv1.PolicyRule\n\n\tfor _, resource := range escalatingScopeResources {\n\t\tif !(has(in.APIGroups, resource.Group) && has(in.Resources, resource.Resource)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif ruleCopy == nil {\n\t\t\t// we're using a cache of cache of an object that uses pointers to data. I'm pretty sure we need to do a copy to avoid\n\t\t\t// muddying the cache\n\t\t\truleCopy = in.DeepCopy()\n\t\t}\n\n\t\truleCopy.Resources = remove(ruleCopy.Resources, resource.Resource)\n\t}\n\n\tif ruleCopy != nil {\n\t\treturn *ruleCopy\n\t}\n\n\treturn in\n}", "func removeEscalatingResources(in rbacv1.PolicyRule) rbacv1.PolicyRule {\n\tvar ruleCopy *rbacv1.PolicyRule\n\n\tfor _, resource := range escalatingScopeResources {\n\t\tif !(has(in.APIGroups, resource.Group) && has(in.Resources, resource.Resource)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif ruleCopy == nil {\n\t\t\t// we're using a cache of cache of an object that uses pointers to data. I'm pretty sure we need to do a copy to avoid\n\t\t\t// muddying the cache\n\t\t\truleCopy = in.DeepCopy()\n\t\t}\n\n\t\truleCopy.Resources = remove(ruleCopy.Resources, resource.Resource)\n\t}\n\n\tif ruleCopy != nil {\n\t\treturn *ruleCopy\n\t}\n\n\treturn in\n}", "func (na *Nagent) dedupReferences(compositeKey string) {\n\tlog.Infof(\"Lateral DB: %v pre dedup: %v\", compositeKey, na.LateralDB[compositeKey])\n\tif len(na.LateralDB[compositeKey]) < 2 {\n\t\treturn\n\t}\n\tmarker := 0\n\tfor idx := 1; idx < len(na.LateralDB[compositeKey]); idx++ {\n\t\tif na.LateralDB[compositeKey][marker] == na.LateralDB[compositeKey][idx] {\n\t\t\tcontinue\n\t\t}\n\t\tmarker++\n\t\tna.LateralDB[compositeKey][marker] = na.LateralDB[compositeKey][idx]\n\t}\n\tna.LateralDB[compositeKey] = na.LateralDB[compositeKey][:marker+1]\n}", "func (c *Controller) cleanupNegotiatedAPIResource(ctx context.Context, clusterName string, gvr metav1.GroupVersionResource, negotiatedApiResource *apiresourcev1alpha1.NegotiatedAPIResource) error {\n\t// In any case change the status on every APIResourceImport with the same GVR, to remove Compatible and Available conditions.\n\n\tobjs, err := c.apiResourceImportIndexer.ByIndex(clusterNameAndGVRIndexName, GetClusterNameAndGVRIndexKey(clusterName, gvr))\n\tif err != nil {\n\t\tklog.Errorf(\"Error in %s: %v\", runtime.GetCaller(), err)\n\t\treturn err\n\t}\n\tfor _, obj := range objs {\n\t\tapiResourceImport := obj.(*apiresourcev1alpha1.APIResourceImport).DeepCopy()\n\t\tapiResourceImport.RemoveCondition(apiresourcev1alpha1.Available)\n\t\tapiResourceImport.RemoveCondition(apiresourcev1alpha1.Compatible)\n\t\tif _, err := c.kcpClient.ApiresourceV1alpha1().APIResourceImports().UpdateStatus(ctx, apiResourceImport, metav1.UpdateOptions{}); err != nil {\n\t\t\tklog.Errorf(\"Error in %s: %v\", runtime.GetCaller(), err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// if a CRD with the same GR has a version == to the current NegotiatedAPIResource version *and* has the current object as owner:\n\t// => if this CRD version is the only one, then delete the CRD\n\t// else remove this CRD version from the CRD, as well as the corresponding owner\n\n\tcrdName := gvr.Resource\n\tif gvr.Group == \"\" {\n\t\tcrdName = crdName + \".core\"\n\t} else {\n\t\tcrdName = crdName + \".\" + gvr.Group\n\t}\n\n\tcrdKey, err := cache.MetaNamespaceKeyFunc(&metav1.PartialObjectMetadata{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: crdName,\n\t\t\tClusterName: clusterName,\n\t\t},\n\t})\n\tif err != nil {\n\t\tklog.Errorf(\"Error in %s: %v\", runtime.GetCaller(), err)\n\t\treturn err\n\t}\n\tcrd, err := c.crdLister.Get(crdKey)\n\tif k8serrors.IsNotFound(err) {\n\t\treturn nil\n\t}\n\tif err != nil {\n\t\tklog.Errorf(\"Error in %s: %v\", runtime.GetCaller(), err)\n\t\treturn err\n\t}\n\n\tvar ownerReferenceAlreadyExists bool\n\tvar cleanedOwnerReferences []metav1.OwnerReference\n\tfor _, ownerRef := range crd.OwnerReferences {\n\t\tif ownerRef.Name == negotiatedApiResource.Name && ownerRef.UID == negotiatedApiResource.UID {\n\t\t\townerReferenceAlreadyExists = true\n\t\t\tcontinue\n\t\t}\n\t\tcleanedOwnerReferences = append(cleanedOwnerReferences, ownerRef)\n\t}\n\tif !ownerReferenceAlreadyExists {\n\t\treturn nil\n\t}\n\n\tvar cleanedVersions []apiextensionsv1.CustomResourceDefinitionVersion\n\tfor _, version := range crd.Spec.Versions {\n\t\tif version.Name == gvr.Version {\n\t\t\tcontinue\n\t\t}\n\t\tcleanedVersions = append(cleanedVersions, version)\n\t}\n\tif len(cleanedVersions) == len(crd.Spec.Versions) {\n\t\treturn nil\n\t}\n\tif len(cleanedVersions) == 0 {\n\t\tif err := c.apiExtensionsClient.ApiextensionsV1().CustomResourceDefinitions().Delete(ctx, crd.Name, metav1.DeleteOptions{}); err != nil {\n\t\t\tklog.Errorf(\"Error in %s: %v\", runtime.GetCaller(), err)\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tcrd = crd.DeepCopy()\n\t\tcrd.Spec.Versions = cleanedVersions\n\t\tcrd.OwnerReferences = cleanedOwnerReferences\n\t\tif _, err := c.apiExtensionsClient.ApiextensionsV1().CustomResourceDefinitions().Update(ctx, crd, metav1.UpdateOptions{}); err != nil {\n\t\t\tklog.Errorf(\"Error in %s: %v\", runtime.GetCaller(), err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (b *Botanist) DeployContainerRuntimeResources(ctx context.Context) error {\n\tfns := []flow.TaskFn{}\n\tfor _, worker := range b.Shoot.Info.Spec.Provider.Workers {\n\t\tif worker.CRI != nil {\n\t\t\tfor _, containerRuntime := range worker.CRI.ContainerRuntimes {\n\t\t\t\tcr := containerRuntime\n\t\t\t\tworkerName := worker.Name\n\t\t\t\ttoApply := extensionsv1alpha1.ContainerRuntime{\n\t\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\t\tName: getContainerRuntimeKey(cr.Type, workerName),\n\t\t\t\t\t\tNamespace: b.Shoot.SeedNamespace,\n\t\t\t\t\t},\n\t\t\t\t}\n\n\t\t\t\tfns = append(fns, func(ctx context.Context) error {\n\t\t\t\t\t_, err := controllerutil.CreateOrUpdate(ctx, b.K8sSeedClient.Client(), &toApply, func() error {\n\t\t\t\t\t\tmetav1.SetMetaDataAnnotation(&toApply.ObjectMeta, v1beta1constants.GardenerOperation, v1beta1constants.GardenerOperationReconcile)\n\t\t\t\t\t\ttoApply.Spec.BinaryPath = extensionsv1alpha1.ContainerDRuntimeContainersBinFolder\n\t\t\t\t\t\ttoApply.Spec.Type = cr.Type\n\t\t\t\t\t\tif cr.ProviderConfig != nil {\n\t\t\t\t\t\t\ttoApply.Spec.ProviderConfig = &cr.ProviderConfig.RawExtension\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttoApply.Spec.WorkerPool.Name = workerName\n\t\t\t\t\t\ttoApply.Spec.WorkerPool.Selector.MatchLabels = map[string]string{gardencorev1beta1constants.LabelWorkerPool: workerName, gardencorev1beta1constants.LabelWorkerPoolDeprecated: workerName}\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t})\n\t\t\t\t\treturn err\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\treturn flow.Parallel(fns...)(ctx)\n}", "func match(manifests []model.Manifest, requestedManifests []model.ManifestName) ([]model.ManifestName, error) {\n\tif len(requestedManifests) == 0 {\n\t\tvar result []model.ManifestName\n\t\tfor _, m := range manifests {\n\t\t\tresult = append(result, m.Name)\n\t\t}\n\t\treturn result, nil\n\t}\n\n\tmanifestsByName := make(map[model.ManifestName]model.Manifest)\n\tfor _, m := range manifests {\n\t\tmanifestsByName[m.Name] = m\n\t}\n\n\tmanifestsToRun := make(map[model.ManifestName]bool)\n\tvar unknownNames []string\n\n\tfor _, m := range requestedManifests {\n\t\tif _, ok := manifestsByName[m]; !ok {\n\t\t\tunknownNames = append(unknownNames, string(m))\n\t\t\tcontinue\n\t\t}\n\n\t\taddManifestAndDeps(manifestsToRun, manifestsByName, m)\n\t}\n\n\tvar result []model.ManifestName\n\tfor _, m := range manifests {\n\t\t// Default to including UnresourcedYAML (\"Uncategorized\") to match historical behavior.\n\t\tif manifestsToRun[m.Name] || m.Name == model.UnresourcedYAMLManifestName {\n\t\t\tresult = append(result, m.Name)\n\t\t}\n\t}\n\n\tif len(unknownNames) > 0 {\n\t\tunmatchedNames := unmatchedManifestNames(manifests, requestedManifests)\n\n\t\treturn nil, fmt.Errorf(`You specified some resources that could not be found: %s\nIs this a typo? Existing resources in Tiltfile: %s`,\n\t\t\tsliceutils.QuotedStringList(unknownNames),\n\t\t\tsliceutils.QuotedStringList(unmatchedNames))\n\t}\n\n\treturn result, nil\n}", "func DelAllResources(nsId string, resourceType string, forceFlag string) error {\n\n\terr := common.CheckString(nsId)\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\treturn err\n\t}\n\n\tresourceIdList, err := ListResourceId(nsId, resourceType)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(resourceIdList) == 0 {\n\t\treturn nil\n\t}\n\n\tfor _, v := range resourceIdList {\n\t\terr := DelResource(nsId, resourceType, v, forceFlag)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (client *Client) UntagResourcesWithOptions(request *UntagResourcesRequest, runtime *util.RuntimeOptions) (_result *UntagResourcesResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.All)) {\n\t\tquery[\"All\"] = request.All\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerAccount)) {\n\t\tquery[\"OwnerAccount\"] = request.OwnerAccount\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerId)) {\n\t\tquery[\"OwnerId\"] = request.OwnerId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.RegionId)) {\n\t\tquery[\"RegionId\"] = request.RegionId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceId)) {\n\t\tquery[\"ResourceId\"] = request.ResourceId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceOwnerAccount)) {\n\t\tquery[\"ResourceOwnerAccount\"] = request.ResourceOwnerAccount\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceOwnerId)) {\n\t\tquery[\"ResourceOwnerId\"] = request.ResourceOwnerId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceType)) {\n\t\tquery[\"ResourceType\"] = request.ResourceType\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.TagKey)) {\n\t\tquery[\"TagKey\"] = request.TagKey\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"UntagResources\"),\n\t\tVersion: tea.String(\"2015-01-01\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &UntagResourcesResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func (p *DeliveryConfigProcessor) UpsertResource(resource *ExportableResource, envName string, content []byte) (added bool, err error) {\n\tdata, err := p.bytesToData(content)\n\tif err != nil {\n\t\treturn false, xerrors.Errorf(\"failed to parse content: %w\", err)\n\t}\n\tdeliveryResource := &DeliveryResource{}\n\terr = yaml.Unmarshal(content, &deliveryResource)\n\tif err != nil {\n\t\treturn false, xerrors.Errorf(\"unmarshal delivery resource: %w\", ErrorInvalidContent{Content: content, ParseError: err})\n\t}\n\n\tenvIx := p.findEnvIndex(envName)\n\tenvsNode := walky.GetKey(p.rawDeliveryConfig, \"environments\")\n\n\tif envsNode == nil || envIx < 0 {\n\t\t// new environment\n\t\tkeyNode, _ := walky.ToNode(\"environments\")\n\t\tif envsNode == nil {\n\t\t\tenvsNode = walky.NewSequenceNode()\n\t\t}\n\t\tnewEnvNode, err := walky.ToNode(map[string]interface{}{\n\t\t\t\"name\": envName,\n\t\t\t\"constraints\": p.constraintsProvider(envName, p.deliveryConfig),\n\t\t\t\"notifications\": p.notificationsProvider(envName, p.deliveryConfig),\n\t\t\t\"resources\": []interface{}{data},\n\t\t\t\"verifyWith\": p.verifyWithProvider(envName, p.deliveryConfig),\n\t\t\t\"postDeploy\": p.postDeployProvider(envName, p.deliveryConfig),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn false, xerrors.Errorf(\"convert to node: %w\", err)\n\t\t}\n\t\terr = walky.AppendNode(envsNode, newEnvNode)\n\t\tif err != nil {\n\t\t\treturn false, xerrors.Errorf(\"append node: %w\", err)\n\t\t}\n\t\terr = walky.AssignMapNode(p.rawDeliveryConfig, keyNode, envsNode)\n\t\tif err != nil {\n\t\t\treturn false, xerrors.Errorf(\"assign map node: %w\", err)\n\t\t}\n\t\t// update in memory struct in case we look for this environment again later\n\t\tp.deliveryConfig.Environments = append(p.deliveryConfig.Environments, &DeliveryEnvironment{\n\t\t\tName: envName,\n\t\t\tResources: []*DeliveryResource{deliveryResource},\n\t\t})\n\t\tadded = true\n\t} else if len(envsNode.Content) > envIx {\n\t\tenvNode := envsNode.Content[envIx]\n\t\tif !walky.HasKey(envNode, \"constraints\") {\n\t\t\tkeyNode, _ := walky.ToNode(\"constraints\")\n\t\t\tvalNode, err := walky.ToNode(p.constraintsProvider(envName, p.deliveryConfig))\n\t\t\tif err != nil {\n\t\t\t\treturn false, xerrors.Errorf(\"convert to node: %w\", err)\n\t\t\t}\n\t\t\terr = walky.AssignMapNode(envNode, keyNode, valNode)\n\t\t\tif err != nil {\n\t\t\t\treturn false, xerrors.Errorf(\"assign map node: %w\", err)\n\t\t\t}\n\t\t}\n\t\tif !walky.HasKey(envNode, \"notifications\") {\n\t\t\tkeyNode, _ := walky.ToNode(\"notifications\")\n\t\t\tvalNode, err := walky.ToNode(p.notificationsProvider(envName, p.deliveryConfig))\n\t\t\tif err != nil {\n\t\t\t\treturn false, xerrors.Errorf(\"convert to node: %w\", err)\n\t\t\t}\n\t\t\terr = walky.AssignMapNode(envNode, keyNode, valNode)\n\t\t\tif err != nil {\n\t\t\t\treturn false, xerrors.Errorf(\"assign map node: %w\", err)\n\t\t\t}\n\t\t}\n\t\tresourcesNode := walky.GetKey(envNode, \"resources\")\n\t\tif resourcesNode != nil {\n\t\t\tresourceIx := p.findResourceIndex(resource, envIx)\n\t\t\tdataNode, err := walky.ToNode(data)\n\t\t\tif err != nil {\n\t\t\t\treturn false, xerrors.Errorf(\"convert to node: %w\", err)\n\t\t\t}\n\t\t\tif resourceIx < 0 {\n\t\t\t\tp.deliveryConfig.Environments[envIx].Resources = append(p.deliveryConfig.Environments[envIx].Resources, deliveryResource)\n\t\t\t\twalky.AppendNode(resourcesNode, dataNode)\n\t\t\t\tadded = true\n\t\t\t} else {\n\t\t\t\tp.deliveryConfig.Environments[envIx].Resources[resourceIx] = deliveryResource\n\t\t\t\tresourcesNode.Content[resourceIx] = dataNode\n\t\t\t}\n\t\t}\n\t\tkeyNode, _ := walky.ToNode(\"verifyWith\")\n\t\tveryWithNode, err := walky.ToNode(p.verifyWithProvider(envName, p.deliveryConfig))\n\t\tif err != nil {\n\t\t\treturn false, xerrors.Errorf(\"convert to node: %w\", err)\n\t\t}\n\t\twalky.AssignMapNode(envNode, keyNode, veryWithNode) // overwrite previous config\n\n\t\tkeyNode, _ = walky.ToNode(\"postDeploy\")\n\t\tpostDeployNode, err := walky.ToNode(p.postDeployProvider(envName, p.deliveryConfig))\n\t\tif err != nil {\n\t\t\treturn false, xerrors.Errorf(\"convert to node: %w\", err)\n\t\t}\n\t\twalky.AssignMapNode(envNode, keyNode, postDeployNode) // overwrite previous config\n\t}\n\treturn added, nil\n}", "func ExcludeKubernetesResource(fs afero.Afero, basePath string, excludedResource string) ([]resid.ResId, error) {\n\tkustomization, err := getKustomization(fs, basePath)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"get kustomization for %s\", basePath)\n\t}\n\n\texcludedResource = strings.TrimPrefix(excludedResource, string(filepath.Separator))\n\n\tnewResources := []string{}\n\tvar excludedResourceBytes []byte\n\tfor _, existingResource := range kustomization.Resources {\n\t\tif existingResource != excludedResource {\n\t\t\tnewResources = append(newResources, existingResource)\n\t\t} else {\n\t\t\texcludedResourceBytes, err = fs.ReadFile(filepath.Join(basePath, excludedResource))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrapf(err, \"read to-be-excluded resource file\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(newResources) != len(kustomization.Resources) {\n\t\t// parse to-be-excluded resource file\n\n\t\texcludedResources, err := NewKubernetesResources(excludedResourceBytes)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"parse to-be-excluded resource file\")\n\t\t}\n\n\t\tkustomization.Resources = newResources\n\t\t// write updated kustomization to disk - resource has been removed\n\n\t\terr = writeKustomization(fs, basePath, kustomization)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"persist kustomization for %s\", basePath)\n\t\t}\n\t\treturn ResIDs(excludedResources), nil\n\t}\n\n\t// check if the resource is already removed from this dir\n\talreadyRemoved, err := fs.Exists(filepath.Join(basePath, excludedResource))\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"check if %s exists in %s\", excludedResource, basePath)\n\t}\n\tif alreadyRemoved {\n\t\t// the file to be removed exists within this base dir, and not within the kustomization yaml\n\t\texcludedResourceBytes, err = fs.ReadFile(filepath.Join(basePath, excludedResource))\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"read already-excluded resource file\")\n\t\t}\n\n\t\texcludedResources, err := NewKubernetesResources(excludedResourceBytes)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"parse already-excluded resource file\")\n\t\t}\n\n\t\treturn ResIDs(excludedResources), nil\n\t}\n\n\tfor _, newBase := range kustomization.Bases {\n\t\tnewBase = filepath.Clean(filepath.Join(basePath, newBase))\n\t\tcleanBase := strings.ReplaceAll(newBase, string(filepath.Separator), \"-\")\n\n\t\tif strings.HasPrefix(excludedResource, cleanBase) {\n\t\t\tupdatedResource := strings.TrimPrefix(excludedResource, cleanBase)\n\t\t\tupdatedResource = strings.TrimPrefix(updatedResource, string(filepath.Separator))\n\n\t\t\treturn ExcludeKubernetesResource(fs, newBase, updatedResource)\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"unable to find resource %s in %s or its bases\", excludedResource, basePath)\n}", "func (dc *DeploymentController) cleanupDeployment(ctx context.Context, oldRSs []*apps.ReplicaSet, deployment *apps.Deployment) error {\n\tlogger := klog.FromContext(ctx)\n\tif !deploymentutil.HasRevisionHistoryLimit(deployment) {\n\t\treturn nil\n\t}\n\n\t// Avoid deleting replica set with deletion timestamp set\n\taliveFilter := func(rs *apps.ReplicaSet) bool {\n\t\treturn rs != nil && rs.ObjectMeta.DeletionTimestamp == nil\n\t}\n\tcleanableRSes := controller.FilterReplicaSets(oldRSs, aliveFilter)\n\n\tdiff := int32(len(cleanableRSes)) - *deployment.Spec.RevisionHistoryLimit\n\tif diff <= 0 {\n\t\treturn nil\n\t}\n\n\tsort.Sort(deploymentutil.ReplicaSetsByRevision(cleanableRSes))\n\tlogger.V(4).Info(\"Looking to cleanup old replica sets for deployment\", \"deployment\", klog.KObj(deployment))\n\n\tfor i := int32(0); i < diff; i++ {\n\t\trs := cleanableRSes[i]\n\t\t// Avoid delete replica set with non-zero replica counts\n\t\tif rs.Status.Replicas != 0 || *(rs.Spec.Replicas) != 0 || rs.Generation > rs.Status.ObservedGeneration || rs.DeletionTimestamp != nil {\n\t\t\tcontinue\n\t\t}\n\t\tlogger.V(4).Info(\"Trying to cleanup replica set for deployment\", \"replicaSet\", klog.KObj(rs), \"deployment\", klog.KObj(deployment))\n\t\tif err := dc.client.AppsV1().ReplicaSets(rs.Namespace).Delete(ctx, rs.Name, metav1.DeleteOptions{}); err != nil && !errors.IsNotFound(err) {\n\t\t\t// Return error instead of aggregating and continuing DELETEs on the theory\n\t\t\t// that we may be overloading the api server.\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func normalizeAPIGroupResources(apiGroupResource *restmapper.APIGroupResources) []metav1.APIResource {\n\tvar versionedResources []metav1.APIResource\n\tfor version, vr := range apiGroupResource.VersionedResources {\n\t\tfor _, resource := range vr {\n\t\t\tresource.Group = apiGroupResource.Group.Name\n\t\t\tresource.Version = version\n\t\t\tversionedResources = append(versionedResources, resource)\n\t\t}\n\t}\n\n\t// Ensure deterministic output.\n\tpreferredVersion := apiGroupResource.Group.PreferredVersion.Version\n\tsort.SliceStable(versionedResources, func(i, j int) bool {\n\t\tif versionedResources[i].Version == versionedResources[j].Version {\n\t\t\treturn versionedResources[i].Name < versionedResources[j].Name\n\t\t}\n\n\t\t// preferred version\n\t\tif versionedResources[i].Version == preferredVersion {\n\t\t\treturn true\n\t\t}\n\t\tif versionedResources[j].Version == preferredVersion {\n\t\t\treturn false\n\t\t}\n\n\t\t// compare kube-like version\n\t\t// Versions will be sorted based on GA/alpha/beta first and then major and minor versions.\n\t\t// e.g. v2, v1, v1beta2, v1beta1, v1alpha1.\n\t\treturn version.CompareKubeAwareVersionStrings(versionedResources[i].Version, versionedResources[j].Version) > 0\n\t})\n\n\t// pick out preferred version or highest semantic version\n\tregistered := make(map[string]bool)\n\tvar normalizedVersionResources []metav1.APIResource\n\tfor _, vr := range versionedResources {\n\t\tif registered[vr.Name] {\n\t\t\tcontinue\n\t\t}\n\t\tnormalizedVersionResources = append(normalizedVersionResources, vr)\n\t\tregistered[vr.Name] = true\n\t}\n\treturn normalizedVersionResources\n}", "func GenRedeployPipelineYaml(runtimeID uint64) apistructs.PipelineYml {\n\tyml := apistructs.PipelineYml{\n\t\tVersion: \"1.1\",\n\t\tStages: [][]*apistructs.PipelineYmlAction{\n\t\t\t{{\n\t\t\t\tType: \"dice-deploy-redeploy\",\n\t\t\t\tAlias: \"dice-deploy-redeploy\",\n\t\t\t\tVersion: \"1.0\",\n\t\t\t\tParams: map[string]interface{}{\n\t\t\t\t\t\"runtime_id\": strconv.FormatUint(runtimeID, 10),\n\t\t\t\t},\n\t\t\t}},\n\t\t\t{{\n\t\t\t\tType: \"dice-deploy-addon\",\n\t\t\t\tVersion: \"1.0\",\n\t\t\t\tParams: map[string]interface{}{\n\t\t\t\t\t\"deployment_id\": \"${dice-deploy-redeploy:OUTPUT:deployment_id}\",\n\t\t\t\t},\n\t\t\t}},\n\t\t\t{{\n\t\t\t\tType: \"dice-deploy-service\",\n\t\t\t\tVersion: \"1.0\",\n\t\t\t\tParams: map[string]interface{}{\n\t\t\t\t\t\"deployment_id\": \"${dice-deploy-redeploy:OUTPUT:deployment_id}\",\n\t\t\t\t},\n\t\t\t}},\n\t\t\t{{\n\t\t\t\tType: \"dice-deploy-domain\",\n\t\t\t\tVersion: \"1.0\",\n\t\t\t\tParams: map[string]interface{}{\n\t\t\t\t\t\"deployment_id\": \"${dice-deploy-redeploy:OUTPUT:deployment_id}\",\n\t\t\t\t},\n\t\t\t}},\n\t\t},\n\t}\n\n\treturn yml\n}", "func mergePatchMatches(fs afero.Afero, basePath string, mergePatch string, excludedResource resid.ResId) (bool, error) {\n\t// read contents of resource and convert it to ResID form\n\tpatchBytes, err := fs.ReadFile(filepath.Join(basePath, string(mergePatch)))\n\tif err != nil {\n\t\treturn false, errors.Wrapf(err, \"read %s in %s to exclude patches for %s\", string(mergePatch), basePath, excludedResource.String())\n\t}\n\n\tpatchResources, err := NewKubernetesResources(patchBytes)\n\tif err != nil {\n\t\treturn false, errors.Wrapf(err, \"parse %s in %s to exclude patches for %s\", string(mergePatch), basePath, excludedResource.String())\n\t}\n\n\tpatchIDs := ResIDs(patchResources)\n\n\tfor _, patchID := range patchIDs {\n\t\tif patchID.GvknEquals(excludedResource) {\n\t\t\t// this file of patches touches the excluded resource, and should be discarded\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "func (s *server) veleroResourcesExist() error {\n\ts.logger.Info(\"Checking existence of Velero custom resource definitions\")\n\n\t// add more group versions whenever available\n\tgvResources := map[string]sets.String{\n\t\tvelerov1api.SchemeGroupVersion.String(): velerov1api.CustomResourceKinds(),\n\t\tvelerov2alpha1api.SchemeGroupVersion.String(): velerov2alpha1api.CustomResourceKinds(),\n\t}\n\n\tfor _, lst := range s.discoveryHelper.Resources() {\n\t\tif resources, found := gvResources[lst.GroupVersion]; found {\n\t\t\tfor _, resource := range lst.APIResources {\n\t\t\t\ts.logger.WithField(\"kind\", resource.Kind).Info(\"Found custom resource\")\n\t\t\t\tresources.Delete(resource.Kind)\n\t\t\t}\n\t\t}\n\t}\n\n\tvar errs []error\n\tfor gv, resources := range gvResources {\n\t\tfor kind := range resources {\n\t\t\terrs = append(errs, errors.Errorf(\"custom resource %s not found in Velero API group %s\", kind, gv))\n\t\t}\n\t}\n\n\tif len(errs) > 0 {\n\t\terrs = append(errs, errors.New(\"Velero custom resources not found - apply config/crd/v1/bases/*.yaml,config/crd/v2alpha1/bases*.yaml, to update the custom resource definitions\"))\n\t\treturn kubeerrs.NewAggregate(errs)\n\t}\n\n\ts.logger.Info(\"All Velero custom resource definitions exist\")\n\treturn nil\n}", "func (dst *Hosts) Merge(src Hosts) {\n\tif dst == nil || len(src) == 0 {\n\t\treturn\n\t}\n\n\tcopied := *dst\n\tcopied = append(copied, src...)\n\n\tregistry := map[string]int{}\n\tfor i := len(copied); i > 0; i-- {\n\t\tregistry[copied[i-1].Name] = i - 1\n\t}\n\tunique := copied[:0]\n\tfor i, host := range copied {\n\t\torigin := registry[host.Name]\n\t\tif i == origin {\n\t\t\tunique = append(unique, host)\n\t\t\tcontinue\n\t\t}\n\t\tunique[origin].Merge(host)\n\t}\n\n\t*dst = unique\n}", "func UnExcludeKubernetesResource(fs afero.Afero, basePath string, unExcludedResource string) error {\n\tkustomization, err := getKustomization(fs, basePath)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"get kustomization for %s\", basePath)\n\t}\n\n\tunExcludedResource = strings.TrimPrefix(unExcludedResource, string(filepath.Separator))\n\n\t// check if the resource is already included, if it is there is nothing left to do\n\tfor _, existingResource := range kustomization.Resources {\n\t\tif existingResource == unExcludedResource {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tresourceLength := len(kustomization.Resources)\n\n\terr = fs.Walk(basePath, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"walk %s\", path)\n\t\t}\n\t\trelPath, err := filepath.Rel(basePath, path)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"get relative path to %s from %s\", path, basePath)\n\t\t}\n\n\t\tif relPath == unExcludedResource {\n\t\t\tkustomization.Resources = append(kustomization.Resources, unExcludedResource)\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"walk files in %s\", basePath)\n\t}\n\n\tif resourceLength != len(kustomization.Resources) {\n\t\t// write updated kustomization to disk - resource has been reincluded\n\t\terr = writeKustomization(fs, basePath, kustomization)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"persist kustomization for %s\", basePath)\n\t\t}\n\t\treturn nil\n\t}\n\n\tfor _, newBase := range kustomization.Bases {\n\t\tnewBase = filepath.Clean(filepath.Join(basePath, newBase))\n\t\tcleanBase := strings.ReplaceAll(newBase, string(filepath.Separator), \"-\")\n\n\t\tif strings.HasPrefix(unExcludedResource, cleanBase) {\n\t\t\tupdatedResource := strings.TrimPrefix(unExcludedResource, cleanBase)\n\t\t\tupdatedResource = strings.TrimPrefix(updatedResource, string(filepath.Separator))\n\n\t\t\treturn UnExcludeKubernetesResource(fs, newBase, updatedResource)\n\t\t}\n\t}\n\n\treturn fmt.Errorf(\"unable to find resource %s in %s or its bases\", unExcludedResource, basePath)\n}", "func (r *TenantReconciler) pruningResources(ns string, keys []string, obj runtime.Object) error {\n\tcapsuleLabel, err := capsulev1alpha1.GetTypeLabel(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\texists, err := labels.NewRequirement(capsuleLabel, selection.Exists, []string{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tnotIn, err := labels.NewRequirement(capsuleLabel, selection.NotIn, keys)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.Log.Info(\"Pruning objects with label selector \" + notIn.String())\n\terr = retry.RetryOnConflict(retry.DefaultBackoff, func() error {\n\t\treturn r.DeleteAllOf(context.TODO(), obj, &client.DeleteAllOfOptions{\n\t\t\tListOptions: client.ListOptions{\n\t\t\t\tLabelSelector: labels.NewSelector().Add(*exists, *notIn),\n\t\t\t\tNamespace: ns,\n\t\t\t},\n\t\t\tDeleteOptions: client.DeleteOptions{},\n\t\t})\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func SortResources(resources []*metav1.APIResourceList) {\n\tsort.SliceStable(resources, func(i, j int) bool {\n\t\tleft := resources[i]\n\t\tleftGV, _ := schema.ParseGroupVersion(left.GroupVersion)\n\t\t// not checking error because it should be impossible to fail to parse data coming from the\n\t\t// apiserver\n\t\tif leftGV.Group == \"extensions\" {\n\t\t\t// always sort extensions at the bottom by saying left is \"greater\"\n\t\t\treturn false\n\t\t}\n\n\t\tright := resources[j]\n\t\trightGV, _ := schema.ParseGroupVersion(right.GroupVersion)\n\t\t// not checking error because it should be impossible to fail to parse data coming from the\n\t\t// apiserver\n\t\tif rightGV.Group == \"extensions\" {\n\t\t\t// always sort extensions at the bottom by saying left is \"less\"\n\t\t\treturn true\n\t\t}\n\n\t\treturn i < j\n\t})\n}", "func (r *deletedReconciler) deleteCreatedResources(ctx context.Context, name, namespace string) (err error) {\n\tlabelMap := map[string]string{\n\t\tOpsrcOwnerNameLabel: name,\n\t\tOpsrcOwnerNamespaceLabel: namespace,\n\t}\n\tlabelSelector := labels.SelectorFromSet(labelMap)\n\toptions := &client.ListOptions{LabelSelector: labelSelector}\n\n\t// Delete Catalog Source Configs\n\tcatalogSourceConfigs := &marketplace.CatalogSourceConfigList{}\n\terr = r.client.List(ctx, options, catalogSourceConfigs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, catalogSourceConfig := range catalogSourceConfigs.Items {\n\t\tr.logger.Infof(\"Removing catalogSourceConfig %s from namespace %s\", catalogSourceConfig.Name, catalogSourceConfig.Namespace)\n\t\terr = r.client.Delete(ctx, &catalogSourceConfig)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn\n}", "func TestRemoveDups(t *testing.T) {\n\tsuite.Run(t, new(RemoveDupsTestingSuite))\n}", "func testAccCheckTwingateResourceDestroy(s *terraform.State) error {\n\tclient := testAccProvider.Meta().(*Client)\n\n\tfor _, rs := range s.RootModule().Resources {\n\t\tif rs.Type != \"twingate_resource\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tresourceId := rs.Primary.ID\n\n\t\terr := client.deleteResource(resourceId)\n\t\t// expecting error here , since the resource is already gone\n\t\tif err == nil {\n\t\t\treturn fmt.Errorf(\"resource with ID %s still present : \", resourceId)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (r *Compare) CompareCRDs() (map[string][]schema.GroupVersionResource, error) {\n\tsrcCRDResource, err := collectPreferredCRDResource(r.SrcDiscovery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdstCRDResourceList, err := collectCRDResources(r.DstDiscovery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcrdGVDiff := r.compareResources(srcCRDResource, dstCRDResourceList)\n\t// if len(crdGVDiff)>0, then CRD APIVersion is incompatible between src and dest\n\tif len(crdGVDiff) > 0 {\n\t\tsrcCRDs, err := collectPreferredResources(r.SrcDiscovery)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsrcCRDs, err = r.includeCRDsOnly(srcCRDs, srcCRDResource, r.SrcClient)\n\n\t\tdstCRDs, err := collectNamespacedResources(r.DstDiscovery)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdstCRDs, err = r.includeCRDsOnly(dstCRDs, dstCRDResourceList, r.DstClient)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcrdsDiff := r.compareResources(srcCRDs, dstCRDs)\n\t\tincompatibleGVKs, err := convertToGVRList(crdsDiff)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Don't report an incompatibleGVK if user settings will skip resource anyways\n\t\texcludedResources := toStringSlice(settings.ExcludedInitialResources.Union(toSet(r.Plan.Status.ExcludedResources)))\n\t\tfilteredGVKs := []schema.GroupVersionResource{}\n\t\tfor _, gvr := range incompatibleGVKs {\n\t\t\tskip := false\n\t\t\tfor _, resource := range excludedResources {\n\t\t\t\tif strings.EqualFold(gvr.Resource, resource) {\n\t\t\t\t\tskip = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !skip {\n\t\t\t\tfilteredGVKs = append(filteredGVKs, gvr)\n\t\t\t}\n\t\t}\n\n\t\treturn r.collectIncompatibleMapping(filteredGVKs)\n\t}\n\treturn nil, nil\n}", "func (dn *Daemon) deleteStaleData(oldIgnConfig, newIgnConfig ign3types.Config) error {\n\tklog.Info(\"Deleting stale data\")\n\tnewFileSet := make(map[string]struct{})\n\tfor _, f := range newIgnConfig.Storage.Files {\n\t\tnewFileSet[f.Path] = struct{}{}\n\t}\n\n\t// need to skip these on upgrade if they are in a MC, or else we will remove all certs!\n\tcertsToSkip := []string{\n\t\tuserCABundleFilePath,\n\t\tcaBundleFilePath,\n\t\tcloudCABundleFilePath,\n\t}\n\tfor _, f := range oldIgnConfig.Storage.Files {\n\t\tif _, ok := newFileSet[f.Path]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tskipBecauseCert := false\n\t\tfor _, cert := range certsToSkip {\n\t\t\tif cert == f.Path {\n\t\t\t\tskipBecauseCert = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif strings.Contains(filepath.Dir(f.Path), imageCAFilePath) {\n\t\t\tskipBecauseCert = true\n\t\t}\n\t\tif skipBecauseCert {\n\t\t\tcontinue\n\t\t}\n\t\tif _, err := os.Stat(noOrigFileStampName(f.Path)); err == nil {\n\t\t\tif delErr := os.Remove(noOrigFileStampName(f.Path)); delErr != nil {\n\t\t\t\treturn fmt.Errorf(\"deleting noorig file stamp %q: %w\", noOrigFileStampName(f.Path), delErr)\n\t\t\t}\n\t\t\tklog.V(2).Infof(\"Removing file %q completely\", f.Path)\n\t\t} else if _, err := os.Stat(origFileName(f.Path)); err == nil {\n\t\t\t// Add a check for backwards compatibility: basically if the file doesn't exist in /usr/etc (on FCOS/RHCOS)\n\t\t\t// and no rpm is claiming it, we assume that the orig file came from a wrongful backup of a MachineConfig\n\t\t\t// file instead of a file originally on disk. See https://bugzilla.redhat.com/show_bug.cgi?id=1814397\n\t\t\tvar restore bool\n\t\t\tif _, err := exec.Command(\"rpm\", \"-qf\", f.Path).CombinedOutput(); err == nil {\n\t\t\t\t// File is owned by an rpm\n\t\t\t\trestore = true\n\t\t\t} else if strings.HasPrefix(f.Path, \"/etc\") && dn.os.IsCoreOSVariant() {\n\t\t\t\tif _, err := os.Stat(withUsrPath(f.Path)); err != nil {\n\t\t\t\t\tif !os.IsNotExist(err) {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\n\t\t\t\t\t// If the error is ErrNotExist then we don't restore the file\n\t\t\t\t} else {\n\t\t\t\t\trestore = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif restore {\n\t\t\t\tif err := restorePath(f.Path); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tklog.V(2).Infof(\"Restored file %q\", f.Path)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif delErr := os.Remove(origFileName(f.Path)); delErr != nil {\n\t\t\t\treturn fmt.Errorf(\"deleting orig file %q: %w\", origFileName(f.Path), delErr)\n\t\t\t}\n\t\t}\n\n\t\t// Check Systemd.Units.Dropins - don't remove the file if configuration has been converted into a dropin\n\t\tif dn.isPathInDropins(f.Path, &newIgnConfig.Systemd) {\n\t\t\tklog.Infof(\"Not removing file %q: replaced with systemd dropin\", f.Path)\n\t\t\tcontinue\n\t\t}\n\n\t\tklog.V(2).Infof(\"Deleting stale config file: %s\", f.Path)\n\t\tif err := os.Remove(f.Path); err != nil {\n\t\t\tnewErr := fmt.Errorf(\"unable to delete %s: %w\", f.Path, err)\n\t\t\tif !os.IsNotExist(err) {\n\t\t\t\treturn newErr\n\t\t\t}\n\t\t\t// otherwise, just warn\n\t\t\tklog.Warningf(\"%v\", newErr)\n\t\t}\n\t\tklog.Infof(\"Removed stale file %q\", f.Path)\n\t}\n\n\tnewUnitSet := make(map[string]struct{})\n\tnewDropinSet := make(map[string]struct{})\n\tfor _, u := range newIgnConfig.Systemd.Units {\n\t\tfor j := range u.Dropins {\n\t\t\tpath := filepath.Join(pathSystemd, u.Name+\".d\", u.Dropins[j].Name)\n\t\t\tnewDropinSet[path] = struct{}{}\n\t\t}\n\t\tpath := filepath.Join(pathSystemd, u.Name)\n\t\tnewUnitSet[path] = struct{}{}\n\t}\n\n\tfor _, u := range oldIgnConfig.Systemd.Units {\n\t\tfor j := range u.Dropins {\n\t\t\tpath := filepath.Join(pathSystemd, u.Name+\".d\", u.Dropins[j].Name)\n\t\t\tif _, ok := newDropinSet[path]; !ok {\n\t\t\t\tif _, err := os.Stat(noOrigFileStampName(path)); err == nil {\n\t\t\t\t\tif delErr := os.Remove(noOrigFileStampName(path)); delErr != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"deleting noorig file stamp %q: %w\", noOrigFileStampName(path), delErr)\n\t\t\t\t\t}\n\t\t\t\t\tklog.V(2).Infof(\"Removing file %q completely\", path)\n\t\t\t\t} else if _, err := os.Stat(origFileName(path)); err == nil {\n\t\t\t\t\tif err := restorePath(path); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tklog.V(2).Infof(\"Restored file %q\", path)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tklog.V(2).Infof(\"Deleting stale systemd dropin file: %s\", path)\n\t\t\t\tif err := os.Remove(path); err != nil {\n\t\t\t\t\tnewErr := fmt.Errorf(\"unable to delete %s: %w\", path, err)\n\t\t\t\t\tif !os.IsNotExist(err) {\n\t\t\t\t\t\treturn newErr\n\t\t\t\t\t}\n\t\t\t\t\t// otherwise, just warn\n\t\t\t\t\tklog.Warningf(\"%v\", newErr)\n\t\t\t\t}\n\t\t\t\tklog.Infof(\"Removed stale systemd dropin %q\", path)\n\t\t\t}\n\t\t}\n\t\tpath := filepath.Join(pathSystemd, u.Name)\n\t\tif _, ok := newUnitSet[path]; !ok {\n\t\t\t// since the unit doesn't exist anymore within the MachineConfig,\n\t\t\t// look to restore defaults here, so that symlinks are removed first\n\t\t\t// if the system has the service disabled\n\t\t\t// writeUnits() will catch units that still have references in other MCs\n\t\t\tif err := dn.presetUnit(u); err != nil {\n\t\t\t\tklog.Infof(\"Did not restore preset for %s (may not exist): %s\", u.Name, err)\n\t\t\t}\n\t\t\tif _, err := os.Stat(noOrigFileStampName(path)); err == nil {\n\t\t\t\tif delErr := os.Remove(noOrigFileStampName(path)); delErr != nil {\n\t\t\t\t\treturn fmt.Errorf(\"deleting noorig file stamp %q: %w\", noOrigFileStampName(path), delErr)\n\t\t\t\t}\n\t\t\t\tklog.V(2).Infof(\"Removing file %q completely\", path)\n\t\t\t} else if _, err := os.Stat(origFileName(path)); err == nil {\n\t\t\t\tif err := restorePath(path); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tklog.V(2).Infof(\"Restored file %q\", path)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tklog.V(2).Infof(\"Deleting stale systemd unit file: %s\", path)\n\t\t\tif err := os.Remove(path); err != nil {\n\t\t\t\tnewErr := fmt.Errorf(\"unable to delete %s: %w\", path, err)\n\t\t\t\tif !os.IsNotExist(err) {\n\t\t\t\t\treturn newErr\n\t\t\t\t}\n\t\t\t\t// otherwise, just warn\n\t\t\t\tklog.Warningf(\"%v\", newErr)\n\t\t\t}\n\t\t\tklog.Infof(\"Removed stale systemd unit %q\", path)\n\t\t}\n\t}\n\n\treturn nil\n}", "func resourceAzurermResourceGroupNameDiffSuppress(k, old, new string, d *schema.ResourceData) bool {\n\treturn strings.ToLower(old) == strings.ToLower(new)\n}", "func (c *Clients) CheckPendingResources(r *ReleaseData) (bool, error) {\n\tlog.Printf(\"Checking pending resources in %s\", r.Name)\n\tvar err error\n\tvar errCount int\n\tvar pArray []bool\n\tif r.Manifest == \"\" {\n\t\treturn true, errors.New(\"Manifest not provided in the request\")\n\t}\n\tinfos, err := c.getManifestDetails(r)\n\tif err != nil {\n\t\t// Retry if resources not found\n\t\t// todo: Need to have retry count\n\t\tre := regexp.MustCompile(\"not found\")\n\t\tif re.MatchString(err.Error()) {\n\t\t\tlog.Println(err.Error())\n\t\t\treturn true, nil\n\t\t}\n\t\treturn true, err\n\t}\n\tfor _, info := range infos {\n\t\tif errCount >= retryCount*2 {\n\t\t\treturn true, fmt.Errorf(\"couldn't get the resources\")\n\t\t}\n\t\tswitch value := kube.AsVersioned(info).(type) {\n\t\tcase *appsv1.Deployment, *appsv1beta1.Deployment, *appsv1beta2.Deployment, *extensionsv1beta1.Deployment:\n\t\t\tcurrentDeployment, err := c.ClientSet.AppsV1().Deployments(info.Namespace).Get(context.Background(), info.Name, metav1.GetOptions{})\n\t\t\tif err != nil {\n\t\t\t\terrCount++\n\t\t\t\tlog.Printf(\"Warning: Got error getting deployment %s\", err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// If paused deployment will never be ready\n\t\t\tif currentDeployment.Spec.Paused {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !deploymentReady(currentDeployment) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *corev1.PersistentVolumeClaim:\n\t\t\tif !volumeReady(value) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *corev1.Service:\n\t\t\tif !serviceReady(value) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *extensionsv1beta1.DaemonSet, *appsv1.DaemonSet, *appsv1beta2.DaemonSet:\n\t\t\tds, err := c.ClientSet.AppsV1().DaemonSets(info.Namespace).Get(context.Background(), info.Name, metav1.GetOptions{})\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Warning: Got error getting daemonset %s\", err.Error())\n\t\t\t\terrCount++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !daemonSetReady(ds) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *appsv1.StatefulSet, *appsv1beta1.StatefulSet, *appsv1beta2.StatefulSet:\n\t\t\tsts, err := c.ClientSet.AppsV1().StatefulSets(info.Namespace).Get(context.Background(), info.Name, metav1.GetOptions{})\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Warning: Got error getting statefulset %s\", err.Error())\n\t\t\t\terrCount++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !statefulSetReady(sts) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *extensionsv1beta1.Ingress:\n\t\t\tif !ingressReady(value) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *networkingv1beta1.Ingress:\n\t\t\tif !ingressNReady(value) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *apiextv1beta1.CustomResourceDefinition:\n\t\t\tif err := info.Get(); err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\tcrd := &apiextv1beta1.CustomResourceDefinition{}\n\t\t\tif err := scheme.Scheme.Convert(info.Object, crd, nil); err != nil {\n\t\t\t\tlog.Printf(\"Warning: Got error getting CRD %s\", err.Error())\n\t\t\t\terrCount++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !crdBetaReady(crd) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *apiextv1.CustomResourceDefinition:\n\t\t\tif err := info.Get(); err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\tcrd := &apiextv1.CustomResourceDefinition{}\n\t\t\tif err := scheme.Scheme.Convert(info.Object, crd, nil); err != nil {\n\t\t\t\tlog.Printf(\"Warning: Got error getting CRD %s\", err.Error())\n\t\t\t\terrCount++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !crdReady(crd) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\t}\n\t}\n\tif len(pArray) > 0 || errCount != 0 {\n\t\treturn true, err\n\t}\n\treturn false, err\n}", "func createDuplicates(cfg *duplicate.Config) {\n\tif cfg.File == \"\" {\n\t\tfmt.Println(\"Please specify the original file path (flag \\\"-file\\\")\")\n\t} else {\n\t\tfmt.Println(\"Functionality in development\")\n\t}\n}", "func TestPopulateResources(t *testing.T) {\n\ttestName := \"TestPopulateResources\"\n\n\tbeforeTest()\n\t// kinds to check for status\n\tvar kindsToCheckStatus = map[string]bool{}\n\n\tvar files = []string{\n\t\tKappnavConfigFile,\n\t\tCrdApplication,\n\t\tappBookinfo,\n\t\tappDetails,\n\t\tdeploymentDetailsV1,\n\t\tserviceDetails,\n\t\tingressBookinfo,\n\t\tappProductpage,\n\t\tnetworkpolicyProductpage,\n\t\tdeploymentProcuctpageV1,\n\t\tserviceProductpage,\n\t\tappRatings,\n\t\tdeploymentRatingsV1,\n\t\tserviceRatings,\n\t\tappReviews,\n\t\tnetworkpolicyReviews,\n\t\tdeploymentReviewsV1,\n\t\tdeploymentReviewsV2,\n\t\tdeploymentReviewsV3,\n\t\tserviceReview,\n\t\tcrdFoo,\n\t\tfooExample,\n\t\tappFoo,\n\t\tkappnavCRFile,\n\t}\n\n\titeration0IDs, err := readResourceIDs(files)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t/* Iteration 0: all normal */\n\ttestActions := newTestActions(testName, kindsToCheckStatus)\n\tvar emptyIDs = []resourceID{}\n\ttestActions.addIteration(iteration0IDs, emptyIDs)\n\n\t/* iteration 1: clean up */\n\ttestActions.addIteration(emptyIDs, emptyIDs)\n\n\t/* create a watcher that populates all resources */\n\tclusterWatcher, err := createClusterWatcher(iteration0IDs, testActions, StatusFailureRate)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer clusterWatcher.shutDown()\n\n\t// ensure we can find each resource\n\tfor _, res := range iteration0IDs {\n\t\texists, _ := resourceExists(clusterWatcher, res)\n\t\tif !exists {\n\t\t\tt.Fatal(fmt.Errorf(\"can't find resource for %s\\n,\", res.fileName))\n\t\t}\n\t}\n\n\terr = testActions.transitionAll()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "func DelResource(nsId string, resourceType string, resourceId string, forceFlag string) error {\n\n\tfmt.Printf(\"DelResource() called; %s %s %s \\n\", nsId, resourceType, resourceId) // for debug\n\n\terr := common.CheckString(nsId)\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\treturn err\n\t}\n\n\terr = common.CheckString(resourceId)\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\treturn err\n\t}\n\tcheck, err := CheckResource(nsId, resourceType, resourceId)\n\n\tif !check {\n\t\terrString := \"The \" + resourceType + \" \" + resourceId + \" does not exist.\"\n\t\t//mapA := map[string]string{\"message\": errString}\n\t\t//mapB, _ := json.Marshal(mapA)\n\t\terr := fmt.Errorf(errString)\n\t\t//return http.StatusNotFound, mapB, err\n\t\treturn err\n\t}\n\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\treturn err\n\t}\n\n\tkey := common.GenResourceKey(nsId, resourceType, resourceId)\n\tfmt.Println(\"key: \" + key)\n\n\tkeyValue, _ := common.CBStore.Get(key)\n\t/*\n\t\tif keyValue == nil {\n\t\t\tmapA := map[string]string{\"message\": \"Failed to find the resource with given ID.\"}\n\t\t\tmapB, _ := json.Marshal(mapA)\n\t\t\terr := fmt.Errorf(\"Failed to find the resource with given ID.\")\n\t\t\treturn http.StatusNotFound, mapB, err\n\t\t}\n\t*/\n\t//fmt.Println(\"keyValue: \" + keyValue.Key + \" / \" + keyValue.Value)\n\n\t//cspType := common.GetResourcesCspType(nsId, resourceType, resourceId)\n\n\tif os.Getenv(\"SPIDER_CALL_METHOD\") == \"REST\" {\n\n\t\tvar url string\n\n\t\t// Create Req body\n\t\ttype JsonTemplate struct {\n\t\t\tConnectionName string\n\t\t}\n\t\ttempReq := JsonTemplate{}\n\n\t\tswitch resourceType {\n\t\tcase common.StrImage:\n\t\t\t// delete image info\n\t\t\terr := common.CBStore.Delete(key)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\t//return http.StatusInternalServerError, nil, err\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// \"DELETE FROM `image` WHERE `id` = '\" + resourceId + \"';\"\n\t\t\t_, err = common.ORM.Delete(&TbImageInfo{Namespace: nsId, Id: resourceId})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"Data deleted successfully..\")\n\t\t\t}\n\n\t\t\t//return http.StatusOK, nil, nil\n\t\t\treturn nil\n\t\tcase common.StrSpec:\n\t\t\t// delete spec info\n\n\t\t\t//get related recommend spec\n\t\t\t//keyValue, err := common.CBStore.Get(key)\n\t\t\tcontent := TbSpecInfo{}\n\t\t\terr := json.Unmarshal([]byte(keyValue.Value), &content)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr = common.CBStore.Delete(key)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t//delete related recommend spec\n\t\t\terr = DelRecommendSpec(nsId, resourceId, content.NumvCPU, content.MemGiB, content.StorageGiB)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// \"DELETE FROM `spec` WHERE `id` = '\" + resourceId + \"';\"\n\t\t\t_, err = common.ORM.Delete(&TbSpecInfo{Namespace: nsId, Id: resourceId})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"Data deleted successfully..\")\n\t\t\t}\n\n\t\t\t//return http.StatusOK, nil, nil\n\t\t\treturn nil\n\t\tcase common.StrSSHKey:\n\t\t\ttemp := TbSshKeyInfo{}\n\t\t\terr = json.Unmarshal([]byte(keyValue.Value), &temp)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttempReq.ConnectionName = temp.ConnectionName\n\t\t\turl = common.SpiderRestUrl + \"/keypair/\" + temp.Name\n\t\tcase common.StrVNet:\n\t\t\ttemp := TbVNetInfo{}\n\t\t\terr = json.Unmarshal([]byte(keyValue.Value), &temp)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttempReq.ConnectionName = temp.ConnectionName\n\t\t\turl = common.SpiderRestUrl + \"/vpc/\" + temp.Name\n\t\tcase common.StrSecurityGroup:\n\t\t\ttemp := TbSecurityGroupInfo{}\n\t\t\terr = json.Unmarshal([]byte(keyValue.Value), &temp)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttempReq.ConnectionName = temp.ConnectionName\n\t\t\turl = common.SpiderRestUrl + \"/securitygroup/\" + temp.Name\n\t\t/*\n\t\t\tcase \"subnet\":\n\t\t\t\ttemp := subnetInfo{}\n\t\t\t\tjson.Unmarshal([]byte(keyValue.Value), &content)\n\t\t\t\treturn content.CspSubnetId\n\t\t\tcase \"publicIp\":\n\t\t\t\ttemp := publicIpInfo{}\n\t\t\t\tjson.Unmarshal([]byte(keyValue.Value), &temp)\n\t\t\t\ttempReq.ConnectionName = temp.ConnectionName\n\t\t\t\turl = common.SPIDER_REST_URL + \"/publicip/\" + temp.CspPublicIpName\n\t\t\tcase \"vNic\":\n\t\t\t\ttemp := vNicInfo{}\n\t\t\t\tjson.Unmarshal([]byte(keyValue.Value), &temp)\n\t\t\t\ttempReq.ConnectionName = temp.ConnectionName\n\t\t\t\turl = common.SPIDER_REST_URL + \"/vnic/\" + temp.CspVNicName\n\t\t*/\n\t\tdefault:\n\t\t\terr := fmt.Errorf(\"invalid resourceType\")\n\t\t\t//return http.StatusBadRequest, nil, err\n\t\t\treturn err\n\t\t}\n\n\t\tfmt.Println(\"url: \" + url)\n\n\t\tclient := resty.New().SetCloseConnection(true)\n\n\t\tresp, err := client.R().\n\t\t\tSetHeader(\"Content-Type\", \"application/json\").\n\t\t\tSetBody(tempReq).\n\t\t\t//SetResult(&SpiderSpecInfo{}). // or SetResult(AuthSuccess{}).\n\t\t\t//SetError(&AuthError{}). // or SetError(AuthError{}).\n\t\t\tDelete(url)\n\n\t\tif err != nil {\n\t\t\tcommon.CBLog.Error(err)\n\t\t\terr := fmt.Errorf(\"an error occurred while requesting to CB-Spider\")\n\t\t\treturn err\n\t\t}\n\n\t\tfmt.Println(\"HTTP Status code: \" + strconv.Itoa(resp.StatusCode()))\n\t\tswitch {\n\t\tcase forceFlag == \"true\":\n\t\t\turl += \"?force=true\"\n\t\t\tfmt.Println(\"forceFlag == true; url: \" + url)\n\n\t\t\t_, err := client.R().\n\t\t\t\tSetHeader(\"Content-Type\", \"application/json\").\n\t\t\t\tSetBody(tempReq).\n\t\t\t\t//SetResult(&SpiderSpecInfo{}). // or SetResult(AuthSuccess{}).\n\t\t\t\t//SetError(&AuthError{}). // or SetError(AuthError{}).\n\t\t\t\tDelete(url)\n\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\terr := fmt.Errorf(\"an error occurred while requesting to CB-Spider\")\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr = common.CBStore.Delete(key)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\tcase resp.StatusCode() >= 400 || resp.StatusCode() < 200:\n\t\t\terr := fmt.Errorf(string(resp.Body()))\n\t\t\tcommon.CBLog.Error(err)\n\t\t\treturn err\n\t\tdefault:\n\t\t\terr := common.CBStore.Delete(key)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t} else {\n\n\t\t// Set CCM gRPC API\n\t\tccm := api.NewCloudResourceHandler()\n\t\terr := ccm.SetConfigPath(os.Getenv(\"CBTUMBLEBUG_ROOT\") + \"/conf/grpc_conf.yaml\")\n\t\tif err != nil {\n\t\t\tcommon.CBLog.Error(\"ccm failed to set config : \", err)\n\t\t\treturn err\n\t\t}\n\t\terr = ccm.Open()\n\t\tif err != nil {\n\t\t\tcommon.CBLog.Error(\"ccm api open failed : \", err)\n\t\t\treturn err\n\t\t}\n\t\tdefer ccm.Close()\n\n\t\tswitch resourceType {\n\t\tcase common.StrImage:\n\t\t\t// delete image info\n\t\t\terr := common.CBStore.Delete(key)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\t//return http.StatusInternalServerError, nil, err\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// \"DELETE FROM `image` WHERE `id` = '\" + resourceId + \"';\"\n\t\t\t_, err = common.ORM.Delete(&TbImageInfo{Namespace: nsId, Id: resourceId})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"Data deleted successfully..\")\n\t\t\t}\n\n\t\t\t//return http.StatusOK, nil, nil\n\t\t\treturn nil\n\t\tcase common.StrSpec:\n\t\t\t// delete spec info\n\n\t\t\t//get related recommend spec\n\t\t\tcontent := TbSpecInfo{}\n\t\t\terr := json.Unmarshal([]byte(keyValue.Value), &content)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr = common.CBStore.Delete(key)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t//delete related recommend spec\n\t\t\terr = DelRecommendSpec(nsId, resourceId, content.NumvCPU, content.MemGiB, content.StorageGiB)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// \"DELETE FROM `spec` WHERE `id` = '\" + resourceId + \"';\"\n\t\t\t_, err = common.ORM.Delete(&TbSpecInfo{Namespace: nsId, Id: resourceId})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"Data deleted successfully..\")\n\t\t\t}\n\n\t\t\treturn nil\n\n\t\tcase common.StrSSHKey:\n\t\t\ttemp := TbSshKeyInfo{}\n\t\t\terr := json.Unmarshal([]byte(keyValue.Value), &temp)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t_, err = ccm.DeleteKeyByParam(temp.ConnectionName, temp.Name, forceFlag)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\tcase common.StrVNet:\n\t\t\ttemp := TbVNetInfo{}\n\t\t\terr := json.Unmarshal([]byte(keyValue.Value), &temp)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t_, err = ccm.DeleteVPCByParam(temp.ConnectionName, temp.Name, forceFlag)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\tcase common.StrSecurityGroup:\n\t\t\ttemp := TbSecurityGroupInfo{}\n\t\t\terr := json.Unmarshal([]byte(keyValue.Value), &temp)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t_, err = ccm.DeleteSecurityByParam(temp.ConnectionName, temp.Name, forceFlag)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\tdefault:\n\t\t\terr := fmt.Errorf(\"invalid resourceType\")\n\t\t\treturn err\n\t\t}\n\n\t\terr = common.CBStore.Delete(key)\n\t\tif err != nil {\n\t\t\tcommon.CBLog.Error(err)\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\n\t}\n}", "func (vrm *ResourceManager) ApplyResourceDiff() error {\n\n\t// Get Actual VolumeGroup on node.\n\tactualVgConfig, err := vrm.getRealVgList()\n\tif err != nil {\n\t\tlog.Errorf(\"ApplyResourceDiff:: Get Node Actual VolumeGroup Error: %s\", err.Error())\n\t\treturn err\n\t}\n\tif len(vrm.volumeGroupDeviceMap) > 0 {\n\t\tvrm.applyDeivce(actualVgConfig)\n\t}\n\tif len(vrm.volumeGroupRegionMap) > 0 {\n\t\tvrm.applyRegion(actualVgConfig)\n\t}\n\n\tlog.Infof(\"ApplyResourceDiff:: Finish volumegroup loop...\")\n\treturn nil\n}", "func (d *DryccCmd) ResourceDelete(appID, name string) error {\n\ts, appID, err := load(d.ConfigFile, appID)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.Printf(\"Deleting %s from %s... \", name, appID)\n\n\tquit := progress(d.WOut)\n\terr = resources.Delete(s.Client, appID, name)\n\tquit <- true\n\t<-quit\n\tif d.checkAPICompatibility(s.Client, err) != nil {\n\t\treturn err\n\t}\n\n\td.Println(\"done\")\n\treturn nil\n}", "func (rcsw *RemoteClusterServiceWatcher) cleanupMirroredResources() error {\n\tmatchLabels := map[string]string{\n\t\tconsts.MirroredResourceLabel: \"true\",\n\t\tconsts.RemoteClusterNameLabel: rcsw.clusterName,\n\t}\n\n\tservices, err := rcsw.localAPIClient.Svc().Lister().List(labels.Set(matchLabels).AsSelector())\n\tif err != nil {\n\t\tinnerErr := fmt.Errorf(\"could not retrieve mirrored services that need cleaning up: %s\", err)\n\t\tif kerrors.IsNotFound(err) {\n\t\t\treturn innerErr\n\t\t}\n\t\t// if its not notFound then something else went wrong, so we can retry\n\t\treturn RetryableError{[]error{innerErr}}\n\t}\n\n\tvar errors []error\n\tfor _, svc := range services {\n\t\tif err := rcsw.localAPIClient.Client.CoreV1().Services(svc.Namespace).Delete(svc.Name, &metav1.DeleteOptions{}); err != nil {\n\t\t\tif kerrors.IsNotFound(err) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\terrors = append(errors, fmt.Errorf(\"Could not delete service %s/%s: %s\", svc.Namespace, svc.Name, err))\n\t\t} else {\n\t\t\trcsw.log.Debugf(\"Deleted service %s/%s\", svc.Namespace, svc.Name)\n\t\t}\n\t}\n\n\tendpoints, err := rcsw.localAPIClient.Endpoint().Lister().List(labels.Set(matchLabels).AsSelector())\n\tif err != nil {\n\t\tinnerErr := fmt.Errorf(\"could not retrieve Endpoints that need cleaning up: %s\", err)\n\t\tif kerrors.IsNotFound(err) {\n\t\t\treturn innerErr\n\t\t}\n\t\treturn RetryableError{[]error{innerErr}}\n\t}\n\n\tfor _, endpt := range endpoints {\n\t\tif err := rcsw.localAPIClient.Client.CoreV1().Endpoints(endpt.Namespace).Delete(endpt.Name, &metav1.DeleteOptions{}); err != nil {\n\t\t\tif kerrors.IsNotFound(err) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\terrors = append(errors, fmt.Errorf(\"Could not delete Endpoints %s/%s: %s\", endpt.Namespace, endpt.Name, err))\n\t\t} else {\n\t\t\trcsw.log.Debugf(\"Deleted Endpoints %s/%s\", endpt.Namespace, endpt.Name)\n\t\t}\n\t}\n\n\tif len(errors) > 0 {\n\t\treturn RetryableError{errors}\n\t}\n\treturn nil\n}", "func deleteServiceTemplate(sd *defs, st *defs, ht *defs, svc *serviceOffset, tmplEnabledDisabled attrVal, hgrpDeleted attrVal, hostname string, bflags attrVal){\n for _, t := range tmplEnabledDisabled {\n if (*st)[t].attrExist(\"host_name\"){\n (*st)[t][\"host_name\"].deleteAttrVal(st , ht, t, \"SVCTMPL HOSTNAME\", \"host_name\", hostname, bflags, hostname)\n if len(*(*st)[t][\"host_name\"]) == 0 {\n printDeletion(t, \"SVCTMPL HOSTNAME\", \"host_name\", \"\", \"attr\", bflags)\n delete((*st)[t], \"host_name\")\n }\n }\n if (*st)[t].attrExist(\"hostgroup_name\"){\n (*st)[t][\"hostgroup_name\"].deleteAttrVal(st , ht, t, \"SVCTMPL HOSTGROUP_NAME\", \"hostgroup_name\", hostname,bflags, hgrpDeleted...)\n if len(*(*st)[t][\"hostgroup_name\"]) == 0 {\n printDeletion(t, \"SVCTMPL HOSTGROUP_NAME\", \"hostgroup_name\", \"\", \"attr\", bflags)\n delete((*st)[t], \"hostgroup_name\")\n }\n }\n if !(*st)[t].attrExist(\"host_name\") && !(*st)[t].attrExist(\"hostgroup_name\"){ // delete hostgroup obj definition\n if !(*st)[t].attrExist(\"register\") || (*st)[t][\"register\"].ToString() == \"1\" {\n if (*st)[t].attrExist(\"use\") && !isTemplateBeingUsed(sd, st, t){\n if isSafeDeleteTemplate(st, *(*st)[t][\"use\"], hgrpDeleted, hostname) {\n printDeletion(t, \"SVCTMPL\", \"\", \"\", \"def\", bflags)\n svc.tmpl.deleted.Add(t)\n delete(*st, t)\n }\n } else if isTemplateBeingUsed(sd, st, t){\n unregisterTemplate := attrVal{\"0\"}\n (*st)[t][\"register\"] = &unregisterTemplate\n fmt.Printf(\"%vRegister%v:%v[SVCTMPL EDIT]%v: Unregister service template %v\\n\", Yellow, RST, Blue, RST, t)\n } else {\n printDeletion(t, \"SVCTMPL\", \"\", \"\", \"def\", bflags)\n svc.tmpl.deleted.Add(t)\n delete(*st, t)\n }\n } else if (*st)[t].attrExist(\"use\") && !isTemplateBeingUsed(sd, st, t){\n if isSafeDeleteTemplate(st, *(*st)[t][\"use\"], hgrpDeleted, hostname) {\n fmt.Printf(\"%vWarning%v:%v[SVCTMPL]%v: found template not being used '%v'\", Yellow, RST,Blue,RST, t)\n // TODO: flag to allow not used template deletion\n// printDeletion(t, \"SVCTMPL\", \"\", \"\", \"def\")\n// svc.SetDeletedTemplate(t)\n// delete(*st, t)\n }\n } else if !isTemplateBeingUsed(sd, st, t){\n fmt.Printf(\"%vWarning%v:%v[SVCTMPL]%v: found template not being used '%v'\", Yellow, RST,Blue,RST, t)\n }\n }\n }\n}", "func (s *Synk) deleteResourceSets(ctx context.Context, name string, version int32) error {\n\tc := s.client.Resource(resourceSetGVR)\n\n\tlist, err := c.List(ctx, metav1.ListOptions{})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"list existing resources\")\n\t}\n\tfor _, r := range list.Items {\n\t\tn, v, ok := decodeResourceSetName(r.GetName())\n\t\tif !ok || n != name || v >= version {\n\t\t\tcontinue\n\t\t}\n\t\t// TODO: should we possibly opt for foreground deletion here so\n\t\t// we only return after all dependents have been deleted as well?\n\t\t// kubectl doesn't allow to opt into foreground deletion in general but\n\t\t// here it would likely bring us closer to the apply --prune semantics.\n\t\tif err := c.Delete(ctx, r.GetName(), metav1.DeleteOptions{}); err != nil {\n\t\t\treturn errors.Wrapf(err, \"delete ResourceSet %q\", r.GetName())\n\t\t}\n\t}\n\treturn nil\n}", "func (c *clusterCache) GetManagedLiveObjs(targetObjs []*unstructured.Unstructured, isManaged func(r *Resource) bool) (map[kube.ResourceKey]*unstructured.Unstructured, error) {\n\tc.lock.RLock()\n\tdefer c.lock.RUnlock()\n\n\tfor _, o := range targetObjs {\n\t\tif len(c.namespaces) > 0 {\n\t\t\tif o.GetNamespace() == \"\" && !c.clusterResources {\n\t\t\t\treturn nil, fmt.Errorf(\"Cluster level %s %q can not be managed when in namespaced mode\", o.GetKind(), o.GetName())\n\t\t\t} else if o.GetNamespace() != \"\" && !c.managesNamespace(o.GetNamespace()) {\n\t\t\t\treturn nil, fmt.Errorf(\"Namespace %q for %s %q is not managed\", o.GetNamespace(), o.GetKind(), o.GetName())\n\t\t\t}\n\t\t}\n\t}\n\n\tmanagedObjs := make(map[kube.ResourceKey]*unstructured.Unstructured)\n\t// iterate all objects in live state cache to find ones associated with app\n\tfor key, o := range c.resources {\n\t\tif isManaged(o) && o.Resource != nil && len(o.OwnerRefs) == 0 {\n\t\t\tmanagedObjs[key] = o.Resource\n\t\t}\n\t}\n\t// but are simply missing our label\n\tlock := &sync.Mutex{}\n\terr := kube.RunAllAsync(len(targetObjs), func(i int) error {\n\t\ttargetObj := targetObjs[i]\n\t\tkey := kube.GetResourceKey(targetObj)\n\t\tlock.Lock()\n\t\tmanagedObj := managedObjs[key]\n\t\tlock.Unlock()\n\n\t\tif managedObj == nil {\n\t\t\tif existingObj, exists := c.resources[key]; exists {\n\t\t\t\tif existingObj.Resource != nil {\n\t\t\t\t\tmanagedObj = existingObj.Resource\n\t\t\t\t} else {\n\t\t\t\t\tvar err error\n\t\t\t\t\tmanagedObj, err = c.kubectl.GetResource(context.TODO(), c.config, targetObj.GroupVersionKind(), existingObj.Ref.Name, existingObj.Ref.Namespace)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tif errors.IsNotFound(err) {\n\t\t\t\t\t\t\treturn nil\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if _, watched := c.apisMeta[key.GroupKind()]; !watched {\n\t\t\t\tvar err error\n\t\t\t\tmanagedObj, err = c.kubectl.GetResource(context.TODO(), c.config, targetObj.GroupVersionKind(), targetObj.GetName(), targetObj.GetNamespace())\n\t\t\t\tif err != nil {\n\t\t\t\t\tif errors.IsNotFound(err) {\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif managedObj != nil {\n\t\t\tconverted, err := c.kubectl.ConvertToVersion(managedObj, targetObj.GroupVersionKind().Group, targetObj.GroupVersionKind().Version)\n\t\t\tif err != nil {\n\t\t\t\t// fallback to loading resource from kubernetes if conversion fails\n\t\t\t\tc.log.V(1).Info(fmt.Sprintf(\"Failed to convert resource: %v\", err))\n\t\t\t\tmanagedObj, err = c.kubectl.GetResource(context.TODO(), c.config, targetObj.GroupVersionKind(), managedObj.GetName(), managedObj.GetNamespace())\n\t\t\t\tif err != nil {\n\t\t\t\t\tif errors.IsNotFound(err) {\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tmanagedObj = converted\n\t\t\t}\n\t\t\tlock.Lock()\n\t\t\tmanagedObjs[key] = managedObj\n\t\t\tlock.Unlock()\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn managedObjs, nil\n}", "func testResourceDeletionNotIgnored(t *testing.T, initialResource func(string) e2e.UpdateOptions, updateResource func(r *e2e.UpdateOptions)) {\n\tctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout*1000)\n\tt.Cleanup(cancel)\n\tmgmtServer := startManagementServer(t)\n\tnodeID := uuid.New().String()\n\tbs := generateBootstrapContents(t, mgmtServer.Address, false, nodeID)\n\txdsR := xdsResolverBuilder(t, bs)\n\tresources := initialResource(nodeID)\n\n\t// Update the management server with initial resources setup.\n\tif err := mgmtServer.Update(ctx, resources); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tcc, err := grpc.Dial(fmt.Sprintf(\"xds:///%s\", serviceName), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(xdsR))\n\tif err != nil {\n\t\tt.Fatalf(\"failed to dial local test server: %v\", err)\n\t}\n\tt.Cleanup(func() { cc.Close() })\n\n\tif err := verifyRPCtoAllEndpoints(cc); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Mutate resource and update on the server.\n\tupdateResource(&resources)\n\tif err := mgmtServer.Update(ctx, resources); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Spin up go routines to verify RPCs fail after the update.\n\tclient := testgrpc.NewTestServiceClient(cc)\n\twg := sync.WaitGroup{}\n\twg.Add(2)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tfor ; ctx.Err() == nil; <-time.After(10 * time.Millisecond) {\n\t\t\tif _, err := client.EmptyCall(ctx, &testpb.Empty{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tfor ; ctx.Err() == nil; <-time.After(10 * time.Millisecond) {\n\t\t\tif _, err := client.UnaryCall(ctx, &testpb.SimpleRequest{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\twg.Wait()\n\tif ctx.Err() != nil {\n\t\tt.Fatal(\"Context expired before RPCs failed.\")\n\t}\n}", "func TestCreatesAllowedDuringNamespaceDeletion(t *testing.T) {\n\tconfig := &origin.MasterConfig{\n\t\tKubeletClientConfig: &kclient.KubeletConfig{},\n\t\tEtcdHelper: etcdstorage.NewEtcdStorage(nil, nil, \"\"),\n\t}\n\tstorageMap := config.GetRestStorage()\n\tresources := sets.String{}\n\n\tfor resource := range storageMap {\n\t\tresources.Insert(strings.ToLower(resource))\n\t}\n\n\tfor resource := range recommendedCreatableResources {\n\t\tif !resources.Has(resource) {\n\t\t\tt.Errorf(\"recommendedCreatableResources has resource %v, but that resource isn't registered.\", resource)\n\t\t}\n\t}\n}", "func (fm *FileManager) Feed(src string, files []*plugin.Generated) error {\n\tvar last string\n\nFileLoop:\n\tfor i := 0; i < len(files); i++ {\n\t\tf := files[i]\n\t\tif !f.IsSetName() {\n\t\t\tif last == \"\" {\n\t\t\t\treturn fmt.Errorf(\"[%s] attended to append but no target file found\", src)\n\t\t\t}\n\t\t\tfm.patch[last] = append(fm.patch[last], f)\n\t\t\tcontinue\n\t\t}\n\t\tname := f.GetName()\n\t\tif idx, ok := fm.index[name]; !ok {\n\t\t\tfm.index[name] = len(fm.files)\n\t\t\tfm.files = append(fm.files, f)\n\t\t} else {\n\t\t\tif f.GetInsertionPoint() != \"\" {\n\t\t\t\t// FIXME: when the target file is renamed due to name collision, the patch may be invalid.\n\t\t\t\tfm.patch[name] = append(fm.patch[name], f)\n\t\t\t} else {\n\t\t\t\tfst := idx\n\t\t\t\text := filepath.Ext(name)\n\t\t\t\tpth := strings.TrimSuffix(name, ext)\n\t\t\t\tcnt := 1\n\n\t\t\t\tvar renamed string\n\t\t\t\tfor {\n\t\t\t\t\tif fm.files[idx].Content == f.Content { // duplicate content\n\t\t\t\t\t\tfm.log.Info(fmt.Sprintf(\"[%s] discard generated file '%s': size %d\", src, name, len(f.Content)))\n\t\t\t\t\t\tfor j := i + 1; j < len(files) && !files[j].IsSetName(); j++ {\n\t\t\t\t\t\t\tfm.log.Info(\"discard patch @\", files[j].GetInsertionPoint())\n\t\t\t\t\t\t\ti++\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue FileLoop\n\t\t\t\t\t}\n\t\t\t\t\trenamed = fmt.Sprintf(\"%s_%d%s\", pth, cnt, ext)\n\t\t\t\t\tif cnt > fm.count[name] {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t} else {\n\t\t\t\t\t\tidx = fm.index[renamed]\n\t\t\t\t\t\tcnt++\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfm.log.Warn(fmt.Sprintf(\"[%s] file names conflict: '%s' (%d <> %d)\", src, name, len(fm.files[fst].Content), len(f.Content)))\n\t\t\t\tfm.index[renamed] = len(fm.files)\n\t\t\t\tfm.files = append(fm.files, f)\n\t\t\t\tfm.count[name]++\n\t\t\t\tf.Name = &renamed\n\t\t\t\tname = renamed // propagate the new name to last\n\t\t\t}\n\t\t}\n\t\tlast = name\n\t}\n\treturn nil\n}", "func (s *storage) cleanExpired(sources pb.SyncMapping, actives pb.SyncMapping) {\nnext:\n\tfor _, entry := range sources {\n\t\tfor _, act := range actives {\n\t\t\tif act.CurInstanceID == entry.CurInstanceID {\n\t\t\t\tcontinue next\n\t\t\t}\n\t\t}\n\n\t\tdelOp := delMappingOp(entry.ClusterName, entry.OrgInstanceID)\n\t\tif _, err := s.engine.Do(context.Background(), delOp); err != nil {\n\t\t\tlog.Errorf(err, \"Delete instance clusterName=%s instanceID=%s failed\", entry.ClusterName, entry.OrgInstanceID)\n\t\t}\n\n\t\ts.deleteInstance(entry.CurInstanceID)\n\t}\n}", "func prepareMirrorURLs(sourceURL string, targetURLs []string) <-chan mirrorURLs {\n\tmirrorURLsCh := make(chan mirrorURLs)\n\n\tgo func() {\n\t\tdefer close(mirrorURLsCh)\n\t\tsourceURL = stripRecursiveURL(sourceURL)\n\t\tif strings.HasSuffix(sourceURL, \"/\") == false {\n\t\t\tsourceURL = sourceURL + \"/\"\n\t\t}\n\t\tsourceClnt, err := url2Client(sourceURL)\n\t\tif err != nil {\n\t\t\tmirrorURLsCh <- mirrorURLs{Error: err.Trace(sourceURL)}\n\t\t\treturn\n\t\t}\n\t\ttargetClnts := make([]client.Client, len(targetURLs))\n\t\tfor i, targetURL := range targetURLs {\n\t\t\ttargetClnt, targetContent, err := url2Stat(targetURL)\n\t\t\tif err != nil {\n\t\t\t\tmirrorURLsCh <- mirrorURLs{Error: err.Trace(targetURL)}\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// if one of the targets is not dir exit\n\t\t\tif !targetContent.Type.IsDir() {\n\t\t\t\tmirrorURLsCh <- mirrorURLs{Error: errInvalidTarget(targetURL).Trace()}\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// special case, be extremely careful before changing this behavior - will lead to data loss\n\t\t\tnewTargetURL := strings.TrimSuffix(targetURL, string(targetClnt.URL().Separator)) + string(targetClnt.URL().Separator)\n\t\t\ttargetClnt, err = url2Client(newTargetURL)\n\t\t\tif err != nil {\n\t\t\t\tmirrorURLsCh <- mirrorURLs{Error: err.Trace(newTargetURL)}\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttargetClnts[i] = targetClnt\n\t\t}\n\t\tfor sURLs := range deltaSourceTargets(sourceClnt, targetClnts) {\n\t\t\tmirrorURLsCh <- sURLs\n\t\t}\n\t}()\n\treturn mirrorURLsCh\n}", "func (v GithubVCS) ConcatAllYamlFiles(ctx context.Context, objects []*github.RepositoryContent, runinfo *RunInfo) (string, error) {\n\tvar allTemplates string\n\n\tfor _, value := range objects {\n\t\tif strings.HasSuffix(value.GetName(), \".yaml\") ||\n\t\t\tstrings.HasSuffix(value.GetName(), \".yml\") {\n\t\t\tdata, err := v.GetObject(ctx, value.GetSHA(), runinfo)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\tif allTemplates != \"\" && !strings.HasPrefix(string(data), \"---\") {\n\t\t\t\tallTemplates += \"---\"\n\t\t\t}\n\t\t\tallTemplates += \"\\n\" + string(data) + \"\\n\"\n\t\t}\n\t}\n\treturn allTemplates, nil\n}", "func tags_Delete_WithSameImageID(t *testing.T, opts ...configOpt) {\n\topts = append(opts)\n\tenv := newTestEnv(t, opts...)\n\tdefer env.Shutdown()\n\n\timageName, err := reference.WithName(\"foo/bar\")\n\tcheckErr(t, err, \"building named object\")\n\n\t// build two tags pointing to the same image\n\ttag1 := \"1.0.0\"\n\ttag2 := \"latest\"\n\tcreateRepositoryWithMultipleIdenticalTags(t, env, imageName.Name(), []string{tag1, tag2})\n\n\t// delete one of the tags\n\tref, err := reference.WithTag(imageName, tag1)\n\tcheckErr(t, err, \"building tag reference\")\n\n\ttagURL, err := env.builder.BuildTagURL(ref)\n\tcheckErr(t, err, \"building tag URL\")\n\n\tresp, err := httpDelete(tagURL)\n\tmsg := \"checking tag delete\"\n\tcheckErr(t, err, msg)\n\n\tdefer resp.Body.Close()\n\n\tcheckResponse(t, msg, resp, http.StatusAccepted)\n\n\t// check the other tag is still there\n\ttagsURL, err := env.builder.BuildTagsURL(imageName)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error building tags url: %v\", err)\n\t}\n\tresp, err = http.Get(tagsURL)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error getting tags: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tdec := json.NewDecoder(resp.Body)\n\tvar tagsResponse tagsAPIResponse\n\tif err := dec.Decode(&tagsResponse); err != nil {\n\t\tt.Fatalf(\"unexpected error decoding response: %v\", err)\n\t}\n\n\tif tagsResponse.Name != imageName.Name() {\n\t\tt.Fatalf(\"tags name should match image name: %v != %v\", tagsResponse.Name, imageName)\n\t}\n\n\tif len(tagsResponse.Tags) != 1 {\n\t\tt.Fatalf(\"expected 1 tag, got %d: %v\", len(tagsResponse.Tags), tagsResponse.Tags)\n\t}\n\n\tif tagsResponse.Tags[0] != tag2 {\n\t\tt.Fatalf(\"expected tag to be %q, got %q\", tagsResponse.Tags[0], tag2)\n\t}\n}", "func (r *Store) RCSPull(ctx context.Context, name, origin, remote string) error {\n\tstore, _ := r.getStore(name)\n\n\treturn store.Storage().Pull(ctx, origin, remote)\n}" ]
[ "0.570892", "0.55854475", "0.53175753", "0.5260137", "0.5203018", "0.50135106", "0.50129366", "0.5002672", "0.49678025", "0.49068257", "0.49068257", "0.4880002", "0.4870154", "0.48697236", "0.48677993", "0.48084393", "0.48019645", "0.4737808", "0.47268918", "0.47148904", "0.47110444", "0.4707466", "0.46897194", "0.46266896", "0.46266896", "0.46225718", "0.4617693", "0.4616879", "0.4607404", "0.46018964", "0.45787314", "0.4559828", "0.45471925", "0.45450217", "0.45417437", "0.4527776", "0.45204145", "0.45159626", "0.45084184", "0.4505851", "0.45018527", "0.4495657", "0.44923508", "0.44904482", "0.44874337", "0.44668075", "0.4465866", "0.44608957", "0.44595924", "0.4458279", "0.4454844", "0.44515", "0.44511968", "0.44457406", "0.44418925", "0.44348696", "0.44235075", "0.44144928", "0.44144928", "0.44021687", "0.4398327", "0.43925658", "0.43917185", "0.43873972", "0.43814036", "0.43804297", "0.4369963", "0.43618023", "0.43572724", "0.43471885", "0.43434155", "0.433504", "0.43332922", "0.4327248", "0.4322365", "0.4322222", "0.43105325", "0.4310411", "0.43065277", "0.4303879", "0.4303645", "0.4299363", "0.42959896", "0.42926016", "0.4292479", "0.42850167", "0.42846048", "0.42830148", "0.42775387", "0.42773747", "0.42754427", "0.42728385", "0.42702034", "0.4270044", "0.4267151", "0.42616972", "0.4257671", "0.42555976", "0.42474487", "0.4245717" ]
0.732469
0
Index sets indexes on appropriate columns/properties
func (n *Notification) Index() mgo.Index { return mgo.Index{ Key: []string{"uid", "list"}, Unique: true, //DropDups: true, Background: true, //Sparse: true, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Mongo) Index(gid string, background bool) error {\n\tm.Session.ResetIndexCache()\n\n\tsessionCopy := m.Session.Copy()\n\tdefer sessionCopy.Close()\n\tcol := sessionCopy.DB(m.DBName).C(gid)\n\n\tcInfo := &mgo.CollectionInfo{DisableIdIndex: true}\n\terr := col.Create(cInfo)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\n\t/*\n\t\t// TODO figure out the magic of mongo indexes\n\t\tindex := mgo.Index{\n\t\t\tKey: []string{\"g\", \"s\", \"p\", \"o\"},\n\t\t\tBackground: false,\n\t\t\tSparse: true,\n\t\t\tUnique: true,\n\t\t\tDropDups: true,\n\t\t}\n\t\terr := col.EnsureIndex(index)\n\t\treturn err\n\t*/\n\n\tindex := mgo.Index{\n\t\tKey: []string{\"g\", \"s\"},\n\t\tBackground: background,\n\t\tSparse: true,\n\t}\n\terr = col.EnsureIndex(index)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\t//return err\n\t}\n\tlog.V(2).Infof(\"%+v\", index)\n\n\tindex.Key = []string{\"g\", \"o\"}\n\terr = col.EnsureIndex(index)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\t//return err\n\t}\n\tlog.V(2).Infof(\"%+v\", index)\n\n\tindex.Key = []string{\"g\", \"p\"}\n\terr = col.EnsureIndex(index)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\t//return err\n\t}\n\tlog.V(2).Infof(\"%+v\", index)\n\n\tindex.Key = []string{\"g\", \"s\", \"p\"}\n\terr = col.EnsureIndex(index)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\t//return err\n\t}\n\tlog.V(2).Infof(\"%+v\", index)\n\n\tindex.Key = []string{\"g\", \"s\", \"o\"}\n\terr = col.EnsureIndex(index)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\t//return err\n\t}\n\tlog.V(2).Infof(\"%+v\", index)\n\n\tindex.Key = []string{\"g\", \"p\", \"o\"}\n\terr = col.EnsureIndex(index)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\t//return err\n\t}\n\tlog.V(2).Infof(\"%+v\", index)\n\n\tindex.Key = []string{\"g\", \"s\", \"p\", \"o\"}\n\tindex.Unique = true\n\tindex.DropDups = true\n\terr = col.EnsureIndex(index)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\t//return err\n\t}\n\tlog.V(2).Infof(\"%+v\", index)\n\n\treturn nil\n}", "func (b *mysql) Index(table *Table, index *Index) string {\n\tlog.Printf(\"create index:%+v\", index)\n\tvar obj = \"INDEX\"\n\tif index.Unique {\n\t\tobj = \"UNIQUE INDEX\"\n\t}\n\treturn fmt.Sprintf(\"CREATE %s %s ON %s (%s);\", obj, index.Name, table.Name, b.columns(nil, index.Fields, true, false, false))\n}", "func (t *Table) Index(idxName string) *Table {\n\tt.columns[len(t.columns)-1].IdxName = idxName\n\tt.columns[len(t.columns)-1].IsIndex = true\n\treturn t\n}", "func (t Table) Index(index Index) error {\n\treturn t.collection.EnsureIndex(mgo.Index{\n\t\tKey: index.Key,\n\t\tUnique: index.Unique,\n\t\tDropDups: !index.Dups,\n\t\tBackground: index.Background,\n\t\tSparse: index.Sparse,\n\t})\n}", "func (b *Blueprint) Index(columns []string, name string, algorithm string) *Blueprint {\n\treturn b.indexCommand(\"index\", columns, name, algorithm)\n}", "func (r *relation) Index() []*engine.IndexTableDef {\n\treturn helper.Index(*r.tbl)\n}", "func (e *Engine) setIndex(index int64) {\n\te.Index = index\n\te.Name = naming.Name(index)\n}", "func updateDBIndexes(mi *modelInfo) {\n\tadapter := adapters[db.DriverName()]\n\t// update column indexes\n\tfor colName, fi := range mi.fields.registryByJSON {\n\t\tif !fi.index {\n\t\t\tcontinue\n\t\t}\n\t\tif !adapter.indexExists(mi.tableName, fmt.Sprintf(\"%s_%s_index\", mi.tableName, colName)) {\n\t\t\tcreateColumnIndex(mi.tableName, colName)\n\t\t}\n\t}\n}", "func DB_IndexAccount(db gorm.DB) {\n\n\tcols := []string{\n\t\t\"acc_active\", \"company\", \"ticker\", \"acc_ref\",\n\t\t\"on_hold\"\t, \"is_client\", \"is_supplier\", \"online\"}\n\n\tfor _, c := range cols {\n\t\tdb.Model(&Account{}).AddIndex(\"idx_\" + c, c)\n\t}\n}", "func (Friendship) Indexes() []ent.Index {\n\treturn []ent.Index{\n\t\tindex.Fields(\"created_at\"),\n\t}\n}", "func indexTableSchema() *memdb.TableSchema {\n\treturn &memdb.TableSchema{\n\t\tName: \"index\",\n\t\tIndexes: map[string]*memdb.IndexSchema{\n\t\t\t\"id\": &memdb.IndexSchema{\n\t\t\t\tName: \"id\",\n\t\t\t\tAllowMissing: false,\n\t\t\t\tUnique: true,\n\t\t\t\tIndexer: &memdb.StringFieldIndex{\n\t\t\t\t\tField: \"Key\",\n\t\t\t\t\tLowercase: true,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "func (st *Schema) addIndex(pk bool, name string, cols []IndexColumn) bool {\n\tif reflect.DeepEqual(st.PK, cols) {\n\t\treturn false\n\t}\n\tfor _, ind := range st.Indexes {\n\t\tif reflect.DeepEqual(ind.Columns, cols) {\n\t\t\tif pk {\n\t\t\t\tst.PrimaryKey = ind.Index\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t}\n\tst.Indexes = append(st.Indexes, SchemaIndex{\n\t\tIndex: name,\n\t\tColumns: cols,\n\t})\n\tif pk {\n\t\tst.PrimaryKey = name\n\t}\n\treturn true\n}", "func (s Serializer) IndexColumn(buf cmpbin.WriteableBytesBuffer, c IndexColumn) (err error) {\n\tdefer recoverTo(&err)\n\n\tif !c.Descending {\n\t\tpanicIf(buf.WriteByte(0))\n\t} else {\n\t\tpanicIf(buf.WriteByte(1))\n\t}\n\t_, err = cmpbin.WriteString(buf, c.Property)\n\treturn\n}", "func OrIndexColumns(db models.XODB, schema string, table string, index string) ([]*models.IndexColumn, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`column_position AS seq_no, ` +\n\t\t`LOWER(column_name) AS column_name ` +\n\t\t`FROM all_ind_columns ` +\n\t\t`WHERE index_owner = UPPER(:1) AND table_name = :2 AND index_name = UPPER(:3) ` +\n\t\t`ORDER BY column_position`\n\n\t// run query\n\tmodels.XOLog(sqlstr, schema, table, index)\n\tq, err := db.Query(sqlstr, schema, table, index)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer q.Close()\n\n\t// load results\n\tres := []*models.IndexColumn{}\n\tfor q.Next() {\n\t\tic := models.IndexColumn{}\n\n\t\t// scan\n\t\terr = q.Scan(&ic.SeqNo, &ic.ColumnName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres = append(res, &ic)\n\t}\n\n\treturn res, nil\n}", "func idIndex() mgo.Index {\n\treturn mgo.Index{\n\t\tKey: []string{\"id\"},\n\t\tUnique: true,\n\t\tDropDups: true,\n\t\tBackground: true,\n\t\tSparse: true,\n\t}\n}", "func (i *ContactIndexer) Index(db *sql.DB, rebuild, cleanup bool) (string, error) {\n\tvar err error\n\n\t// find our physical index\n\tphysicalIndexes := i.FindIndexes()\n\n\tphysicalIndex := \"\"\n\tif len(physicalIndexes) > 0 {\n\t\tphysicalIndex = physicalIndexes[0]\n\t}\n\n\t// whether we need to remap our alias after building\n\tremapAlias := false\n\n\t// doesn't exist or we are rebuilding, create it\n\tif physicalIndex == \"\" || rebuild {\n\t\tphysicalIndex, err = i.createNewIndex(contactsSettings)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"error creating new index\")\n\t\t}\n\t\ti.log().WithField(\"index\", physicalIndex).Info(\"created new physical index\")\n\t\tremapAlias = true\n\t}\n\n\t// if the index didn't previously exist or we are rebuilding, remap to our alias\n\tif remapAlias {\n\t\terr := i.updateAlias(physicalIndex)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"error updating alias\")\n\t\t}\n\t\tremapAlias = false\n\t}\n\n\tlastModified, err := i.GetLastModified(physicalIndex)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"error finding last modified\")\n\t}\n\n\ti.log().WithField(\"index\", physicalIndex).WithField(\"last_modified\", lastModified).Debug(\"indexing newer than last modified\")\n\n\t// now index our docs\n\tstart := time.Now()\n\tindexed, deleted, err := i.indexModified(db, physicalIndex, lastModified.Add(-5*time.Second), rebuild)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"error indexing documents\")\n\t}\n\n\ti.recordComplete(indexed, deleted, time.Since(start))\n\n\t// cleanup our aliases if appropriate\n\tif cleanup {\n\t\terr := i.cleanupIndexes()\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"error cleaning up old indexes\")\n\t\t}\n\t}\n\n\treturn physicalIndex, nil\n}", "func ConfigureIndexes(mClient *mongo.Client) {\n\tcollection := getMarkdownCollection(mClient)\n\n\tindex := []mongo.IndexModel{\n\t\t{\n\t\t\tKeys: bsonx.Doc{\n\t\t\t\t{Key: \"title\", Value: bsonx.String(\"text\")},\n\t\t\t\t{Key: \"body\", Value: bsonx.String(\"text\")},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tKeys: bsonx.Doc{{Key: \"createDate\", Value: bsonx.Int32(1)}},\n\t\t},\n\t}\n\tname, err := collection.Indexes().CreateMany(context.TODO(), index)\n\tif err != nil {\n\t\tfmt.Printf(\"Error Creating Text Index: %s\", err)\n\t\treturn\n\t}\n\tfmt.Printf(\"Index Created: %s\\n\", name)\n}", "func updateIndex(indexName string, objects []algoliasearch.Object) error {\n\n\tindex := algoliaClient.InitIndex(indexName)\n\terr := populateIndex(index, objects)\n\tif err != nil {\n\t\treturn errors.New(\"Error updating index -\" + err.Error())\n\t}\n\n\treturn nil\n}", "func createIndexes(db *sql.DB, table string) error {\n\tindexes := []string{}\n\n\tswitch table {\n\tcase \"dfp\":\n\t\tindexes = []string{\n\t\t\t\"CREATE INDEX IF NOT EXISTS dfp_metrics ON dfp (CODE, ID_CIA, YEAR, VL_CONTA);\",\n\t\t\t\"CREATE INDEX IF NOT EXISTS dfp_year_ver ON dfp (ID_CIA, YEAR, VERSAO);\",\n\t\t}\n\tcase \"itr\":\n\t\tindexes = []string{\n\t\t\t\"CREATE INDEX IF NOT EXISTS itr_metrics ON itr (CODE, ID_CIA, YEAR, VL_CONTA);\",\n\t\t\t\"CREATE INDEX IF NOT EXISTS itr_quarter_ver ON itr (ID_CIA, DT_FIM_EXERC, VERSAO);\",\n\t\t}\n\tcase \"stock_quotes\":\n\t\tindexes = []string{\n\t\t\t\"CREATE UNIQUE INDEX IF NOT EXISTS stock_quotes_stockdate ON stock_quotes (stock, date);\",\n\t\t}\n\tcase \"fii_dividends\":\n\t\tindexes = []string{\n\t\t\t\"CREATE UNIQUE INDEX IF NOT EXISTS fii_dividends_pk ON fii_dividends (trading_code, base_date);\",\n\t\t}\n\t}\n\n\tfor _, idx := range indexes {\n\t\t_, err := db.Exec(idx)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"erro ao criar índice\")\n\t\t}\n\t}\n\n\treturn nil\n}", "func (index *tableIndex) build(values [][]interface{}, metadata *TableScheme) {\n\tif metadata.Constraints == nil {\n\t\treturn\n\t}\n\tif len(metadata.Constraints.uniqueColumns) == 0 {\n\t\treturn\n\t}\n\n\t// clear index\n\tindex.primaryIndex = make(map[string]bool)\n\tindex.uniqueIndex = make(map[string][]int64)\n\n\tfor i, v := range values {\n\t\tuniqueColumns := metadata.columnsToIndices(metadata.Constraints.uniqueColumns)\n\t\tuniqueHash := index.hashcode(v, uniqueColumns...)\n\t\tbucket, ok := index.uniqueIndex[uniqueHash]\n\t\tif ok {\n\t\t\tbucket = append(bucket, int64(i))\n\t\t\tindex.uniqueIndex[uniqueHash] = bucket\n\t\t} else {\n\t\t\tbucket = make([]int64, 0)\n\t\t\tbucket = append(bucket, int64(i))\n\t\t\tindex.uniqueIndex[uniqueHash] = bucket\n\t\t}\n\t}\n}", "func (Project) Indexes() []ent.Index {\n\treturn []ent.Index{\n\t\tindex.Fields(\"name\").\n\t\t\tEdges(\"type\").\n\t\t\tUnique(),\n\t}\n}", "func (i *Index) Index(docs []index.Document, opts interface{}) error {\n blk := i.conn.Bulk()\n\tfor _, doc := range docs {\n //fmt.Println(\"indexing \", doc.Id)\n\t\treq := elastic.NewBulkIndexRequest().Index(i.name).Type(\"doc\").Id(doc.Id).Doc(doc.Properties)\n\t\tblk.Add(req)\n\t\t/*_, err := i.conn.Index().Index(i.name).Type(\"doc\").Id(doc.Id).BodyJson(doc.Properties).Do()\n if err != nil {\n // Handle error\n panic(err)\n }*/\n //fmt.Printf(\"Indexed tweet %s to index %s, type %s\\n\", put2.Id, put2.Index, put2.Type)\n\t}\n\t//_, err := blk.Refresh(true).Do()\n\t_, err := blk.Refresh(false).Do()\n if err != nil {\n panic(err)\n fmt.Println(\"Get Error during indexing\", err)\n }\n\treturn err\n\t//return nil\n}", "func init() {\n\tindexFields := []string{\"name\"}\n\tconfig.CreateHashIndexedCollection(CollectionName, indexFields)\n}", "func (s *FieldStatsService) Index(index ...string) *FieldStatsService {\n\ts.index = append(s.index, index...)\n\treturn s\n}", "func BuildIndexInfo(\n\tctx sessionctx.Context,\n\tallTableColumns []*model.ColumnInfo,\n\tindexName model.CIStr,\n\tisPrimary bool,\n\tisUnique bool,\n\tisGlobal bool,\n\tindexPartSpecifications []*ast.IndexPartSpecification,\n\tindexOption *ast.IndexOption,\n\tstate model.SchemaState,\n) (*model.IndexInfo, error) {\n\tif err := checkTooLongIndex(indexName); err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\tidxColumns, mvIndex, err := buildIndexColumns(ctx, allTableColumns, indexPartSpecifications)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\t// Create index info.\n\tidxInfo := &model.IndexInfo{\n\t\tName: indexName,\n\t\tColumns: idxColumns,\n\t\tState: state,\n\t\tPrimary: isPrimary,\n\t\tUnique: isUnique,\n\t\tGlobal: isGlobal,\n\t\tMVIndex: mvIndex,\n\t}\n\n\tif indexOption != nil {\n\t\tidxInfo.Comment = indexOption.Comment\n\t\tif indexOption.Visibility == ast.IndexVisibilityInvisible {\n\t\t\tidxInfo.Invisible = true\n\t\t}\n\t\tif indexOption.Tp == model.IndexTypeInvalid {\n\t\t\t// Use btree as default index type.\n\t\t\tidxInfo.Tp = model.IndexTypeBtree\n\t\t} else {\n\t\t\tidxInfo.Tp = indexOption.Tp\n\t\t}\n\t} else {\n\t\t// Use btree as default index type.\n\t\tidxInfo.Tp = model.IndexTypeBtree\n\t}\n\n\treturn idxInfo, nil\n}", "func composeIndex(tblName string, col *column) string {\n\tif col.IsIndex {\n\t\treturn \"CREATE INDEX \" + applyIdxConcurrency(col.IsIdxConcurrent) + applyExistence(col.IfExists) +\n\t\t\tcol.IdxName + \" ON \" + tblName + \" (\" + col.Name + \")\" + applyIncludes(col.Includes)\n\t}\n\n\tif col.IsUnique {\n\t\treturn \"CREATE UNIQUE INDEX \" + applyIdxConcurrency(col.IsIdxConcurrent) + applyExistence(col.IfExists) +\n\t\t\tcol.IdxName + \" ON \" + tblName + \" (\" + col.Name + \")\" + applyIncludes(col.Includes)\n\t}\n\n\tif col.ForeignKey != nil {\n\t\tif col.IsIdxConcurrent {\n\t\t\tconcurrentFk := \"\"\n\t\t\twords := strings.Fields(*col.ForeignKey)\n\t\t\tfor _, word := range words {\n\t\t\t\tseq := \" \" + word + \" \"\n\t\t\t\tif word == Constraint {\n\t\t\t\t\tseq += \" \" + Concurrently + \" \"\n\t\t\t\t}\n\t\t\t\tconcurrentFk += seq\n\t\t\t}\n\n\t\t\treturn concurrentFk\n\t\t}\n\n\t\treturn *col.ForeignKey\n\t}\n\n\treturn \"\"\n}", "func (s *BasePlSqlParserListener) EnterIndex_properties(ctx *Index_propertiesContext) {}", "func (Like) Indexes() []ent.Index {\n\treturn []ent.Index{\n\t\tindex.Fields(\"user_id\").Edges(\"restaurant\").Unique(),\n\t}\n}", "func Index(s *mgo.Session) {\n\tsession := s.Copy()\n\tdefer session.Close()\n\n\tcontext := session.DB(\"store\").C(\"locations\")\n\n\tindex := mgo.Index{\n\t\tKey: []string{\"id\"}, //Index key fields; prefix name with dash (-) for descending order\n\t\tUnique: true, //Prevent two documents from having the same index key\n\t\tDropDups: true, //Drop documents with the same index key as a previously indexed one\n\t\tBackground: true, //Build index in background and return immediately\n\t\tSparse: true, //Only index documents containing the Key fields\n\t}\n\n\terr := context.EnsureIndex(index)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n}", "func addIndexes() {\n\tvar err error\n\n\tufIndex1 := mgo.Index{\n\t\tKey: []string{\"codigo\"},\n\t\tUnique: true,\n\t\tBackground: true,\n\t\tSparse: true,\n\t}\n\tmunicipioIndex1 := mgo.Index{\n\t\tKey: []string{\"codigo\"},\n\t\tUnique: true,\n\t\tBackground: true,\n\t\tSparse: true,\n\t}\n\t// Add indexes into MongoDB\n\tsession := Session.Copy()\n\tdefer session.Close()\n\tufCol := session.DB(commons.AppConfig.Database).C(\"ufs\")\n\tmunicipioCol := session.DB(commons.AppConfig.Database).C(\"municipios\")\n\n\t// cria indice codigo para UF\n\terr = ufCol.EnsureIndex(ufIndex1)\n\tif err != nil {\n\t\tlog.Fatalf(\"[addIndexes]: %s\\n\", err)\n\t}\n\tlog.Println(\"Indice para UF criado com sucesso\")\n\n\t// cria indice codigo para Municipio\n\terr = municipioCol.EnsureIndex(municipioIndex1)\n\tif err != nil {\n\t\tlog.Fatalf(\"[addIndexes]: %s\\n\", err)\n\t}\n\tlog.Println(\"Indice para Municipio criado com sucesso\")\n\n}", "func createIndexes(ts *Schema, ti *Info, idxs []schema.Index, store *stor.Stor) {\n\tif len(idxs) == 0 {\n\t\treturn\n\t}\n\tts.Indexes = slices.Clip(ts.Indexes) // copy on write\n\tnold := len(ts.Indexes)\n\tfor i := range idxs {\n\t\tix := &idxs[i]\n\t\tif ts.FindIndex(ix.Columns) != nil {\n\t\t\tpanic(\"duplicate index: \" +\n\t\t\t\tstr.Join(\"(,)\", ix.Columns) + \" in \" + ts.Table)\n\t\t}\n\t\tts.Indexes = append(ts.Indexes, *ix)\n\t}\n\tidxs = ts.SetupNewIndexes(nold)\n\tn := len(ti.Indexes)\n\tti.Indexes = slices.Clip(ti.Indexes) // copy on write\n\tfor i := range idxs {\n\t\tbt := btree.CreateBtree(store, &ts.Indexes[n+i].Ixspec)\n\t\tti.Indexes = append(ti.Indexes, index.OverlayFor(bt))\n\t}\n}", "func (c *index) Meta() *model.IndexInfo {\n\treturn c.idxInfo\n}", "func MyIndexColumns(db XODB, schema string, table string, index string) ([]*IndexColumn, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`seq_in_index AS seq_no, ` +\n\t\t`column_name ` +\n\t\t`FROM information_schema.statistics ` +\n\t\t`WHERE index_schema = ? AND table_name = ? AND index_name = ? ` +\n\t\t`ORDER BY seq_in_index`\n\n\t// run query\n\tXOLog(sqlstr, schema, table, index)\n\tq, err := db.Query(sqlstr, schema, table, index)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer q.Close()\n\n\t// load results\n\tres := []*IndexColumn{}\n\tfor q.Next() {\n\t\tic := IndexColumn{}\n\n\t\t// scan\n\t\terr = q.Scan(&ic.SeqNo, &ic.ColumnName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres = append(res, &ic)\n\t}\n\n\treturn res, nil\n}", "func addIndexes() {\n\tvar err error\n\tuserIndex := mgo.Index{\n\t\tKey: []string{\"email\"},\n\t\tUnique: true,\n\t\tBackground: true,\n\t\tSparse: true,\n\t}\n\n\tauthIndex := mgo.Index{\n\t\tKey: []string{\"sender_id\"},\n\t\tUnique: true,\n\t\tBackground: true,\n\t\tSparse: true,\n\t}\n\n\t// Add indexes into MongoDB\n\tsession := GetSession().Copy()\n\tdefer session.Close()\n\tuserCol := session.DB(AppConfig.MongoDBName).C(\"users\")\n\tauthCol := session.DB(AppConfig.MongoDBName).C(\"auth\")\n\n\terr = userCol.EnsureIndex(userIndex)\n\tif err != nil {\n\t\tlog.Fatalf(\"[addIndexes]: %s\\n\", err)\n\t}\n\n\terr = authCol.EnsureIndex(authIndex)\n\tif err != nil {\n\t\tlog.Fatalf(\"[addIndexes]: %s\\n\", err)\n\t}\n\n}", "func (indexStore *IndexStore) InitIndex() {\n\tdocs := indexStore.db.getAllDocs()\n\tuniqueIndexes := make(map[string]int)\n\ti := 0\n\tfor _, doc := range docs {\n\t\tif _, present := indexStore.store[doc.Index]; !present {\n\t\t\tindexStore.NewIndex(doc.Index)\n\t\t}\n\t\tindexStore.AddDocument(doc.Index, doc.Title, doc.Contents, doc.Id)\n\t\tuniqueIndexes[doc.Index] = 1\n\n\t\tif i%50 == 0 {\n\t\t\tfmt.Printf(\"%v documents indexed\\n\", i)\n\t\t}\n\t\ti++\n\t}\n\n\tfor index := range uniqueIndexes {\n\t\tindexStore.UpdateIndex(index)\n\t}\n}", "func indexes(t reflect.Type) map[string][]int {\n\tfields := make(map[string][]int)\n\n\tif err := verifyStruct(t); err != nil {\n\t\treturn fields\n\t}\n\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tf := t.Field(i)\n\t\ttag := f.Tag\n\t\tcol := tag.Get(\"sql\")\n\n\t\tif col == \"\" {\n\t\t\tif f.Anonymous && f.Type.Kind() == reflect.Struct {\n\t\t\t\tfor jCol, js := range indexes(f.Type) {\n\t\t\t\t\tfields[jCol] = append([]int{i}, js...)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcontinue\n\t\t}\n\n\t\tfields[col] = []int{i}\n\t}\n\n\treturn fields\n}", "func OrIndexColumns(db XODB, schema string, table string, index string) ([]*IndexColumn, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`column_position AS seq_no, ` +\n\t\t`LOWER(column_name) AS column_name ` +\n\t\t`FROM all_ind_columns ` +\n\t\t`WHERE index_owner = UPPER(:1) AND table_name = UPPER(:2) AND index_name = UPPER(:3) ` +\n\t\t`ORDER BY column_position`\n\n\t// run query\n\tXOLog(sqlstr, schema, table, index)\n\tq, err := db.Query(sqlstr, schema, table, index)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer q.Close()\n\n\t// load results\n\tres := []*IndexColumn{}\n\tfor q.Next() {\n\t\tic := IndexColumn{}\n\n\t\t// scan\n\t\terr = q.Scan(&ic.SeqNo, &ic.ColumnName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres = append(res, &ic)\n\t}\n\n\treturn res, nil\n}", "func (vt *perfSchemaTable) Indices() []table.Index {\n\treturn nil\n}", "func TestIndex(t *testing.T) {\n\tdefer os.RemoveAll(\"testidx\")\n\n\tindex, err := New(\"testidx\", mapping)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer index.Close()\n\n\t// index all the people\n\tfor _, person := range people {\n\t\terr = index.Index(person.Identifier, person)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t}\n\n\ttermQuery := NewTermQuery(\"marti\").SetField(\"name\")\n\tsearchRequest := NewSearchRequest(termQuery)\n\tsearchResult, err := index.Search(searchRequest)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif searchResult.Total != uint64(1) {\n\t\tt.Errorf(\"expected 1 total hit for term query, got %d\", searchResult.Total)\n\t} else {\n\t\tif searchResult.Hits[0].ID != \"a\" {\n\t\t\tt.Errorf(\"expected top hit id 'a', got '%s'\", searchResult.Hits[0].ID)\n\t\t}\n\t}\n\n\ttermQuery = NewTermQuery(\"noone\").SetField(\"name\")\n\tsearchRequest = NewSearchRequest(termQuery)\n\tsearchResult, err = index.Search(searchRequest)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif searchResult.Total != uint64(0) {\n\t\tt.Errorf(\"expected 0 total hits\")\n\t}\n\n\tmatchPhraseQuery := NewMatchPhraseQuery(\"long name\")\n\tsearchRequest = NewSearchRequest(matchPhraseQuery)\n\tsearchResult, err = index.Search(searchRequest)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif searchResult.Total != uint64(1) {\n\t\tt.Errorf(\"expected 1 total hit for phrase query, got %d\", searchResult.Total)\n\t} else {\n\t\tif searchResult.Hits[0].ID != \"b\" {\n\t\t\tt.Errorf(\"expected top hit id 'b', got '%s'\", searchResult.Hits[0].ID)\n\t\t}\n\t}\n\n\ttermQuery = NewTermQuery(\"walking\").SetField(\"name\")\n\tsearchRequest = NewSearchRequest(termQuery)\n\tsearchResult, err = index.Search(searchRequest)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif searchResult.Total != uint64(0) {\n\t\tt.Errorf(\"expected 0 total hits\")\n\t}\n\n\tmatchQuery := NewMatchQuery(\"walking\").SetField(\"name\")\n\tsearchRequest = NewSearchRequest(matchQuery)\n\tsearchResult, err = index.Search(searchRequest)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif searchResult.Total != uint64(1) {\n\t\tt.Errorf(\"expected 1 total hit for match query, got %d\", searchResult.Total)\n\t} else {\n\t\tif searchResult.Hits[0].ID != \"c\" {\n\t\t\tt.Errorf(\"expected top hit id 'c', got '%s'\", searchResult.Hits[0].ID)\n\t\t}\n\t}\n\n\tprefixQuery := NewPrefixQuery(\"bobble\").SetField(\"name\")\n\tsearchRequest = NewSearchRequest(prefixQuery)\n\tsearchResult, err = index.Search(searchRequest)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif searchResult.Total != uint64(1) {\n\t\tt.Errorf(\"expected 1 total hit for prefix query, got %d\", searchResult.Total)\n\t} else {\n\t\tif searchResult.Hits[0].ID != \"d\" {\n\t\t\tt.Errorf(\"expected top hit id 'd', got '%s'\", searchResult.Hits[0].ID)\n\t\t}\n\t}\n\n\tsyntaxQuery := NewSyntaxQuery(\"+name:phone\")\n\tsearchRequest = NewSearchRequest(syntaxQuery)\n\tsearchResult, err = index.Search(searchRequest)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif searchResult.Total != uint64(1) {\n\t\tt.Errorf(\"expected 1 total hit for syntax query, got %d\", searchResult.Total)\n\t} else {\n\t\tif searchResult.Hits[0].ID != \"d\" {\n\t\t\tt.Errorf(\"expected top hit id 'd', got '%s'\", searchResult.Hits[0].ID)\n\t\t}\n\t}\n\n\tmaxAge := 30.0\n\tnumericRangeQuery := NewNumericRangeQuery(nil, &maxAge).SetField(\"age\")\n\tsearchRequest = NewSearchRequest(numericRangeQuery)\n\tsearchResult, err = index.Search(searchRequest)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif searchResult.Total != uint64(2) {\n\t\tt.Errorf(\"expected 2 total hits for numeric range query, got %d\", searchResult.Total)\n\t} else {\n\t\tif searchResult.Hits[0].ID != \"b\" {\n\t\t\tt.Errorf(\"expected top hit id 'b', got '%s'\", searchResult.Hits[0].ID)\n\t\t}\n\t\tif searchResult.Hits[1].ID != \"a\" {\n\t\t\tt.Errorf(\"expected next hit id 'a', got '%s'\", searchResult.Hits[1].ID)\n\t\t}\n\t}\n\n\tstartDate = \"2010-01-01\"\n\tdateRangeQuery := NewDateRangeQuery(&startDate, nil).SetField(\"birthday\")\n\tsearchRequest = NewSearchRequest(dateRangeQuery)\n\tsearchResult, err = index.Search(searchRequest)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif searchResult.Total != uint64(2) {\n\t\tt.Errorf(\"expected 2 total hits for numeric range query, got %d\", searchResult.Total)\n\t} else {\n\t\tif searchResult.Hits[0].ID != \"d\" {\n\t\t\tt.Errorf(\"expected top hit id 'd', got '%s'\", searchResult.Hits[0].ID)\n\t\t}\n\t\tif searchResult.Hits[1].ID != \"c\" {\n\t\t\tt.Errorf(\"expected next hit id 'c', got '%s'\", searchResult.Hits[1].ID)\n\t\t}\n\t}\n\n\t// test that 0 time doesn't get indexed\n\tendDate = \"2010-01-01\"\n\tdateRangeQuery = NewDateRangeQuery(nil, &endDate).SetField(\"birthday\")\n\tsearchRequest = NewSearchRequest(dateRangeQuery)\n\tsearchResult, err = index.Search(searchRequest)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif searchResult.Total != uint64(1) {\n\t\tt.Errorf(\"expected 1 total hit for numeric range query, got %d\", searchResult.Total)\n\t} else {\n\t\tif searchResult.Hits[0].ID != \"b\" {\n\t\t\tt.Errorf(\"expected top hit id 'b', got '%s'\", searchResult.Hits[0].ID)\n\t\t}\n\t}\n\n\t// test behavior of arrays\n\t// make sure we can successfully find by all elements in array\n\ttermQuery = NewTermQuery(\"gopher\").SetField(\"tags\")\n\tsearchRequest = NewSearchRequest(termQuery)\n\tsearchResult, err = index.Search(searchRequest)\n\tif err != nil {\n\t\tt.Error(err)\n\t} else {\n\t\tif searchResult.Total != uint64(1) {\n\t\t\tt.Errorf(\"expected 1 total hit for term query, got %d\", searchResult.Total)\n\t\t} else {\n\t\t\tif searchResult.Hits[0].ID != \"a\" {\n\t\t\t\tt.Errorf(\"expected top hit id 'a', got '%s'\", searchResult.Hits[0].ID)\n\t\t\t}\n\t\t}\n\t}\n\n\ttermQuery = NewTermQuery(\"belieber\").SetField(\"tags\")\n\tsearchRequest = NewSearchRequest(termQuery)\n\tsearchResult, err = index.Search(searchRequest)\n\tif err != nil {\n\t\tt.Error(err)\n\t} else {\n\t\tif searchResult.Total != uint64(1) {\n\t\t\tt.Errorf(\"expected 1 total hit for term query, got %d\", searchResult.Total)\n\t\t} else {\n\t\t\tif searchResult.Hits[0].ID != \"a\" {\n\t\t\t\tt.Errorf(\"expected top hit id 'a', got '%s'\", searchResult.Hits[0].ID)\n\t\t\t}\n\t\t}\n\t}\n\n\ttermQuery = NewTermQuery(\"notintagsarray\").SetField(\"tags\")\n\tsearchRequest = NewSearchRequest(termQuery)\n\tsearchResult, err = index.Search(searchRequest)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif searchResult.Total != uint64(0) {\n\t\tt.Errorf(\"expected 0 total hits\")\n\t}\n\n\t// lookup document a\n\t// expect to find 2 values for field \"tags\"\n\ttagsCount := 0\n\tdoc, err := index.Document(\"a\")\n\tif err != nil {\n\t\tt.Error(err)\n\t} else {\n\t\tfor _, f := range doc.Fields {\n\t\t\tif f.Name() == \"tags\" {\n\t\t\t\ttagsCount++\n\t\t\t}\n\t\t}\n\t}\n\tif tagsCount != 2 {\n\t\tt.Errorf(\"expected to find 2 values for tags\")\n\t}\n}", "func MsIndexColumns(db XODB, schema string, table string, index string) ([]*IndexColumn, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`k.keyno AS seq_no, ` +\n\t\t`k.colid AS cid, ` +\n\t\t`c.name AS column_name ` +\n\t\t`FROM sysindexes i ` +\n\t\t`INNER JOIN sysobjects o ON i.id = o.id ` +\n\t\t`INNER JOIN sysindexkeys k ON k.id = o.id AND k.indid = i.indid ` +\n\t\t`INNER JOIN syscolumns c ON c.id = o.id AND c.colid = k.colid ` +\n\t\t`WHERE o.type = 'U' AND SCHEMA_NAME(o.uid) = $1 AND o.name = $2 AND i.name = $3 ` +\n\t\t`ORDER BY k.keyno`\n\n\t// run query\n\tXOLog(sqlstr, schema, table, index)\n\tq, err := db.Query(sqlstr, schema, table, index)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer q.Close()\n\n\t// load results\n\tres := []*IndexColumn{}\n\tfor q.Next() {\n\t\tic := IndexColumn{}\n\n\t\t// scan\n\t\terr = q.Scan(&ic.SeqNo, &ic.Cid, &ic.ColumnName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres = append(res, &ic)\n\t}\n\n\treturn res, nil\n}", "func ShowIndex(ctx context.Context, db QueryExecutor, schemaName string, table string) ([]*IndexInfo, error) {\n\t/*\n\t\tshow index example result:\n\t\tmysql> show index from test;\n\t\t+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n\t\t| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |\n\t\t+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n\t\t| test | 0 | PRIMARY | 1 | id | A | 0 | NULL | NULL | | BTREE | | |\n\t\t| test | 0 | aid | 1 | aid | A | 0 | NULL | NULL | YES | BTREE | | |\n\t\t+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n\t*/\n\tindices := make([]*IndexInfo, 0, 3)\n\tquery := fmt.Sprintf(\"SHOW INDEX FROM %s\", TableName(schemaName, table))\n\trows, err := db.QueryContext(ctx, query)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tfields, err1 := ScanRow(rows)\n\t\tif err1 != nil {\n\t\t\treturn nil, errors.Trace(err1)\n\t\t}\n\t\tseqInIndex, err1 := strconv.Atoi(string(fields[\"Seq_in_index\"].Data))\n\t\tif err1 != nil {\n\t\t\treturn nil, errors.Trace(err1)\n\t\t}\n\t\tcardinality, err1 := strconv.Atoi(string(fields[\"Cardinality\"].Data))\n\t\tif err1 != nil {\n\t\t\treturn nil, errors.Trace(err1)\n\t\t}\n\t\tindex := &IndexInfo{\n\t\t\tTable: string(fields[\"Table\"].Data),\n\t\t\tNoneUnique: string(fields[\"Non_unique\"].Data) == \"1\",\n\t\t\tKeyName: string(fields[\"Key_name\"].Data),\n\t\t\tColumnName: string(fields[\"Column_name\"].Data),\n\t\t\tSeqInIndex: seqInIndex,\n\t\t\tCardinality: cardinality,\n\t\t}\n\t\tindices = append(indices, index)\n\t}\n\n\treturn indices, nil\n}", "func generateAlterIndex(diff table.Diff) (ops SQLOperations) {\n\tvar ok bool\n\tvar builder StatementBuilder\n\tvar index table.Index\n\n\t// Obtain Index Object\n\tdiffPair, ok := diff.Value.(table.DiffPair)\n\t\n\tif !ok {\n\t\tindex, ok = diff.Value.(table.Index)\n\t} else {\n\t\tindex, ok = diffPair.To.(table.Index)\n\t}\n\n\tif ok {\n\t\tindexName := \"\"\n\n\t\t// Drop\n\t\tif diff.Field == \"PrimaryIndex\" {\n\t\t\tindexName = \"PRIMARY KEY\"\n\n\t\t\tbuilder.Add(\"ALTER TABLE\")\n\t\t\tbuilder.AddQuote(diff.Table)\n\t\t\tbuilder.Add(\"DROP\")\n\t\t\tbuilder.Add(indexName)\n\n\t\t} else if diff.Field == \"SecondaryIndexes\" {\n\t\t\tindexName = fmt.Sprintf(\"%s\", index.Name)\n\n\t\t\tbuilder.Add(\"DROP INDEX\")\n\t\t\tbuilder.AddQuote(indexName)\n\t\t\tbuilder.Add(\"ON\")\n\t\t\tbuilder.AddQuote(diff.Table)\n\t\t}\n\n\t\tremoveOp := SQLOperation{\n\t\t\tStatement: builder.Format(),\n\t\t\tOp: table.Del,\n\t\t\tMetadata: diff.Metadata,\n\t\t}\n\n\t\tbuilder.Reset()\n\t\tbuilder.Add(\"CREATE INDEX\")\n\t\tbuilder.AddQuote(indexName)\n\t\tbuilder.Add(\"ON\")\n\t\tbuilder.AddQuote(diff.Table)\n\t\tbuilder.Add(index.ColumnsSQL())\n\n\t\taddOp := SQLOperation{\n\t\t\tStatement: builder.Format(),\n\t\t\tOp: table.Add,\n\t\t\tMetadata: diff.Metadata,\n\t\t}\n\n\t\tswitch diff.Op {\n\n\t\tcase table.Add:\n\t\t\tops.Add(addOp)\n\n\t\tcase table.Del:\n\t\t\tops.Add(removeOp)\n\n\t\tcase table.Mod:\n\t\t\tdiffPair := diff.Value.(table.DiffPair)\n\t\t\ttoIndex, ok := diffPair.To.(table.Index)\n\n\t\t\tif ok {\n\t\t\t\t// Process modification by type\n\t\t\t\tif diff.Property == \"Name\" {\n\n\t\t\t\t\tfromIndex, ok := diffPair.From.(table.Index)\n\t\t\t\t\tif ok {\n\t\t\t\t\t\tbuilder.Reset()\n\t\t\t\t\t\tbuilder.Add(\"ALTER TABLE\")\n\t\t\t\t\t\tbuilder.AddQuote(diff.Table)\n\t\t\t\t\t\tbuilder.Add(\"RENAME\")\n\t\t\t\t\t\tbuilder.AddFormat(\"%s %s\", fromIndex.Name, toIndex.Name)\n\n\t\t\t\t\t\tops.Add(SQLOperation{\n\t\t\t\t\t\t\tStatement: builder.Format(),\n\t\t\t\t\t\t\tOp: table.Mod,\n\t\t\t\t\t\t\tMetadata: diff.Metadata,\n\t\t\t\t\t\t})\n\t\t\t\t\t} else {\n\t\t\t\t\t\tutil.LogError(\"Gen SQL: ALTER INDEX: MOD: Could not obtain from index\")\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// if anything other than a rename, we need to drop the index and re-add\n\t\t\t\t\tops.Add(removeOp)\n\t\t\t\t\tops.Add(addOp)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tutil.LogError(\"Obtaining Index FAILED\")\n\t\t\t}\n\t\t}\n\t} else {\n\t\tutil.LogError(\"Obtaining Index FAILED\")\n\t}\n\treturn ops\n}", "func (i *Index) Index(docs []index.Document, options interface{}) error {\n\n\tvar opts IndexingOptions\n\thasOpts := false\n\tif options != nil {\n\t\tif opts, hasOpts = options.(IndexingOptions); !hasOpts {\n\t\t\treturn errors.New(\"invalid indexing options\")\n\t\t}\n\t}\n\n\tconn := i.getConn()\n\tdefer conn.Close()\n\n\tn := 0\n\n\tfor _, doc := range docs {\n\t\targs := make(redis.Args, 0, len(i.md.Fields)*2+4)\n\t\targs = append(args, i.name, doc.Id, doc.Score)\n\t\t// apply options\n\t\tif hasOpts {\n\t\t\tif opts.NoSave {\n\t\t\t\targs = append(args, \"NOSAVE\")\n\t\t\t}\n\t\t\tif opts.Language != \"\" {\n\t\t\t\targs = append(args, \"LANGUAGE\", opts.Language)\n\t\t\t}\n\t\t}\n\n\t\targs = append(args, \"FIELDS\")\n\n\t\tfor k, f := range doc.Properties {\n\t\t\targs = append(args, k, f)\n\t\t}\n\n\t\tif err := conn.Send(i.commandPrefix+\".ADD\", args...); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn++\n\t}\n\n\tif err := conn.Flush(); err != nil {\n\t\treturn err\n\t}\n\n\tfor n > 0 {\n\t\tif _, err := conn.Receive(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn--\n\t}\n\n\treturn nil\n}", "func AddIndexColumnFlag(tblInfo *model.TableInfo, indexInfo *model.IndexInfo) {\n\tif indexInfo.Primary {\n\t\tfor _, col := range indexInfo.Columns {\n\t\t\ttblInfo.Columns[col.Offset].AddFlag(mysql.PriKeyFlag)\n\t\t}\n\t\treturn\n\t}\n\n\tcol := indexInfo.Columns[0]\n\tif indexInfo.Unique && len(indexInfo.Columns) == 1 {\n\t\ttblInfo.Columns[col.Offset].AddFlag(mysql.UniqueKeyFlag)\n\t} else {\n\t\ttblInfo.Columns[col.Offset].AddFlag(mysql.MultipleKeyFlag)\n\t}\n}", "func addIndexes() {\n\tvar err error\n\tuserIndex := mgo.Index{\n\t\tKey: []string{\"email\"},\n\t\tUnique: true,\n\t\tBackground: true,\n\t\tSparse: true,\n\t}\n\t// Add indexes into MongoDB\n\tsession := GetSession().Copy()\n\tdefer session.Close()\n\tuserCol := session.DB(AppConfig.Database).C(\"users\")\n\n\terr = userCol.EnsureIndex(userIndex)\n\tif err != nil {\n\t\tlog.Fatalf(\"[addIndexes]: %s\\n\", err)\n\t}\n}", "func (p *planner) CreateIndex(n *parser.CreateIndex) (planNode, error) {\n\ttableDesc, err := p.getTableDesc(n.Table)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif _, err := tableDesc.FindIndexByName(string(n.Name)); err == nil {\n\t\tif n.IfNotExists {\n\t\t\t// Noop.\n\t\t\treturn &valuesNode{}, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"index %q already exists\", string(n.Name))\n\t}\n\n\tif err := p.checkPrivilege(tableDesc, privilege.CREATE); err != nil {\n\t\treturn nil, err\n\t}\n\n\tindexDesc := IndexDescriptor{\n\t\tName: string(n.Name),\n\t\tUnique: n.Unique,\n\t\tColumnNames: n.Columns,\n\t}\n\ttableDesc.Indexes = append(tableDesc.Indexes, indexDesc)\n\n\tif err := tableDesc.AllocateIDs(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// `indexDesc` changed on us when we called `tableDesc.AllocateIDs()`.\n\tindexDesc = tableDesc.Indexes[len(tableDesc.Indexes)-1]\n\n\t// Get all the rows affected.\n\t// TODO(vivek): Avoid going through Select.\n\t// TODO(tamird): Support partial indexes?\n\trow, err := p.Select(&parser.Select{\n\t\tExprs: parser.SelectExprs{parser.StarSelectExpr()},\n\t\tFrom: parser.TableExprs{&parser.AliasedTableExpr{Expr: n.Table}},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Construct a map from column ID to the index the value appears at within a\n\t// row.\n\tcolIDtoRowIndex := map[ColumnID]int{}\n\tfor i, name := range row.Columns() {\n\t\tc, err := tableDesc.FindColumnByName(name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcolIDtoRowIndex[c.ID] = i\n\t}\n\n\t// TODO(tamird): This will fall down in production use. We need to do\n\t// something better (see #2036). In particular, this implementation\n\t// has the following problems:\n\t// - Very large tables will generate an enormous batch here. This\n\t// isn't really a problem in itself except that it will exacerbate\n\t// the other issue:\n\t// - Any non-quiescent table that this runs against will end up with\n\t// an inconsistent index. This is because as inserts/updates continue\n\t// to roll in behind this operation's read front, the written index\n\t// will become incomplete/stale before it's written.\n\tvar b client.Batch\n\tb.Put(MakeDescMetadataKey(tableDesc.GetID()), tableDesc)\n\n\t// We need a dummy element in this slice to account for the `Put`\n\t// above; the `Put` won't fail, but if we don't add an entry for it,\n\t// we'll end up with out-of-bounds error when we iterate over the\n\t// writes in the error case.\n\twrites := []write{{}}\n\n\tfor row.Next() {\n\t\trowVals := row.Values()\n\n\t\tsecondaryIndexEntries, err := encodeSecondaryIndexes(\n\t\t\ttableDesc.ID, []IndexDescriptor{indexDesc}, colIDtoRowIndex, rowVals)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, secondaryIndexEntry := range secondaryIndexEntries {\n\t\t\tif log.V(2) {\n\t\t\t\tlog.Infof(\"CPut %q -> %v\", secondaryIndexEntry.key, secondaryIndexEntry.value)\n\t\t\t}\n\t\t\tb.CPut(secondaryIndexEntry.key, secondaryIndexEntry.value, nil)\n\n\t\t\tvar w write\n\n\t\t\tfor i, columnID := range indexDesc.ColumnIDs {\n\t\t\t\tw.values = append(w.values, writePair{\n\t\t\t\t\tcol: indexDesc.ColumnNames[i],\n\t\t\t\t\tval: rowVals[colIDtoRowIndex[columnID]],\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tw.constraint = &indexDesc\n\n\t\t\twrites = append(writes, w)\n\t\t}\n\t}\n\n\tif err := row.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Mark transaction as operating on the system DB.\n\tp.txn.SetSystemDBTrigger()\n\tif err := p.txn.Run(&b); err != nil {\n\t\tfor i, result := range b.Results {\n\t\t\tif _, ok := result.Err.(*proto.ConditionFailedError); ok {\n\t\t\t\tw := writes[i]\n\n\t\t\t\treturn nil, fmt.Errorf(\"duplicate key value %s violates unique constraint %q\", w.values, w.constraint.Name)\n\t\t\t}\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn &valuesNode{}, nil\n}", "func (b *Blueprint) indexCommand(typ string, columns []string, index string, algorithm string) *Blueprint {\n\t// if no name was specified for this index, we will create one using a bsaic\n\t// convention of the table name, followed by the columns, followd by an\n\t// index type, such as primary or index, which makes the index unique.\n\tif index == \"\" {\n\t\tindex = b.createIndexName(typ, columns)\n\t}\n\n\treturn b.addCommand(typ, &CommandOptions{\n\t\tIndex: index,\n\t\tColumns: columns,\n\t\tAlgorithm: algorithm,\n\t})\n}", "func createColumnIndex(tableName, colName string) {\n\tadapter := adapters[db.DriverName()]\n\tquery := fmt.Sprintf(`\n\t\tCREATE INDEX %s ON %s (%s)\n\t`, fmt.Sprintf(\"%s_%s_index\", tableName, colName), adapter.quoteTableName(tableName), colName)\n\tdbExecuteNoTx(query)\n}", "func (p *ThriftHiveMetastoreClient) AlterIndex(ctx context.Context, dbname string, base_tbl_name string, idx_name string, new_idx *Index) (err error) {\n var _args108 ThriftHiveMetastoreAlterIndexArgs\n _args108.Dbname = dbname\n _args108.BaseTblName = base_tbl_name\n _args108.IdxName = idx_name\n _args108.NewIdx_ = new_idx\n var _result109 ThriftHiveMetastoreAlterIndexResult\n if err = p.Client_().Call(ctx, \"alter_index\", &_args108, &_result109); err != nil {\n return\n }\n switch {\n case _result109.O1!= nil:\n return _result109.O1\n case _result109.O2!= nil:\n return _result109.O2\n }\n\n return nil\n}", "func m4accountIndices(db *IndexerDb, state *MigrationState) error {\n\tsqlLines := []string{\n\t\t\"CREATE INDEX IF NOT EXISTS account_asset_by_addr ON account_asset ( addr )\",\n\t\t\"CREATE INDEX IF NOT EXISTS asset_by_creator_addr ON asset ( creator_addr )\",\n\t\t\"CREATE INDEX IF NOT EXISTS app_by_creator ON app ( creator )\",\n\t\t\"CREATE INDEX IF NOT EXISTS account_app_by_addr ON account_app ( addr )\",\n\t}\n\treturn sqlMigration(db, state, sqlLines)\n}", "func (api *Api) createIndexes() {\n\t// username and email will be unique.\n\tkeys := bsonx.Doc{\n\t\t{Key: \"username\", Value: bsonx.Int32(1)},\n\t\t{Key: \"email\", Value: bsonx.Int32(1)},\n\t}\n\tpeople := api.DB.Collection(\"people\")\n\tdb.SetIndexes(people, keys)\n}", "func TestBaseModel_EnsureIndexes(t *testing.T) {\n\tconfig := mongo.Configuration{\n\t\tURL: \"mongodb://localhost:27017/some-test-db\",\n\t\tUseSSL: false,\n\t\tSSLCert: []byte{},\n\t\tPingFrequency: 100,\n\t}\n\n\tdb, teardown := mongo.InitMongoFromConfig(config)\n\tdefer teardown()\n\n\t// initialize the collection..\n\tdb.C(\"some-collection\").Insert(&testDocument{})\n\n\tmodel := &BaseModel{\n\t\tDB: db,\n\t\tCollectionName: \"some-collection\",\n\t\tIndexes: []*mgo.Index{\n\t\t\t{\n\t\t\t\tUnique: true,\n\t\t\t\tName: \"test_1\",\n\t\t\t\tKey: []string{\"first_key\"},\n\t\t\t},\n\t\t},\n\t}\n\n\tEnsureIndexes([]Model{model}, false)\n\n\tindexes, err := db.C(\"some-collection\").Indexes()\n\tassert.Nil(t, err)\n\tassert.Equal(t, []mgo.Index{\n\t\t{Key: []string{\"_id\"}, Name: \"_id_\"},\n\t\t{Key: []string{\"first_key\"}, Name: \"test_1\", Unique: true},\n\t}, indexes)\n}", "func (meta metadata) getIndexes() []mgo.Index {\n\tindexes := []mgo.Index{}\n\tfor _, field := range meta.findFieldsWithIndex() {\n\t\tindexes = append(indexes, mgo.Index{Key: []string{field.key}, Unique: field.unique})\n\t}\n\treturn indexes\n}", "func (st *Schema) addCreateIndex(ci sql.CreateIndexStmt) {\n\tst.Indexes = append(st.Indexes, SchemaIndex{\n\t\tIndex: ci.Index,\n\t\tColumns: st.toIndexColumns(ci.IndexedColumns),\n\t})\n}", "func (engine *Engine) Index(docId uint64, data types.DocData,\n\tforceUpdate ...bool) {\n\n\tvar force bool\n\tif len(forceUpdate) > 0 {\n\t\tforce = forceUpdate[0]\n\t}\n\n\t// if engine.HasDoc(docId) {\n\t// \tengine.RemoveDoc(docId)\n\t// }\n\n\t// data.Tokens\n\tengine.internalIndexDoc(docId, data, force)\n\n\thash := murmur.Sum32(fmt.Sprintf(\"%d\", docId)) %\n\t\tuint32(engine.initOptions.StoreShards)\n\n\tif engine.initOptions.UseStore && docId != 0 {\n\t\tengine.storeIndexDocChans[hash] <- storeIndexDocReq{\n\t\t\tdocId: docId, data: data}\n\t}\n}", "func (self *LSHforest) Index() {\n\t// iterate over the empty indexed hash tables\n\tfor i := range self.hashTables {\n\t\t// transfer contents from the corresponding band in the initial hash table\n\t\tfor HashedSignature, keys := range self.InitialHashTables[i] {\n\t\t\tself.hashTables[i] = append(self.hashTables[i], band{HashedSignature, keys})\n\t\t}\n\t\t// sort the new hashtable and store it in the corresponding slot in the indexed hash tables\n\t\tsort.Sort(self.hashTables[i])\n\t\t// clear the initial hashtable that has just been processed\n\t\tself.InitialHashTables[i] = make(initialHashTable)\n\t}\n}", "func NewIndex(unique bool, columns []Column) *Index {\n\treturn &Index{\n\t\tbtree: btree.NewBTreeG[Doc](func(a, b Doc) bool {\n\t\t\treturn Order(a, b, columns, !unique) < 0\n\t\t}),\n\t}\n}", "func (ts *STableSpec) Indexes() []STableIndex {\n\treturn ts._indexes\n}", "func (i *Index) Create() error {\n\n\tdoc := mapping{Properties: map[string]mappingProperty{}}\n\tfor _, f := range i.md.Fields {\n\t\tdoc.Properties[f.Name] = mappingProperty{}\n\t\tfs, err := fieldTypeString(f.Type)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdoc.Properties[f.Name][\"type\"] = fs\n\t}\n\n // Added for apple to apple benchmark\n doc.Properties[\"body\"][\"type\"] = \"text\"\n doc.Properties[\"body\"][\"analyzer\"] = \"my_english_analyzer\"\n doc.Properties[\"body\"][\"search_analyzer\"] = \"whitespace\"\n doc.Properties[\"body\"][\"index_options\"] = \"offsets\"\n //doc.Properties[\"body\"][\"test\"] = \"test\"\n index_map := map[string]int{\n \"number_of_shards\" : 1,\n \"number_of_replicas\" : 0,\n }\n analyzer_map := map[string]interface{}{\n \"my_english_analyzer\": map[string]interface{}{\n \"tokenizer\": \"standard\",\n \"char_filter\": []string{ \"html_strip\" } ,\n \"filter\" : []string{\"english_possessive_stemmer\", \n \"lowercase\", \"english_stop\", \n \"english_stemmer\", \n \"asciifolding\", \"icu_folding\"},\n },\n }\n filter_map := map[string]interface{}{\n \"english_stop\": map[string]interface{}{\n \"type\": \"stop\",\n \"stopwords\": \"_english_\",\n },\n \"english_possessive_stemmer\": map[string]interface{}{\n \"type\": \"stemmer\",\n \"language\": \"possessive_english\",\n },\n \"english_stemmer\" : map[string]interface{}{\n \"type\" : \"stemmer\",\n \"name\" : \"english\",\n },\n \"my_folding\": map[string]interface{}{\n \"type\": \"asciifolding\",\n \"preserve_original\": \"false\",\n },\n }\n analysis_map := map[string]interface{}{\n \"analyzer\": analyzer_map,\n \"filter\" : filter_map,\n }\n settings := map[string]interface{}{\n \"index\": index_map,\n \"analysis\": analysis_map,\n }\n\n // TODO delete?\n\t// we currently manually create the autocomplete mapping\n\t/*ac := mapping{\n\t\tProperties: map[string]mappingProperty{\n\t\t\t\"sugg\": mappingProperty{\n\t\t\t\t\"type\": \"completion\",\n\t\t\t\t\"payloads\": true,\n\t\t\t},\n\t\t},\n\t}*/\n\n\tmappings := map[string]mapping{\n\t\ti.typ: doc,\n //\t\"autocomplete\": ac,\n\t}\n\n fmt.Println(mappings)\n\n\t//_, err := i.conn.CreateIndex(i.name).BodyJson(map[string]interface{}{\"mappings\": mappings}).Do()\n\t_, err := i.conn.CreateIndex(i.name).BodyJson(map[string]interface{}{\"mappings\": mappings, \"settings\": settings}).Do()\n\n if err != nil {\n fmt.Println(\"Error \", err)\n\t\tfmt.Println(\"!!!!Get Error when using client to create index\")\n\t}\n\n\treturn err\n}", "func MakeIndex() error {\n\n\treturn nil\n}", "func (db *DB) Index(ctx context.Context, i services.Consumable) error {\n\tvar (\n\t\terr error\n\t\tjob = db.stream.NewJob(\"index\")\n\t\tsess = db.db.NewSession(job)\n\t)\n\tjob.KeyValue(\"id\", i.ID())\n\tjob.KeyValue(\"chain_id\", i.ChainID())\n\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tjob.CompleteKv(health.Error, health.Kvs{\"err\": err.Error()})\n\t\t\treturn\n\t\t}\n\t\tjob.Complete(health.Success)\n\t}()\n\n\t// Create db tx\n\tvar dbTx *dbr.Tx\n\tdbTx, err = sess.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer dbTx.RollbackUnlessCommitted()\n\n\t// Ingest the tx and commit\n\terr = db.ingestTx(services.NewConsumerContext(ctx, job, dbTx, i.Timestamp()), i.Body())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = dbTx.Commit()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (UuidId) Indexes() []ent.Index {\n\treturn []ent.Index{\n\t\tindex.Fields(\"id\"),\n\t}\n}", "func (obj *LineFile) BuildIndex() {\n\n\tlog.Printf(\"Building indexes: %s is started...\", obj.filePath)\n\n\tfile, err := os.Open(obj.filePath)\n\tobj.checkError(err)\n\n\tobj.deleteIndexFiles()\n\n\tvar lastOffset int\n\tr := bufio.NewReader(file)\n\tdata, err := obj.readLine(r)\n\tobj.checkError(err)\n\tvar i int\n\tfor ; err != io.EOF && data != nil && len(data) > 0; i++ {\n\t\tobj.checkError(err)\n\t\tobj.indexPage = append(obj.indexPage, lastOffset)\n\t\tlastOffset += int(len(data)) + 1\n\t\tif (i+1)%obj.numLinesPerIndexPage == 0 {\n\t\t\tobj.writeToIndexPage(i / obj.numLinesPerIndexPage)\n\t\t\tobj.indexPage = obj.indexPage[:0]\n\t\t}\n\t\tdata, err = obj.readLine(r)\n\t}\n\tif len(obj.indexPage) > 0 {\n\t\tobj.writeToIndexPage((i - 1) / obj.numLinesPerIndexPage)\n\t\tobj.indexPage = obj.indexPage[:0]\n\t}\n\tobj.numLines = i\n\tobj.indexCompleted = true\n\tlog.Printf(\"Building indexes is completed: %s\", obj.filePath)\n\n\tfile.Close()\n}", "func UseIndex(designDocument, name string) Parameter {\n\treturn func(pa Parameterizable) {\n\t\tif name == \"\" {\n\t\t\tpa.SetParameter(\"use_index\", designDocument)\n\t\t} else {\n\t\t\tpa.SetParameter(\"use_index\", []string{designDocument, name})\n\t\t}\n\t}\n}", "func (s *BasePlSqlParserListener) EnterTable_index_clause(ctx *Table_index_clauseContext) {}", "func CreateIndex(fromKind string, fromKindFieldName string, toKind string,\n\textractor ForeignKeyExtractor) {\n\n\ti := Indexes[fromKind]\n\tif i == nil {\n\t\ti = make(map[string]string)\n\t\tIndexes[fromKind] = i\n\t}\n\ti[fromKindFieldName] = toKind\n\n\tfkv := ForeignKeyExtractors[fromKind]\n\tif fkv == nil {\n\t\tfkv = make(map[string]ForeignKeyExtractor)\n\t\tForeignKeyExtractors[fromKind] = fkv\n\t}\n\tfkv[fromKindFieldName] = extractor\n}", "func (m Mixtape) buildIndex() MixtapeIndex{\n\tmi := MixtapeIndex{}\n\t// Initialize the MixtapeIndex structure so its variables aren't nil\n\tmi.init()\n\n\t// Note for the below, as per the spec, `:=` re-uses the variable in the loop's scope. In the context of pointers,\n\t// it means it will be the same address in each operation.\n\t// Index the Users\n\tfor i, _ := range m.Users {\n\t\tu := m.Users[i]\n\t\tmi.Users[u.Id] = &u\n\t}\n\n\t// Index the Playlists\n\tfor i, _ := range m.Playlists {\n\t\tp := m.Playlists[i]\n\t\tmi.Playlists[p.Id] = &p\n\n\t\t// Keep the playlist upper bound index updated\n\t\tid, _ := strconv.Atoi(p.Id)\n\t\tfmt.Println(id)\n\t\tif id > mi.PlaylistIdUpperBound {\n\t\t\tmi.PlaylistIdUpperBound = id\n\t\t}\n\t}\n\n\t// Index the Songs\n\tfor i, _ := range m.Songs{\n\t\ts := m.Songs[i]\n\t\tmi.Songs[s.Id] = &s\n\t}\n\n\tfmt.Printf(\"Mixtape Index: \\n%#v\\n\", mi)\n\n\treturn mi\n}", "func (es *ElasticSearch) Index(esIndex string, esType string, body interface{}) {\n\t// Add a document to the index\n\t_, err := client.Index().\n\t\tIndex(esIndex).\n\t\tType(\"project\").\n\t\tBodyJson(body).\n\t\tRefresh(true).\n\t\tDo()\n\tif err != nil {\n\t\t// TODO: Handle error\n\t\tpanic(err)\n\t}\n}", "func (c *compiler) index(index []ast.Expr) {\n\tfor _, expr := range index {\n\t\tif e, ok := expr.(*ast.NumExpr); ok && e.Value == float64(int(e.Value)) {\n\t\t\t// If index expression is integer constant, optimize to string \"n\"\n\t\t\t// to avoid toString() at runtime.\n\t\t\ts := strconv.Itoa(int(e.Value))\n\t\t\tc.expr(&ast.StrExpr{Value: s})\n\t\t\tcontinue\n\t\t}\n\t\tc.expr(expr)\n\t}\n\tif len(index) > 1 {\n\t\tc.add(IndexMulti, opcodeInt(len(index)))\n\t}\n}", "func (r Rules) Indexes() []string {\n\ti, ok := r[\".indexOn\"]\n\tif !ok {\n\t\treturn nil\n\t}\n\tindexes, ok := i.([]string)\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn indexes\n}", "func (s *BasePlSqlParserListener) EnterIndex_attributes(ctx *Index_attributesContext) {}", "func (self *FileBaseDataStore) SetIndex(\n\tconfig_obj *api_proto.Config,\n\tindex_urn string,\n\tentity string,\n\tkeywords []string) error {\n\n\tfor _, keyword := range keywords {\n\t\tsubject := path.Join(index_urn, strings.ToLower(keyword), entity)\n\t\terr := writeContentToFile(config_obj, subject, []byte{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func generateIndex(textsNumber int, wordsNumber int) *Index {\n\ttitles := make([]string, textsNumber)\n\tentries := make(map[string]Set)\n\tfor i := 0; i < textsNumber; i++ {\n\t\ttitles[i] = fmt.Sprintf(\"title-with-number-%d\", i)\n\t}\n\tfor i := 0; i < wordsNumber; i++ {\n\t\tset := Set{}\n\t\tfor j := 0; j < textsNumber; j++ {\n\t\t\tset.Put(j)\n\t\t}\n\t\tentries[fmt.Sprintf(\"w%d\", i)] = set\n\t}\n\treturn &Index{\n\t\tTitles: titles,\n\t\tData: entries,\n\t}\n}", "func (u UserConfig) IndexType() string {\n\treturn \"hnsw\"\n}", "func SqIndexColumns(db XODB, index string) ([]*IndexColumn, error) {\n\tvar err error\n\n\t// sql query\n\tvar sqlstr = `PRAGMA index_info(` + index + `)`\n\n\t// run query\n\tXOLog(sqlstr)\n\tq, err := db.Query(sqlstr, index)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer q.Close()\n\n\t// load results\n\tres := []*IndexColumn{}\n\tfor q.Next() {\n\t\tic := IndexColumn{}\n\n\t\t// scan\n\t\terr = q.Scan(&ic.SeqNo, &ic.Cid, &ic.ColumnName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres = append(res, &ic)\n\t}\n\n\treturn res, nil\n}", "func BuildIndex(ctx context.Context, numBuckets, id int64, records ast.RecordSet) (int64, *Histogram, error) {\n\treturn build4SortedColumn(ctx, numBuckets, id, records, false)\n}", "func initTableIndices(t *tableCommon) error {\n\ttrace_util_0.Count(_tables_00000, 29)\n\ttblInfo := t.meta\n\tfor _, idxInfo := range tblInfo.Indices {\n\t\ttrace_util_0.Count(_tables_00000, 31)\n\t\tif idxInfo.State == model.StateNone {\n\t\t\ttrace_util_0.Count(_tables_00000, 33)\n\t\t\treturn table.ErrIndexStateCantNone.GenWithStack(\"index %s can't be in none state\", idxInfo.Name)\n\t\t}\n\n\t\t// Use partition ID for index, because tableCommon may be table or partition.\n\t\ttrace_util_0.Count(_tables_00000, 32)\n\t\tidx := NewIndex(t.physicalTableID, tblInfo, idxInfo)\n\t\tt.indices = append(t.indices, idx)\n\t}\n\ttrace_util_0.Count(_tables_00000, 30)\n\treturn nil\n}", "func (h *Stocks) Index(ctx context.Context, w http.ResponseWriter, r *http.Request, _ map[string]string) error {\n\n\tclaims, err := auth.ClaimsFromContext(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfields := []datatable.DisplayField{\n\t\t{Field: \"id\", Title: \"ID\", Visible: false, Searchable: true, Orderable: true, Filterable: false},\n\t\t{Field: \"product_id\", Title: \"Product ID\", Visible: false, Searchable: false, Orderable: false, Filterable: false},\n\t\t{Field: \"product_name\", Title: \"Product\", Visible: true, Searchable: true, Orderable: true, Filterable: true, FilterPlaceholder: \"filter Name\"},\n\t\t{Field: \"branch_id\", Title: \"Branch ID\", Visible: false, Searchable: false, Orderable: false, Filterable: false},\n\t\t{Field: \"branch_name\", Title: \"Branch\", Visible: true, Searchable: true, Orderable: true, Filterable: true, FilterPlaceholder: \"filter Branch\"},\n\t\t{Field: \"quantity\", Title: \"Quantity\", Visible: true, Searchable: false, Orderable: true, Filterable: false, },\n\t\t{Field: \"type\", Title: \"Type\", Visible: true, Searchable: false, Orderable: true, Filterable: true, FilterPlaceholder: \"filter Transaction Type\"},\n\t\t{Field: \"narration\", Title: \"Narration\", Visible: true, Searchable: false, Orderable: true, Filterable: true, FilterPlaceholder: \"filter Transaction Type\"},\n\t\t{Field: \"created_at\", Title: \"Date\", Visible: true, Searchable: false, Orderable: true, Filterable: true, },\n\t\t{Field: \"sales_rep\", Title: \"Added By\", Visible: true, Searchable: false, Orderable: true, Filterable: true, },\n\t}\n\n\tmapFunc := func(q *inventory.Response, cols []datatable.DisplayField) (resp []datatable.ColumnValue, err error) {\n\t\tfor i := 0; i < len(cols); i++ {\n\t\t\tcol := cols[i]\n\t\t\tvar v datatable.ColumnValue\n\t\t\tswitch col.Field {\n\t\t\tcase \"id\":\n\t\t\t\tv.Value = fmt.Sprintf(\"%s\", q.ID)\n\t\t\tcase \"product_id\":\n\t\t\t\tv.Value = fmt.Sprintf(\"%s\", q.ProductID)\n\t\t\tcase \"product_name\":\n\t\t\t\tv.Value = q.Product\n\t\t\t\tv.Formatted = fmt.Sprintf(\"<a href='%s'>%s</a>\", urlProductsView(q.ProductID), v.Value)\n\t\t\tcase \"branch_id\":\n\t\t\t\tv.Value = fmt.Sprintf(\"%s\", q.BranchID)\n\t\t\tcase \"branch_name\":\n\t\t\t\tv.Value = q.Branch\n\t\t\t\tv.Formatted = fmt.Sprintf(\"<a href='%s'>%s</a>\", urlBranchesView(q.BranchID), v.Value)\n\t\t\tcase \"quantity\":\n\t\t\t\tv.Value = fmt.Sprintf(\"%d\", q.Quantity)\n\t\t\t\tv.Formatted = fmt.Sprintf(\"<a href='%s'>%s</a>\", urlStocksView(q.ID), v.Value)\n\t\t\tcase \"type\":\n\t\t\t\tv.Value = q.TXType\n\t\t\t\tv.Formatted = v.Value\n\t\t\tcase \"narration\":\n\t\t\t\tv.Value = q.Narration\n\t\t\t\tv.Formatted = formatInventoryNarration(q.Narration)\n\t\t\tcase \"created_at\":\n\t\t\t\tv.Value = q.CreatedAt.Local\n\t\t\t\tv.Formatted = fmt.Sprintf(\"<a href='%s'>%s</a>\", urlStocksView(q.ID), v.Value)\n\t\t\tcase \"sales_rep\":\n\t\t\t\tv.Value = q.SalesRep\n\t\t\t\tv.Formatted = fmt.Sprintf(\"<a href='%s'>%s</a>\", urlUsersView(q.SalesRepID), v.Value)\n\n\t\t\tdefault:\n\t\t\t\treturn resp, errors.Errorf(\"Failed to map value for %s.\", col.Field)\n\t\t\t}\n\t\t\tresp = append(resp, v)\n\t\t}\n\n\t\treturn resp, nil\n\t}\n\n\tloadFunc := func(ctx context.Context, sorting string, fields []datatable.DisplayField) (resp [][]datatable.ColumnValue, err error) {\n\t\tif len(sorting) == 0 {\n\t\t\tsorting = \"created_at desc\"\n\t\t}\n\t\tres, err := h.Repo.Find(ctx, claims, inventory.FindRequest{\n\t\t\tOrder: strings.Split(sorting, \",\"), IncludeProduct: true, IncludeBranch: true, IncludeSalesRep: true,\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn resp, err\n\t\t}\n\n\t\tfor _, a := range res.Transactions {\n\t\t\tl, err := mapFunc(a, fields)\n\t\t\tif err != nil {\n\t\t\t\treturn resp, errors.Wrapf(err, \"Failed to map category for display.\")\n\t\t\t}\n\n\t\t\tresp = append(resp, l)\n\t\t}\n\n\t\treturn resp, nil\n\t}\n\n\tdt, err := datatable.New(ctx, w, r, h.Redis, fields, loadFunc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif dt.HasCache() {\n\t\treturn nil\n\t}\n\n\tif ok, err := dt.Render(); ok {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\n\tdata := map[string]interface{}{\n\t\t\"datatable\": dt.Response(),\n\t\t\"urlStocksCreate\": urlStocksCreate(),\n\t\t\"urlStocksRemove\": urlStocksRemove(),\n\t\t\"urlStocksIndex\": urlStocksIndex(),\n\t}\n\n\treturn h.Renderer.Render(ctx, w, r, TmplLayoutBase, \"stocks-index.gohtml\", web.MIMETextHTMLCharsetUTF8, http.StatusOK, data)\n}", "func (statement *Statement) GenIndexSQL() []string {\n\tvar sqls []string\n\ttbName := statement.TableName()\n\tfor _, index := range statement.RefTable.Indexes {\n\t\tif index.Type == schemas.IndexType {\n\t\t\tsql := statement.dialect.CreateIndexSQL(tbName, index)\n\t\t\tsqls = append(sqls, sql)\n\t\t}\n\t}\n\treturn sqls\n}", "func (MixinID) Indexes() []ent.Index {\n\treturn []ent.Index{\n\t\tindex.Fields(\"id\"),\n\t\tindex.Fields(\"id\", \"some_field\"),\n\t\tindex.Fields(\"id\", \"mixin_field\"),\n\t\tindex.Fields(\"id\", \"mixin_field\", \"some_field\"),\n\t}\n}", "func (this *TableDef) SetNewColumnPositionOfIndex(fullTbName string) error {\n\tfor i, oneColName := range this.PrimaryKey.ColumnNames {\n\t\tnewIdx := this.GetColIndxByName(oneColName)\n\t\tif newIdx < 0 {\n\t\t\treturn errors.NotFoundf(\"column %s not found in table def of %s\", oneColName, fullTbName)\n\t\t}\n\t\tthis.PrimaryKey.ColumnIndices[i] = newIdx\n\t}\n\n\tfor k := range this.UniqueKeys {\n\t\tfor i, oneColName := range this.UniqueKeys[k].ColumnNames {\n\t\t\tnewIdx := this.GetColIndxByName(oneColName)\n\t\t\tif newIdx < 0 {\n\t\t\t\treturn errors.NotFoundf(\"column %s not found in table def of %s\", oneColName, fullTbName)\n\t\t\t}\n\t\t\tthis.UniqueKeys[k].ColumnIndices[i] = newIdx\n\t\t}\n\t}\n\treturn nil\n}", "func init() {\n\tupdateIndex()\n}", "func TestEnsureHashIndex(t *testing.T) {\n\tc := createClient(t, nil)\n\tdb := ensureDatabase(nil, c, \"index_test\", nil, t)\n\n\ttestOptions := []*driver.EnsureHashIndexOptions{\n\t\tnil,\n\t\t{Unique: true, Sparse: false},\n\t\t{Unique: true, Sparse: true},\n\t\t{Unique: false, Sparse: false},\n\t\t{Unique: false, Sparse: true},\n\t}\n\n\tfor i, options := range testOptions {\n\t\tcol := ensureCollection(nil, db, fmt.Sprintf(\"hash_index_test_%d\", i), nil, t)\n\n\t\tidx, created, err := col.EnsureHashIndex(nil, []string{\"name\"}, options)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Failed to create new index: %s\", describe(err))\n\t\t}\n\t\tif !created {\n\t\t\tt.Error(\"Expected created to be true, got false\")\n\t\t}\n\t\tif idxType := idx.Type(); idxType != driver.HashIndex {\n\t\t\tt.Errorf(\"Expected HashIndex, found `%s`\", idxType)\n\t\t}\n\t\tif options != nil && idx.Unique() != options.Unique {\n\t\t\tt.Errorf(\"Expected Unique to be %t, found `%t`\", options.Unique, idx.Unique())\n\t\t}\n\t\tif options != nil && idx.Sparse() != options.Sparse {\n\t\t\tt.Errorf(\"Expected Sparse to be %t, found `%t`\", options.Sparse, idx.Sparse())\n\t\t}\n\n\t\t// Index must exists now\n\t\tif found, err := col.IndexExists(nil, idx.Name()); err != nil {\n\t\t\tt.Fatalf(\"Failed to check index '%s' exists: %s\", idx.Name(), describe(err))\n\t\t} else if !found {\n\t\t\tt.Errorf(\"Index '%s' does not exist, expected it to exist\", idx.Name())\n\t\t}\n\n\t\t// Ensure again, created must be false now\n\t\t_, created, err = col.EnsureHashIndex(nil, []string{\"name\"}, options)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Failed to re-create index: %s\", describe(err))\n\t\t}\n\t\tif created {\n\t\t\tt.Error(\"Expected created to be false, got true\")\n\t\t}\n\n\t\t// Remove index\n\t\tif err := idx.Remove(nil); err != nil {\n\t\t\tt.Fatalf(\"Failed to remove index '%s': %s\", idx.Name(), describe(err))\n\t\t}\n\n\t\t// Index must not exists now\n\t\tif found, err := col.IndexExists(nil, idx.Name()); err != nil {\n\t\t\tt.Fatalf(\"Failed to check index '%s' exists: %s\", idx.Name(), describe(err))\n\t\t} else if found {\n\t\t\tt.Errorf(\"Index '%s' does exist, expected it not to exist\", idx.Name())\n\t\t}\n\t}\n}", "func (c *MongoStoreClient) EnsureIndexes() error {\n\tmedtronicIndexDateTime, _ := time.Parse(medtronicDateFormat, medtronicIndexDate)\n\tdataIndexes := []mongo.IndexModel{\n\t\t{\n\t\t\tKeys: bson.D{{Key: \"_userId\", Value: 1}, {Key: \"deviceModel\", Value: 1}, {Key: \"fakefield\", Value: 1}},\n\t\t\tOptions: options.Index().\n\t\t\t\tSetName(\"GetLoopableMedtronicDirectUploadIdsAfter_v2_DateTime\").\n\t\t\t\tSetBackground(true).\n\t\t\t\tSetPartialFilterExpression(\n\t\t\t\t\tbson.D{\n\t\t\t\t\t\t{Key: \"_active\", Value: true},\n\t\t\t\t\t\t{Key: \"type\", Value: \"upload\"},\n\t\t\t\t\t\t{Key: \"deviceModel\", Value: bson.M{\n\t\t\t\t\t\t\t\"$exists\": true,\n\t\t\t\t\t\t}},\n\t\t\t\t\t\t{Key: \"time\", Value: bson.M{\n\t\t\t\t\t\t\t\"$gte\": medtronicIndexDateTime,\n\t\t\t\t\t\t}},\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\tKeys: bson.D{{Key: \"_userId\", Value: 1}, {Key: \"origin.payload.device.manufacturer\", Value: 1}, {Key: \"fakefield\", Value: 1}},\n\t\t\tOptions: options.Index().\n\t\t\t\tSetName(\"HasMedtronicLoopDataAfter_v2_DateTime\").\n\t\t\t\tSetBackground(true).\n\t\t\t\tSetPartialFilterExpression(\n\t\t\t\t\tbson.D{\n\t\t\t\t\t\t{Key: \"_active\", Value: true},\n\t\t\t\t\t\t{Key: \"origin.payload.device.manufacturer\", Value: \"Medtronic\"},\n\t\t\t\t\t\t{Key: \"time\", Value: bson.M{\n\t\t\t\t\t\t\t\"$gte\": medtronicIndexDateTime,\n\t\t\t\t\t\t}},\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\tKeys: bson.D{{Key: \"_userId\", Value: 1}, {Key: \"time\", Value: -1}, {Key: \"type\", Value: 1}},\n\t\t\tOptions: options.Index().\n\t\t\t\tSetName(\"UserIdTimeWeighted_v2\").\n\t\t\t\tSetBackground(true).\n\t\t\t\tSetPartialFilterExpression(\n\t\t\t\t\tbson.D{\n\t\t\t\t\t\t{Key: \"_active\", Value: true},\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t},\n\t}\n\n\tif _, err := dataCollection(c).Indexes().CreateMany(context.Background(), dataIndexes); err != nil {\n\t\tlog.Fatal(dataStoreAPIPrefix, fmt.Sprintf(\"Unable to create indexes: %s\", err))\n\t}\n\n\t// Not sure if all these indexes need to also be on the deviceDataSets collection.\n\tdataSetsIndexes := []mongo.IndexModel{\n\t\t{\n\t\t\tKeys: bson.D{{Key: \"_userId\", Value: 1}, {Key: \"deviceModel\", Value: 1}, {Key: \"fakefield\", Value: 1}},\n\t\t\tOptions: options.Index().\n\t\t\t\tSetName(\"GetLoopableMedtronicDirectUploadIdsAfter_v2_DateTime\").\n\t\t\t\tSetBackground(true).\n\t\t\t\tSetPartialFilterExpression(\n\t\t\t\t\tbson.D{\n\t\t\t\t\t\t{Key: \"_active\", Value: true},\n\t\t\t\t\t\t{Key: \"type\", Value: \"upload\"},\n\t\t\t\t\t\t{Key: \"deviceModel\", Value: bson.M{\n\t\t\t\t\t\t\t\"$exists\": true,\n\t\t\t\t\t\t}},\n\t\t\t\t\t\t{Key: \"time\", Value: bson.M{\n\t\t\t\t\t\t\t\"$gte\": medtronicIndexDateTime,\n\t\t\t\t\t\t}},\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\tKeys: bson.D{{Key: \"_userId\", Value: 1}, {Key: \"origin.payload.device.manufacturer\", Value: 1}, {Key: \"fakefield\", Value: 1}},\n\t\t\tOptions: options.Index().\n\t\t\t\tSetName(\"HasMedtronicLoopDataAfter_v2_DateTime\").\n\t\t\t\tSetBackground(true).\n\t\t\t\tSetPartialFilterExpression(\n\t\t\t\t\tbson.D{\n\t\t\t\t\t\t{Key: \"_active\", Value: true},\n\t\t\t\t\t\t{Key: \"origin.payload.device.manufacturer\", Value: \"Medtronic\"},\n\t\t\t\t\t\t{Key: \"time\", Value: bson.M{\n\t\t\t\t\t\t\t\"$gte\": medtronicIndexDateTime,\n\t\t\t\t\t\t}},\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\tKeys: bson.D{{Key: \"_userId\", Value: 1}, {Key: \"time\", Value: -1}, {Key: \"type\", Value: 1}},\n\t\t\tOptions: options.Index().\n\t\t\t\tSetName(\"UserIdTimeWeighted_v2\").\n\t\t\t\tSetBackground(true).\n\t\t\t\tSetPartialFilterExpression(\n\t\t\t\t\tbson.D{\n\t\t\t\t\t\t{Key: \"_active\", Value: true},\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t},\n\t}\n\n\tif _, err := dataSetsCollection(c).Indexes().CreateMany(context.Background(), dataSetsIndexes); err != nil {\n\t\tlog.Fatal(dataStoreAPIPrefix, fmt.Sprintf(\"Unable to create indexes: %s\", err))\n\t}\n\n\treturn nil\n}", "func (m *ProjectIndexer) Index(resource *models.Project, doc solr.Document) solr.Document {\n\tdoc.Set(\"type_ssi\", \"Project\")\n\tdoc.Set(\"title_tesi\", resource.Title)\n\tdoc.Set(\"alternative_title_tesim\", resource.AlternativeTitle)\n\tdoc.Set(\"start_date_ssi\", resource.StartDate)\n\tdoc.Set(\"end_date_ssi\", resource.EndDate)\n\n\treturn doc\n}", "func BuildIndex(dir string){\n\tconfig := Config()\n\tbuilder := makeIndexBuilder(config)\n\tbuilder.Build(\"/\")\n\tsort.Strings(documents)\n\tsave(documents, config)\n}", "func (esHandler *ESHandler) Index(verses []Verse) error {\n\tctx := context.Background()\n\tserivce, err := esHandler.Client.BulkProcessor().Name(\"ScriptureProcessor\").Workers(2).BulkActions(1000).Do(ctx)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Error initializing BulkProcessor\")\n\t}\n\tdefer serivce.Close()\n\n\tfor _, v := range verses {\n\t\tid := v.GetID()\n\t\tr := elastic.NewBulkIndexRequest().Index(esHandler.ESIndex).Type(\"Verse\").Id(id).Doc(v)\n\t\tserivce.Add(r)\n\t}\n\treturn nil\n}", "func (t *BenchmarkerChaincode) updateIndex(stub shim.ChaincodeStubInterface, key, indexName string, indexValueSpace [][]string) error {\n\tif indexName == \"\" {\n\t\treturn nil\n\t}\n\n\tvar indexValues []string\n\tfor _, validValues := range indexValueSpace {\n\t\tchoice := rand.Intn(len(validValues))\n\t\tindexValues = append(indexValues, validValues[choice])\n\t}\n\n\tindexKey, err := stub.CreateCompositeKey(indexName+\"~id\", append(indexValues, key))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvalue := []byte{0x00}\n\tif err := stub.PutState(indexKey, value); err != nil {\n\t\treturn err\n\t}\n\tfmt.Printf(\"Set composite key '%s' to '%s' for key '%s'\\n\", indexKey, value, key)\n\n\treturn nil\n}", "func (c *Collection) addIndex(schema *jsonschema.Schema, index Index, opts ...Option) error {\n\targs := &Options{}\n\tfor _, opt := range opts {\n\t\topt(args)\n\t}\n\n\t// Don't allow the default index to be overwritten\n\tif index.Path == idFieldName {\n\t\tif _, ok := c.indexes[idFieldName]; ok {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// Validate path and type.\n\tjt, err := getSchemaTypeAtPath(schema, index.Path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar valid bool\n\tfor _, t := range indexTypes {\n\t\tif jt.Type == t {\n\t\t\tvalid = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !valid {\n\t\treturn ErrNotIndexable\n\t}\n\n\t// Skip if nothing to do\n\tif x, ok := c.indexes[index.Path]; ok && index.Unique == x.Unique {\n\t\treturn nil\n\t}\n\n\t// Ensure collection does not contain multiple instances with the same value at path\n\tif index.Unique && index.Path != idFieldName {\n\t\tvals := make(map[interface{}]struct{})\n\t\tall, err := c.Find(&Query{}, WithTxnToken(args.Token))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, i := range all {\n\t\t\tres := gjson.GetBytes(i, index.Path)\n\t\t\tif !res.Exists() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif _, ok := vals[res.Value()]; ok {\n\t\t\t\treturn ErrCantCreateUniqueIndex\n\t\t\t} else {\n\t\t\t\tvals[res.Value()] = struct{}{}\n\t\t\t}\n\t\t}\n\t}\n\n\tc.indexes[index.Path] = index\n\treturn c.saveIndexes()\n}", "func SetIndexPageSize(dbo Database, pageSize int) error {\n\tdb := dbo.(*database)\n\tsql := db.getRawDB()\n\t_, err := sql.Exec(`insert into fts(fts, rank) values(\"pgsz\", ?)`, pageSize)\n\treturn err\n}", "func (access ColumnAccess) SharedIndex(localIndex int) int {\n return access.indices[localIndex]\n}", "func PrepareIndex(creators map[string]Creator, cfg Config, games []GameSource) error {\n\tindexPath := cfg.Filepath\n\tindexFile, err := os.Stat(indexPath)\n\tif !os.IsNotExist(err) && err != nil {\n\t\treturn err\n\t}\n\n\tif indexFile != nil {\n\t\terr = os.RemoveAll(indexPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif creator, ok := creators[cfg.Variant]; ok {\n\t\terr = creator.CreateIndex(indexPath, games)\n\t} else {\n\t\terr = fmt.Errorf(\"Creator not found for the config\")\n\t}\n\treturn err\n}", "func (req MinRequest) Index(index interface{}) MinRequest {\n\treq.index = index\n\treturn req\n}", "func (t *tableCommon) Indices() []table.Index {\n\ttrace_util_0.Count(_tables_00000, 35)\n\treturn t.indices\n}", "func (d *dbBasePostgres) GenerateSpecifyIndex(tableName string, useIndex int, indexes []string) string {\n\tDebugLog.Println(\"[WARN] Not support any specifying index action, so that action is ignored\")\n\treturn ``\n}", "func EnsureIndex(db *mongo.Database, collectionName string, keys bson.M, opt *options.IndexOptions) {\n\tvar keyIndex []string\n\tfor k := range keys {\n\t\tkeyIndex = append(keyIndex, k)\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tcollection := db.Collection(collectionName)\n\n\tindexes := collection.Indexes()\n\tcursor, err := indexes.List(ctx)\n\tif err != nil {\n\t\tlog.Panicf(\"index list error %v\", err)\n\t}\n\n\tif cursor != nil {\n\t\tfor cursor.Next(ctx) {\n\t\t\tvar index []primitive.E\n\t\t\terrCursor := cursor.Decode(&index)\n\t\t\tif errCursor != nil {\n\t\t\t\tlog.Panicf(\"index list error %v\", errCursor)\n\t\t\t}\n\n\t\t\t// skip creating index if key field already exist\n\t\t\tkeyIsExist := keyFieldIndexIsExist(index, keyIndex)\n\t\t\tif keyIsExist {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tmod := mongo.IndexModel{\n\t\t\tKeys: keys,\n\t\t\tOptions: opt,\n\t\t}\n\n\t\topts := options.CreateIndexes().SetMaxTime(5 * time.Second)\n\t\t_, err = collection.Indexes().CreateOne(ctx, mod, opts)\n\t\tif err != nil {\n\t\t\tlog.Panicf(\"ensure index error %v\", err)\n\t\t}\n\t}\n}", "func SetIndexes(collection *mongo.Collection, keys bsonx.Doc) {\n\tindex := mongo.IndexModel{}\n\tindex.Keys = keys\n\tunique := true\n\tindex.Options = &options.IndexOptions{\n\t\tUnique: &unique,\n\t}\n\topts := options.CreateIndexes().SetMaxTime(10 * time.Second)\n\t_, err := collection.Indexes().CreateOne(context.Background(), index, opts)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error while creating indexs: %v\", err)\n\t}\n}", "func (b *Blueprint) SpatialIndex(columns []string, name string) *Blueprint {\n\treturn b.indexCommand(\"spatialIndex\", columns, name, \"\")\n}", "func OrTableIndexes(db models.XODB, schema string, table string) ([]*models.Index, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`LOWER(i.index_name) AS index_name, ` +\n\t\t`CASE WHEN i.uniqueness = 'UNIQUE' THEN '1' ELSE '0' END AS is_unique, ` +\n\t\t`CASE WHEN c.constraint_type = 'P' THEN '1' ELSE '0' END AS is_primary ` +\n\t\t`FROM user_indexes i ` +\n\t\t`LEFT JOIN user_constraints c on i.INDEX_NAME = c.constraint_name ` +\n\t\t`WHERE i.TABLE_OWNER = UPPER(:1) AND i.TABLE_NAME = :2`\n\n\t// run query\n\tmodels.XOLog(sqlstr, schema, table)\n\tq, err := db.Query(sqlstr, schema, table)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer q.Close()\n\n\t// load results\n\tres := []*models.Index{}\n\tfor q.Next() {\n\t\ti := models.Index{}\n\n\t\t// scan\n\t\terr = q.Scan(&i.IndexName, &i.IsUnique, &i.IsPrimary)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres = append(res, &i)\n\t}\n\n\treturn res, nil\n}", "func (s *RefreshService) Index(index ...string) *RefreshService {\n\ts.index = append(s.index, index...)\n\treturn s\n}" ]
[ "0.6745448", "0.65392023", "0.65343076", "0.6283328", "0.6246127", "0.6234686", "0.61355233", "0.6058079", "0.60186356", "0.6000727", "0.5930021", "0.58883613", "0.58581555", "0.58448315", "0.5811686", "0.5805725", "0.58047396", "0.57995695", "0.5793175", "0.5792225", "0.5766758", "0.5759171", "0.57488877", "0.5728702", "0.5726939", "0.570867", "0.5708432", "0.56842864", "0.56684077", "0.5667792", "0.56677765", "0.5656537", "0.56394595", "0.5631976", "0.5603504", "0.5592507", "0.55908436", "0.55844253", "0.55677503", "0.5550272", "0.55258375", "0.5522019", "0.54966867", "0.54940903", "0.54927397", "0.54919165", "0.5487628", "0.5485676", "0.5484873", "0.5476352", "0.54748565", "0.5468511", "0.54626364", "0.5441341", "0.54365814", "0.54288274", "0.54142094", "0.5402969", "0.53978324", "0.53925824", "0.5385271", "0.5379293", "0.53785235", "0.5378472", "0.53774005", "0.53687495", "0.5346897", "0.5345805", "0.5340295", "0.53369296", "0.53328353", "0.53304243", "0.5327379", "0.53199327", "0.53196716", "0.53164285", "0.53153676", "0.5314674", "0.53102416", "0.5309066", "0.53027546", "0.53027093", "0.52992386", "0.52853096", "0.5284755", "0.5267813", "0.5256141", "0.52553767", "0.5253723", "0.52290857", "0.52227557", "0.5221733", "0.5212082", "0.5204973", "0.52014446", "0.5199698", "0.5199656", "0.5199214", "0.5197647", "0.51973134" ]
0.54256165
56
Collection getter method for the collections constant
func (n *Notification) Collection() string { return COLLECTION }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetCollection(ctx context.Context, c Client, uri string) (*Collection, error) {\n\tresp, err := c.Get(ctx, uri)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tvar result Collection\n\terr = json.NewDecoder(resp.Body).Decode(&result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &result, nil\n}", "func (s *VisvalingamSimplifier) Collection(c orb.Collection) orb.Collection {\n\treturn collection(s, c)\n}", "func (mm *Model) GetCollection(session *mgo.Session) CachedCollection {\n\treturn mm.generateCollection(session)\n}", "func (c *Repository) Collection() *mgo.Collection {\n\treturn c.Session.DB(database).C(collection)\n}", "func (engine *Engine) Collection() string {\n\treturn engine.evaluator.Collection()\n}", "func (ins *instance) getCollection() (*mgo.Collection, error) {\n\tsession, err := ins.getConnection()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsession.SetSafe(&mgo.Safe{})\n\tsession.SetMode(mgo.Strong, true)\n\tc := session.DB(ins.database).C(CollectionName)\n\treturn c, nil\n}", "func (m *MongoDB) Collections() map[string]*mongo.Collection {\n\treturn m.coll\n}", "func (instance *Instance) GetCollection() (collection string) {\n\tif val := instance.GetIndexInstance(); val != nil {\n\t\treturn val.GetDefinition().GetCollection()\n\t} else {\n\t\t// TODO: should we panic\n\t}\n\treturn\n}", "func (rs *ResourceSubscription) GetCollection() (*Collection, uint) {\n\trs.e.mu.Lock()\n\tdefer rs.e.mu.Unlock()\n\treturn rs.collection, rs.version\n}", "func GetCollection(kind string, namespace string, args ...string) ([]byte, error) {\n\tget := []string{\"get\", kind, \"-n\", namespace}\n\treturn kubectl(append(get, args...)...)\n}", "func NewCollection() Collection {\n\treturn make(Collection)\n}", "func (x CollectionEntity) GetCollection() EntityCollection {\n\treturn x.Collection\n}", "func (group *Group) GetCollection() string {\n\treturn GroupsCollection\n}", "func (k Keeper) GetCollection(ctx sdk.Context, denom string) (types.Collection, error) {\n\tnfts := k.GetNFTs(ctx, denom)\n\tif len(nfts) == 0 {\n\t\treturn types.Collection{}, sdkerrors.Wrapf(types.ErrUnknownCollection, \"collection %s not existed \", denom)\n\t}\n\treturn types.NewCollection(denom, nfts), nil\n}", "func GetCollection(name string) *mgo.Collection {\n\treturn DB.C(name)\n}", "func (AktaKelahiran) Collection() *mongo.Collection {\n\treturn mongodb.DB.Collection(variable.CollectionNames.SubMission.AktaKelahiran)\n}", "func (x WorkloadEntity) GetCollection() EntityCollection {\n\treturn x.Collection\n}", "func (m Service) GetCollection() string {\n\treturn ServiceCollectionName\n}", "func (repo *mongoBaseRepo) GetCollection() interface{} {\n\treturn repo.collection\n}", "func (dao ArtistDAO) getCollection() *mgo.Collection {\n\treturn dao.conn.DB(\"bookfire\").C(\"artists\")\n}", "func (ds *DataStore) Collection(name string) *mgo.Collection {\n\treturn ds.MongoSession.DB(commons.AppConfig.Database).C(name)\n}", "func (d WrapperDatabase) Collection(name string) CollectionLayer {\n\treturn &WrapperCollection{Collection: d.Database.Collection(name)}\n}", "func (db Database) C(name string) Collection {\n\treturn Collection{\n\t\tConn: db.Conn,\n\t\tNamespace: db.Name + \".\" + name,\n\t\tLastErrorCmd: db.LastErrorCmd,\n\t}\n}", "func (Admin) Collection() *mongo.Collection {\n\treturn mongodb.DB.Collection(variable.CollectionNames.Admin)\n}", "func (m *Messages) Collection(messagesmap map[string]string) *Collection {\n\treturn NewCollection(m, messagesmap)\n}", "func (c Client) GetCollection(id string) (Collection, error) {\n\turl := c.Config.BaseURL + \"/\" + c.Config.Version + \"/\" + collectionsEndpoint + \"/\" + id\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn Collection{}, err\n\t}\n\treq.Header.Add(\"Authorization\", \"Bearer \"+c.Config.Token)\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\tresp, err := c.Client.Do(req)\n\tif err != nil {\n\t\treturn Collection{}, err\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn Collection{}, err\n\t}\n\tvar collection Collection\n\terr = json.Unmarshal(body, &collection)\n\tif err != nil {\n\t\treturn Collection{}, err\n\t}\n\treturn collection, nil\n}", "func (s MutableAccountNFTAmountInCollectionParams) Collection() wasmtypes.ScMutableNftID {\n\treturn wasmtypes.NewScMutableNftID(s.Proxy.Root(ParamCollection))\n}", "func (m *mapping) collections() []string {\n\tresult := make([]string, 0, len(m.collectionsToKinds)+1)\n\tfor u := range m.collectionsToKinds {\n\t\tresult = append(result, u)\n\t}\n\treturn result\n}", "func (rc *ResourceCommand) getCollection(ctx context.Context, client auth.ClientI) (ResourceCollection, error) {\n\tif rc.ref.Kind == \"\" {\n\t\treturn nil, trace.BadParameter(\"specify resource to list, e.g. 'tctl get roles'\")\n\t}\n\n\tswitch rc.ref.Kind {\n\tcase types.KindUser:\n\t\tif rc.ref.Name == \"\" {\n\t\t\tusers, err := client.GetUsers(rc.withSecrets)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\treturn &userCollection{users: users}, nil\n\t\t}\n\t\tuser, err := client.GetUser(rc.ref.Name, rc.withSecrets)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &userCollection{users: services.Users{user}}, nil\n\tcase types.KindConnectors:\n\t\tsc, scErr := getSAMLConnectors(ctx, client, rc.ref.Name, rc.withSecrets)\n\t\toc, ocErr := getOIDCConnectors(ctx, client, rc.ref.Name, rc.withSecrets)\n\t\tgc, gcErr := getGithubConnectors(ctx, client, rc.ref.Name, rc.withSecrets)\n\t\terrs := []error{scErr, ocErr, gcErr}\n\t\tallEmpty := len(sc) == 0 && len(oc) == 0 && len(gc) == 0\n\t\treportErr := false\n\t\tfor _, err := range errs {\n\t\t\tif err != nil && !trace.IsNotFound(err) {\n\t\t\t\treportErr = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tvar finalErr error\n\t\tif allEmpty || reportErr {\n\t\t\tfinalErr = trace.NewAggregate(errs...)\n\t\t}\n\t\treturn &connectorsCollection{\n\t\t\tsaml: sc,\n\t\t\toidc: oc,\n\t\t\tgithub: gc,\n\t\t}, finalErr\n\tcase types.KindSAMLConnector:\n\t\tconnectors, err := getSAMLConnectors(ctx, client, rc.ref.Name, rc.withSecrets)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &samlCollection{connectors}, nil\n\tcase types.KindOIDCConnector:\n\t\tconnectors, err := getOIDCConnectors(ctx, client, rc.ref.Name, rc.withSecrets)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &oidcCollection{connectors}, nil\n\tcase types.KindGithubConnector:\n\t\tconnectors, err := getGithubConnectors(ctx, client, rc.ref.Name, rc.withSecrets)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &githubCollection{connectors}, nil\n\tcase types.KindReverseTunnel:\n\t\tif rc.ref.Name == \"\" {\n\t\t\ttunnels, err := client.GetReverseTunnels(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\treturn &reverseTunnelCollection{tunnels: tunnels}, nil\n\t\t}\n\t\ttunnel, err := client.GetReverseTunnel(rc.ref.Name)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &reverseTunnelCollection{tunnels: []types.ReverseTunnel{tunnel}}, nil\n\tcase types.KindCertAuthority:\n\t\tif rc.ref.SubKind == \"\" && rc.ref.Name == \"\" {\n\t\t\tvar allAuthorities []types.CertAuthority\n\t\t\tfor _, caType := range types.CertAuthTypes {\n\t\t\t\tauthorities, err := client.GetCertAuthorities(ctx, caType, rc.withSecrets)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif trace.IsBadParameter(err) {\n\t\t\t\t\t\tlog.Warnf(\"failed to get certificate authority: %v; skipping\", err)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t\t}\n\t\t\t\tallAuthorities = append(allAuthorities, authorities...)\n\t\t\t}\n\t\t\treturn &authorityCollection{cas: allAuthorities}, nil\n\t\t}\n\t\tid := types.CertAuthID{Type: types.CertAuthType(rc.ref.SubKind), DomainName: rc.ref.Name}\n\t\tauthority, err := client.GetCertAuthority(ctx, id, rc.withSecrets)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &authorityCollection{cas: []types.CertAuthority{authority}}, nil\n\tcase types.KindNode:\n\t\tnodes, err := client.GetNodes(ctx, rc.namespace)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\tif rc.ref.Name == \"\" {\n\t\t\treturn &serverCollection{servers: nodes}, nil\n\t\t}\n\t\tfor _, node := range nodes {\n\t\t\tif node.GetName() == rc.ref.Name || node.GetHostname() == rc.ref.Name {\n\t\t\t\treturn &serverCollection{servers: []types.Server{node}}, nil\n\t\t\t}\n\t\t}\n\t\treturn nil, trace.NotFound(\"node with ID %q not found\", rc.ref.Name)\n\tcase types.KindAuthServer:\n\t\tservers, err := client.GetAuthServers()\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\tif rc.ref.Name == \"\" {\n\t\t\treturn &serverCollection{servers: servers}, nil\n\t\t}\n\t\tfor _, server := range servers {\n\t\t\tif server.GetName() == rc.ref.Name || server.GetHostname() == rc.ref.Name {\n\t\t\t\treturn &serverCollection{servers: []types.Server{server}}, nil\n\t\t\t}\n\t\t}\n\t\treturn nil, trace.NotFound(\"auth server with ID %q not found\", rc.ref.Name)\n\tcase types.KindProxy:\n\t\tservers, err := client.GetProxies()\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\tif rc.ref.Name == \"\" {\n\t\t\treturn &serverCollection{servers: servers}, nil\n\t\t}\n\t\tfor _, server := range servers {\n\t\t\tif server.GetName() == rc.ref.Name || server.GetHostname() == rc.ref.Name {\n\t\t\t\treturn &serverCollection{servers: []types.Server{server}}, nil\n\t\t\t}\n\t\t}\n\t\treturn nil, trace.NotFound(\"proxy with ID %q not found\", rc.ref.Name)\n\tcase types.KindRole:\n\t\tif rc.ref.Name == \"\" {\n\t\t\troles, err := client.GetRoles(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\treturn &roleCollection{roles: roles}, nil\n\t\t}\n\t\trole, err := client.GetRole(ctx, rc.ref.Name)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &roleCollection{roles: []types.Role{role}}, nil\n\tcase types.KindNamespace:\n\t\tif rc.ref.Name == \"\" {\n\t\t\tnamespaces, err := client.GetNamespaces()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\treturn &namespaceCollection{namespaces: namespaces}, nil\n\t\t}\n\t\tns, err := client.GetNamespace(rc.ref.Name)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &namespaceCollection{namespaces: []types.Namespace{*ns}}, nil\n\tcase types.KindTrustedCluster:\n\t\tif rc.ref.Name == \"\" {\n\t\t\ttrustedClusters, err := client.GetTrustedClusters(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\treturn &trustedClusterCollection{trustedClusters: trustedClusters}, nil\n\t\t}\n\t\ttrustedCluster, err := client.GetTrustedCluster(ctx, rc.ref.Name)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &trustedClusterCollection{trustedClusters: []types.TrustedCluster{trustedCluster}}, nil\n\tcase types.KindRemoteCluster:\n\t\tif rc.ref.Name == \"\" {\n\t\t\tremoteClusters, err := client.GetRemoteClusters()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\treturn &remoteClusterCollection{remoteClusters: remoteClusters}, nil\n\t\t}\n\t\tremoteCluster, err := client.GetRemoteCluster(rc.ref.Name)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &remoteClusterCollection{remoteClusters: []types.RemoteCluster{remoteCluster}}, nil\n\tcase types.KindSemaphore:\n\t\tsems, err := client.GetSemaphores(ctx, types.SemaphoreFilter{\n\t\t\tSemaphoreKind: rc.ref.SubKind,\n\t\t\tSemaphoreName: rc.ref.Name,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &semaphoreCollection{sems: sems}, nil\n\tcase types.KindClusterAuthPreference:\n\t\tif rc.ref.Name != \"\" {\n\t\t\treturn nil, trace.BadParameter(\"only simple `tctl get %v` can be used\", types.KindClusterAuthPreference)\n\t\t}\n\t\tauthPref, err := client.GetAuthPreference(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &authPrefCollection{authPref}, nil\n\tcase types.KindClusterNetworkingConfig:\n\t\tif rc.ref.Name != \"\" {\n\t\t\treturn nil, trace.BadParameter(\"only simple `tctl get %v` can be used\", types.KindClusterNetworkingConfig)\n\t\t}\n\t\tnetConfig, err := client.GetClusterNetworkingConfig(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &netConfigCollection{netConfig}, nil\n\tcase types.KindClusterMaintenanceConfig:\n\t\tif rc.ref.Name != \"\" {\n\t\t\treturn nil, trace.BadParameter(\"only simple `tctl get %v` can be used\", types.KindClusterMaintenanceConfig)\n\t\t}\n\n\t\tcmc, err := client.GetClusterMaintenanceConfig(ctx)\n\t\tif err != nil && !trace.IsNotFound(err) {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\n\t\treturn &maintenanceWindowCollection{cmc}, nil\n\tcase types.KindSessionRecordingConfig:\n\t\tif rc.ref.Name != \"\" {\n\t\t\treturn nil, trace.BadParameter(\"only simple `tctl get %v` can be used\", types.KindSessionRecordingConfig)\n\t\t}\n\t\trecConfig, err := client.GetSessionRecordingConfig(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &recConfigCollection{recConfig}, nil\n\tcase types.KindLock:\n\t\tif rc.ref.Name == \"\" {\n\t\t\tlocks, err := client.GetLocks(ctx, false)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\treturn &lockCollection{locks: locks}, nil\n\t\t}\n\t\tname := rc.ref.Name\n\t\tif rc.ref.SubKind != \"\" {\n\t\t\tname = rc.ref.SubKind + \"/\" + name\n\t\t}\n\t\tlock, err := client.GetLock(ctx, name)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &lockCollection{locks: []types.Lock{lock}}, nil\n\tcase types.KindDatabaseServer:\n\t\tservers, err := client.GetDatabaseServers(ctx, rc.namespace)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\tif rc.ref.Name == \"\" {\n\t\t\treturn &databaseServerCollection{servers: servers}, nil\n\t\t}\n\n\t\tservers = filterByNameOrPrefix(servers, rc.ref.Name)\n\t\tif len(servers) == 0 {\n\t\t\treturn nil, trace.NotFound(\"database server %q not found\", rc.ref.Name)\n\t\t}\n\t\treturn &databaseServerCollection{servers: servers}, nil\n\tcase types.KindKubeServer:\n\t\tservers, err := client.GetKubernetesServers(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\tif rc.ref.Name == \"\" {\n\t\t\treturn &kubeServerCollection{servers: servers}, nil\n\t\t}\n\t\taltNameFn := func(r types.KubeServer) string {\n\t\t\treturn r.GetHostname()\n\t\t}\n\t\tservers = filterByNameOrPrefix(servers, rc.ref.Name, altNameFn)\n\t\tif len(servers) == 0 {\n\t\t\treturn nil, trace.NotFound(\"kubernetes server %q not found\", rc.ref.Name)\n\t\t}\n\t\treturn &kubeServerCollection{servers: servers}, nil\n\n\tcase types.KindAppServer:\n\t\tservers, err := client.GetApplicationServers(ctx, rc.namespace)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\tif rc.ref.Name == \"\" {\n\t\t\treturn &appServerCollection{servers: servers}, nil\n\t\t}\n\n\t\tvar out []types.AppServer\n\t\tfor _, server := range servers {\n\t\t\tif server.GetName() == rc.ref.Name || server.GetHostname() == rc.ref.Name {\n\t\t\t\tout = append(out, server)\n\t\t\t}\n\t\t}\n\t\tif len(out) == 0 {\n\t\t\treturn nil, trace.NotFound(\"application server %q not found\", rc.ref.Name)\n\t\t}\n\t\treturn &appServerCollection{servers: out}, nil\n\tcase types.KindNetworkRestrictions:\n\t\tnr, err := client.GetNetworkRestrictions(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &netRestrictionsCollection{nr}, nil\n\tcase types.KindApp:\n\t\tif rc.ref.Name == \"\" {\n\t\t\tapps, err := client.GetApps(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\treturn &appCollection{apps: apps}, nil\n\t\t}\n\t\tapp, err := client.GetApp(ctx, rc.ref.Name)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &appCollection{apps: []types.Application{app}}, nil\n\tcase types.KindDatabase:\n\t\tdatabases, err := client.GetDatabases(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\tif rc.ref.Name == \"\" {\n\t\t\treturn &databaseCollection{databases: databases}, nil\n\t\t}\n\t\tdatabases = filterByNameOrPrefix(databases, rc.ref.Name)\n\t\tif len(databases) == 0 {\n\t\t\treturn nil, trace.NotFound(\"database %q not found\", rc.ref.Name)\n\t\t}\n\t\treturn &databaseCollection{databases: databases}, nil\n\tcase types.KindKubernetesCluster:\n\t\tclusters, err := client.GetKubernetesClusters(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\tif rc.ref.Name == \"\" {\n\t\t\treturn &kubeClusterCollection{clusters: clusters}, nil\n\t\t}\n\t\tclusters = filterByNameOrPrefix(clusters, rc.ref.Name)\n\t\tif len(clusters) == 0 {\n\t\t\treturn nil, trace.NotFound(\"kubernetes cluster %q not found\", rc.ref.Name)\n\t\t}\n\t\treturn &kubeClusterCollection{clusters: clusters}, nil\n\tcase types.KindWindowsDesktopService:\n\t\tservices, err := client.GetWindowsDesktopServices(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\tif rc.ref.Name == \"\" {\n\t\t\treturn &windowsDesktopServiceCollection{services: services}, nil\n\t\t}\n\n\t\tvar out []types.WindowsDesktopService\n\t\tfor _, service := range services {\n\t\t\tif service.GetName() == rc.ref.Name {\n\t\t\t\tout = append(out, service)\n\t\t\t}\n\t\t}\n\t\tif len(out) == 0 {\n\t\t\treturn nil, trace.NotFound(\"Windows desktop service %q not found\", rc.ref.Name)\n\t\t}\n\t\treturn &windowsDesktopServiceCollection{services: out}, nil\n\tcase types.KindWindowsDesktop:\n\t\tdesktops, err := client.GetWindowsDesktops(ctx, types.WindowsDesktopFilter{})\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\tif rc.ref.Name == \"\" {\n\t\t\treturn &windowsDesktopCollection{desktops: desktops}, nil\n\t\t}\n\n\t\tvar out []types.WindowsDesktop\n\t\tfor _, desktop := range desktops {\n\t\t\tif desktop.GetName() == rc.ref.Name {\n\t\t\t\tout = append(out, desktop)\n\t\t\t}\n\t\t}\n\t\tif len(out) == 0 {\n\t\t\treturn nil, trace.NotFound(\"Windows desktop %q not found\", rc.ref.Name)\n\t\t}\n\t\treturn &windowsDesktopCollection{desktops: out}, nil\n\tcase types.KindToken:\n\t\tif rc.ref.Name == \"\" {\n\t\t\ttokens, err := client.GetTokens(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\treturn &tokenCollection{tokens: tokens}, nil\n\t\t}\n\t\ttoken, err := client.GetToken(ctx, rc.ref.Name)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &tokenCollection{tokens: []types.ProvisionToken{token}}, nil\n\tcase types.KindInstaller:\n\t\tif rc.ref.Name == \"\" {\n\t\t\tinstallers, err := client.GetInstallers(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\treturn &installerCollection{installers: installers}, nil\n\t\t}\n\t\tinst, err := client.GetInstaller(ctx, rc.ref.Name)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &installerCollection{installers: []types.Installer{inst}}, nil\n\tcase types.KindUIConfig:\n\t\tif rc.ref.Name != \"\" {\n\t\t\treturn nil, trace.BadParameter(\"only simple `tctl get %v` can be used\", types.KindUIConfig)\n\t\t}\n\t\tuiconfig, err := client.GetUIConfig(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn &uiConfigCollection{uiconfig}, nil\n\tcase types.KindDatabaseService:\n\t\tresourceName := rc.ref.Name\n\t\tlistReq := proto.ListResourcesRequest{\n\t\t\tResourceType: types.KindDatabaseService,\n\t\t}\n\t\tif resourceName != \"\" {\n\t\t\tlistReq.PredicateExpression = fmt.Sprintf(`name == \"%s\"`, resourceName)\n\t\t}\n\n\t\tgetResp, err := apiclient.GetResourcesWithFilters(ctx, client, listReq)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\n\t\tdatabaseServices, err := types.ResourcesWithLabels(getResp).AsDatabaseServices()\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\n\t\tif len(databaseServices) == 0 && resourceName != \"\" {\n\t\t\treturn nil, trace.NotFound(\"Database Service %q not found\", resourceName)\n\t\t}\n\n\t\treturn &databaseServiceCollection{databaseServices: databaseServices}, nil\n\tcase types.KindLoginRule:\n\t\tloginRuleClient := client.LoginRuleClient()\n\t\tif rc.ref.Name == \"\" {\n\t\t\tfetch := func(token string) (*loginrulepb.ListLoginRulesResponse, error) {\n\t\t\t\tresp, err := loginRuleClient.ListLoginRules(ctx, &loginrulepb.ListLoginRulesRequest{\n\t\t\t\t\tPageToken: token,\n\t\t\t\t})\n\t\t\t\treturn resp, trail.FromGRPC(err)\n\t\t\t}\n\t\t\tvar rules []*loginrulepb.LoginRule\n\t\t\tresp, err := fetch(\"\")\n\t\t\tfor ; err == nil; resp, err = fetch(resp.NextPageToken) {\n\t\t\t\trules = append(rules, resp.LoginRules...)\n\t\t\t\tif resp.NextPageToken == \"\" {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn &loginRuleCollection{rules}, trace.Wrap(err)\n\t\t}\n\t\trule, err := loginRuleClient.GetLoginRule(ctx, &loginrulepb.GetLoginRuleRequest{\n\t\t\tName: rc.ref.Name,\n\t\t})\n\t\treturn &loginRuleCollection{[]*loginrulepb.LoginRule{rule}}, trail.FromGRPC(err)\n\tcase types.KindSAMLIdPServiceProvider:\n\t\tif rc.ref.Name != \"\" {\n\t\t\tserviceProvider, err := client.GetSAMLIdPServiceProvider(ctx, rc.ref.Name)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\treturn &samlIdPServiceProviderCollection{serviceProviders: []types.SAMLIdPServiceProvider{serviceProvider}}, nil\n\t\t}\n\t\tvar resources []types.SAMLIdPServiceProvider\n\t\tnextKey := \"\"\n\t\tfor {\n\t\t\tvar sps []types.SAMLIdPServiceProvider\n\t\t\tvar err error\n\t\t\tsps, nextKey, err = client.ListSAMLIdPServiceProviders(ctx, 0, nextKey)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\n\t\t\tresources = append(resources, sps...)\n\t\t\tif nextKey == \"\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn &samlIdPServiceProviderCollection{serviceProviders: resources}, nil\n\tcase types.KindDevice:\n\t\tremote := client.DevicesClient()\n\t\tif rc.ref.Name != \"\" {\n\t\t\tresp, err := remote.FindDevices(ctx, &devicepb.FindDevicesRequest{\n\t\t\t\tIdOrTag: rc.ref.Name,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\n\t\t\treturn &deviceCollection{resp.Devices}, nil\n\t\t}\n\n\t\treq := &devicepb.ListDevicesRequest{\n\t\t\tView: devicepb.DeviceView_DEVICE_VIEW_RESOURCE,\n\t\t}\n\t\tvar devs []*devicepb.Device\n\t\tfor {\n\t\t\tresp, err := remote.ListDevices(ctx, req)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\n\t\t\tdevs = append(devs, resp.Devices...)\n\n\t\t\tif resp.NextPageToken == \"\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treq.PageToken = resp.NextPageToken\n\t\t}\n\n\t\tsort.Slice(devs, func(i, j int) bool {\n\t\t\td1 := devs[i]\n\t\t\td2 := devs[j]\n\n\t\t\tif d1.AssetTag == d2.AssetTag {\n\t\t\t\treturn d1.OsType < d2.OsType\n\t\t\t}\n\n\t\t\treturn d1.AssetTag < d2.AssetTag\n\t\t})\n\n\t\treturn &deviceCollection{devices: devs}, nil\n\tcase types.KindOktaImportRule:\n\t\tif rc.ref.Name != \"\" {\n\t\t\timportRule, err := client.OktaClient().GetOktaImportRule(ctx, rc.ref.Name)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\treturn &oktaImportRuleCollection{importRules: []types.OktaImportRule{importRule}}, nil\n\t\t}\n\t\tvar resources []types.OktaImportRule\n\t\tnextKey := \"\"\n\t\tfor {\n\t\t\tvar importRules []types.OktaImportRule\n\t\t\tvar err error\n\t\t\timportRules, nextKey, err = client.OktaClient().ListOktaImportRules(ctx, 0, nextKey)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\n\t\t\tresources = append(resources, importRules...)\n\t\t\tif nextKey == \"\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn &oktaImportRuleCollection{importRules: resources}, nil\n\tcase types.KindOktaAssignment:\n\t\tif rc.ref.Name != \"\" {\n\t\t\tassignment, err := client.OktaClient().GetOktaAssignment(ctx, rc.ref.Name)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\treturn &oktaAssignmentCollection{assignments: []types.OktaAssignment{assignment}}, nil\n\t\t}\n\t\tvar resources []types.OktaAssignment\n\t\tnextKey := \"\"\n\t\tfor {\n\t\t\tvar assignments []types.OktaAssignment\n\t\t\tvar err error\n\t\t\tassignments, nextKey, err = client.OktaClient().ListOktaAssignments(ctx, 0, nextKey)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\n\t\t\tresources = append(resources, assignments...)\n\t\t\tif nextKey == \"\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn &oktaAssignmentCollection{assignments: resources}, nil\n\tcase types.KindUserGroup:\n\t\tif rc.ref.Name != \"\" {\n\t\t\tuserGroup, err := client.GetUserGroup(ctx, rc.ref.Name)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\treturn &userGroupCollection{userGroups: []types.UserGroup{userGroup}}, nil\n\t\t}\n\t\tvar resources []types.UserGroup\n\t\tnextKey := \"\"\n\t\tfor {\n\t\t\tvar userGroups []types.UserGroup\n\t\t\tvar err error\n\t\t\tuserGroups, nextKey, err = client.ListUserGroups(ctx, 0, nextKey)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\n\t\t\tresources = append(resources, userGroups...)\n\t\t\tif nextKey == \"\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn &userGroupCollection{userGroups: resources}, nil\n\n\tcase types.KindIntegration:\n\t\tif rc.ref.Name != \"\" {\n\t\t\tig, err := client.GetIntegration(ctx, rc.ref.Name)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\treturn &integrationCollection{integrations: []types.Integration{ig}}, nil\n\t\t}\n\n\t\tvar resources []types.Integration\n\t\tvar igs []types.Integration\n\t\tvar err error\n\t\tvar nextKey string\n\t\tfor {\n\t\t\tigs, nextKey, err = client.ListIntegrations(ctx, 0, nextKey)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\tresources = append(resources, igs...)\n\t\t\tif nextKey == \"\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\treturn &integrationCollection{integrations: resources}, nil\n\t}\n\treturn nil, trace.BadParameter(\"getting %q is not supported\", rc.ref.String())\n}", "func C(cfg *Config) *mgo.Collection {\n\treturn cfg.Mongo.session.DB(cfg.Mongo.Database).C(cfg.Mongo.Collection)\n}", "func (s MutableAccountNFTsInCollectionParams) Collection() wasmtypes.ScMutableNftID {\n\treturn wasmtypes.NewScMutableNftID(s.Proxy.Root(ParamCollection))\n}", "func (s ImmutableAccountNFTAmountInCollectionParams) Collection() wasmtypes.ScImmutableNftID {\n\treturn wasmtypes.NewScImmutableNftID(s.Proxy.Root(ParamCollection))\n}", "func (s ImmutableAccountNFTsInCollectionParams) Collection() wasmtypes.ScImmutableNftID {\n\treturn wasmtypes.NewScImmutableNftID(s.Proxy.Root(ParamCollection))\n}", "func (avi *AviSession) GetCollection(uri string) (AviCollectionResult, error) {\n\tvar result AviCollectionResult\n\tres, rerror := avi.rest_request(\"GET\", uri, nil)\n\tif rerror != nil || res == nil {\n\t\treturn result, rerror\n\t}\n\terr := json.Unmarshal(res, &result)\n\treturn result, err\n}", "func C(name string) *mgo.Collection {\n return Db.C(name)\n}", "func collections(r *http.Request) ([]byte, error) {\n\tn, e := webutil.String(r, \"db\")\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\tc, e := db.Collections(n)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\treturn util.JSON(map[string]interface{}{\"collections\": c})\n}", "func (u UserDAO) getCollection() *mgo.Collection {\n\treturn u.conn.DB(\"bookfire\").C(\"users\")\n}", "func (us *UsersService) Collections(username string, queryParams client.QueryParams) ([]client.Collection, error) {\n\tctx := context.Background()\n\treturn us.client.GetUserCollections(ctx, username, queryParams)\n}", "func (b *Bucket) Collection(collectionName string) *Collection {\n\treturn b.DefaultScope().Collection(collectionName)\n}", "func GetCollection(session *mgo.Session, collectionName string) *mgo.Collection {\n\treturn GetDatabase(session).C(collectionName)\n}", "func (rt *RestTester) getCollectionsForBLIP() []string {\n\tdb := rt.GetDatabase()\n\tvar collections []string\n\tif db.OnlyDefaultCollection() {\n\t\treturn collections\n\t}\n\tfor _, collection := range db.CollectionByID {\n\t\tcollections = append(collections, base.ScopeAndCollectionName{\n\t\t\tScope: collection.ScopeName,\n\t\t\tCollection: collection.Name,\n\t\t}.String())\n\t}\n\treturn collections\n}", "func GetColl(s *mgo.Session, collName string) []Simple {\n if s == nil {\n log.Println(\"FATAL: Can not access MongoDB! Application Closing!\")\n os.Exit(1)\n }\n\n defer s.Close()\n s.SetMode(mgo.Monotonic, true)\n\n c := s.DB(\"nebula\").C(collName)\n\n var results []Simple\n err := c.Find(nil).All(&results)\n\n if err != nil {\n log.Printf(\"ERROR: Can not access \"+collName+\" collection to get items!\") \n }\n\n return results\n}", "func (b *Bucket) Collections() *CollectionManager {\n\tcli := b.sb.getCachedClient()\n\n\treturn &CollectionManager{\n\t\tcollectionsSupported: cli.supportsCollections(),\n\t\tmgmtProvider: b,\n\t\tbucketName: b.Name(),\n\t\ttracer: b.sb.Tracer,\n\t}\n}", "func (r *staticCollection) Get(id string) (any, error) {\n\treturn r.items[id], nil\n}", "func GetServerCollection(start int, count int) (*model.ServerCollection, []commonMessage.Message) {\n\tdbImpl := db.GetDBInstance()\n\tret, err := dbImpl.GetServerCollection(start, count)\n\tif err != nil {\n\t\treturn nil, []commonMessage.Message{commonMessage.NewInternalError()}\n\t}\n\treturn ret, nil\n}", "func (s *Scope) Collection(collectionName string) *Collection {\n\treturn newCollection(s, collectionName)\n}", "func (b *Bucket) GetFilesCollection(_ context.Context) ICollection {\n\treturn b.files\n}", "func (c *vertexCollection) rawCollection() Collection {\n\tresult, _ := newCollection(c.name, c.g.db)\n\treturn result\n}", "func (svc *Rekognition) GetCollection(name string) (*Collection, error) {\n\tcollectionName := svc.prefix + name\n\n\t// get the stream from cache\n\tsvc.collectionsMu.RLock()\n\tc, ok := svc.collections[collectionName]\n\tsvc.collectionsMu.RUnlock()\n\tif ok {\n\t\treturn c, nil\n\t}\n\n\tc = NewCollection(svc, name)\n\tsvc.collectionsMu.Lock()\n\tsvc.collections[collectionName] = c\n\tsvc.collectionsMu.Unlock()\n\treturn c, nil\n}", "func (role *roleImpl) getCollectionAccess(scope, collection string) (*CollectionAccess, bool) {\n\tca, ok := role.CollectionsAccess[scope][collection]\n\treturn ca, ok\n}", "func (avisess *AviSession) GetCollection(uri string, objList interface{}, options ...ApiOptionsParams) error {\n\tresult, err := avisess.GetCollectionRaw(uri, options...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif result.Count == 0 {\n\t\treturn nil\n\t}\n\treturn json.Unmarshal(result.Results, &objList)\n}", "func NewCollection() *Collection {\n\treturn &Collection{}\n}", "func (m *MongoDB) C(name string) *mgo.Collection {\n\treturn m.db.C(name)\n}", "func (a *Client) GETCollections(params *GETCollectionsParams, authInfo runtime.ClientAuthInfoWriter) (*GETCollectionsOK, *GETCollectionsAccepted, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGETCollectionsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getCollections\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/id4ns/{id4n}/collections\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/xml\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/xml\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GETCollectionsReader{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, nil, err\n\t}\n\tswitch value := result.(type) {\n\tcase *GETCollectionsOK:\n\t\treturn value, nil, nil\n\tcase *GETCollectionsAccepted:\n\t\treturn nil, value, nil\n\t}\n\treturn nil, nil, nil\n\n}", "func (task *ParseTask) GetCollections(content []byte) ([]wisply.Collectioner, error) {\n\ttask.addContent(\"collections\")\n\tcollections, err := task.remote.GetCollections(content)\n\tnumber := strconv.Itoa(len(collections))\n\ttask.finishRequest(err, \"Success. \"+number+\" `collections` has been identified\")\n\n\treturn collections, err\n}", "func (h CollectionsHandler) Get(w http.ResponseWriter, r *http.Request) {\n\tlog.WithFields(log.Fields{\"handler\": \"CollectionsHandler\"}).Debug(\"Handler called\")\n\n\tif len(takeCollectionID(r)) > 0 {\n\t\tresourceNotFound(w, errors.New(\"Collection ID doesn't exist in this API Root\"))\n\t\treturn\n\t}\n\n\tp, err := cabby.NewPage(takeLimit(r))\n\tif err != nil {\n\t\tbadRequest(w, err)\n\t\treturn\n\t}\n\n\tcollections, err := h.CollectionService.Collections(r.Context(), takeAPIRoot(r), &p)\n\tif err != nil {\n\t\tinternalServerError(w, err)\n\t\treturn\n\t}\n\n\tif noResources(len(collections.Collections)) {\n\t\tresourceNotFound(w, errors.New(\"No resources available for this request\"))\n\t\treturn\n\t}\n\n\twriteContent(w, r, cabby.TaxiiContentType, resourceToJSON(collections))\n}", "func (repo *repository) Get(name string) (*CollectionType, error) {\n\trepo.mu.Lock()\n\tdefer repo.mu.Unlock()\n\n\tif a, ok := repo.collections[name]; ok {\n\t\treturn a, nil\n\t}\n\treturn nil, fmt.Errorf(\"can't find CollectionType named %s\", name)\n}", "func (b *Bucket) GetMarkersCollection(_ context.Context) ICollection {\n\treturn b.markers\n}", "func Coll(colname string) driver.Collection {\n\tcol, err := Database.Collection(nil, colname)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to open collection: %v\", err)\n\t}\n\treturn col\n}", "func (b *Bucket) GetChunksCollection(_ context.Context) ICollection {\n\treturn b.chunks\n}", "func newCollection() *collection {\n\treturn &collection{\n\t\terrs: []error{},\n\t}\n}", "func GetKeyValueExpireViaCollection(iCollection string) (*KeyValueExpire, error) {\n\tvar _KeyValueExpire = &KeyValueExpire{Collection: iCollection}\n\thas, err := Engine.Get(_KeyValueExpire)\n\tif has {\n\t\treturn _KeyValueExpire, err\n\t} else {\n\t\treturn nil, err\n\t}\n}", "func getCollections(db *DB) []Collection {\n\tvar IDs []NodeIdentifier\n\tvar out []Collection\n\tqs := \"select id,pid from nodes where parent_id is null\"\n\tdb.Select(&IDs, qs)\n\n\ttq := \"select value from nodes where ancestry=? and node_type_id=? order by id asc limit 1\"\n\tfor _, val := range IDs {\n\t\tvar title string\n\t\tdb.QueryRow(tq, val.ID, 2).Scan(&title)\n\t\tout = append(out, Collection{ID: val.ID, PID: val.PID, Title: title})\n\t}\n\treturn out\n}", "func GetCollection(collection string) *mongo.Collection {\n\tif client == nil {\n\t\tinitClient()\n\t}\n\n\tucol := client.Database(\"loanCalc\").Collection(collection)\n\n\treturn ucol\n}", "func (s *PagesService) Collections(ctx context.Context, pageID int) ([]*PageCollection, *http.Response, error) {\n\tu := fmt.Sprintf(\"v1/pages/%d/collections\", pageID)\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treq.Header.Set(\"Accept\", \"application/json\")\n\n\tvar collections []*PageCollection\n\tresp, err := s.client.Do(ctx, req, &collections)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn collections, resp, nil\n}", "func routeCollection(db *mongo.Database) *mongo.Collection {\n\treturn db.Collection(\"routes\")\n}", "func GetKeyValueViaCollection(iCollection string) (*KeyValue, error) {\n\tvar _KeyValue = &KeyValue{Collection: iCollection}\n\thas, err := Engine.Get(_KeyValue)\n\tif has {\n\t\treturn _KeyValue, err\n\t} else {\n\t\treturn nil, err\n\t}\n}", "func getCollections() ([]*SQLDeskCollection, error) {\n\n\tbuilder := make(map[string]*SQLDeskCollection)\n\tresult, err := (database).GetDeskCollections()\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tr := result.(*sql.Rows)\n\tdefer r.Close()\n\n\tvar DeskID, Name, IP, Port, Red, Green, Blue, Health, Retries, CollectionID, AssociationID, Associated_Desk_ID, Associated_Collection_ID, CollectionName string\n\n\tfor r.Next() {\n\n\t\terr := r.Scan(&CollectionID,\n\t\t\t\t\t &CollectionName,\n\t\t\t\t\t &AssociationID,\n\t\t\t\t\t &Associated_Collection_ID,\n\t\t\t\t\t &Associated_Desk_ID,\n\t\t\t\t\t &DeskID,\n\t\t\t\t\t &Name,\n\t\t\t\t\t &IP,\n\t\t\t\t\t &Port,\n\t\t\t\t\t &Red,\n\t\t\t\t\t &Green,\n\t\t\t\t\t &Blue,\n\t\t\t\t\t &Health,\n\t\t\t\t\t &Retries)\n\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tif dc := builder[CollectionName]; dc == nil {\n\t\t\tvar deskCollection SQLDeskCollection\n\t\t\tdeskCollection.CollectionID = CollectionID\n\t\t\tdeskCollection.Name = CollectionName\n\t\t\tdeskCollection.Desks = append(deskCollection.Desks, SQLDesk{DeskID, Name, IP, Port, Red, Green, Blue, Health, Retries})\n\t\t\tbuilder[CollectionName] = &deskCollection\n\t\t\t} else {\n\t\t\tdc.Desks = append(dc.Desks, SQLDesk{DeskID, Name, IP, Port, Red, Green, Blue, Health, Retries})\n\t\t}\n\t}\n\n\tvar collections []*SQLDeskCollection\n\tfor _, collection := range builder {\n\t\t\tcollections = append(collections, collection)\n\t}\n\n\treturn collections, nil\n}", "func AdminCollection(c *mongo.Database) {\n\tadminCollection = c.Collection(\"admins\")\n}", "func GetEndpointCollection(ctx iris.Context) {\n\turi := ctx.Request().RequestURI\n\tfabricID := ctx.Params().Get(\"id\")\n\t_, ok := capdata.FabricDataStore.Data[fabricID]\n\tif !ok {\n\t\terrMsg := fmt.Sprintf(\"Endpoint data for uri %s not found\", uri)\n\t\tlog.Error(errMsg)\n\t\tresp := updateErrorResponse(response.ResourceNotFound, errMsg, []interface{}{\"Endpoint\", uri})\n\t\tctx.StatusCode(http.StatusNotFound)\n\t\tctx.JSON(resp)\n\t\treturn\n\t}\n\tvar members = []*model.Link{}\n\n\tfor endpointID, endpointData := range capdata.EndpointDataStore {\n\t\tif endpointData.FabricID == fabricID {\n\t\t\tmembers = append(members, &model.Link{\n\t\t\t\tOid: endpointID,\n\t\t\t})\n\t\t}\n\t}\n\tendpointCollection := model.Collection{\n\t\tODataContext: \"/ODIM/v1/$metadata#EndpointCollection.EndpointCollection\",\n\t\tODataID: uri,\n\t\tODataType: \"#EndpointCollection.EndpointCollection\",\n\t\tDescription: \"EndpointCollection view\",\n\t\tName: \"Endpoints\",\n\t\tMembers: members,\n\t\tMembersCount: len(members),\n\t}\n\tctx.StatusCode(http.StatusOK)\n\tctx.JSON(endpointCollection)\n}", "func (s *MongoStore) C(sess *mgo.Session, collectionName string) *mgo.Collection {\n\treturn sess.DB(s.db).C(collectionName)\n}", "func (r *PolicyAppliesToCollectionRequest) Get(ctx context.Context) ([]DirectoryObject, error) {\n\treturn r.GetN(ctx, 0)\n}", "func GetCollectionStatList(client *mongo.Client) *CollectionStatList {\n\tcollectionStatList := &CollectionStatList{}\n\tdbNames, err := client.ListDatabaseNames(context.TODO(), bson.M{})\n\tif err != nil {\n\t\tif !logSuppressCS.Contains(keyCS) {\n\t\t\tlog.Warnf(\"%s. Collection stats will not be collected. This log message will be suppressed from now.\", err)\n\t\t\tlogSuppressCS.Add(keyCS)\n\t\t}\n\t\treturn nil\n\t}\n\n\tlogSuppressCS.Delete(keyCS)\n\tfor _, dbName := range dbNames {\n\t\tif common.IsSystemDB(dbName) {\n\t\t\tcontinue\n\t\t}\n\n\t\tcollNames, err := client.Database(dbName).ListCollectionNames(context.TODO(), bson.M{})\n\t\tif err != nil {\n\t\t\tif !logSuppressCS.Contains(dbName) {\n\t\t\t\tlog.Warnf(\"%s. Collection stats will not be collected for this db. This log message will be suppressed from now.\", err)\n\t\t\t\tlogSuppressCS.Add(dbName)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tlogSuppressCS.Delete(dbName)\n\t\tfor _, collName := range collNames {\n\t\t\tif common.IsSystemCollection(collName) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfullCollName := common.CollFullName(dbName, collName)\n\t\t\tcollStatus := CollectionStatus{}\n\t\t\tres := client.Database(dbName).RunCommand(context.TODO(), bson.D{{\"collStats\", collName}, {\"scale\", 1}})\n\t\t\tif err = res.Decode(&collStatus); err != nil {\n\t\t\t\tif !logSuppressCS.Contains(fullCollName) {\n\t\t\t\t\tlog.Warnf(\"%s. Collection stats will not be collected for this collection. This log message will be suppressed from now.\", err)\n\t\t\t\t\tlogSuppressCS.Add(fullCollName)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlogSuppressCS.Delete(fullCollName)\n\t\t\tcollStatus.Database = dbName\n\t\t\tcollStatus.Name = collName\n\t\t\tcollectionStatList.Members = append(collectionStatList.Members, collStatus)\n\t\t}\n\t}\n\n\treturn collectionStatList\n}", "func (m *MongoDAL) c(collection string) *mgo.Collection {\n\treturn m.session.DB(m.dbName).C(collection)\n}", "func CollectionForModel(model interface{}) (string, error) {\n\treturn CollectionForModelField(model, \"ID\")\n}", "func (d *Dao) GetCollection(session *mgo.Session, collectionName string) *mgo.Collection {\n\treturn session.DB(dbname).C(collectionName)\n}", "func (database *Database) GetCollection(collection string) (*db.Col, error) {\n\t// Make sure the collection exists first\n\tif err := database.createCollection(collection); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Switch to the collection\n\tobjects := database.Client.Use(collection)\n\n\t// Return the collection\n\treturn objects, nil\n}", "func (s *Manager) GetCollectionRules(ctx context.Context, project, dbAlias, col string) ([]interface{}, error) {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\ttype response struct {\n\t\tIsRealTimeEnabled bool `json:\"isRealtimeEnabled\"`\n\t\tRules map[string]*config.Rule `json:\"rules\"`\n\t}\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif dbAlias != \"\" && col != \"\" {\n\t\tcollectionInfo, ok := projectConfig.Modules.Crud[dbAlias].Collections[col]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"specified collection (%s) not present in config for dbAlias (%s) )\", dbAlias, col)\n\t\t}\n\t\treturn []interface{}{map[string]*response{fmt.Sprintf(\"%s-%s\", dbAlias, col): {IsRealTimeEnabled: collectionInfo.IsRealTimeEnabled, Rules: collectionInfo.Rules}}}, nil\n\t} else if dbAlias != \"\" {\n\t\tcollections := projectConfig.Modules.Crud[dbAlias].Collections\n\t\tcoll := map[string]*response{}\n\t\tfor key, value := range collections {\n\t\t\tcoll[fmt.Sprintf(\"%s-%s\", dbAlias, key)] = &response{IsRealTimeEnabled: value.IsRealTimeEnabled, Rules: value.Rules}\n\t\t}\n\t\treturn []interface{}{coll}, nil\n\t}\n\tdatabases := projectConfig.Modules.Crud\n\tcoll := map[string]*response{}\n\tfor dbName, dbInfo := range databases {\n\t\tfor key, value := range dbInfo.Collections {\n\t\t\tcoll[fmt.Sprintf(\"%s-%s\", dbName, key)] = &response{IsRealTimeEnabled: value.IsRealTimeEnabled, Rules: value.Rules}\n\t\t}\n\t}\n\treturn []interface{}{coll}, nil\n}", "func UsersCollection() *mongo.Collection {\n\treturn usersCollection\n}", "func (c *Collection) Adding() *Slice {\n\treturn c.register\n}", "func (d *closedDB) GetCollection(ctx context.Context, req *protomodel.GetCollectionRequest) (*protomodel.GetCollectionResponse, error) {\n\treturn nil, store.ErrAlreadyClosed\n}", "func (db *Mngo) GetCollection(c *store.Context, model store.Model) *mongo.Collection {\n\tutils.EnsurePointer(model)\n\tmongoModel := store.EnsureGenericModel(model)\n\treturn db.database.Collection(mongoModel.GetCollection())\n}", "func (r *mongoRepository) getProjectsCollection() *mongo.Collection {\n\treturn r.client.Database(r.database).Collection(\"projects\")\n}", "func (m *collection) Stats() (*CollectionStats, error) {\n\trv := &CollectionStats{}\n\n\tm.stats.AtomicCopyTo(rv)\n\n\tm.m.Lock()\n\tm.statsSegmentsLOCKED(rv)\n\tm.m.Unlock()\n\n\treturn rv, nil\n}", "func StaticCollections(packageName string, m *ast.Metadata) (string, error) {\n\tentries := make([]colEntry, 0, len(m.Collections))\n\tfor _, c := range m.Collections {\n\t\tr := m.FindResourceForGroupKind(c.Group, c.Kind)\n\t\tif r == nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to find resource (%s/%s) for collection %s\", c.Group, c.Kind, c.Name)\n\t\t}\n\n\t\tentries = append(entries, colEntry{\n\t\t\tCollection: c,\n\t\t\tResource: r,\n\t\t})\n\t}\n\n\tsort.Slice(entries, func(i, j int) bool {\n\t\treturn strings.Compare(entries[i].Collection.Name, entries[j].Collection.Name) < 0\n\t})\n\n\tcontext := struct {\n\t\tEntries []colEntry\n\t\tPackageName string\n\t}{\n\t\tEntries: entries,\n\t\tPackageName: packageName,\n\t}\n\n\t// Calculate the Go packages that needs to be imported for the proto types to be registered.\n\treturn applyTemplate(staticCollectionsTemplate, context)\n}", "func (b *Bucket) GetFilesCollection() *mongo.Collection {\n\treturn b.filesColl\n}", "func (t mongoTokenizer) collection() *mgo.Collection {\n\t// lightweight operation, involves no network communication\n\tcol := t.db.C(\"tokens\")\n\treturn col\n}", "func (d *Database) Collection(name string) *Collection {\n\tvar cp *mongo.Collection\n\n\tcp = d.database.Collection(name)\n\n\treturn &Collection{\n\t\tcollection: cp,\n\t}\n}", "func List(collection Getter) func(ctx context.Context) ([]interface{}, error) {\n\treturn func(ctx context.Context) ([]interface{}, error) {\n\t\tprojects := []Project{}\n\t\terr := collection.GetAll(ctx, &projects)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\titems := make([]interface{}, len(projects))\n\t\tfor i, v := range projects {\n\t\t\titems[i] = v\n\t\t}\n\t\treturn items, nil\n\t}\n}", "func retrieveMongoCollection(client *mongo.Client, db string, collection string) *mongo.Collection {\n\tcol := client.Database(db).Collection(collection)\n\treturn col\n}", "func (*Collection_SubCollection) Descriptor() ([]byte, []int) {\n\treturn file_config_v1_resources_proto_rawDescGZIP(), []int{18, 0}\n}", "func TagCollection(c *mongo.Database) {\n\ttagCollection = c.Collection(\"tags\")\n}", "func (l Link) Collection(database, collection string) (*mongo.Collection, error) {\n\tif err := l.linkCheck(\"link.Collection\"); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn l.client.Database(database).Collection(collection), nil\n}", "func (a *ArangoDb) collection(ctx context.Context, colName string) (arango.Collection, error) {\n\tvar col arango.Collection\n\n\tcol, err := (*a.Db).Collection(ctx, colName)\n\n\tif arango.IsNotFound(err) {\n\t\tcol, err = (*a.Db).CreateCollection(ctx, colName, nil)\n\t} else if err != nil {\n\t\treturn nil, &e.Error{Code: e.EINTERNAL, Op: \"db.collection\", Err: err}\n\t}\n\n\treturn col, nil\n}", "func (m *IdentitySetCollectionResponse) GetValue()([]IdentitySetable) {\n val, err := m.GetBackingStore().Get(\"value\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]IdentitySetable)\n }\n return nil\n}", "func (i *ServerDBImplement) GetServerCollection(start int, count int) (*model.ServerCollection, error) {\n\tvar (\n\t\ttotal int\n\t\tserver []entity.Server\n\t\tret = new(model.ServerCollection)\n\t)\n\n\tc := commonDB.GetConnection()\n\tc.Table(\"server\").Count(&total)\n\tc.Order(\"Name asc\").Limit(count).Offset(start).Select([]string{\"ID\", \"Name\", \"State\", \"Health\"}).Find(&server)\n\tret.Start = start\n\tret.Count = len(server)\n\tret.Total = total\n\tfor i := range server {\n\t\tret.Members = append(ret.Members, model.ServerMember{\n\t\t\tID: server[i].ID,\n\t\t\tName: server[i].Name,\n\t\t\tState: server[i].State,\n\t\t\tHealth: server[i].Health,\n\t\t})\n\t}\n\treturn ret, nil\n}", "func (app *App) getCollection(collection string) *mongo.Collection {\n\treturn app.MongoClient.Database(app.Config.DbName).Collection(collection)\n}", "func (a *ManagementApiService) GetCollection(ctx _context.Context, applicationId int32, campaignId int32, collectionId int32) apiGetCollectionRequest {\n\treturn apiGetCollectionRequest{\n\t\tapiService: a,\n\t\tctx: ctx,\n\t\tapplicationId: applicationId,\n\t\tcampaignId: campaignId,\n\t\tcollectionId: collectionId,\n\t}\n}", "func (s *SmartCollectionServiceOp) Get(collectionID int64, options interface{}) (*SmartCollection, error) {\n\tpath := fmt.Sprintf(\"%s/%d.json\", smartCollectionsBasePath, collectionID)\n\tresource := new(SmartCollectionResource)\n\terr := s.client.Get(path, resource, options)\n\treturn resource.Collection, err\n}", "func (c *Collection) Entities() *Slice {\n\treturn c.entities.Slice()\n}" ]
[ "0.64066327", "0.6346272", "0.6314892", "0.6311393", "0.62494123", "0.623893", "0.62287575", "0.6194703", "0.6170104", "0.612091", "0.6087927", "0.60627484", "0.60557365", "0.6017529", "0.5995261", "0.5989541", "0.59014827", "0.58967024", "0.58730906", "0.5862669", "0.5838353", "0.5798528", "0.57957643", "0.5790129", "0.5768274", "0.5761341", "0.57591057", "0.57588553", "0.5751034", "0.57422984", "0.5738969", "0.5734476", "0.5732001", "0.5715491", "0.5668821", "0.5668425", "0.5664619", "0.56561023", "0.5654981", "0.5625008", "0.56126934", "0.560593", "0.56005436", "0.5577908", "0.5576329", "0.55752254", "0.55726516", "0.55663824", "0.55614865", "0.5557766", "0.5530661", "0.55264217", "0.5513875", "0.5496266", "0.54943234", "0.5456277", "0.54544973", "0.5452824", "0.54455787", "0.54441625", "0.54370403", "0.5433197", "0.543041", "0.53909224", "0.5381478", "0.5375823", "0.5348437", "0.53475636", "0.5332372", "0.53252816", "0.5321485", "0.5311651", "0.5308126", "0.529345", "0.527956", "0.52793974", "0.52609247", "0.52556735", "0.5239091", "0.5236411", "0.52360445", "0.52300537", "0.5225958", "0.5224184", "0.5212222", "0.5211993", "0.5208416", "0.5207065", "0.52025115", "0.5200246", "0.5192459", "0.5191473", "0.5179182", "0.517005", "0.51697755", "0.5167345", "0.5165681", "0.5162032", "0.5157004", "0.5151414" ]
0.6095918
10
NewCreateUserRepository creates new createUserRepository with its dependencies
func NewCreateUserRepository(handler *database.MongoHandler) entity.UserRepositoryCreator { return createUserRepository{ handler: handler, collection: "users", } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *UserRepositoriesClient) Create(ctx context.Context,\n\tref gitprovider.UserRepositoryRef,\n\treq gitprovider.RepositoryInfo,\n\topts ...gitprovider.RepositoryCreateOption) (gitprovider.UserRepository, error) {\n\t// Make sure the RepositoryRef is valid\n\tif err := validateUserRepositoryRef(ref, c.host); err != nil {\n\t\treturn nil, err\n\t}\n\n\tapiObj, err := createRepository(ctx, c.client, addTilde(ref.UserLogin), ref, req, opts...)\n\tif err != nil {\n\t\tif errors.Is(err, ErrAlreadyExists) {\n\t\t\treturn nil, gitprovider.ErrAlreadyExists\n\t\t}\n\t\treturn nil, fmt.Errorf(\"failed to create repository %s/%s: %w\", addTilde(ref.UserLogin), ref.RepositoryName, err)\n\t}\n\n\tref.SetSlug(apiObj.Slug)\n\n\treturn newUserRepository(c.clientContext, apiObj, ref), nil\n}", "func newUserRepo(db *sql.DB) *userRepo {\n\treturn &userRepo{\n\t\tdb: db,\n\t}\n}", "func CreateUserRepositoryForTests() stored_users.UserRepository {\n\tfileRepository := concrete_files.CreateFileRepositoryForTests()\n\tuserBuilderFactory := CreateUserBuilderFactoryForTests()\n\tout := CreateUserRepository(fileRepository, userBuilderFactory)\n\treturn out\n}", "func (u *UserRepository) Create(user *domain.User) (uint, error) {\n\targs := u.Called(user)\n\treturn uint(args.Int(0)), args.Error(1)\n}", "func New(repo rel.Repository) UserRepository {\n\treturn userRepository{\n\t\trepository: repo,\n\t}\n}", "func NewUserRepository(db *sql.DB) *Users {\n\n\treturn &Users{db}\n}", "func (pc UserController) Create(c *gin.Context) {\n\tvar u repository.UserRepository\n\tp, err := u.CreateModel(c)\n\n\tif err != nil {\n\t\tc.AbortWithStatus(400)\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t} else {\n\t\tc.JSON(201, p)\n\t}\n}", "func CreateUserRepository() (*UserRepository, error) {\n\tif databaseConnection == nil {\n\t\treturn nil, ErrGormNotInitialized\n\t}\n\treturn &UserRepository{}, nil\n}", "func CreateUser(w http.ResponseWriter, r *http.Request) {\n\trequestBody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Fatal(\"Error\")\n\t}\n\n\tvar user models.User\n\tif err = json.Unmarshal(requestBody, &user); err != nil {\n\t\tlog.Fatal(\"Error\")\n\t}\n\n\tdb, err := database.OpenDbConnection()\n\tif err != nil {\n\t\tlog.Fatal(\"error\")\n\t}\n\n\trepository := repositories.UserRepository(db)\n\trepository.Create(user)\n}", "func UserCreate(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\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\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\t// Get Result Object\n\tres, err := auth.CreateUser(uuid, urlUser, postBody.FirstName, postBody.LastName, postBody.Organization, postBody.Description,\n\t\tpostBody.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(), \"duplicate\") {\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(), \"invalid\") {\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\n}", "func (u UserRepository) Create() (interface{}, error) {\n\n\tvar sqlStm = `SELECT create_user( $1, $2, $3, $4, $5 )`\n\n\ttx, err := u.DB.Begin()\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s\", err)\n\t}\n\n\tdefer tx.Rollback()\n\n\tstmt, err := tx.Prepare(sqlStm)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s\", err)\n\t}\n\n\tdefer stmt.Close()\n\n\thash, err := bcrypt.GenerateFromPassword([]byte(u.Model.Password), bcrypt.DefaultCost)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s\", err)\n\t}\n\n\tif _, err = stmt.Exec(\n\t\tu.Model.FirstName,\n\t\tu.Model.LastName,\n\t\tu.Model.UserName,\n\t\tstring(hash),\n\t\tu.Model.Email,\n\t); err != nil {\n\t\treturn nil, fmt.Errorf(\"%s\", err)\n\t}\n\n\tif err = tx.Commit(); err != nil {\n\t\treturn nil, fmt.Errorf(\"%s\", err)\n\t}\n\n\treturn u.AuthenticateUser()\n\n}", "func (m *MockIUserRepository) CreateNewUser() *model.User {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateNewUser\")\n\tret0, _ := ret[0].(*model.User)\n\treturn ret0\n}", "func (s *service) createUser(ctx context.Context, newUser *auth.User) error {\n\treturn s.repoMngr.User().Create(ctx, newUser)\n}", "func (us *UserService) Create(ctx context.Context, user User) (int64, error) {\n\treturn us.userRepository.Create(ctx, user)\n}", "func CreateUserRepoImpl(db *gorm.DB) user.UserRepository {\n\treturn &UserRepoImpl{db}\n}", "func NewTestRepository() user.IRepository {\n\tlog.Println(\"Create users table...\")\n\n\trep := &testRepo{\n\t\tusers: make([]*user.User, 0),\n\t}\n\n\treturn rep\n}", "func (m MockRepositoryStore) CreateRepository(ctx context.Context, repositoryID int64, virtualStorage, relativePath, replicaPath, primary string, updatedSecondaries, outdatedSecondaries []string, storePrimary, storeAssignments bool) error {\n\tif m.CreateRepositoryFunc == nil {\n\t\treturn nil\n\t}\n\n\treturn m.CreateRepositoryFunc(ctx, repositoryID, virtualStorage, relativePath, replicaPath, primary, updatedSecondaries, outdatedSecondaries, storePrimary, storeAssignments)\n}", "func (repo *UserRepo) Create(user domain.Register) (domain.User, error) {\n\tvar m struct {\n\t\tCreateUser struct {\n\t\t\tId graphql.String\n\t\t\tName graphql.String\n\t\t\tUsername graphql.String\n\t\t\tPicture graphql.String\n\t\t} `graphql:\"createUser(input:{name: $name, username: $username, role: $role, tokenID: $tokenID, provider: $provider, picture: $picture, status: \\\"active\\\"})\"`\n\t}\n\n\tvars := map[string]interface{}{\n\t\t\"name\": graphql.String(user.Name),\n\t\t\"username\": graphql.String(user.Username),\n\t\t\"picture\": graphql.String(user.Picture),\n\t\t\"role\": graphql.String(user.Role),\n\t\t\"provider\": graphql.String(user.Provider),\n\t\t\"tokenID\": graphql.String(user.TokenID),\n\t}\n\n\terr := repo.client.Mutate(context.Background(), &m, vars)\n\tif err != nil {\n\t\treturn domain.User{}, err\n\t}\n\n\treturn domain.User{\n\t\tId: string(m.CreateUser.Id),\n\t\tName: string(m.CreateUser.Name),\n\t\tUsername: string(m.CreateUser.Username),\n\t\tPicture: string(m.CreateUser.Picture),\n\t}, nil\n}", "func (server Server) CreateNewUser(w http.ResponseWriter, r *http.Request) {\n\tvar user models.User // make a user\n\tvar res models.APIResponse // make a response\n\n\terr := json.NewDecoder(r.Body).Decode(&user) //decode the user\n\tif err != nil {\n\t\tlog.Printf(\"Unable to decode the request body. %v\", err)\n\t\tres = models.BuildAPIResponseFail(\"Unable to decode the request body\", nil)\n\t}\n\tif user.Name == \"\" || user.Email == \"\" || user.Password == \"\" {\n\t\tres = models.BuildAPIResponseFail(\"Blank users cannot be created\", nil)\n\t} else {\n\t\tinsertID := insertUser(user, server.db) // call insert user function and pass the note\n\t\tres = models.BuildAPIResponseSuccess(fmt.Sprintf(\"User Created with %d id\", insertID), nil) // format a response object\n\t}\n\tjson.NewEncoder(w).Encode(res)\n\n}", "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\n}", "func CreateNewUser(user model.User, password string) error {\n\n\t//Maybe we want to do this asynchronous\n\thash, err := bcrypt.GenerateFromPassword([]byte(password), 12)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tuser.HashedPassword = hash\n\n\taccess := data.CreateDataAccess()\n\terr = access.CreateUser(user)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//Created\n\treturn nil\n\n}", "func New() UsersRepository {\n\treturn &usersRepository{}\n}", "func (service *UserService) Create(data *models.User) (*models.User, error) {\n\treturn service.repository.Create(data)\n}", "func (rep *UserRepository) Create(user *models.User) (err error) {\n\tuser.Created = utils.GetTimestampNow()\n\tuser.Updated = utils.GetTimestampNow()\n\terr = databaseConnection.Create(user).Error\n\tif err != nil {\n\t\tlog.Error(0, \"Could not create user: %v\", err)\n\t\treturn\n\t}\n\treturn\n}", "func NewUserRepository(ctx *gin.Context) *userRepository {\n\tuserRepository := userRepository{}\n\tuserRepository.New(ctx)\n\treturn &userRepository\n}", "func (c *Repo) CreateRepo(w http.ResponseWriter, req *http.Request) (int, interface{}) {\n\tsctx := req.Context().Value(middlewares.SessionKey)\n\tsession, ok := sctx.(*types.Session)\n\tif !ok {\n\t\tfmt.Println(\"cant convert to session\", sctx)\n\t\treturn httputils.InternalError()\n\t}\n\n\trepo := types.Repo{}\n\n\terr := json.NewDecoder(req.Body).Decode(&repo)\n\tif err != nil {\n\t\treturn httputils.InternalError()\n\t}\n\n\trepo.Uname = session.User.Uname\n\trepo.OwnerID = session.User.ID\n\n\terr = repos.CreateBareRepo(&repo)\n\tif err != nil {\n\t\treturn http.StatusConflict, httputils.ErrorResponse([]string{\"Repo already exists\"})\n\t}\n\n\treturn http.StatusOK, nil\n}", "func (u *UserRepository) Create(username string) error {\n\t//initialize user model\n\tusername = strings.Replace(username, \" \", \"\", -1)\n\tuser, _ := u.GetByUsername(username)\n\tif user.Username != \"\" {\n\t\tu.log.Errorw(\"user exist\",\n\t\t\t\"username\", username,\n\t\t)\n\t\treturn fmt.Errorf(\"user exist\")\n\t}\n\tuserModel := models.User{}\n\tuserModel.ID = primitive.NewObjectID()\n\tuserModel.CreateAt = time.Now()\n\tuserModel.Username = username\n\t//insert user\n\tres, err := u.db.User.InsertOne(context.Background(), userModel)\n\tif err != nil {\n\t\tu.log.Errorw(\"failed to insert user in db\",\n\t\t\t\"user model\", userModel,\n\t\t\t\"error\", err,\n\t\t)\n\t\treturn err\n\t}\n\t//check the result of insertOne method\n\toid, ok := res.InsertedID.(primitive.ObjectID)\n\tif !ok {\n\t\tu.log.Errorw(\"failed to convert insert ID\",\n\t\t\t\"InsertID\", res.InsertedID,\n\t\t)\n\t\treturn fmt.Errorf(\"failed to convert insert ID\")\n\t}\n\tu.log.Infow(\"inserted new user successfully\",\n\t\t\"user model\", userModel,\n\t\t\"insertID\", oid.Hex(),\n\t)\n\n\treturn nil\n}", "func CreateNewUser(w http.ResponseWriter, r *http.Request) {\n\tfLog := userMgmtLogger.WithField(\"func\", \"CreateNewUser\").WithField(\"RequestID\", r.Context().Value(constants.RequestID)).WithField(\"path\", r.URL.Path).WithField(\"method\", r.Method)\n\n\tiauthctx := r.Context().Value(constants.HansipAuthentication)\n\tif iauthctx == nil {\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusUnauthorized, \"You are not authorized to access this resource\", nil, nil)\n\t\treturn\n\t}\n\n\tfLog.Trace(\"Creating new user\")\n\treq := &CreateNewUserRequest{}\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tfLog.Errorf(\"ioutil.ReadAll got %s\", err.Error())\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusInternalServerError, err.Error(), nil, nil)\n\t\treturn\n\t}\n\terr = json.Unmarshal(body, req)\n\tif err != nil {\n\t\tfLog.Errorf(\"json.Unmarshal got %s\", err.Error())\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusBadRequest, err.Error(), nil, nil)\n\t\treturn\n\t}\n\tisValidPassphrase := passphrase.Validate(req.Passphrase, config.GetInt(\"security.passphrase.minchars\"), config.GetInt(\"security.passphrase.minwords\"), config.GetInt(\"security.passphrase.mincharsinword\"))\n\tif !isValidPassphrase {\n\t\tfLog.Errorf(\"Passphrase invalid\")\n\t\tinvalidMsg := fmt.Sprintf(\"Invalid passphrase. Passphrase must at least has %d characters and %d words and for each word have minimum %d characters\", config.GetInt(\"security.passphrase.minchars\"), config.GetInt(\"security.passphrase.minwords\"), config.GetInt(\"security.passphrase.mincharsinword\"))\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusBadRequest, \"invalid passphrase\", nil, invalidMsg)\n\t\treturn\n\t}\n\tuser, err := UserRepo.CreateUserRecord(r.Context(), req.Email, req.Passphrase)\n\tif err != nil {\n\t\tfLog.Errorf(\"UserRepo.CreateUserRecord got %s\", err.Error())\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusBadRequest, err.Error(), nil, nil)\n\t\treturn\n\t}\n\tresp := &CreateNewUserResponse{\n\t\tRecordID: user.RecID,\n\t\tEmail: user.Email,\n\t\tEnabled: user.Enabled,\n\t\tSuspended: user.Suspended,\n\t\tLastSeen: user.LastSeen,\n\t\tLastLogin: user.LastLogin,\n\t\tTotpEnabled: user.Enable2FactorAuth,\n\t}\n\tfLog.Warnf(\"Sending email\")\n\tmailer.Send(r.Context(), &mailer.Email{\n\t\tFrom: config.Get(\"mailer.from\"),\n\t\tFromName: config.Get(\"mailer.from.name\"),\n\t\tTo: []string{user.Email},\n\t\tCc: nil,\n\t\tBcc: nil,\n\t\tTemplate: \"EMAIL_VERIFY\",\n\t\tData: user,\n\t})\n\n\thelper.WriteHTTPResponse(r.Context(), w, http.StatusOK, \"Success creating user\", nil, resp)\n\treturn\n}", "func NewRepository() UsersRepository {\n\treturn &usersRepository{}\n}", "func CreateNewUser(username, password string) (userID string, err error) {\n\n err = checkInit()\n if err != nil {\n return\n }\n\n var checkIfTheUserAlreadyExists = func(username string, userData map[string]interface{}) (err error) {\n var salt = userData[\"_salt\"].(string)\n var loginUsername = userData[\"_username\"].(string)\n\n if SHA256(username, salt) == loginUsername {\n err = createError(020)\n }\n\n return\n }\n\n var users = data[\"users\"].(map[string]interface{})\n for _, userData := range users {\n err = checkIfTheUserAlreadyExists(username, userData.(map[string]interface{}))\n if err != nil {\n return\n }\n }\n\n var defaults = defaultsForNewUser(username, password)\n userID = defaults[\"_id\"].(string)\n users[userID] = defaults\n\n saveDatabase(data)\n\n return\n}", "func (s *RepositoryService) Create(rs app.RequestScope, model *models.Repository) (*models.Repository, error) {\n\tif err := model.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := s.dao.Create(rs.DB(), model); err != nil {\n\t\treturn nil, err\n\t}\n\treturn s.dao.Get(rs.DB(), model.Name)\n}", "func CreateUserService() *UserService {\n\tuserRepository := repositories.CreateUserRepository()\n\tuserService := NewUserService(userRepository)\n\treturn userService\n}", "func NewRepo() contact.UserRepo {\n\treturn &userRepo{}\n}", "func CreateUser(c *gin.Context) {}", "func NewUserRepository(db *gorm.DB) user.Repository {\n\treturn &handler{\n\t\tdb: db,\n\t}\n}", "func NewUserRepository() (repo UserRepository) {\n\trepo.c = MongoSession.DB(conf.MongoDatabase).C(\"users\")\n\treturn\n}", "func (r *UserRepository) Create(ctx context.Context, ent entity.User) (created entity.User, err error) {\n\terr = ent.GenID()\n\tif err != nil {\n\t\treturn\n\t}\n\terr = r.DB(ctx).Create(&ent).Error\n\tif err != nil {\n\t\treturn\n\t}\n\terr = r.DB(ctx).Take(&created, \"id = ?\", ent.ID).Error\n\treturn created, err\n}", "func CreateRepo(cmdCtx *cobra.Command, args []string) {\n\tif len(args) == 0 {\n\t\tfmt.Println(\"Please enter a repo name ex. nere create dopeRepo\")\n\t\tos.Exit(1)\n\t}\n\tctx := context.Background()\n\tts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: args[1]})\n\tclient := oauth2.NewClient(ctx, ts)\n\n\treqBody, err := json.Marshal(Repo{Name: args[0]})\n\tcheck(err)\n\treq, err := http.NewRequest(\"POST\", fmt.Sprintf(\"%s/user/repos\", baseUrl), bytes.NewBuffer(reqBody))\n\tcheck(err)\n\t_, err = client.Do(req)\n\tcheck(err)\n\tfmt.Printf(\"Success: %s was created\\n\", args[0])\n}", "func NewUserRepository(db *sql.DB) *UserRepository {\n\treturn &UserRepository{db}\n}", "func (r *UserRepository) CreateUser(u *model.User) (*model.User, error) {\n\tvar sU model.User\n\t//testTimeStamp := time.Unix(time.Now().Unix(), 0).Format(time.RFC3339)\n\n\t//fmt.Println(\"time now ____\", time.Now().Unix())\n\tbirthInt64, _ := strconv.ParseInt(u.Birthday, 10, 64)\n\tcreationDInt64, _ := strconv.ParseInt(u.CreationDate, 10, 64)\n\tbirth := time.Unix(birthInt64 / 1000, 0).Format(time.RFC3339)\n\tcreationD := time.Unix(creationDInt64 / 1000, 0).Format(time.RFC3339)\n\tfmt.Println(\"creation Date _______ \",creationD, \"\\n Birthday ________ \", birth)\n\tif err := u.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := u.BeforeCreate(); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := r.store.db.QueryRow(\n\t\t\"INSERT INTO users (id_user, email, encrypted_password, login, birthday, type_user, creation_date, sex) VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING id_user, email, encrypted_password, login, birthday, type_user, creation_date, sex\",\n\t\tu.ID,\n\t\tu.Email,\n\t\tu.EncryptedPassword,\n\t\tu.Login,\n\t\tbirth,\n\t\tu.TypeUser,\n\t\tcreationD,\n\t\tu.Sex,\n\t).Scan(\n\t\t&sU.ID,\n\t\t&sU.Email,\n\t\t&sU.EncryptedPassword,\n\t\t&sU.Login,\n\t\t&sU.Birthday,\n\t\t&sU.TypeUser,\n\t\t&sU.CreationDate,\n\t\t&sU.Sex,\n\t\t); err != nil {\n\t\t\treturn nil, err\n\t}\n\treturn &sU, nil\n}", "func (c createUserRepository) Create(ctx context.Context, u entity.User) (entity.User, error) {\n\tvar bson = createUserBSON{\n\t\tID: u.ID().Value(),\n\t\tFullName: u.FullName().Value(),\n\t\tDocument: createUserDocumentBSON{\n\t\t\tType: u.Document().Type().String(),\n\t\t\tValue: u.Document().Value(),\n\t\t},\n\t\tEmail: u.Email().Value(),\n\t\tPassword: u.Password().Value(),\n\t\tWallet: createUserWalletBSON{\n\t\t\tCurrency: u.Wallet().Money().Currency().String(),\n\t\t\tAmount: u.Wallet().Money().Amount().Value(),\n\t\t},\n\t\tType: u.TypeUser().String(),\n\t\tCreatedAt: u.CreatedAt(),\n\t}\n\n\tif _, err := c.handler.Db().Collection(c.collection).InsertOne(ctx, bson); err != nil {\n\t\treturn entity.User{}, errors.Wrap(err, entity.ErrCreateUser.Error())\n\t}\n\n\treturn u, nil\n}", "func (m *MockHandler) UserCreate(username, email, password string) (*domain.User, string, error) {\n\tret := m.ctrl.Call(m, \"UserCreate\", username, email, password)\n\tret0, _ := ret[0].(*domain.User)\n\tret1, _ := ret[1].(string)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "func (m *MockUserPGRepository) Create(ctx context.Context, user *models.User) (*models.User, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Create\", ctx, user)\n\tret0, _ := ret[0].(*models.User)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (s *Store) CreateRepository(r *gh.Repository) (*gh.Repository, error) {\n\tr.LastAccess = time.Now()\n\tresult := s.db.Create(r)\n\tif result.Error != nil {\n\t\treturn nil, result.Error\n\t}\n\treturn r, nil\n}", "func (m *MockUserLogic) UserCreate(username, email, password string) (*domain.User, string, error) {\n\tret := m.ctrl.Call(m, \"UserCreate\", username, email, password)\n\tret0, _ := ret[0].(*domain.User)\n\tret1, _ := ret[1].(string)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "func New(db *mgo.Database) *UserRepository {\n\treturn &UserRepository{\n\t\tdb: db,\n\t\tcollection: db.C(collectionName),\n\t}\n}", "func CreateUser(w http.ResponseWriter, r *http.Request) {\n\tvar user models.User\n\tbodyRequest, err := ioutil.ReadAll(r.Body)\n\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tif err = json.Unmarshal(bodyRequest, &user); err != nil {\n\t\tresponses.Error(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tif err := user.Prepare(true); err != nil {\n\t\tresponses.Error(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tif err := validateUniqueDataUser(user, true); err != nil {\n\t\tresponses.Error(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tdb, err := database.Connect()\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusInternalServerError, err)\n\t}\n\tdefer db.Close()\n\n\trepository := repository.NewRepositoryUser(db)\n\n\tuser.Id, err = repository.Insert(user)\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tresponses.JSON(w, http.StatusCreated, user)\n\n}", "func (UserReqServices) CreateNew(ctx context.Context, req dt.UserRequest, dbConn lib.DbConnection) (resp dt.UserResponse) {\n\terr := validation.Errors{\n\t\t\"name\": validation.Validate(req.Name, validation.Required, validation.Length(1, 50), is.Letter),\n\t\t\"email\": validation.Validate(req.Email, validation.Required, is.Email),\n\t\t\"phone\": validation.Validate(req.Phone, validation.Required, is.Digit),\n\t}.Filter()\n\tresp.ResponseCode = \"-1\"\n\tresp.ResponseDesc = err\n\tif err == nil || err == \"\" {\n\n\t\tresp.ResponseCode = \"1\"\n\t\tresp.ResponseDesc = \"Success\"\n\t}\n\t\n\treturn\n}", "func (u *UserController) CreateUser(c *gin.Context) {\n var user models.UserRegister\n if err := c.ShouldBind(&user); err != nil {\n util.ErrorJSON(c, http.StatusBadRequest, \"Inavlid Json Provided\")\n return\n }\n\n hashPassword, _ := util.HashPassword(user.Password)\n user.Password = hashPassword\n\n err := u.service.CreateUser(user)\n if err != nil {\n util.ErrorJSON(c, http.StatusBadRequest, \"Failed to create user\")\n return\n }\n\n util.SuccessJSON(c, http.StatusOK, \"Successfully Created user\")\n}", "func (u UserRepositoryMysql) Create(ctx context.Context, db *gorp.DbMap, user model.User) (model.User, error) {\n\tuserDAO := &dao.User{Nickname: user.Nickname}\n\terr := db.Insert(userDAO)\n\tif err != nil {\n\t\treturn model.User{}, err\n\t}\n\n\tuser = model.User{\n\t\tID: userDAO.ID,\n\t\tNickname: userDAO.Nickname}\n\treturn user, nil\n}", "func NewUserRepository(db *gorm.DB) UserRepository {\n\treturn userRepository{\n\t\tDB: db,\n\t}\n}", "func NewUser(db *config.DB) *UserRepository {\n\treturn &UserRepository{log: logger.Logger(), db: db}\n}", "func (r *RepositoryUsersCRUD) Create(user models.User) (models.User, error) {\n\tvar err error\n\tdone := make(chan bool)\n\tgo func(ch chan<- bool) {\n\t\tdefer close(ch)\n\t\terr = r.model.Create(&user).Error\n\t\tif err != nil {\n\t\t\tch <- false\n\t\t\treturn\n\t\t}\n\t\tch <- true\n\t}(done)\n\tif channels.OK(done) {\n\t\treturn user, nil\n\t}\n\treturn models.User{}, err\n}", "func (u *UserHandler) Create(c *fiber.Ctx) error {\n\tuser := models.User{}\n\terr := c.BodyParser(&user)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = u.Repo.Create(user)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.Status(fiber.StatusOK).JSON(user)\n}", "func Create(user User) error {\n\t\n}", "func UserCreate(w http.ResponseWriter, r *http.Request) {\n\terr := json.NewDecoder(r.Body).Decode(&user)\n\tif err != nil {\n\t\tm.Message = fmt.Sprintf(\"Error al leer el usuario a registrarse: %s\", err)\n\t\tm.Code = http.StatusBadRequest\n\t\tcommons.DisplayMessage(w, m)\n\t\treturn\n\t}\n\tif user.Password != user.ConfirmPassword {\n\t\tm.Message = \"Las contraseña no coinciden\"\n\t\tm.Code = http.StatusBadRequest\n\t\tcommons.DisplayMessage(w, m)\n\t\treturn\n\t}\n\tuser.Password = password\n\tavatarmd5 := md5.Sum([]byte(user.Password))\n\tavatarstr := fmt.Sprintf(\"%x\", avatarmd5)\n\tuser.Avatar = \"https://gravatar.com/avatar/\" + avatarstr + \"?s=100\"\n\tdatabase := configuration.GetConnection()\n\tdefer database.Close()\n\terr = database.Create(&user).Error\n\tif err != nil {\n\t\tm.Message = fmt.Sprintf(\"Error al crear el registro: %s\", err)\n\t\tm.Code = http.StatusBadRequest\n\t\tcommons.DisplayMessage(w, m)\n\t\treturn\n\t}\n\tm.Message = \"Usuario creado con éxito\"\n\tm.Code = http.StatusCreated\n\tcommons.DisplayMessage(w, m)\n}", "func CreateUserHandler(w http.ResponseWriter, req *http.Request) {\n // Validate internal token.\n if internalToken := req.Header.Get(app.Config.AuthHeaderName); internalToken != app.Config.RestApiToken {\n respond.Error(w, errmsg.Unauthorized())\n return\n }\n\n // Parse & validate payload.\n var pl payload.CreateUserPayload\n\n if !pl.Validate(req) {\n respond.Error(w, errmsg.InvalidPayload())\n return\n }\n\n // Check if the executor is using the USER_CREATION_HASH to create this user.\n usingUserCreationPw := pl.ExecutorEmail == \"\" && app.Config.UserCreationHash != \"\" &&\n crypt.VerifySha256(pl.ExecutorPassword, app.Config.UserCreationHash)\n\n // If not using USER_CREATION_HASH for auth, verify executor exists using email/pw.\n if !usingUserCreationPw {\n // Get executor user by email.\n executorUser, err := usersvc.FromEmail(pl.ExecutorEmail)\n\n if err != nil {\n app.Log.Errorln(err.Error())\n respond.Error(w, errmsg.UserNotFound())\n return\n }\n\n // Ensure executor user's password is correct.\n if !crypt.VerifyBcrypt(pl.ExecutorPassword, executorUser.HashedPw) {\n app.Log.Errorln(\"error creating new User: invalid executor user password\")\n respond.Error(w, errmsg.Unauthorized())\n return\n }\n\n // Only admin users can create other users.\n if !executorUser.Admin {\n app.Log.Errorln(\"error creating new User: executor user must be an admin\")\n respond.Error(w, errmsg.Unauthorized())\n return\n }\n }\n\n // Hash provided user password.\n hashedPw, err := crypt.BcryptHash(pl.NewPassword)\n\n if err != nil {\n app.Log.Errorf(\"error creating new User: bcrypt password hash failed with %s\\n\", err.Error())\n respond.Error(w, errmsg.ISE())\n return\n }\n\n // Create new User.\n newUser, err := usersvc.Create(pl.NewEmail, hashedPw, pl.Admin)\n\n if err != nil {\n app.Log.Errorln(err.Error())\n pqError, ok := err.(*pq.Error)\n\n if ok && pqError.Code.Name() == \"unique_violation\" {\n respond.Error(w, errmsg.EmailNotAvailable())\n } else {\n respond.Error(w, errmsg.UserCreationFailed())\n }\n\n return\n }\n\n // Create response payload and respond.\n respData := successmsg.UserCreationSuccess\n respData[\"uid\"] = newUser.Uid\n\n respond.Created(w, respData)\n}", "func (us UserService) Create(userDto dto.UserCreateDto) (*model.User, error) {\n\t//if username is exits,it can't create this user\n\tuserModel := userDao.GetByUserName(userDto.Username)\n\tif userModel.Username == userDto.Username {\n\t\treturn nil, errors.New(\"username is exits\")\n\t}\n\tsalt, _ := account.MakeSalt()\n\tpwd, _ := account.HashPassword(userDto.Password, salt)\n\tnewUser := &model.User{\n\t\tUsername: userDto.Username,\n\t\tMobile: userDto.Mobile,\n\t\tPassword: pwd,\n\t\tDepartmentId: userDto.DepartmentId,\n\t\tSalt: salt,\n\t\tSex: userDto.Sex,\n\t\tEmail: userDto.Email,\n\t\tTitle: userDto.Title,\n\t\tRealname: userDto.Realname,\n\t\tStatus: userDto.Status,\n\t}\n\tc := userDao.Create(newUser)\n\tif c.Error != nil {\n\t\tlog.Error(c.Error.Error())\n\t\treturn nil, errors.New(\"create user failed\")\n\t}\n\n\tif userDto.Roles != \"\" {\n\t\tus.AssignRole(strconv.Itoa(newUser.Id), strings.Split(userDto.Roles, \",\"))\n\t}\n\n\treturn &userModel, nil\n}", "func NewRepositoryUsersCRUD(db *gorm.DB) *RepositoryUsersCRUD {\n\tmodel := db.Model(&models.User{})\n\treturn &RepositoryUsersCRUD{db, model}\n}", "func (m *MockRepository) Create(ctx context.Context, u *models.User) (*models.User, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Create\", ctx, u)\n\tret0, _ := ret[0].(*models.User)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func createUser(c *gin.Context) {\n password,_ := HashPassword(c.PostForm(\"password\"))\n\tuser := user{Login: c.PostForm(\"login\"), Password: password}\n\tdb.Save(&user)\n\tc.JSON(http.StatusCreated, gin.H{\"status\": http.StatusCreated, \"message\": \"User item created successfully!\"})\n}", "func (h *handler) Create(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\n\tvar req AddRequest\n\tif err := json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\thttperror.BadRequest(w, err)\n\t\treturn\n\t}\n\n\taccount := new(object.Account)\n\taccount.Username = req.Username\n\tif err := account.SetPassword(req.Password); err != nil {\n\t\thttperror.InternalServerError(w, err)\n\t\treturn\n\t}\n\n\trepoAccount := h.app.Dao.Account() // domain/repository の取得\n\taccount, err := repoAccount.Create(ctx, account)\n\tif err != nil {\n\t\t// Todo: これrepoにエラー出させたほうが良くない?\n\t\tif mysqlErr, ok := err.(*mysql.MySQLError); ok {\n\t\t\tif mysqlErr.Number == 1062 {\n\t\t\t\thttperror.BadRequest(w, errors.New(\"User already exists\"))\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\thttperror.InternalServerError(w, err)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tif err := json.NewEncoder(w).Encode(account); err != nil {\n\t\thttperror.InternalServerError(w, err)\n\t\treturn\n\t}\n}", "func (uc UserController) CreateUser(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\t// Stub an user to be populated from the body\n\tu := models.User{}\n\n\t// Populate the user data\n\tjson.NewDecoder(r.Body).Decode(&u)\n\n\t// Add an Id\n\tu.Id = bson.NewObjectId()\n\n\thPass, err := bcrypt.GenerateFromPassword([]byte(u.Password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\tw.WriteHeader(500)\n\t\treturn\n\t}\n\tu.HashPassword = hPass\n\t// clear the incoming text password\n\tu.Password = \"\"\n\n\t// Write the user to mongo\n\terr = uc.session.DB(\"todos\").C(\"users\").Insert(&u)\n\n\t// clear hashed password\n\tu.HashPassword = nil\n\n\t// Marshal provided interface into JSON structure\n\tuj, _ := json.Marshal(u)\n\n\t// Write content-type, statuscode, payload\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(201)\n\tfmt.Fprintf(w, \"%s\", uj)\n}", "func (m *MockUserRepo) Create(ctx context.Context, input CreateUserInput) (User, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Create\", ctx, input)\n\tret0, _ := ret[0].(User)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (userRepository UserRepository) Create(user models.User) (uint64, error) {\n\tstatement, err := userRepository.db.Prepare(\n\t\t\"insert into users (name, nick, email, password) values (?, ?, ?, ?)\",\n\t)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tdefer statement.Close()\n\n\tresult, err := statement.Exec(user.Name, user.Nick, user.Email, user.Password)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tlastInsertId, err := result.LastInsertId()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn uint64(lastInsertId), nil\n}", "func CreateUser(w http.ResponseWriter, r *http.Request) {\n\tu := User{}\n\terr := json.NewDecoder(r.Body).Decode(&u)\n\n\tif err != nil {\n\t\thttp.Error(w, http.StatusText(500), http.StatusInternalServerError)\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\terr = SaveUser(u.FullName, u.NickName, u.Email, u.Balance)\n\n\tif err != nil {\n\t\thttp.Error(w, http.StatusText(500), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusCreated)\n}", "func NewUserRepo(config *domain.Config) *UserRepo {\n\tclient := graphql.NewClient(config.UserRepo.Url, nil)\n\treturn &UserRepo{\n\t\tconfig: config,\n\t\tclient: client,\n\t}\n}", "func NewUserService(userRepository UserRepository) *UserService {\n\treturn &UserService{userRepository}\n}", "func CreateUser(db *gorm.DB, w http.ResponseWriter, r *http.Request) {\n\trepo := users.NewUserRepository(db)\n\tuser := &users.User{}\n\tdecoder := json.NewDecoder(r.Body)\n\n\tif err := decoder.Decode(user); err != nil {\n\t\tutils.JsonResponse(w, utils.ErrorResponse{Error: err.Error()}, http.StatusBadRequest)\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\trepo.AddUser(user)\n\tutils.JsonResponse(w, user, http.StatusCreated)\n}", "func createRepo(repoConstructorFunc interface{}, convMock interface{}) interface{} {\n\tv := reflect.ValueOf(repoConstructorFunc)\n\tif v.Kind() != reflect.Func {\n\t\tpanic(\"Repo constructor should be a function\")\n\t}\n\tt := v.Type()\n\n\tif t.NumOut() != 1 {\n\t\tpanic(\"Repo constructor should return only one argument\")\n\t}\n\n\tif t.NumIn() == 0 {\n\t\treturn v.Call(nil)[0].Interface()\n\t}\n\n\tif t.NumIn() != 1 {\n\t\tpanic(\"Repo constructor should accept zero or one arguments\")\n\t}\n\n\tmockVal := reflect.ValueOf(convMock)\n\treturn v.Call([]reflect.Value{mockVal})[0].Interface()\n}", "func (m *MockUsersRepo) Create(arg0 auth.User) (auth.User, error) {\n\tret := m.ctrl.Call(m, \"Create\", arg0)\n\tret0, _ := ret[0].(auth.User)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (ur *UserRepository) Create(ctx context.Context, u *user.User) error {\n\tq := `\n\tINSERT INTO users (user_name, role)\n\tVALUES ($1, $2)\n\tRETURNING id;\n\t`\n\tstmt, err := ur.Data.DB.PrepareContext(ctx, q)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer stmt.Close()\n\n\trow := stmt.QueryRowContext(ctx, u.UserName, u.Role)\n\n\terr = row.Scan(&u.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (g *GitFactory) Create(d Data, args []string) (Registry, error) {\n\tif len(args) != 1 {\n\t\treturn nil, ErrorNoValidRepositoryGiven\n\t}\n\td.Type = RegTypeGit\n\tif len(d.Name) == 0 {\n\t\td.Name = strings.Replace(filepath.Base(args[0]), filepath.Ext(args[0]), \"\", 1)\n\t}\n\treg := &GitRegistry{\n\t\tCore: d,\n\t\tRepository: args[0],\n\t}\n\n\treturn reg, nil\n}", "func (fac *InMemoryRepositoryFactory) CreateDependencyRepository() DependencyRepository {\n\trepo := NewDepRepository()\n\treturn repo\n}", "func (m *MockGitUseCaseI) Create(userID int64, repos *git.Repository) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Create\", userID, repos)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func CreateUser(response http.ResponseWriter, request *http.Request) {\n\n\t\n\t\trequest.ParseForm()\n\t\tdecoder := json.NewDecoder(request.Body)\n\t\tvar newUser User\n\t\t\n\t\terr := decoder.Decode(&newUser)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\t\n newUser.Password=hashAndSalt([]byte(newUser.Password))\n\t\t\n\t\tinsertUser(newUser)\n\t\n}", "func createUser(name, password, passwordUpdateRequest string) string {\n\treturn fmt.Sprintf(`{\n \"type\": \"User\",\n \"name\": \"%s\",\n \"credential\": {\n \"type\": \"PasswordCredential\",\n\t\t\"password\": \"%s\",\n\t\t\"passwordUpdateRequest\": \"%s\"\n }\n}`, name, password, passwordUpdateRequest)\n}", "func (u *usecase) Create(ctx context.Context, user *User) error {\n\tvalidate = validator.New()\n\tif err := validate.Struct(user); err != nil {\n\t\tvalidationErrors := err.(validator.ValidationErrors)\n\t\treturn validationErrors\n\t}\n\n\tuser.ID = u.newID()\n\tif err := u.repository.Create(ctx, user); err != nil {\n\t\treturn errors.Wrap(err, \"error creating new user\")\n\t}\n\n\treturn nil\n}", "func (_m *UserRepository) Create(user domain.User) (domain.User, error) {\n\tret := _m.Called(user)\n\n\tvar r0 domain.User\n\tif rf, ok := ret.Get(0).(func(domain.User) domain.User); ok {\n\t\tr0 = rf(user)\n\t} else {\n\t\tr0 = ret.Get(0).(domain.User)\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(domain.User) error); ok {\n\t\tr1 = rf(user)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "func (s *usersService) Create(u User) (User, error) {\n\t// TODO santitize and validate input\n\tpass, err := bcrypt.GenerateFromPassword([]byte(u.Password), bcrypt.MinCost)\n\tif err != nil {\n\t\tlog.Printf(\"error creating user: %s\", err.Error())\n\t\treturn User{}, err\n\t}\n\n\tu.Password = string(pass)\n\n\tusr, err := s.repo.Create(u)\n\tif err != nil {\n\t\tlog.Printf(\"error creating user: %s\\n\", err)\n\t\treturn User{}, err\n\t}\n\n\ttoken, err := utils.GenerateToken(usr.ID, s.secret)\n\tif err != nil {\n\t\tlog.Printf(\"error creating user: %s\\n\", err)\n\t\treturn User{}, err\n\t}\n\n\tusr.Token = token\n\n\treturn usr, nil\n}", "func CreateUser(user model.User) {\n\tfmt.Println(user)\n}", "func Create(t *testing.T, knFunc *TestShellCmdRunner, project FunctionTestProject) {\n\tvar result TestShellCmdResult\n\tif project.RemoteRepository == \"\" {\n\t\tresult = knFunc.Exec(\"create\", project.ProjectPath, \"--language\", project.Runtime, \"--template\", project.Template)\n\t} else {\n\t\tresult = knFunc.Exec(\"create\", project.ProjectPath, \"--language\", project.Runtime, \"--template\", project.Template, \"--repository\", project.RemoteRepository)\n\t}\n\tif result.Error != nil {\n\t\tt.Fatal()\n\t}\n}", "func (m_2 *MockUserRepository) Create(m *model.User) (*model.User, error) {\n\tm_2.ctrl.T.Helper()\n\tret := m_2.ctrl.Call(m_2, \"Create\", m)\n\tret0, _ := ret[0].(*model.User)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func createNewUser(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tparams := mux.Vars(r)\n\tvar userInfo UserBody\n\t//decode the json object and store the values in userInfo\n\terr := json.NewDecoder(r.Body).Decode(&userInfo)\n\tif err != nil {\n\t\tfmt.Println(\"ERROR DECODING JSON OBJ FROM CREATE NEW USER\")\n\t}\n\tresult := post.CreateUser(params[\"id\"], userInfo.FirstName, userInfo.LastName, userInfo.Email)\n\tjson.NewEncoder(w).Encode(map[string]bool{\n\t\t\"result\": result,\n\t})\n}", "func NewUserRepository(db *gorm.DB) model.UserRepository {\n\treturn &UserRepository{\n\t\tDB: db,\n\t}\n}", "func New(c *config.Config) (*Repository, error) {\n\tDBURL := fmt.Sprintf(\"host=%s port=%d user=%s dbname=%s sslmode=disable password=%s\",\n\t\tc.Database.DBHost,\n\t\tc.Database.DBPort,\n\t\tc.Database.DBUser,\n\t\tc.Database.DBName,\n\t\tc.Database.DBPassword)\n\n\tdb, err := gorm.Open(dbDriver, DBURL)\n\tif err != nil {\n\t\tfmt.Printf(\"Unable to connect to database, %v\", err)\n\t\tdefer db.Close()\n\t\treturn nil, err\n\t}\n\n\tdb.LogMode(true)\n\n\tuserRepository := UserRepository{db}\n\n\tr := &Repository{db: db, UserRepository: &userRepository}\n\treturn r, nil\n}", "func (c *client) CreateRepo(owner string, isUser bool, repo RepoCreateRequest) (*FullRepo, error) {\n\tdurationLogger := c.log(\"CreateRepo\", owner, isUser, repo)\n\tdefer durationLogger()\n\n\tif repo.Name == nil || *repo.Name == \"\" {\n\t\treturn nil, errors.New(\"repo.Name must be non-empty\")\n\t}\n\tif c.fake {\n\t\treturn nil, nil\n\t} else if c.dry {\n\t\treturn repo.ToRepo(), nil\n\t}\n\n\tpath := \"/user/repos\"\n\tif !isUser {\n\t\tpath = fmt.Sprintf(\"/orgs/%s/repos\", owner)\n\t}\n\tvar retRepo FullRepo\n\t_, err := c.request(&request{\n\t\tmethod: http.MethodPost,\n\t\tpath: path,\n\t\torg: owner,\n\t\trequestBody: &repo,\n\t\texitCodes: []int{201},\n\t}, &retRepo)\n\treturn &retRepo, err\n}", "func CreateAppRepository(handler kube.AuthHandler) func(w http.ResponseWriter, req *http.Request) {\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\trequestNamespace, requestCluster := getNamespaceAndCluster(req)\n\t\ttoken := auth.ExtractToken(req.Header.Get(\"Authorization\"))\n\n\t\tclientset, err := handler.AsUser(token, requestCluster)\n\t\tif err != nil {\n\t\t\treturnK8sError(err, w)\n\t\t\treturn\n\t\t}\n\n\t\tappRepo, err := clientset.CreateAppRepository(req.Body, requestNamespace)\n\t\tif err != nil {\n\t\t\treturnK8sError(err, w)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tresponse := appRepositoryResponse{\n\t\t\tAppRepository: *appRepo,\n\t\t}\n\t\tresponseBody, err := json.Marshal(response)\n\t\tif err != nil {\n\t\t\tJSONError(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.Write(responseBody)\n\t}\n}", "func NewUserRepository(db *gorm.DB) UserRepository {\n\treturn &userRepository{db}\n}", "func NewUserRepository(db *gorm.DB) UserRepository {\n\treturn &userRepository{db}\n}", "func NewUser(repository UserRepository) *User {\n\treturn &User{repository}\n}", "func (m *MockUserRepository) Create(user *auth.User) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Create\", user)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (r *mutationResolver) CreateUserss(ctx context.Context, input *model.RegisterInput) (*model.Register, error) {\n\tuser := &model.Register{\n\t\tID: fmt.Sprintf(\"T%d\", rand.Int()),\n\t\tName: input.Name,\n\t\tLastname: input.Lastname,\n\t\tPassword: input.Password,\n\t}\n\tr.user = append(r.user, user)\n\treturn user, nil\n}", "func NewRepository(repoName string) *Repository {\n\n\tclientIndex := model.ByEquality(\"ClientId\")\n\tclientIndex.Unique = true\n\t//\tuserIndex := model.ByEquality(\"UserId\")\n\t//\tuserIndex.Unique = true\n\n\treturn &Repository{\n\t\tName: repoName,\n\t\tmesssages: model.NewTable(store.DefaultStore, repoName, model.Indexes(clientIndex), nil),\n\t}\n}", "func createRepository(t *testing.T) *git.Repository {\n\t// Create the repo\n\tr, err := git.Init(memory.NewStorage(), memfs.New())\n\tif err != nil {\n\t\tt.Errorf(\"Unable to create repository for testing: %s\", err.Error())\n\t}\n\n\treturn r\n}", "func (m *MockUserRepository) Create(ctx context.Context, user *domain.User) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Create\", ctx, user)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (t *OpetCode) createUser(APIstub shim.ChaincodeStubInterface, args []string) sc.Response {\n if len(args) != 2 {\n return shim.Error(\"Incorrect number of arguments. Expecting 2\")\n }\n\n uid := args[0]\n json_props := args[1]\n user_key, _ := APIstub.CreateCompositeKey(uid, []string{USER_KEY})\n\n if _, err := t.loadUser(APIstub, user_key); err == nil {\n return shim.Error(\"Account already exists\")\n }\n new_user := new(User)\n new_user.Uid = uid\n new_user.Data = make(map[string]string)\n err := json.Unmarshal([]byte(json_props), &new_user.Data)\n if err != nil {\n return shim.Error(\"Can't parse json props\")\n }\n\n new_user_json, _ := json.Marshal(new_user)\n APIstub.PutState(user_key, new_user_json)\n\n return shim.Success(nil)\n}", "func (u *userController) Create() {\n\treturn\n}", "func CreateUser(newUser userDto.RegisterUserDto )*userModel.User {\n\n\thashedPassword, err:= bcrypt.GenerateFromPassword([]byte(newUser.Password), bcrypt.DefaultCost)\n\n\tif err != nil {\n panic(err)\n }\n\n\tvar newUserData = &userModel.User{\n\t\tID: guuid.New().String(),\n\t\tName: newUser.Name,\n\t\tEmail: newUser.Email,\n\t\tPassword: hashedPassword,\n\t}\n\n\tdbConnect.Insert(newUserData)\n\n\treturn newUserData\n}", "func NewUserRepo(db *sql.DB) *UserRepo {\n\treturn &UserRepo{db: db}\n}" ]
[ "0.6687183", "0.66358143", "0.65263623", "0.6430974", "0.6306735", "0.6288708", "0.6258359", "0.61549735", "0.6132873", "0.6104257", "0.60754794", "0.606565", "0.5990323", "0.59862757", "0.5980177", "0.5976259", "0.59719974", "0.5967437", "0.5949544", "0.59149235", "0.58906084", "0.5890447", "0.58789825", "0.58692557", "0.5856102", "0.5829611", "0.5819231", "0.58173805", "0.58073735", "0.57661897", "0.5765567", "0.5754275", "0.57445836", "0.5737748", "0.57337284", "0.57155293", "0.5703246", "0.56887287", "0.5682121", "0.5679685", "0.5676451", "0.566381", "0.5660863", "0.5641877", "0.5640197", "0.56332237", "0.5626182", "0.5618271", "0.5607091", "0.56021285", "0.5601347", "0.559882", "0.5597145", "0.55953914", "0.5585332", "0.55843824", "0.55792975", "0.5543364", "0.55412394", "0.5540615", "0.55404246", "0.55394363", "0.5534466", "0.55285823", "0.55266595", "0.5526601", "0.5523684", "0.55189973", "0.55180824", "0.5511722", "0.5506207", "0.55060446", "0.5502276", "0.5495954", "0.5495133", "0.54938936", "0.5489571", "0.5488838", "0.5484586", "0.5473742", "0.54724854", "0.5469798", "0.54646045", "0.545853", "0.54515284", "0.54489315", "0.5447312", "0.544486", "0.5442052", "0.5442052", "0.5436545", "0.5436472", "0.5435945", "0.5435283", "0.5433738", "0.54291856", "0.5427191", "0.5422157", "0.5420168", "0.54180896" ]
0.6640742
1
Create performs insertOne into the database
func (c createUserRepository) Create(ctx context.Context, u entity.User) (entity.User, error) { var bson = createUserBSON{ ID: u.ID().Value(), FullName: u.FullName().Value(), Document: createUserDocumentBSON{ Type: u.Document().Type().String(), Value: u.Document().Value(), }, Email: u.Email().Value(), Password: u.Password().Value(), Wallet: createUserWalletBSON{ Currency: u.Wallet().Money().Currency().String(), Amount: u.Wallet().Money().Amount().Value(), }, Type: u.TypeUser().String(), CreatedAt: u.CreatedAt(), } if _, err := c.handler.Db().Collection(c.collection).InsertOne(ctx, bson); err != nil { return entity.User{}, errors.Wrap(err, entity.ErrCreateUser.Error()) } return u, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (repo *sqlRepository) Create(interface{}) error{\n\tvar (\n\t\t\tdb *sql.DB\n\t\t\tstmt *sql.Stmt\n\t\t)\n\t db, _ = sql.Open(driver, repo.user + \":\" + repo.password + \"@tcp(\" + repo.host + \":\" + repo.port + \")/\" + repo.database)\n\n\tstmt, err := db.Prepare(\"INSERT users SET name=?,gender=?,age=?\")\n\tif err != nil {\n\t\t panic(err)\n\t}\n\n\tres, err := stmt.Exec(\"joe\", \"male\", 30)\n\tif err != nil {\n\t\t panic(err)\n\t}\n\n\tid, err := res.LastInsertId()\n\tif err != nil {\n\t\t panic(err)\n\t}\n\n\tfmt.Println(id)\n\treturn nil\n}", "func (db *Datastore) Create(txn transaction.Transaction) error {\n\tfmt.Println(`Creating txn with data:`, txn)\n\t// your DB operations to transactions ...\n\treturn nil\n}", "func (m *UserModel) Create(ctx context.Context, kv query.KV) (int64, error) {\n\n\tif _, ok := kv[\"created_at\"]; !ok {\n\t\tkv[\"created_at\"] = time.Now()\n\t}\n\n\tif _, ok := kv[\"updated_at\"]; !ok {\n\t\tkv[\"updated_at\"] = time.Now()\n\t}\n\n\tsqlStr, params := m.query.Table(m.tableName).ResolveInsert(kv)\n\n\tres, err := m.db.ExecContext(ctx, sqlStr, params...)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn res.LastInsertId()\n}", "func (adapter *GORMAdapter) Create(entity interface{}) orm.Result {\n\treturn orm.Result{\n\t\tError: adapter.db.Create(entity).Error,\n\t}\n}", "func Create(record Record) {\r\n\tdb.QueryRow(\"insert into records values($1,$2,$3,$4,$5)\", record.Uuid, record.Mail, record.Seq, record.Pssm, record.Result)\r\n}", "func (t TalentRepositoryImpl) Create(ctx context.Context, talent entity.Talent) (int64, error) {\n\tquery, args, err := squirrel.Insert(\"talent\").Columns(\n\t\t\"name\",\n\t).Values(talent.Name).ToSql()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tres, err := t.db.ExecContext(ctx, query, args...)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tid, err := res.LastInsertId()\n\tlog.Printf(\"success insert talent : %s, with id %d\", talent.Name, id)\n\n\treturn id, nil\n}", "func (question *Question) Create() {\n\tdb.QueryRow(\"insert into questions (author, content, user_id) values ($1, $2, $3) returning id\", question.Author.Name, question.Content, question.UserID).Scan(&question.ID)\n}", "func (m *UserExtModel) Create(ctx context.Context, kv query.KV) (int64, error) {\n\n\tif _, ok := kv[\"created_at\"]; !ok {\n\t\tkv[\"created_at\"] = time.Now()\n\t}\n\n\tif _, ok := kv[\"updated_at\"]; !ok {\n\t\tkv[\"updated_at\"] = time.Now()\n\t}\n\n\tsqlStr, params := m.query.Table(m.tableName).ResolveInsert(kv)\n\n\tres, err := m.db.ExecContext(ctx, sqlStr, params...)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn res.LastInsertId()\n}", "func (p *PgStore) Create(ctx context.Context, s sessionup.Session) error {\n\tq := fmt.Sprintf(\"INSERT INTO %s VALUES ($1, $2, $3, $4, $5, $6, $7);\", p.tName)\n\t_, err := p.db.ExecContext(ctx, q, s.CreatedAt, s.ExpiresAt, s.ID, s.UserKey,\n\t\tsetNullString(s.IP.String()), setNullString(s.Agent.OS), setNullString(s.Agent.Browser))\n\tif perr, ok := err.(*pq.Error); ok && perr.Constraint == fmt.Sprintf(\"%s_pkey\", p.tName) {\n\t\treturn sessionup.ErrDuplicateID\n\t}\n\treturn err\n}", "func (database *Database) Create(object interface{}) error {\n\tif err := database.DB.Create(object).Error; err != nil {\n\t\treturn fmt.Errorf(\"Failed to create a '%s': %s\", reflect.TypeOf(object), err)\n\t}\n\treturn nil\n}", "func (u *User) Create(db *pg.DB) error {\n\t_, err := db.Model(u).Insert()\n\treturn err\n}", "func (u *User) Create(db *pg.DB) error {\n\t_, err := db.Model(u).Insert()\n\treturn err\n}", "func CreatePerson(db *sql.DB) {}", "func (gi *SensorToUser) Create(db *pg.DB) error {\r\n\tlog.Printf(\"===>senUserModel.Create()\")\r\n\tlog.Printf(\" senUserModel.Create():SensorToUser=%v\\n\", gi)\r\n\r\n\tinsertErr := db.Insert(gi)\r\n\tif insertErr != nil {\r\n\t\tlog.Printf(\"Error writing to DB in senUserModel.Create(), Reason:%v\\n\", insertErr)\r\n\t\treturn insertErr\r\n\t}\r\n\tlog.Printf(\"SenUserIterm %s inserted successfully into table\", gi.SensorID)\r\n\treturn nil\r\n}", "func (dao *DAOName) Create(m *ReferenceModel) error {\n\tif err := dao.db.Create(m).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (r *HousingTypology) Create(db *sql.DB) error {\n\treturn db.QueryRow(`INSERT INTO housing_typology(name) VALUES($1) RETURNING id`,\n\t\t&r.Name).Scan(&r.ID)\n}", "func (api *MysqlAPI) Create(table string, obj map[string]interface{}) (rs sql.Result, err error) {\n\tsql, err := api.sql.InsertByTable(table, obj)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn api.exec(sql)\n}", "func (h *JourneyRepository) Create(model *models.Journey) (*models.Journey, error) {\n\tif err := h.Db.Create(&model).Error; err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\n\treturn model, nil\n\n}", "func (t *DbService) Create(request *CreateRequest) (*CreateResponse, error) {\n\trsp := &CreateResponse{}\n\treturn rsp, t.client.Call(\"db\", \"Create\", request, rsp)\n}", "func (user *UserObject) Create(database *sqlx.DB) error {\n\tvalues := fmt.Sprintf(\"'%s,'%s','%s','%s','%s','%s',%d,%d,%d,1\", user.FirstName, user.LastName, user.NickName, user.UserName, user.EmailAddress, user.Phone, user.Age, user.AcceptsCookies, user.FilterContent)\n\tquery := fmt.Sprintf(createItem, userTableName, \"fname,lname,nname,uname,email,phone,age,accepts_cookie,filter_content,active\", values)\n\n\tresult, err := database.Exec(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnextID, err := result.LastInsertId()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tuser.ID = int(nextID)\n\n\treturn nil\n}", "func (link *Link) Create(\n\tctx context.Context,\n\ttx *sqlx.Tx,\n\tactionID int,\n\tstatusID int,\n) (int64, error) {\n\tid, err := link.insertOne(ctx, tx)\n\tif err != nil {\n\t\treturn id, fmt.Errorf(\"entityone Create(): %v\", err)\n\t}\n\n\terr = link.SaveStatus(ctx, tx, id, actionID, statusID)\n\tif err != nil {\n\t\treturn id, fmt.Errorf(\"entityone Create(): %v\", err)\n\t}\n\n\treturn id, nil\n}", "func (postgres *Postgres) CreateOne(order *proto.Order) (*proto.Order, error) {\n\tquery := fmt.Sprintf(\"INSERT INTO orders (product_id, user_id, status)\"+\n\t\t\" VALUES (%d, %d, 'waiting for payment')\", order.ProductId, order.UserId)\n\t_, err := postgres.DB.Exec(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn order, err\n}", "func (c *Connection) Create(model interface{}) error {\n\tsm := &Model{Value: model}\n\treturn sm.iterate(func(m *Model) error {\n\t\tif err := c.Dialect.Create(c.DB, m); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}", "func (id *User) Create(tx *sql.Tx) error {\n\tsql := `INSERT INTO \"user\" DEFAULT VALUES RETURNING id`\n\treturn tx.QueryRow(sql).Scan(id)\n}", "func Create(dst interface{}) {\n\tif datastore != nil {\n\t\tdatastore.Create(dst)\n\t} else {\n\t\tlog.Printf(\"No database configured, not creating %v\", dst)\n\t}\n}", "func (user *User) Create() {\n\tdb := common.GetDatabase()\n\n\tdb.NewRecord(user)\n\tdb.Create(&user)\n}", "func (s *Store) Create(c *gin.Context) {\n\n}", "func (entity *Entity) Create() (result *Entity) {\n\tres, err := Connection.Db.Exec(\"INSERT INTO entities(uuid, url, status) VALUES(?, ?, ?)\", entity.UUID, entity.Url, entity.Status)\n\tif err != nil {\n\t\tlog.Println(\"Error in exec: \", err)\n\t}\n\n\tlastId, err := res.LastInsertId()\n\tif err != nil {\n\t\tlog.Println(\"Error in lastId: \", err)\n\t}\n\n\terr = Connection.Db.QueryRow(\"SELECT id,uuid,url,status from entities where id=?\", lastId).\n\t\tScan(&entity.Id, &entity.UUID, &entity.Url, &entity.Status)\n\tif err != nil {\n\t\tlog.Println(\"Error after queryrow: \", err)\n\t}\n\n\treturn entity\n}", "func (a *Admin) Create() (*mongo.InsertOneResult, error) {\n\ta.CreatedAt = variable.DateTimeNowPtr()\n\ta.ModifiedAt = variable.DateTimeNowPtr()\n\treturn a.Collection().InsertOne(context.Background(), *a)\n}", "func (r *Repository) Create(auth *Auth) (*Auth, error) {\n\tstr := `INSERT INTO ` + r.tableName + ` (user_id, device_id, token) values(?, ?, ?)`\n\tfmt.Println(str)\n\t_, err := DB.Exec(str, auth.UserID, auth.DeviceID, auth.Token)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn auth, nil\n}", "func (m *Manager) Create(ctx context.Context, tx *sql.Tx, user v0.User) error {\n\t_, err := tx.ExecContext(ctx, `\n\t\t\t\tINSERT INTO users (\n\t\t\t\t\tname, \n\t\t\t\t\temail, \n\t\t\t\t\tprimary_public_key, \n\t\t\t\t\trecovery_public_key, \n\t\t\t\t\tsuper_user, \n\t\t\t\t\tauth_level, \n\t\t\t\t\tweight,\n\t\t\t\t\tuser_set\n\t\t\t\t\t) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,\n\t\tuser.Name,\n\t\tuser.Email,\n\t\tuser.PrimaryPublicKey,\n\t\tuser.RecoveryPublicKey,\n\t\tuser.SuperUser,\n\t\tuser.AuthLevel,\n\t\tuser.Weight,\n\t\tuser.Set,\n\t)\n\treturn err\n}", "func (s *Storage) Create(item interface{}) error {\n\tses := s.GetDBSession()\n\tdefer ses.Close()\n\terr := ses.DB(s.database).C(s.table).Insert(item)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (u *InformationRepository) Create(model *models.Information) error {\n\tquery := u.InformationTable().Create(model)\n\tif err := query.Error; err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Create(row orm.Model) (bool, error) {\n\tconn, err := db.Open()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tdefer conn.Close()\n\tsession := orm.NewSession(conn)\n\terr = session.Insert(row)\n\treturn err == nil, err\n}", "func (meta Meta) Create(userID string) {\n\tdata := generate(userID)\n\tmeta.collection.InsertOne(context.TODO(), data)\n}", "func (s *PaymentStorage) Create(\n\tctx context.Context,\n\tid aggregate.ID,\n\tversion transaction.Version,\n\torganisationID transaction.OrganisationID,\n\tattributes interface{},\n) error {\n\tlogger := log.FromContext(ctx)\n\n\tquery := `INSERT INTO %[1]s (id, version, organisation_id, attributes) VALUES ($1, $2, $3, $4)`\n\tquery = fmt.Sprintf(query, s.table)\n\n\tif logger != nil {\n\t\tlogger.Debugf(\"exec in transaction sql %s, values %+v\", query, []interface{}{\n\t\t\tid,\n\t\t\tversion,\n\t\t\torganisationID,\n\t\t\tattributes,\n\t\t})\n\t}\n\n\treturn execInTransaction(s.db, func(tx *sqlx.Tx) error {\n\t\t_, err := tx.ExecContext(ctx, query, id, version, organisationID, attributes)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n}", "func (p *Poet) Create(db *sql.DB) error {\n\tvar (\n\t\terr error\n\t)\n\n\t// assume id is already assigned\n\n\t// set birthday\n\tp.BirthDate = time.Now().Truncate(time.Millisecond)\n\n\t// prepare statement if not already done so.\n\tif poetCreateStmt == nil {\n\t\t// create statement\n\t\tstmt := `INSERT INTO poets (\n id, designer, name, birthDate, deathDate, description, language, programFileName, parameterFileName, parameterFileIncluded, path\n ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)`\n\t\tpoetCreateStmt, err = db.Prepare(stmt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t_, err = poetCreateStmt.Exec(\n\t\tp.Id,\n\t\tp.Designer.Id,\n\t\tp.Name,\n\t\tp.BirthDate,\n\t\tp.DeathDate,\n\t\tp.Description,\n\t\tp.Language,\n\t\tp.ProgramFileName,\n\t\tp.ParameterFileName,\n\t\tp.ParameterFileIncluded,\n\t\tp.Path,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (r repository) Create(ctx context.Context, link entity.Link) error {\n\treturn r.db.With(ctx).Model(&link).Insert()\n}", "func (a *Api) Create(db *system.DB) (err error) {\n\n\tif err = a.validateError(); err != nil {\n\t\treturn\n\t}\n\n\ttx, err := db.Begin()\n\n\tdefer func() {\n\t\tif err != nil {\n\t\t\ttx.Rollback()\n\t\t\treturn\n\t\t}\n\n\t\tif err = tx.Commit(); err != nil {\n\t\t\ttx.Rollback()\n\t\t\treturn\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\tlog.Println(\"Api.Create() Error -> \", err)\n\t\treturn\n\t}\n\n\ta.IsActive = true\n\ta.CreatedAt = time.Now()\n\ta.UpdatedAt = time.Now()\n\n\terr = tx.QueryRow(a.queryCreate(),\n\t\ta.UserID,\n\t\ta.Token,\n\t\ta.PushNotificationToken,\n\t\ta.PushNotificationService,\n\t\ta.ManufacturerName,\n\t\ta.ManufacturerModel,\n\t\ta.ManufacturerVersion,\n\t\ta.DeviceID,\n\t\ta.IsActive,\n\t\ta.CreatedAt,\n\t\ta.UpdatedAt).Scan(&a.ID)\n\n\tif err != nil {\n\t\tlog.Printf(\"Api.Create() QueryRow() -> %v Error -> %v\", a.queryCreate(), err)\n\t\treturn\n\t}\n\n\tlog.Println(\"Api.Create() create successful, id -> \", a.ID)\n\treturn\n}", "func (u *CardRepository) Create(model *models.Card) error {\n\tquery := u.CardTable().Where(\"code = ?\", model.Code).FirstOrCreate(&model)\n\tif err := query.Error; err != nil {\n\t\treturn nil\n\t}\n\n\treturn nil\n}", "func (dao NotesPostgres) Create(note *model.Note) error {\n\tdb := getConnection()\n\tdefer db.Close()\n\n\tvar id int64\n\t// PostgreSQL doesn't support retrieving the last inserted ID from metadata so QueryRow and Scan act as a work around for this\n\terr := db.QueryRow(\"insert into notes (note_type, note_content, created, modified, owner_user_id) VALUES ($1, $2, now()::timestamp, now()::timestamp, $3) RETURNING id\", note.NoteType, note.NoteContent, note.OwnerUserID).Scan(&id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tnote.ID = id\n\treturn nil\n}", "func (gi *Sensor) Create(db *pg.DB) error {\r\n\tlog.Printf(\"===>sensorItem.Create()\")\r\n\tlog.Printf(\" sensorItem.Create():=%v\\n\", gi)\r\n\r\n\tinsertErr := db.Insert(gi)\r\n\tif insertErr != nil {\r\n\t\tlog.Printf(\"Error writing to DB in sensorItem.Create()\\n\")\r\n\t\tlog.Printf(\"Reason:%v\\n\", insertErr)\r\n\t\treturn insertErr\r\n\t}\r\n\tlog.Printf(\"Sensor %s inserted successfully into table\", gi.Sensorname)\r\n\treturn nil\r\n}", "func (self Users) Create() {\n\tsqlStatement := `INSERT INTO users (id, username) VALUES ($1, $2)`\n\t_, err := self.DB.Exec(sqlStatement, self.Id, self.UserName)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func (r *sampleRepository) Create(sample *model.Sample) error {\n\tsample.ID = uuid.New()\n\n\treturn r.DB.Create(sample).Error\n}", "func (db *Mngo) Create(c *store.Context, collectionName string, model store.Model) error {\n\tutils.EnsurePointer(model)\n\tmongoModel := store.EnsureGenericModel(model)\n\tcollection := db.database.Collection(mongoModel.GetCollection())\n\n\tif creator, ok := model.(store.BeforeCreator); ok {\n\t\tif err := creator.BeforeCreate(); err != nil {\n\t\t\treturn errors.Wrap(err, \"error in BeforeCreate\")\n\t\t}\n\t}\n\tif creator, ok := model.(store.BeforeCreatorWithContext); ok {\n\t\tif err := creator.BeforeCreate(c); err != nil {\n\t\t\treturn errors.Wrap(err, \"error in BeforeCreatorWithContext\")\n\t\t}\n\t}\n\n\tres, err := collection.InsertOne(db.context, model)\n\tif err != nil {\n\t\tlogrus.WithError(err).Errorln(\"cannot insert model\")\n\t\treturn errors.Wrap(err, \"cannot insert model\")\n\t}\n\n\t// update with inserted id\n\tif id, ok := res.InsertedID.(primitive.ObjectID); ok {\n\t\tsetID(model, id.Hex())\n\t}\n\tif id, ok := res.InsertedID.(string); ok {\n\t\tsetID(model, id)\n\t}\n\n\treturn nil\n}", "func (main *Main) Create(e echo.Context) (err error) {\n\n\t// get request and validate\n\treq := new(request.Create)\n\te.Bind(req)\n\tif err = e.Validate(req); err != nil {\n\t\treturn rest.ConstructErrorResponse(e, exception.NewInputValidationFailed(err.Error()))\n\t}\n\t// map req to input data\n\treqData := input.NewNewTransactionCreate(\n\t\tmap[string]interface{}{\n\t\t\t\"Name\": req.Name,\n\t\t\t\"Qty\": req.Qty,\n\t\t\t\"Price\": req.Price,\n\t\t\t\"Weight\": req.Weight,\n\t\t\t\"Images\": req.Images,\n\t\t\t\"Description\": req.Description,\n\t\t},\n\t)\n\t//insert data to db\n\ttransaction, exc := TransactionModel.Create(reqData)\n\tif exc != nil {\n\t\treturn rest.ConstructErrorResponse(e, exc)\n\t}\n\tdata := map[string]contract.Model{\n\t\t\"created_transaction\": transaction,\n\t}\n\treturn rest.ConstructSuccessResponse(e, data)\n}", "func (j *JDB) Create(w http.ResponseWriter, r *http.Request) {\n\tpath := mux.Vars(r)[\"host\"]\n\tcol := mux.Vars(r)[\"col\"]\n\tid := mux.Vars(r)[\"slug\"]\n\tdata := post.Post{}\n\terr := r.ParseForm()\n\tif err != nil {\n\t\t// Handle error\n\t}\n\tvar post post.Post\n\t// r.PostForm is a map of our POST form values\n\terr = decoder.Decode(&post, r.PostForm)\n\tif err != nil {\n\t\t// Handle error\n\t}\n\n\tif err := j.db.Write(path+\"/\"+col, id, data); err != nil {\n\t\tfmt.Println(\"Error\", err)\n\t}\n}", "func (h *handler) InsertOne(ctx context.Context, params db.Params) error {\n\treturn h.getDatabase(params.Database).C(params.Collection).Insert(params.UpsertData)\n}", "func (ms *mysqlstore) Create(record store.Record) (err error) {\n\tdefer func(t0 time.Time) {\n\t\terrStr := \"\"\n\t\tif err != nil {\n\t\t\terrStr = err.Error()\n\t\t}\n\t\tms.logger.Printf(\"%v\",\n\t\t\tlogrec{\n\t\t\t\tService: \"mysql\",\n\t\t\t\tOperation: \"create\",\n\t\t\t\tID: record.ID(),\n\t\t\t\tError: errStr,\n\t\t\t\tDuration: fmt.Sprintf(\"%v\", time.Since(t0)),\n\t\t\t},\n\t\t)\n\t}(time.Now())\n\n\t// run create op\n\n\treturn\n}", "func Create(t *contract.SQLTable) error {\n\tsqlstr := t.GetCreateSQL()\n\tif t.Database == \"\" {\n\t\tt.Database = \"default\"\n\t}\n\tdb, err := dblist.Get(t.Database)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = db.Exec(sqlstr)\n\treturn err\n}", "func (r *Repository) Create(ctx context.Context, m fazzdb.ModelInterface) (interface{}, error) {\n\tq, err := r.GetQuery(ctx)\n\tif nil != err {\n\t\treturn nil, err\n\t}\n\n\tresult, err := q.Use(m).\n\t\tInsertCtx(ctx, false)\n\n\tif nil != err {\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "func (ug *userDbHandle) Create(user *User) error {\n\treturn ug.db.Create(user).Error\n}", "func (db *Database) CreateNewDBRecord(record interface{}) error {\n\tif !db.NewRecord(record) {\n\t\tlog.Warn().Msg(\"The value's primary key is not blank\")\n\t}\n\tif err := db.Create(record).Error; err != nil {\n\t\tlog.Warn().Msg(\"Unable to create new Database record\")\n\t\treturn err\n\t}\n\tlog.Info().Msg(\"A new Database Record were successfully added.\")\n\treturn nil\n}", "func (c *Company) Insert() error {\n\tresult := initdb.DbInstance.Create(c)\n\tlog.Println(\"Created -> \", result)\n\treturn result.Error\n}", "func (i *Instance) Create() error {\n\tvar err error\n\ti.ID = bson.ObjectId(\"\")\n\n\tif err = i.save(); err != nil {\n\t\treturn nil\n\t}\n\n\treturn nil\n}", "func (repository *MongoRepository) Create(ctx context.Context, vessel *Vessel) error {\n\tlog.Printf(\"Create a new vessle : %v\", *vessel)\n\t_, err := repository.collection.InsertOne(ctx, vessel)\n\treturn err\n}", "func (u UserDAO) Create(user User) error {\n\treturn u.getCollection().Insert(&user)\n}", "func (u *User) Create() {\n\tconfig.DB.Create(u)\n}", "func (r *repository) Create(c *customerDomain.Customer) error {\n\terr := r.db.Table(c.TableName()).Create(c).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *ServiceObject) Create(id string) (*Row, sql.Result, error) {\n\tvar identity Row\n\tjsonObj := jsonObject{\n\t\tEmail: \"[email protected]\",\n\t}\n\tgeneratedID := uuid.New()\n\tgeneratedVariant := uuid2.NewV4()\n\tsupraID := generatedVariant.String() + \"-\" + generatedID.String()\n\tsupraID = supraID[0:50]\n\ts.log.Debug(\"supraID:\", zap.String(\"supraID\", supraID), zap.Int(\"supra lenght\", len(supraID)))\n\trawJSON, _ := json.Marshal(&jsonObj)\n\trightNow := time.Now()\n\tresult, err := s.db.Exec(`INSERT INTO identity\n\t\t(id, first_name, last_name, profile, created_at, updated_at) VALUES\n\t\t($1, $2, $3, $4, $5, $6);`,\n\t\tsupraID,\n\t\t\"adam\",\n\t\t\"cobb\",\n\t\trawJSON,\n\t\trightNow,\n\t\trightNow)\n\tif err != nil {\n\t\treturn nil, result, err\n\t}\n\n\t//Examine the result and define errors if necessary.\n\taffected, resErr := result.RowsAffected()\n\tif resErr != nil {\n\t\treturn nil, nil, resErr\n\t}\n\tif affected == int64(0) || affected > 1 {\n\t\tinsertErr := errors.New(\"INSERT INTO had fatal errors\")\n\t\treturn nil, nil, insertErr\n\t}\n\tsqlRow := s.db.QueryRow(`SELECT id, first_name, last_name, profile, created_at, updated_at\n\t\tFROM identity WHERE id = $1`, supraID)\n\tif sqlRow != nil {\n\t\tvar jsonData []byte\n\n\t\tscanErr := sqlRow.Scan(&identity.ID, &identity.FirstName, &identity.LastName,\n\t\t\t&jsonData, &identity.CreatedAt, &identity.UpdatedAt)\n\t\tif scanErr != nil {\n\t\t\treturn nil, nil, scanErr\n\t\t}\n\n\t\tif len(jsonData) > 0 {\n\t\t\tvar output interface{}\n\t\t\tdecodeErr := json.Unmarshal(jsonData, &output)\n\t\t\tif decodeErr != nil {\n\t\t\t\treturn nil, nil, decodeErr\n\t\t\t}\n\t\t\tidentity.ProfileInfo = output\n\t\t}\n\t}\n\treturn &identity, result, nil\n}", "func (ad *Admin) Create() error {\n\tif ad.dbCollection == nil {\n\t\treturn errors.New(\"Uninitialized Object Admin\")\n\t}\n\ttz, _ := utils.GetTimeZone()\n\tad.Timestamp = time.Now().In(tz).Format(time.ANSIC)\n\treturn ad.dbCollection.Insert(ad)\n}", "func (c *ConversationsRepo) Create(conversation *models.Conversation) (*models.Conversation, error) {\n _, err := c.DB.Model(conversation).Returning(\"*\").Insert()\n return conversation, err\n}", "func (imd *InMemoryDb) Create(obj interface{}) (string, bool) {\n\tif !imd.connected {\n\t\treturn \"\", false\n\t}\n\timd.mux.Lock()\n\tid := fmt.Sprintf(\"%d\", imd.idGenCount)\n\timd.idGenCount++\n\timd.store[id] = obj\n\timd.mux.Unlock()\n\treturn id, true\n}", "func (m *PasswordResetModel) Create(ctx context.Context, kv query.KV) (int64, error) {\n\n\tif _, ok := kv[\"created_at\"]; !ok {\n\t\tkv[\"created_at\"] = time.Now()\n\t}\n\n\tsqlStr, params := m.query.Table(m.tableName).ResolveInsert(kv)\n\n\tres, err := m.db.ExecContext(ctx, sqlStr, params...)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn res.LastInsertId()\n}", "func (dao *Wager) Create(tx *gorm.DB, mod *models.Wager) error {\n\terr := tx.Create(mod).Error\n\tif err != nil {\n\t\treturn errs.Wrap(errs.ErrMySQLCreate, err.Error(), \"tx.Create\")\n\t}\n\treturn nil\n}", "func (s *Storage) Create(item interface{}) error {\n\tses := s.GetDBSession()\n\tdefer ses.Close()\n\terr := ses.DB(s.database).C(s.collection).Insert(item)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s ArticleService) Create(ctx context.Context, i Article) error {\n\tstat := `INSERT INTO articles (title, description, content) VALUES(?,?,?);`\n\tif s.DB == nil {\n\t\tpanic(\"no existing database\")\n\t}\n\t_, err := s.DB.ExecContext(ctx, stat, i.Title, i.Desc, i.Content)\n\treturn err\n}", "func (a MySQLAdapter) Create(user entity.User) (uid int, err error) {\n\tinsertStmt := fmt.Sprintf(\"INSERT INTO %s VALUES (DEFAULT, ?, ?, ?, ?)\", a.table)\n\thashedPwd, err := passgen.HashPassword([]byte(user.Password))\n\tif err != nil {\n\t\treturn uid, err\n\t}\n\tres, err := a.db.Exec(insertStmt, user.Username, hashedPwd, user.Email, time.Now())\n\tif err != nil {\n\t\treturn uid, err\n\t}\n\tlastInsertID, err := res.LastInsertId()\n\tif err != nil {\n\t\treturn uid, err\n\t}\n\tuid = int(lastInsertID)\n\treturn uid, nil\n}", "func (r *Repository) create(user *domain.UserInfoModel) error {\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tquery := \"INSERT INTO users (namee, email, password) VALUES ($1, $2, $3)\"\n\tstmt, err := r.db.PrepareContext(ctx, query)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer stmt.Close()\n\n\tqueryStart := time.Now().Nanosecond() / 1000\n\t_, err = stmt.ExecContext(ctx, user.Name, user.Email, user.PassWord)\n\tif err != nil {\n\t\treturn err\n\t}\n\tqueryEnd := time.Now().Nanosecond() / 1000\n\texecutionTime := queryEnd - queryStart\n\terr = r.insertTimeSpent(\"Create\", executionTime)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn nil\n}", "func (ug *userGorm) Create(user *User) error{\n\treturn ug.db.Create(user).Error\n}", "func (ug *userGorm) Create(user *User) error {\n\treturn ug.db.Create(user).Error\n\n}", "func (r RepresentativeRepo) Create(repr d.Representative) error {\n\ttx, err := r.DB.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = r.UserRepo.CreateTx(tx, repr.User)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconst insertQuery = `INSERT INTO \"Representative\"(representative_id, job_title, ref_user, ref_company)\n\tVALUES ($1, $2, $3, $4);`\n\t_, err = tx.Exec(insertQuery,\n\t\trepr.ID,\n\t\trepr.JobTitle,\n\t\trepr.User.ID,\n\t\trepr.CompanyID,\n\t)\n\n\tif err != nil {\n\t\t_ = tx.Rollback()\n\t\treturn err\n\t}\n\n\terr = tx.Commit()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (user *User) Create() error {\n\tif err := db.Create(user).Error; err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (question Question) Create(Db *gorm.DB) {\n\tDb.Create(&question)\n}", "func (a *AktaKelahiran) Create() (*mongo.InsertOneResult, error) {\n\t// generate unique code and date created & modified\n\ta.InitCreate()\n\n\tresult, err := a.Collection().InsertOne(context.Background(), *a)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ta.ID = result.InsertedID.(primitive.ObjectID)\n\treturn result, nil\n}", "func Create(user User) error {\n\t\n}", "func (pr postRepository) Create(p Post) error {\n\treturn pr.getCollection().Insert(p)\n}", "func (gist *Gist) Create() {\n\t_, err := Db.NamedExec(`\n\t\tINSERT into gists (title, content, public, user_id, created_at, updated_at)\n\t\tVALUES (:title, :content, :public, :user_id, :created_at, :updated_at)`, gist,\n\t)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func Create(db database.Connection, name string, description string) int {\n\tvar id int\n\tresult := db.QueryRow(fmt.Sprintf(`\n\t\tINSERT INTO %v (name, description, show)\n\t\tVALUES ($1, $2, true)\n\t\tRETURNING ID\n\t\t`, table), name, description)\n\tresult.Scan(&id)\n\n\treturn id\n}", "func (repo *OrderRepository) Create(order *models.Order) (id int64, err error) {\n\tstatement := \"insert into `order` (vendorId, customerId, orderDetails, status) values (?, ?, ?, ?)\"\n\tstmt, err := Db.Prepare(statement)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer stmt.Close()\n\tresult, err := stmt.Exec(order.VendorId, order.CustomerId, order.OrderDetails, order.Status)\n\tif err != nil {\n\t\tcommon.Error.Println(\"Order could not be created \", err)\n\t\treturn\n\t}\n\treturn result.LastInsertId()\n\n}", "func (orm *JallyORM) Create(q Query) error {\n\treturn orm.Query(q.Create()).Exec()\n}", "func CreateOne(newUser NewUser) *User {\n\tres, err := collection().InsertOne(getContext(), newUser)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tuser, _ := GetOneByID(res.InsertedID.(primitive.ObjectID).Hex())\n\n\treturn user\n}", "func (u *UserModel) Create() error {\n\treturn DB.Self.Create(&u).Error\n}", "func (r *RootRepository) Create(ent Entity) error {\n\tif err := ent.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif err := r.DB.Create(ent).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (u UserRepositoryMysql) Create(ctx context.Context, db *gorp.DbMap, user model.User) (model.User, error) {\n\tuserDAO := &dao.User{Nickname: user.Nickname}\n\terr := db.Insert(userDAO)\n\tif err != nil {\n\t\treturn model.User{}, err\n\t}\n\n\tuser = model.User{\n\t\tID: userDAO.ID,\n\t\tNickname: userDAO.Nickname}\n\treturn user, nil\n}", "func (c *CourseDAL) Create(course *model.Course) error {\n\treturn nil\n}", "func (h *Hotel) Create(a *config.AppContext) error {\n\treturn a.Db.Create(h).Error\n}", "func (m *Manager) Create(vote models.Vote) error {\n\treturn m.Store.Database.Create(&vote).Error\n}", "func (ug *userGorm) Create(user *User) error {\n\treturn ug.db.Create(user).Error\n}", "func (ug *userGorm) Create(user *User) error {\n\treturn ug.db.Create(user).Error\n}", "func (prj *Project) Create() error {\n\treturn db.Create(prj).Error\n}", "func (h *EcrHandler) Create(obj interface{}) error {\n\treturn h.Upsert(obj)\n}", "func (x *UserStore) Create(uuid, firstName, lastName, email, password string) (string, error) {\n\tif x.mock != nil && x.mock.Enabled() {\n\t\treturn x.mock.String(), x.mock.Error()\n\t}\n\n\t_, err := x.db.Exec(`\n\t\tINSERT INTO user\n\t\t(id, first_name, last_name, email, password, status_id)\n\t\tVALUES\n\t\t(?,?,?,?,?,?)\n\t\t`,\n\t\tuuid, firstName, lastName, email, password, 1)\n\n\treturn uuid, err\n}", "func insertObject(object *remember.DataObject, connection *sql.DB) error {\n\tstatement, err := connection.Prepare(CREATE)\n\tif nil != err {\n\t\treturn err\n\t}\n\tdefer statement.Close()\n\n\tobject.CreatedAt = time.Now()\n\tobject.UpdatedAt = time.Now()\n\n\tresponse, err := statement.Exec(\n\t\tobject.Title,\n\t\tobject.GroupId,\n\t\tobject.Payload,\n\t\tobject.CreatedAt.Unix(),\n\t\tobject.UpdatedAt.Unix(),\n\t)\n\tif nil != err {\n\t\treturn err\n\t}\n\n\tobject.ID, err = response.LastInsertId()\n\treturn err\n}", "func (o *Constraint) Create(db *gorm.DB) error {\n\treturn db.Create(o).Error\n}", "func (contact *Contact) Create() error {\n\treturn DB().Create(contact).Error\n}", "func Create(c *gin.Context) {\n\ttodo := todo{Title: c.PostForm(\"title\"), Done: false}\n\tdb := Database()\n\tdb.Save(&todo)\n\tc.JSON(http.StatusCreated, gin.H{\n\t\t\"status\": http.StatusCreated,\n\t\t\"message\": \"Todo created\",\n\t\t\"todoid\": todo.ID,\n\t})\n}", "func (*SeatDataAccessObject) InsertOne(s *Seat) error {\n\t_, err := orm.InsertOne(s)\n\treturn err\n}", "func (m *Message) Create() (err error) {\n\tm.CreatedAt = time.Now()\n\t_, err = GetDB().Insert(m)\n\treturn err\n}", "func (post *Post) Create() (err error) {\n\tstatement := \"insert into posts (content, author) values ($1, $2) returning id\"\n\t//Prepare creates a prepared statement for later queries or executions. Multiple queries or executions may be run concurrently from the returned statement. The caller must call the statement's Close method when the statement is no longer needed.\n\tstmt, err := Db.Prepare(statement)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer stmt.Close()\n\t//QueryRow executes a prepared query statement with the given arguments. If an error occurs during the execution of the statement, that error will be returned by a call to Scan on the returned *Row, which is always non-nil. If the query selects no rows, the *Row's Scan will return ErrNoRows. Otherwise, the *Row's Scan scans the first selected row and discards the rest.\n\t//Scan copies the columns from the matched row into the values pointed at by dest. See the documentation on Rows.Scan for details. If more than one row matches the query, Scan uses the first row and discards the rest. If no row matches the query, Scan returns ErrNoRows.\n\terr = stmt.QueryRow(post.Content, post.Author).Scan(&post.Id)\n\treturn\n}", "func (c *Category) Create(db *sql.DB) (err error) {\n\terr = db.QueryRow(\"INSERT INTO category (name) VALUES($1) RETURNING id\",\n\t\tc.Name).Scan(&c.ID)\n\treturn err\n}" ]
[ "0.6750509", "0.67373616", "0.6689686", "0.66649663", "0.6654316", "0.66212976", "0.6599416", "0.6594931", "0.6594112", "0.65927285", "0.6590238", "0.6590238", "0.65799296", "0.65766186", "0.65734625", "0.65650755", "0.6561134", "0.6551655", "0.6546562", "0.6536333", "0.65285003", "0.65219194", "0.65161306", "0.6493709", "0.6490234", "0.6486837", "0.648542", "0.6461924", "0.645993", "0.64566934", "0.6453996", "0.6445178", "0.6437581", "0.64343786", "0.6429889", "0.64051545", "0.6400548", "0.63982475", "0.63945895", "0.63935286", "0.6388328", "0.63855165", "0.6385243", "0.6380973", "0.63689023", "0.6364379", "0.63490915", "0.63480026", "0.6347408", "0.6346523", "0.6344983", "0.6336737", "0.63310695", "0.6329397", "0.63214225", "0.63204384", "0.6317346", "0.630316", "0.6288109", "0.6279446", "0.6279126", "0.6273853", "0.62730366", "0.6269989", "0.6259187", "0.6259106", "0.6258607", "0.6258529", "0.62514585", "0.6243099", "0.6231127", "0.62309897", "0.62302125", "0.62171304", "0.62072986", "0.6194155", "0.61866796", "0.6186178", "0.61844355", "0.6179317", "0.61784124", "0.6177565", "0.617461", "0.6174572", "0.61716676", "0.61565715", "0.61561215", "0.6152734", "0.6150183", "0.6150183", "0.6135147", "0.6134725", "0.6134554", "0.6130915", "0.6129491", "0.6129469", "0.61270714", "0.6125099", "0.6124286", "0.6117023", "0.6115484" ]
0.0
-1
syncBucket syncs the local gallery with the bucket
func syncBucket(name string) { objects, err := s3.ListBucket(name, "") if err != nil { log.Printf("Can't list objects in bucket: %v", err) } // download each file that we don't have yet locally: for _, object := range objects { localfile := filepath.Join(galleryPath, object) if _, err := os.Stat(localfile); err != nil { err = s3.DownloadFromBucket("gallery", object, localfile) if err != nil { log.Printf("Can't download file %v: %v", object, err) } } } log.Printf("Done downloading missing files from bucket %v", name) // upload metadata files that are not yet remote: files, err := ioutil.ReadDir(galleryPath) if err != nil { log.Printf("Can't scan local gallery for metadata: %v", err) return } for _, f := range files { if strings.HasSuffix(f.Name(), "meta") { if !has(objects, f.Name()) { err = s3.UploadToBucket("gallery", f.Name(), filepath.Join(galleryPath, f.Name()), "text/plain") if err != nil { log.Printf("Can't upload metadata file %v: %v", f.Name(), err) } } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Sync(t time.Time, log *zap.Logger) {\n\tlog.Info(\"S3 sync begun\")\n\n\tbucket := Config.bucket\n\tregion := Config.bucketRegion\n\n\tsvc := setUpAwsSession(region)\n\tresp, err := listBucket(bucket, region, svc, log)\n\tif err != nil {\n\t\tlog.Error(\"failed to list bucket\",\n\t\t\tzap.Error(err),\n\t\t\tzap.String(\"bucket\", bucket),\n\t\t\tzap.String(\"region\", region),\n\t\t)\n\n\t\treturn\n\t}\n\n\tif err := parseAllFiles(resp, bucket, svc, log); err != nil {\n\t\treturn\n\t}\n\n\tmu.Lock()\n\tdefer mu.Unlock()\n\tUp = true\n\tHealth = true\n\n\tlog.Info(\"S3 sync finished\")\n}", "func (gcs *localStorage) Upload(b []byte, bucket, fileName string) (string, error) {\n\t_, err := os.Stat(bucket) // checking if bucket exists\n\tif os.IsNotExist(err) {\n\t\terr := os.MkdirAll(bucket, 0755)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"falha ao criar diretório %s, erro %q\", bucket, err)\n\t\t}\n\t}\n\tname := fmt.Sprintf(\"%s/%s\", bucket, fileName)\n\tif err := ioutil.WriteFile(name, b, 0644); err != nil {\n\t\treturn \"\", fmt.Errorf(\"falha ao salver arquivo %s no caminho %s, erro %q\", fileName, name, err)\n\t}\n\treturn fmt.Sprintf(\"%s/%s\", bucket, fileName), nil\n}", "func (b *Bucket) Bucket(name string) *Bucket { panic(\"n/i\") }", "func (h *S3Handler) uploadToS3(p *Project, wg *sync.WaitGroup) {\n\n\tdefer recovery()\n\t// get image content\n\tdefer wg.Done()\n\tvar arr []string\n\n\tfor _, url := range(p.Image) {\n\n\t\tbuffer:= img(url)\n\t\tif len(*buffer) > 0 {\n\t\t\t// upload to s3\n\n\t\t\ts := strings.Split(url, \"/\")\n\t\t\turl_key := s[len(s)-1]\n\n\t\t\tmyurl := fmt.Sprintf(\"https://%s.s3.ap-south-1.amazonaws.com/%s\", S3_BUCKET, url_key)\n\n\t\t\t_, err := s3.New(h.Session).PutObject(&s3.PutObjectInput{\n\n\t\t\t\tBucket: aws.String(S3_BUCKET),\n\t\t\t\tKey: aws.String(url_key),\n\t\t\t\tACL: aws.String(\"public-read\"),\n\t\t\t\tBody: bytes.NewReader(*buffer),\n\t\t\t\tContentLength: aws.Int64(int64(len(*buffer))),\n\t\t\t\tContentType: aws.String(http.DetectContentType(*buffer)),\n\t\t\t\tContentDisposition: aws.String(\"attachment\"),\n\t\t\t})\n\n\t\t\tif err != nil{\n\t\t\t\tpanic(\"********************************************************************************************************************************************\")\n\n\n\t\t\t}else {\n\t\t\t\tarr = append(arr, myurl)\n\t\t\t\t//fmt.Println(akki)\n\n\t\t\t}\n\t\t}\n\n\n\t}\n\n\t// update to mongodb\n\tobjID, _ := primitive.ObjectIDFromHex(p.ID)\n\n\tfilter := bson.M{\"_id\": bson.M{\"$eq\": objID}}\n\n\n\tupdate := bson.M{\n\t\t\"$set\": bson.M{\n\t\t\t\"new_image_urlss\": arr,\n\n\t\t},\n\t}\n\tupdateResult, _ := h.Collection.UpdateOne(context.TODO(), filter, update)\n\n\tfmt.Println(updateResult)\n\n\n}", "func patchBucket(w http.ResponseWriter, r *http.Request) {\n\n\tpathParams := mux.Vars(r)\n\tsageBucketID := pathParams[\"bucket\"]\n\t//objectKey := pathParams[\"key\"]\n\n\tvars := mux.Vars(r)\n\tusername := vars[\"username\"]\n\n\t//rawQuery := r.URL.RawQuery\n\n\t// normal bucket metadata\n\n\tallowed, err := userHasBucketPermission(username, sageBucketID, \"FULL_CONTROL\")\n\tif err != nil {\n\t\trespondJSONError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\tif !allowed {\n\t\trespondJSONError(w, http.StatusUnauthorized, \"Write access to bucket metadata denied (%s, %s)\", username, sageBucketID)\n\t\treturn\n\t}\n\n\tvar deltaBucket map[string]string\n\n\terr = json.NewDecoder(r.Body).Decode(&deltaBucket)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Could not parse json: %s\", err.Error())\n\t\trespondJSONError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\tlog.Printf(\"got: %v\", deltaBucket)\n\n\tdb, err := sql.Open(\"mysql\", mysqlDSN)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Unable to connect to database: %v\", err)\n\t\treturn\n\t}\n\tdefer db.Close()\n\n\tnewBucketname, ok := deltaBucket[\"name\"]\n\tif ok {\n\n\t\tinsertQueryStr := \"UPDATE Buckets SET name=? WHERE id=UUID_TO_BIN(?) ;\"\n\t\t_, err = db.Exec(insertQueryStr, newBucketname, sageBucketID)\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"Bucket creation in mysql failed: %s\", err.Error())\n\t\t\treturn\n\t\t}\n\n\t}\n\n\t// return should return real bucket\n\n\tnewBucket, err := GetSageBucket(sageBucketID)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"GetSageBucket returned: %s\", err.Error())\n\t\trespondJSONError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\trespondJSON(w, http.StatusOK, newBucket)\n\t//bucket fields:\n\t//metadata , name , type, (owner, change requires permission change)\n\n\t//permission\n\n}", "func (t *targetrunner) renamelocalbucket(bucketFrom, bucketTo string, p BucketProps, clone *bucketMD) (errstr string) {\n\t// ready to receive migrated obj-s _after_ that point\n\t// insert directly w/o incrementing the version (metasyncer will do at the end of the operation)\n\tclone.LBmap[bucketTo] = p\n\tt.bmdowner.put(clone)\n\n\twg := &sync.WaitGroup{}\n\tch := make(chan string, len(ctx.mountpaths.Available))\n\tfor mpath := range ctx.mountpaths.Available {\n\t\tfromdir := filepath.Join(makePathLocal(mpath), bucketFrom)\n\t\twg.Add(1)\n\t\tgo func(fromdir string, wg *sync.WaitGroup) {\n\t\t\ttime.Sleep(time.Millisecond * 100) // FIXME: 2-phase for the targets to 1) prep (above) and 2) rebalance\n\t\t\tch <- t.renameOne(fromdir, bucketFrom, bucketTo)\n\t\t\twg.Done()\n\t\t}(fromdir, wg)\n\t}\n\twg.Wait()\n\tclose(ch)\n\tfor errstr = range ch {\n\t\tif errstr != \"\" {\n\t\t\treturn\n\t\t}\n\t}\n\tfor mpath := range ctx.mountpaths.Available {\n\t\tfromdir := filepath.Join(makePathLocal(mpath), bucketFrom)\n\t\tif err := os.RemoveAll(fromdir); err != nil {\n\t\t\tglog.Errorf(\"Failed to remove dir %s\", fromdir)\n\t\t}\n\t}\n\tclone.del(bucketFrom, true)\n\treturn\n}", "func Initrepo(server string, secure bool, accesskey string, secretkey string, enckey string, bucketname string, dir string) bool {\n\t// New returns an Amazon S3 compatible client object. API compatibility (v2 or v4) is automatically\n\t// determined based on the Endpoint value.\n\ts3Client, err := minio.New(server, accesskey, secretkey, secure)\n\tif err != nil {\n\t\tjc.SendString(fmt.Sprintln(err))\n\t\treturn false\n\t}\n\n\tfound, err := s3Client.BucketExists(bucketname)\n\tif err != nil {\n\t\tjc.SendString(fmt.Sprintln(err))\n\t\treturn false\n\t}\n\n\tif found {\n\t\tjc.SendString(\"Bucket exists.\")\n\t} else {\n\t\tjc.SendString(\"Creating bucket.\")\n\t\terr = s3Client.MakeBucket(bucketname, \"us-east-1\")\n\t\tif err != nil {\n\t\t\tjc.SendString(fmt.Sprintln(err))\n\t\t\treturn false\n\t\t}\n\t}\n\tvar strs []string\n\tslash := dir[len(dir)-1:]\n\tif slash != \"/\" {\n\t\tstrs = append(strs, dir)\n\t\tstrs = append(strs, \"/\")\n\t\tdir = strings.Join(strs, \"\")\n\t}\n\tvar dbname []string\n\tvar dbnameLocal []string\n\tdbname = append(dbname, bucketname)\n\tdbname = append(dbname, \".db\")\n\tdbnameLocal = append(dbnameLocal, dir)\n\tdbnameLocal = append(dbnameLocal, \".\")\n\tdbnameLocal = append(dbnameLocal, strings.Join(dbname, \"\"))\n\t// check if dir exists, create if not\n\tbasedir := filepath.Dir(strings.Join(dbnameLocal, \"\"))\n\tos.MkdirAll(basedir, os.ModePerm)\n\n\t// create empty repository\n\tfile, err := os.Create(strings.Join(dbnameLocal, \"\"))\n\tdefer file.Close()\n\tif err != nil {\n\t\tjc.SendString(fmt.Sprintln(err))\n\t\treturn false\n\t}\n\tdbuploadlist := make(map[string]string)\n\t// add these files to the upload list\n\tdbuploadlist[strings.Join(dbname, \"\")] = strings.Join(dbnameLocal, \"\")\n\tfailedUploads, err := Upload(server, 443, secure, accesskey, secretkey, enckey, dbuploadlist, bucketname)\n\tif err != nil {\n\t\tfor _, hash := range failedUploads {\n\t\t\tjc.SendString(fmt.Sprintln(\"Failed to upload: \", hash))\n\t\t}\n\t\treturn false\n\t}\n\n\terr = os.Remove(strings.Join(dbnameLocal, \"\"))\n\tif err != nil {\n\t\tjc.SendString(fmt.Sprintln(\"Error deleting database!\", err))\n\t}\n\treturn true\n\n}", "func (s *synchronizer) restoreBucket(ctx context.Context, bucketSlug string) error {\n\n\tlocalBucket, err := s.getBucket(ctx, bucketSlug)\n\tif err != nil {\n\t\tlog.Error(\"Error in getBucket\", err)\n\t\treturn err\n\t}\n\n\tmirrorBucket, err := s.getMirrorBucket(ctx, bucketSlug)\n\tif err != nil {\n\t\tlog.Error(\"Error in getMirrorBucket\", err)\n\t\treturn err\n\t}\n\n\titerator := func(c context.Context, b *bucket.Bucket, itemPath string) error {\n\t\texists, _ := localBucket.FileExists(c, itemPath)\n\n\t\tif exists {\n\t\t\tnewerBucket, err := s.newerBucketPath(c, localBucket, mirrorBucket, itemPath)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif newerBucket == localBucket {\n\t\t\t\t// do not overwrite: mirror is not newer\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\n\t\tbucketModel, err := s.model.FindBucket(ctx, bucketSlug)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\titem, err := mirrorBucket.ListDirectory(ctx, itemPath)\n\t\tif s.eventNotifier != nil && err == nil {\n\t\t\tinfo := utils.MapDirEntryToFileInfo(api_buckets_pb.ListPathResponse(*item), itemPath)\n\t\t\tinfo.BackedUp = true\n\t\t\tinfo.LocallyAvailable = exists\n\t\t\tinfo.RestoreInProgress = true\n\t\t\ts.eventNotifier.SendFileEvent(events.NewFileEvent(info, events.FileRestoring, bucketSlug, bucketModel.DbID))\n\t\t}\n\n\t\ts.NotifyFileRestore(bucketSlug, itemPath)\n\t\treturn nil\n\t}\n\n\tif _, err = mirrorBucket.Each(ctx, \"\", iterator, true); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (cs *CloudStorage) Upload(ctx context.Context, user *domain.User,\n\tbucket string, attrs *domain.ImgAttrs, r io.Reader, prefix string) error {\n\twc := cs.Bucket(bucket).Object(prefix).NewWriter(ctx)\n\tif _, err := io.Copy(wc, r); err != nil {\n\t\treturn err\n\t}\n\tif err := wc.Close(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (bm *BucketManager) InsertBucket(settings *BucketSettings) error {\n\tposts := url.Values{}\n\tposts.Add(\"name\", settings.Name)\n\tif settings.Type == Couchbase {\n\t\tposts.Add(\"bucketType\", \"couchbase\")\n\t} else if settings.Type == Memcached {\n\t\tposts.Add(\"bucketType\", \"memcached\")\n\t} else if settings.Type == Ephemeral {\n\t\tposts.Add(\"bucketType\", \"ephemeral\")\n\t} else {\n\t\tpanic(\"Unrecognized bucket type.\")\n\t}\n\tif settings.FlushEnabled {\n\t\tposts.Add(\"flushEnabled\", \"1\")\n\t} else {\n\t\tposts.Add(\"flushEnabled\", \"0\")\n\t}\n\tposts.Add(\"replicaNumber\", fmt.Sprintf(\"%d\", settings.Replicas))\n\tposts.Add(\"authType\", \"sasl\")\n\tposts.Add(\"saslPassword\", settings.Password)\n\tposts.Add(\"ramQuotaMB\", fmt.Sprintf(\"%d\", settings.Quota))\n\n\tdata := []byte(posts.Encode())\n\n\treq := &gocbcore.HttpRequest{\n\t\tService: gocbcore.ServiceType(MgmtService),\n\t\tPath: \"/pools/default/buckets\",\n\t\tMethod: \"POST\",\n\t\tBody: data,\n\t\tContentType: \"application/x-www-form-urlencoded\",\n\t}\n\n\tresp, err := bm.httpClient.DoHttpRequest(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.StatusCode != 202 {\n\t\tdata, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = resp.Body.Close()\n\t\tif err != nil {\n\t\t\tlogDebugf(\"Failed to close socket (%s)\", err)\n\t\t}\n\t\treturn networkError{statusCode: resp.StatusCode, message: string(data)}\n\t}\n\n\treturn nil\n}", "func (p *PBM) ResyncStorage(l *log.Event) error {\n\tstg, err := p.GetStorage(l)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to get backup store\")\n\t}\n\n\t_, err = stg.FileStat(StorInitFile)\n\tif errors.Is(err, storage.ErrNotExist) {\n\t\terr = stg.Save(StorInitFile, bytes.NewBufferString(version.DefaultInfo.Version), 0)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"init storage\")\n\t}\n\n\tbcps, err := stg.List(\"\", MetadataFileSuffix)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"get a backups list from the storage\")\n\t}\n\n\terr = p.moveCollection(BcpCollection, BcpOldCollection)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"copy current backups meta from %s to %s\", BcpCollection, BcpOldCollection)\n\t}\n\terr = p.moveCollection(PITRChunksCollection, PITRChunksOldCollection)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"copy current pitr meta from %s to %s\", PITRChunksCollection, PITRChunksOldCollection)\n\t}\n\n\tif len(bcps) == 0 {\n\t\treturn nil\n\t}\n\n\tvar ins []interface{}\n\tfor _, b := range bcps {\n\t\td, err := stg.SourceReader(b.Name)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"read meta for %v\", b.Name)\n\t\t}\n\n\t\tv := BackupMeta{}\n\t\terr = json.NewDecoder(d).Decode(&v)\n\t\td.Close()\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"unmarshal backup meta\")\n\t\t}\n\t\terr = checkBackupFiles(&v, stg)\n\t\tif err != nil {\n\t\t\tl.Warning(\"skip snapshot %s: %v\", v.Name, err)\n\t\t\tcontinue\n\t\t}\n\t\tins = append(ins, v)\n\t}\n\t_, err = p.Conn.Database(DB).Collection(BcpCollection).InsertMany(p.ctx, ins)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"insert retrieved backups meta\")\n\t}\n\n\tpitrf, err := stg.List(PITRfsPrefix, \"\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"get list of pitr chunks\")\n\t}\n\tif len(pitrf) == 0 {\n\t\treturn nil\n\t}\n\n\tvar pitr []interface{}\n\tfor _, f := range pitrf {\n\t\t_, err := stg.FileStat(PITRfsPrefix + \"/\" + f.Name)\n\t\tif err != nil {\n\t\t\tl.Warning(\"skip pitr chunk %s/%s because of %v\", PITRfsPrefix, f.Name, err)\n\t\t\tcontinue\n\t\t}\n\t\tchnk := PITRmetaFromFName(f.Name)\n\t\tif chnk != nil {\n\t\t\tpitr = append(pitr, chnk)\n\t\t}\n\t}\n\n\tif len(pitr) == 0 {\n\t\treturn nil\n\t}\n\n\t_, err = p.Conn.Database(DB).Collection(PITRChunksCollection).InsertMany(p.ctx, pitr)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"insert retrieved pitr meta\")\n\t}\n\n\treturn nil\n}", "func upload(resp []byte, b, r string) error {\n\n\t// put bytes in reader\n\tfile := bytes.NewReader(resp)\n\n\t// configure s3 client\n\tsess, err := session.NewSession(&aws.Config{\n\t\tRegion: aws.String(\"eu-west-2\")},\n\t)\n\n\t// use timestamp and repo as filename\n\tt := time.Now()\n\ttf := t.Format(time.RFC3339)\n\tfn := (tf) + \"-\" + (r)\n\n\tuploader := s3manager.NewUploader(sess)\n\n\t// upload to s3\n\t_, err = uploader.Upload(&s3manager.UploadInput{\n\t\tBucket: aws.String(b),\n\t\tKey: aws.String(fn),\n\t\tBody: file,\n\t})\n\tif err != nil {\n\t\texitErrorf(\"could not upload %q to %q, %v: \", fn, b, err)\n\t}\n\n\tfmt.Printf(\"successfully uploaded %q to %q\\n\", fn, b)\n\treturn nil\n}", "func (c *SiteReplicationSys) syncLocalToPeers(ctx context.Context) error {\n\t// If local has buckets, enable versioning on them, create them on peers\n\t// and setup replication rules.\n\tobjAPI := newObjectLayerFn()\n\tif objAPI == nil {\n\t\treturn errSRObjectLayerNotReady\n\t}\n\tbuckets, err := objAPI.ListBuckets(ctx)\n\tif err != nil {\n\t\treturn errSRBackendIssue(err)\n\t}\n\tfor _, bucketInfo := range buckets {\n\t\tbucket := bucketInfo.Name\n\n\t\t// MinIO does not store bucket location - so we just check if\n\t\t// object locking is enabled.\n\t\tlockConfig, err := globalBucketMetadataSys.GetObjectLockConfig(bucket)\n\t\tif err != nil {\n\t\t\tif _, ok := err.(BucketObjectLockConfigNotFound); !ok {\n\t\t\t\treturn errSRBackendIssue(err)\n\t\t\t}\n\t\t}\n\n\t\tvar opts BucketOptions\n\t\tif lockConfig != nil {\n\t\t\topts.LockEnabled = lockConfig.ObjectLockEnabled == \"Enabled\"\n\t\t}\n\n\t\t// Now call the MakeBucketHook on existing bucket - this will\n\t\t// create buckets and replication rules on peer clusters.\n\t\terr = c.MakeBucketHook(ctx, bucket, opts)\n\t\tif err != nil {\n\t\t\treturn errSRBucketConfigError(err)\n\t\t}\n\n\t\t// Replicate bucket policy if present.\n\t\tpolicy, err := globalPolicySys.Get(bucket)\n\t\tfound := true\n\t\tif _, ok := err.(BucketPolicyNotFound); ok {\n\t\t\tfound = false\n\t\t} else if err != nil {\n\t\t\treturn errSRBackendIssue(err)\n\t\t}\n\t\tif found {\n\t\t\tpolicyJSON, err := json.Marshal(policy)\n\t\t\tif err != nil {\n\t\t\t\treturn wrapSRErr(err)\n\t\t\t}\n\t\t\terr = c.BucketMetaHook(ctx, madmin.SRBucketMeta{\n\t\t\t\tType: madmin.SRBucketMetaTypePolicy,\n\t\t\t\tBucket: bucket,\n\t\t\t\tPolicy: policyJSON,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn errSRBucketMetaError(err)\n\t\t\t}\n\t\t}\n\n\t\t// Replicate bucket tags if present.\n\t\ttags, err := globalBucketMetadataSys.GetTaggingConfig(bucket)\n\t\tfound = true\n\t\tif _, ok := err.(BucketTaggingNotFound); ok {\n\t\t\tfound = false\n\t\t} else if err != nil {\n\t\t\treturn errSRBackendIssue(err)\n\t\t}\n\t\tif found {\n\t\t\ttagCfg, err := xml.Marshal(tags)\n\t\t\tif err != nil {\n\t\t\t\treturn wrapSRErr(err)\n\t\t\t}\n\t\t\ttagCfgStr := base64.StdEncoding.EncodeToString(tagCfg)\n\t\t\terr = c.BucketMetaHook(ctx, madmin.SRBucketMeta{\n\t\t\t\tType: madmin.SRBucketMetaTypeTags,\n\t\t\t\tBucket: bucket,\n\t\t\t\tTags: &tagCfgStr,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn errSRBucketMetaError(err)\n\t\t\t}\n\t\t}\n\n\t\t// Replicate object-lock config if present.\n\t\tobjLockCfg, err := globalBucketMetadataSys.GetObjectLockConfig(bucket)\n\t\tfound = true\n\t\tif _, ok := err.(BucketObjectLockConfigNotFound); ok {\n\t\t\tfound = false\n\t\t} else if err != nil {\n\t\t\treturn errSRBackendIssue(err)\n\t\t}\n\t\tif found {\n\t\t\tobjLockCfgData, err := xml.Marshal(objLockCfg)\n\t\t\tif err != nil {\n\t\t\t\treturn wrapSRErr(err)\n\t\t\t}\n\t\t\tobjLockStr := base64.StdEncoding.EncodeToString(objLockCfgData)\n\t\t\terr = c.BucketMetaHook(ctx, madmin.SRBucketMeta{\n\t\t\t\tType: madmin.SRBucketMetaTypeObjectLockConfig,\n\t\t\t\tBucket: bucket,\n\t\t\t\tTags: &objLockStr,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn errSRBucketMetaError(err)\n\t\t\t}\n\t\t}\n\n\t\t// Replicate existing bucket bucket encryption settings\n\t\tsseConfig, err := globalBucketMetadataSys.GetSSEConfig(bucket)\n\t\tfound = true\n\t\tif _, ok := err.(BucketSSEConfigNotFound); ok {\n\t\t\tfound = false\n\t\t} else if err != nil {\n\t\t\treturn errSRBackendIssue(err)\n\t\t}\n\t\tif found {\n\t\t\tsseConfigData, err := xml.Marshal(sseConfig)\n\t\t\tif err != nil {\n\t\t\t\treturn wrapSRErr(err)\n\t\t\t}\n\t\t\tsseConfigStr := base64.StdEncoding.EncodeToString(sseConfigData)\n\t\t\terr = c.BucketMetaHook(ctx, madmin.SRBucketMeta{\n\t\t\t\tType: madmin.SRBucketMetaTypeSSEConfig,\n\t\t\t\tBucket: bucket,\n\t\t\t\tSSEConfig: &sseConfigStr,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn errSRBucketMetaError(err)\n\t\t\t}\n\t\t}\n\t}\n\n\t{\n\t\t// Replicate IAM policies on local to all peers.\n\t\tallPolicies, err := globalIAMSys.ListPolicies(ctx, \"\")\n\t\tif err != nil {\n\t\t\treturn errSRBackendIssue(err)\n\t\t}\n\n\t\tfor pname, policy := range allPolicies {\n\t\t\tpolicyJSON, err := json.Marshal(policy)\n\t\t\tif err != nil {\n\t\t\t\treturn wrapSRErr(err)\n\t\t\t}\n\t\t\terr = c.IAMChangeHook(ctx, madmin.SRIAMItem{\n\t\t\t\tType: madmin.SRIAMItemPolicy,\n\t\t\t\tName: pname,\n\t\t\t\tPolicy: policyJSON,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn errSRIAMError(err)\n\t\t\t}\n\t\t}\n\t}\n\n\t{\n\t\t// Replicate policy mappings on local to all peers.\n\t\tuserPolicyMap := make(map[string]MappedPolicy)\n\t\tgroupPolicyMap := make(map[string]MappedPolicy)\n\t\tglobalIAMSys.store.rlock()\n\t\terrU := globalIAMSys.store.loadMappedPolicies(ctx, stsUser, false, userPolicyMap)\n\t\terrG := globalIAMSys.store.loadMappedPolicies(ctx, stsUser, true, groupPolicyMap)\n\t\tglobalIAMSys.store.runlock()\n\t\tif errU != nil {\n\t\t\treturn errSRBackendIssue(errU)\n\t\t}\n\t\tif errG != nil {\n\t\t\treturn errSRBackendIssue(errG)\n\t\t}\n\n\t\tfor user, mp := range userPolicyMap {\n\t\t\terr := c.IAMChangeHook(ctx, madmin.SRIAMItem{\n\t\t\t\tType: madmin.SRIAMItemPolicyMapping,\n\t\t\t\tPolicyMapping: &madmin.SRPolicyMapping{\n\t\t\t\t\tUserOrGroup: user,\n\t\t\t\t\tIsGroup: false,\n\t\t\t\t\tPolicy: mp.Policies,\n\t\t\t\t},\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn errSRIAMError(err)\n\t\t\t}\n\t\t}\n\n\t\tfor group, mp := range groupPolicyMap {\n\t\t\terr := c.IAMChangeHook(ctx, madmin.SRIAMItem{\n\t\t\t\tType: madmin.SRIAMItemPolicyMapping,\n\t\t\t\tPolicyMapping: &madmin.SRPolicyMapping{\n\t\t\t\t\tUserOrGroup: group,\n\t\t\t\t\tIsGroup: true,\n\t\t\t\t\tPolicy: mp.Policies,\n\t\t\t\t},\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn errSRIAMError(err)\n\t\t\t}\n\t\t}\n\t}\n\n\t{\n\t\t// Check for service accounts and replicate them. Only LDAP user\n\t\t// owned service accounts are supported for this operation.\n\t\tserviceAccounts := make(map[string]auth.Credentials)\n\t\tglobalIAMSys.store.rlock()\n\t\terr := globalIAMSys.store.loadUsers(ctx, svcUser, serviceAccounts)\n\t\tglobalIAMSys.store.runlock()\n\t\tif err != nil {\n\t\t\treturn errSRBackendIssue(err)\n\t\t}\n\t\tfor user, acc := range serviceAccounts {\n\t\t\tclaims, err := globalIAMSys.GetClaimsForSvcAcc(ctx, acc.AccessKey)\n\t\t\tif err != nil {\n\t\t\t\treturn errSRBackendIssue(err)\n\t\t\t}\n\t\t\tif claims != nil {\n\t\t\t\tif _, isLDAPAccount := claims[ldapUserN]; !isLDAPAccount {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\t_, policy, err := globalIAMSys.GetServiceAccount(ctx, acc.AccessKey)\n\t\t\tif err != nil {\n\t\t\t\treturn errSRBackendIssue(err)\n\t\t\t}\n\t\t\tvar policyJSON []byte\n\t\t\tif policy != nil {\n\t\t\t\tpolicyJSON, err = json.Marshal(policy)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn wrapSRErr(err)\n\t\t\t\t}\n\t\t\t}\n\t\t\terr = c.IAMChangeHook(ctx, madmin.SRIAMItem{\n\t\t\t\tType: madmin.SRIAMItemSvcAcc,\n\t\t\t\tSvcAccChange: &madmin.SRSvcAccChange{\n\t\t\t\t\tCreate: &madmin.SRSvcAccCreate{\n\t\t\t\t\t\tParent: acc.ParentUser,\n\t\t\t\t\t\tAccessKey: user,\n\t\t\t\t\t\tSecretKey: acc.SecretKey,\n\t\t\t\t\t\tGroups: acc.Groups,\n\t\t\t\t\t\tClaims: claims,\n\t\t\t\t\t\tSessionPolicy: json.RawMessage(policyJSON),\n\t\t\t\t\t\tStatus: acc.Status,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn errSRIAMError(err)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (bo *bmdOwnerBase) _put(bucketmd *bucketMD) {\n\tbucketmd.vstr = strconv.FormatInt(bucketmd.Version, 10)\n\tbo.bucketmd.Store(unsafe.Pointer(bucketmd))\n}", "func commitFileUpload(\n\tctx context.Context,\n\tfs *fsMutable,\n\tchans commitChans,\n\tbundleUploadWaitGroup *sync.WaitGroup,\n\tcaFs cafs.Fs,\n\tuploadTask commitUploadTask) {\n\tdefer bundleUploadWaitGroup.Done()\n\tfile, err := fs.localCache.OpenFile(getPathToBackingFile(uploadTask.inodeID),\n\t\tos.O_RDONLY|os.O_SYNC, fileDefaultMode)\n\tif err != nil {\n\t\tselect {\n\t\tcase chans.error <- err:\n\t\t\tfs.l.Error(\"Commit: backing fs open() error on file upload\",\n\t\t\t\tzap.Error(err),\n\t\t\t\tzap.String(\"filename\", uploadTask.name))\n\t\tcase <-chans.done:\n\t\t}\n\t\treturn\n\t}\n\t// written, key, keys, duplicate, err =\n\tputRes, err := caFs.Put(ctx, file)\n\tif err != nil {\n\t\tselect {\n\t\tcase chans.error <- err:\n\t\t\tfs.l.Error(\"Commit: cafs Put() error on file upload\",\n\t\t\t\tzap.Error(err),\n\t\t\t\tzap.String(\"filename\", uploadTask.name))\n\t\tcase <-chans.done:\n\t\t}\n\t\treturn\n\t}\n\tbe := model.BundleEntry{\n\t\tHash: putRes.Key.String(),\n\t\tNameWithPath: uploadTask.name,\n\t\tFileMode: 0, // #TODO: #35 file mode support\n\t\tSize: uint64(putRes.Written),\n\t}\n\tselect {\n\tcase chans.bundleEntry <- be:\n\tcase <-chans.done:\n\t}\n\n}", "func commitFileUpload(\n\tctx context.Context,\n\tfs *fsMutable,\n\tchans commitChans,\n\tbundleUploadWaitGroup *sync.WaitGroup,\n\tcaFs cafs.Fs,\n\tuploadTask commitUploadTask) {\n\tdefer bundleUploadWaitGroup.Done()\n\tfile, err := fs.localCache.OpenFile(getPathToBackingFile(uploadTask.inodeID),\n\t\tos.O_RDONLY|os.O_SYNC, fileDefaultMode)\n\tif err != nil {\n\t\tselect {\n\t\tcase chans.error <- err:\n\t\t\tfs.l.Error(\"Commit: backing fs open() error on file upload\",\n\t\t\t\tzap.Error(err),\n\t\t\t\tzap.String(\"filename\", uploadTask.name))\n\t\tcase <-chans.done:\n\t\t}\n\t\treturn\n\t}\n\t// written, key, keys, duplicate, err =\n\tputRes, err := caFs.Put(ctx, file)\n\tif err != nil {\n\t\tselect {\n\t\tcase chans.error <- err:\n\t\t\tfs.l.Error(\"Commit: cafs Put() error on file upload\",\n\t\t\t\tzap.Error(err),\n\t\t\t\tzap.String(\"filename\", uploadTask.name))\n\t\tcase <-chans.done:\n\t\t}\n\t\treturn\n\t}\n\tbe := model.BundleEntry{\n\t\tHash: putRes.Key.String(),\n\t\tNameWithPath: uploadTask.name,\n\t\tFileMode: 0, // #TODO: #35 file mode support\n\t\tSize: uint64(putRes.Written),\n\t}\n\tselect {\n\tcase chans.bundleEntry <- be:\n\tcase <-chans.done:\n\t}\n\n}", "func Upload(w http.ResponseWriter, r *http.Request) {\n\t// Get uploaded file\n\tr.ParseMultipartForm(32 << 20)\n\tfile, _, err := r.FormFile(\"uploadFile\")\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tdefer file.Close()\n\n\t// Get isPublic attribute\n\tIsPublicFromValue := r.FormValue(\"IsPublic\")\n\tif IsPublicFromValue == \"\" {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tIsPublic, err := strconv.ParseBool(IsPublicFromValue)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Identify who the user is\n\tusername := r.Context().Value(\"username\")\n\tif username == nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Get user bucket id\n\tbucketID, err := GetUserGUID(username.(string))\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Generate a unique ID to identify the photo object\n\tphotoID := uuid.New().String()\n\n\t// Register photo in photos table\n\tphoto := Photo{\n\t\tID: photoID,\n\t\tIsPublic: IsPublic,\n\t\tUserID: *bucketID,\n\t}\n\tDB.Create(&photo)\n\n\t// Retrieve user's bucket\n\tbkt := Client.Bucket(getBucketForPhoto(photo))\n\n\t// Verify existence of bucket\n\t// Only run in production as Google Cloud Storage emulator for local development does not support metadata retrieval\n\t// TODO: Need more robust diaster recovery\n\tif !IsDebug {\n\t\t_, err = Client.Bucket(getBucketForPhoto(photo)).Attrs(r.Context())\n\t\tif err == storage.ErrBucketNotExist {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tw.Write([]byte(\"Bucket does not exist: \" + err.Error()))\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Upload photo to bucket\n\tobj := bkt.Object(photoID)\n\tobjWriter := obj.NewWriter(r.Context())\n\tif _, err := io.Copy(objWriter, file); err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif err := objWriter.Close(); err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Write([]byte(photoID))\n\tw.WriteHeader(http.StatusOK)\n}", "func (d *gcpVolDriver) syncWithHost() error {\n\tlog.Println(\"Synchronizing: load existing volumes into driver & Google Cloud Storage\")\n\t// get existing volumes defined for the driver\n\tvolumesNames, err := d.getVolumesFromHost()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, v := range volumesNames {\n\t\tlog.Printf(\"Synchronizing: existing volume '%s' found\\n\", v)\n\t\t// create a GCStorage bucket for that volume if not exist\n\t\tbucketName, err := d.handleCreateGCStorageBucket(v)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// add this volume to the driver's in-memory map of volumes\n\t\td.mountedBuckets[v] = &gcsVolumes{\n\t\t\tvolume: &volume.Volume{\n\t\t\t\tName: v,\n\t\t\t\tMountpoint: filepath.Join(d.driverRootDir, v, \"_data\"),\n\t\t\t},\n\t\t\tgcsBucketName: bucketName,\n\t\t\tcleanCloud: true,\n\t\t}\n\t}\n\treturn nil\n}", "func (is *ImageStoreLocal) FinishBlobUpload(repo, uuid string, body io.Reader, dstDigest godigest.Digest) error {\n\tif err := dstDigest.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\tsrc := is.BlobUploadPath(repo, uuid)\n\n\t_, err := os.Stat(src)\n\tif err != nil {\n\t\tis.log.Error().Err(err).Str(\"blob\", src).Msg(\"failed to stat blob\")\n\n\t\treturn zerr.ErrUploadNotFound\n\t}\n\n\tblobFile, err := os.Open(src)\n\tif err != nil {\n\t\tis.log.Error().Err(err).Str(\"blob\", src).Msg(\"failed to open blob\")\n\n\t\treturn zerr.ErrUploadNotFound\n\t}\n\n\tdefer blobFile.Close()\n\n\tdigester := sha256.New()\n\n\t_, err = io.Copy(digester, blobFile)\n\tif err != nil {\n\t\tis.log.Error().Err(err).Str(\"repository\", repo).Str(\"blob\", src).Str(\"digest\", dstDigest.String()).\n\t\t\tMsg(\"unable to compute hash\")\n\n\t\treturn err\n\t}\n\n\tsrcDigest := godigest.NewDigestFromEncoded(godigest.SHA256, fmt.Sprintf(\"%x\", digester.Sum(nil)))\n\n\tif srcDigest != dstDigest {\n\t\tis.log.Error().Str(\"srcDigest\", srcDigest.String()).\n\t\t\tStr(\"dstDigest\", dstDigest.String()).Msg(\"actual digest not equal to expected digest\")\n\n\t\treturn zerr.ErrBadBlobDigest\n\t}\n\n\tdir := path.Join(is.rootDir, repo, \"blobs\", dstDigest.Algorithm().String())\n\n\tvar lockLatency time.Time\n\n\tis.Lock(&lockLatency)\n\tdefer is.Unlock(&lockLatency)\n\n\terr = ensureDir(dir, is.log)\n\tif err != nil {\n\t\tis.log.Error().Err(err).Msg(\"error creating blobs/sha256 dir\")\n\n\t\treturn err\n\t}\n\n\tdst := is.BlobPath(repo, dstDigest)\n\n\tif is.dedupe && fmt.Sprintf(\"%v\", is.cache) != fmt.Sprintf(\"%v\", nil) {\n\t\terr = is.DedupeBlob(src, dstDigest, dst)\n\t\tif err := inject.Error(err); err != nil {\n\t\t\tis.log.Error().Err(err).Str(\"src\", src).Str(\"dstDigest\", dstDigest.String()).\n\t\t\t\tStr(\"dst\", dst).Msg(\"unable to dedupe blob\")\n\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tif err := os.Rename(src, dst); err != nil {\n\t\t\tis.log.Error().Err(err).Str(\"src\", src).Str(\"dstDigest\", dstDigest.String()).\n\t\t\t\tStr(\"dst\", dst).Msg(\"unable to finish blob\")\n\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (gs *GistStorage) Push(localPath, remotePath string) (err error) {\n\tvar public bool = false\n\n\t// Read the encrypted data store content\n\tfileBytes, err := ioutil.ReadFile(localPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfileContent := string(fileBytes)\n\n\t// Build a Gist file store\n\tfiles := map[github.GistFilename]github.GistFile{\n\t\tgithub.GistFilename(remotePath): github.GistFile{\n\t\t\tContent: &fileContent,\n\t\t},\n\t}\n\n\t// Create a gist representation ready to be\n\t// pushed over network\n\tgist := &github.Gist{\n\t\tPublic: &public,\n\t\tFiles: files,\n\t}\n\n\t// Push the gist to github\n\t_, _, err = gs.connexion.Gists.Create(gist)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *Shipper) Sync(ctx context.Context) (uploaded int, err error) {\n\tmeta, err := ReadMetaFile(s.dir)\n\tif err != nil {\n\t\t// If we encounter any error, proceed with an empty meta file and overwrite it later.\n\t\t// The meta file is only used to avoid unnecessary bucket.Exists call,\n\t\t// which are properly handled by the system if their occur anyway.\n\t\tif !os.IsNotExist(err) {\n\t\t\tlevel.Warn(s.logger).Log(\"msg\", \"reading meta file failed, will override it\", \"err\", err)\n\t\t}\n\t\tmeta = &Meta{Version: MetaVersion1}\n\t}\n\n\t// Build a map of blocks we already uploaded.\n\thasUploaded := make(map[ulid.ULID]struct{}, len(meta.Uploaded))\n\tfor _, id := range meta.Uploaded {\n\t\thasUploaded[id] = struct{}{}\n\t}\n\n\t// Reset the uploaded slice so we can rebuild it only with blocks that still exist locally.\n\tmeta.Uploaded = nil\n\n\tvar (\n\t\tchecker = newLazyOverlapChecker(s.logger, s.bucket, s.getLabels)\n\t\tuploadErrs int\n\t)\n\n\tuploadCompacted := s.uploadCompactedFunc()\n\tmetas, err := s.blockMetasFromOldest()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tfor _, m := range metas {\n\t\t// Do not sync a block if we already uploaded or ignored it. If it's no longer found in the bucket,\n\t\t// it was generally removed by the compaction process.\n\t\tif _, uploaded := hasUploaded[m.ULID]; uploaded {\n\t\t\tmeta.Uploaded = append(meta.Uploaded, m.ULID)\n\t\t\tcontinue\n\t\t}\n\n\t\tif m.Stats.NumSamples == 0 {\n\t\t\t// Ignore empty blocks.\n\t\t\tlevel.Debug(s.logger).Log(\"msg\", \"ignoring empty block\", \"block\", m.ULID)\n\t\t\tcontinue\n\t\t}\n\n\t\t// We only ship of the first compacted block level as normal flow.\n\t\tif m.Compaction.Level > 1 {\n\t\t\tif !uploadCompacted {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\t// Check against bucket if the meta file for this block exists.\n\t\tok, err := s.bucket.Exists(ctx, path.Join(m.ULID.String(), block.MetaFilename))\n\t\tif err != nil {\n\t\t\treturn 0, errors.Wrap(err, \"check exists\")\n\t\t}\n\t\tif ok {\n\t\t\tmeta.Uploaded = append(meta.Uploaded, m.ULID)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Skip overlap check if out of order uploads is enabled.\n\t\tif m.Compaction.Level > 1 && !s.allowOutOfOrderUploads {\n\t\t\tif err := checker.IsOverlapping(ctx, m.BlockMeta); err != nil {\n\t\t\t\treturn 0, errors.Errorf(\"Found overlap or error during sync, cannot upload compacted block, details: %v\", err)\n\t\t\t}\n\t\t}\n\n\t\tif err := s.upload(ctx, m); err != nil {\n\t\t\tif !s.allowOutOfOrderUploads {\n\t\t\t\treturn 0, errors.Wrapf(err, \"upload %v\", m.ULID)\n\t\t\t}\n\n\t\t\t// No error returned, just log line. This is because we want other blocks to be uploaded even\n\t\t\t// though this one failed. It will be retried on second Sync iteration.\n\t\t\tlevel.Error(s.logger).Log(\"msg\", \"shipping failed\", \"block\", m.ULID, \"err\", err)\n\t\t\tuploadErrs++\n\t\t\tcontinue\n\t\t}\n\t\tmeta.Uploaded = append(meta.Uploaded, m.ULID)\n\t\tuploaded++\n\t\ts.metrics.uploads.Inc()\n\t}\n\tif err := WriteMetaFile(s.logger, s.dir, meta); err != nil {\n\t\tlevel.Warn(s.logger).Log(\"msg\", \"updating meta file failed\", \"err\", err)\n\t}\n\n\ts.metrics.dirSyncs.Inc()\n\tif uploadErrs > 0 {\n\t\ts.metrics.uploadFailures.Add(float64(uploadErrs))\n\t\treturn uploaded, errors.Errorf(\"failed to sync %v blocks\", uploadErrs)\n\t}\n\n\tif uploadCompacted {\n\t\ts.metrics.uploadedCompacted.Set(1)\n\t} else {\n\t\ts.metrics.uploadedCompacted.Set(0)\n\t}\n\treturn uploaded, nil\n}", "func putBucket(w http.ResponseWriter, r *http.Request) {\n\n\tpathParams := mux.Vars(r)\n\tsageBucketID := pathParams[\"bucket\"]\n\t//objectKey := pathParams[\"key\"]\n\n\tvars := mux.Vars(r)\n\tusername := vars[\"username\"]\n\n\trawQuery := r.URL.RawQuery\n\n\tif strings.Contains(rawQuery, \"permission\") {\n\t\tallowed, err := userHasBucketPermission(username, sageBucketID, \"WRITE_ACP\")\n\t\tif err != nil {\n\t\t\trespondJSONError(w, http.StatusBadRequest, err.Error())\n\t\t\treturn\n\t\t}\n\t\tif !allowed {\n\t\t\trespondJSONError(w, http.StatusUnauthorized, \"Write access to bucket permissions denied (%s, %s)\", username, sageBucketID)\n\t\t\treturn\n\t\t}\n\n\t\tbucketObject, err := GetSageBucket(sageBucketID)\n\t\tif err != nil {\n\t\t\trespondJSONError(w, http.StatusBadRequest, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tvar newPerm SAGEBucketPermission\n\n\t\terr = json.NewDecoder(r.Body).Decode(&newPerm)\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"Could not parse json: %s\", err.Error())\n\t\t\trespondJSONError(w, http.StatusBadRequest, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif bucketObject.Owner == newPerm.Grantee {\n\t\t\trespondJSONError(w, http.StatusBadRequest, \"You cannot change your own permissons.\")\n\t\t\treturn\n\t\t}\n\n\t\tif newPerm.GranteeType == \"\" {\n\t\t\trespondJSONError(w, http.StatusBadRequest, \"GranteeType missing\")\n\t\t\treturn\n\t\t}\n\n\t\tif newPerm.GranteeType == \"GROUP\" && newPerm.Grantee == \"AllUsers\" && newPerm.Permission != \"READ\" {\n\t\t\trespondJSONError(w, http.StatusBadRequest, \"Buckets can be made public only for READ access.\")\n\t\t\treturn\n\t\t}\n\n\t\t//do something\n\t\tdb, err := sql.Open(\"mysql\", mysqlDSN)\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"Unable to connect to database: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tdefer db.Close()\n\n\t\tinsertQueryStr := \"INSERT INTO BucketPermissions (id, granteeType, grantee, permission) VALUES ( UUID_TO_BIN(?), ? , ?, ?) ;\"\n\t\t_, err = db.Exec(insertQueryStr, sageBucketID, newPerm.GranteeType, newPerm.Grantee, newPerm.Permission)\n\t\tif err != nil {\n\t\t\tme, ok := err.(*mysql.MySQLError)\n\t\t\tif ok {\n\t\t\t\tif me.Number == 1062 {\n\t\t\t\t\t// entry already exists, quietly respond OK\n\t\t\t\t\trespondJSON(w, http.StatusOK, newPerm)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\terr = fmt.Errorf(\"Adding bucket permissions failed: %s\", err.Error())\n\t\t\trespondJSONError(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\trespondJSON(w, http.StatusOK, newPerm)\n\t\treturn\n\t}\n\n\trespondJSONError(w, http.StatusUnauthorized, \"Only query ?permissions supported\")\n\treturn\n\t//respondJSON(w, http.StatusOK, newBucket)\n\t//bucket fields:\n\t//metadata , name , type, (owner, change requires permission change)\n\n\t//permission\n\n}", "func (s *Syncer) Sync(localObjects []uploader.Object, saveRoot string) error {\n\tremoteObjects, err := s.uploader.ListObjects(saveRoot)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Printf(\"find %d local objects\", len(localObjects))\n\tlog.Printf(\"find %d remote objects\", len(remoteObjects))\n\tlog.Printf(\"compare the local files and the remote objects...\")\n\ts.compareObjects(localObjects, remoteObjects)\n\n\tlog.Printf(\"found %d files to be uploaded, uploading...\", len(s.tobeUploadedObjects))\n\tfor _, obj := range s.tobeUploadedObjects {\n\t\tlog.Printf(\"[%s] %s => %s\", obj.Type, obj.FilePath, obj.Key)\n\t\tif err := s.uploader.Upload(obj.Key, obj.FilePath); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlog.Printf(\"found %d files to be deleted, cleaning...\", len(s.tobeDeletedObjects))\n\tfor _, obj := range s.tobeDeletedObjects {\n\t\tlog.Printf(\"[deleted] %s\", obj.Key)\n\t\tif err := s.uploader.Delete(obj.Key); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlog.Printf(\"files sync done.\")\n\treturn nil\n}", "func (gcs *StorageConnection) StoreInBucket(ctx context.Context, fileName, url string) (err error) {\n\tvar response *http.Response\n\t//TODO add more filename validation\n\tif fileName == \"\" {\n\t\treturn fmt.Errorf(\"Filename is empty.\")\n\t}\n\t// Get HTTP response\n\tresponse, err = http.Get(url)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"HTTP response returned an error: %v\", err)\n\t}\n\tdefer response.Body.Close()\n\n\tif response.StatusCode == http.StatusOK {\n\t\tobj := gcs.bucket.Object(fileName)\n\n\t\t// w implements io.Writer.\n\t\tw := obj.NewWriter(ctx)\n\n\t\t// Copy file into storage\n\t\t_, err = io.Copy(w, response.Body)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Failed to copy %v to bucket with the error: %v\", fileName, err)\n\t\t}\n\n\t\tif err = w.Close(); err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to close storage connection: %v\", err)\n\t\t}\n\t}\n\treturn nil\n}", "func (s *TestSuite) TestPutBucket(c *C) {\n\troot, e := ioutil.TempDir(os.TempDir(), \"fs-\")\n\tc.Assert(e, IsNil)\n\tdefer os.RemoveAll(root)\n\n\tbucketPath := filepath.Join(root, \"bucket\")\n\tfsClient, err := fsNew(bucketPath)\n\tc.Assert(err, IsNil)\n\terr = fsClient.MakeBucket(\"us-east-1\", true, false)\n\tc.Assert(err, IsNil)\n}", "func syncRepo(c *gin.Context) {\n\tr := c.Param(\"repo\")\n\tif strings.Contains(r, \"not-found\") {\n\t\tmsg := fmt.Sprintf(\"Repo %s does not exist\", r)\n\n\t\tc.AbortWithStatusJSON(http.StatusNotFound, types.Error{Message: &msg})\n\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, fmt.Sprintf(\"Repo %s has been synced\", r))\n}", "func (api *bucketAPI) SyncUpdate(obj *objstore.Bucket) error {\n\tif api.ct.objResolver != nil {\n\t\tlog.Fatal(\"Cannot use Sync update when object resolver is enabled on ctkit\")\n\t}\n\tnewObj := obj\n\tvar writeErr error\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\tnewObj, writeErr = apicl.ObjstoreV1().Bucket().Update(context.Background(), obj)\n\t}\n\n\tif writeErr == nil {\n\t\tapi.ct.handleBucketEvent(&kvstore.WatchEvent{Object: newObj, Type: kvstore.Updated})\n\t}\n\n\treturn writeErr\n}", "func syncFileUp(fileMapping LocalToRemoteFileMapping, encrypt bool,\n\texistingDriveFiles map[string]*drive.File, pb *pb.ProgressBar) error {\n\tdebug.Printf(\"syncFileUp: %#v\", fileMapping.LocalFileInfo)\n\n\t// We need to create the file or folder on Google Drive.\n\tvar err error\n\n\t// Get the *drive.File for the folder to create the new file in.\n\t// This folder should definitely exist at this point, since we\n\t// create all folders needed before starting to upload files.\n\tdirPath := filepath.Dir(fileMapping.RemotePath)\n\tif dirPath == \".\" {\n\t\tdirPath = \"/\"\n\t}\n\tparentFile, ok := existingDriveFiles[dirPath]\n\tif !ok {\n\t\tparentFile, err = getDriveFile(dirPath)\n\t\tif err != nil {\n\t\t\t// We can't really recover at this point; the\n\t\t\t// parent folder definitely should have been\n\t\t\t// created by now, and we can't proceed without\n\t\t\t// it...\n\t\t\tprintErrorAndExit(fmt.Errorf(\"skicka: %v\\n\", err))\n\t\t}\n\t}\n\n\tbaseName := filepath.Base(fileMapping.RemotePath)\n\tvar driveFile *drive.File\n\n\tif fileMapping.LocalFileInfo.IsDir() {\n\t\tdriveFile, _ = createDriveFolder(baseName,\n\t\t\tfileMapping.LocalFileInfo.Mode(), fileMapping.LocalFileInfo.ModTime(), parentFile)\n\t\tatomic.AddInt64(&stats.UploadBytes, fileMapping.LocalFileInfo.Size())\n\t\tpb.Add64(fileMapping.LocalFileInfo.Size())\n\t\tverbose.Printf(\"Created Google Drive folder %s\", fileMapping.RemotePath)\n\n\t\t// We actually only update the map when we create new folders;\n\t\t// we don't update it for new files. There are two reasons\n\t\t// for this: first, once we've created a file, we don't\n\t\t// access it again during a given run of skicka.\n\t\t// Second, file upload is multi-threaded, and would require a\n\t\t// mutex to the map, which doesn't seem worth the trouble\n\t\t// given the first reason.\n\t\t//\n\t\t// Note that if the contents of Google Drive are modified in\n\t\t// another session, this map may become stale; we don't\n\t\t// explicitly look out for this and will presumably error out\n\t\t// in interesting ways if it does happen.\n\t\texistingDriveFiles[fileMapping.RemotePath] = driveFile\n\t} else {\n\t\tif driveFile, ok = existingDriveFiles[fileMapping.RemotePath]; !ok {\n\t\t\tdriveFile, err = createDriveFile(baseName, fileMapping.LocalFileInfo.Mode(),\n\t\t\t\tfileMapping.LocalFileInfo.ModTime(), encrypt, parentFile)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tvar iv []byte\n\t\tif encrypt {\n\t\t\tiv, err = getInitializationVector(driveFile)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unable to get IV: %v\\n\", err)\n\t\t\t}\n\t\t}\n\n\t\tfor ntries := 0; ntries < 5; ntries++ {\n\t\t\tvar reader io.Reader\n\t\t\tvar countingReader *ByteCountingReader\n\n\t\t\tcontentsReader, length, err :=\n\t\t\t\tgetFileContentsReaderForUpload(fileMapping.LocalPath, encrypt, iv)\n\t\t\tif contentsReader != nil {\n\t\t\t\tdefer contentsReader.Close()\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treader = contentsReader\n\n\t\t\tif pb != nil {\n\t\t\t\tcountingReader = &ByteCountingReader{\n\t\t\t\t\tR: reader,\n\t\t\t\t}\n\t\t\t\treader = io.TeeReader(countingReader, pb)\n\t\t\t}\n\n\t\t\terr = uploadFileContents(driveFile, reader, length, ntries)\n\t\t\tif err == nil {\n\t\t\t\t// Success!\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif re, ok := err.(RetryHTTPTransmitError); ok {\n\t\t\t\tdebug.Printf(\"%s: got retry http error--retrying: %s\",\n\t\t\t\t\tfileMapping.LocalPath, re.Error())\n\t\t\t\tif pb != nil {\n\t\t\t\t\t// The \"progress\" made so far on this file should be rolled back\n\t\t\t\t\tpb.Add64(int64(0 - countingReader.bytesRead))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdebug.Printf(\"%s: giving up due to error: %v\",\n\t\t\t\t\tfileMapping.LocalPath, err)\n\t\t\t\t// This file won't be uploaded, so subtract the expected progress\n\t\t\t\t// from the total expected bytes\n\t\t\t\tif pb != nil {\n\t\t\t\t\tpb.Add64(int64(0 - countingReader.bytesRead))\n\t\t\t\t\tpb.Total -= length\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tverbose.Printf(\"Updated local %s -> Google Drive %s\", fileMapping.LocalPath,\n\t\tfileMapping.RemotePath)\n\treturn updateModificationTime(driveFile, fileMapping.LocalFileInfo.ModTime())\n}", "func remoteS3(localarch string) {\n\tdefer func() {\n\t\t_ = os.Remove(localarch)\n\t}()\n\tendpoint := brf.Creds.StorageTargetEndpoint\n\taccessKeyID := \"\"\n\tsecretAccessKey := \"\"\n\tfor _, p := range brf.Creds.Params {\n\t\tif p.Key == \"AWS_ACCESS_KEY_ID\" {\n\t\t\taccessKeyID = p.Value\n\t\t}\n\t\tif p.Key == \"AWS_SECRET_ACCESS_KEY\" {\n\t\t\tsecretAccessKey = p.Value\n\t\t}\n\t}\n\tuseSSL := true\n\t_, f := filepath.Split(localarch)\n\tbucket := brf.InfraService + \"-backup-\" + strings.TrimSuffix(f, filepath.Ext(f))\n\tobject := \"latest.zip\"\n\tctype := \"application/zip\"\n\n\tlog.WithFields(log.Fields{\"func\": \"remoteS3\"}).Info(fmt.Sprintf(\"Trying to back up to %s/%s in S3 compatible remote storage\", bucket, object))\n\tif mc, err := minio.New(endpoint, accessKeyID, secretAccessKey, useSSL); err != nil {\n\t\tlog.WithFields(log.Fields{\"func\": \"remoteS3\"}).Fatal(fmt.Sprintf(\"%s \", err))\n\t} else {\n\t\tlocation := \"us-east-1\"\n\t\tif err = mc.MakeBucket(bucket, location); err != nil {\n\t\t\texists, err := mc.BucketExists(bucket)\n\t\t\tif err == nil && exists {\n\t\t\t\tlog.WithFields(log.Fields{\"func\": \"remoteS3\"}).Info(fmt.Sprintf(\"Bucket %s already exists\", bucket))\n\t\t\t} else {\n\t\t\t\tlog.WithFields(log.Fields{\"func\": \"remoteS3\"}).Fatal(fmt.Sprintf(\"%s\", err))\n\t\t\t}\n\t\t}\n\t\tif nbytes, err := mc.FPutObject(bucket, object, localarch, ctype); err != nil {\n\t\t\tlog.WithFields(log.Fields{\"func\": \"remoteS3\"}).Fatal(fmt.Sprintf(\"%s\", err))\n\t\t} else {\n\t\t\tlog.WithFields(log.Fields{\"func\": \"remoteS3\"}).Info(fmt.Sprintf(\"Successfully stored %s/%s (%d Bytes) in S3 compatible remote storage %s\", bucket, object, nbytes, endpoint))\n\t\t}\n\t}\n}", "func syncLocalAssets(cr command.Runner) error {\n\tfs, err := localAssets()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, f := range fs {\n\t\terr := cr.Copy(f)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (gcs *gcsPhotos) uploadPhotos() []string {\n ext := \".jpg\"\n subDir := \"photos/\"\n testPhotos := []string{ \"0\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\"}\n\t \n for _, name := range testPhotos {\n ffile := subDir + name + ext\n srcFile, fName, err := gcs.read(ffile)\n if err != nil {\n log.Errorf(gcs.ctx, \"Open / read file error %v\", err)\n return nil\n }\n fName = fName + ext\n gcs.write(fName, srcFile)\n log.Infof(gcs.ctx, \"In File: %s, Out File: %s\\n\", ffile, fName)\n }\n\t return gcs.retrievePhotos()\n}", "func uploadConcurrent(localPath string, bucket string) {\n\n\tconst maxWorkers = 5\n\n\t// helper function to allocate int64 and\n\t// initialize it in one function call\n\tvar newInt64 = func(init int64) *int64 {\n\t\tval := new(int64)\n\t\t*val = init\n\t\treturn val\n\t}\n\n\tvar partNumber int64 = 1 // part number must start from 1 according to AWS SDK\n\tvar totalBytes int64\n\n\tkeyName := filepath.Base(localPath) // extract file name from the path and consider it as key name\n\n\ts, err := session.NewSession()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\ts3client := s3.New(s)\n\n\tmpuInput := &s3.CreateMultipartUploadInput{\n\t\tBucket: aws.String(bucket),\n\t\tKey: aws.String(keyName),\n\t}\n\n\t// initiate multipart upload\n\tmpu, err := s3client.CreateMultipartUpload(mpuInput)\n\tif err != nil {\n\t\tprintAwsError(err)\n\t\tpanic(err)\n\t}\n\n\tfile, err := os.Open(localPath)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer file.Close()\n\n\t// etags will store multipart upload Etag values\n\t// for proper completion of multipart upload\n\tetags := make([]*s3.CompletedPart, 0)\n\n\tetagschan := make(chan *s3.CompletedPart)\n\tworkersCtrl := make(chan struct{}, maxWorkers)\n\tendRead := make(chan struct{})\n\tendUpload := make(chan struct{})\n\n\tgo func() {\n\t\tvar cleanup = func() {\n\t\t\tclose(workersCtrl)\n\t\t\tclose(etagschan)\n\t\t\tclose(endRead)\n\t\t\tclose(endUpload)\n\t\t}\n\t\tdefer cleanup()\n\t\tdone := false\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase etag := <-etagschan:\n\t\t\t\tetags = append(etags, etag)\n\t\t\t\t<-workersCtrl\n\t\t\t\tif done && len(workersCtrl) == 0 {\n\t\t\t\t\tgoto End\n\t\t\t\t}\n\t\t\tcase <-endRead:\n\t\t\t\tdone = true\n\t\t\t\tif len(workersCtrl) == 0 {\n\t\t\t\t\tgoto End\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tEnd:\n\t\tendUpload <- struct{}{}\n\t}()\n\n\tfmt.Println(\"Uploading...\")\n\tfor {\n\t\tbuf := make([]byte, 1024 * 1024 * (*c))\n\t\tbytesRead, err := file.Read(buf)\n\t\tif err == io.EOF {\n\t\t\t// io.EOF always returns bytesRead = 0 so we are safe to break\n\t\t\tendRead <- struct{}{}\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\t// increment workers count toward max\n\t\tworkersCtrl <- struct{}{}\n\n\t\tgo func(buf []byte, pn int64) {\n\t\t\tbufReader := bytes.NewReader(buf)\n\t\t\tinput := &s3.UploadPartInput{\n\t\t\t\tBody: bufReader,\n\t\t\t\tBucket: aws.String(bucket),\n\t\t\t\tKey: aws.String(keyName),\n\t\t\t\tPartNumber: aws.Int64(pn),\n\t\t\t\tUploadId: mpu.UploadId,\n\t\t\t}\n\t\t\tresult, err := s3client.UploadPart(input)\n\t\t\tif err != nil {\n\t\t\t\tprintAwsError(err)\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tetagschan <- &s3.CompletedPart{ ETag:result.ETag, PartNumber: newInt64(pn) }\n\t\t\ttotalBytes += bufReader.Size()\n\t\t}(buf[0:bytesRead], partNumber) // bytes read, not buffer size\n\n\t\tpartNumber++\n\t}\n\n\t<-endUpload\n\n\tsort.Slice(etags, func(i, j int) bool {\n\t\treturn *etags[i].PartNumber < *etags[j].PartNumber\n\t})\n\n\tcmpuInput := &s3.CompleteMultipartUploadInput{\n\t\tBucket: aws.String(bucket),\n\t\tKey: aws.String(keyName),\n\t\tMultipartUpload: &s3.CompletedMultipartUpload{\n\t\t\tParts: etags,\n\t\t},\n\t\tUploadId: mpu.UploadId,\n\t}\n\n\tresult, err := s3client.CompleteMultipartUpload(cmpuInput)\n\tif err != nil {\n\t\tprintAwsError(err)\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"Successfully uploaded object\", *result.Key, \"to bucket. Etag:\", *result.Bucket, *result.ETag)\n}", "func SyncPublicS3Files(awsSession *session.Session, staticS3Bucket, staticS3Prefix, staticDir string, metadatas ...Metadata) error {\n\tuploader := s3manager.NewUploader(awsSession)\n\n\t// Set the default cache-control, users can override this value with a Metadata arg.\n\tmetadata := map[string]*string{\n\t\t\"Cache-Control\": aws.String(\"max-age=604800\"),\n\t}\n\tfor _, kv := range metadatas {\n\t\tmetadata[kv.Key] = aws.String(kv.Value)\n\t}\n\n\tdi, err := NewDirectoryIterator(staticS3Bucket, staticS3Prefix, staticDir, \"public-read\", metadata)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = uploader.UploadWithIterator(aws.BackgroundContext(), di)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func upload(bucket, file string, config *s3util.Config) error {\n\t// open the local file to upload\n\tlocalFile, err := os.Open(file)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer localFile.Close()\n\n\theaders := http.Header{}\n\theaders.Add(\"x-amz-acl\", \"private\")\n\ts3File, err := s3util.Create(generateS3Url(bucket, filepath.Base(file)), headers, config)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer s3File.Close()\n\n\t// copy the file\n\t_, err = io.Copy(s3File, localFile)\n\treturn err\n}", "func (s *Storage) Push(request *openapi.BackupRequest, filename string) error {\n\tfor _, v := range request.Envs {\n\t\tos.Setenv(v.Name, v.Value)\n\t}\n\tctx := context.Background()\n\tclient, err := getClient(ctx)\n\tif err != nil {\n\t\tlog.Printf(\"Error push/gcp %s to %s:%s, error: %v\", filename, request.Bucket, request.Location, err)\n\t\treturn fmt.Errorf(\"Cannot get Client: %v\", err)\n\t}\n\tdefer client.Close()\n\n\t// Open local file.\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\tlog.Printf(\"Error push/opening %s to %s:%s, error: %v\", filename, request.Bucket, request.Location, err)\n\t\treturn fmt.Errorf(\"os.Open: %v\", err)\n\t}\n\tdefer f.Close()\n\n\tctx, cancel := context.WithTimeout(ctx, time.Second*60)\n\tdefer cancel()\n\tlocation := request.Location\n\tif request.Location[0:1] == \"/\" {\n\t\tlocation = request.Location[1:]\n\t}\n\twc := client.Bucket(request.Bucket).Object(location).NewWriter(ctx)\n\tif _, err = io.Copy(wc, f); err != nil {\n\t\tlog.Printf(\"Error push/writer %s to %s:%s, error: %v\", filename, request.Bucket, request.Location, err)\n\t\treturn fmt.Errorf(\"io.Copy: %v\", err)\n\t}\n\tif err := wc.Close(); err != nil {\n\t\tlog.Printf(\"Error push/close %s to %s:%s, error: %v\", filename, request.Bucket, request.Location, err)\n\t\treturn fmt.Errorf(\"Writer.Close: %v\", err)\n\t}\n\tlog.Printf(\"Pushing %s to %s:%s, succeeded\", filename, request.Bucket, request.Location)\n\treturn nil\n}", "func (api *bucketAPI) SyncDelete(obj *objstore.Bucket) error {\n\tvar writeErr error\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\t_, writeErr = apicl.ObjstoreV1().Bucket().Delete(context.Background(), &obj.ObjectMeta)\n\t}\n\n\tif writeErr == nil {\n\t\tapi.ct.handleBucketEvent(&kvstore.WatchEvent{Object: obj, Type: kvstore.Deleted})\n\t}\n\n\treturn writeErr\n}", "func (m *minioServer) putter(ctx context.Context, bucket, object, fpath string, overwrite bool) error {\n\tif err := m.ensureBucketExists(ctx, bucket); err != nil {\n\t\treturn fmt.Errorf(\"unable to validate %s bucket exists: %w\", bucket, err)\n\t}\n\tfi, err := os.Stat(fpath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl := log.WithFields(log.Fields{\n\t\t\"bucket\": bucket,\n\t\t\"creator\": myHostName,\n\t\t\"from\": fpath,\n\t\t\"func\": \"putter\",\n\t\t\"object\": object,\n\t\t\"overwrite\": overwrite,\n\t\t\"size\": fmt.Sprintf(\"%d\", fi.Size()),\n\t})\n\n\tfo, err := os.Open(fpath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tl.Info(\"Calculating SHA256 for upload consideration\")\n\tsha256, err := calcSha256(fo)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.WithField(\"sha256\", sha256).Infof(\"Calculated SHA256\")\n\n\tmC, err := m.client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts, err := mC.StatObject(ctx, bucket, object, minio.GetObjectOptions{})\n\tif err == nil {\n\t\trSHA, ok := s.UserMetadata[\"X-Amz-Meta-Sha256\"]\n\t\tif ok {\n\t\t\tif rSHA == sha256 && fi.Size() == s.Size {\n\t\t\t\tl.Infof(\"Exact version has already been uploaded, skipping\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tl.WithFields(log.Fields{\n\t\t\t\t\"remote sha\": rSHA,\n\t\t\t\t\"remote size\": s.Size,\n\t\t\t}).Info(\"Replacing remove version\")\n\t\t}\n\n\t\tif !overwrite {\n\t\t\tl.Warning(\"Skipping overwrite of file; overwrite set to false for the this file\")\n\t\t}\n\t}\n\n\tl.WithField(\"sha256\", sha256).Info(\"Starting Upload\")\n\ti, err := mC.FPutObject(ctx, bucket, object, fpath,\n\t\tminio.PutObjectOptions{\n\t\t\t// When uploaded, user-metadata will be X-Amz-Meta-<key>\n\t\t\tUserMetadata: map[string]string{\n\t\t\t\t\"creator\": myHostName,\n\t\t\t\t\"sha256\": sha256,\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to upload to %s/%s: %w\", bucket, object, err)\n\t}\n\tl.WithFields(log.Fields{\n\t\t\"etag\": i.ETag,\n\t\t\"remote size\": i.Size,\n\t}).Info(\"Uploaded\")\n\n\treturn nil\n}", "func (g *gcs) Upload(ctx context.Context, localPath string, remotePath string) (err error) {\n\tgcsObject := g.bucket.Object(remotePath)\n\tgcsWriter := gcsObject.NewWriter(g.context)\n\n\tsourceFile, err := os.Open(localPath)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer sourceFile.Close()\n\n\tif _, err = io.Copy(gcsWriter, sourceFile); err != nil {\n\t\treturn\n\t}\n\n\tif err = gcsWriter.Close(); err != nil {\n\t\tgcsObject.Delete(g.context)\n\t\treturn\n\t}\n\n\tif err = gcsObject.ACL().Set(g.context, storage.AllUsers, storage.RoleReader); err != nil {\n\t\tgcsObject.Delete(g.context)\n\t\treturn\n\t}\n\n\treturn\n}", "func cleanBucket(ctx context.Context, bkt *storage.BucketHandle, mod, ver string) error {\n\tif err := bkt.Object(config.PackageVersionedName(mod, ver, \"mod\")).Delete(ctx); err != nil {\n\t\treturn err\n\t}\n\tif err := bkt.Object(config.PackageVersionedName(mod, ver, \"info\")).Delete(ctx); err != nil {\n\t\treturn err\n\t}\n\tif err := bkt.Object(config.PackageVersionedName(mod, ver, \"zip\")).Delete(ctx); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (w *streamedBlockWriter) syncDir() (err error) {\n\tdf, err := fileutil.OpenDir(w.blockDir)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"open temporary block blockDir\")\n\t}\n\n\tdefer runutil.CloseWithErrCapture(&err, df, \"close temporary block blockDir\")\n\n\tif err := fileutil.Fdatasync(df); err != nil {\n\t\treturn errors.Wrap(err, \"sync temporary blockDir\")\n\t}\n\n\treturn nil\n}", "func (is *ObjectStorage) FinishBlobUpload(repo, uuid string, body io.Reader, dstDigest godigest.Digest) error {\n\tif err := dstDigest.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\tsrc := is.BlobUploadPath(repo, uuid)\n\n\t// complete multiUploadPart\n\tfileWriter, err := is.store.Writer(context.Background(), src, true)\n\tif err != nil {\n\t\tis.log.Error().Err(err).Str(\"blob\", src).Msg(\"failed to open blob\")\n\n\t\treturn zerr.ErrBadBlobDigest\n\t}\n\n\tif err := fileWriter.Commit(); err != nil {\n\t\tis.log.Error().Err(err).Msg(\"failed to commit file\")\n\n\t\treturn err\n\t}\n\n\tif err := fileWriter.Close(); err != nil {\n\t\tis.log.Error().Err(err).Msg(\"failed to close file\")\n\n\t\treturn err\n\t}\n\n\tfileReader, err := is.store.Reader(context.Background(), src, 0)\n\tif err != nil {\n\t\tis.log.Error().Err(err).Str(\"blob\", src).Msg(\"failed to open file\")\n\n\t\treturn zerr.ErrUploadNotFound\n\t}\n\n\tdefer fileReader.Close()\n\n\tsrcDigest, err := godigest.FromReader(fileReader)\n\tif err != nil {\n\t\tis.log.Error().Err(err).Str(\"blob\", src).Msg(\"failed to open blob\")\n\n\t\treturn zerr.ErrBadBlobDigest\n\t}\n\n\tif srcDigest != dstDigest {\n\t\tis.log.Error().Str(\"srcDigest\", srcDigest.String()).\n\t\t\tStr(\"dstDigest\", dstDigest.String()).Msg(\"actual digest not equal to expected digest\")\n\n\t\treturn zerr.ErrBadBlobDigest\n\t}\n\n\tdst := is.BlobPath(repo, dstDigest)\n\n\tvar lockLatency time.Time\n\n\tis.Lock(&lockLatency)\n\tdefer is.Unlock(&lockLatency)\n\n\tif is.dedupe && fmt.Sprintf(\"%v\", is.cache) != fmt.Sprintf(\"%v\", nil) {\n\t\tif err := is.DedupeBlob(src, dstDigest, dst); err != nil {\n\t\t\tis.log.Error().Err(err).Str(\"src\", src).Str(\"dstDigest\", dstDigest.String()).\n\t\t\t\tStr(\"dst\", dst).Msg(\"unable to dedupe blob\")\n\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tif err := is.store.Move(context.Background(), src, dst); err != nil {\n\t\t\tis.log.Error().Err(err).Str(\"src\", src).Str(\"dstDigest\", dstDigest.String()).\n\t\t\t\tStr(\"dst\", dst).Msg(\"unable to finish blob\")\n\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func uploadToS3(data urlbox.ShotData) (s3Link string) {\n\tif data.URL != \"\" && data.Width > 0 && data.Height > 0 {\n\t\tawsSecret := os.Getenv(\"SNAPMAKER_AWS_ACCESS_SECRET\")\n\t\tawsKey := os.Getenv(\"SNAPMAKER_AWS_ACCESS_KEY\")\n\n\t\tif awsSecret == \"\" || awsKey == \"\" {\n\t\t\tlog.Fatal(\"[!]invalid AWS credentials\")\n\t\t}\n\t\tauth, _ := aws.GetAuth(awsKey, awsSecret)\n\t\tclient := s3.New(auth, aws.USEast)\n\n\t\tsnapBucket := client.Bucket(BUCKETNAME)\n\n\t\tfileName := urlbox.GetFileName(data)\n\t\tbytes, filetype := getFile(fileName)\n\t\tsnapBucket.Put(fileName, bytes, filetype, s3.PublicRead)\n\t\ts3Link = snapBucket.URL(fileName)\n\t\tos.Remove(fileName)\n\t}\n\treturn\n}", "func (mb *metadataBackend) sync() error {\n\treturn mb.db.Sync()\n}", "func (b *Bucket) Upload(_ context.Context, name string, r io.Reader) error {\n\tsize, err := objstore.TryToGetSize(r)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"getting size of %s\", name)\n\t}\n\n\tpartNums, lastSlice := int(math.Floor(float64(size)/partSize)), size%partSize\n\tif partNums == 0 {\n\t\tbody, err := bce.NewBodyFromSizedReader(r, lastSlice)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to create SizedReader for %s\", name)\n\t\t}\n\n\t\tif _, err := b.client.PutObject(b.name, name, body, nil); err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to upload %s\", name)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tresult, err := b.client.BasicInitiateMultipartUpload(b.name, name)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to initiate MultipartUpload for %s\", name)\n\t}\n\n\tuploadEveryPart := func(partSize int64, part int, uploadId string) (string, error) {\n\t\tbody, err := bce.NewBodyFromSizedReader(r, partSize)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tetag, err := b.client.UploadPart(b.name, name, uploadId, part, body, nil)\n\t\tif err != nil {\n\t\t\tif err := b.client.AbortMultipartUpload(b.name, name, uploadId); err != nil {\n\t\t\t\treturn etag, err\n\t\t\t}\n\t\t\treturn etag, err\n\t\t}\n\t\treturn etag, nil\n\t}\n\n\tvar parts []api.UploadInfoType\n\n\tfor part := 1; part <= partNums; part++ {\n\t\tetag, err := uploadEveryPart(partSize, part, result.UploadId)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to upload part %d for %s\", part, name)\n\t\t}\n\t\tparts = append(parts, api.UploadInfoType{PartNumber: part, ETag: etag})\n\t}\n\n\tif lastSlice != 0 {\n\t\tetag, err := uploadEveryPart(lastSlice, partNums+1, result.UploadId)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to upload the last part for %s\", name)\n\t\t}\n\t\tparts = append(parts, api.UploadInfoType{PartNumber: partNums + 1, ETag: etag})\n\t}\n\n\tif _, err := b.client.CompleteMultipartUploadFromStruct(b.name, name, result.UploadId, &api.CompleteMultipartUploadArgs{Parts: parts}); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to set %s upload completed\", name)\n\t}\n\treturn nil\n}", "func (instance *Storage) Sync() error {\n\tif dirty {\n\t\tif err := writeToFile(); err != nil {\n\t\t\treturn err\n\t\t} else {\n\t\t\tdirty = false\n\t\t}\n\t}\n\treturn nil\n}", "func SuggestBucket(method, bucket, kind string) (string, error) {\n\tif method == DirectUploadMethod {\n\t\treturn \"\", nil\n\t}\n\tif bucket == \"\" {\n\t\tb, err := gql.SuggestedBucket(kind, method)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn b, nil\n\t}\n\n\tb, buckets, err := gql.QueryBucket(kind, method, bucket)\n\tif err != nil {\n\t\te := fmt.Sprintf(\"Valid buckets are: %q. Your input: %q\\n\", buckets, bucket)\n\t\treturn \"\", errors.New(e)\n\t}\n\treturn b, nil\n}", "func (gcs *GSCClient) Upload(b []byte, bucket, fileName string) (string, error) {\n\tr := bytes.NewReader(b)\n\tctx, cancel := context.WithTimeout(context.Background(), timeout)\n\tdefer cancel()\n\twc := gcs.client.Bucket(bucket).Object(fileName).NewWriter(ctx)\n\tif _, err := io.Copy(wc, r); err != nil {\n\t\treturn \"\", fmt.Errorf(\"falha ao copiar conteúdo de arquivo local para o bucket no GCS (%s/%s), erro %q\", bucket, fileName, err)\n\t}\n\tif err := wc.Close(); err != nil {\n\t\treturn \"\", fmt.Errorf(\"falha ao fechar storate.Writter object (%s/%s), erro %q\", bucket, fileName, err)\n\t}\n\treturn fmt.Sprintf(\"%s/%s\", bucket, fileName), nil\n}", "func DeployBucket(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Bucket, error) {\n\tparsed, err := abi.JSON(strings.NewReader(BucketABI))\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\taddress, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(BucketBin), backend)\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\treturn address, tx, &Bucket{BucketCaller: BucketCaller{contract: contract}, BucketTransactor: BucketTransactor{contract: contract}, BucketFilterer: BucketFilterer{contract: contract}}, nil\n}", "func putObject(ctx *context, onDisk string, uploadKey string) error {\n\t// Setup\n\tsess := session.Must(session.NewSession())\n\t// Ex: $HOME/temp/blast/db/README\n\tlog.Print(\"File upload. Source: \" + onDisk)\n\tlocal, err := ctx.os.Open(onDisk)\n\tif err != nil {\n\t\treturn handle(\"Error in opening file on disk.\", err)\n\t}\n\tdefer func() {\n\t\tif err = local.Close(); err != nil {\n\t\t\terrOut(\"Error in closing local file\", err)\n\t\t}\n\t}()\n\n\t// Upload to S3\n\tuploader := s3manager.NewUploader(sess)\n\toutput, err := uploader.Upload(&s3manager.UploadInput{\n\t\tBody: local,\n\t\tBucket: aws.String(ctx.bucket),\n\t\tKey: aws.String(uploadKey),\n\t})\n\tawsOutput(fmt.Sprintf(\"%#v\", output))\n\tif err != nil && !strings.Contains(err.Error(),\n\t\t\"IllegalLocationConstraintException\") {\n\t\treturn handle(fmt.Sprintf(\"Error in file upload of %s to S3.\", onDisk), err)\n\t}\n\n\t// Remove file locally after upload finished\n\tif err = ctx.os.Remove(onDisk); err != nil {\n\t\treturn handle(\"Error in deleting temporary file on local disk.\", err)\n\t}\n\treturn err\n}", "func (s *storageClient) upload(ctx context.Context, r io.Reader, objectName string) error {\n\tw := s.client.Bucket(s.bucketName).Object(objectName).NewWriter(ctx)\n\tif _, err := io.Copy(w, r); err != nil {\n\t\treturn fmt.Errorf(\"error while uploading to GCS object %q: %w\", objectName, err)\n\t}\n\t// The actual upload might happen after Close is called so we need to capture any errors.\n\tif err := w.Close(); err != nil {\n\t\treturn fmt.Errorf(\"error finishing upload to GCS object %q: %w\", objectName, err)\n\t}\n\treturn nil\n}", "func (api *bucketAPI) SyncCreate(obj *objstore.Bucket) error {\n\tnewObj := obj\n\tevtType := kvstore.Created\n\tvar writeErr error\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\tnewObj, writeErr = apicl.ObjstoreV1().Bucket().Create(context.Background(), obj)\n\t\tif writeErr != nil && strings.Contains(writeErr.Error(), \"AlreadyExists\") {\n\t\t\tnewObj, writeErr = apicl.ObjstoreV1().Bucket().Update(context.Background(), obj)\n\t\t\tevtType = kvstore.Updated\n\t\t}\n\t}\n\n\tif writeErr == nil {\n\t\tapi.ct.handleBucketEvent(&kvstore.WatchEvent{Object: newObj, Type: evtType})\n\t}\n\treturn writeErr\n}", "func uploadBlob(registry, name string) (string, error) {\n\tfile, err := makeLayer()\n\tif err != nil {\n\t\tfmt.Printf(\"makeLayer Error\\n\")\n\t\treturn \"\", err\n\t}\n\tdefer os.Remove(file.Name())\n\n\thasher := sha256.New()\n\tif _, err := io.Copy(hasher, file); err != nil {\n\t\treturn \"\", err\n\t}\n\tdigest := fmt.Sprintf(\"%x\", hasher.Sum(nil))\n\tfileLength, err := file.Seek(0, os.SEEK_CUR)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif _, err := file.Seek(0, os.SEEK_SET); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tuploadURL := fmt.Sprintf(\"%s/v2/%s/blobs/uploads/?digest=sha256:%s\", registry, name, digest)\n\treq, err := http.NewRequest(http.MethodPost, uploadURL, file)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treq.Close = true\n\treq.Header.Set(\"Content-Length\", fmt.Sprintf(\"%d\", fileLength))\n\treq.Header.Set(\"Content-Type\", \"application/octet-stream\")\n\tresp, err := http.DefaultClient.Do(req)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tfor resp.StatusCode == http.StatusAccepted {\n\t\tdefer resp.Body.Close()\n\t\t_, err := ioutil.ReadAll(resp.Body)\n\n\t\tfmt.Printf(\"Got `%s` even though we wanted one-stop upload, retrying\\n\", resp.Status)\n\t\t// The last upload closed the file; reopen it\n\t\tfile, err = os.Open(file.Name())\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tnewURL, err := url.Parse(resp.Header.Get(\"Location\"))\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tquery := newURL.Query()\n\t\tquery.Add(\"digest\", \"sha256:\"+digest)\n\t\tnewURL.RawQuery = query.Encode()\n\t\tnewreq, err := http.NewRequest(http.MethodPut, newURL.String(), file)\n\t\t// The last argument is the request body to upload.\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tnewreq.Close = true\n\t\tnewreq.Header.Set(\"Content-Length\", fmt.Sprintf(\"%d\", fileLength))\n\t\tnewreq.Header.Set(\"Content-Type\", \"application/octet-stream\")\n\n\t\tnewresp, err := http.DefaultClient.Do(newreq)\n\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tresp = newresp\n\t}\n\n\tswitch resp.StatusCode {\n\tcase http.StatusCreated:\n\t\tbreak\n\tcase http.StatusAccepted:\n\t\tpanic(\"Got status accepted outside loop\")\n\tcase http.StatusBadRequest, http.StatusMethodNotAllowed, http.StatusForbidden, http.StatusNotFound:\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"Error uploading: %s: %s\", resp.Status, string(body))\n\tcase http.StatusUnauthorized:\n\t\treturn \"\", fmt.Errorf(\"Error uploading: unauthorized\")\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"Error uploading: unknown status %s\", resp.Status)\n\t}\n\n\treturn digest, nil\n}", "func (s *Server) upload(info string) {\n\t// rsync -av -e 'ssh -o \"ProxyCommand ssh -p port bastion-dev@proxy exec nc %h %p 2>/dev/null\"' test.txt app@target:~/\n\t// rsync -avrP -e 'ssh -o ProxyCommand=\"ssh -W %h:%p bastion-dev@proxy -p port\"' test.txt app@target:~/\n\tssh := fmt.Sprintf(`ssh -o StrictHostKeyChecking=no -l %s -p %s`, s.User, strings.TrimLeft(s.Port, \":\"))\n\tif s.Proxy != nil {\n\t\tssh = fmt.Sprintf(`ssh -o StrictHostKeyChecking=no -o ProxyCommand=\"ssh -W %%h:%%p %s@%s -p %s\"`, s.Proxy.User, s.Proxy.Host, strings.TrimLeft(s.Proxy.Port, \":\"))\n\t}\n\n\tappName := cfg.App.Name\n\tdst := fmt.Sprintf(\"%s@%s:%s/harp/%s/\", s.User, s.Host, s.Home, appName)\n\t// if option.debug {\n\t// \tfmt.Println(\"rsync\", \"-az\", \"--delete\", \"-e\", ssh, filepath.Join(tmpDir, appName), filepath.Join(tmpDir, \"files\"), dst)\n\t// }\n\targs := []string{\"-az\", \"--delete\", \"-e\", ssh}\n\tif option.debug {\n\t\targs = append(args, \"-P\")\n\t}\n\tif !option.noBuild {\n\t\targs = append(args, filepath.Join(tmpDir, appName))\n\t}\n\tif !option.noFiles {\n\t\targs = append(args, filepath.Join(tmpDir, \"files\"))\n\t}\n\tif option.debug {\n\t\tfmt.Println(\"upload cmd:\", strings.Join(append([]string{\"rsync\"}, append(args, dst)...), \" \"))\n\t}\n\tcmd := exec.Command(\"rsync\", append(args, dst)...)\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\terr := cmd.Run()\n\tif err != nil {\n\t\ts.exitf(\"failed to sync binary %s: %s\", appName, err)\n\t}\n\n\tsession := s.getSession()\n\toutput, err := session.CombinedOutput(fmt.Sprintf(\"cat <<EOF > %s/harp/%s/harp-build.info\\n%s\\nEOF\", s.Home, appName, info))\n\tif err != nil {\n\t\ts.exitf(\"failed to save build info: %s: %s\", err, string(output))\n\t}\n\tsession.Close()\n}", "func (b *OSSBackend) Upload(blobID string, blobPath string) error {\n\tblobID = b.objectPrefix + blobID\n\tif exist, err := b.bucket.IsObjectExist(blobID); err != nil {\n\t\treturn err\n\t} else if exist {\n\t\treturn nil\n\t}\n\n\tvar stat os.FileInfo\n\tstat, err := os.Stat(blobPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tblobSize := stat.Size()\n\n\tvar needMultiparts bool = false\n\t// Blob size bigger than 100MB, apply multiparts upload.\n\tif blobSize >= multipartsUploadThreshold {\n\t\tneedMultiparts = true\n\t}\n\n\tstart := time.Now()\n\n\tif needMultiparts {\n\t\tlogrus.Debugf(\"Upload %s using multiparts method\", blobID)\n\t\tchunks, err := oss.SplitFileByPartNum(blobPath, splitPartsCount)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\timur, err := b.bucket.InitiateMultipartUpload(blobID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvar parts []oss.UploadPart\n\n\t\tg := new(errgroup.Group)\n\t\tfor _, chunk := range chunks {\n\t\t\tck := chunk\n\t\t\tg.Go(func() error {\n\t\t\t\tp, err := b.bucket.UploadPartFromFile(imur, blobPath, ck.Offset, ck.Size, ck.Number)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\t// TODO: We don't verify data part MD5 from ETag right now.\n\t\t\t\t// But we can do it if we have to.\n\t\t\t\tparts = append(parts, p)\n\t\t\t\treturn nil\n\t\t\t})\n\t\t}\n\n\t\tif err := g.Wait(); err != nil {\n\t\t\treturn errors.Wrap(err, \"Uploading parts failed\")\n\t\t}\n\n\t\t_, err = b.bucket.CompleteMultipartUpload(imur, parts)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\treader, err := os.Open(blobPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer reader.Close()\n\t\terr = b.bucket.PutObject(blobID, reader)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tend := time.Now()\n\telapsed := end.Sub(start)\n\tlogrus.Debugf(\"Uploading blob %s costs %s\", blobID, elapsed)\n\n\treturn err\n}", "func PutCopySyncer(src, dst *s3.Bucket, key s3.Key) error {\n\t_, err := dst.PutCopy(key.Key, s3.Private, s3.CopyOptions{}, src.Name+\"/\"+key.Key)\n\treturn err\n}", "func InitDBBucket() {\n\tdb.Update(func(tx *bolt.Tx) error {\n\t\t_, err := tx.CreateBucketIfNotExists([]byte(DefaultBucket))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\treturn nil\n\t})\n}", "func (b *Bucket) Upload(_ context.Context, name string, r io.Reader) error {\n\tbody, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\tb.objects[name] = body\n\treturn nil\n}", "func (c *runningConfig) magicPut(remote, local string) error {\n\t// open the file to be transferred\n\tfile, err := os.Open(local)\n\tdefer file.Close()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error loading local file %s - %v\", local, err)\n\t}\n\n\tbytes := make([]byte, chunkSize)\n\tbuffer := bufio.NewReader(file)\n\t// at most, buffer.Read can only read len(bytes) bytes\n\t_, err = buffer.Read(bytes)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error reading from local file %s - %v\", local, err)\n\t}\n\n\t// determine the filetype based on the bytes you read\n\tfiletype := http.DetectContentType(bytes)\n\t_, err = file.Seek(0, 0)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error resetting local file %s - %v\", local, err)\n\t}\n\n\t// set up for multipart upload\n\tmultiUploader, err := c.bucket.InitMulti(remote, filetype, s3.ACL(\"private\"))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error opening remote file %s - %v\", remote, err)\n\t}\n\n\t// upload all of the file in pieces\n\tparts, err := multiUploader.PutAll(file, chunkSize)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error writing to remote file %s - %v\", local, err)\n\t}\n\n\t// complete the file\n\terr = multiUploader.Complete(parts)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error completing file %s - %v\", remote, err)\n\t}\n\n\treturn nil\n}", "func initializeBucket() {\n\tclient := getClient()\n\tparams := &s3.GetBucketLocationInput{\n\t\tBucket: aws.String(S3_BUCKET_NAME), // Required\n\t}\n\t_, err := client.GetBucketLocation(params)\n\tif err != nil {\n\t\t// bucket does not exist\n\t\tparams := &s3.CreateBucketInput{\n\t\t\tBucket: aws.String(S3_BUCKET_NAME), // Required\n\t\t}\n\t\t_, err := client.CreateBucket(params)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Attempted to create bucket with name \" + S3_BUCKET_NAME + \", but failed.\")\n\t\t\tfmt.Println(\"Error was: \" + err.Error())\n\t\t\tos.Exit(2)\n\t\t}\n\t\t// fmt.Println(\"created new bucket with name: \" + S3_BUCKET_NAME)\n\t}\n}", "func UploadToGCloudStorage(bucket, filePath, fileName string, isPublic bool) (string, error) {\n\tfile, err := os.Open(filePath)\n\tif err != nil {\n\t\tlogrus.Error(\"[UploadToGCloudStorage] Open file error: \", err)\n\t\treturn \"\", err\n\t}\n\n\tdefer func() {\n\t\terr = file.Close()\n\t}()\n\n\tobj := client.Bucket(bucket).Object(fileName)\n\twriter := obj.NewWriter(ctx)\n\tif _, err = io.Copy(writer, file); err != nil {\n\t\tlogrus.Error(\"[UploadToGCloudStorage] Copy file error: \", err)\n\t\treturn \"\", err\n\t}\n\n\tif err = writer.Close(); err != nil {\n\t\tlogrus.Error(\"[UploadToGCloudStorage] close writer error: \", err)\n\t\treturn \"\", err\n\t}\n\n\tif isPublic {\n\t\tacl := client.Bucket(bucket).Object(fileName).ACL()\n\t\tif err := acl.Set(ctx, storage.AllUsers, storage.RoleReader); err != nil {\n\t\t\tlogrus.Error(\"[UploadToGCloudStorage] ACL set error: \", err)\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\treturn fileName, nil\n}", "func (b *fakeBosClient) PutBucket(bucket string) (string, error) {\n\treturn \"\", fmt.Errorf(\"test\")\n}", "func (stc *SyncClient) remotePutBlob(hash string, blob []byte) error {\n\tresp, err := stc.client.Post(fmt.Sprintf(\"/api/blobstore/blob/%s\", hash), blob)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif err := clientutil.ExpectStatusCode(resp, http.StatusCreated); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *Shipper) upload(ctx context.Context, meta *metadata.Meta) error {\n\tlevel.Info(s.logger).Log(\"msg\", \"upload new block\", \"id\", meta.ULID)\n\n\t// We hard-link the files into a temporary upload directory so we are not affected\n\t// by other operations happening against the TSDB directory.\n\tupdir := filepath.Join(s.dir, \"thanos\", \"upload\", meta.ULID.String())\n\n\t// Remove updir just in case.\n\tif err := os.RemoveAll(updir); err != nil {\n\t\treturn errors.Wrap(err, \"clean upload directory\")\n\t}\n\tif err := os.MkdirAll(updir, 0750); err != nil {\n\t\treturn errors.Wrap(err, \"create upload dir\")\n\t}\n\tdefer func() {\n\t\tif err := os.RemoveAll(updir); err != nil {\n\t\t\tlevel.Error(s.logger).Log(\"msg\", \"failed to clean upload directory\", \"err\", err)\n\t\t}\n\t}()\n\n\tdir := filepath.Join(s.dir, meta.ULID.String())\n\tif err := hardlinkBlock(dir, updir); err != nil {\n\t\treturn errors.Wrap(err, \"hard link block\")\n\t}\n\t// Attach current labels and write a new meta file with Thanos extensions.\n\tif lset := s.getLabels(); lset != nil {\n\t\tmeta.Thanos.Labels = lset.Map()\n\t}\n\tmeta.Thanos.Source = s.source\n\tmeta.Thanos.SegmentFiles = block.GetSegmentFiles(updir)\n\tif err := meta.WriteToDir(s.logger, updir); err != nil {\n\t\treturn errors.Wrap(err, \"write meta file\")\n\t}\n\treturn block.Upload(ctx, s.logger, s.bucket, updir, s.hashFunc)\n}", "func cleanupBucket(bucketName string, c *minio.Client) error {\n\t// Create a done channel to control 'ListObjectsV2' go routine.\n\tdoneCh := make(chan struct{})\n\t// Exit cleanly upon return.\n\tdefer close(doneCh)\n\t// Iterate over all objects in the bucket via listObjectsV2 and delete\n\tfor objCh := range c.ListObjects(context.Background(), bucketName, minio.ListObjectsOptions{Recursive: true}) {\n\t\tif objCh.Err != nil {\n\t\t\treturn objCh.Err\n\t\t}\n\t\tif objCh.Key != \"\" {\n\t\t\terr := c.RemoveObject(context.Background(), bucketName, objCh.Key, minio.RemoveObjectOptions{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tfor objPartInfo := range c.ListIncompleteUploads(context.Background(), bucketName, \"\", true) {\n\t\tif objPartInfo.Err != nil {\n\t\t\treturn objPartInfo.Err\n\t\t}\n\t\tif objPartInfo.Key != \"\" {\n\t\t\terr := c.RemoveIncompleteUpload(context.Background(), bucketName, objPartInfo.Key)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\t// objects are already deleted, clear the buckets now\n\terr := c.RemoveBucket(context.Background(), bucketName)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) error {\n\tw := b.bkt.Object(name).NewWriter(ctx)\n\n\tif _, err := io.Copy(w, r); err != nil {\n\t\treturn err\n\t}\n\treturn w.Close()\n}", "func (t *targetrunner) runRechecksumBucket(bucket string) {\n\t// check if re-checksumming of a given bucket is currently being performed\n\txrcksum := t.xactions.renewRechecksum(bucket)\n\tif xrcksum == nil {\n\t\treturn\n\t}\n\n\t// re-checksum every object in a given bucket\n\tglog.Infof(\"Re-checksum: %s started: bucket: %s\", xrcksum, bucket)\n\tavailablePaths, _ := fs.Mountpaths.Get()\n\tfor contentType, contentResolver := range fs.CSM.RegisteredContentTypes {\n\t\tif !contentResolver.PermToProcess() { // FIXME: PermToRechecksum?\n\t\t\tcontinue\n\t\t}\n\n\t\twg := &sync.WaitGroup{}\n\t\tfor _, mpathInfo := range availablePaths {\n\t\t\twg.Add(1)\n\t\t\tgo func(mpathInfo *fs.MountpathInfo) {\n\t\t\t\tmpathL := mpathInfo.MakePath(contentType, true /*bucket is local*/)\n\t\t\t\tt.oneRechecksumBucket(mpathInfo, mpathL, xrcksum)\n\t\t\t\twg.Done()\n\t\t\t}(mpathInfo)\n\t\t}\n\t\twg.Wait()\n\t\tfor _, mpathInfo := range availablePaths {\n\t\t\twg.Add(1)\n\t\t\tgo func(mpathInfo *fs.MountpathInfo) {\n\t\t\t\tmpathC := mpathInfo.MakePath(contentType, false /*cloud*/)\n\t\t\t\tt.oneRechecksumBucket(mpathInfo, mpathC, xrcksum)\n\t\t\t\twg.Done()\n\t\t\t}(mpathInfo)\n\t\t}\n\t\twg.Wait()\n\t}\n\n\t// finish up\n\txrcksum.EndTime(time.Now())\n}", "func IMAGE_API_SendToCloudStorage(req *http.Request, mpf multipart.File, hdr *multipart.FileHeader, prefix string) (string, error) {\n\text, extErr := filterExtension(req, hdr) // ensure that file's extension is an image\n\tif extErr != nil { // if it is not, exit, returning error\n\t\treturn \"\", extErr\n\t}\n\n\tuploadName := prefix + makeSHA(mpf) + \".\" + ext // build new filename based on the image data instead. this will keep us from making multiple files of the same data.\n\tmpf.Seek(0, 0) // makeSHA moved the reader, move it back.\n\n\tctx := appengine.NewContext(req)\n\treturn uploadName, addFileToGCS(ctx, uploadName, mpf) // upload the file and name. if there is an error, our parent will catch it.}\n}", "func PutBucket(ctx context.Context, project, bucket string, cfg *pb.Bucket) {\n\tif cfg == nil {\n\t\tcfg = &pb.Bucket{}\n\t}\n\tif cfg.Name == \"\" {\n\t\tcfg.Name = bucket\n\t}\n\tconvey.So(datastore.Put(ctx, &model.Bucket{\n\t\tParent: model.ProjectKey(ctx, project),\n\t\tID: bucket,\n\t\tProto: cfg,\n\t}), convey.ShouldBeNil)\n}", "func (group *UploadGroup) Upload(contents string, bucket string, filename string, month time.Time) {\n\tgroup.wg.Add(1)\n\tuploadResult := UploadResult{\n\t\tmake(chan *s3manager.UploadOutput, 1),\n\t\tmake(chan error, 1),\n\t}\n\n\tgo func(outc chan *s3manager.UploadOutput, ec chan error) {\n\t\tdefer group.wg.Done()\n\t\toutput, err := Upload(contents, bucket, filename, month)\n\t\tec <- err\n\t\toutc <- output\n\t}(uploadResult.S3Output, uploadResult.Err)\n\n\tgroup.Outputs = append(group.Outputs, uploadResult)\n}", "func (lb *Elb) sync() {\n\tfor _ = range lb.syncCh {\n\t\tlog.Printf(\"-- ELB:%s:syncing:%s\\n\", lb.name, lb.members)\n\t\tinstancesInAwsElb, err := lb.getInstancesInAwsElb()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, instance := range instancesInAwsElb {\n\t\t\tif !lb.memberExists(instance, lb.members) {\n\t\t\t\tlb.removeInstanceFromAwsElb(instance)\n\t\t\t}\n\t\t}\n\t\tfor _, instance := range lb.members {\n\t\t\tif !lb.memberExists(instance, instancesInAwsElb) {\n\t\t\t\tlb.addInstanceToAwsElb(instance)\n\t\t\t}\n\t\t}\n\t}\n}", "func (s *S3) upload(ctx context.Context, snapshot, extraMetadata string, now time.Time) (*snapshotFile, error) {\n\tlogrus.Infof(\"Uploading snapshot %s to S3\", snapshot)\n\tbasename := filepath.Base(snapshot)\n\tvar snapshotFileName string\n\tvar sf snapshotFile\n\tif s.config.EtcdS3Folder != \"\" {\n\t\tsnapshotFileName = filepath.Join(s.config.EtcdS3Folder, basename)\n\t} else {\n\t\tsnapshotFileName = basename\n\t}\n\n\ttoCtx, cancel := context.WithTimeout(ctx, s.config.EtcdS3Timeout)\n\tdefer cancel()\n\topts := minio.PutObjectOptions{NumThreads: 2}\n\tif strings.HasSuffix(snapshot, compressedExtension) {\n\t\topts.ContentType = \"application/zip\"\n\t} else {\n\t\topts.ContentType = \"application/octet-stream\"\n\t}\n\tuploadInfo, err := s.client.FPutObject(toCtx, s.config.EtcdS3BucketName, snapshotFileName, snapshot, opts)\n\tif err != nil {\n\t\tsf = snapshotFile{\n\t\t\tName: filepath.Base(uploadInfo.Key),\n\t\t\tMetadata: extraMetadata,\n\t\t\tNodeName: \"s3\",\n\t\t\tCreatedAt: &metav1.Time{\n\t\t\t\tTime: now,\n\t\t\t},\n\t\t\tMessage: base64.StdEncoding.EncodeToString([]byte(err.Error())),\n\t\t\tSize: 0,\n\t\t\tStatus: failedSnapshotStatus,\n\t\t\tS3: &s3Config{\n\t\t\t\tEndpoint: s.config.EtcdS3Endpoint,\n\t\t\t\tEndpointCA: s.config.EtcdS3EndpointCA,\n\t\t\t\tSkipSSLVerify: s.config.EtcdS3SkipSSLVerify,\n\t\t\t\tBucket: s.config.EtcdS3BucketName,\n\t\t\t\tRegion: s.config.EtcdS3Region,\n\t\t\t\tFolder: s.config.EtcdS3Folder,\n\t\t\t\tInsecure: s.config.EtcdS3Insecure,\n\t\t\t},\n\t\t}\n\t\tlogrus.Errorf(\"Error received during snapshot upload to S3: %s\", err)\n\t} else {\n\t\tca, err := time.Parse(time.RFC3339, uploadInfo.LastModified.Format(time.RFC3339))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tsf = snapshotFile{\n\t\t\tName: filepath.Base(uploadInfo.Key),\n\t\t\tMetadata: extraMetadata,\n\t\t\tNodeName: \"s3\",\n\t\t\tCreatedAt: &metav1.Time{\n\t\t\t\tTime: ca,\n\t\t\t},\n\t\t\tSize: uploadInfo.Size,\n\t\t\tStatus: successfulSnapshotStatus,\n\t\t\tS3: &s3Config{\n\t\t\t\tEndpoint: s.config.EtcdS3Endpoint,\n\t\t\t\tEndpointCA: s.config.EtcdS3EndpointCA,\n\t\t\t\tSkipSSLVerify: s.config.EtcdS3SkipSSLVerify,\n\t\t\t\tBucket: s.config.EtcdS3BucketName,\n\t\t\t\tRegion: s.config.EtcdS3Region,\n\t\t\t\tFolder: s.config.EtcdS3Folder,\n\t\t\t\tInsecure: s.config.EtcdS3Insecure,\n\t\t\t},\n\t\t}\n\t}\n\treturn &sf, nil\n}", "func (bc *BoltClient) InitBucket() {\n\terr := bc.boltDB.Update(func(tx *bolt.Tx) error {\n\t\t_, err := tx.CreateBucketIfNotExists([]byte(bc.BucketName))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"create bucket failed: %s\", err)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func setupBucket(ctx context.Context, cloud, bucket string) (*blob.Bucket, error) {\n\tswitch cloud {\n\tcase \"aws\":\n\t\treturn setupAWS(ctx, bucket)\n\tcase \"gcp\":\n\t\treturn setupGCP(ctx, bucket)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid cloud provider: %s\", cloud)\n\t}\n}", "func (is *ImageStoreLocal) FullBlobUpload(repo string, body io.Reader, dstDigest godigest.Digest,\n) (string, int64, error) {\n\tif err := dstDigest.Validate(); err != nil {\n\t\treturn \"\", -1, err\n\t}\n\n\tif err := is.InitRepo(repo); err != nil {\n\t\treturn \"\", -1, err\n\t}\n\n\tu, err := guuid.NewV4()\n\tif err != nil {\n\t\treturn \"\", -1, err\n\t}\n\n\tuuid := u.String()\n\n\tsrc := is.BlobUploadPath(repo, uuid)\n\n\tblobFile, err := os.Create(src)\n\tif err != nil {\n\t\tis.log.Error().Err(err).Str(\"blob\", src).Msg(\"failed to open blob\")\n\n\t\treturn \"\", -1, zerr.ErrUploadNotFound\n\t}\n\n\tdefer func() {\n\t\tif is.commit {\n\t\t\t_ = blobFile.Sync()\n\t\t}\n\n\t\t_ = blobFile.Close()\n\t}()\n\n\tdigester := sha256.New()\n\tmw := io.MultiWriter(blobFile, digester)\n\n\tnbytes, err := io.Copy(mw, body)\n\tif err != nil {\n\t\treturn \"\", -1, err\n\t}\n\n\tsrcDigest := godigest.NewDigestFromEncoded(godigest.SHA256, fmt.Sprintf(\"%x\", digester.Sum(nil)))\n\tif srcDigest != dstDigest {\n\t\tis.log.Error().Str(\"srcDigest\", srcDigest.String()).\n\t\t\tStr(\"dstDigest\", dstDigest.String()).Msg(\"actual digest not equal to expected digest\")\n\n\t\treturn \"\", -1, zerr.ErrBadBlobDigest\n\t}\n\n\tdir := path.Join(is.rootDir, repo, \"blobs\", dstDigest.Algorithm().String())\n\n\tvar lockLatency time.Time\n\n\tis.Lock(&lockLatency)\n\tdefer is.Unlock(&lockLatency)\n\n\t_ = ensureDir(dir, is.log)\n\tdst := is.BlobPath(repo, dstDigest)\n\n\tif is.dedupe && fmt.Sprintf(\"%v\", is.cache) != fmt.Sprintf(\"%v\", nil) {\n\t\tif err := is.DedupeBlob(src, dstDigest, dst); err != nil {\n\t\t\tis.log.Error().Err(err).Str(\"src\", src).Str(\"dstDigest\", dstDigest.String()).\n\t\t\t\tStr(\"dst\", dst).Msg(\"unable to dedupe blob\")\n\n\t\t\treturn \"\", -1, err\n\t\t}\n\t} else {\n\t\tif err := os.Rename(src, dst); err != nil {\n\t\t\tis.log.Error().Err(err).Str(\"src\", src).Str(\"dstDigest\", dstDigest.String()).\n\t\t\t\tStr(\"dst\", dst).Msg(\"unable to finish blob\")\n\n\t\t\treturn \"\", -1, err\n\t\t}\n\t}\n\n\treturn uuid, nbytes, nil\n}", "func (s *Socker) SyncImages(configFile, repoFilter, filter string) error {\n\tif configFile == \"\" {\n\t\tconfigFile = dftImageConfigFile\n\t}\n\timages, err := ParseImages(repoFilter, filter)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdata, err := yaml.Marshal(images)\n\tif err != nil {\n\t\tlog.Errorf(\"marshal yaml data failed: %v\", err)\n\t\treturn err\n\t}\n\treturn ioutil.WriteFile(configFile, data, permRecordFile)\n}", "func (s *BCDNSyncer) Sync(sourcePath string) error {\n\tobjMap := make(map[string]api.BCDNObject)\n\n\tmetrics := struct {\n\t\ttotal int\n\t\tnewFile int\n\t\tmodifiedFile int\n\t\tdeletedFile int\n\t}{0, 0, 0, 0}\n\terr := filepath.Walk(sourcePath, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"prevent panic by handling failure accessing a path %q: %v\\n\", path, err)\n\t\t\treturn err\n\t\t}\n\t\tlog.Printf(\"DEBUG: checking path: %q\\n\", path)\n\t\trelPath, err := filepath.Rel(sourcePath, path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif info.IsDir() {\n\t\t\treturn s.fetchDirectory(objMap, relPath)\n\t\t}\n\t\tmetrics.total += 1\n\t\tfileContent, fsChecksum, err := getFileContent(path)\n\n\t\tobj, ok := objMap[relPath]\n\t\tif !ok {\n\t\t\tlog.Printf(\"DEBUG: %s not found in storage, uploading...\\n\", relPath)\n\t\t\tmetrics.newFile += 1\n\t\t\treturn s.uploadFile(relPath, fileContent, fsChecksum)\n\t\t}\n\n\t\tfsChecksum = strings.ToLower(fsChecksum)\n\t\tobjChecksum := strings.ToLower(obj.Checksum)\n\t\tif fsChecksum != objChecksum {\n\t\t\tmetrics.modifiedFile += 1\n\t\t\tlog.Printf(\"DEBUG: %s checksum doesn't match, local: [%s] remote: [%s]\\n\", relPath, fsChecksum, objChecksum)\n\t\t\tdelete(objMap, relPath)\n\t\t\treturn s.uploadFile(relPath, fileContent, fsChecksum)\n\t\t}\n\t\tlog.Printf(\"DEBUG: %s matches with remote storage, skipping.\\n\", relPath)\n\n\t\tdelete(objMap, relPath)\n\n\t\treturn nil\n\t})\n\tfor relPath, obj := range objMap {\n\t\tif !obj.IsDirectory {\n\t\t\tmetrics.deletedFile += 1\n\t\t\tlog.Printf(\"%s object must be deleted.\\n\", relPath)\n\t\t\ts.deletePath(relPath)\n\t\t}\n\t}\n\n\tlog.Printf(\"Total files: %d New files: %d Modified files: %d Deleted files: %d\\n\", metrics.total, metrics.newFile, metrics.modifiedFile, metrics.deletedFile)\n\n\treturn err\n}", "func (p *Packager) Upload(r io.ReadSeeker, key string) (string, error) {\n\tfmt.Printf(\"Uploading %s\\n\", key)\n\n\tinput := &s3.PutObjectInput{\n\t\tBucket: aws.String(p.S3Bucket),\n\t\tBody: r,\n\t\tKey: aws.String(key),\n\t}\n\n\tif p.KMSKeyID != \"\" {\n\t\tinput.ServerSideEncryption = aws.String(\"aws:kms\")\n\t\tinput.SSEKMSKeyId = aws.String(p.KMSKeyID)\n\t}\n\n\t_, err := p.svc.PutObject(input)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn fmt.Sprintf(\"s3://%s/%s\", p.S3Bucket, key), nil\n}", "func (remote *LocalRemote) Push(image, imageRoot string) error {\n\tlog.Println(\"pushing local\", remote.Url.Path)\n\n\treturn remote.rsyncTo(imageRoot, \"\")\n}", "func (s *SharemeService) HandleUpload(hc *HTTPContext, c *gae.Context, session *Session) []*Share {\n\tret := make([]*Share, 0)\n\tbis := s.storageService.HandleUpload(hc)\n\tfor _, stat := range bis {\n\t\tdsk, err := datastore.Put(c, datastore.NewIncompleteKey(c, \"Share\", nil), stat)\n\t\tif err != nil {\n\t\t\t//TODO: delete blob\n\t\t\tcontinue\n\t\t}\n\t\tfkey := dsk.Encode()\n\t\tsession.Set(fmt.Sprintf(\"%s%s\", KeySessionPrefix, fkey), stat.Name)\n\t\trstat := s.Stat(c, fkey)\n\t\tret = append(ret, &rstat)\n\n\t}\n\treturn ret\n}", "func testPutObject() {\n\tstartTime := time.Now()\n\tfunction := \"testPutObject\"\n\tbucket := randString(60, rand.NewSource(time.Now().UnixNano()), \"versioning-test-\")\n\tobject := \"testObject\"\n\texpiry := 1 * time.Minute\n\targs := map[string]interface{}{\n\t\t\"bucketName\": bucket,\n\t\t\"objectName\": object,\n\t\t\"expiry\": expiry,\n\t}\n\n\t_, err := s3Client.CreateBucket(&s3.CreateBucketInput{\n\t\tBucket: aws.String(bucket),\n\t})\n\tif err != nil {\n\t\tfailureLog(function, args, startTime, \"\", \"CreateBucket failed\", err).Fatal()\n\t\treturn\n\t}\n\tdefer cleanupBucket(bucket, function, args, startTime)\n\n\tputVersioningInput := &s3.PutBucketVersioningInput{\n\t\tBucket: aws.String(bucket),\n\t\tVersioningConfiguration: &s3.VersioningConfiguration{\n\t\t\tStatus: aws.String(\"Enabled\"),\n\t\t},\n\t}\n\n\t_, err = s3Client.PutBucketVersioning(putVersioningInput)\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), \"NotImplemented: A header you provided implies functionality that is not implemented\") {\n\t\t\tignoreLog(function, args, startTime, \"Versioning is not implemented\").Info()\n\t\t\treturn\n\t\t}\n\t\tfailureLog(function, args, startTime, \"\", \"Put versioning failed\", err).Fatal()\n\t\treturn\n\t}\n\n\tputInput1 := &s3.PutObjectInput{\n\t\tBody: aws.ReadSeekCloser(strings.NewReader(\"my content 1\")),\n\t\tBucket: aws.String(bucket),\n\t\tKey: aws.String(object),\n\t}\n\t_, err = s3Client.PutObject(putInput1)\n\tif err != nil {\n\t\tfailureLog(function, args, startTime, \"\", fmt.Sprintf(\"PUT expected to succeed but got %v\", err), err).Fatal()\n\t\treturn\n\t}\n\tputInput2 := &s3.PutObjectInput{\n\t\tBody: aws.ReadSeekCloser(strings.NewReader(\"content file 2\")),\n\t\tBucket: aws.String(bucket),\n\t\tKey: aws.String(object),\n\t}\n\t_, err = s3Client.PutObject(putInput2)\n\tif err != nil {\n\t\tfailureLog(function, args, startTime, \"\", fmt.Sprintf(\"PUT expected to succeed but got %v\", err), err).Fatal()\n\t\treturn\n\t}\n\n\tinput := &s3.ListObjectVersionsInput{\n\t\tBucket: aws.String(bucket),\n\t}\n\n\tresult, err := s3Client.ListObjectVersions(input)\n\tif err != nil {\n\t\tfailureLog(function, args, startTime, \"\", fmt.Sprintf(\"PUT expected to succeed but got %v\", err), err).Fatal()\n\t\treturn\n\t}\n\n\tif len(result.Versions) != 2 {\n\t\tfailureLog(function, args, startTime, \"\", \"Unexpected list content\", errors.New(\"unexpected number of versions\")).Fatal()\n\t\treturn\n\t}\n\n\tvid1 := *result.Versions[0]\n\tvid2 := *result.Versions[1]\n\n\tif *vid1.VersionId == \"\" || *vid2.VersionId == \"\" || *vid1.VersionId == *vid2.VersionId {\n\t\tfailureLog(function, args, startTime, \"\", \"Unexpected list content\", errors.New(\"unexpected VersionId field\")).Fatal()\n\t\treturn\n\t}\n\n\tif *vid1.IsLatest == false || *vid2.IsLatest == true {\n\t\tfailureLog(function, args, startTime, \"\", \"Unexpected list content\", errors.New(\"unexpected IsLatest field\")).Fatal()\n\t\treturn\n\t}\n\n\tif *vid1.Size != 14 || *vid2.Size != 12 {\n\t\tfailureLog(function, args, startTime, \"\", \"Unexpected list content\", errors.New(\"unexpected Size field\")).Fatal()\n\t\treturn\n\t}\n\n\tif !etagRegex.MatchString(*vid1.ETag) || !etagRegex.MatchString(*vid2.ETag) {\n\t\tfailureLog(function, args, startTime, \"\", \"Unexpected list content\", errors.New(\"unexpected ETag field\")).Fatal()\n\t\treturn\n\t}\n\n\tif *vid1.Key != \"testObject\" || *vid2.Key != \"testObject\" {\n\t\tfailureLog(function, args, startTime, \"\", \"Unexpected list content\", errors.New(\"unexpected Key field\")).Fatal()\n\t\treturn\n\t}\n\n\tif (*vid1.LastModified).Before(*vid2.LastModified) {\n\t\tfailureLog(function, args, startTime, \"\", \"Unexpected list content\", errors.New(\"unexpected Last modified field\")).Fatal()\n\t\treturn\n\t}\n\n\tsuccessLogger(function, args, startTime).Info()\n}", "func (media *SavedMedia) Sync() error {\n\tinsta := media.insta\n\tbody, _, err := insta.sendRequest(\n\t\t&reqOptions{\n\t\t\tEndpoint: urlFeedSaved,\n\t\t\tQuery: map[string]string{\n\t\t\t\t\"include_igtv_preview\": \"true\",\n\t\t\t\t\"include_igtv_tab\": \"true\",\n\t\t\t\t\"include_clips_subtab\": \"false\", // default is false, but could be set to true\n\t\t\t\t\"clips_subtab_first\": \"false\",\n\t\t\t\t\"show_igtv_first\": \"false\",\n\t\t\t\t\"include_collection_info\": \"false\",\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttmp := collectionSync{}\n\terr = json.Unmarshal(body, &tmp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmedia.NextID = tmp.Media.NextID\n\tmedia.MoreAvailable = tmp.Media.MoreAvailable\n\tmedia.NumResults = tmp.Media.NumResults\n\n\tmedia.Items = tmp.Media.Items\n\tmedia.setValues()\n\n\treturn nil\n}", "func (fs *Stow) Upload(ctx context.Context, path, mediaType string, r io.ReadCloser) (map[string]interface{}, error) {\n\t_, err := fs.fileUrl(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocation, err := stow.Dial(fs.kind, fs.config)\n\tif err != nil {\n\t\tlog.Errorf(\"stow.Dial fail: %v\", err)\n\t\treturn nil, err\n\t}\n\tdefer location.Close()\n\n\tcontainer, err := location.Container(fs.bucket)\n\tif err != nil {\n\t\tlog.Errorf(\"stow.GetContainer fail: %v\", err)\n\t\treturn nil, err\n\t}\n\n\titem, err := container.Item(path)\n\tif item != nil {\n\t\t// TODO overwrite existing item instead of remove\n\t\tcontainer.RemoveItem(path)\n\t}\n\terr = nil\n\n\t// TODO check if put requires to load file content into memory\n\t// TODO add metadata\n\t_, err = container.Put(path, r, 0, nil)\n\tif err != nil {\n\t\tlog.Errorf(\"container.Put fail: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tdg, close, err := dgraph.NewClient(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer close()\n\n\ttx := dg.NewTxn()\n\tdefer dgraph.Discard(ctx, tx)\n\n\tfile, err := FindFileImpl(ctx, tx, path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif file == nil {\n\t\tfile = &FileInfo{}\n\t}\n\tfile.Path = path\n\tfile.MediaType = mediaType\n\n\treturn AddFile(ctx, tx, file)\n}", "func (m Mux) Bucket(ctx context.Context, rawurl string) (Bucket, string, error) {\n\tu, err := url.Parse(rawurl)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\tstore, ok := m[u.Scheme]\n\tif !ok {\n\t\treturn nil, \"\", errors.E(errors.NotSupported, \"blob.Bucket\", rawurl,\n\t\t\terrors.Errorf(\"no implementation for scheme %s\", u.Scheme))\n\t}\n\tbucket, err := store.Bucket(ctx, u.Host)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\treturn bucket, strings.TrimPrefix(rawurl, bucket.Location()), err\n}", "func UpdateBucket(context *gin.Context) {\n\tresponseCode := constant.INVALID_PARAMS\n\n\tbucketToUpdate := models.Bucket{}\n\tif err := context.ShouldBindWith(&bucketToUpdate, binding.Form); err != nil {\n\t\t//log.Println(err)\n\t\tutils.AppLogger.Info(err.Error(), zap.String(\"service\", \"UpdateBucket()\"))\n\t\tcontext.AbortWithStatusJSON(http.StatusBadRequest, gin.H{\n\t\t\t\"code\": responseCode,\n\t\t\t\"data\": make(map[string]string),\n\t\t\t\"msg\": constant.GetMessage(responseCode),\n\t\t})\n\t\treturn\n\t}\n\n\tvalidCheck := validation.Validation{}\n\tvalidCheck.Required(bucketToUpdate.ID, \"bucket_id\").Message(\"Must have bucket id\")\n\tvalidCheck.MaxSize(bucketToUpdate.Name, 64, \"bucket_name\").Message(\"Bucket name length can not exceed 64\")\n\n\tdata := make(map[string]interface{})\n\tif !validCheck.HasErrors() {\n\t\tif err := models.UpdateBucket(&bucketToUpdate); err != nil {\n\t\t\tif err == models.NoSuchBucketError {\n\t\t\t\tresponseCode = constant.BUCKET_NOT_EXIST\n\t\t\t} else {\n\t\t\t\tresponseCode = constant.INTERNAL_SERVER_ERROR\n\t\t\t}\n\t\t} else {\n\t\t\tresponseCode = constant.BUCKET_UPDATE_SUCCESS\n\t\t}\n\t} else {\n\t\tfor _, err := range validCheck.Errors {\n\t\t\t//log.Println(err.Message)\n\t\t\tutils.AppLogger.Info(err.Message, zap.String(\"service\", \"UpdateBucket()\"))\n\t\t}\n\t}\n\n\tdata[\"bucket_id\"] = bucketToUpdate.ID\n\tcontext.JSON(http.StatusOK, gin.H{\n\t\t\"code\": responseCode,\n\t\t\"data\": data,\n\t\t\"msg\": constant.GetMessage(responseCode),\n\t})\n}", "func (h Hosting) UploadHostingAssets(realmClient realm.Client, groupID, appID string, hostingDiffs HostingDiffs, errHandler func(err error)) error {\n\tvar wg sync.WaitGroup\n\n\tjobCh := make(chan func())\n\terrCh := make(chan error)\n\tdoneCh := make(chan struct{})\n\n\tvar errs []error\n\tgo func() {\n\t\tfor err := range errCh {\n\t\t\terrHandler(err)\n\t\t\terrs = append(errs, err)\n\t\t}\n\t\tdoneCh <- struct{}{}\n\t}()\n\n\tfor n := 0; n < numHostingWorkers; n++ {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tfor job := range jobCh {\n\t\t\t\tjob()\n\t\t\t}\n\t\t}()\n\t}\n\n\tassetsDir := filepath.Join(h.RootDir, NameFiles)\n\n\tfor _, added := range hostingDiffs.Added {\n\t\tasset := added // the closure otherwise sees the same value for `added` each iteration\n\t\tjobCh <- func() {\n\t\t\tif err := realmClient.HostingAssetUpload(groupID, appID, assetsDir, asset); err != nil {\n\t\t\t\terrCh <- fmt.Errorf(\"failed to add %s: %w\", asset.FilePath, err)\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, deleted := range hostingDiffs.Deleted {\n\t\tasset := deleted // the closure otherwise sees the same value for `added` each iteration\n\t\tjobCh <- func() {\n\t\t\tif err := realmClient.HostingAssetRemove(groupID, appID, asset.FilePath); err != nil {\n\t\t\t\terrCh <- fmt.Errorf(\"failed to remove %s: %w\", asset.FilePath, err)\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, modified := range hostingDiffs.Modified {\n\t\tasset := modified // the closure otherwise sees the same value for `added` each iteration\n\t\tjobCh <- func() {\n\t\t\tif asset.AttrsModified && !asset.BodyModified {\n\t\t\t\tif err := realmClient.HostingAssetAttributesUpdate(groupID, appID, asset.FilePath, asset.Attrs...); err != nil {\n\t\t\t\t\terrCh <- fmt.Errorf(\"failed to update attributes for %s: %w\", asset.FilePath, err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif err := realmClient.HostingAssetUpload(groupID, appID, assetsDir, asset.HostingAsset); err != nil {\n\t\t\t\t\terrCh <- fmt.Errorf(\"failed to update %s: %w\", asset.FilePath, err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tclose(jobCh)\n\twg.Wait()\n\n\tclose(errCh)\n\t<-doneCh\n\n\tif len(errs) > 0 {\n\t\treturn fmt.Errorf(\"%d error(s) occurred while importing hosting assets\", len(errs))\n\t}\n\treturn nil\n}", "func uploadBookHandler(res http.ResponseWriter, req *http.Request) {\n _, claims, err := jwtauth.FromContext(req.Context())\n if err != nil {\n log.Println(err)\n res.WriteHeader(500)\n return\n }\n\n // Parse the uploaded forms\n if err := req.ParseMultipartForm(maxFormMemory); err != nil {\n res.WriteHeader(500)\n return\n }\n\n // Upload each uploaded book to the server\n for _, header := range req.MultipartForm.File[\"books\"] {\n filename := header.Filename\n file, err := header.Open()\n if err != nil {\n res.WriteHeader(500)\n log.Println(err)\n return\n }\n\n stream, err := booksBucket.OpenUploadStream(filename, options.GridFSUpload())\n if err != nil {\n res.WriteHeader(400)\n log.Println(err)\n return\n }\n defer stream.Close()\n\n if _, err := io.Copy(stream, file); err != nil {\n res.WriteHeader(500)\n log.Println(err)\n return\n }\n\n _, err = usersCollection.UpdateOne(\n context.Background(),\n bson.M{\"username\": claims[\"username\"].(string)},\n bson.M{\"$push\": bson.M{\"books\": Book{Id: stream.FileID.(primitive.ObjectID), Title: filename}}},\n options.Update().SetUpsert(true),\n )\n if err != nil {\n res.WriteHeader(500)\n log.Println(err)\n return\n }\n }\n\n // Go back to the library page \n http.Redirect(res, req, \"/library\", 302)\n}", "func syncWithRemote(remote string, dest string) error {\n\tif _, err := os.Stat(dest); os.IsNotExist(err) {\n\t\tcloneBareRepository(remote, dest)\n\t}\n\n\tif err := os.Chdir(dest); err != nil {\n\t\treturn err\n\t}\n\n\tcmd := exec.Command(\"echo\", \"git\", \"fetch\", remote)\n\n\terr := cmd.Run()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *Client) SyncImages(request *SyncImagesRequest) (response *SyncImagesResponse, err error) {\n return c.SyncImagesWithContext(context.Background(), request)\n}", "func (t *targetrunner) renameLB(bucketFrom, bucketTo string) (err error) {\n\t// ready to receive migrated obj-s _after_ that point\n\t// insert directly w/o incrementing the version (metasyncer will do at the end of the operation)\n\twg := &sync.WaitGroup{}\n\n\tpid := t.smapowner.get().ProxySI.DaemonID\n\tavailablePaths, _ := fs.Mountpaths.Get()\n\tch := make(chan error, len(fs.CSM.RegisteredContentTypes)*len(availablePaths))\n\tfor contentType := range fs.CSM.RegisteredContentTypes {\n\t\tfor _, mpathInfo := range availablePaths {\n\t\t\t// Create directory for new local bucket\n\t\t\ttoDir := mpathInfo.MakePathBucket(contentType, bucketTo, true /*bucket is local*/)\n\t\t\tif err := cmn.CreateDir(toDir); err != nil {\n\t\t\t\tch <- fmt.Errorf(\"failed to create dir %s, error: %v\", toDir, err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\twg.Add(1)\n\t\t\tfromDir := mpathInfo.MakePathBucket(contentType, bucketFrom, true /*bucket is local*/)\n\t\t\tgo func(fromDir string) {\n\t\t\t\ttime.Sleep(time.Millisecond * 100) // FIXME: 2-phase for the targets to 1) prep (above) and 2) rebalance\n\t\t\t\tch <- t.renameOne(fromDir, bucketFrom, bucketTo, pid)\n\t\t\t\twg.Done()\n\t\t\t}(fromDir)\n\t\t}\n\t}\n\twg.Wait()\n\tclose(ch)\n\tfor err = range ch {\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func (is *ImageStoreLocal) PutImageManifest(repo, reference, mediaType string, //nolint: gocyclo\n\tbody []byte,\n) (godigest.Digest, godigest.Digest, error) {\n\tif err := is.InitRepo(repo); err != nil {\n\t\tis.log.Debug().Err(err).Msg(\"init repo\")\n\n\t\treturn \"\", \"\", err\n\t}\n\n\tvar lockLatency time.Time\n\n\tvar err error\n\n\tis.Lock(&lockLatency)\n\tdefer func() {\n\t\tis.Unlock(&lockLatency)\n\n\t\tif err == nil {\n\t\t\tmonitoring.SetStorageUsage(is.metrics, is.rootDir, repo)\n\t\t\tmonitoring.IncUploadCounter(is.metrics, repo)\n\t\t}\n\t}()\n\n\trefIsDigest := true\n\n\tmDigest, err := common.GetAndValidateRequestDigest(body, reference, is.log)\n\tif err != nil {\n\t\tif errors.Is(err, zerr.ErrBadManifest) {\n\t\t\treturn mDigest, \"\", err\n\t\t}\n\n\t\trefIsDigest = false\n\t}\n\n\tdigest, err := common.ValidateManifest(is, repo, reference, mediaType, body, is.log)\n\tif err != nil {\n\t\treturn digest, \"\", err\n\t}\n\n\tindex, err := common.GetIndex(is, repo, is.log)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\t// create a new descriptor\n\tdesc := ispec.Descriptor{\n\t\tMediaType: mediaType, Size: int64(len(body)), Digest: mDigest,\n\t}\n\n\tif !refIsDigest {\n\t\tdesc.Annotations = map[string]string{ispec.AnnotationRefName: reference}\n\t}\n\n\tvar subjectDigest godigest.Digest\n\n\tartifactType := \"\"\n\n\tif mediaType == ispec.MediaTypeImageManifest {\n\t\tvar manifest ispec.Manifest\n\n\t\terr := json.Unmarshal(body, &manifest)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\n\t\tif manifest.Subject != nil {\n\t\t\tsubjectDigest = manifest.Subject.Digest\n\t\t}\n\n\t\tartifactType = zcommon.GetManifestArtifactType(manifest)\n\t} else if mediaType == ispec.MediaTypeImageIndex {\n\t\tvar index ispec.Index\n\n\t\terr := json.Unmarshal(body, &index)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\n\t\tif index.Subject != nil {\n\t\t\tsubjectDigest = index.Subject.Digest\n\t\t}\n\n\t\tartifactType = zcommon.GetIndexArtifactType(index)\n\t}\n\n\tupdateIndex, oldDgst, err := common.CheckIfIndexNeedsUpdate(&index, &desc, is.log)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\tif !updateIndex {\n\t\treturn desc.Digest, subjectDigest, nil\n\t}\n\n\t// write manifest to \"blobs\"\n\tdir := path.Join(is.rootDir, repo, \"blobs\", mDigest.Algorithm().String())\n\t_ = ensureDir(dir, is.log)\n\tfile := path.Join(dir, mDigest.Encoded())\n\n\t// in case the linter will not pass, it will be garbage collected\n\tif err := is.writeFile(file, body); err != nil {\n\t\tis.log.Error().Err(err).Str(\"file\", file).Msg(\"unable to write\")\n\n\t\treturn \"\", \"\", err\n\t}\n\n\terr = common.UpdateIndexWithPrunedImageManifests(is, &index, repo, desc, oldDgst, is.log)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\t// now update \"index.json\"\n\tindex.Manifests = append(index.Manifests, desc)\n\tdir = path.Join(is.rootDir, repo)\n\tfile = path.Join(dir, \"index.json\")\n\n\tbuf, err := json.Marshal(index)\n\tif err := inject.Error(err); err != nil {\n\t\tis.log.Error().Err(err).Str(\"file\", file).Msg(\"unable to marshal JSON\")\n\n\t\treturn \"\", \"\", err\n\t}\n\n\t// update the descriptors artifact type in order to check for signatures when applying the linter\n\tdesc.ArtifactType = artifactType\n\n\t// apply linter only on images, not signatures or indexes\n\tpass, err := common.ApplyLinter(is, is.linter, repo, desc)\n\tif !pass {\n\t\tis.log.Error().Err(err).Str(\"repository\", repo).Str(\"reference\", reference).Msg(\"linter didn't pass\")\n\n\t\treturn \"\", \"\", err\n\t}\n\n\terr = is.writeFile(file, buf)\n\tif err := inject.Error(err); err != nil {\n\t\tis.log.Error().Err(err).Str(\"file\", file).Msg(\"unable to write\")\n\n\t\treturn \"\", \"\", err\n\t}\n\n\treturn desc.Digest, subjectDigest, nil\n}", "func reloc(bucketName, oldPath, newPath string, keys s3gof3r.Keys) error {\n\ts3 := s3gof3r.New(\"s3.amazonaws.com\", keys)\n\tbucket := s3.Bucket(bucketName)\n\t// this is a POST at the bottom, and copies are a PUT. whee.\n\t//w, err := s3.Bucket(bucketName).PutWriter(newPath, copyInstruction, s3Conf)\n\t// So, implement our own aws copy API.\n\treq, err := http.NewRequest(\"PUT\", \"\", &bytes.Buffer{})\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.URL.Scheme = s3Conf.Scheme\n\treq.URL.Host = fmt.Sprintf(\"%s.%s\", bucketName, s3.Domain)\n\treq.URL.Path = path.Clean(fmt.Sprintf(\"/%s\", newPath))\n\t// Communicate the copy source object with a header.\n\t// Be advised that if this object doesn't exist, amazon reports that as a 404... yes, a 404 that has nothing to do with the query URI.\n\treq.Header.Add(\"x-amz-copy-source\", path.Join(\"/\", bucketName, oldPath))\n\tbucket.Sign(req)\n\tresp, err := s3Conf.Client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != 200 {\n\t\treturn newRespError(resp)\n\t}\n\t// delete previous location\n\tif err := bucket.Delete(oldPath); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (h *Handler) ensureBucket() error {\n\t_, err := h.gcsClient.Bucket(h.Config.Bucket).Attrs(h.clientContext)\n\terr = convertGCSError(err)\n\t// assumes that bucket is administered by other entity\n\tif err == nil {\n\t\treturn nil\n\t}\n\tif !trace.IsNotFound(err) {\n\t\th.Errorf(\"Failed to ensure that bucket %q exists (%v). GCS session uploads may fail. If you've set up the bucket already and gave Teleport write-only access, feel free to ignore this error.\", h.Bucket, err)\n\t\treturn nil\n\t}\n\terr = h.gcsClient.Bucket(h.Config.Bucket).Create(h.clientContext, h.Config.ProjectID, &storage.BucketAttrs{\n\t\tVersioningEnabled: true,\n\t\tEncryption: &storage.BucketEncryption{DefaultKMSKeyName: h.Config.KMSKeyName},\n\t\t// See https://cloud.google.com/storage/docs/json_api/v1/buckets/insert#parameters\n\t\tPredefinedACL: \"projectPrivate\",\n\t\tPredefinedDefaultObjectACL: \"projectPrivate\",\n\t})\n\terr = convertGCSError(err)\n\tif err != nil {\n\t\tif !trace.IsAlreadyExists(err) {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\t// if this gcsClient has not created the bucket, don't reconfigure it\n\t\treturn nil\n\t}\n\treturn nil\n}", "func TestWithGCS(t *testing.T) {\n\tctx, cancel := context.WithTimeout(context.Background(), time.Minute*5)\n\tdefer cancel()\n\tconst (\n\t\tmod = \"stashmod\"\n\t\tver = \"v1.0.0\"\n\t)\n\tstrg := getStorage(t)\n\tstrg.Delete(ctx, mod, ver)\n\tdefer strg.Delete(ctx, mod, ver)\n\n\t// sanity check\n\t_, err := strg.GoMod(ctx, mod, ver)\n\tif !errors.Is(err, errors.KindNotFound) {\n\t\tt.Fatalf(\"expected the stash bucket to return a NotFound error but got: %v\", err)\n\t}\n\n\tvar eg errgroup.Group\n\tfor i := 0; i < 5; i++ {\n\t\tcontent := uuid.New().String()\n\t\tms := &mockGCPStasher{strg, content}\n\t\ts := WithGCSLock(ms)\n\t\teg.Go(func() error {\n\t\t\tctx, cancel := context.WithTimeout(context.Background(), time.Second*10)\n\t\t\tdefer cancel()\n\t\t\t_, err := s.Stash(ctx, \"stashmod\", \"v1.0.0\")\n\t\t\treturn err\n\t\t})\n\t}\n\n\terr = eg.Wait()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tinfo, err := strg.Info(ctx, mod, ver)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tmodContent, err := strg.GoMod(ctx, mod, ver)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tzip, err := strg.Zip(ctx, mod, ver)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer zip.Close()\n\tzipContent, err := io.ReadAll(zip)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !bytes.Equal(info, modContent) {\n\t\tt.Fatalf(\"expected info and go.mod to be equal but info was {%v} and content was {%v}\", string(info), string(modContent))\n\t}\n\tif !bytes.Equal(info, zipContent) {\n\t\tt.Fatalf(\"expected info and zip to be equal but info was {%v} and content was {%v}\", string(info), string(zipContent))\n\t}\n}", "func (ct *ctrlerCtx) diffBucket(apicl apiclient.Services) {\n\topts := api.ListWatchOptions{}\n\n\t// get a list of all objects from API server\n\tobjlist, err := apicl.ObjstoreV1().Bucket().List(context.Background(), &opts)\n\tif err != nil {\n\t\tct.logger.Errorf(\"Error getting a list of objects. Err: %v\", err)\n\t\treturn\n\t}\n\n\tct.logger.Infof(\"diffBucket(): BucketList returned %d objects\", len(objlist))\n\n\t// build an object map\n\tobjmap := make(map[string]*objstore.Bucket)\n\tfor _, obj := range objlist {\n\t\tobjmap[obj.GetKey()] = obj\n\t}\n\n\tlist, err := ct.Bucket().List(context.Background(), &opts)\n\tif err != nil && !strings.Contains(err.Error(), \"not found in local cache\") {\n\t\tct.logger.Infof(\"Failed to get a list of objects. Err: %s\", err)\n\t\treturn\n\t}\n\n\t// if an object is in our local cache and not in API server, trigger delete for it\n\tfor _, obj := range list {\n\t\t_, ok := objmap[obj.GetKey()]\n\t\tif !ok {\n\t\t\tct.logger.Infof(\"diffBucket(): Deleting existing object %#v since its not in apiserver\", obj.GetKey())\n\t\t\tevt := kvstore.WatchEvent{\n\t\t\t\tType: kvstore.Deleted,\n\t\t\t\tKey: obj.GetKey(),\n\t\t\t\tObject: &obj.Bucket,\n\t\t\t}\n\t\t\tct.handleBucketEvent(&evt)\n\t\t}\n\t}\n\n\t// trigger create event for all others\n\tfor _, obj := range objlist {\n\t\tct.logger.Infof(\"diffBucket(): Adding object %#v\", obj.GetKey())\n\t\tevt := kvstore.WatchEvent{\n\t\t\tType: kvstore.Created,\n\t\t\tKey: obj.GetKey(),\n\t\t\tObject: obj,\n\t\t}\n\t\tct.handleBucketEvent(&evt)\n\t}\n}", "func (m *manager) forceSync(quotaID string) error {\n\tm.bucketsLock.RLock()\n\tb, ok := m.buckets[quotaID]\n\tif !ok {\n\t\tm.bucketsLock.RUnlock()\n\t\treturn nil\n\t}\n\tm.bucketsLock.RUnlock()\n\tm.bucketsSyncingLock.Lock()\n\tm.bucketsSyncing[b] = struct{}{}\n\tm.bucketsSyncingLock.Unlock()\n\tdefer func() {\n\t\tm.bucketsSyncingLock.Lock()\n\t\tdelete(m.bucketsSyncing, b)\n\t\tm.bucketsSyncingLock.Unlock()\n\t}()\n\treturn b.sync()\n}", "func UploadFiles(c *gin.Context) {\n\tlocationFull := \"\"\n\tpreviewImage := \"\"\n\tpathName := \"files_\" + c.Request.Header[\"Application-Id\"][0]\n\n\tformFile, _ := c.FormFile(\"file\")\n\n\tfile, _ := formFile.Open()\n\tdefer file.Close()\n\n\tvar copiedFile io.Reader\n\tvar buf bytes.Buffer\n\n\tif isImage(formFile.Header[\"Content-Type\"][0]) {\n\t\tcopiedFile = io.TeeReader(file, &buf)\n\t\tpreview, err := makePreview(copiedFile)\n\n\t\tif err == nil {\n\t\t\tnewFileName, _ := newFileName(pathName, formFile.Header[\"Content-Type\"][0])\n\t\t\tpreviewImage, _ = s3.Upload(preview, newFileName)\n\t\t}\n\t}\n\n\tnewFileName, err := newFileName(pathName, formFile.Header[\"Content-Type\"][0])\n\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tvar errUpload error\n\tif buf.Len() == 0 {\n\t\tlocationFull, errUpload = s3.Upload(file, newFileName)\n\t} else {\n\t\tr := bytes.NewReader(buf.Bytes())\n\t\tlocationFull, errUpload = s3.Upload(r, newFileName)\n\t}\n\n\tif errUpload != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": errUpload.Error()})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"result\": map[string]string{\n\t\t\t\"url\": locationFull,\n\t\t\t\"previewUrl\": previewImage,\n\t\t\t\"type\": formFile.Header[\"Content-Type\"][0],\n\t\t}})\n}", "func (b *Bucket) Upload(file *os.File, filename string) error {\n\t// set session\n\tsess, err := b.setSession()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tuploader := b.newUploaderfunc(sess)\n\t_, err = uploader.Upload(&s3manager.UploadInput{\n\t\tBucket: aws.String(b.BucketName),\n\t\tKey: aws.String(crPath + filename),\n\t\tBody: file,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error uploading %s to bucket %s : %s\", filename, b.BucketName, err.Error())\n\t}\n\n\treturn nil\n}", "func (iter *SyncFolderIterator) UploadObject() s3manager.BatchUploadObject {\n\tfi := iter.fileInfos[0]\n\titer.fileInfos = iter.fileInfos[1:]\n\tbody, err := os.Open(fi.fullpath)\n\tif err != nil {\n\t\titer.err = err\n\t}\n\n\textension := filepath.Ext(fi.key)\n\tmimeType := mime.TypeByExtension(extension)\n\n\tif mimeType == \"\" {\n\t\tmimeType = \"binary/octet-stream\"\n\t}\n\n\tinput := s3manager.UploadInput{\n\t\tBucket: &iter.bucket,\n\t\tKey: &fi.key,\n\t\tBody: body,\n\t\tContentType: &mimeType,\n\t}\n\n\treturn s3manager.BatchUploadObject{\n\t\tObject: &input,\n\t}\n}", "func (client StorageGatewayClient) updateCloudSync(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {\n\thttpRequest, err := request.HTTPRequest(http.MethodPut, \"/storageGateways/{storageGatewayId}/cloudSyncs/{cloudSyncName}\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response UpdateCloudSyncResponse\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}", "func syncHierarchyUp(localPath string, driveRoot string,\n\texistingFiles map[string]*drive.File,\n\tencrypt bool, ignoreTimes bool) error {\n\tif encrypt {\n\t\tvar err error\n\t\tkey, err = decryptEncryptionKey()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Kick off a background thread to periodically allow uploading\n\t// a bit more data. This allowance is consumed by the\n\t// RateLimitedReader Read() function.\n\tlaunchBandwidthTask(config.Upload.Bytes_per_second_limit)\n\n\tfileMappings, err := compileUploadFileTree(localPath, driveRoot, encrypt)\n\tcheckFatalError(err, \"skicka: error getting local filetree: %v\\n\")\n\ttimeDelta(\"Walk local directories\")\n\tfileMappings, err = filterFilesToUpload(fileMappings, existingFiles, encrypt, ignoreTimes)\n\tcheckFatalError(err, \"skicka: error determining files to sync: %v\\n\")\n\n\tif len(fileMappings) == 0 {\n\t\tfmt.Fprintln(os.Stderr, \"There are no new files that need to be uploaded.\")\n\t\treturn nil\n\t}\n\n\tnBytesToUpload := int64(0)\n\tfor _, info := range fileMappings {\n\t\tnBytesToUpload += info.LocalFileInfo.Size()\n\t}\n\n\t// Given the list of files to sync, first find all of the directories and\n\t// then either get or create a Drive folder for each one.\n\tdirectoryMappingMap := make(map[string]LocalToRemoteFileMapping)\n\tvar directoryNames []string\n\tfor _, localfile := range fileMappings {\n\t\tif localfile.LocalFileInfo.IsDir() {\n\t\t\tdirectoryNames = append(directoryNames, localfile.RemotePath)\n\t\t\tdirectoryMappingMap[localfile.RemotePath] = localfile\n\t\t}\n\t}\n\n\t// Now sort the directories by name, which ensures that the parent of each\n\t// directory is available if we need to create its children.\n\tsort.Strings(directoryNames)\n\n\tprogressBar := pb.New64(nBytesToUpload).SetUnits(pb.U_BYTES)\n\tprogressBar.ShowBar = true\n\tprogressBar.Output = os.Stderr\n\tprogressBar.Start()\n\n\tnUploadErrors := int32(0)\n\n\t// And finally sync the directories, which serves to create any missing ones.\n\tfor _, dirName := range directoryNames {\n\t\tfile := directoryMappingMap[dirName]\n\t\terr = syncFileUp(file, encrypt, existingFiles, progressBar)\n\t\tif err != nil {\n\t\t\tnUploadErrors++\n\t\t\tprintErrorAndExit(fmt.Errorf(\"skicka: %s: %v\\n\", file.LocalPath, err))\n\t\t}\n\t\tupdateActiveMemory()\n\t}\n\ttimeDelta(\"Create Google Drive directories\")\n\n\t// And finally actually update the files that look like they need it.\n\t// Because round-trips to the Drive APIs take a while, we kick off multiple\n\t// worker jobs to do the updates. (However, we don't want too have too\n\t// many workers; this would both lead to lots of 403 rate limit\n\t// errors as well as possibly increase memory use too much if we're\n\t// uploading lots of large files...)\n\tnWorkers := 4\n\n\t// Create a channel that holds indices into the filesToSync array for\n\t// the workers to consume.\n\tindexChan := make(chan int)\n\tdoneChan := make(chan int)\n\n\tuploadWorker := func() {\n\t\tfor {\n\t\t\tindex := <-indexChan\n\t\t\tif index < 0 {\n\t\t\t\tdebug.Printf(\"Worker got index %d; exiting\", index)\n\t\t\t\tdoneChan <- 1\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tlocalFile := fileMappings[index]\n\n\t\t\terr = syncFileUp(localFile, encrypt, existingFiles, progressBar)\n\t\t\tif err != nil {\n\t\t\t\tatomic.AddInt32(&nUploadErrors, 1)\n\t\t\t\tfmt.Fprintf(os.Stderr, \"skicka: %s: %v\\n\",\n\t\t\t\t\tlocalFile.LocalPath, err)\n\t\t\t}\n\t\t\tupdateActiveMemory()\n\t\t}\n\t}\n\n\t// Launch the workers.\n\tfor i := 0; i < nWorkers; i++ {\n\t\tgo uploadWorker()\n\t}\n\t// Communicate the indices of the entries in the localFiles[] array\n\t// to be processed by the workers.\n\tfor index, file := range fileMappings {\n\t\tif !file.LocalFileInfo.IsDir() {\n\t\t\tindexChan <- index\n\t\t}\n\t}\n\t// -1 signifies \"no more work\"; workers exit when they see this.\n\tfor i := 0; i < nWorkers; i++ {\n\t\tindexChan <- -1\n\t}\n\t// Wait for all of the workers to finish.\n\tfor i := 0; i < nWorkers; i++ {\n\t\t<-doneChan\n\t}\n\tprogressBar.Finish()\n\n\ttimeDelta(\"Sync files\")\n\n\tif nUploadErrors == 0 {\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"%d files not uploaded due to errors\", nUploadErrors)\n}" ]
[ "0.6680358", "0.602391", "0.57765335", "0.5678034", "0.5564744", "0.55118626", "0.5504865", "0.5477009", "0.5462354", "0.54434687", "0.54375553", "0.54249734", "0.5424158", "0.53969073", "0.5366358", "0.5366358", "0.5363845", "0.5360529", "0.5357023", "0.5355839", "0.5343172", "0.5339702", "0.5338103", "0.5326292", "0.5325198", "0.532063", "0.52894306", "0.5288342", "0.52788675", "0.52781504", "0.5253367", "0.52507514", "0.5248301", "0.5237444", "0.5224132", "0.5219741", "0.5216028", "0.5208887", "0.5197255", "0.5192053", "0.5190576", "0.5181615", "0.5134196", "0.5126793", "0.51235276", "0.51210403", "0.51048684", "0.510448", "0.5101829", "0.50961816", "0.50961035", "0.50951356", "0.50797796", "0.5071833", "0.5071784", "0.50581723", "0.5056809", "0.5052043", "0.50409126", "0.5032487", "0.50296545", "0.5020773", "0.50176334", "0.501297", "0.5008234", "0.5005466", "0.5004241", "0.49955553", "0.49850255", "0.49850014", "0.49837828", "0.49795732", "0.49745664", "0.4959061", "0.49556765", "0.495261", "0.49506605", "0.49353275", "0.49344745", "0.4927393", "0.4913637", "0.49092305", "0.490849", "0.48986077", "0.48970205", "0.4894631", "0.48939043", "0.48773363", "0.4873609", "0.48724434", "0.48697412", "0.48563161", "0.485475", "0.48534203", "0.48499575", "0.4836552", "0.48345098", "0.4827826", "0.48230964", "0.48138914" ]
0.8269777
0
RegisterHandler registers a file descriptor with the Poller and returns a Pollable which can be used for reading/writing as well as readiness notification. File descriptors registered with the poller will be placed into nonblocking mode.
func (p *Poller) RegisterHandler(fd uintptr, h EventHandler, data interface{}) (*Pollable, error) { if err := syscall.SetNonblock(int(fd), true); err != nil { return nil, err } return p.register(fd, h, data) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewPoller() (*Epoll, error) {\n\treturn NewPollerWithBuffer(128)\n}", "func (h *Handler) AddPoller(c echo.Context) error {\n\tid := c.Param(\"id\")\n\trequest := &PollerRequest{}\n\tvar err error\n\tif err = c.Bind(request); err != nil {\n\t\treturn err\n\t}\n\tp := &poller.Poller{}\n\tp.UUID = uuid.NewV4().String()\n\tp.Action = request.Action\n\tp.Driver = &particleio.ParticleIO{\n\t\tUUID: p.UUID,\n\t\tDeviceID: request.DeviceID,\n\t\tAccessToken: request.AccessToken,\n\t}\n\tp.PollInterval, err = time.ParseDuration(request.PollInterval)\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.IsPolling = request.IsPolling\n\tp.User = id\n\n\tdb := h.DB.Clone()\n\tdefer db.Close()\n\n\tif err := db.DB(\"oxylus\").C(\"pollers\").Insert(&p); err != nil {\n\t\treturn err\n\t}\n\t// if ispolling then send the poller to the registry\n\t// turn this into a channel\n\th.PollerRegistry.Add(p.UUID, p)\n\treturn c.NoContent(http.StatusCreated)\n}", "func New() *PollerRegistry {\n\treturn &PollerRegistry{\n\t\tRegistry: make(map[string]*poller.Poller),\n\t\tToDB: make(chan interface{}),\n\t\tUpdateStatus: make(chan string),\n\t}\n}", "func (w *filePoller) Add(name string) error {\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\n\tif w.closed {\n\t\treturn errPollerClosed\n\t}\n\n\tf, err := os.Open(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfi, err := os.Stat(name)\n\tif err != nil {\n\t\tf.Close()\n\t\treturn err\n\t}\n\n\tif w.watches == nil {\n\t\tw.watches = make(map[string]chan struct{})\n\t}\n\tif _, exists := w.watches[name]; exists {\n\t\tf.Close()\n\t\treturn fmt.Errorf(\"watch exists\")\n\t}\n\tchClose := make(chan struct{})\n\tw.watches[name] = chClose\n\n\tgo w.watch(f, fi, chClose)\n\treturn nil\n}", "func (r *Raft) RegisterHandler() {\n\tmux := http.NewServeMux()\n\n\tmux.HandleFunc(\"/health\", r.serveHealth)\n\tmux.HandleFunc(\"/askVote\", r.sendRequestVoteReply)\n\tmux.HandleFunc(\"/heartbeatPluslog\", r.serveHeartbeatPluslog)\n\n\tr.server = &http.Server{\n\t\tAddr: fmt.Sprintf(\":%d\", r.config.Server.Port),\n\t\tHandler: mux,\n\t}\n}", "func NewPoller(poll PollerFunc, interval time.Duration) *Poller {\n\treturn &Poller{\n\t\tChannel: make(chan interface{}),\n\t\tPoll: poll,\n\t\tWaitInterval: interval,\n\t\tisStopped: false,\n\t\tisFinished: false,\n\t\tgroup: &sync.WaitGroup{},\n\t\tstopMutex: &sync.Mutex{},\n\t}\n}", "func NewPoller(getFunc GetFunc, period time.Duration, store Store) *Poller {\n\treturn &Poller{\n\t\tgetFunc: getFunc,\n\t\tperiod: period,\n\t\tstore: store,\n\t}\n}", "func Watch(specfile, dir string, fallback http.Handler, stderr io.Writer) *Handler {\n\tif stderr == nil {\n\t\tstderr = ioutil.Discard\n\t}\n\th := &Handler{\n\t\tspecfile: specfile,\n\t\tdir: dir,\n\t\tfallback: fallback,\n\t\tstderr: stderr,\n\t\tlogger: log.New(stderr, \"\", log.LstdFlags),\n\t}\n\tgo func() {\n\t\th.mend()\n\t\ttime.AfterFunc(time.Second/5, func() {\n\t\t\th.OnChange()\n\t\t})\n\t\th.watch()\n\t}()\n\treturn h\n}", "func NewPoller() *Poller {\n\treturn &Poller{}\n}", "func New() (*Poller, error) {\n\tfd, err := unix.EpollCreate1(unix.EPOLL_CLOEXEC)\n\tif err != nil {\n\t\terr = os.NewSyscallError(\"epoll_create1\", err)\n\t\tlog.WithError(err).Error(\"failed to create an epoll instance\")\n\t\treturn nil, err\n\t}\n\n\tp := &Poller{\n\t\tepfd: fd,\n\t}\n\n\treturn p, nil\n}", "func (c *Client) RegisterHandler(n string, h EventHandler) {\n var handlers []EventHandler\n\n reg, ok := c.Subscribers.Load(n)\n\n if ok {\n handlers = reg.([]EventHandler)\n }\n\n handlers = append(handlers, h)\n c.Subscribers.Store(n, handlers)\n}", "func NewWatcher(bufsize, sysBufSize int, sleepTime time.Duration, fn func([]*WatchEvent),\n) (w *Watcher, err error) {\n\tfd, err := syscall.InotifyInit()\n\tif err != nil {\n\t\treturn\n\t}\n\tif fd == -1 {\n\t\terr = os.NewSyscallError(\"inotify_init\", err)\n\t\treturn\n\t}\n\tif useNonBlock {\n\t\tsyscall.SetNonblock(fd, true)\n\t}\n\tw = &Watcher{\n\t\tfd: fd,\n\t\tfn: fn,\n\t\tev: make(chan []*WatchEvent, bufsize),\n\t\twds: make(map[int32]string),\n\t\tflags: make(map[string]uint32),\n\t\tsl: sleepTime,\n\t\tsysbufsize: sysBufSize,\n\t}\n\tgo w.readEvents()\n\tgo w.handleEvents()\n\treturn\n}", "func New(pattern string) *Handler {\n\trhandlerm.Lock()\n\tdefer rhandlerm.Unlock()\n\n\t_, exists := rhandlers[pattern]\n\tif exists {\n\t\tpanic(\"handler `\" + pattern + \"` already exists\")\n\t}\n\n\th := &Handler{\n\t\tpattern: pattern,\n\t\twstrings: make(chan wstring, 1),\n\t\twints: make(chan wint, 1),\n\t}\n\trhandlers[pattern] = h\n\twhandlers <- h\n\n\treturn h\n}", "func (d *Daemon) RegisterHandler(fun HandlerFunc) {\n\td.handlers = append(d.handlers, fun)\n}", "func RegisterHandler(cb Callback) *Job {\n var job = &Job{\n\t\tcb: cb,\n\t\ttimestamp: -1,\n }\n\n\thandlerQueue.Push(job)\n\treturn job\n}", "func NewPoller(url string, interval time.Duration, out chan PollMsg, shutdown chan *sync.WaitGroup) *Poller {\n\treturn &Poller{\n\t\tURL: url,\n\t\tInterval: interval,\n\t\tOut: out,\n\t\tShutdown: shutdown,\n\t}\n}", "func NewFilePoller(ctx context.Context, f FileChannel, pollTimeout time.Duration) *FilePoller {\n\treturn &FilePoller{File: f, ctx: ctx, pollTimeout: pollTimeout}\n}", "func (l *Loader) NewWatcher(done <-chan struct{}) <-chan error {\n\tif !l.watcher {\n\t\treturn nil\n\t}\n\tupdate := make(chan error)\n\tw := watcher{}\n\tgo w.watcher(l.filename, done, update)\n\treturn update\n}", "func Listen(pattern string, f func(*Response)) Handler {\n\treturn Handler{\n\t\tMethod: PublicMsg,\n\t\tPattern: pattern,\n\t\tRun: f,\n\t}\n}", "func NewWatcher(file string, deadTime time.Duration) (*Watcher, error) {\n\tfileToWatch, err := filepath.Abs(file)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Couldn't get absolute path of file. \" + err.Error())\n\t}\n\tdirectoryToWatch := filepath.Dir(fileToWatch)\n\n\tw := Watcher{\n\t\tC: make(chan struct{}),\n\t\tstopChan: make(chan struct{}),\n\t}\n\n\twatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\treturn nil, errors.New(\"Couldn't establish watcher. \" + err.Error())\n\t}\n\n\tgo func() {\n\t\tt := time.NewTimer(deadTime)\n\t\ttimerRunning := true\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := <-watcher.Events:\n\t\t\t\t// Received an event. Check it's for our file.\n\t\t\t\teventFile, evErr := filepath.Abs(event.Name)\n\t\t\t\tif evErr != nil || eventFile != fileToWatch {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// It's for our file so stop and restart the timer.\n\t\t\t\tif timerRunning {\n\t\t\t\t\tif !t.Stop() {\n\t\t\t\t\t\t// empty the timer chan if we failed to stop it\n\t\t\t\t\t\t<-t.C\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tt.Reset(deadTime)\n\t\t\t\ttimerRunning = true\n\t\t\tcase watcherErr := <-watcher.Errors:\n\t\t\t\tlog.Println(\"Throttled Watcher error:\", watcherErr)\n\t\t\tcase <-t.C:\n\t\t\t\ttimerRunning = false\n\t\t\t\tw.C <- struct{}{}\n\t\t\tcase <-w.stopChan:\n\t\t\t\tif timerRunning {\n\t\t\t\t\tt.Stop()\n\t\t\t\t}\n\t\t\t\twatcher.Close()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\terr = watcher.Add(directoryToWatch)\n\tif err != nil {\n\t\tw.stopChan <- struct{}{}\n\t\treturn nil, errors.New(\"Couldn't watch directory. \" + err.Error())\n\t}\n\n\treturn &w, nil\n\n}", "func RegisterHandler() {\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, os.Interrupt, syscall.SIGTERM)\n\tgo func() {\n\t\t<-c\n\t\tdoneMu.Lock()\n\t\tdone = true\n\t\tdoneMu.Unlock()\n\t}()\n}", "func NewPollerWithBuffer(count int) (*Epoll, error) {\n\tfd, err := unix.EpollCreate1(0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Epoll{\n\t\tfd: fd,\n\t\tlock: &sync.RWMutex{},\n\t\tconns: make(map[int]net.Conn),\n\t\tconnbuf: make([]net.Conn, count, count),\n\t\tevents: make([]unix.EpollEvent, count, count),\n\t}, nil\n}", "func New[T any](pl exported.Pipeline, resp *http.Response) (*Poller[T], error) {\n\tif resp == nil {\n\t\tlog.Write(log.EventLRO, \"Resuming Core-Fake-Poller poller.\")\n\t\treturn &Poller[T]{pl: pl}, nil\n\t}\n\n\tlog.Write(log.EventLRO, \"Using Core-Fake-Poller poller.\")\n\tfakeStatus := resp.Header.Get(shared.HeaderFakePollerStatus)\n\tif fakeStatus == \"\" {\n\t\treturn nil, errors.New(\"response is missing Fake-Poller-Status header\")\n\t}\n\n\tctxVal := resp.Request.Context().Value(shared.CtxAPINameKey{})\n\tif ctxVal == nil {\n\t\treturn nil, errors.New(\"missing value for CtxAPINameKey\")\n\t}\n\n\tapiName, ok := ctxVal.(string)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"expected string for CtxAPINameKey, the type was %T\", ctxVal)\n\t}\n\n\tqp := \"\"\n\tif resp.Request.URL.RawQuery != \"\" {\n\t\tqp = \"?\" + resp.Request.URL.RawQuery\n\t}\n\n\tp := &Poller[T]{\n\t\tpl: pl,\n\t\tresp: resp,\n\t\tAPIName: apiName,\n\t\t// NOTE: any changes to this path format MUST be reflected in SanitizePollerPath()\n\t\tFakeURL: fmt.Sprintf(\"%s://%s%s%s%s\", resp.Request.URL.Scheme, resp.Request.URL.Host, resp.Request.URL.Path, lroStatusURLSuffix, qp),\n\t\tFakeStatus: fakeStatus,\n\t}\n\treturn p, nil\n}", "func (this *PollDriver) Add(fd int, mode PollMode) error {\n\tvar already bool\n\n\t// Make this method exclusive\n\tthis.lock.Lock()\n\tdefer this.lock.Unlock()\n\n\t// Set up the event structure\n\tthis.ctlEvent.Fd = int32(fd)\n\tthis.ctlEvent.Events, already = this.events[fd]\n\n\tswitch mode {\n\tcase POLL_MODE_READ:\n\t\tthis.ctlEvent.Events |= POLL_READFLAGS\n\tcase POLL_MODE_WRITE:\n\t\tthis.ctlEvent.Events |= POLL_WRITEFLAGS\n\tdefault:\n\t\treturn pollErrInvalidMode\n\t}\n\n\t// Modify or add poll\n\tvar op int\n\tif already {\n\t\top = syscall.EPOLL_CTL_MOD\n\t} else {\n\t\top = syscall.EPOLL_CTL_ADD\n\t}\n\n\t// System call\n\tif err := syscall.EpollCtl(this.handle, op, fd, &this.ctlEvent); err != nil {\n\t\treturn os.NewSyscallError(\"epoll_ctl\", err)\n\t}\n\n\t// Record the events we're interested in\n\tthis.events[fd] = this.ctlEvent.Events\n\n\t// return success\n\treturn nil\n}", "func (s *Server) Register(path string, handler HandlerFunc) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\ts.handlers[path] = handler\n}", "func (w *Watcher) Register(cb func(bts []byte)) {\n\tw.writeCallback = cb\n}", "func Poller(in <-chan *Resource, out chan<- *Resource, status chan<- State) {\n\tfor r := range in {\n\t\ts := r.Poll()\n\t\tstatus <- State{r.url, s}\n\t\tout <- r\n\t}\n}", "func (h *BasicHost) RegisterProtocol(\n\tpid common.Pid,\n\thandler ProtocolHandler,\n\tadapters ...ProtocolAdapter,\n) {\n\th.host.SetStreamHandler(pid.ProtocolID(), func(stream net.Stream) {\n\t\tdefer stream.Reset()\n\t\tmsg, err := common.ReadMessage(stream)\n\t\tif err != nil {\n\t\t\tlog.Println(\"failed to read message from stream :\", err)\n\t\t\treturn\n\t\t}\n\t\tgo handler.Handle(adapters...)(msg)\n\t})\n}", "func (p *Poller) Watch(processEventFn func(fd int, eFlags uint32) error) error {\n\tif p == nil {\n\t\treturn errors.New(\"nil poller\")\n\t}\n\n\tevents := make([]unix.EpollEvent, 100)\n\n\tfor {\n\t\teventsGot, err := unix.EpollWait(p.epfd, events, -1)\n\t\tif err != nil {\n\t\t\tif err == unix.EINTR {\n\t\t\t\t// No connections are ready for read or write, try again\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\terr = os.NewSyscallError(\"epoll_wait\", err)\n\t\t\tlog.WithError(err).Errorf(\"failed to watch on epoll fd: %d\", p.epfd)\n\t\t\treturn err\n\t\t}\n\n\t\tevents = events[:eventsGot]\n\n\t\tfor _, e := range events {\n\t\t\terr = processEventFn(int(e.Fd), e.Events)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "func (e *epoll) AddWatcher(fd int, events uint32, cb interface{}, p interface{}) error {\n\t_, ok := e.callbacks[fd]\n\tif !ok {\n\t\te.callbacks[fd] = epollEvent{fun: cb, param: p}\n\t} else {\n\t\treturn errors.New(\"epoll duplicated watch fd\")\n\t}\n\n\terr := syscall.EpollCtl(e.efd, syscall.EPOLL_CTL_ADD, fd, &syscall.EpollEvent{Events: events, Fd: int32(fd)})\n\tif err != nil {\n\t\tdelete(e.callbacks, fd)\n\t\treturn err\n\t}\n\treturn err\n}", "func NewPoller() *Poller {\n\treturn &Poller{\n\t\tinterval: DefaultPollingInterval,\n\t}\n}", "func (c *Client) RegisterWatcher(ctx context.Context, req *pdpb.RegisterWatcherReq) (*pdpb.RegisterWatcherRsp, error) {\n\trsp, err := c.proxyRPC(ctx,\n\t\treq,\n\t\tfunc() {\n\t\t\treq.From = c.name\n\t\t\treq.ID = c.seq\n\t\t},\n\t\tfunc(cc context.Context) (interface{}, error) {\n\t\t\treturn c.pd.RegisterWatcher(cc, req, grpc.FailFast(true))\n\t\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn rsp.(*pdpb.RegisterWatcherRsp), nil\n}", "func NewWriteHandler(logger log.Logger, reg prometheus.Registerer, appendable storage.Appendable) http.Handler {\n\th := &writeHandler{\n\t\tlogger: logger,\n\t\tappendable: appendable,\n\n\t\tsamplesWithInvalidLabelsTotal: prometheus.NewCounter(prometheus.CounterOpts{\n\t\t\tNamespace: \"prometheus\",\n\t\t\tSubsystem: \"api\",\n\t\t\tName: \"remote_write_invalid_labels_samples_total\",\n\t\t\tHelp: \"The total number of remote write samples which contains invalid labels.\",\n\t\t}),\n\t}\n\tif reg != nil {\n\t\treg.MustRegister(h.samplesWithInvalidLabelsTotal)\n\t}\n\treturn h\n}", "func pollHandler(ctx *router.Context) {\n\tc, w := ctx.Context, ctx.Writer\n\tif err := poll(c, config.LuciConfigServer); err != nil {\n\t\tlogging.WithError(err).Errorf(c, \"Failed to poll.\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n}", "func RegisterHandler(pattern string, handler http.Handler) {\n\tregisterHandler(pattern, handler, patternHandlers, PatternMuxer)\n}", "func (s *Server) RegisterHandler(pattern string, handler http.Handler, secure bool) {\n\ts.mux.Handle(\n\t\tpattern,\n\t\ts.HandlerChain(\n\t\t\thandler,\n\t\t\tsecure,\n\t\t),\n\t)\n}", "func NewWatcher(filename string) Watcher {\n\treturn &watchImpl{filename: filename}\n}", "func (h *Hub) CreateHandler() func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) {\n\treturn func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) {\n\t\tconn, err := upgrader.Upgrade(w, r, nil)\n\t\tif err != nil {\n\t\t\th.log.Error().Err(err).Msg(\"Failed to upgrade websocket connection\")\n\t\t\treturn\n\t\t}\n\t\t// Create and register client\n\t\tc := &client{hub: h, conn: conn, send: make(chan []byte, 256)}\n\t\th.register <- c\n\n\t\t// read & write in go routines.\n\t\tgo c.writePump()\n\t\tgo c.readPump()\n\t}\n}", "func RegisterWatcher(cb func(key Subsystem, err error)) (unregister func()) {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\thandle := new(watchHandle)\n\twatchers[handle] = cb\n\tif timer == nil {\n\t\ttimer = time.AfterFunc(time.Minute, timerSelfCheck)\n\t}\n\treturn func() {\n\t\tmu.Lock()\n\t\tdefer mu.Unlock()\n\t\tdelete(watchers, handle)\n\t\tif len(watchers) == 0 && timer != nil {\n\t\t\ttimer.Stop()\n\t\t\ttimer = nil\n\t\t}\n\t}\n}", "func (p *StreamingEndpointsCreatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "func New(handler http.Handler) backend.CallResourceHandler {\n\treturn &httpResourceHandler{\n\t\thandler: handler,\n\t}\n}", "func NewHandler(f func(*Message), path string, description ...string) *Handler {\n\thandler := &Handler{f: f}\n\thandler.variables, handler.pattern = parse(path)\n\tif len(description) > 0 {\n\t\thandler.description = description[0]\n\t}\n\treturn handler\n}", "func (m *FPGADevicePluginServer) Register(kubeletEndpoint, resourceName string) error {\n\tconn, err := grpc.Dial(kubeletEndpoint, grpc.WithInsecure(),\n\t\tgrpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {\n\t\t\treturn net.DialTimeout(\"unix\", addr, timeout)\n\t\t}))\n\n\tif err != nil {\n\t\tlog.Debugf(\"Cann't connect to kubelet service\")\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tclient := pluginapi.NewRegistrationClient(conn)\n\treqt := &pluginapi.RegisterRequest{\n\t\tVersion: pluginapi.Version,\n\t\tEndpoint: path.Base(m.socket),\n\t\tResourceName: resourceName,\n\t}\n\n\t_, err = client.Register(context.Background(), reqt)\n\tif err != nil {\n\t\tlog.Debugf(\"Cann't register to kubelet service\")\n\t\treturn err\n\t}\n\treturn nil\n}", "func NewHandler(handler HandlerFunc) *Handler {\n\tph := &Handler{panicChan: make(chan Info), handle: handler, mu: &sync.Mutex{}, quit: make(chan struct{})}\n\tgo ph.listen()\n\treturn ph\n}", "func Register(id int, handlerName string) int", "func (p *Parallel) Register(f interface{}, args ...interface{}) *Handler {\n\treturn p.NewPipeline().Register(f, args...)\n}", "func RegistrationHandler(cr *ConnectionRegistry) http.HandlerFunc {\n\treturn func(writer http.ResponseWriter, request *http.Request) {\n\n\t\t// websocket stuff\n\t\tws, err := upgrader.Upgrade(writer, request, nil)\n\t\tif err != nil {\n\t\t\thttp.Error(writer, err.Error(), 500)\n\t\t\treturn\n\t\t}\n\n\t\t// create new connection struct\n\t\tconn := NewConnection(request.URL.Query()[\"id\"][0], ConnConfig{\n\t\t\treceive: &broadcastChannel,\n\t\t})\n\n\t\t// register new connection\n\t\terr = cr.Save(conn)\n\t\tif err != nil {\n\t\t\thttp.Error(writer, err.Error(), 500)\n\t\t\treturn\n\t\t}\n\t\t// read/write loops to websocket; read bocks until closed\n\t\tconn.Start(ws)\n\t\t// Remove connection when closed\n\t\terr = cr.Remove(conn.ID)\n\t\tif err != nil {\n\t\t\thttp.Error(writer, err.Error(), 500)\n\t\t\treturn\n\t\t}\n\t}\n}", "func (srv *RegistryServer) RegisterEventHandler(ctx context.Context, handler *Handler) (*RegisterResponse, error) {\n\tvar err error\n\tout := new(RegisterResponse)\n\tfmt.Printf(\"Received a registration request \\n\")\n\t//Check there is no registration already from this server for this subject\n\tproxy := srv.registry.AlreadyRegisteredClientAndMessage(handler.ClientId, handler.MessageId)\n\tif proxy != nil {\n\t\tfmt.Printf(\"Received a registration request for the second time for client %s message %s\\n\", handler.ClientId, handler.MessageId)\n\t\t//Delete old registration and create new because chances are sequence number has changed so need\n\t\t//to pick up new sequnce number\n\t\tfmt.Printf(\"Deleting duplicate proxy..\")\n\t\tsrv.registry.DeleteProxy(handler.ClientId, handler.MessageId)\n\t\tfmt.Printf(\"Deleted duplicate proxy\")\n\t}\n\terr = srv.registry.AddNewProxy(handler)\n\n\treturn out, err\n}", "func NewWatcher() (*Watcher, error) {\n\t// Need to set nonblocking mode for SetDeadline to work, otherwise blocking\n\t// I/O operations won't terminate on close.\n\tfd, errno := unix.InotifyInit1(unix.IN_CLOEXEC | unix.IN_NONBLOCK)\n\tif fd == -1 {\n\t\treturn nil, errno\n\t}\n\n\tw := &Watcher{\n\t\tfd: fd,\n\t\tinotifyFile: os.NewFile(uintptr(fd), \"\"),\n\t\twatches: newWatches(),\n\t\tEvents: make(chan Event),\n\t\tErrors: make(chan error),\n\t\tdone: make(chan struct{}),\n\t\tdoneResp: make(chan struct{}),\n\t}\n\n\tgo w.readEvents()\n\treturn w, nil\n}", "func New(p *Page) (Poller, error) {\n\tid := \"\"\n\tl := log.With().Str(\"func\", \"poller.New\").Logger()\n\n\tif p.ID != nil && len(*p.ID) > 0 {\n\t\tid = *p.ID\n\t} else {\n\t\tid = randomdata.SillyName()\n\t\tl.Info().Msg(\"generating random name...\")\n\t}\n\tl = l.With().Str(\"id\", id).Logger()\n\n\t// -- Validation\n\tmethod, err := parseHTTPMethod(p.Method)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tparsedURL, err := parseURL(p.URL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// -- Set ups\n\trandomFrequency, ticks, offset := parsePollOptions(id, p.PollOptions)\n\tif randomFrequency {\n\t\tticks = nextRandomTick(ticks-offset, ticks+offset)\n\t}\n\n\trandUA, userAgents := parseUserAgentOptions(id, p.UserAgentOptions)\n\n\theaders := http.Header{}\n\tif p.Headers == nil {\n\t\tl.Warn().Msg(\"no headers provided\")\n\t} else {\n\t\tfor headerKey, headerVal := range p.Headers {\n\t\t\theaders[headerKey] = []string{headerVal}\n\t\t}\n\t\tswitch hlen := len(p.Headers); {\n\t\tcase hlen == 0:\n\t\t\tl.Warn().Msg(\"no headers provided\")\n\t\tcase hlen < 3:\n\t\t\tl.Warn().Msg(\"few headers provided\")\n\t\t}\n\t}\n\n\thttpClient := &http.Client{\n\t\tTimeout: time.Duration(defaultHTTPClientTimeout) * time.Second,\n\t\tCheckRedirect: func(req *http.Request, via []*http.Request) error {\n\t\t\treturn http.ErrUseLastResponse\n\t\t},\n\t}\n\tif p.FollowRedirect {\n\t\thttpClient.CheckRedirect = nil\n\t}\n\n\trequest, err := http.NewRequestWithContext(context.Background(), method, parsedURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trequest.Header = headers\n\n\t// -- Complete and return\n\treturn &pagePoller{\n\t\tid: id,\n\t\thttpClient: httpClient,\n\t\trequest: request,\n\t\tuserAgents: userAgents,\n\t\tticks: ticks,\n\t\trandTick: randomFrequency,\n\t\toffsetRange: offset,\n\t\tlastUAIndex: -1,\n\t\trandUa: randUA,\n\t}, nil\n}", "func (d *dumper) RegisterHandler(h Handler) {\n\tname := h.Name()\n\t_, duplicate := d.handlers[name]\n\td.handlers[name] = h\n\n\tif duplicate {\n\t\tfor _, spec := range d.methods {\n\t\t\tif spec.handler == name {\n\t\t\t\tspec.h = h\n\t\t\t}\n\t\t}\n\n\t\tfor _, spec := range d.regexps {\n\t\t\tif spec.handler == name {\n\t\t\t\tspec.h = h\n\t\t\t}\n\t\t}\n\t}\n}", "func NewDispatcher(handler Handler, waiter Waiter, config *DispatcherConfig) *Dispatcher {\n\tif config == nil {\n\t\tconfig = defaultDispatcherConfig\n\t}\n\n\tpool := make(chan chan RetryJob, config.MaxWorkers)\n\treturn &Dispatcher{\n\t\tWorkerPool: pool,\n\t\tConfig: config,\n\t\thandler: handler,\n\t\twaiter: waiter,\n\t}\n}", "func (d Dependency) NewHandler() operations.V1ReadHelloStatusHandlerFunc {\n\tif d.ContextCreator == nil {\n\t\tlogger.Fatalf(nil, \"context creator not set for Dependency\")\n\t}\n\tif d.Storage == nil {\n\t\tlogger.Fatalf(nil, \"storage not set for Dependency\")\n\t}\n\n\treturn func(params operations.V1ReadHelloStatusParams) middleware.Responder {\n\t\tctx := d.ContextCreator.Create(params.HTTPRequest)\n\t\treturn d.handle(ctx, params)\n\t}\n}", "func ListenAndRegister(c context.Context, l *Listener, reg *Registry, fn func(d device.D) error) error {\n\tfor {\n\t\tdh, err := l.Accept(c)\n\t\tif err != nil {\n\t\t\t// Note: may be a Context cancellation / deadline.\n\t\t\treturn err\n\t\t}\n\t\tif d, isNew := reg.Observe(dh); isNew && fn != nil {\n\t\t\tif err := fn(d); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "func (p *Poller) Start() {\n\tgo func(url string, interval time.Duration, out chan<- PollMsg, shutdown <-chan *sync.WaitGroup) {\n\t\twg := &sync.WaitGroup{}\n\t\tdefer func() {\n\t\t\twg.Done()\n\t\t}()\n\n\t\tticker := time.NewTicker(interval)\n\t\tmsg := PollMsg{}\n\t\tresp, err := http.Get(url)\n\t\tif err != nil {\n\t\t\tmsg.Error = append(msg.Error, err)\n\t\t}\n\n\t\tdata, err2 := ioutil.ReadAll(resp.Body)\n\t\tif err2 != nil {\n\t\t\tmsg.Error = append(msg.Error, err2)\n\t\t}\n\n\t\tmsg.Payload = data\n\t\tout <- msg\n\n\t\tresp.Body.Close()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase wg = <-shutdown:\n\t\t\t\treturn\n\t\t\tcase <-ticker.C:\n\t\t\t\tmsg := PollMsg{}\n\t\t\t\tresp, err := http.Get(url)\n\t\t\t\tif err != nil {\n\t\t\t\t\tmsg.Error = append(msg.Error, err)\n\t\t\t\t}\n\n\t\t\t\tdata, err2 := ioutil.ReadAll(resp.Body)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\tmsg.Error = append(msg.Error, err2)\n\t\t\t\t}\n\n\t\t\t\tmsg.Payload = data\n\t\t\t\tout <- msg\n\n\t\t\t\tresp.Body.Close()\n\t\t\t}\n\t\t}\n\t}(p.URL, p.Interval, p.Out, p.Shutdown)\n}", "func poll(f *os.File) error {\n\tconst (\n\t\tevents = 0x001 // POLLIN\n\t\ttimeout = -1 // TSS2_TCTI_TIMEOUT_BLOCK=-1; block indefinitely until data is available\n\t)\n\tpollFds := []unix.PollFd{\n\t\t{Fd: int32(f.Fd()), Events: events},\n\t}\n\t_, err := unix.Poll(pollFds, timeout)\n\treturn err\n}", "func (p *Poller) Poll(ctx context.Context, pf PollFunc) (interface{}, error) {\n\tif p.timeout > 0 {\n\t\tctxWithTimeout, cancel := context.WithTimeout(ctx, p.timeout)\n\t\tdefer cancel()\n\t\tctx = ctxWithTimeout\n\t}\n\n\tticker := time.NewTicker(p.interval)\n\tdefer ticker.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tdone, res, err := pf(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif !done {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\treturn res, nil\n\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, ctx.Err()\n\t\t}\n\t}\n}", "func New(notifier *gobrake.Notifier) *Handler {\n\th := Handler{notifier}\n\treturn &h\n}", "func NewRegisterHandler(\n\tendpoint goa.Endpoint,\n\tmux goahttp.Muxer,\n\tdec func(*http.Request) goahttp.Decoder,\n\tenc func(context.Context, http.ResponseWriter) goahttp.Encoder,\n\teh func(context.Context, http.ResponseWriter, error),\n) http.Handler {\n\tvar (\n\t\tdecodeRequest = DecodeRegisterRequest(mux, dec)\n\t\tencodeResponse = EncodeRegisterResponse(enc)\n\t\tencodeError = EncodeRegisterError(enc)\n\t)\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get(\"Accept\"))\n\t\tctx = context.WithValue(ctx, goa.MethodKey, \"register\")\n\t\tctx = context.WithValue(ctx, goa.ServiceKey, \"mtd\")\n\t\tpayload, err := decodeRequest(r)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\teh(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tres, err := endpoint(ctx, payload)\n\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\teh(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif err := encodeResponse(ctx, w, res); err != nil {\n\t\t\teh(ctx, w, err)\n\t\t}\n\t})\n}", "func RegisterProxy(initialEntry *ServiceEntry, entries chan *ServiceEntry, iface *net.Interface) (*Server, error) {\n\ts, err := newServer(initialEntry, iface)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts.waitGroup.Add(1)\n\tgo s.mainloop(entries)\n\n\treturn s, nil\n}", "func New() (*FileWatcher, error) {\n\t// Create a new file watcher\n\twatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tf := &FileWatcher{\n\t\twatcher: watcher,\n\t\ttriggerClose: make(chan struct{}),\n\t}\n\n\t// Start the goroutine to watch the files\n\tgo func() {\n\t\tdefer f.watcher.Close()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := <-watcher.Events:\n\t\t\t\t// Skip if the event function is not defined\n\t\t\t\tif f.onEvent == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// Create a new event object\n\t\t\t\te := &Event{\n\t\t\t\t\tPath: event.Name,\n\t\t\t\t\tevent: &event,\n\t\t\t\t}\n\n\t\t\t\t// Call the callback in a safe way\n\t\t\t\tfunc() {\n\t\t\t\t\t// Recover panics and log the error\n\t\t\t\t\tdefer func() {\n\t\t\t\t\t\tif e := recover(); e != nil {\n\t\t\t\t\t\t\tlog.L.Error(\"filewatcher callback panic: %v\", e)\n\t\t\t\t\t\t}\n\t\t\t\t\t}()\n\n\t\t\t\t\tf.onEvent(e)\n\t\t\t\t}()\n\n\t\t\t\t// If a new folder was created, then add it to monitor recursive actions\n\t\t\t\tif e.IsCreate() {\n\t\t\t\t\tgo func() {\n\t\t\t\t\t\tif stat, err := os.Stat(e.Path); err == nil && stat.IsDir() {\n\t\t\t\t\t\t\terr = f.Add(e.Path)\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\tlog.L.Error(\"filewatcher: failed to add recursive directory: %v\", 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\n\t\t\t\t// We don't have to remove deleted directories from the watcher,\n\t\t\t\t// because they are removed automatically...\n\t\t\tcase err := <-watcher.Errors:\n\t\t\t\tlog.L.Error(\"a file watcher error occurred: %s\", err.Error())\n\t\t\tcase <-f.triggerClose:\n\t\t\t\t// Just exit the loop\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn f, nil\n}", "func NewHookHandler(cfg *config.Config) HookHandler {\n\tvar lock sync.Mutex\n\n\tvar handler HookHandler\n\thandler.lock = &lock\n\thandler.config = cfg\n\treturn handler\n}", "func (m *serverMessageHandlerManager) registerHandler(packetType gearman.PacketType, handler serverMessageHandler) {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\n\tm.handlers[packetType] = handler\n}", "func AddHandler(handler func()) {\n\t// Create the channel and start the main interrupt handler which invokes all other callbacks and exits if not\n\t// already done.\n\tif Chan == nil {\n\t\tChan = make(chan os.Signal, 1)\n\t\tsignal.Notify(Chan, Signals...)\n\t\tgo Listener()\n\t}\n\tAddHandlerChan <- handler\n}", "func (r *Replicator) RegisterWSHandler() *http.ServeMux {\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(fmt.Sprintf(ccommon.HTTPHandlerPattern, ccommon.EndpointOpenReplicationRemoteReadStream), r.OpenReplicationRemoteReadStreamHandler)\n\tmux.HandleFunc(fmt.Sprintf(ccommon.HTTPHandlerPattern, ccommon.EndpointOpenReplicationReadStream), r.OpenReplicationReadStreamHandler)\n\treturn mux\n}", "func New(dir string, conn *websocket.Conn) *Watcher {\n\treturn &Watcher{\n\t\tConn: conn,\n\t\tDir: dir,\n\t}\n}", "func NewHandleFunc(h func(*Client)) http.HandlerFunc {\n\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\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tserveWs(h, upgrader, w, r)\n\t}\n}", "func RegisterRegistryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {\n\treturn RegisterRegistryHandlerClient(ctx, mux, NewRegistryClient(conn))\n}", "func RegisterHandler(command string, handlerFunc HandlerFunc) {\n\thandlers[command] = handlerFunc\n}", "func (w *watcher) AddEventHandler(h ResourceEventHandler) {\n\tw.handler = h\n}", "func (api *API) RegisterHandler(path string, handler http.Handler) {\n\tapi.hasHandlers = true\n\thttp.Handle(path, api.RequireToken(handler.ServeHTTP))\n}", "func NewPollerJob(resourceUrl string) PollerJob{\n\treturn PollerJob{\n\t\tresourceUrl:resourceUrl,\n\t\tsuspend: make(chan bool),\n\t\tresume: make(chan bool),\n\t}\n}", "func makeWatcherInputHandler(serCh serverChannelsT) handlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif len(serCh.watcherInput) == maxBufferSize {\n\t\t\tw.WriteHeader(http.StatusServiceUnavailable)\n\t\t\tw.Write([]byte(\"Server too busy.\"))\n\t\t\treturn\n\t\t}\n\t\tbody, err := ioutil.ReadAll(r.Body)\n\t\treplyChan := make(chan []byte)\n\t\tserCh.watcherInput <- update.RawWatcherInputT{\n\t\t\tContent: body,\n\t\t\tReplyChan: replyChan,\n\t\t\tBodyReadErr: err,\n\t\t}\n\t\tresp := <-replyChan\n\t\tw.Write(resp)\n\t}\n}", "func (rl *RateLimiter) Handler(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\t// Make a new PluggableResponseWriter if we need to\n\t\tDebugOut.Printf(\"RateLimiter Pluggable ResponseWriter...\\n\")\n\t\trw, _ := prw.NewPluggableResponseWriterIfNot(w)\n\t\tdefer rw.Flush()\n\n\t\thttpError := tollbooth.LimitByRequest(rl.Limiter, rw, r)\n\t\tif httpError != nil {\n\t\t\tDebugOut.Printf(\"%s: %s\\n\", ErrRequestError{r, \"Request tripped limiter\"}.String(), r.RequestURI)\n\t\t\tif !rl.collectOnly {\n\t\t\t\trl.ExecOnLimitReached(rw, r)\n\t\t\t\trw.Header().Add(\"Content-Type\", rl.GetMessageContentType())\n\t\t\t\tsec := 1\n\t\t\t\tmax := rl.GetMax()\n\t\t\t\tif max < 1.0 && max > 0.0 {\n\t\t\t\t\tsec = int(math.Ceil(1.0 / max))\n\t\t\t\t}\n\t\t\t\trw.Header().Add(\"Retry-After\", fmt.Sprintf(\"%d\", sec))\n\t\t\t\trw.WriteHeader(httpError.StatusCode)\n\t\t\t\trw.Write([]byte(httpError.Message))\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tnext.ServeHTTP(rw, r)\n\t}\n\treturn http.HandlerFunc(fn)\n}", "func NewHandler() (*Handler, error) {\n\trdCloser, err := NewReaderCloser()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Handler{\n\t\treaderCloser: rdCloser,\n\t\tbufioReader: bufio.NewReader(rdCloser),\n\t}, nil\n}", "func (h *Handler) UpdatePoller(c echo.Context) error {\n\tid := c.Param(\"id\")\n\trequest := &PollerRequest{}\n\tvar err error\n\tif err = c.Bind(request); err != nil {\n\t\treturn err\n\t}\n\n\tdb := h.DB.Clone()\n\tdefer db.Close()\n\n\tnewInterval, err := time.ParseDuration(request.PollInterval)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tif err := db.DB(\"oxylus\").C(\"pollers\").Update(\n\t\tbson.M{\"uuid\": id},\n\t\tbson.M{\"$set\": bson.M{\n\t\t\t\"ispolling\": request.IsPolling,\n\t\t\t\"action\": request.Action,\n\t\t\t\"pollinterval\": newInterval}}); err != nil {\n\t\treturn err\n\t}\n\n\tif request.IsPolling {\n\t\tvar p poller.Poller\n\t\tif err := db.DB(\"oxylus\").C(\"pollers\").Find(bson.M{\"uuid\": id}).One(&p); err != nil {\n\t\t\treturn err\n\t\t}\n\t\th.PollerRegistry.Add(id, &p)\n\t} else {\n\t\th.PollerRegistry.Remove(id)\n\t}\n\n\treturn c.NoContent(http.StatusOK)\n}", "func (c *watchImpl) Watch(handler WatcherHandler) (chan struct{}, error) {\n\twatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := watcher.Add(path.Dir(c.filename)); err != nil {\n\t\treturn nil, err\n\t}\n\tstopCh := make(chan struct{}, 0)\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase err := <-watcher.Errors:\n\t\t\t\tgo handler.Error(err)\n\t\t\tcase ev := <-watcher.Events:\n\t\t\t\tif ev.Op&fsnotify.Write == fsnotify.Write || ev.Op&fsnotify.Create == fsnotify.Create {\n\t\t\t\t\tif ev.Name == c.filename {\n\t\t\t\t\t\tgo handler.Updated()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase <-stopCh:\n\t\t\t\twatcher.Close()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn stopCh, nil\n}", "func (e *Client) Register(ctx context.Context, filename string) error {\n\tconst action = \"/register\"\n\turl := e.baseURL + action\n\n\treqBody, err := json.Marshal(map[string]interface{}{\n\t\t\"events\": []EventType{Shutdown},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\thttpReq, err := http.NewRequestWithContext(ctx, \"POST\", url, bytes.NewBuffer(reqBody))\n\tif err != nil {\n\t\treturn err\n\t}\n\thttpReq.Header.Set(extensionNameHeader, filename)\n\thttpRes, err := e.httpClient.Do(httpReq)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif httpRes.StatusCode != 200 {\n\t\treturn fmt.Errorf(\"request failed with status %s\", httpRes.Status)\n\t}\n\tdefer httpRes.Body.Close()\n\te.extensionID = httpRes.Header.Get(extensionIdentiferHeader)\n\treturn nil\n}", "func RegisterFleaHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {\n\treturn RegisterFleaHandlerClient(ctx, mux, NewFleaClient(conn))\n}", "func makeRegisterHandler(endpoints endpoint.Endpoints, options []grpc.ServerOption) grpc.Handler {\n\treturn grpc.NewServer(endpoints.RegisterEndpoint, decodeRegisterRequest, encodeRegisterResponse, options...)\n}", "func makeRegisterHandler(endpoints endpoint.Endpoints, options []grpc.ServerOption) grpc.Handler {\n\treturn grpc.NewServer(endpoints.RegisterEndpoint, decodeRegisterRequest, encodeRegisterResponse, options...)\n}", "func (c *ListenConfig) Listen(path string) (net.Listener, error) {\n\th, err := makeServerPipeHandle(path, c.SecurityDescriptor, c, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tl := &pipeListener{\n\t\tfirstHandle: h,\n\t\tpath: path,\n\t\tconfig: *c,\n\t\tacceptCh: make(chan chan acceptResponse),\n\t\tcloseCh: make(chan int),\n\t\tdoneCh: make(chan int),\n\t}\n\t// The first connection is swallowed on Windows 7 & 8, so synthesize it.\n\tif maj, min, _ := windows.RtlGetNtVersionNumbers(); maj < 6 || (maj == 6 && min < 4) {\n\t\tpath16, err := windows.UTF16PtrFromString(path)\n\t\tif err == nil {\n\t\t\th, err = windows.CreateFile(path16, 0, 0, nil, windows.OPEN_EXISTING, windows.SECURITY_SQOS_PRESENT|windows.SECURITY_ANONYMOUS, 0)\n\t\t\tif err == nil {\n\t\t\t\twindows.CloseHandle(h)\n\t\t\t}\n\t\t}\n\t}\n\tgo l.listenerRoutine()\n\treturn l, nil\n}", "func NewHandler(mux *drpcmux.Mux, cb handlerFunc) *Handler {\n\tif cb == nil {\n\t\tcb = defaultHandlerFunc\n\t}\n\treturn &Handler{\n\t\tmux: mux,\n\t\tcb: cb,\n\t}\n}", "func (p PollingListener) ListenAndServe(handler Handler) {\n\tpollingURL := \"https://\" + path.Join(\"api.telegram.org/\", \"bot\"+p.Token, \"getUpdates\")\n\tpollingURL += \"?timeout=\" + strconv.Itoa(p.Timeout)\n\tvar offset = -1\nmainLoop:\n\tfor {\n\t\tselect {\n\t\tcase <-p.s:\n\t\t\tbreak mainLoop\n\t\tdefault:\n\t\t\tif resp, err := p.Client.Get(pollingURL + \"&offset=\" + strconv.Itoa(offset)); err == nil {\n\t\t\t\tvar result getResult\n\t\t\t\terr = json.NewDecoder(resp.Body).Decode(&result)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif !result.OK {\n\t\t\t\t\tlog.Println(\"Result not OK\")\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfor _, u := range result.Result {\n\t\t\t\t\toffset = u.UpdateID + 1\n\t\t\t\t\tgo handler.Handle(p.r, &u)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t}\n\t}\n}", "func NewWatcher(cfg WatcherConfig) (Watcher, error) {\n\tif cfg.PollInterval == 0 {\n\t\tcfg.PollInterval = DefaultPoolInterval\n\t}\n\n\tif len(cfg.Extensions) == 0 {\n\t\tcfg.Extensions = DefaultExtensions\n\t}\n\n\tallowedExts := make(map[string]bool)\n\tfor _, ext := range cfg.Extensions {\n\t\tallowedExts[\".\"+ext] = true\n\t}\n\n\twatchPaths, err := resolvePaths(cfg.WatchItems, allowedExts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tignorePaths, err := resolvePaths(cfg.IgnoreItems, allowedExts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlogger.Debugf(\"Resolved watch paths: %v\", watchPaths)\n\tlogger.Debugf(\"Resolved ignore paths: %v\", ignorePaths)\n\treturn &watcher{\n\t\tevents: make(chan string),\n\t\terrors: make(chan error),\n\t\tdefaultIgnore: cfg.DefaultIgnore,\n\t\tpollInterval: cfg.PollInterval,\n\t\twatchItems: watchPaths,\n\t\tignoreItems: ignorePaths,\n\t\tallowedExtensions: allowedExts,\n\t}, nil\n}", "func (e *Client) Register(ctx context.Context, filename string) (*RegisterResponse, error) {\n\tconst action = \"/register\"\n\turl := e.baseURL + action\n\n\treqBody, err := json.Marshal(map[string]interface{}{\n\t\t\"events\": []EventType{Invoke, Shutdown},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thttpReq, err := http.NewRequestWithContext(ctx, \"POST\", url, bytes.NewBuffer(reqBody))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thttpReq.Header.Set(extensionNameHeader, filename)\n\thttpRes, err := e.httpClient.Do(httpReq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif httpRes.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"request failed with status %s\", httpRes.Status)\n\t}\n\tdefer httpRes.Body.Close()\n\tbody, err := ioutil.ReadAll(httpRes.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres := RegisterResponse{}\n\terr = json.Unmarshal(body, &res)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\te.ExtensionID = httpRes.Header.Get(extensionIdentiferHeader)\n\tfmt.Println(\"Extension id:\", e.ExtensionID)\n\treturn &res, nil\n}", "func MountRegisterHandler(mux goahttp.Muxer, h http.Handler) {\n\tf, ok := 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(\"POST\", \"/v1/mtd/{state}\", f)\n}", "func (c *regularResourceComponent) Listen() {\n\tfor ev := range c.stream {\n\t\tif c.logicalID != ev.LogicalResourceID {\n\t\t\tcontinue\n\t\t}\n\t\tupdateComponentStatus(&c.mu, &c.statuses, cfnStatus{\n\t\t\tvalue: cloudformation.StackStatus(ev.ResourceStatus),\n\t\t\treason: ev.ResourceStatusReason,\n\t\t})\n\t\tupdateComponentTimer(&c.mu, c.statuses, c.stopWatch)\n\t}\n\tclose(c.done) // No more events will be processed.\n}", "func NewHandler(dial func(addr string) (*hdhomerun.Client, error)) http.Handler {\n\treturn &handler{\n\t\tdial: dial,\n\t}\n}", "func (c *Config) RegisterHandler(handler func(*Config)) error {\n\tc.handlers = append(c.handlers, handler)\n\treturn nil\n}", "func AddHandler(informer cache.SharedIndexInformer, kind string) workqueue.RateLimitingInterface {\n\trateLimiter := workqueue.DefaultControllerRateLimiter()\n\tqueue := workqueue.NewNamedRateLimitingQueue(rateLimiter, kind)\n\thandler := NewEventHandler(kind, queue)\n\tinformer.AddEventHandler(handler)\n\treturn queue\n}", "func NewHandler(newEventStream NewEventStreamHandler) *Handler {\n\treturn NewHandlerBuffered(newEventStream, 0)\n}", "func (r *Ready) Handler(ready http.Handler) http.HandlerFunc {\n\treturn func(rw http.ResponseWriter, req *http.Request) {\n\t\tselect {\n\t\tcase <-r.Notify():\n\t\t\tready.ServeHTTP(rw, req)\n\t\tdefault:\n\t\t\tr.unreadyHandler.ServeHTTP(rw, req)\n\t\t}\n\t}\n}", "func newWatcher(loader *Loader, uri string, interval time.Duration, onStop func()) *watcher {\n\treturn &watcher{\n\t\tstate: isCreated,\n\t\tupdatedAt: 0,\n\t\tloader: loader,\n\t\turi: uri,\n\t\tupdates: make(chan Update, 1),\n\t\tinterval: interval,\n\t\tonStop: onStop,\n\t}\n}", "func New(config config.ConnectorConfig) (http.Handler, error) {\n\tif config.URI == \"\" {\n\t\treturn nil, errors.Errorf(\"URI parameter missing in connector: %#v\", config)\n\t}\n\tif !strings.HasPrefix(config.URI, prefixURI) {\n\t\treturn nil, errors.Errorf(\"Invalid URI parameter in connector, expected '%s': %#v\", prefixURI, config)\n\t}\n\n\tdirectoryPath := strings.Replace(config.URI, prefixURI, \"\", 1)\n\tif directoryPath == \"\" {\n\t\treturn nil, errors.Errorf(\"Directory path is missing in URI parameter in connector: %#v\", config)\n\t}\n\n\tstat, err := os.Stat(directoryPath)\n\tif os.IsNotExist(err) {\n\t\treturn nil, errors.Errorf(\"Directory passed in URI parameter doesn't exists, connector: %#v\", config)\n\t}\n\tif !stat.Mode().IsDir() {\n\t\treturn nil, errors.Errorf(\"URI parameter doesn't point to directory, connector: %#v\", config)\n\t}\n\n\thandler := &directoryHandler{\n\t\tpathPrefix: config.PathPrefix,\n\t\tdirectoryPath: directoryPath,\n\t}\n\n\treturn handler, nil\n}", "func New(c *Config) (Poller, error) {\n\tcfg := c.withDefaults()\n\n\tkq, err := KqueueCreate(&KqueueConfig{\n\t\tOnWaitError: cfg.OnWaitError,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn poller{kq}, nil\n}", "func (l Listener) AddHandler(cmd string, handleFunc func()) {\n\tl[cmd] = handleFunc\n}", "func (h *Hook) Register() (*Hook, error) {\n\tvar err error\n\n\th.Registered = time.Now()\n\n\th.file, err = h.file.Set(h)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn h, nil\n}", "func NewHandler(dbFile string) (h *handler, err error) {\n\terr = os.MkdirAll(filepath.Dir(dbFile), 0755)\n\tif err != nil {\n\t\treturn\n\t}\n\th = &handler{messages: make(chan *message, 1000)}\n\th.db, err = bolt.Open(dbFile, 0600, &bolt.Options{Timeout: 30 * time.Second})\n\tif err != nil {\n\t\treturn\n\t}\n\terr = h.db.Update(func(tx *bolt.Tx) error {\n\t\t_, err := tx.CreateBucket([]byte(bucket))\n\t\treturn err\n\t})\n\tgo h.Loop()\n\treturn\n}", "func NewHandler(fp string, fs http.FileSystem, fc FragmentCache) http.Handler {\n\treturn &Handler{fs, fc, fp}\n}" ]
[ "0.5313639", "0.52643883", "0.5241936", "0.5210753", "0.5175671", "0.5104131", "0.50692457", "0.5018211", "0.49877605", "0.49037454", "0.48952135", "0.4866136", "0.48658457", "0.48586193", "0.48374307", "0.4825528", "0.4811092", "0.47992", "0.47865638", "0.47729722", "0.47683546", "0.47179824", "0.47160292", "0.46524936", "0.46094006", "0.45864248", "0.45845523", "0.45735663", "0.45729288", "0.45644724", "0.45465592", "0.45352122", "0.4533333", "0.4519817", "0.45181027", "0.4502073", "0.44853067", "0.44827312", "0.4471347", "0.44657597", "0.44426084", "0.44296148", "0.44282478", "0.44214135", "0.44180715", "0.44035763", "0.44017458", "0.43955633", "0.43909675", "0.43891147", "0.43710312", "0.43707806", "0.43690974", "0.4365585", "0.43570048", "0.4345989", "0.4344802", "0.4328955", "0.4326977", "0.43266746", "0.4321242", "0.4320471", "0.4308139", "0.4305433", "0.4301735", "0.42952874", "0.42890283", "0.4288398", "0.42882866", "0.42872873", "0.42843", "0.42839998", "0.4283628", "0.42797464", "0.42794615", "0.42787355", "0.42777225", "0.42763525", "0.42752668", "0.42706892", "0.42706892", "0.42694426", "0.42658764", "0.4262229", "0.42548355", "0.4254685", "0.4250533", "0.4248258", "0.42407474", "0.42386627", "0.42342764", "0.42321432", "0.42279097", "0.4227779", "0.42245352", "0.4223584", "0.4219167", "0.4212396", "0.42117593", "0.42104357" ]
0.7504527
0
GetInstNameField returns the inst name field
func GetInstNameField(objID string) string { switch objID { case BKInnerObjIDApp: return BKAppNameField case BKInnerObjIDSet: return BKSetNameField case BKInnerObjIDModule: return BKModuleNameField case BKInnerObjIDObject: return BKInstNameField case BKInnerObjIDHost: return BKHostNameField case BKInnerObjIDProc: return BKProcNameField case BKInnerObjIDPlat: return BKCloudNameField case BKTableNameInstAsst: return BKFieldID default: if IsObjectInstAsstShardingTable(objID) { return BKFieldID } return BKInstNameField } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *GetField) Name() string { return p.name }", "func (inst *InstFPToUI) GetName() string {\n\treturn inst.Name\n}", "func (inst *InstTrunc) GetName() string {\n\treturn inst.Name\n}", "func (inst *InstFPExt) GetName() string {\n\treturn inst.Name\n}", "func (inst *InstSExt) GetName() string {\n\treturn inst.Name\n}", "func (inst *InstUIToFP) GetName() string {\n\treturn inst.Name\n}", "func (inst *InstZExt) GetName() string {\n\treturn inst.Name\n}", "func (inst *InstFPTrunc) GetName() string {\n\treturn inst.Name\n}", "func (inst *InstFPToSI) GetName() string {\n\treturn inst.Name\n}", "func (inst *InstSIToFP) GetName() string {\n\treturn inst.Name\n}", "func (o *SingleSelectFieldField) GetName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Name\n}", "func (f *Field) Name() string {\n\tjsonTag := reflect.StructTag(f.Tag.Value[1 : len(f.Tag.Value)-1]).Get(\"json\") // Delete first and last quotation\n\tjsonTag = strings.Split(jsonTag, \",\")[0] // This can return \"-\"\n\tif jsonTag != \"\" {\n\t\treturn jsonTag\n\t}\n\n\tif f.Names != nil {\n\t\treturn f.Names[0].Name\n\t}\n\n\treturn f.Type.(*ast.Ident).Name\n}", "func (f StandInstDbNameField) Tag() quickfix.Tag { return tag.StandInstDbName }", "func (f *Fieldx) Name() string {\n\treturn f.data.Name\n}", "func (f BinaryField) GetName() string {\n\treturn f.name\n}", "func fieldname(field *ast.Field) string {\n\treturn field.Names[0].Name\n}", "func (inst *InstBitCast) GetName() string {\n\treturn inst.Name\n}", "func (f *Field) Name() string {\n\treturn f.field.Name\n}", "func (o FieldOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Field) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "func (field Field) Name() string {\n\tif len(field.Names) > 0 {\n\t\treturn field.Names[0].String()\n\t}\n\n\t// The field has no name, so we use Type name as the field name.\n\treturn itemTypeName(field.TypeValue.Type).Name\n}", "func getInstanceName(infra infraObject) string {\n\t// cloud-init will split the hostname on '.' and set the hostname to the first chunk. This causes an issue where all\n\t// nodes in a machine pool may have the same node name in Kubernetes. Converting the '.' to '-' here prevents this.\n\tinstanceName := strings.ReplaceAll(infra.meta.GetName(), \".\", \"-\")\n\tinstanceName = name2.SafeConcatName(instanceName)\n\n\treturn instanceName\n}", "func (c *Checker) getFieldName(field reflect.StructField) string {\n\tname := field.Name\n\tif c.JSONTag != nil {\n\t\tif val, ok := field.Tag.Lookup(\"json\"); ok {\n\t\t\tname = strings.Split(val, \",\")[0]\n\t\t}\n\t}\n\tif name == \"-\" {\n\t\tif !c.JSONTag.IgnoreDashFields {\n\t\t\tname = field.Name\n\t\t}\n\t}\n\treturn name\n}", "func (f *Field) GetName() string {\n\treturn formatGoName(f.Name)\n}", "func (c *STableField) Name() string {\n\tif len(c.alias) > 0 {\n\t\treturn c.alias\n\t}\n\treturn c.spec.Name()\n}", "func getInstanceName(instance ec2.Instance) (string, error) {\n\tfor _, value := range instance.Tags {\n\t\tif *value.Key == \"Name\" {\n\t\t\treturn *value.Value, nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"could not find instance\")\n}", "func (inst *InstPtrToInt) GetName() string {\n\treturn inst.Name\n}", "func (d Digest) GetInstanceName() InstanceName {\n\t_, _, _, sizeBytesEnd := d.unpack()\n\treturn InstanceName{\n\t\tvalue: d.value[sizeBytesEnd+1:],\n\t}\n}", "func (bi *BaseInstance) Name() string {\n\treturn bi.name\n}", "func (bi *BaseInstance) Name() string {\n\treturn bi.name\n}", "func (o IndexingConfigurationThingIndexingConfigurationManagedFieldOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IndexingConfigurationThingIndexingConfigurationManagedField) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "func (inst *InstIntToPtr) GetName() string {\n\treturn inst.Name\n}", "func (e *Encoder) getFieldName(field reflect.StructField) string {\n\tif e.useTags {\n\t\tname := field.Tag.Get(e.tag)\n\t\t// skip columns tagged with -\n\t\tif name == \"-\" {\n\t\t\treturn \"\"\n\t\t}\n\t\tif name != \"\" {\n\t\t\treturn name\n\t\t}\n\t}\n\treturn field.Name\n\n}", "func name(v reflect.StructField) string {\n\tif name, ok := v.Tag.Lookup(\"name\"); ok {\n\t\treturn name\n\t}\n\treturn v.Name\n}", "func (o IndexingConfigurationThingGroupIndexingConfigurationManagedFieldOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IndexingConfigurationThingGroupIndexingConfigurationManagedField) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "func (s *StructField) Name() string {\n\treturn s.name\n}", "func (instance *cache) GetName() string {\n\treturn instance.name.Load().(string)\n}", "func (o IndexingConfigurationThingGroupIndexingConfigurationCustomFieldOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IndexingConfigurationThingGroupIndexingConfigurationCustomField) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "func (t *SentryTaggedStruct) GetName() string {\n\treturn \"\"\n}", "func (o IndexingConfigurationThingIndexingConfigurationCustomFieldOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IndexingConfigurationThingIndexingConfigurationCustomField) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "func (f *DialectMessageField) GetName() string {\n\treturn f.name\n}", "func NewStandInstDbName(val string) StandInstDbNameField {\n\treturn StandInstDbNameField{quickfix.FIXString(val)}\n}", "func ExtractFieldName(field *ast.Field) string {\r\n\tif field != nil && len(field.Names) > 0 {\r\n\t\treturn field.Names[0].Name\r\n\t}\r\n\r\n\treturn \"\"\r\n}", "func (o *FormField) GetName() string {\n\tif o == nil || o.Name == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Name\n}", "func (c FieldsCollection) Name() *models.Field {\n\treturn c.MustGet(\"Name\")\n}", "func (e InstanceValidationError) Field() string { return e.field }", "func getFieldName(f reflect.StructField) string {\n\tn := f.Name\n\ttag, found := f.Tag.Lookup(\"json\")\n\tif found {\n\t\t// If we have a json field, and the first part of it before the\n\t\t// first comma is non-empty, that's our field name.\n\t\tparts := strings.Split(tag, \",\")\n\t\tif parts[0] != \"\" {\n\t\t\tn = parts[0]\n\t\t}\n\t}\n\treturn n\n}", "func (e *Entry) GetName() string {\n\tif len(e.NameRaw) > 0 {\n\t\treturn string(e.NameRaw)\n\t}\n\treturn e.Name\n}", "func (o InstanceOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "func (o InstanceOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "func (o InstanceOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "func (e GetInstanceRequestValidationError) Field() string { return e.field }", "func (inst *InstAddrSpaceCast) GetName() string {\n\treturn inst.Name\n}", "func (e IdentifierValidationError) Field() string { return e.field }", "func (o *AddOn) GetName() (value string, ok bool) {\n\tok = o != nil && o.bitmap_&2048 != 0\n\tif ok {\n\t\tvalue = o.name\n\t}\n\treturn\n}", "func (o InstanceFromTemplateOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *InstanceFromTemplate) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "func (p Packet) Name() (name string) {\n\t// todo: think of ways to make this not a compiled in hack\n\t// todo: collectd 4 uses different patterns for some plugins\n\t// https://collectd.org/wiki/index.php/V4_to_v5_migration_guide\n\tswitch p.Plugin {\n\tcase \"df\":\n\t\tname = fmt.Sprintf(\"df_%s_%s\", p.PluginInstance, p.TypeInstance)\n\tcase \"interface\":\n\t\tname = fmt.Sprintf(\"%s_%s\", p.Type, p.PluginInstance)\n\tcase \"load\":\n\t\tname = \"load\"\n\tcase \"memory\":\n\t\tname = fmt.Sprintf(\"memory_%s\", p.TypeInstance)\n\tdefault:\n\t\tname = fmt.Sprintf(\"%s_%s_%s_%s\", p.Plugin, p.PluginInstance, p.Type, p.TypeInstance)\n\t}\n\treturn name\n}", "func (o *CreateInstance) GetName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Name\n}", "func (x ApmDatabaseInstanceEntity) GetName() string {\n\treturn x.Name\n}", "func getNameFromTag(f reflect.StructField, tagName string) string {\n\ttag, _ := parseTag(f, tagName)\n\tif tag != \"\" {\n\t\treturn tag\n\t}\n\treturn f.Name\n}", "func targetFieldName(s *types.Struct, i int) string {\n\ttag := reflect.StructTag(s.Tag(i)).Get(\"rgo\")\n\tif tag != \"\" {\n\t\treturn tag\n\t}\n\treturn s.Field(i).Name()\n}", "func (o SecondaryIndexOutput) InstanceName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SecondaryIndex) pulumi.StringOutput { return v.InstanceName }).(pulumi.StringOutput)\n}", "func (o LookupInstanceAttachmentResultOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupInstanceAttachmentResult) string { return v.Name }).(pulumi.StringOutput)\n}", "func (ipr *Ipref) Name() string { return \"ipref\" }", "func (e *EntryBase) Name() string {\n\treturn e.name()\n}", "func (m *ParentLabelDetails) GetName()(*string) {\n val, err := m.GetBackingStore().Get(\"name\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (m *LabelActionBase) GetName()(*string) {\n val, err := m.GetBackingStore().Get(\"name\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (o *GridViewUpdate) GetName() string {\n\tif o == nil || IsNil(o.Name) {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Name\n}", "func (b *Base) getName() string {\n\treturn b.name\n}", "func (f BooleanField) GetName() string {\n\treturn f.name\n}", "func (d *Document) Name() string {\n\treturn fmt.Sprintf(\"%s-%s\", d.AccountId, d.InstanceId)\n}", "func (o *CloudInstanceTypeAllOf) GetName() string {\n\tif o == nil || o.Name == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Name\n}", "func (o InstanceOutput) ImageName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.ImageName }).(pulumi.StringOutput)\n}", "func getInstanceName() string {\n\tif *baseapp.Local {\n\t\tu, err := user.Current()\n\t\tif err != nil {\n\t\t\treturn \"localhost\"\n\t\t}\n\t\treturn u.Username\n\t}\n\treturn viper.GetString(\"firestore.instance\")\n}", "func (o TableOutput) InstanceName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Table) pulumi.StringOutput { return v.InstanceName }).(pulumi.StringOutput)\n}", "func (e *Exec) GetNameID() string { return e.nameID }", "func (t *Type) GetName() string { return t.Name }", "func (bd *BlockDAG) GetName() string {\n\treturn bd.instance.GetName()\n}", "func (e GetInstanceResponseValidationError) Field() string { return e.field }", "func (o *OutputField) GetFieldName() string {\n\tif o == nil || IsNil(o.FieldName) {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.FieldName\n}", "func (_DelegateProfile *DelegateProfileCallerSession) GetFieldByName(_name string) (struct {\n\tVerifier common.Address\n\tDeprecated bool\n}, error) {\n\treturn _DelegateProfile.Contract.GetFieldByName(&_DelegateProfile.CallOpts, _name)\n}", "func (s *MyTestStruct) Name() string {\n\treturn s.field_Name\n}", "func (r *PackageAggRow) GetName() string { return *r.Data.Name }", "func (ilp *IlpFormatter) Name() string {\n\treturn ilp.name\n}", "func (m *ManagementTemplateStep) GetDisplayName()(*string) {\n val, err := m.GetBackingStore().Get(\"displayName\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func getColumnName(sf reflect.StructField, tag reflect.StructTag) string {\n\tdbTag := tag.Get(\"db\")\n\tif dbTag == \"\" {\n\t\treturn strings.ToLower(sf.Name)\n\t}\n\treturn dbTag\n}", "func (_DelegateProfile *DelegateProfileSession) GetFieldByName(_name string) (struct {\n\tVerifier common.Address\n\tDeprecated bool\n}, error) {\n\treturn _DelegateProfile.Contract.GetFieldByName(&_DelegateProfile.CallOpts, _name)\n}", "func (o *SyntheticMonitorUpdate) GetName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Name\n}", "func getNameFromTag(field reflect.StructField) tagInfo {\n\tfieldName, tags := ParseTag(field.Tag.Get(\"provider\"))\n\tif fieldName == \"\" {\n\t\trawFieldName, _ := ParseTag(field.Tag.Get(\"json\"))\n\t\tfieldName = ToSnakeCase(rawFieldName)\n\t}\n\tif fieldName == \"\" {\n\t\tfieldName = field.Name\n\t}\n\treturn tagInfo{\n\t\tname: fieldName,\n\t\tisId: tags.Contains(\"id\"),\n\t\tflatten: tags.Contains(\"flatten\"),\n\t\tignore: tags.Contains(\"ignore\"),\n\t}\n}", "func (m *NOCWidget) Name() *string {\n\treturn m.nameField\n}", "func (_DelegateProfile *DelegateProfileCaller) GetFieldByName(opts *bind.CallOpts, _name string) (struct {\n\tVerifier common.Address\n\tDeprecated bool\n}, error) {\n\tret := new(struct {\n\t\tVerifier common.Address\n\t\tDeprecated bool\n\t})\n\tout := ret\n\terr := _DelegateProfile.contract.Call(opts, out, \"getFieldByName\", _name)\n\treturn *ret, err\n}", "func (*unifinames) Name() string { return \"unifi-names\" }", "func (ev *PodCustomIfUpdate) GetName() string {\n\treturn \"Pod Custom Interfaces Update\"\n}", "func (ifce *Interface) Name() string {\n\treturn ifce.name\n}", "func (ifce *Interface) Name() string {\n\treturn ifce.name\n}", "func (o *StorageSasExpander) GetName() string {\n\tif o == nil || o.Name == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Name\n}", "func fieldFlagName(fieldName string) (ret string) {\n\t// defer func() { log.Println(fieldName, ret) }()\n\t// TCP\n\tif ss := regexp.MustCompile(\"^[[:upper:]]{2,}$\").FindStringSubmatch(fieldName); ss != nil {\n\t\treturn strings.ToLower(ss[0])\n\t}\n\t// TCPAddr\n\tif ss := regexp.MustCompile(\"^([[:upper:]]+)([[:upper:]][^[:upper:]].*?)$\").FindStringSubmatch(fieldName); ss != nil {\n\t\treturn strings.ToLower(ss[1]) + ss[2]\n\t}\n\t// Addr\n\tif ss := regexp.MustCompile(\"^([[:upper:]])(.*)$\").FindStringSubmatch(fieldName); ss != nil {\n\t\treturn strings.ToLower(ss[1]) + ss[2]\n\t}\n\tpanic(fieldName)\n}", "func (e ErrorValidation) FieldName() string {\n\treturn e.fieldName\n}", "func (o *LogsPipelineProcessor) GetName() string {\n\tif o == nil || o.Name == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Name\n}", "func (o *LocalDatabaseProvider) GetName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Name\n}", "func (o GetInstancesFilterOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetInstancesFilter) string { return v.Name }).(pulumi.StringOutput)\n}" ]
[ "0.683984", "0.66691345", "0.66529775", "0.6619471", "0.65891474", "0.6570262", "0.6415572", "0.63976705", "0.6358292", "0.6319564", "0.62703145", "0.62133884", "0.62109816", "0.61973596", "0.6195115", "0.6148975", "0.61299187", "0.6109643", "0.61041665", "0.60617775", "0.6018982", "0.59937555", "0.59935814", "0.59827095", "0.59723085", "0.59707934", "0.59695727", "0.59687644", "0.59687644", "0.59441936", "0.5940104", "0.59328896", "0.59224564", "0.58363706", "0.58163613", "0.5808076", "0.5760111", "0.57541966", "0.5750456", "0.57425797", "0.57425225", "0.57354414", "0.5680218", "0.56656826", "0.56572634", "0.5646315", "0.5628965", "0.56108683", "0.56108683", "0.56108683", "0.5607623", "0.5606371", "0.56015027", "0.55956566", "0.55936503", "0.5581631", "0.55735517", "0.55642295", "0.55596703", "0.5547216", "0.55371624", "0.553676", "0.5531274", "0.553121", "0.55303615", "0.55247265", "0.5517936", "0.55173707", "0.55155325", "0.550068", "0.5489093", "0.54767245", "0.5475098", "0.5470822", "0.5470631", "0.5465772", "0.5449414", "0.544321", "0.5443135", "0.543099", "0.5430459", "0.54296404", "0.542887", "0.542482", "0.5421382", "0.54063714", "0.5405876", "0.540541", "0.5403107", "0.5401463", "0.53956735", "0.5393307", "0.5386469", "0.5386469", "0.5385518", "0.538511", "0.5382951", "0.5375121", "0.5371692", "0.536042" ]
0.81934553
0
GetInstIDField get primary key of object's collection/table
func GetInstIDField(objType string) string { switch objType { case BKInnerObjIDApp: return BKAppIDField case BKInnerObjIDSet: return BKSetIDField case BKInnerObjIDModule: return BKModuleIDField case BKInnerObjIDObject: return BKInstIDField case BKInnerObjIDHost: return BKHostIDField case BKInnerObjIDProc: return BKProcIDField case BKInnerObjIDPlat: return BKCloudIDField case BKTableNameInstAsst: return BKFieldID case BKTableNameServiceInstance: return BKFieldID case BKTableNameServiceTemplate: return BKFieldID case BKTableNameProcessTemplate: return BKFieldID case BKTableNameProcessInstanceRelation: return BKProcessIDField default: if IsObjectInstAsstShardingTable(objType) { return BKFieldID } return BKInstIDField } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func getPrimaryKeyField(data []models.Create) (models.TableField, string, error) {\n\tfor _, d := range data {\n\t\tfor _, f := range d.TableFields {\n\t\t\tif f.Tags.PrimaryKey {\n\t\t\t\treturn f, d.TableName, nil\n\t\t\t}\n\t\t}\n\t}\n\treturn models.TableField{}, \"\", errors.New(\"unable to find primary key\")\n}", "func hostGetObjectId(objId int32, keyId int32, typeId int32) int32", "func (p *Pet) GetPrimaryKeyAddress() interface{} {\n\treturn &p.ID\n}", "func (user *User) PrimaryKey() uint64 {\n return user.ID\n}", "func (t *Commit) PrimaryKey() interface{} {\n\treturn t.ID\n}", "func (c *DefaultConstr) GetPrimaryKey(conn *sql.DB, schema string, tableName string) ([]string, error) {\n\treturn nil, ErrorNotSupport\n}", "func (qp *QueryParser) getPrimayKey(data interface{}) string {\n\treturn \"ID\"\n}", "func (k *Key) IntID() int64 { return k.toks[len(k.toks)-1].IntID }", "func (t *badgerTableVersion) getObjKey(id, objID []byte) []byte {\n\tprefix := []byte(t.prefix + \"object/\")\n\tprefix = append(prefix, id...)\n\tprefix = append(prefix, '/')\n\n\treturn append(prefix, objID...)\n}", "func (fieldType *AdaReferentialType) PrimaryKeyName() string {\n\tif fieldType.keys[0] == \"\" {\n\t\treturn \"ISN\"\n\t}\n\treturn fieldType.keys[0]\n}", "func GetPrimaryKeyOfTable(dbConn *sql.DB, table string) (string, error) {\n\tquery := fmt.Sprintf(\"SELECT c.column_name FROM information_schema.key_column_usage AS c LEFT JOIN information_schema.table_constraints AS t ON t.constraint_name = c.constraint_name WHERE t.table_name = '%s' AND t.constraint_type = 'PRIMARY KEY';\", table)\n\tprimaryKey := GetAllColsOfRows(dbConn, query)\n\n\tif len(primaryKey) == 0 {\n\t\treturn \"\", fmt.Errorf(\"Get Primary Key Error: No Primary Key Found For Table %s\", table)\n\t}\n\n\tif pk, ok := primaryKey[0][\"column_name\"]; ok {\n\t\treturn pk, nil\n\t} else {\n\t\treturn \"\", fmt.Errorf(\"Get Primary Key Error: No Primary Key Found For Table %s\", table)\n\t}\n}", "func (m *Model) GetPK() string {\n\treturn m.PrimaryKey\n}", "func (p *CockroachDriver) PrimaryKeyInfo(schema, tableName string) (*bdb.PrimaryKey, error) {\n\tPrintName(\"PrimaryKeyInfo\")\n\tpkey := &bdb.PrimaryKey{}\n\tvar err error\n\n\tquery := `\n\tselect tc.constraint_name\n\tfrom ` + schema + `.rveg_primary_keys as tc\n\twhere tc.table_name = $1 and tc.table_schema = $2\n\t;\n\t`\n\n\trow := p.dbConn.QueryRow(query, tableName, schema)\n\n\tif err = row.Scan(&pkey.Name); err != nil {\n\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tqueryColumns := `\n\tselect kcu.column_name\n\tfrom information_schema.key_column_usage as kcu\n\twhere constraint_name = $1\n\t\tand table_schema = $2\n\tlimit 1\n\t;`\n\n\tvar rows *sql.Rows\n\tif rows, err = p.dbConn.Query(queryColumns, pkey.Name, schema); err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\tvar col = \"\"\n\tvar columns []string\n\tvar xC = 0\n\n\tfor rows.Next() {\n\t\tvar column string\n\n\t\terr = rows.Scan(&column)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif col == \"\" {\n\t\t\tcol = column\n\t\t}\n\t\tif column == \"id\" {\n\t\t\txC++\n\t\t}\n\t\tif column != col {\n\t\t\tif xC > 0 {\n\t\t\t\tcolumns = append(columns, column)\n\t\t\t}\n\t\t}\n\t\tcol = column\n\t}\n\tcolumns = append(columns, col)\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tpkey.Columns = columns\n\n\treturn pkey, nil\n}", "func (d Document) PrimaryField() string {\n\tif fields := d.PrimaryFields(); len(fields) == 1 {\n\t\treturn fields[0]\n\t}\n\n\tpanic(\"rel: composite primary key is not supported\")\n}", "func (x UserGroup) PrimaryKey() string {\n\treturn \"id\"\n}", "func (dd *DatabaseDiff) ObjectKey() ObjectKey {\n\tif dd == nil || (dd.From == nil && dd.To == nil) {\n\t\treturn ObjectKey{}\n\t}\n\tif dd.From == nil {\n\t\treturn dd.To.ObjectKey()\n\t}\n\treturn dd.From.ObjectKey()\n}", "func (self *Devices) GetPrimaryKeyValue() int64 {\n return self.Id\n}", "func getRefModelPk(field modelField) *int64 {\n\tif field.value.IsNil() {\n\t\treturn nil\n\t}\n\tmi, err := getModelInfo(field.value.Interface())\n\tif err != nil {\n\t\treturn nil\n\t}\n\tfor _, field := range mi.fields {\n\t\tif isPkField(field) {\n\t\t\tif !isZeroField(field.value) {\n\t\t\t\tif field.value.Kind() == reflect.Int64 {\n\t\t\t\t\treturn field.value.Addr().Interface().(*int64)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (m *TestModel) PrimaryKey() string {\n\treturn m.ID\n}", "func (o baseObject) ObjectID() int64 {\n\treturn o.ID\n}", "func (c *Category) PrimaryKey() string {\n\treturn \"id\"\n}", "func (stmt *Statement) ObjectKey() ObjectKey {\n\treturn ObjectKey{\n\t\tType: stmt.ObjectType,\n\t\tName: stmt.ObjectName,\n\t}\n}", "func (c CommitterProbe) GetPrimaryKey() []byte {\n\treturn c.primaryKey\n}", "func (o *VolumeAttributesType) KeyId() string {\n\tr := *o.KeyIdPtr\n\treturn r\n}", "func PrimaryKey(sqlTable SQLTableStruct) string {\n\treturn fmt.Sprintf(\"%s%s\", sqlTable.Name, sqlIDSuffix)\n}", "func (c *collection) primaryKey(a *driver.Action) [2]interface{} {\n\tvar keys [2]interface{}\n\tvar err error\n\tkeys[0], err = a.Doc.GetField(c.partitionKey)\n\tif err != nil {\n\t\treturn keys\n\t}\n\tif c.sortKey != \"\" {\n\t\tkeys[1], _ = a.Doc.GetField(c.sortKey) // ignore error since keys[1] would be nil in that case\n\t}\n\treturn keys\n}", "func (obj *SObject) ExternalIDFieldName() string {\n\treturn obj.StringField(sobjectExternalIDFieldNameKey)\n}", "func IsPrimaryKey(sqlTable SQLTableStruct, sqlField SQLFieldStruct) bool {\n\treturn strings.EqualFold(fmt.Sprintf(\"%s%s\", sqlTable.Name, sqlIDSuffix), sqlField.Field)\n}", "func (t *ACLRole) PrimaryKey() interface{} {\n\treturn t.ID\n}", "func (objectIDs *DbObjectIDs) GetObjectID(key ExternalIDKey) string {\n\treturn objectIDs.objectIDs[key]\n}", "func (s Strategy) GetIDField(coralName string) string {\n\treturn s.Map.Entities[coralName].ID\n}", "func (i *IPPeerMatcher) PrimaryKey() string {\n\tblock := i.IPBlock\n\tvar except []string\n\tfor _, e := range block.Except {\n\t\texcept = append(except, e)\n\t}\n\tsort.Slice(except, func(i, j int) bool {\n\t\treturn except[i] < except[j]\n\t})\n\treturn fmt.Sprintf(\"%s: [%s]\", block.CIDR, strings.Join(except, \", \"))\n}", "func (u *User) GetPrimaryKeyAddress() interface{} {\n\treturn &u.ID\n}", "func (tbl RecordTable) PkColumn() string {\n\treturn tbl.pk\n}", "func (o ElemU) Id() int { return o.Cid }", "func (o ServiceTenantAccessPtrOutput) PrimaryKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ServiceTenantAccess) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.PrimaryKey\n\t}).(pulumi.StringPtrOutput)\n}", "func PKOfDoc(doc map[string]interface{}, panicOnErr bool) uint64 {\n\tdocPK, ok := doc[PK_NAME].(string)\n\tif !ok {\n\t\tif panicOnErr {\n\t\t\tpanic(fmt.Sprintf(\"Doc %v does not have a valid PK\", doc))\n\t\t}\n\t\treturn 18446744073709551615\n\t}\n\tstrint, err := strconv.ParseUint(docPK, 10, 64)\n\tif err != nil {\n\t\tif panicOnErr {\n\t\t\tpanic(fmt.Sprintf(\"Doc %v does not have a valid PK\", doc))\n\t\t}\n\t\treturn 18446744073709551615\n\t}\n\treturn strint\n}", "func (p *Pet) GetPrimaryKeyStringValue() (string, error) {\n\treturn strconv.FormatInt(int64(p.ID), 10), nil\n}", "func (i *CollectionIterator) GetID() string {\n\tdbKey := i.getDBKey()\n\tif dbKey == nil {\n\t\treturn \"\"\n\t}\n\n\tcleanDBKey := dbKey[len(i.colPrefix):]\n\treturn string(cleanDBKey)\n}", "func (o ServiceTenantAccessOutput) PrimaryKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ServiceTenantAccess) *string { return v.PrimaryKey }).(pulumi.StringPtrOutput)\n}", "func (n *Network) PrimaryKeyFields() []string {\n\treturn []string{\"id\"}\n}", "func (s *Sizing) PrimaryKeyFields() []string {\n\treturn []string{\"id\"}\n}", "func (obj *SObject) ID() string {\n\treturn obj.StringField(sobjectIDKey)\n}", "func (t *Table) GetPrimaryKey() []string {\n\treturn t.Indexs[\"PRIMARY\"].Cols\n}", "func (iter *radixIterator) Key() []byte {\n\tif iter.cursorKey != nil {\n\t\treturn iter.cursorKey\n\t}\n\tdbk, _, _ := memdb.KVFromObject(iter.cursor)\n\treturn dbk\n}", "func (c FieldsCollection) ID() *models.Field {\n\treturn c.MustGet(\"ID\")\n}", "func (p *Pet) GetPrimaryKeyHashableValue() interface{} {\n\treturn p.ID\n}", "func (self *Store) NextPk() []byte {\n\tself.mu.Lock()\n\tself.mu.Unlock()\n\treturn nil\n}", "func (p ObjectID) ID() string {\n\treturn fmt.Sprintf(\"%d.%d.%d\",\n\t\tp.SpaceType(),\n\t\tp.ObjectType(),\n\t\tp.Instance(),\n\t)\n}", "func (vt *perfSchemaTable) GetPhysicalID() int64 {\n\treturn vt.meta.ID\n}", "func (k Key) ID() string {\n\treturn k.trimWildcard().trimPrefix().String()\n}", "func hostGetKeyId(key *byte, size int32) int32", "func getObjIDByTblName(tblName string) (ObjID, error) {\n\tvar err error\n\tvar taiObj ObjID\n\n\tswitch tblName {\n\tcase vtepdb.BridgeDomain:\n\t\ttaiObj = ObjectIDBridge\n\tcase vtepdb.Vrf:\n\t\ttaiObj = ObjectIDVrf\n\tcase vtepdb.L2port:\n\t\ttaiObj = ObjectIDL2Port\n\tcase vtepdb.L3port:\n\t\ttaiObj = ObjectIDL3Port\n\tcase vtepdb.Locator:\n\t\ttaiObj = ObjectIDTunnel\n\tcase vtepdb.RemoteFdb:\n\t\ttaiObj = ObjectIDFDB\n\tcase vtepdb.Route:\n\t\ttaiObj = ObjectIDRoute\n\tcase vtepdb.RemoteNeigh:\n\t\ttaiObj = ObjectIDNeighbour\n\tcase vtepdb.McastMacsLocal:\n\t\ttaiObj = ObjectIDMcastFDB\n\tcase vtepdb.ACL:\n\t\ttaiObj = ObjectIDACL\n\tcase vtepdb.ACLRule:\n\t\ttaiObj = ObjectIDACLRule\n\tcase vtepdb.PolicyBasedRoute:\n\t\ttaiObj = ObjectIDPBR\n\tcase vtepdb.AutoGatewayConf:\n\t\ttaiObj = ObjectIDAutoGatewayConf\n\tdefault:\n\t\treturn taiObj, errors.New(\"undefined tai object\")\n\t}\n\n\treturn taiObj, err\n}", "func stringKeyFunc(obj interface{}) (string, error) {\n\tkey := obj.(*nodeidentity.Info).InstanceID\n\treturn key, nil\n}", "func primaryIdentity(e *openpgp.Entity) *openpgp.Identity {\n\tvar firstIdentity *openpgp.Identity\n\tfor _, ident := range e.Identities {\n\t\tif firstIdentity == nil {\n\t\t\tfirstIdentity = ident\n\t\t}\n\t\tif ident.SelfSignature.IsPrimaryId != nil && *ident.SelfSignature.IsPrimaryId {\n\t\t\treturn ident\n\t\t}\n\t}\n\treturn firstIdentity\n}", "func primaryIdentity(e *openpgp.Entity) *openpgp.Identity {\n\tvar firstIdentity *openpgp.Identity\n\tfor _, ident := range e.Identities {\n\t\tif firstIdentity == nil {\n\t\t\tfirstIdentity = ident\n\t\t}\n\t\tif ident.SelfSignature.IsPrimaryId != nil && *ident.SelfSignature.IsPrimaryId {\n\t\t\treturn ident\n\t\t}\n\t}\n\treturn firstIdentity\n}", "func (p *Partitions) Key(record Record) string {\n\treturn record.Index(p.Strategy.Partition.Columns)\n}", "func (t *Commit) PrimaryKeyColumn() string {\n\treturn CommitColumnID\n}", "func (pk PublicKey) ID() string {\n\treturn stringEntry(pk[IDProperty])\n}", "func getAutoRecordID(d types.Datum, target *types.FieldType) int64 {\n\tswitch target.Tp {\n\tcase mysql.TypeFloat, mysql.TypeDouble:\n\t\treturn int64(math.Round(d.GetFloat64()))\n\tcase mysql.TypeTiny, mysql.TypeShort, mysql.TypeInt24, mysql.TypeLong, mysql.TypeLonglong:\n\t\treturn d.GetInt64()\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unsupported auto-increment field type '%d'\", target.Tp))\n\t}\n}", "func (c *Container) Key() string {\n\tc.Lock()\n\tdefer c.Unlock()\n\treturn c.ID\n}", "func (obj *SObject) ExternalID() string {\n\treturn obj.StringField(obj.ExternalIDFieldName())\n}", "func (o GetServiceTenantAccessOutput) PrimaryKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetServiceTenantAccess) string { return v.PrimaryKey }).(pulumi.StringOutput)\n}", "func VirtualGetObjectIDAsHexString(fieldName string) func(doc bson.M) (interface{}, error) {\n\treturn func(doc bson.M) (interface{}, error) {\n\t\tif fieldName == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"no field name specified\")\n\t\t}\n\t\tv, ok := doc[fieldName]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"field %q not found\", fieldName)\n\t\t} else if v == nil {\n\t\t\treturn nil, fmt.Errorf(\"field %q not set\", fieldName)\n\t\t}\n\n\t\t// if its an object id convert to hex\n\t\tif IsObjectID(v) {\n\t\t\toid := v.(primitive.ObjectID)\n\t\t\treturn oid.Hex(), nil\n\t\t}\n\n\t\t// otherwise just try to return the string\n\t\treturn fmt.Sprintf(\"%v\", v), nil\n\t}\n}", "func rowToKey(rowID uint64) (key uint64) {\n\treturn rowID * (ShardWidth / containerWidth)\n}", "func (p *Pet) GetPrimaryKeyZeroValue() interface{} {\n\treturn 0\n}", "func (c *JobSales) Table_PrimaryKey() query.Column {\n\treturn \"JobSalesID\"\n}", "func (o ReplicaExternalKeyOutput) KeyId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ReplicaExternalKey) pulumi.StringOutput { return v.KeyId }).(pulumi.StringOutput)\n}", "func (r ManagedResource) id() ReferenceID { return r.ID }", "func (tbl AssociationTable) PkColumn() string {\n\treturn tbl.pk\n}", "func (r *ProductRow) GetID() int32 { return *r.Data.ID }", "func (di *Iterator) Key() []byte {\n\tkey := di.iter.Key()\n\treturn key[len(types.ExtUtxoTablePrefix):]\n}", "func (x *User) PrimaryKey() string {\n\treturn x.PrimaryKeyName\n}", "func (bc *TranslatableBusinessCase) ObjectID() string {\n\treturn bc.ID.String()\n}", "func (c ValueColumn) PrimaryKey() ValueColumn {\n\tc.ctype = c.ctype + \" PRIMARY KEY \"\n\treturn c\n}", "func (t *Table) ID() uint64 { return t.id }", "func (p *Pet) GetPrimaryKeyValue() interface{} {\n\treturn p.ID\n}", "func (f *Fixture) ObjectKey(o client.Object) client.ObjectKey {\n\tk := client.ObjectKeyFromObject(o)\n\treturn k\n}", "func (bdm MySQLDBManager) ExecuteSQLPrimaryKey(table string) (column string, err error) {\n\trow, err := bdm.ExecuteSQLSelectRow(\"SHOW KEYS FROM \" + table + \" WHERE Key_name = 'PRIMARY'\")\n\n\tif err != nil {\n\t\treturn\n\t}\n\tcolumn = row[\"Column_name\"]\n\treturn\n}", "func (k *Key) StringID() string { return k.toks[len(k.toks)-1].StringID }", "func (m *DiscoveredSensitiveType) 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}", "func (t *ACLRole) PrimaryKeyColumn() string {\n\treturn ACLRoleColumnID\n}", "func _dbKeyForPKIDToProfileEntry(pkid *PKID) []byte {\n\tprefixCopy := append([]byte{}, _PrefixPKIDToProfileEntry...)\n\tkey := append(prefixCopy, pkid[:]...)\n\treturn key\n}", "func ObjectID(oid primitive.ObjectID) Val {\n\tv := Val{t: bsontype.ObjectID}\n\tcopy(v.bootstrap[0:12], oid[:])\n\treturn v\n}", "func (o SharedAccessPolicyOutput) PrimaryKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SharedAccessPolicy) pulumi.StringOutput { return v.PrimaryKey }).(pulumi.StringOutput)\n}", "func LegacyInstanceObjectID(obj *ResourceInstanceObjectSrc) string {\n\tif obj == nil {\n\t\treturn \"<not created>\"\n\t}\n\n\tif obj.AttrsJSON != nil {\n\t\ttype WithID struct {\n\t\t\tID string `json:\"id\"`\n\t\t}\n\t\tvar withID WithID\n\t\terr := json.Unmarshal(obj.AttrsJSON, &withID)\n\t\tif err == nil {\n\t\t\treturn withID.ID\n\t\t}\n\t} else if obj.AttrsFlat != nil {\n\t\tif flatID, exists := obj.AttrsFlat[\"id\"]; exists {\n\t\t\treturn flatID\n\t\t}\n\t}\n\n\t// For resource types created after we removed id as special there may\n\t// not actually be one at all. This is okay because older tests won't\n\t// encounter this, and new tests shouldn't be using ids.\n\treturn \"<none>\"\n}", "func (c *ReplicaSetClient) KeyOf(obj interface{}) string {\n\tkey, err := cache.MetaNamespaceKeyFunc(obj)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn key\n}", "func GetInstNameField(objID string) string {\n\tswitch objID {\n\tcase BKInnerObjIDApp:\n\t\treturn BKAppNameField\n\tcase BKInnerObjIDSet:\n\t\treturn BKSetNameField\n\tcase BKInnerObjIDModule:\n\t\treturn BKModuleNameField\n\tcase BKInnerObjIDObject:\n\t\treturn BKInstNameField\n\tcase BKInnerObjIDHost:\n\t\treturn BKHostNameField\n\tcase BKInnerObjIDProc:\n\t\treturn BKProcNameField\n\tcase BKInnerObjIDPlat:\n\t\treturn BKCloudNameField\n\tcase BKTableNameInstAsst:\n\t\treturn BKFieldID\n\tdefault:\n\t\tif IsObjectInstAsstShardingTable(objID) {\n\t\t\treturn BKFieldID\n\t\t}\n\t\treturn BKInstNameField\n\t}\n}", "func makeKey(objId string, sliceId uint32, id blizstorage.ChunkIdentity, field string) []byte {\r\n\r\n\tif bytes.Equal(id[:], sliceDBNilChunkId[:]) {\r\n\t\treturn []byte(field)\r\n\t}\r\n\r\n\t// blizstorage.ChunkIdentity2Int(id)\r\n\tpart := fmt.Sprintf(\"%s:%d:%s\", objId, sliceId, field)\r\n\r\n\treturn append(sliceDBItemPrefix, append(id[:], part...)...)\r\n}", "func (workItemType WorkItemType) GetID() string {\n return workItemType.ID.Hex()\n}", "func (m *PooledWrapper) KeyId(ctx context.Context) (string, error) {\n\treturn m.encryptor().KeyId(ctx)\n}", "func (o MongoDBDatabaseResourcePtrOutput) Id() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *MongoDBDatabaseResource) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Id\n\t}).(pulumi.StringPtrOutput)\n}", "func (event_EntityInfo) GetId(object interface{}) (uint64, error) {\n\treturn object.(*Event).Id, nil\n}", "func (objectIDs *DbObjectIDs) getUniqueID() (string, error) {\n\tid := objectIDs.ownerControllerName + \":\" + string(objectIDs.idsType.ownerObjectType)\n\tfor _, key := range objectIDs.idsType.GetExternalIDKeys() {\n\t\tvalue, ok := objectIDs.objectIDs[key]\n\t\tif !ok {\n\t\t\treturn \"\", fmt.Errorf(\"key %v is required but not present\", key)\n\t\t}\n\t\tid += \":\" + value\n\t}\n\treturn id, nil\n}", "func (c *Customer) PrimaryKeyFields() []string {\n\treturn []string{\"id\"}\n}", "func (p *PKCS11) GetKeyID() (err error) {\n findTemplate := []*pkcs11.Attribute{\n pkcs11.NewAttribute(pkcs11.CKA_ID, true), // KeyID\n pkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_PRIVATE_KEY),\n pkcs11.NewAttribute(pkcs11.CKA_PRIVATE, true),\n pkcs11.NewAttribute(pkcs11.CKA_KEY_TYPE, pkcs11.CKK_RSA),\n }\n\n p.Ctx.FindObjectsInit(p.SessionHandle, findTemplate)\n obj, _, err := p.Ctx.FindObjects(p.SessionHandle, 1000)\n if err != nil {\n return\n }\n\n err = p.Ctx.FindObjectsFinal(p.SessionHandle)\n if err != nil {\n return\n }\n\n p.KeyID = map[int][]byte{}\n for num, objValue := range obj {\n attrs, _ := p.Ctx.GetAttributeValue(p.SessionHandle, objValue, findTemplate)\n p.KeyID[num] = attrs[0].Value\n }\n\n return\n}", "func (k *Key) GetID() int64 {\n\tif k == nil || k.ID == nil {\n\t\treturn 0\n\t}\n\treturn *k.ID\n}", "func (m *_KeyValuePair) GetIdentifier() string {\n\treturn \"14535\"\n}", "func (metas metadatas) getDocumentID(document interface{}) (id bson.ObjectId, err error) {\n\tValue := reflect.ValueOf(document)\n\tmeta, ok := metas[Value.Type()]\n\tif !ok {\n\t\treturn id, ErrDocumentNotRegistered\n\t}\n\tidFields, ok := meta.findIDField()\n\tif !ok {\n\t\treturn id, ErrIDFieldNotFound\n\t}\n\treturn Value.Elem().FieldByName(idFields.name).Interface().(bson.ObjectId), nil\n\n}", "func (g *GPGKey) GetPrimaryKeyID() int64 {\n\tif g == nil || g.PrimaryKeyID == nil {\n\t\treturn 0\n\t}\n\treturn *g.PrimaryKeyID\n}" ]
[ "0.64741033", "0.64149576", "0.6027425", "0.5938452", "0.59127915", "0.588824", "0.5860908", "0.5822916", "0.579606", "0.5791429", "0.5788975", "0.5778923", "0.57776135", "0.5776322", "0.5768322", "0.5766646", "0.5741552", "0.5735442", "0.57068944", "0.56671613", "0.5661163", "0.565714", "0.56407416", "0.56166434", "0.56107646", "0.5608271", "0.56031156", "0.55953604", "0.55609757", "0.55604595", "0.5537299", "0.5527534", "0.5507149", "0.5490425", "0.5486863", "0.54812336", "0.54580975", "0.5452261", "0.545211", "0.54518473", "0.5450067", "0.5442877", "0.5441242", "0.5418139", "0.5405292", "0.53885597", "0.5381753", "0.53785557", "0.5370921", "0.5347351", "0.5339408", "0.53321666", "0.53319126", "0.5323546", "0.53203", "0.53203", "0.5319048", "0.52986044", "0.5296176", "0.5295048", "0.52556086", "0.52541065", "0.5252688", "0.52526414", "0.525192", "0.5249666", "0.52482295", "0.52431464", "0.524036", "0.5238722", "0.52315646", "0.52210414", "0.5206039", "0.5203624", "0.5193732", "0.5191842", "0.5188962", "0.5187099", "0.5184496", "0.5183655", "0.5182287", "0.5181662", "0.5176934", "0.5175469", "0.51746184", "0.5165758", "0.51635355", "0.5159767", "0.51592463", "0.5157066", "0.5152833", "0.51385474", "0.51380825", "0.5134645", "0.5129174", "0.51154333", "0.5111809", "0.5106252", "0.50918317", "0.5087263" ]
0.71526545
0
IsInnerMainlineModel judge if the object type is inner mainline model
func IsInnerMainlineModel(objType string) bool { switch objType { case BKInnerObjIDApp, BKInnerObjIDSet, BKInnerObjIDModule: return true default: return false } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t Type) IsModel() bool {\n\t_, isModel := t.impl.(*modelImpl)\n\treturn isModel\n}", "func (ref *UIElement) IsMain() bool {\n\tret, _ := ref.BoolAttr(MainAttribute)\n\treturn ret\n}", "func (c Category) IsMainSet() bool {\n\treturn c.Main != 0\n}", "func (o *LinkRouteTable) GetMainOk() (*bool, bool) {\n\tif o == nil || o.Main == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Main, true\n}", "func (bd *BlockDAG) isOnMainChain(h *hash.Hash) bool {\n\treturn bd.instance.IsOnMainChain(bd.getBlock(h))\n}", "func (a Ad) IsInline() bool {\n\treturn a.InLine != nil\n}", "func (s *BasePlSqlParserListener) EnterMain_model(ctx *Main_modelContext) {}", "func (e *Ex) Inner() error {\n\treturn e.inner\n}", "func (e *Ex) Inner() error {\n\treturn e.inner\n}", "func (meta MVCCMetadata) IsInline() bool {\n\treturn meta.RawBytes != nil\n}", "func (o *LinkRouteTable) HasMain() bool {\n\tif o != nil && o.Main != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (t *Thread) IsMain() bool {\n\treturn t == t.mainThread\n}", "func isRoot(e *yang.Entry) bool {\n\treturn e.Parent == nil\n}", "func isNativeInline(o fyne.CanvasObject) bool {\n\tswitch o.(type) {\n\tcase *canvas.Image, *canvas.Text, *widget.Label:\n\t\treturn true\n\t}\n\treturn false\n}", "func (o *LinkRouteTable) GetMain() bool {\n\tif o == nil || o.Main == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.Main\n}", "func (o *ForecastModelAllOf) HasModelType() bool {\n\tif o != nil && o.ModelType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ConvergedinfraServerComplianceDetailsAllOf) HasModel() bool {\n\tif o != nil && o.Model != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (bd *BlockDAG) IsOnMainChain(h *hash.Hash) bool {\n\tbd.stateLock.Lock()\n\tdefer bd.stateLock.Unlock()\n\n\treturn bd.isOnMainChain(h)\n}", "func (me TxsdFeConvolveMatrixTypeEdgeMode) IsWrap() bool { return me.String() == \"wrap\" }", "func (obj *content) IsNormal() bool {\n\treturn obj.normal != nil\n}", "func InnerBoundaryIs(value Element) *CompoundElement { return newCEElement(\"innerBoundaryIs\", value) }", "func isMain(graph *graph.DependencyGraph, pkg string) bool {\n\tfor _, name := range graph.PackageNames[pkg] {\n\t\tif name == \"main\" {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (m *Maps) OuterWall(c types.Coordinate) bool {\n\tif m.CurrentLevel() == homeLevel {\n\t\treturn false\n\t}\n\n\treturn c.X == 0 || c.X == width-1 || c.Y == 0 || c.Y == height-1\n}", "func (f *Field) IsInlined() bool {\n\tjsonTag := reflect.StructTag(f.Tag.Value[1 : len(f.Tag.Value)-1]).Get(\"json\") // Delete first and last quotation\n\treturn strings.Contains(jsonTag, \"inline\")\n}", "func (me TxsdRecordPatternSimpleContentExtensionOffsetunit) IsLine() bool {\n\treturn me.String() == \"line\"\n}", "func (s *BasePlSqlParserListener) EnterMain_model_name(ctx *Main_model_nameContext) {}", "func (q *QuestionnaireT) LabelIsOutline(s string) bool {\n\treturn outlineNumbering1.MatchString(s) || outlineNumbering2.MatchString(s)\n}", "func (me TxsdPresentationAttributesGraphicsDisplay) IsInline() bool { return me.String() == \"inline\" }", "func (s *layoutStack) atTopLevel() bool {\n\treturn len(s.data) == 1\n}", "func (testEntityInline_EntityInfo) AddToModel(model *objectbox.Model) {\n\tmodel.Entity(\"TestEntityInline\", 4, 7566870022778519807)\n\tmodel.Property(\"Date\", objectbox.PropertyType_Date, 1, 6052475349651303914)\n\tmodel.Property(\"Value\", objectbox.PropertyType_Double, 2, 7019205901062172310)\n\tmodel.Property(\"Id\", objectbox.PropertyType_Long, 3, 5298431058949014957)\n\tmodel.PropertyFlags(objectbox.PropertyFlags_UNSIGNED | objectbox.PropertyFlags_ID)\n\tmodel.EntityLastPropertyId(3, 5298431058949014957)\n}", "func (m *Model) IsClassification() bool { return m.target.IsNominal() }", "func (i IntransitiveActivity) IsObject() bool {\n\treturn true\n}", "func nestedFlag(typ uint16) bool {\n\treturn typ&netlink.Nested != 0\n}", "func (sb *SweetieBot) IsMainGuild(info *GuildInfo) bool {\n\treturn sb.MainGuildID.Equals(info.ID)\n}", "func isEdge(e *spb.Entry) bool { return e.Target != nil && e.EdgeKind != \"\" }", "func IsInline(t NodeType) bool {\n\treturn t&(NodeText|NodeURL|NodeImage|NodeButton) != 0\n}", "func (f BodyField) isRoot() bool {\n\treturn len(f.Keys) == 0\n}", "func (u *RootInfo) IsRootInfo() {}", "func (Master) IsAnAPIObject() {}", "func (s *BasePlSqlParserListener) ExitMain_model(ctx *Main_modelContext) {}", "func isMainBranch(br string) bool {\n\treturn br == \"master\" || strings.HasPrefix(br, \"dev.\")\n}", "func OuterBoundaryIs(value Element) *CompoundElement { return newCEElement(\"outerBoundaryIs\", value) }", "func TopLevelResource(r *Resource) bool {\n\treturn len(r.OwnerRefs) == 0\n}", "func (me TxsdPresentationAttributesGraphicsDisplay) IsInlineTable() bool {\n\treturn me.String() == \"inline-table\"\n}", "func (o *StorageNetAppHighAvailability) HasPartnerModel() bool {\n\tif o != nil && o.PartnerModel != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ForecastModelAllOf) GetModelTypeOk() (*string, bool) {\n\tif o == nil || o.ModelType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ModelType, true\n}", "func (me *XsdGoPkgHasElem_InnerBoundaryIs) Walk() (err error) {\r\n\tif fn := WalkHandlers.XsdGoPkgHasElem_InnerBoundaryIs; me != nil {\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tif err = me.InnerBoundaryIs.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\treturn\r\n\t\t}\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "func hasEmbeddedObjectRecursive(structTypeInfo *types.Struct) bool {\n\tfor i := 0; i < structTypeInfo.NumFields(); i++ {\n\t\tfield := structTypeInfo.Field(i)\n\t\tfieldTypeInfo, ok := field.Type().(*types.Named)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tstructTypeInfo, ok := fieldTypeInfo.Underlying().(*types.Struct)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\t// Search for embedded \"gml.Object\" field\n\t\tif field.Embedded() {\n\t\t\tif fieldTypeInfo.String() == objectPath {\n\t\t\t\treturn true\n\t\t\t} else if hasEmbeddedObjectRecursive(structTypeInfo) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "func (o *StorageNetAppHighAvailability) GetPartnerModelOk() (*string, bool) {\n\tif o == nil || o.PartnerModel == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PartnerModel, true\n}", "func (obj *cardinality) IsSpecific() bool {\n\treturn obj.specific != nil\n}", "func (me TAttlistArticlePubModel) IsElectronicECollection() bool {\n\treturn me.String() == \"Electronic-eCollection\"\n}", "func (t Type) ModelImpl() interface{} {\n\tm, isModel := t.impl.(*modelImpl)\n\tif !isModel {\n\t\treturn nil\n\t}\n\treturn m.pubImpl\n}", "func (s *layoutStack) topInBaseTypeCollection() bool {\n\treturn s.top().inBaseTypeCollection\n}", "func Inner(a, b Tensor) (retVal Tensor, err error) {\n\tif a.Dtype() != b.Dtype() {\n\t\terr = errors.Errorf(dtypeMismatch, a.Dtype(), b.Dtype())\n\t\treturn\n\t}\n\n\tswitch at := a.(type) {\n\tcase *Dense:\n\t\tbt := b.(*Dense)\n\t\treturn at.Inner(bt)\n\t}\n\tpanic(\"Unreachable\")\n}", "func (obj *operation) IsArythmetic() bool {\n\treturn obj.ary != nil\n}", "func isRoot(entry *yang.Entry) bool {\n\tif entry.Annotation != nil {\n\t\tif v, ok := entry.Annotation[\"isFakeRoot\"]; ok {\n\t\t\treturn v == true\n\t\t}\n\t}\n\treturn false\n}", "func (t *Dense) Inner(other Tensor) (retVal interface{}, err error) {\n\t// check that the data is a float\n\tif err = typeclassCheck(t.t, floatcmplxTypes); err != nil {\n\t\treturn nil, errors.Wrapf(err, unsupportedDtype, t.t, \"Inner\")\n\t}\n\n\t// check both are vectors\n\tif !t.Shape().IsVector() || !other.Shape().IsVector() {\n\t\treturn nil, errors.Errorf(\"Inner only works when there are two vectors. t's Shape: %v; other's Shape %v\", t.Shape(), other.Shape())\n\t}\n\n\t// we do this check instead of the more common t.Shape()[1] != other.Shape()[0],\n\t// basically to ensure a similarity with numpy's dot and vectors.\n\tif t.len() != other.DataSize() {\n\t\treturn nil, errors.Errorf(shapeMismatch, t.Shape(), other.Shape())\n\t}\n\n\te := t.e\n\tswitch ip := e.(type) {\n\tcase InnerProderF32:\n\t\treturn ip.Inner(t, other)\n\tcase InnerProderF64:\n\t\treturn ip.Inner(t, other)\n\tcase InnerProder:\n\t\treturn ip.Inner(t, other)\n\t}\n\n\treturn nil, errors.Errorf(\"Engine does not support Inner()\")\n}", "func (decode *decoder) ensureOutInnerType(outInnerType reflect.Type) error {\n\tswitch outInnerType.Kind() {\n\tcase reflect.Struct:\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"cannot use \" + outInnerType.String() + \", only struct supported\")\n}", "func (o *NetworkElementSummaryAllOf) HasModel() bool {\n\tif o != nil && o.Model != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func CfnDetectorModel_IsConstruct(x interface{}) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_iotevents.CfnDetectorModel\",\n\t\t\"isConstruct\",\n\t\t[]interface{}{x},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "func UnmarshalEntityOutlineInterface(b []byte) (*EntityOutlineInterface, error) {\n\tvar err error\n\n\tvar rawMessageEntityOutline map[string]*json.RawMessage\n\terr = json.Unmarshal(b, &rawMessageEntityOutline)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Nothing to unmarshal\n\tif len(rawMessageEntityOutline) < 1 {\n\t\treturn nil, nil\n\t}\n\n\tvar typeName string\n\n\tif rawTypeName, ok := rawMessageEntityOutline[\"__typename\"]; ok {\n\t\terr = json.Unmarshal(*rawTypeName, &typeName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tswitch typeName {\n\t\tcase \"ApmApplicationEntityOutline\":\n\t\t\tvar interfaceType ApmApplicationEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"ApmDatabaseInstanceEntityOutline\":\n\t\t\tvar interfaceType ApmDatabaseInstanceEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"ApmExternalServiceEntityOutline\":\n\t\t\tvar interfaceType ApmExternalServiceEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"BrowserApplicationEntityOutline\":\n\t\t\tvar interfaceType BrowserApplicationEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"DashboardEntityOutline\":\n\t\t\tvar interfaceType DashboardEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"ExternalEntityOutline\":\n\t\t\tvar interfaceType ExternalEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"GenericEntityOutline\":\n\t\t\tvar interfaceType GenericEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"GenericInfrastructureEntityOutline\":\n\t\t\tvar interfaceType GenericInfrastructureEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"InfrastructureAwsLambdaFunctionEntityOutline\":\n\t\t\tvar interfaceType InfrastructureAwsLambdaFunctionEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"InfrastructureHostEntityOutline\":\n\t\t\tvar interfaceType InfrastructureHostEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"MobileApplicationEntityOutline\":\n\t\t\tvar interfaceType MobileApplicationEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"SecureCredentialEntityOutline\":\n\t\t\tvar interfaceType SecureCredentialEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"SyntheticMonitorEntityOutline\":\n\t\t\tvar interfaceType SyntheticMonitorEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"ThirdPartyServiceEntityOutline\":\n\t\t\tvar interfaceType ThirdPartyServiceEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"UnavailableEntityOutline\":\n\t\t\tvar interfaceType UnavailableEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"WorkloadEntityOutline\":\n\t\t\tvar interfaceType WorkloadEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\t}\n\t} else {\n\t\tkeys := []string{}\n\t\tfor k := range rawMessageEntityOutline {\n\t\t\tkeys = append(keys, k)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"interface EntityOutline did not include a __typename field for inspection: %s\", keys)\n\t}\n\n\treturn nil, fmt.Errorf(\"interface EntityOutline was not matched against all PossibleTypes: %s\", typeName)\n}", "func (s *BasePlSqlParserListener) EnterModel_rules_part(ctx *Model_rules_partContext) {}", "func (m *AttachmentItem) GetIsInline()(*bool) {\n return m.isInline\n}", "func (m *Immutable) MainType() string {\n\treturn m.contained.MainType()\n}", "func (ref Ref) IsNested() bool {\n\tfor _, x := range ref {\n\t\tif _, ok := x.Value.(Ref); ok {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func MessageIsEndOfLine(vm *VM, target, locals Interface, msg *Message) Interface {\n\treturn vm.IoBool(target.(*Message).IsTerminator())\n}", "func (o *ConvergedinfraServerComplianceDetailsAllOf) GetModelOk() (*string, bool) {\n\tif o == nil || o.Model == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Model, true\n}", "func (me *XsdGoPkgHasElem_OuterBoundaryIs) Walk() (err error) {\r\n\tif fn := WalkHandlers.XsdGoPkgHasElem_OuterBoundaryIs; me != nil {\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tif err = me.OuterBoundaryIs.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\treturn\r\n\t\t}\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "func validateModel(model interface{}) error {\n\tvar hasID bool = false\n\tmodelData := reflect.ValueOf(model).Elem()\n\tmodelType := modelData.Type()\n\n\tif modelData.Kind().String() != `struct` {\n\t\treturn NoStructError\n\t}\n\n\tfor i := 0; i < modelData.NumField(); i++ {\n\t\tif !modelData.Field(i).CanSet() {\n\t\t\treturn NonExportedAttrError\n\t\t}\n\n\t\tif modelType.Field(i).Tag.Get(`ohm`) == `id` {\n\t\t\thasID = true\n\n if modelType.Field(i).Type.Name() != `string` {\n return NonStringIDError\n }\n }\n\t}\n\n\tif !hasID {\n\t\treturn NoIDError\n\t}\n\n\treturn nil\n}", "func (b *baseVisitor) IsEnteringRoot() bool {\n\treturn b.depth == 1\n}", "func (o *EditorPlugin) HasMainScreen() gdnative.Bool {\n\t//log.Println(\"Calling EditorPlugin.HasMainScreen()\")\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(\"EditorPlugin\", \"has_main_screen\")\n\n\t// Call the parent method.\n\t// bool\n\tretPtr := gdnative.NewEmptyBool()\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.NewBoolFromPointer(retPtr)\n\treturn ret\n}", "func (l *line) isTopIndent() bool {\n\treturn l.indent == indentTop\n}", "func InnerType(typ Type) Type {\n\tswitch typ := AliasOf(typ).(type) {\n\tcase *TypeSet:\n\t\treturn typ.Type\n\tcase *TypeArray:\n\t\treturn typ.Type\n\tdefault:\n\t\treturn nil\n\t}\n}", "func (s *Db) MovieIsEdgeCollection() bool {\n\treturn false\n}", "func isRecordIntraNode(record entities.Record) bool {\n\tif srcIEWithValue, exist := record.GetInfoElementWithValue(\"sourcePodName\"); exist && srcIEWithValue.Value != \"\" {\n\t\tif dstIEWithValue, exist := record.GetInfoElementWithValue(\"destinationPodName\"); exist && dstIEWithValue.Value != \"\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (l *line) childOf(parent element) (bool, error) {\n\tvar ok bool\n\tvar err error\n\n\tswitch {\n\tcase l.isEmpty():\n\t\tok = true\n\tcase parent.ContainPlainText():\n\t\tswitch {\n\t\tcase parent.Base().ln.indent < l.indent:\n\t\t\tok = true\n\t\t}\n\tdefault:\n\t\tswitch {\n\t\tcase l.indent == parent.Base().ln.indent+1:\n\t\t\tok = true\n\t\tcase l.indent > parent.Base().ln.indent+1:\n\t\t\terr = fmt.Errorf(\"the indent is invalid [file: %s][line: %d]\", l.fileName(), l.no)\n\t\t}\n\t}\n\n\treturn ok, err\n}", "func (o *LinkRouteTable) SetMain(v bool) {\n\to.Main = &v\n}", "func (me TAttlistArticlePubModel) IsElectronic() bool { return me.String() == \"Electronic\" }", "func (t *osCinderCSITranslator) CanSupportInline(volume *v1.Volume) bool {\n\treturn volume != nil && volume.Cinder != nil\n}", "func isTopLevelComponent(component string) bool {\n\tfor _, entry := range TopLevelEntryNames {\n\t\tif entry == component {\n\t\t\treturn true\n\t\t}\n\t\tif strings.HasPrefix(component, \"validator.\") {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (me TAttlistLocationLabelType) IsPart() bool { return me.String() == \"part\" }", "func (d *Departure)IsForeignLine()bool{\n\treturn d.ForeignLine==TRUE\n}", "func (vc *client) IsVC() bool {\n\treturn vc.client.IsVC()\n}", "func (te *TreeEntry) IsSubModule() bool {\n\treturn te.entryMode == EntryModeCommit\n}", "func (obj *errorStruct) HasParent() bool {\n\treturn obj.parent != nil\n}", "func (me TAttlistArticlePubModel) IsPrint() bool { return me.String() == \"Print\" }", "func (me *XsdGoPkgHasElems_InnerBoundaryIs) Walk() (err error) {\r\n\tif fn := WalkHandlers.XsdGoPkgHasElems_InnerBoundaryIs; me != nil {\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor _, x := range me.InnerBoundaryIses {\r\n\t\t\tif err = x.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "func (n *Declarator) isExternInline() bool {\n\treturn n.IsExtern() && n.Type() != nil && n.Type().Inline()\n}", "func UnmarshalInfrastructureIntegrationEntityOutlineInterface(b []byte) (*InfrastructureIntegrationEntityOutlineInterface, error) {\n\tvar err error\n\n\tvar rawMessageInfrastructureIntegrationEntityOutline map[string]*json.RawMessage\n\terr = json.Unmarshal(b, &rawMessageInfrastructureIntegrationEntityOutline)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Nothing to unmarshal\n\tif len(rawMessageInfrastructureIntegrationEntityOutline) < 1 {\n\t\treturn nil, nil\n\t}\n\n\tvar typeName string\n\n\tif rawTypeName, ok := rawMessageInfrastructureIntegrationEntityOutline[\"__typename\"]; ok {\n\t\terr = json.Unmarshal(*rawTypeName, &typeName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tswitch typeName {\n\t\tcase \"GenericInfrastructureEntityOutline\":\n\t\t\tvar interfaceType GenericInfrastructureEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx InfrastructureIntegrationEntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"InfrastructureAwsLambdaFunctionEntityOutline\":\n\t\t\tvar interfaceType InfrastructureAwsLambdaFunctionEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx InfrastructureIntegrationEntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\t}\n\t} else {\n\t\tkeys := []string{}\n\t\tfor k := range rawMessageInfrastructureIntegrationEntityOutline {\n\t\t\tkeys = append(keys, k)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"interface InfrastructureIntegrationEntityOutline did not include a __typename field for inspection: %s\", keys)\n\t}\n\n\treturn nil, fmt.Errorf(\"interface InfrastructureIntegrationEntityOutline was not matched against all PossibleTypes: %s\", typeName)\n}", "func (o *NewData) HasModel() bool {\n\tif o != nil && o.Model != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *EquipmentIdentityAllOf) HasModel() bool {\n\tif o != nil && o.Model != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (outer outer) Visible() bool {\r\n\treturn false\r\n}", "func (te *TreeEntry) IsSubModule() bool {\n\treturn te.gogitTreeEntry.Mode == filemode.Submodule\n}", "func (s *BaseDMLListener) EnterModelParts(ctx *ModelPartsContext) {}", "func (o *CanvasItem) IsSetAsToplevel() gdnative.Bool {\n\t//log.Println(\"Calling CanvasItem.IsSetAsToplevel()\")\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(\"CanvasItem\", \"is_set_as_toplevel\")\n\n\t// Call the parent method.\n\t// bool\n\tretPtr := gdnative.NewEmptyBool()\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.NewBoolFromPointer(retPtr)\n\treturn ret\n}", "func UnmarshalApmBrowserApplicationEntityOutlineInterface(b []byte) (*ApmBrowserApplicationEntityOutlineInterface, error) {\n\tvar err error\n\n\tvar rawMessageApmBrowserApplicationEntityOutline map[string]*json.RawMessage\n\terr = json.Unmarshal(b, &rawMessageApmBrowserApplicationEntityOutline)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Nothing to unmarshal\n\tif len(rawMessageApmBrowserApplicationEntityOutline) < 1 {\n\t\treturn nil, nil\n\t}\n\n\tvar typeName string\n\n\tif rawTypeName, ok := rawMessageApmBrowserApplicationEntityOutline[\"__typename\"]; ok {\n\t\terr = json.Unmarshal(*rawTypeName, &typeName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tswitch typeName {\n\t\tcase \"ApmApplicationEntityOutline\":\n\t\t\tvar interfaceType ApmApplicationEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx ApmBrowserApplicationEntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\t}\n\t} else {\n\t\tkeys := []string{}\n\t\tfor k := range rawMessageApmBrowserApplicationEntityOutline {\n\t\t\tkeys = append(keys, k)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"interface ApmBrowserApplicationEntityOutline did not include a __typename field for inspection: %s\", keys)\n\t}\n\n\treturn nil, fmt.Errorf(\"interface ApmBrowserApplicationEntityOutline was not matched against all PossibleTypes: %s\", typeName)\n}", "func isLteCrossStructField(fl FieldLevel) bool {\n\tfield := fl.Field()\n\tkind := field.Kind()\n\n\ttopField, topKind, ok := fl.GetStructFieldOK()\n\tif !ok || topKind != kind {\n\t\treturn false\n\t}\n\n\tswitch kind {\n\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn field.Int() <= topField.Int()\n\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\treturn field.Uint() <= topField.Uint()\n\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn field.Float() <= topField.Float()\n\n\tcase reflect.Slice, reflect.Map, reflect.Array:\n\t\treturn int64(field.Len()) <= int64(topField.Len())\n\n\tcase reflect.Struct:\n\n\t\tfieldType := field.Type()\n\n\t\tif fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) {\n\n\t\t\tfieldTime := field.Convert(timeType).Interface().(time.Time)\n\t\t\ttopTime := topField.Convert(timeType).Interface().(time.Time)\n\n\t\t\treturn fieldTime.Before(topTime) || fieldTime.Equal(topTime)\n\t\t}\n\n\t\t// Not Same underlying type i.e. struct and time\n\t\tif fieldType != topField.Type() {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// default reflect.String:\n\treturn field.String() <= topField.String()\n}", "func (w *MainWindow) IsUppermostLayer(c ContextLayer) bool {\n\t//TODO find correct answer\n\treturn true\n}", "func CfnDetectorModel_IsCfnResource(construct constructs.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_iotevents.CfnDetectorModel\",\n\t\t\"isCfnResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "func (fps *ListMyProjectInvitationsResponse_FieldSubPath) IsLeaf() bool {\n\treturn fps.subPath.IsLeaf()\n}" ]
[ "0.5549369", "0.54470146", "0.5239084", "0.5052032", "0.5040084", "0.5008778", "0.49941906", "0.49561843", "0.49561843", "0.49077177", "0.4892996", "0.48708993", "0.486818", "0.4856625", "0.48033246", "0.4745723", "0.47209913", "0.470247", "0.46628037", "0.4641946", "0.4635977", "0.46328887", "0.4594992", "0.45929724", "0.4581602", "0.45780778", "0.4577763", "0.45679373", "0.4556133", "0.45426992", "0.45363638", "0.45245132", "0.45163992", "0.4508588", "0.45064694", "0.45037344", "0.44965073", "0.44861385", "0.448398", "0.44765842", "0.44569063", "0.444329", "0.4439958", "0.44399565", "0.4437262", "0.44367677", "0.44259545", "0.4425651", "0.442386", "0.44162932", "0.4406178", "0.44058338", "0.43934333", "0.4378613", "0.43699947", "0.4368994", "0.43533942", "0.4352676", "0.43526593", "0.43500596", "0.434095", "0.43180776", "0.43177673", "0.43177128", "0.43123478", "0.43112314", "0.43047276", "0.4303436", "0.430291", "0.42979455", "0.42862284", "0.4283375", "0.42723233", "0.42670655", "0.42514497", "0.424355", "0.42356908", "0.42347187", "0.42323288", "0.4225553", "0.4220811", "0.4219507", "0.4214851", "0.42128494", "0.42092475", "0.42074785", "0.42030543", "0.42014983", "0.4198064", "0.41911188", "0.41864908", "0.41861442", "0.41838372", "0.4171942", "0.41710356", "0.41676265", "0.41629016", "0.41613838", "0.41599205", "0.41594124" ]
0.89547443
0
/ DBConn Function which opens a new connection with db
func DBConn() (db *sql.DB) { dbDriver := "mysql" dbUser := "root" dbPass := "vrajupaj" dbName := "example" db, err := sql.Open(dbDriver, dbUser+":"+dbPass+"@/"+dbName) if err != nil { panic(err.Error()) } else { log.Println("Connection was opened correctly") } return db }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func newDbConnection(connStr string) *sql.DB {\n\tdb, err := sql.Open(\"postgres\", connStr)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\terr = db.Ping()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(\"[es] new db connection established.\")\n\treturn db\n}", "func dbConn() (db *sql.DB) {\n\t// declaring some variables to use in the in the when opening the db not super useful now but later version will be helpful\n\tdbDriver := \"mysql\"\n\tdbUser := creds.UserName\n\tdbPass := creds.Password\n\tDBName := creds.DBName\n\tlit.Debug(\"Hit dbConn Entered\")\n\tdb, err := sql.Open(dbDriver, dbUser+\":\"+dbPass+\"@/\"+DBName)\n\tif err != nil {\n\t\tlit.Error(\"Something terrible has happened\")\n\t}\n\treturn db\n}", "func (c *SQLClient) OpenConn(user string, pass string) (*gorm.DB, error) {\n\tdsnConfig := mysql.NewConfig()\n\tdsnConfig.Net = \"tcp\"\n\tdsnConfig.Addr = fmt.Sprintf(\"%s:%d\", c.config.Host, c.config.Port)\n\tdsnConfig.User = user\n\tdsnConfig.Passwd = pass\n\tdsnConfig.Timeout = time.Second * 5\n\tdsnConfig.ParseTime = true\n\tdsnConfig.Loc = time.Local\n\tdsnConfig.MultiStatements = true // TODO: Disable this, as it increase security risk.\n\tdsnConfig.TLSConfig = c.config.TLSKey\n\tdsn := dsnConfig.FormatDSN()\n\n\tdb, err := gorm.Open(mysqlDriver.Open(dsn))\n\tif err != nil {\n\t\tlog.Warn(\"Failed to open SQL connection\",\n\t\t\tzap.String(\"targetComponent\", distro.R().TiDB),\n\t\t\tzap.Error(err))\n\t\tif mysqlErr, ok := err.(*mysql.MySQLError); ok {\n\t\t\tif mysqlErr.Number == mysqlerr.ER_ACCESS_DENIED_ERROR {\n\t\t\t\treturn nil, ErrAuthFailed.New(\"Bad SQL username or password\")\n\t\t\t}\n\t\t}\n\t\treturn nil, ErrConnFailed.Wrap(err, \"Failed to connect to %s\", distro.R().TiDB)\n\t}\n\n\t// Ensure that when the App stops resources are released\n\tif c.config.BaseContext != nil {\n\t\tdb = db.WithContext(c.config.BaseContext)\n\t}\n\n\treturn db, nil\n}", "func DbConn() (db *sql.DB) {\n\t//var host = \"tcp(192.168.0.14)\"\n\tvar host = \"tcp(192.168.0.12)\"\n\t// var host = \"tcp(127.0.0.1)\"\n\tdbname := \"dbaexperience\"\n\tdb, err := sql.Open(config.DbDriver, fmt.Sprintf(\"%s:%s@%s/%s\", config.DbUser, config.DbPass, host, dbname))\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn db\n}", "func dbConnect(dbConnParams string) *sql.DB {\n\tdb, err := sql.Open(\"postgres\", dbConnParams) // this opens a connection and adds to the pool\n\terrMsgHandler(fmt.Sprintf(\"Failed to connect to the database\"), err)\n\n\t// connect to the database\n\terr = db.Ping() // this validates that the opened connection \"db\" is actually working\n\terrMsgHandler(fmt.Sprintf(\"The database connection is no longer open\"), err)\n\n\tfmt.Println(\"Successfully connected to the database\")\n\treturn db\n}", "func (p *Pool) Open(Connstr string) *sql.DB{\n if val,ok:=p.availablePool[Connstr];ok{\n\t p.usedPool[Connstr]=p.availablePool[Connstr];\n\t\tdelete(p.availablePool,Connstr)\n return val\n }else{\n dbb, err:=sql.Open(\"go_ibm_db\", Connstr)\n if err != nil{\n return nil\n }\n p.usedPool[Connstr]=dbb;\n db=dbb\n con=Connstr\n }\n return db\n}", "func dbConn() (db *sql.DB) {\r\n\tdbDriver := \"mysql\"\r\n\tdbUser := \"root\"\r\n\tdbPass := \"\"\r\n\tdbName := \"golang\"\r\n\tdb, err := sql.Open(dbDriver, dbUser+\":\"+dbPass+\"@/\"+dbName)\r\n\tif err != nil {\r\n\t\tpanic(err.Error())\r\n\t}\r\n\treturn db\r\n}", "func dbConn() (db *sql.DB) {\n\tdbDriver := \"mysql\"\n\tdbUser := \"root\"\n\tdbpass := \"Green2013[]\"\n\tdbName := \"goblog\"\n\n\tdb, err := sql.Open(dbDriver, dbUser+\":\"+dbpass+\"@/\"+dbName)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\treturn db\n\n}", "func dbConn() *sql.DB {\n\tdbDet := DBDetails{}\n\tdbDet.DbDriver = beego.AppConfig.String(\"dbDriver\")\n\tdbDet.DbUser = beego.AppConfig.String(\"dbUser\")\n\tdbDet.Dbpassword = beego.AppConfig.String(\"dbPass\")\n\tdbDet.DbName = beego.AppConfig.String(\"dbName\")\n\tdb, err := sql.Open(dbDet.DbDriver, dbDet.DbUser+\":\"+dbDet.Dbpassword+\"@/\"+dbDet.DbName)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn db\n}", "func openDB(cfg config) (*sql.DB, error) {\n\t// Use sql.Open() to create an empty connection pool, using the DSN from the config\n\t// struct.\n\tdb, err := sql.Open(\"postgres\", cfg.db.dsn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Set the maximum number of open (in-use + idle) connections in the pool. Note that\n\t// passing a value less than or equal to 0 will mean there is no limit.\n\tdb.SetMaxOpenConns(cfg.db.maxOpenConns)\n\n\t// Set the maximum number of idle connections in the pool. Again, passing a value\n\t// less than or equal to 0 will mean there is no limit.\n\tdb.SetMaxIdleConns(cfg.db.maxIdleConns)\n\n\t// Use the time.ParseDuration() function to convert the idle timeout durantion type\n\t// to a time.Duration type.\n\tdurantion, err := time.ParseDuration(cfg.db.maxIdleTime)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Set the maximum idle timeout\n\tdb.SetConnMaxIdleTime(durantion)\n\n\t// Create a context with a 5-second timeout deadline.\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\t// Use PingContext() to establish a new connection to the database, passing in the\n\t// context we created above as a parameter. If the connection couldn't be\n\t// established successfully within the 5 second deadline, then this will return an\n\t// err\n\terr = db.PingContext(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Return the sql.Db connection pool\n\treturn db, nil\n}", "func openDB(cfg config) (*sql.DB, error) {\n\t// Use sql.Open() to create an empty connection pool, using the DSN from the config\n\t// struct.\n\tdb, err := sql.Open(\"postgres\", cfg.db.dsn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Set the maximum number of open (in-use + idle) connections in the pool. Note that\n\t// passing a value less than or equal to 0 will mean there is no limit.\n\tdb.SetMaxOpenConns(cfg.db.maxOpenConns)\n\n\t// Set the maximum number of idle connections in the pool. Again, passing a value\n\t// less than or equal to 0 will mean there is no limit.\n\tdb.SetMaxIdleConns(cfg.db.maxIdleConns)\n\n\t// Use the time.ParseDuration() function to convert the idle timeout duration string\n\t// to a time.Duration type.\n\tduration, err := time.ParseDuration(cfg.db.maxIdleTime)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Set the maximum idle timeout.\n\tdb.SetConnMaxIdleTime(duration)\n\n\t// Create a context with a 5-second timeout deadline.\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\t// Use PingContext() to establish a new connection to the database, passing in the\n\t// context we created above as a parameter. If the connection couldn't be\n\t// established successfully within the 5 second deadline, then this will return an\n\t// error.\n\terr = db.PingContext(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Return the sql.DB connection pool.\n\treturn db, nil\n}", "func Open(driverName, masterDSN string, replicasDSNs []string) (*DB, error) {\n\tconns := make([]string, 0, len(replicasDSNs)+1)\n\tconns = append(conns, masterDSN)\n\tconns = append(conns, replicasDSNs...)\n\n\tdb := &DB{\n\t\tcpdbs: make([]*connection, len(conns)),\n\t}\n\n\terr := scatter(len(db.cpdbs), func(i int) (err error) {\n\t\tconn, err := sql.Open(driverName, conns[i])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = conn.Ping()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdb.cpdbs[i] = new(connection)\n\t\tdb.cpdbs[i].db = conn\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "func dbconn() (db *sql.DB) {\n\tdbDriver := \"mysql\"\n dbUser := \"root\"\n dbPass := \"\"\n\tdbName := \"pmi\"\n\tdb, err := sql.Open(dbDriver, dbUser+\":\"+dbPass+\"@/\"+dbName)\n\tif err != nil {\n panic(err.Error())\n }\n return db\n}", "func (self *CSql) Connect(driverName string, dial string) (*sql.DB, error) {\r\n\tvar err error = nil\r\n\tself.db, err = sql.Open(driverName, dial)\r\n\tself.db.SetMaxOpenConns(20)\r\n\tself.db.SetMaxIdleConns(10)\r\n\tself.db.SetConnMaxLifetime(60 * time.Second)\r\n\treturn self.db, err\r\n}", "func connectDB(cfg *config.DB) error{\n\turi := fmt.Sprintf(\"%s:%s@tcp(%s)/%s?charset=utf8&parseTime=True\", cfg.User, cfg.Password, cfg.Address, cfg.Name)\n\tconn, err := gorm.Open(dialect, uri)\n\tif err != nil{\n\t\treturn err\n\t}\n\tdefaultDB = &DB{conn}\n\tdefaultDB.DB.DB().SetMaxIdleConns(cfg.MaxIdleConn)\n\tdefaultDB.DB.DB().SetMaxOpenConns(cfg.MaxOpenConn)\n\tdefaultDB.DB.DB().SetConnMaxLifetime(cfg.MaxConnLifetime)\n\tdefaultDB.DB.LogMode(cfg.Debug)\n\n\treturn nil\n}", "func Connect(driver, db string) *sql.DB {\n\tDB, err := sql.Open(driver, db)\n\tcheckErr(err)\n\treturn DB\n}", "func OpenConnection(cnf config.Config) (*sql.DB, error) {\n\tusername := cnf.DBUsername\n\tpassword := cnf.DBPassword\n\thost := cnf.DBHost\n\tport := cnf.DBPort\n\tdatabase := cnf.Database\n\n\tdsn := fmt.Sprintf(\"%v:%v@tcp(%v:%v)/%v?parseTime=true\", username, password, host, port, database)\n\n\tlog.Debugf(\"Connect to : %v\", dsn)\n\tdb, err := sql.Open(\"mysql\", dsn)\n\tif err != nil {\n\t\treturn nil, ErrCanNotConnectWithDatabase\n\t}\n\n\t// Open doesn't open a connection. Validate DSN data:\n\terr = db.Ping()\n\tif err != nil {\n\t\treturn nil, ErrCanNotConnectWithDatabase\n\t}\n\treturn db, nil\n}", "func dbConn() (db *sql.DB) {\n\tdbDriver := \"mysql\"\n\tdbUser := \"root\"\n\tdbPass := \"Kikker12\"\n\tdbName := \"vitaintellectdb\"\n\tdb, err := sql.Open(dbDriver, dbUser+\":\"+dbPass+\"@/\"+dbName)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn db\n}", "func getConn() *gorm.DB {\n\tdsn := \"host=localhost user=hello password=hello dbname=hello port=15432 sslmode=disable TimeZone=Asia/Shanghai\"\n\tdb, _ := gorm.Open(postgres.Open(dsn), &gorm.Config{})\n\n\treturn db\n\t// sqlDB, err := db.DB()\n\n\t// // SetMaxIdleConns 设置空闲连接池中连接的最大数量\n\t// sqlDB.SetMaxIdleConns(10)\n\t// // SetMaxOpenConns 设置打开数据库连接的最大数量。\n\t// sqlDB.SetMaxOpenConns(100)\n\n\t// // SetConnMaxLifetime 设置了连接可复用的最大时间。\n\t// sqlDB.SetConnMaxLifetime(time.Hour)\n}", "func dbConn() (db *sql.DB) {\n\tdbDriver := \"mysql\"\n\tdbUser := \"root\"\n\tdbName := \"appointment_db\"\n\tdb, err := sql.Open(dbDriver, dbUser+\"@tcp(127.0.0.1:3306)/\"+dbName+\"?parseTime=true\")\n\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\treturn db\n}", "func OpenConnection(cnf config.Config) (*sql.DB, error) {\n\tusername := cnf.DBUsername\n\tpassword := cnf.DBPassword\n\thost := cnf.DBHost\n\tport := cnf.DBPort\n\tdatabase := cnf.Database\n\n\tdsn := fmt.Sprintf(\"%v:%v@tcp(%v:%v)/%v\", username, password, host, port, database)\n\n\tlog.Debugf(\"Connect to : %v\", dsn)\n\tdb, err := sql.Open(\"mysql\", dsn)\n\tif err != nil {\n\t\treturn nil, ErrCanNotConnectWithDatabase\n\t}\n\n\t// Open doesn't open a connection. Validate DSN data:\n\terr = db.Ping()\n\tif err != nil {\n\t\treturn nil, ErrCanNotConnectWithDatabase\n\t}\n\treturn db, nil\n}", "func InitDB(driverName, dataSourceName string) (*sql.DB) {\n conn, err := sql.Open(driverName, dataSourceName)\n \n log.Println(\"open main db conn\")\n \n if err != nil {\n log.Fatal(\"DB is not connected\")\n }\n \n if err = conn.Ping(); err != nil {\n log.Fatal(\"DB is not responded\")\n }\n \n return conn\n}", "func ConnectDB() *sql.DB {\n\n\t// connString := fmt.Sprintf(\"%s/%s/@//****:****/%s\",\n\t// dbusername,\n\t// dbpassword,\n\t// dbsid)\n\n\t// db, err := sql.Open(\"goracle\", connString)\n\tdb, err := sql.Open(\n\t\t\"godror\", \"plnadmin/plnadmin@apkt_dev\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn db\n}", "func Conn() (db *sql.DB) {\n\t// dbDriver := \"mysql\"\n\t// dbUser := \"root\"\n\t// dbPass := \"1234\"\n\t// dbName := \"accuknox\"\n\t// db, err := sql.Open(dbDriver, dbUser+\":\"+dbPass+\"@/\"+dbName)\n\tconnString := \"root:1234@tcp(localhost:3306)/accuknox\"\n\tdb, err := sql.Open(\"mysql\", connString)\n\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn db\n}", "func OpenConnection(ctx context.Context, logContext, dsn string, maxConns, maxIdleConns int, maxConnLifetime time.Duration) (*sql.DB, error) {\n\tvar (\n\t\turl *dburl.URL\n\t\tconn *sql.DB\n\t\terr error\n\t\tch = make(chan error)\n\t)\n\n\turl, err = safeParse(dsn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdriver := url.Driver\n\tif url.GoDriver != \"\" {\n\t\tdriver = url.GoDriver\n\t}\n\n\t// Open the DB handle in a separate goroutine so we can terminate early if the context closes.\n\tgo func() {\n\t\tconn, err = sql.Open(driver, url.DSN)\n\t\tclose(ch)\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn nil, ctx.Err()\n\tcase <-ch:\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tconn.SetMaxIdleConns(maxIdleConns)\n\tconn.SetMaxOpenConns(maxConns)\n\tconn.SetConnMaxLifetime(maxConnLifetime)\n\n\tif klog.V(1).Enabled() {\n\t\tif len(logContext) > 0 {\n\t\t\tlogContext = fmt.Sprintf(\"[%s] \", logContext)\n\t\t}\n\t\tklog.Infof(\"%sDatabase handle successfully opened with '%s' driver\", logContext, driver)\n\t}\n\treturn conn, nil\n}", "func (d *DB) Conn() *sql.DB { return d.conn }", "func Connect(c *Config) (*sql.DB, error) {\n\n\tdb, err := sql.Open(\"sqlserver\", generateConnectionString(c))\n\tif err != nil {\n\t\tlog.Fatal(\"Error creating connection pool: \" + err.Error())\n\t}\n\treturn db, nil\n}", "func Open() (DB, error) {\n\tif config.Bridge.DB.Driver != \"sqlserver\" {\n\t\treturn nil, errors.New(\"only sqlserver is supported at the moment\")\n\t}\n\n\tquery := url.Values{}\n\tquery.Add(\"database\", config.Bridge.DB.Name)\n\n\tconnURL := &url.URL{\n\t\tScheme: \"sqlserver\",\n\t\tUser: url.UserPassword(config.Bridge.DB.User, config.Bridge.DB.Password),\n\t\tHost: fmt.Sprintf(\"%s:%d\", config.Bridge.DB.Host, config.Bridge.DB.Port),\n\t\tRawQuery: query.Encode(),\n\t}\n\n\tdbConn, err := sql.Open(config.Bridge.DB.Driver, connURL.String())\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not create db connection pool\")\n\t}\n\n\tif err := dbConn.Ping(); err != nil {\n\t\tdbConn.Close()\n\t\treturn nil, errors.Wrap(err, \"could not connect to database server\")\n\t}\n\treturn &db{dbConn}, nil\n}", "func connectDb() *sql.DB {\n\tconnStr := \"user=postgres dbname=postgres sslmode=disable port=5000\"\n\tdb, err := sql.Open(\"postgres\", connStr)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn db\n}", "func createConnection() *sql.DB {\n\t// load .env file\n\terr := godotenv.Load(\".env\")\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error loading .env file\")\n\t}\n\n\t// Open the connection\n\tusername := os.Getenv(\"db_user\")\n\tpassword := os.Getenv(\"db_pass\")\n\tdbName := os.Getenv(\"db_name\")\n\tdbHost := os.Getenv(\"db_host\")\n\tdbURI := fmt.Sprintf(\"host=%s user=%s dbname=%s sslmode=disable password=%s\", dbHost, username, dbName, password) //Build connection string\n\n\tdb, err := sql.Open(\"postgres\", dbURI)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// check the connection\n\terr = db.Ping()\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"Successfully connected!\")\n\t// return the connection\n\treturn db\n}", "func (dbInfo *DBInfo) DbConn() (db *sql.DB) {\n\tdbDriver := \"mysql\"\n\tdb, err := sql.Open(dbDriver, dbInfo.User+\":\"+dbInfo.Pass+\"@tcp(\"+dbInfo.Host+\":3306)/\"+dbInfo.Name)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn db\n}", "func (d *Driver) Open(connStr string) (driver.Conn, error) {\n\trestClient, err := NewRestClient(nil, connStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefaultDb, ok := restClient.params[\"DEFAULTDB\"]\n\tif !ok {\n\t\tdefaultDb, _ = restClient.params[\"DB\"]\n\t}\n\treturn &Conn{restClient: restClient, defaultDb: defaultDb}, nil\n}", "func DBCon() *sql.DB {\n\tdbCfg := readConfig()\n\n\t// dbconnection string format: \"username:password@tcp(127.0.0.1:3306)/test\"\n\tdb, err := sql.Open(\"mysql\", fmt.Sprintf(\"%s:%s@tcp(%s:%s)/%s\", dbCfg.usr, dbCfg.pass,\n\t\tdbCfg.host, dbCfg.port, dbCfg.dbname))\n\n\tif err != nil {\n\t\tlog.Fatal(\"(ERR) Database connection configuration is not satisfied: \", err)\n\t}\n\n\t// You can set the connection details here if you are using only this application for the database\n\t/*db.SetMaxOpenConns(25)\n\tdb.SetMaxIdleConns(25)\n\tdb.SetConnMaxLifetime(5 * time.Minute)*/\n\n\t// In Go, connection doesn't mean that it is connected successfully so you need to ping the database if the\n\t// connection is really available with the given config\n\tctx, cancelfunc := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancelfunc()\n\terr = db.PingContext(ctx)\n\tif err != nil {\n\t\tlog.Fatalf(\"(ERR) Database: %s with host: %s is not reachable: %s\", dbCfg.dbname, dbCfg.host,\n\t\t\terr.Error())\n\t}\n\n\treturn db\n\n}", "func OpenDBConnection(connStr string, config gorm.Config) (*gorm.DB, error) {\n\tvar err error\n\tonce.Do(func() {\n\t\tdb, err := gorm.Open(mysql.Open(connStr), &config)\n\t\tif err == nil {\n\t\t\tsingleton = db\n\t\t}\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn singleton, nil\n}", "func CreateConnection_old(host string, port string, user string, pwd string) (*sql.DB, error) {\n\t// Create dsn\n\tdsn := \"hdb://\" + user + \":\" + pwd + \"@\" + host + \":\" + port\n\t// Create connector\n\tconnector, err := driver.NewDSNConnector(dsn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Set connectior option\n\tconnector.SetFetchSize(512)\n\t// Create db object\n\tdb := sql.OpenDB(connector)\n\t// Test connection\n\terr = db.Ping()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Return\n\treturn db, nil\n}", "func OpenConnection(props *DbProperties) *sql.DB {\n\tpsqlInfo := fmt.Sprintf(\"host=%s port=%s user=%s password=%s dbname=%s sslmode=disable\",\n\t\tprops.Host, props.Port, props.User, props.Password, props.Dbname)\n\n\tdb, err := sql.Open(\"postgres\", psqlInfo)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = db.Ping()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn db\n}", "func Connect(user string, password string, host string, port int, schema string, dsn string) (*sql.DB, error) {\n\tvar err error\n\tvar connString bytes.Buffer\n\n\tpara := map[string]interface{}{}\n\tpara[\"User\"] = user\n\tpara[\"Pass\"] = password\n\tpara[\"Host\"] = host\n\tpara[\"Port\"] = port\n\tpara[\"Schema\"] = schema\n\n\ttmpl, err := template.New(\"dbconn\").Option(\"missingkey=zero\").Parse(dsn)\n\tif err != nil {\n\t\tlog.Error().Err(err).Msg(\"tmpl parse\")\n\t\treturn nil, err\n\t}\n\n\terr = tmpl.Execute(&connString, para)\n\tif err != nil {\n\t\tlog.Error().Err(err).Msg(\"tmpl execute\")\n\t\treturn nil, err\n\t}\n\n\tlog.Debug().Str(\"dsn\", connString.String()).Msg(\"connect to db\")\n\tdb, err := sql.Open(\"mysql\", connString.String())\n\tif err != nil {\n\t\tlog.Error().Err(err).Msg(\"mysql connect\")\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "func OpenMysql(driverName, dataSourceName string) (db *MysqlDB, err error) {\n var db2 *sql.DB\n db2, err = sql.Open(driverName, dataSourceName)\n if err != nil {\n return\n }\n db = &MysqlDB{}\n db.DB.DB = *db2\n return\n}", "func (d MySQLDriver) OpenDB() (*sql.DB, error) {\n\ta := d.username + \":\" + d.pass + \"@\" + d.server + \"/\" + d.database\n\tfmt.Println(a)\n\tdb, err := sql.Open(\"mysql\", d.username+\":\"+d.pass+\"@(\"+d.server+\")/\"+d.database)\n\tif err != nil {\n\t\tcheckErr(err) // Just for example purpose. You should use proper error handling instead of panic\n\t}\n\treturn db, err\n}", "func createConnection() (io.Closer, error) {\n\tid := atomic.AddInt32(&idCounter, 1)\n\tlog.Println(\"Create: New Connection\", id)\n\treturn &dbConnection{id}, nil\n}", "func (w *DBInstance) connect() (req DBRequest, err error) {\n\treq.db, err = gorm.Open(\"mysql\", fmt.Sprintf(\"%v:%v@/%v?charset=utf8&parseTime=True&loc=Local\", w.sqlUser, w.sqlPass, w.sqlDBName))\n\treturn\n}", "func dbConnect() *sql.DB {\n\tdb, err := sql.Open(\"postgres\",\n\t\tfmt.Sprintf(\"user=%s password=%s dbname=%s host=%s port=%s sslmode=%s\",\n\t\t\tPG_USER,\n\t\t\tPG_PASSWORD,\n\t\t\tPG_DB,\n\t\t\tPG_HOST,\n\t\t\tPG_PORT,\n\t\t\tPG_SSL,\n\t\t))\n\tif err != nil {\n\t\tlog.Fatalf(\"ERROR: Error connecting to Postgres => %s\", err.Error())\n\t}\n\tlog.Printf(\"PQ Database connection made to %s\", PG_DB)\n\treturn db\n}", "func newDBClient() connection {\n\tc := client{}\n\terr := c.connect()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\terr = c.applySchema()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn &c\n}", "func Open() *sql.DB {\n\tusername := \"root\"\n\tpassword := \"DB_PASSWORD\"\n\tprotocol := \"tcp\"\n\taddress := \"mysql\"\n\tport := \"3306\"\n\tdbname := \"leafme\"\n\tdb, _ := sql.Open(\"mysql\",\n\t\tusername+\":\"+password+\"@\"+protocol+\"(\"+address+\":\"+port+\")/\"+dbname+\"?parseTime=true\")\n\treturn db\n}", "func (pg *PostgresqlDb)Open() *domain.ErrHandler {\n connErr:= pg.config() \n if connErr != nil {\n return connErr\n }\n var err error\n psqlInfo := fmt.Sprintf(\"host=%s port=%d user=%s password=%s dbname=%s sslmode=disable\", pg.host, pg.port, pg.user, pg.pass, pg.dbname)\n pg.conn, err = sql.Open(\"postgres\", psqlInfo)\n if err != nil {\n return &domain.ErrHandler{1, \"func (pg PostgresqlDb)\", \"Open\", err.Error()}\n }\n err = pg.conn.Ping()\n if err != nil {\n return &domain.ErrHandler{1, \"func (pg PostgresqlDb)\", \"Open\", err.Error()}\n }\n connErr = pg.initDb()\n if connErr != nil {\n return connErr\n }\n return nil\n}", "func OpenConnection() *sql.DB {\r\n\tpsqlInfo := fmt.Sprintf(\"user=%s \"+\"password=%s dbname=%s sslmode=disable\", user, password, dbname)\r\n\tdb, err := sql.Open(\"postgres\", psqlInfo)\r\n\tcheckErr(err)\r\n\terr = db.Ping()\r\n\tcheckErr(err)\r\n\t//fmt.Println(\"Connected!\")\r\n\treturn db\r\n}", "func Conn() (*sql.DB, error) {\n\tdb, err := sql.Open(\"postgres\", \"postgres://postgres:changeme@localhost/garages?sslmode=disable\")\n\tif err != nil {\n\t\tfmt.Println(`Could not connect to db`)\n\t\treturn nil, err\n\t}\n\n\tif err := db.Ping(); err != nil {\n\t\tfmt.Println(`Could not connect to db`)\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "func PgConn(dataSourceName string) *sql.DB {\n\tvar err error\n\tfmt.Println(\"connecting...\")\n\tdbDriver, err = sql.Open(\"postgres\", dataSourceName)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\t//defer db.Close()\n\n\tif err = dbDriver.Ping(); err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tfmt.Println(\"#****Successfully connected*****#\")\n\treturn dbDriver\n}", "func createConnection() *sql.DB {\n\t// load .env file\n\terr := godotenv.Load(\".env\")\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error loading .env file\")\n\t}\n\n\t// Open the connection\n\tdb, err := sql.Open(\"postgres\", os.Getenv(\"POSTGRES_URL\"))\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// check the connection\n\terr = db.Ping()\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"Successfully connected!\")\n\t// return the connection\n\treturn db\n}", "func CreateConnection(requestID string) (*sql.DB, error) {\n\t// 요청된 requestID에 대한 반출 조회\n\toptionfilePath, err := checkFileExistance(requestID, \"query.json\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// 데이터베이스 연결 정보 및 반출 처리 옵션 읽어오기\n\toptions, err := getOptionFile(optionfilePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// 데이터베이스 연결 정보 추출\n\tconnInfo := options[\"conn\"].(map[string]interface{})\n\n\t// DSN 생성\n\tdsn := \"hdb://\" + connInfo[\"user\"].(string) + \":\" + connInfo[\"pwd\"].(string) + \"@\" + connInfo[\"host\"].(string) + \":\" + connInfo[\"port\"].(string)\n\t// 커넥터 생성\n\tconnector, err := driver.NewDSNConnector(dsn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// 커넥터 옵션 설정\n\tconnector.SetFetchSize(512)\n\t// 데이터베이스 객체 생성\n\tdb := sql.OpenDB(connector)\n\t// 연결 테스트\n\terr = db.Ping()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Return\n\treturn db, nil\n}", "func OpenDB(c *Connector) *DB {\n\tmetrics := newMetrics(stdHdbDriver.metrics, statsCfg.TimeUpperBounds)\n\tnc := &Connector{\n\t\tconnAttrs: c.connAttrs,\n\t\tauthAttrs: c.authAttrs,\n\t\tnewConn: func(ctx context.Context, connAttrs *connAttrs, authAttrs *authAttrs) (driver.Conn, error) {\n\t\t\treturn newConn(ctx, metrics, connAttrs, authAttrs) // use db specific metrics\n\t\t},\n\t}\n\treturn &DB{\n\t\tmetrics: metrics,\n\t\tDB: sql.OpenDB(nc),\n\t}\n}", "func connect(dsn string) *sql.DB {\n\tdb, err := sql.Open(\"mysql\", dsn)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Set the maximum number of idle connections in the pool. Setting this\n\t// to less than or equal to 0 will mean that no idle connections are retained.\n\tdb.SetMaxIdleConns(5)\n\n\tif err := db.Ping(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn db\n}", "func (d *Driver) Open(uri string) (driver.Conn, error) {\n proto, addr, dbname, user, passwd, params, err := parseDSN(uri)\n\tif err != nil {\n\t return nil, err\n }\n\td.proto = proto\n d.raddr = addr\n d.user = user\n\td.passwd = passwd\n d.db = dbname\n\n\t// Establish the connection\n\tc := conn{mysql.New(d.proto, d.laddr, d.raddr, d.user, d.passwd, d.db)}\n\n if v, ok := params[\"charset\"]; ok {\n Register(\"SET NAMES \" + v)\n }\n if v, ok := params[\"keepalive\"]; ok {\n t, err := strconv.Atoi(v)\n if err != nil {\n return nil, ErrMaxIdle\n }\n RegisterFunc(func(my mysql.Conn){\n go func() {\n for my.IsConnected() {\n time.Sleep(time.Duration(t) * time.Second)\n if err := my.Ping(); err != nil {\n break\n }\n }\n }()\n })\n }\n\tfor _, q := range d.initCmds {\n\t\tc.my.Register(q) // Register initialisation commands\n\t}\n for _, f := range d.initFuncs {\n c.my.RegisterFunc(f)\n }\n\tif err := c.my.Connect(); err != nil {\n\t\treturn nil, errFilter(err)\n\t}\n\treturn &c, nil\n}", "func dbConn(dbUrl string) {\n\tvar err error\n\tconn, err = pgx.Connect(context.Background(), dbUrl)\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to connect to database: %v\\n\", err)\n\t}\n}", "func createConnection() (io.Closer, error) {\n\tid := atomic.AddInt32(&idCounter, 1)\n\tfmt.Println(\"--> Create: New Connection\", id)\n\treturn &dbConnection{id}, nil\n}", "func newConnection() connection {\n\tdatabase := sqlx.MustOpen(driverName, \"user=erosai dbname=erosai password=Erosai11!! sslmode=disable\")\n\tc := connection{\n\t\tdb: database,\n\t}\n\n\tregisterConnection(&c)\n\n\treturn c\n}", "func ConnectDB() *sql.DB {\n\thost := viper.GetString(\"db.host\")\n\tport := viper.GetString(\"db.port\")\n\tuser := viper.GetString(\"db.user\")\n\tpass := viper.GetString(\"db.pass\")\n\tdsn := fmt.Sprintf(\"%s:%s@tcp(%s:%s)/%s\", user, pass, host, port, user)\n\tdb, err := sql.Open(\"mysql\", dsn)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error connecting to db: %s\\n\", err.Error())\n\t}\n\treturn db\n}", "func Connect(pool ServerPool, spec db.Specifier) (db.DB, error) {\n\tpool.RLock()\n\n\tif db, ok := pool.Get(spec); ok {\n\t\t// The connection was found. Do we need to update it?\n\t\tif db.Spec().NeedsUpdate(spec) {\n\t\t\tpool.RUnlock()\n\t\t\tpool.Lock()\n\t\t\t// By now, someone else may have updated it already.\n\t\t\tif db.Spec().NeedsUpdate(spec) {\n\t\t\t\tif err := db.Update(spec); err != nil {\n\t\t\t\t\tpool.Unlock()\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t\tpool.Unlock()\n\t\t\tpool.RLock()\n\t\t}\n\t\tpool.RUnlock()\n\t\treturn db, nil\n\t}\n\tpool.RUnlock()\n\treturn insertNewDB(pool, spec)\n}", "func (adapter *MySQLAdapter) OpenConnection(config *config.DatabaseConfig, queryString string) (*sql.DB, error) {\n\tif len(config.Masters) > 1 {\n\t\treturn nil, errors.New(\"Sorry, currently supports single master database only\")\n\t}\n\tdbname := config.NameOrPath\n\tfor _, master := range config.Masters {\n\t\tdsn := fmt.Sprintf(\"%s:%s@tcp(%s)/%s?%s\", config.Username, config.Password, master, dbname, queryString)\n\t\tdebug.Printf(\"dsn = %s\", strings.Replace(dsn, \"%\", \"%%\", -1))\n\t\tconn, err := sql.Open(config.Adapter, dsn)\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithStack(err)\n\t\t}\n\t\treturn conn, nil\n\t}\n\tfor _, slave := range config.Slaves {\n\t\tdsn := fmt.Sprintf(\"%s:%s@tcp(%s)/%s?%s\", config.Username, config.Password, slave, dbname, queryString)\n\t\tdebug.Printf(\"TODO: not support slave. dsn = %s\", dsn)\n\t\tbreak\n\t}\n\n\tfor _, backup := range config.Backups {\n\t\tdsn := fmt.Sprintf(\"%s:%s@tcp(%s)/%s?%s\", config.Username, config.Password, backup, dbname, queryString)\n\t\tdebug.Printf(\"TODO: not support backup. dsn = %s\", dsn)\n\t}\n\treturn nil, errors.New(\"must define 'master' server\")\n}", "func connectDB(name, user, password string) (*sql.DB, error) {\n\tdb, err := sql.Open(\"postgres\", fmt.Sprintf(\"user=%s dbname=%s password=%s sslmode=disable\", user, name, password))\n\treturn db, err\n}", "func Open(ctx context.Context, addr string, opts ...PGOpt) (*sql.DB, error) {\n\toptions := &pgOptions{\n\t\tdb: \"postgres\",\n\t\tuser: \"postgres\",\n\t\tpassword: \"\",\n\t\tdialAttempts: 5,\n\t}\n\tfor _, o := range opts {\n\t\to(options)\n\t}\n\n\tconnStr := fmt.Sprintf(\"postgres://%s:%s@%s/%s?sslmode=disable\",\n\t\tescp(options.user),\n\t\tescp(options.password),\n\t\taddr,\n\t\tescp(options.db))\n\n\tvar err error\n\tfor i := 0; i < options.dialAttempts; i++ {\n\t\tlog.Printf(\"Attempting connection %d of %d to %v\", i+1, options.dialAttempts, addr)\n\t\tvar db *sql.DB\n\t\tif db, err = connect(ctx, connStr); err == nil {\n\t\t\tlog.Printf(\"Connected\")\n\t\t\treturn db, nil\n\t\t}\n\t\tlog.Printf(\"Error connecting: %v\", err)\n\t\tif i < options.dialAttempts-1 {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn nil, ctx.Err()\n\t\t\tcase <-time.After(5 * time.Second):\n\t\t\t}\n\t\t}\n\t}\n\treturn nil, err\n}", "func OpenDB(host, user, password, dbname string) error {\n\tvar err error\n\tdb, err = sql.Open(\"postgres\",\n\t\tfmt.Sprintf(\"host=%s user=%s password=%s dbname=%s \"+\n\t\t\t\"sslmode=%s\", host, user, password, dbname, db_ssl_mode))\n\treturn err\n}", "func initDBConnection(dbUser, dbPass, dbURL, dbNAME string) (err error) {\n\t/*\n\t\tVariables defined here\n\t*/\n\tvar user, pass, url, name string\n\n\t/*\n\t\tverify that all variables exists\n\t*/\n\tif len(dbUser) == 0 || len(dbURL) == 0 || len(dbPass) == 0 || len(dbNAME) == 0 {\n\t\terr = errors.New(\"Missing DB Credentails. Please Check\")\n\t\treturn\n\t}\n\n\t/*\n\t\tverify the varibles and set values after remove spaces\n\t*/\n\tif len(dbUser) > 0 && len(dbPass) > 0 && len(dbURL) > 0 && len(dbNAME) > 0 {\n\t\tuser = strings.TrimSpace(dbUser)\n\t\tpass = strings.TrimSpace(dbPass)\n\t\turl = strings.TrimSpace(dbURL)\n\t\tname = strings.TrimSpace(dbNAME)\n\t}\n\n\t/*\n\t\tPrepares the connection string\n\t*/\n\tconnString := fmt.Sprintf(\"postgres://%s:%s@%s/%s?sslmode=require\", user, pass, url, name)\n\tfmt.Printf(\"connecting to database: %s\\n\", url)\n\n\t/*\n\t\tconnects the database with the provided values, in case of any issue error will be raise\n\t*/\n\tdb, err = sql.Open(\"postgres\", connString)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Database refused connection: %s\", err.Error())\n\t\treturn\n\t}\n\n\treturn\n}", "func connection()(db *sql.DB, err error){\n\tdb, err = sql.Open(\"postgres\", config.getUrlConnection(\"postgres\"))\n\tif err != nil {\n\t\tfmt.Println(\"error\")\n\t\tdb.Close()\n\t}\n\treturn\n}", "func (ar *ActiveRecord) Connect(dbtype string, url string) (err error) {\n\tif ar.DB != nil {\n\t\tar.Close()\n\t}\n\n\tif ar.DB, err = sql.Open(dbtype, url); err != nil {\n\t\treturn err\n\t} else {\n\t\treturn nil\n\t}\n}", "func OpenConnection() *sql.DB {\n\terr := godotenv.Load(\"ENV.env\")\n\tif err != nil {\n\t\tlog.Fatal(\"Error loading env file \\n\", err)\n\t}\n\tvar db *sql.DB\n\n\tdsn := fmt.Sprintf(\"host=%s user=%s password=%s dbname=%s port=%s sslmode=disable\",\n\t\tos.Getenv(\"DB_HOST\"),os.Getenv(\"DB_USERNAME\"), os.Getenv(\"DB_PASSWORD\"), os.Getenv(\"DB_NAME\"), os.Getenv(\"DB_PORT\"))\n\n\tlog.Print(\"Connecting to PostgreSQL DB...\")\n\tdb, err = sql.Open(\"postgres\",dsn)\n\n\n\tif err != nil {\n\t\tlog.Fatal(\"Failed to connect to database. \\n\", err)\n\t\tos.Exit(2)\n\n\t}\n\tlog.Println(\"connected\")\n\treturn db;\n\n}", "func Connect() *sql.DB {\n\tdbinfo := fmt.Sprintf(\"user=%s password=%s dbname=%s sslmode=disable\", DbUser, DbPassword, DbName)\n\n\tdb, _ := sql.Open(\"postgres\", dbinfo)\n\n\treturn db\n}", "func (dbConn *DBConnection) Open() error {\n\tstrPassword, err := dbConn.readDbPassword()\n\tif err != nil {\n\t\tfmt.Println(\"database.Open failed on readDbPassword\", err.Error())\n\t\treturn err\n\t}\n\tstrConnection := dbConn.GetConnectionString(strPassword)\n\t// utils.Info.Println(strConnection)\n\tdbConn.db, err = sql.Open(dbConn.Engine, strConnection)\n\tif err != nil {\n\t\tfmt.Println(\"database.Open failed on sql.Open\", err.Error())\n\t\treturn err\n\t}\n\n\terr = dbConn.db.Ping()\n\tif err != nil {\n\t\tfmt.Println(\"database.Open failed on db.Ping\", err.Error())\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func InitDatabase() *sql.DB {\n\tlog.Println(\"connecting database.\")\n\n\tquery := url.Values{}\n\tquery.Add(\"database\", \"Company\")\n\n\tu := &url.URL{\n\t\tScheme: \"sqlserver\",\n\t\tUser: url.UserPassword(\"sa\", \"1234\"),\n\t\tHost: fmt.Sprintf(\"%s:%d\", \"localhost\", 1433),\n\t\t// Path: instance, // if connecting to an instance instead of a port\n\t\tRawQuery: query.Encode(),\n\t}\n\n\tlog.Println(u.String())\n\n\tcondb, err := sql.Open(\"sqlserver\", u.String())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tlog.Println(\"test ping database.\")\n\tif err = condb.Ping(); err != nil {\n\t\tpanic(err)\n\t}\n\treturn condb\n}", "func Connect(connstr string) (*sql.DB, error) {\n\tdb, err := sql.Open(\"postgres\", connstr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "func getDBConnection() *sql.DB {\n // Open database\n db, err := sql.Open(\"sqlite3\", \"db.sqlite3\")\n if err != nil {\n // TODO\n panic(fmt.Sprintf(\"%#v\", err))\n }\n return db\n}", "func Connect() *sql.DB {\n\tURL := fmt.Sprintf(\"user=%s password=%s dbname=%s sslmode=%s\", configs.Database.User, configs.Database.Pass, configs.Database.Name, \"disable\")\n\tdb, err := sql.Open(\"postgres\", URL)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn nil\n\t}\n\treturn db\n}", "func NewDBConn() *mgo.Database {\n\tdb := DBInfo{}\n\terr := db.loadFromConfigFile(MONGO_CONFIG_FILE)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tsession, err := mgo.Dial(db.Host)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer session.Close()\n\tsession.SetBatch(DEFAULT_MONGO_BATCH_SIZE)\n\tcollections := session.DB(db.DB)\n\tif err := collections.Login(db.User, db.Pass); err != nil {\n\t\tlog.Printf(\"Cannot login to DB.\")\n\t\treturn nil\n\t}\n\treturn collections\n}", "func Connect(_db *sql.DB) {\n\tdb = _db\n}", "func OpenDB(o ServerOptions) error {\n\tvar err = (error)(nil)\n\n\tif o.DBTlsKeyName != \"\" && o.DBTlsServerHostName != \"\" && o.DBTlsServerCAPem != \"\" && o.DBTlsClientCertPem != \"\" && o.DBTlsClientKeyPem != \"\" {\n\t\tserverCAPem, err := base64.StdEncoding.DecodeString(o.DBTlsServerCAPem)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to decode server ca PEM value\")\n\t\t}\n\t\tclientCertPem, err := base64.StdEncoding.DecodeString(o.DBTlsClientCertPem)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to decode client certificate PEM value\")\n\t\t}\n\t\tclientKeyPem, err := base64.StdEncoding.DecodeString(o.DBTlsClientKeyPem)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to decode client key PEM value\")\n\t\t}\n\n\t\trootCertPool := x509.NewCertPool()\n\t\tif ok := rootCertPool.AppendCertsFromPEM(serverCAPem); !ok {\n\t\t\treturn fmt.Errorf(\"Failed to append server CA PEM\")\n\t\t}\n\n\t\tclientCert := make([]tls.Certificate, 0, 1)\n\t\tcerts, err := tls.X509KeyPair(clientCertPem, clientKeyPem)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tclientCert = append(clientCert, certs)\n\t\terr = mysql.RegisterTLSConfig(o.DBTlsKeyName, &tls.Config{\n\t\t\tRootCAs: rootCertPool,\n\t\t\tCertificates: clientCert,\n\t\t\tServerName: o.DBTlsServerHostName,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tdb, err = sql.Open(o.DBDriverName, o.DBDataSourceName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Initialize memory cache\n\toriginCache, err = lru.NewARC(10)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func NewDB(dbConnString string, log logger.Logger, wg *sync.WaitGroup, driver string, netParams *params.ChainParams) *Database {\n\tdb, err := sql.Open(driver, dbConnString)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = db.Ping()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdbclient := &Database{\n\t\tlog: log,\n\t\tdb: db,\n\t\tcanClose: wg,\n\t\tdriver: driver,\n\t\tnetParams: netParams,\n\t}\n\n\tdbclient.log.Info(\"Database connection established\")\n\n\treturn dbclient\n}", "func (r *Resolver) ConnectDB(ctx context.Context) {\n\tif r.db != nil {\n\t\tfmt.Printf(\"ConnectDB connection already open\\n\")\n\t\treturn\n\t}\n\n\tfmt.Printf(\"ConnectDB connecting...\\n\")\n\tconn, err := pgx.Connect(ctx, os.Getenv(\"DATABASE_URL\"))\n\t// defer conn.Close(ctx) // can't do this, keep the connection open then?\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tr.db = conn\n}", "func DbConnect() {\n\tpostgresHost, _ := os.LookupEnv(\"CYCLING_BLOG_DB_SERVICE_SERVICE_HOST\")\n\tpostgresPort := 5432\n\tpostgresUser, _ := os.LookupEnv(\"POSTGRES_USER\")\n\tpostgresPassword, _ := os.LookupEnv(\"PGPASSWORD\")\n\tpostgresName, _ := os.LookupEnv(\"POSTGRES_DB\")\n\n\tenv := ENV{Host: postgresHost, Port: postgresPort, User: postgresUser, Password: postgresPassword, Dbname: postgresName}\n\n\tpsqlInfo := fmt.Sprintf(\"host=%s port=%d user=%s password=%s dbname=%s sslmode=disable\", env.Host, env.Port, env.User, env.Password, env.Dbname)\n\tdb, err := sql.Open(\"postgres\", psqlInfo)\n\tif err != nil {\n\t\tlog.Panic(\"DbConnect: unable to connect to database\", err)\n\t}\n\tDB = db\n\tfmt.Println(\"Successfully connected!\")\n}", "func DBConn() *gorm.DB {\n\n\tdbConfig := config.New().DBConnections[0]\n\n\tc := conn{\n\t\tHost: dbConfig.Host,\n\t\tPort: dbConfig.Port,\n\t\tUser: dbConfig.Username,\n\t\tDBName: dbConfig.DBName,\n\t\tPassword: dbConfig.Password,\n\t\tSSL: dbConfig.SSL,\n\t}\n\tdb, err := gorm.Open(\"postgres\", c.toString())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdb.Set(\"gorm:table_options\", \"charset=utf8\")\n\treturn db\n}", "func ConnectDB(wrappers ...DriverWrapper) (*sql.DB, error) {\n\tif debug := viper.GetBool(\"database.debug\"); debug {\n\t\twrappers = append(wrappers, WithInstrumentedSQL())\n\t}\n\n\tdb, err := OpenConnection(ConnectionConfig{\n\t\tDriverWrappers: wrappers,\n\t\tUser: viper.GetString(\"database.user\"),\n\t\tPassword: viper.GetString(\"database.password\"),\n\t\tHost: viper.GetString(\"database.host\"),\n\t\tName: viper.GetString(\"database.name\"),\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmaxConn := viper.GetInt(\"database.max_open_conn\")\n\tdb.SetMaxOpenConns(maxConn)\n\tdb.SetMaxIdleConns(maxConn)\n\n\tretries, period := viper.GetInt(\"database.connection_retries\"), viper.GetDuration(\"database.retry_period\")\n\tfor i := 0; i < retries; i++ {\n\t\terr = db.Ping()\n\t\tif err == nil {\n\t\t\tlogrus.Debug(\"Connected to the database\")\n\t\t\treturn db, nil\n\t\t}\n\t\ttime.Sleep(period)\n\t\tlogrus.WithError(err).Debug(\"DB connection error. Retrying...\")\n\t}\n\treturn nil, fmt.Errorf(\"failed to open DB connection\")\n}", "func connectDatabase(connectionURL string) *sql.DB {\n\tdb, err := sql.Open(\"postgres\", connectionURL)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn db\n}", "func Connect() *sql.DB {\n\tfmtStr := \"host=%s port=%s user=%s \" +\n\t\t\"password=%s dbname=%s sslmode=disable\"\n\tpsqlInfo := fmt.Sprintf(\n\t\tfmtStr,\n\t\tos.Getenv(\"PG_HOST\"),\n\t\tos.Getenv(\"PG_PORT\"),\n\t\tos.Getenv(\"PG_USER\"),\n\t\tos.Getenv(\"PG_PASSWORD\"),\n\t\tos.Getenv(\"PG_DBNAME\"),\n\t)\n\tdb, err := sql.Open(\"postgres\", psqlInfo)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn db\n}", "func OpenConnection(driver string, connString string) (Conn, error) {\n\tvar conn Conn\n\tvar err error\n\tconn.DisallowConcurency = true // As a general rule, do not allow multiple go routines\n\tconn.DB, err = sql.Open(driver, connString)\n\tconn.driver = driver\n\tif err != nil && LogErrors {\n\t\tlog.Print(err.Error())\n\t}\n\treturn conn, err\n}", "func (c *Client) Connect() (*DBConnection, error) {\n\tdbRegistryLock.Lock()\n\tdefer dbRegistryLock.Unlock()\n\n\tdsn := c.config.connStr(c.databaseName)\n\tconn, found := dbRegistry[dsn]\n\tif !found {\n\t\tdb, err := sql.Open(proxyDriverName, dsn)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Error connecting to PostgreSQL server %s: %w\", c.config.Host, err)\n\t\t}\n\n\t\t// We don't want to retain connection\n\t\t// So when we connect on a specific database which might be managed by terraform,\n\t\t// we don't keep opened connection in case of the db has to be dopped in the plan.\n\t\tdb.SetMaxIdleConns(0)\n\t\tdb.SetMaxOpenConns(c.config.MaxConns)\n\n\t\tconn = &DBConnection{\n\t\t\tdb,\n\t\t\tc,\n\t\t}\n\t\tdbRegistry[dsn] = conn\n\t}\n\n\treturn conn, nil\n}", "func GetDBconn() *sql.DB {\n\tdbName := \"userdb\"\n\tfmt.Println(\"conn info:\", dbName)\n\tdb, err := sql.Open(\"mysql\", \"root:manish1234@tcp(localhost:3306)/userdb\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\t// defer db.Close()\n\n\treturn db\n}", "func Open(user, addr, dbName string) (*sql.DB, error) {\n\tc := &mysql.Config{\n\t\tUser: user,\n\t\tNet: \"tcp\",\n\t\tAddr: addr,\n\t\tDBName: dbName,\n\t\tCollation: \"utf8mb4_bin\",\n\t\tParseTime: true,\n\t}\n\n\treturn sql.Open(\"mysql\", c.FormatDSN())\n}", "func Dbcon() (db *sql.DB, err error) {\n\tdb, err = sql.Open(\"mysql\", \"mremmalex:password@tcp(localhost:3306)/backendtest\")\n\treturn db, err\n}", "func Connect(ctx context.Context, cfg Config) (*DB, error) {\n\tpool, err := pgxpool.New(ctx, ConnString(cfg))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"database connection error: %w\", err)\n\t}\n\tdb := DB{pool}\n\n\treturn &db, nil\n}", "func (p *DSNProvider) openDB() (*sql.DB, error) {\n\tdb, err := sql.Open(p.DriverName, p.DSN)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tidle := p.MaxIdleConns\n\tif idle == 0 {\n\t\tidle = DefaultMaxIdleConns\n\t}\n\tdb.SetMaxIdleConns(idle)\n\n\topen := p.MaxOpenConns\n\tif open == 0 {\n\t\topen = DefaultMaxOpenConns\n\t}\n\tdb.SetMaxOpenConns(open)\n\n\tttl := p.MaxConnLifetime\n\tif ttl == 0 {\n\t\tttl = DefaultMaxConnLifetime\n\t}\n\tdb.SetConnMaxLifetime(ttl)\n\n\treturn db, nil\n}", "func GetDBConnection(databaseURL string) (*sql.DB, error) {\n var db *sql.DB\n appEnv, err := cfenv.Current()\n if err != nil {\n db, err = sql.Open(\"mysql\", databaseURL+\"?parseTime=true\")\n if err != nil {\n return nil, err\n }\n } else {\n mysqlEnv, err := appEnv.Services.WithName(\"hero-mysql\")\n if err != nil {\n return nil, err\n }\n mysqlPort := \"\"\n if val, ok := mysqlEnv.Credentials[\"port\"].(string); ok {\n mysqlPort = val\n } else {\n mysqlPort = strconv.FormatFloat(mysqlEnv.Credentials[\"port\"].(float64), 'f', -1, 64)\n }\n db, err = sql.Open(\"mysql\", mysqlEnv.Credentials[\"username\"].(string)+\":\"+mysqlEnv.Credentials[\"password\"].(string)+\"@tcp(\"+mysqlEnv.Credentials[\"hostname\"].(string)+\":\"+mysqlPort+\")/\"+mysqlEnv.Credentials[\"name\"].(string)+\"?parseTime=true\")\n if err != nil {\n return nil, err\n }\n }\n\n err = db.Ping()\n if err != nil {\n db.Close()\n return nil, err\n }\n\n return db, nil\n}", "func (cp *connectionPool) createConnectionAndOpen() error {\n\tcp.length++\n\n\tdbConn := db.Conn{\n\t\tAddr: cp.addr,\n\t}\n\n\tif err := dbConn.Open(); err != nil {\n\t\treturn err\n\t}\n\n\tconn := &connection{\n\t\tdbConn: dbConn,\n\t\tid: cp.length,\n\t}\n\n\tif nil == cp.tail {\n\t\tcp.push(conn)\n\t}\n\tcp.unshift(conn)\n\n\treturn nil\n}", "func connectDB(dsn string) (dbh *sql.DB, err error) {\n\tdbh, err = sql.Open(\"mysql\", dsn)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Set really low limits, this application is only meant to do quick serialized SQL queries\n\tdbh.SetMaxOpenConns(1)\n\tdbh.SetConnMaxLifetime(time.Second)\n\n\treturn\n}", "func Open(driverName, dsn string) (*DB, error) {\n\tswitch driverName {\n\tcase \"mysql\":\n\tdefault:\n\t\tdsn = fmt.Sprintf(\"%s://%s\", driverName, dsn)\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tdbC := make(chan *sql.DB, 1)\n\terrC := make(chan error, 1)\n\n\tgo func(driverName, dsn string) {\n\t\tdb, err := sql.Open(driverName, dsn)\n\t\tif err != nil {\n\t\t\terrC <- err\n\t\t\treturn\n\t\t}\n\t\tdbC <- db\n\t}(driverName, dsn)\n\n\tselect {\n\tcase db := <-dbC:\n\t\t// see: https://github.com/go-sql-driver/mysql/issues/674\n\t\tdb.SetMaxIdleConns(0)\n\t\treturn &DB{db}, nil\n\tcase err := <-errC:\n\t\treturn nil, err\n\tcase <-ctx.Done():\n\t\treturn nil, errTimeout\n\t}\n}", "func OpenMlsConn(conn *xorm.Engine, mls string) (*xorm.Engine, error) {\n\tsql := fmt.Sprintf(\"select * from mls where id = '%v'\", mls)\n\tresult, err := conn.Query(sql)\n\tif err != nil {\n\t\treturn &xorm.Engine{}, err\n\t}\n\tif len(result) == 0 {\n\t\treturn &xorm.Engine{}, fmt.Errorf(\"Could not establish communication with the database\")\n\t}\n\tusr := string(result[0][\"username_bd\"])\n\tpwd := string(result[0][\"password_bd\"])\n\thost := string(result[0][\"server_bd\"])\n\tbd := string(result[0][\"name_bd\"])\n\tport := \"\"\n\tif strings.Contains(host, \":\") {\n\t\ttmp := strings.Split(host, \":\")\n\t\thost = tmp[0]\n\t\tport = tmp[1]\n\t} else {\n\t\tport = \"5432\"\n\t}\n\torm, err := OpenBD(usr, pwd, host, port, bd, \"postgres\")\n\tif err == nil {\n\t\terr = orm.Ping()\n\t}\n\treturn orm, err\n}", "func OpenDB(driver, dsn string, opts ...Option) (*sql.DB, error) {\n\tconfig := &dbConfig{\n\t\tlogger: log.NewNopLogger(),\n\t\tcensusTraceOptions: []ocsql.TraceOption{ocsql.WithAllTraceOptions()},\n\t\tmaxAttempts: 15,\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(config)\n\t}\n\n\tif config.wrapWithCensus && !config.alreadyRegisteredDriver {\n\t\tdriverName, err := ocsql.Register(driver, config.censusTraceOptions...)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"wrapping driver %s with opencensus sql %s\", driver, driverName)\n\t\t}\n\t\tdriver = driverName\n\t}\n\n\tdb, err := sql.Open(driver, dsn)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"opening %s connection, dsn=%s\", driver, dsn)\n\t}\n\n\tvar dbError error\n\tfor attempt := 0; attempt < config.maxAttempts; attempt++ {\n\t\tdbError = db.Ping()\n\t\tif dbError == nil {\n\t\t\t// we're connected!\n\t\t\tbreak\n\t\t}\n\t\tinterval := time.Duration(attempt) * time.Second\n\t\tlevel.Info(config.logger).Log(driver, fmt.Sprintf(\n\t\t\t\"could not connect to db: %v, sleeping %v\", dbError, interval))\n\t\ttime.Sleep(interval)\n\t}\n\tif dbError != nil {\n\t\treturn nil, dbError\n\t}\n\n\treturn db, nil\n}", "func GetConnection(dsn string) (*sql.DB, error) {\n\tif dsn == \"\" {\n\t\tdsn = GetDSN()\n\t}\n\treturn sql.Open(\"goracle\", dsn)\n}", "func Open(connStr string) (*sqlx.DB, error) {\n\treturn sqlx.Open(\"postgres\", connStr)\n}", "func OpenDB() *sql.DB {\n\tdb, err := sql.Open(\"mysql\", \"root:password@tcp(192.168.1.200:32769)/BikeTransport_db\")\n\tif err != nil {\n\t\tfmt.Println(\"Failed to open SQL db:\", err)\n\t\tlog.Fatalln(\"Failed to open SQL db:\", err)\n\t}\n\tfmt.Println(\"Database successfully opened.\")\n\n\treturn db\n}", "func openDB(dsn string) (*sql.DB, error) {\r\n\tdb, err := sql.Open(\"mysql\", dsn)\r\n\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tif err = db.Ping(); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn db, nil\r\n}", "func (c *MysqlClient) OpenCon(config config.Config, logger *log.Logger) error {\n\tconStr := fmt.Sprintf(\n\t\t\"%s:%s@(%s:%s)/%s?charset=utf8&parseTime=True&loc=Local\",\n\t\tconfig.DBUser,\n\t\tconfig.DBPassword,\n\t\tconfig.DBHost,\n\t\tconfig.DBPort,\n\t\tconfig.DBName,\n\t)\n\tdb, err := gorm.Open(config.DBDriver, conStr)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to open db connection\")\n\t}\n\tdb.LogMode(true)\n\tdb.SetLogger(NewGormLogger(logger))\n\n\tc.conn = db\n\tc.config = config\n\tc.logger = logger\n\treturn nil\n}" ]
[ "0.76061195", "0.7395707", "0.7394749", "0.7332755", "0.7270426", "0.7248962", "0.723286", "0.72274655", "0.7204548", "0.7196246", "0.71668965", "0.7166142", "0.7125072", "0.7085214", "0.7083889", "0.7082635", "0.7049826", "0.7041966", "0.70018184", "0.7000479", "0.69844055", "0.6976002", "0.69384414", "0.68932885", "0.6889955", "0.6871632", "0.68548197", "0.6846963", "0.6830966", "0.68298405", "0.68295807", "0.68274087", "0.68214834", "0.682142", "0.6802886", "0.6795568", "0.6787861", "0.6781857", "0.6779087", "0.67496943", "0.674601", "0.67420906", "0.67417705", "0.6741692", "0.6731691", "0.6728271", "0.6725383", "0.6719292", "0.6718617", "0.6716746", "0.67156667", "0.6713741", "0.67120594", "0.67091304", "0.66975665", "0.669017", "0.6687218", "0.6679178", "0.6678722", "0.66725904", "0.6659038", "0.66527516", "0.6649785", "0.66349626", "0.6622035", "0.66173637", "0.6607591", "0.6607182", "0.65987545", "0.6594961", "0.6590589", "0.6582862", "0.65795946", "0.65791035", "0.65768033", "0.65717626", "0.6554612", "0.65521616", "0.6551797", "0.6549186", "0.6548847", "0.65485126", "0.65475684", "0.654595", "0.6545487", "0.6539417", "0.65363294", "0.6533847", "0.6529383", "0.65264106", "0.652588", "0.65247273", "0.65244496", "0.65195096", "0.65173995", "0.65130866", "0.65116155", "0.650772", "0.650769", "0.65027696" ]
0.70031714
18
NewNodeResourceTopologies makes a CRD golang object representing NodeResourceTopology definition
func NewNodeResourceTopologies() (*apiextensionsv1.CustomResourceDefinition, error) { _, file, _, ok := runtime.Caller(0) if !ok { return nil, fmt.Errorf("cannot retrieve manifests directory") } baseDir := filepath.Dir(file) crdPath := filepath.Clean(filepath.Join(baseDir, "..", "..", "..", "deployment", "base", "noderesourcetopologies-crd", "noderesourcetopologies.yaml")) data, err := os.ReadFile(crdPath) if err != nil { return nil, err } decode := scheme.Codecs.UniversalDeserializer().Decode obj, _, err := decode(data, nil, nil) if err != nil { return nil, err } crd, ok := obj.(*apiextensionsv1.CustomResourceDefinition) if !ok { return nil, fmt.Errorf("unexpected type, got %t", obj) } return crd, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CreateNodeResourceTopologies(ctx context.Context, extClient extclient.Interface) (*apiextensionsv1.CustomResourceDefinition, error) {\n\tcrd, err := NewNodeResourceTopologies()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Delete existing CRD (if any) with this we also get rid of stale objects\n\terr = extClient.ApiextensionsV1().CustomResourceDefinitions().Delete(ctx, crd.Name, metav1.DeleteOptions{})\n\tif err != nil && !errors.IsNotFound(err) {\n\t\treturn nil, fmt.Errorf(\"failed to delete NodeResourceTopology CRD: %w\", err)\n\t}\n\n\t// It takes time for the delete operation, wait until the CRD completely gone\n\tif err = wait.PollUntilContextTimeout(ctx, 5*time.Second, 1*time.Minute, true, func(ctx context.Context) (bool, error) {\n\t\t_, err = extClient.ApiextensionsV1().CustomResourceDefinitions().Get(ctx, crd.Name, metav1.GetOptions{})\n\t\tif err == nil {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tif errors.IsNotFound(err) {\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, err\n\t}); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get NodeResourceTopology CRD: %w\", err)\n\t}\n\treturn extClient.ApiextensionsV1().CustomResourceDefinitions().Create(ctx, crd, metav1.CreateOptions{})\n}", "func Topology(node uint32) (*TopologyConn, error) {\n\tsa := &unix.TIPCServiceName{\n\t\tType: unix.TIPC_TOP_SRV,\n\t\tInstance: unix.TIPC_TOP_SRV,\n\t\tDomain: node,\n\t}\n\n\tst := &unix.SockaddrTIPC{\n\t\tScope: unix.TIPC_CLUSTER_SCOPE,\n\t\tAddr: sa,\n\t}\n\n\tc, err := tipc.DialSequentialPacket(st)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &TopologyConn{conn: c}, nil\n}", "func GetNodeTopology(ctx context.Context, topologyClient *topologyclientset.Clientset, nodeName string) *v1alpha2.NodeResourceTopology {\n\tvar nodeTopology *v1alpha2.NodeResourceTopology\n\tvar err error\n\tgomega.EventuallyWithOffset(1, func() bool {\n\t\tnodeTopology, err = topologyClient.TopologyV1alpha2().NodeResourceTopologies().Get(ctx, nodeName, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\tframework.Logf(\"failed to get the node topology resource: %v\", err)\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}, time.Minute, 5*time.Second).Should(gomega.BeTrue())\n\treturn nodeTopology\n}", "func IsValidNodeTopology(nodeTopology *v1alpha2.NodeResourceTopology, kubeletConfig *kubeletconfig.KubeletConfiguration) bool {\n\tif nodeTopology == nil || len(nodeTopology.TopologyPolicies) == 0 {\n\t\tframework.Logf(\"failed to get topology policy from the node topology resource\")\n\t\treturn false\n\t}\n\n\ttmPolicy := string(topologypolicy.DetectTopologyPolicy(kubeletConfig.TopologyManagerPolicy, kubeletConfig.TopologyManagerScope))\n\tif nodeTopology.TopologyPolicies[0] != tmPolicy {\n\t\tframework.Logf(\"topology policy mismatch got %q expected %q\", nodeTopology.TopologyPolicies[0], tmPolicy)\n\t\treturn false\n\t}\n\n\texpectedPolicyAttribute := v1alpha2.AttributeInfo{\n\t\tName: nfdtopologyupdater.TopologyManagerPolicyAttributeName,\n\t\tValue: kubeletConfig.TopologyManagerPolicy,\n\t}\n\tif !containsAttribute(nodeTopology.Attributes, expectedPolicyAttribute) {\n\t\tframework.Logf(\"topology policy attributes don't have correct topologyManagerPolicy attribute expected %v attributeList %v\", expectedPolicyAttribute, nodeTopology.Attributes)\n\t\treturn false\n\t}\n\n\texpectedScopeAttribute := v1alpha2.AttributeInfo{\n\t\tName: nfdtopologyupdater.TopologyManagerScopeAttributeName,\n\t\tValue: kubeletConfig.TopologyManagerScope,\n\t}\n\tif !containsAttribute(nodeTopology.Attributes, expectedScopeAttribute) {\n\t\tframework.Logf(\"topology policy attributes don't have correct topologyManagerScope attribute expected %v attributeList %v\", expectedScopeAttribute, nodeTopology.Attributes)\n\t\treturn false\n\t}\n\n\tif nodeTopology.Zones == nil || len(nodeTopology.Zones) == 0 {\n\t\tframework.Logf(\"failed to get topology zones from the node topology resource\")\n\t\treturn false\n\t}\n\n\tfoundNodes := 0\n\tfor _, zone := range nodeTopology.Zones {\n\t\t// TODO constant not in the APIs\n\t\tif !strings.HasPrefix(strings.ToUpper(zone.Type), \"NODE\") {\n\t\t\tcontinue\n\t\t}\n\t\tfoundNodes++\n\n\t\tif !isValidCostList(zone.Name, zone.Costs) {\n\t\t\tframework.Logf(\"invalid cost list for zone %q\", zone.Name)\n\t\t\treturn false\n\t\t}\n\n\t\tif !isValidResourceList(zone.Name, zone.Resources) {\n\t\t\tframework.Logf(\"invalid resource list for zone %q\", zone.Name)\n\t\t\treturn false\n\t\t}\n\t}\n\treturn foundNodes > 0\n}", "func AllocatableResourceListFromNodeResourceTopology(nodeTopo *v1alpha2.NodeResourceTopology) map[string]corev1.ResourceList {\n\tallocRes := make(map[string]corev1.ResourceList)\n\tfor _, zone := range nodeTopo.Zones {\n\t\tif zone.Type != \"Node\" {\n\t\t\tcontinue\n\t\t}\n\t\tresList := make(corev1.ResourceList)\n\t\tfor _, res := range zone.Resources {\n\t\t\tresList[corev1.ResourceName(res.Name)] = res.Allocatable.DeepCopy()\n\t\t}\n\t\tif len(resList) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tallocRes[zone.Name] = resList\n\t}\n\treturn allocRes\n}", "func newResource() *resource.Resource {\n\tr, _ := resource.Merge(\n\t\tresource.Default(),\n\t\tresource.NewWithAttributes(\n\t\t\tsemconv.SchemaURL,\n\t\t\tsemconv.ServiceNameKey.String(\"opentelemetry-server\"),\n\t\t\tsemconv.ServiceVersionKey.String(\"v0.1.0\"),\n\t\t\tattribute.String(\"environment\", \"demo\"),\n\t\t),\n\t)\n\treturn r\n}", "func NewTopology() Topology {\n\treturn &topologyS{\n\t\tTopology: &topology.Topo{},\n\t}\n}", "func (fm *FCFSModel)TaskNodeToResource(td *TaskDescriptor,rd *ResDescriptor)*ArcDescriptor{\n\t//ct := uint64(rand.Intn(100))\n\treturn &ArcDescriptor{\n\t\tcost: fm.TaskToResCost(td,rd),\n\t\tcapLower :0,\n\t\tcapUpper: 1,\n\t}\n}", "func (zic *ZoneInterconnectHandler) createRemoteZoneNodeResources(node *corev1.Node, nodeID int, chassisId string) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port Ips : %w\", err)\n\t}\n\n\tnetworkId, err := util.ParseNetworkIDAnnotation(node, zic.GetNetworkName())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get the network id for the network %s on node %s: %v\", zic.GetNetworkName(), node.Name, err)\n\t}\n\n\ttransitSwitchTunnelKey := BaseTransitSwitchTunnelKey + networkId\n\tts := &nbdb.LogicalSwitch{\n\t\tName: zic.networkTransitSwitchName,\n\t\tOtherConfig: map[string]string{\n\t\t\t\"interconn-ts\": zic.networkTransitSwitchName,\n\t\t\t\"requested-tnl-key\": strconv.Itoa(transitSwitchTunnelKey),\n\t\t\t\"mcast_snoop\": \"true\",\n\t\t\t\"mcast_flood_unregistered\": \"true\",\n\t\t},\n\t}\n\n\t// Create transit switch if it doesn't exist\n\tif err := libovsdbops.CreateOrUpdateLogicalSwitch(zic.nbClient, ts); err != nil {\n\t\treturn fmt.Errorf(\"failed to create/update transit switch %s: %w\", zic.networkTransitSwitchName, err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\tremotePortAddr := transitRouterPortMac.String()\n\tfor _, tsNetwork := range transitRouterPortNetworks {\n\t\tremotePortAddr = remotePortAddr + \" \" + tsNetwork\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\n\tremotePortName := zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix + node.Name)\n\tif err := zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, remotePortName, lportTypeRemote, []string{remotePortAddr}, lspOptions, externalIDs); err != nil {\n\t\treturn err\n\t}\n\t// Set the port binding chassis.\n\tif err := zic.setRemotePortBindingChassis(node.Name, remotePortName, chassisId); err != nil {\n\t\treturn err\n\t}\n\n\tif err := zic.addRemoteNodeStaticRoutes(node, nodeTransitSwitchPortIPs); err != nil {\n\t\treturn err\n\t}\n\n\t// Cleanup the logical router port connecting to the transit switch for the remote node (if present)\n\t// Cleanup would be required when a local zone node moves to a remote zone.\n\treturn zic.cleanupNodeClusterRouterPort(node.Name)\n}", "func newTopoClient(cfg ServiceConfig) (topoapi.TopoClient, error) {\n\topts := []grpc.DialOption{\n\t\tgrpc.WithStreamInterceptor(southbound.RetryingStreamClientInterceptor(100 * time.Millisecond)),\n\t}\n\tif cfg.Insecure {\n\t\topts = append(opts, grpc.WithInsecure())\n\t}\n\n\tconn, err := getTopoConn(\"onos-topo\", opts...)\n\tif err != nil {\n\t\tstat, ok := status.FromError(err)\n\t\tif ok {\n\t\t\tlog.Error(\"Unable to connect to topology service\", err)\n\t\t\treturn nil, errors.FromStatus(stat)\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn topoapi.NewTopoClient(conn), nil\n}", "func NewResourceNode(networkID string, pubKey crypto.PubKey, ownerAddr sdk.AccAddress,\n\tdescription Description, nodeType string, creationTime time.Time) ResourceNode {\n\treturn ResourceNode{\n\t\tNetworkID: networkID,\n\t\tPubKey: pubKey,\n\t\tSuspend: false,\n\t\tStatus: sdk.Unbonded,\n\t\tTokens: sdk.ZeroInt(),\n\t\tOwnerAddress: ownerAddr,\n\t\tDescription: description,\n\t\tNodeType: nodeType,\n\t\tCreationTime: creationTime,\n\t}\n}", "func NewNODES(config configuration.CONFIGURATION) *NODES_IMPL {\r\n client := new(NODES_IMPL)\r\n client.config = config\r\n return client\r\n}", "func (zic *ZoneInterconnectHandler) createLocalZoneNodeResources(node *corev1.Node, nodeID int) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port ips for node %s: %w\", node.Name, err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\t// Connect transit switch to the cluster router by creating a pair of logical switch port - logical router port\n\tlogicalRouterPortName := zic.GetNetworkScopedName(types.RouterToTransitSwitchPrefix + node.Name)\n\tlogicalRouterPort := nbdb.LogicalRouterPort{\n\t\tName: logicalRouterPortName,\n\t\tMAC: transitRouterPortMac.String(),\n\t\tNetworks: transitRouterPortNetworks,\n\t\tOptions: map[string]string{\n\t\t\t\"mcast_flood\": \"true\",\n\t\t},\n\t}\n\tlogicalRouter := nbdb.LogicalRouter{\n\t\tName: zic.networkClusterRouterName,\n\t}\n\n\tif err := libovsdbops.CreateOrUpdateLogicalRouterPort(zic.nbClient, &logicalRouter, &logicalRouterPort, nil); err != nil {\n\t\treturn fmt.Errorf(\"failed to create/update cluster router %s to add transit switch port %s for the node %s: %w\", zic.networkClusterRouterName, logicalRouterPortName, node.Name, err)\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"router-port\": logicalRouterPortName,\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\terr = zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix+node.Name),\n\t\tlportTypeRouter, []string{lportTypeRouterAddr}, lspOptions, externalIDs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Its possible that node is moved from a remote zone to the local zone. Check and delete the remote zone routes\n\t// for this node as it's no longer needed.\n\treturn zic.deleteLocalNodeStaticRoutes(node, nodeID, nodeTransitSwitchPortIPs)\n}", "func nodesToCreate(clusterName string, flags *CreateOptions) []nodeSpec {\n\tvar desiredNodes []nodeSpec\n\n\t// prepare nodes explicitly\n\tfor n := 0; n < flags.controlPlanes; n++ {\n\t\trole := constants.ControlPlaneNodeRoleValue\n\t\tdesiredNode := nodeSpec{\n\t\t\tName: fmt.Sprintf(\"%s-%s-%d\", clusterName, role, n+1),\n\t\t\tRole: role,\n\t\t}\n\t\tdesiredNodes = append(desiredNodes, desiredNode)\n\t}\n\tfor n := 0; n < flags.workers; n++ {\n\t\trole := constants.WorkerNodeRoleValue\n\t\tdesiredNode := nodeSpec{\n\t\t\tName: fmt.Sprintf(\"%s-%s-%d\", clusterName, role, n+1),\n\t\t\tRole: role,\n\t\t}\n\t\tdesiredNodes = append(desiredNodes, desiredNode)\n\t}\n\n\t// add an external load balancer if explicitly requested or if there are multiple control planes\n\tif flags.externalLoadBalancer || flags.controlPlanes > 1 {\n\t\trole := constants.ExternalLoadBalancerNodeRoleValue\n\t\tdesiredNodes = append(desiredNodes, nodeSpec{\n\t\t\tName: fmt.Sprintf(\"%s-lb\", clusterName),\n\t\t\tRole: role,\n\t\t})\n\t}\n\n\treturn desiredNodes\n}", "func (p *Provider) initTopology() (*topology, func(), error) {\n\tif err := checkVersion(p.api); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\ttopo, cleanup, err := p.api.newTopology()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tcleanup()\n\t\t}\n\t}()\n\n\tif err = topo.setFlags(); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tif err = topo.load(); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn topo, cleanup, nil\n}", "func (zic *ZoneInterconnectHandler) createRemoteZoneNodeResources(node *corev1.Node, nodeID int, chassisId string) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port Ips : %w\", err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\tremotePortAddr := transitRouterPortMac.String()\n\tfor _, tsNetwork := range transitRouterPortNetworks {\n\t\tremotePortAddr = remotePortAddr + \" \" + tsNetwork\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\n\tremotePortName := zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix + node.Name)\n\tif err := zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, remotePortName, lportTypeRemote, []string{remotePortAddr}, lspOptions, externalIDs); err != nil {\n\t\treturn err\n\t}\n\t// Set the port binding chassis.\n\tif err := zic.setRemotePortBindingChassis(node.Name, remotePortName, chassisId); err != nil {\n\t\treturn err\n\t}\n\n\tif err := zic.addRemoteNodeStaticRoutes(node, nodeTransitSwitchPortIPs); err != nil {\n\t\treturn err\n\t}\n\n\t// Cleanup the logical router port connecting to the transit switch for the remote node (if present)\n\t// Cleanup would be required when a local zone node moves to a remote zone.\n\treturn zic.cleanupNodeClusterRouterPort(node.Name)\n}", "func Generate(topology *Topology, clusters, namespaces []string) *Topology {\n\tvar edges []Edge\n\tvar nodes []Node\n\tvar clusterNodes []Node\n\tvar namespaceNodes []Node\n\n\tfor _, clusterName := range clusters {\n\t\tfor _, namespace := range namespaces {\n\t\t\tfor _, edge := range topology.Edges {\n\t\t\t\tif (edge.Data.SourceCluster == clusterName && edge.Data.SourceNamespace == namespace) || (edge.Data.TargetCluster == clusterName && edge.Data.TargetNamespace == namespace) {\n\t\t\t\t\tedges = appendEdgeIfMissing(edges, edge)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, edge := range edges {\n\t\tfor _, node := range topology.Nodes {\n\t\t\tif node.Data.ID == edge.Data.Source || node.Data.ID == edge.Data.Target {\n\t\t\t\tnodes = appendNodeIfMissing(nodes, node)\n\n\t\t\t\tclusterNode := Node{\n\t\t\t\t\tData: NodeData{\n\t\t\t\t\t\tID: node.Data.Cluster,\n\t\t\t\t\t\tType: \"cluster\",\n\t\t\t\t\t\tLabel: node.Data.Cluster,\n\t\t\t\t\t\tParent: \"\",\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t\tclusterNodes = appendNodeIfMissing(clusterNodes, clusterNode)\n\n\t\t\t\tnamespaceNode := Node{\n\t\t\t\t\tData: NodeData{\n\t\t\t\t\t\tID: node.Data.Cluster + \"-\" + node.Data.Namespace,\n\t\t\t\t\t\tType: \"namespace\",\n\t\t\t\t\t\tLabel: node.Data.Namespace,\n\t\t\t\t\t\tParent: node.Data.Cluster,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t\tnamespaceNodes = append(namespaceNodes, namespaceNode)\n\t\t\t}\n\t\t}\n\t}\n\n\tnodes = append(nodes, clusterNodes...)\n\tnodes = append(nodes, namespaceNodes...)\n\n\treturn &Topology{\n\t\tEdges: edges,\n\t\tNodes: nodes,\n\t}\n}", "func NewTerraNodeResource(node db.Node) TerraNodeResource {\n\treturn TerraNodeResource{\n\t\tJAID: NewJAIDInt32(node.ID),\n\t\tName: node.Name,\n\t\tTerraChainID: node.TerraChainID,\n\t\tTendermintURL: node.TendermintURL,\n\t\tCreatedAt: node.CreatedAt,\n\t\tUpdatedAt: node.UpdatedAt,\n\t}\n}", "func TestNoTopo(t *testing.T) {\n\tkdlog.InitLogs()\n\n\tkubePod := &kubev1.Pod{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"Pod0\",\n\t\t\tAnnotations: map[string]string{\n\t\t\t\t\"ABCD\": \"EFGH\",\n\t\t\t},\n\t\t},\n\t\tSpec: kubev1.PodSpec{\n\t\t\tContainers: []kubev1.Container{\n\t\t\t\t{\n\t\t\t\t\tName: \"Cont0\",\n\t\t\t\t\tResources: kubev1.ResourceRequirements{\n\t\t\t\t\t\tRequests: kubev1.ResourceList{\n\t\t\t\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(4, resource.DecimalSI),\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\tnodeInfo0 := &kubev1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"Node0\",\n\t\t},\n\t\tStatus: kubev1.NodeStatus{\n\t\t\tCapacity: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(4, resource.DecimalSI),\n\t\t\t},\n\t\t\tAllocatable: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(4, resource.DecimalSI),\n\t\t\t},\n\t\t},\n\t}\n\tnodeInfo1 := &kubev1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"Node1\",\n\t\t},\n\t\tStatus: kubev1.NodeStatus{\n\t\t\tCapacity: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(8, resource.DecimalSI),\n\t\t\t},\n\t\t\tAllocatable: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(8, resource.DecimalSI),\n\t\t\t},\n\t\t},\n\t}\n\tnodeInfo2 := &kubev1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"Node2\",\n\t\t},\n\t\tStatus: kubev1.NodeStatus{\n\t\t\tCapacity: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(0, resource.DecimalSI),\n\t\t\t},\n\t\t\tAllocatable: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(0, resource.DecimalSI),\n\t\t\t},\n\t\t},\n\t}\n\tnodeInfo3 := &kubev1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"Node3\",\n\t\t},\n\t\tStatus: kubev1.NodeStatus{},\n\t}\n\tnodeInfo4 := &kubev1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"Node4\",\n\t\t},\n\t\tStatus: kubev1.NodeStatus{\n\t\t\tCapacity: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(8, resource.DecimalSI),\n\t\t\t},\n\t\t\tAllocatable: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(8, resource.DecimalSI),\n\t\t\t},\n\t\t},\n\t}\n\n\tds := DeviceScheduler\n\tds.RemoveAll()\n\tdev := &gpuschedulerplugin.NvidiaGPUScheduler{}\n\tds.AddDevice(dev)\n\n\tn0, _ := kubeinterface.KubeNodeToNodeInfo(nodeInfo0, nil)\n\tn1, _ := kubeinterface.KubeNodeToNodeInfo(nodeInfo1, nil)\n\tn2, _ := kubeinterface.KubeNodeToNodeInfo(nodeInfo2, nil)\n\tn3, _ := kubeinterface.KubeNodeToNodeInfo(nodeInfo3, nil)\n\tn4, _ := kubeinterface.KubeNodeToNodeInfo(nodeInfo4, nil)\n\tds.AddNode(nodeInfo0.ObjectMeta.Name, n0)\n\tds.AddNode(nodeInfo1.ObjectMeta.Name, n1)\n\tds.AddNode(nodeInfo2.ObjectMeta.Name, n2)\n\tds.AddNode(nodeInfo3.ObjectMeta.Name, n3)\n\tfmt.Printf(\"NodeLocationMap:\\n%+v\\n\", gpuschedulerplugin.NodeLocationMap)\n\tfmt.Printf(\"NodeCacheMap:\\n%+v\\n\", gpuschedulerplugin.NodeCacheMap)\n\tds.AddNode(nodeInfo4.ObjectMeta.Name, n4)\n\tfmt.Printf(\"NodeLocationMap:\\n%+v\\n\", gpuschedulerplugin.NodeLocationMap)\n\tfmt.Printf(\"NodeCacheMap:\\n%+v\\n\", gpuschedulerplugin.NodeCacheMap)\n\tfmt.Printf(\"Node: %+v\\n\", n0)\n\tfmt.Printf(\"Node: %+v\\n\", n1)\n\tmodReq := gpuschedulerplugin.TranslateGPUResources(n0.KubeAlloc[gpuplugintypes.ResourceGPU], types.ResourceList{\n\t\ttypes.DeviceGroupPrefix + \"/gpugrp1/A/gpugrp0/B/gpu/GPU0/cards\": int64(1),\n\t}, n0.Allocatable)\n\tif !reflect.DeepEqual(modReq, n0.Allocatable) {\n\t\tt.Errorf(\"Alloc not same, expect: %v, have: %v\", n0.Allocatable, modReq)\n\t}\n\tn0.Allocatable = modReq\n\t//fmt.Printf(\"Node: %+v\\n\", n0)\n\n\tp0, _ := kubeinterface.KubePodInfoToPodInfo(kubePod, false)\n\tfmt.Printf(\"Pod: %+v\\n\", p0)\n\n\tfits, failures, score := ds.PodFitsResources(p0, n0, false)\n\tfmt.Printf(\"Fit: %v Failures: %v Score: %v\\n\", fits, failures, score)\n\n\tfits, failures, score = ds.PodFitsResources(p0, n1, false)\n\tfmt.Printf(\"Fit: %v Failures: %v Score: %v\\n\", fits, failures, score)\n\n\tfits, failures, score = ds.PodFitsResources(p0, n2, false)\n\tfmt.Printf(\"Fit: %v Failures: %v Score: %v\\n\", fits, failures, score)\n\n\tfits, failures, score = ds.PodFitsResources(p0, n3, false)\n\tfmt.Printf(\"Fit: %v Failures: %v Score: %v\\n\", fits, failures, score)\n\n\tfmt.Printf(\"Scores: %+v\\n\", ds.score)\n\n\tpri0 := ds.PodPriority(p0, n0)\n\tfmt.Printf(\"PodPriority0: %v\\n\", pri0)\n\n\tpri1 := ds.PodPriority(p0, n1)\n\tfmt.Printf(\"PodPriority1: %v\\n\", pri1)\n\n\tds.RemoveNode(\"Node1\")\n\tfmt.Printf(\"NodeLocationMap:\\n%+v\\n\", gpuschedulerplugin.NodeLocationMap)\n\tfmt.Printf(\"NodeCacheMap:\\n%+v\\n\", gpuschedulerplugin.NodeCacheMap)\n\tds.RemoveNode(\"Node4\")\n\tfmt.Printf(\"NodeLocationMap:\\n%+v\\n\", gpuschedulerplugin.NodeLocationMap)\n\tfmt.Printf(\"NodeCacheMap:\\n%+v\\n\", gpuschedulerplugin.NodeCacheMap)\n\n\tkdlog.FlushLogs()\n}", "func NewNodeMap(client kube_client.Interface, nodes []*apiv1.Node) (Map, error) {\n\tnodeMap := Map{\n\t\tOnDemand: make([]*NodeInfo, 0),\n\t\tSpot: make([]*NodeInfo, 0),\n\t}\n\n\tfor _, node := range nodes {\n\t\tnodeInfo, err := newNodeInfo(client, node)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Sort pods with biggest CPU request first\n\t\tsort.Slice(nodeInfo.Pods, func(i, j int) bool {\n\t\t\tiCPU := getPodCPURequests(nodeInfo.Pods[i])\n\t\t\tjCPU := getPodCPURequests(nodeInfo.Pods[j])\n\t\t\treturn iCPU > jCPU\n\t\t})\n\n\t\tswitch true {\n\t\tcase isSpotNode(node):\n\t\t\tnodeMap[Spot] = append(nodeMap[Spot], nodeInfo)\n\t\t\tcontinue\n\t\tcase isOnDemandNode(node):\n\t\t\tnodeMap[OnDemand] = append(nodeMap[OnDemand], nodeInfo)\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tcontinue\n\t\t}\n\t}\n\n\t// Sort spot nodes by most requested CPU first\n\tsort.Slice(nodeMap[Spot], func(i, j int) bool {\n\t\treturn nodeMap[Spot][i].RequestedCPU > nodeMap[Spot][j].RequestedCPU\n\t})\n\t// Sort on-demand nodes by least requested CPU first\n\tsort.Slice(nodeMap[OnDemand], func(i, j int) bool {\n\t\treturn nodeMap[OnDemand][i].RequestedCPU < nodeMap[OnDemand][j].RequestedCPU\n\t})\n\n\treturn nodeMap, nil\n}", "func NewTCPCluster(name string, mutationFunc ...ClusterMutator) (ciliumv2.XDSResource, error) {\n\tcluster := &envoy_config_cluster_v3.Cluster{\n\t\tName: name,\n\t\tClusterDiscoveryType: &envoy_config_cluster_v3.Cluster_Type{\n\t\t\tType: envoy_config_cluster_v3.Cluster_EDS,\n\t\t},\n\t}\n\n\t// Apply mutation functions for customizing the cluster.\n\tfor _, fn := range mutationFunc {\n\t\tcluster = fn(cluster)\n\t}\n\n\tclusterBytes, err := proto.Marshal(cluster)\n\tif err != nil {\n\t\treturn ciliumv2.XDSResource{}, err\n\t}\n\n\treturn ciliumv2.XDSResource{\n\t\tAny: &anypb.Any{\n\t\t\tTypeUrl: envoy.ClusterTypeURL,\n\t\t\tValue: clusterBytes,\n\t\t},\n\t}, nil\n}", "func (zic *ZoneInterconnectHandler) createLocalZoneNodeResources(node *corev1.Node, nodeID int) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port ips for node %s: %w\", node.Name, err)\n\t}\n\n\tnetworkId, err := util.ParseNetworkIDAnnotation(node, zic.GetNetworkName())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get the network id for the network %s on node %s: %v\", zic.GetNetworkName(), node.Name, err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\ttransitSwitchTunnelKey := BaseTransitSwitchTunnelKey + networkId\n\tts := &nbdb.LogicalSwitch{\n\t\tName: zic.networkTransitSwitchName,\n\t\tOtherConfig: map[string]string{\n\t\t\t\"interconn-ts\": zic.networkTransitSwitchName,\n\t\t\t\"requested-tnl-key\": strconv.Itoa(transitSwitchTunnelKey),\n\t\t\t\"mcast_snoop\": \"true\",\n\t\t\t\"mcast_flood_unregistered\": \"true\",\n\t\t},\n\t}\n\n\t// Create transit switch if it doesn't exist\n\tif err := libovsdbops.CreateOrUpdateLogicalSwitch(zic.nbClient, ts); err != nil {\n\t\treturn fmt.Errorf(\"failed to create/update transit switch %s: %w\", zic.networkTransitSwitchName, err)\n\t}\n\n\t// Connect transit switch to the cluster router by creating a pair of logical switch port - logical router port\n\tlogicalRouterPortName := zic.GetNetworkScopedName(types.RouterToTransitSwitchPrefix + node.Name)\n\tlogicalRouterPort := nbdb.LogicalRouterPort{\n\t\tName: logicalRouterPortName,\n\t\tMAC: transitRouterPortMac.String(),\n\t\tNetworks: transitRouterPortNetworks,\n\t\tOptions: map[string]string{\n\t\t\t\"mcast_flood\": \"true\",\n\t\t},\n\t}\n\tlogicalRouter := nbdb.LogicalRouter{\n\t\tName: zic.networkClusterRouterName,\n\t}\n\n\tif err := libovsdbops.CreateOrUpdateLogicalRouterPort(zic.nbClient, &logicalRouter, &logicalRouterPort, nil); err != nil {\n\t\treturn fmt.Errorf(\"failed to create/update cluster router %s to add transit switch port %s for the node %s: %w\", zic.networkClusterRouterName, logicalRouterPortName, node.Name, err)\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"router-port\": logicalRouterPortName,\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\terr = zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix+node.Name),\n\t\tlportTypeRouter, []string{lportTypeRouterAddr}, lspOptions, externalIDs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Its possible that node is moved from a remote zone to the local zone. Check and delete the remote zone routes\n\t// for this node as it's no longer needed.\n\treturn zic.deleteLocalNodeStaticRoutes(node, nodeID, nodeTransitSwitchPortIPs)\n}", "func buildNormalizedNodeResourceMap(pods []*core_v1.Pod, nodes []*core_v1.Node) nodeResourceMap { // nolint: gocyclo\n\tnrm := nodeResourceMap{}\n\n\tfor _, n := range nodes {\n\t\tnrm[n.ObjectMeta.Name] = allocatedNodeResources{node: n}\n\t}\n\n\t// We sum the total allocated resources on every node from our list of pods.\n\t// Some strategies may wish to price pods based on their fraction of allocated\n\t// node resources, rather than the total resources available on a node. This\n\t// may punish lone pods that are initially scheduled onto large nodes, but this\n\t// may be desirable as it rightfully punishes applications that may cause\n\t// frequent node turnover.\n\tfor _, p := range pods {\n\t\tnr, ok := nrm[p.Spec.NodeName]\n\t\tif !ok {\n\t\t\tlog.Log.Warnw(\"unexpected missing node from NodeMap\", zap.String(\"nodeName\", p.Spec.NodeName))\n\t\t\tcontinue\n\t\t}\n\t\tnr.cpuUsed += sumPodResource(p, core_v1.ResourceCPU)\n\t\tnr.memoryUsed += sumPodResource(p, core_v1.ResourceMemory)\n\t\tnr.gpuUsed += sumPodResource(p, ResourceGPU)\n\t\tnrm[p.Spec.NodeName] = nr\n\t}\n\n\tfor k, v := range nrm {\n\t\tc := v.node.Status.Capacity.Cpu()\n\t\tif c != nil {\n\t\t\tv.cpuAvailable = c.MilliValue()\n\t\t}\n\n\t\tm := v.node.Status.Capacity.Memory()\n\t\tif m != nil {\n\t\t\tv.memoryAvailable = m.Value()\n\t\t}\n\n\t\tg := gpuCapacity(&v.node.Status.Capacity)\n\t\tif g != nil {\n\t\t\tv.gpuAvailable = g.Value()\n\t\t}\n\n\t\t// The ratio of cpuUsed / cpuAvailable is used for proportional scaling of\n\t\t// resources to \"normalize\" pod resource utilization to a full node. If\n\t\t// cpuUsed is 0 because the pods that are running have not made resource\n\t\t// requests, there's a possible divide by 0 in calling code so we default to\n\t\t// setting cpuUsed to cpuAvailable.\n\t\tif v.cpuUsed == 0 {\n\t\t\tv.cpuUsed = v.cpuAvailable\n\t\t}\n\n\t\tif v.memoryUsed == 0 {\n\t\t\tv.memoryUsed = v.memoryAvailable\n\t\t}\n\n\t\tif v.gpuUsed == 0 {\n\t\t\tv.gpuUsed = v.gpuAvailable\n\t\t}\n\n\t\tnrm[k] = v\n\t}\n\n\treturn nrm\n}", "func newResources(clusterID, clusterVPCID string, publicAccessFW publicAccessFirewall, gclient *godo.Client) *resources {\n\treturn &resources{\n\t\tclusterID: clusterID,\n\t\tclusterVPCID: clusterVPCID,\n\t\tfirewall: publicAccessFW,\n\n\t\tgclient: gclient,\n\t}\n}", "func NewTopologiesCommands() []Command {\n\treturn []Command{\n\t\t&changeTopologyCmd{},\n\t\t&bqlCmd{},\n\t}\n}", "func TestCreateLogicalRouter(t *testing.T) {\n\n\tnsxClient, teardown := setupTest()\n\tdefer teardown()\n\n\tclusters, err := nsxtapi.FindEdgeCluster(&nsxClient, nsxtapi.EdgeClusterCallback[\"name\"], \"edge-cluster\")\n\tif err != nil {\n\t\tt.Fatal(\"No cluster defined\")\n\t}\n\n\ttype args struct {\n\t\tnsxClient *nsxt.APIClient\n\t\trouterType string\n\t\tname string\n\t\tclusterUuid string\n\t\ttags []common.Tag\n\t}\n\ttests := []struct {\n\t\tname string\n\t\targs args\n\t\twantErr bool\n\t}{\n\t\t{\n\t\t\t\"test create tier0\",\n\t\t\targs{\n\t\t\t\t&nsxClient,\n\t\t\t\t\"TIER0\",\n\t\t\t\t\"test\",\n\t\t\t\tclusters[0].Id,\n\t\t\t\tnil,\n\t\t\t},\n\t\t\tfalse,\n\t\t},\n\t\t{\n\t\t\t\"test create tier1\",\n\t\t\targs{\n\t\t\t\t&nsxClient,\n\t\t\t\t\"TIER1\",\n\t\t\t\t\"test\",\n\t\t\t\tclusters[0].Id,\n\t\t\t\tnil,\n\t\t\t},\n\t\t\tfalse,\n\t\t},\n\t\t{\n\t\t\t\"wrong type\",\n\t\t\targs{\n\t\t\t\t&nsxClient,\n\t\t\t\t\"TIER2\",\n\t\t\t\t\"test\",\n\t\t\t\tclusters[0].Id,\n\t\t\t\tnil,\n\t\t\t},\n\t\t\ttrue,\n\t\t},\n\t\t{\n\t\t\t\"wrong cluster id\",\n\t\t\targs{\n\t\t\t\t&nsxClient,\n\t\t\t\t\"TIER0\",\n\t\t\t\t\"test\",\n\t\t\t\t\"1234\",\n\t\t\t\tnil,\n\t\t\t},\n\t\t\ttrue,\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\n\t\t\treq := nsxtapi.RouterCreateReq{}\n\n\t\t\treq.Name = tt.args.name\n\t\t\treq.RouterType = tt.args.routerType\n\t\t\treq.ClusterID = tt.args.clusterUuid\n\t\t\treq.Tags = tt.args.tags\n\n\t\t\tnsx := tt.args.nsxClient\n\t\t\tgot, err := nsxtapi.CreateLogicalRouter(nsx, req)\n\t\t\tif (err != nil) != tt.wantErr {\n\t\t\t\tt.Errorf(\"CreateLogicalRouter() error = %v, wantErr %v\", err, tt.wantErr)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err != nil && tt.wantErr == true {\n\t\t\t\tt.Log(\" Expected error and go error\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err == nil && got == nil {\n\t\t\t\tt.Errorf(\"CreateLogicalRouter() error not nil but got back nil\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif got != nil {\n\n\t\t\t\t// read / delete / read after addition\n\t\t\t\t_, _, err = tt.args.nsxClient.LogicalRoutingAndServicesApi.ReadLogicalRouter(nsx.Context, got.Id)\n\t\t\t\tif (err != nil) != tt.wantErr {\n\t\t\t\t\tt.Errorf(\"CreateLogicalRouter() error = %v, wantErr %v\", err, tt.wantErr)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t_, err = nsxtapi.DeleteLogicalRouter(tt.args.nsxClient, got.Id)\n\t\t\t\tif (err != nil) != tt.wantErr {\n\t\t\t\t\tt.Errorf(\"CreateLogicalRouter() error = %v, wantErr %v\", err, tt.wantErr)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t_, _, err = tt.args.nsxClient.LogicalRoutingAndServicesApi.ReadLogicalRouter(nsx.Context, got.Id)\n\t\t\t\tif err == nil {\n\t\t\t\t\tt.Errorf(\"Delete failed\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "func NewElasticsearchTopology(topology []string) ([]ElasticsearchTopologyElement, error) {\n\tvar t = make([]ElasticsearchTopologyElement, 0, len(topology))\n\tfor _, rawElement := range topology {\n\t\tvar element ElasticsearchTopologyElement\n\t\telement.fillDefaults()\n\t\tif err := json.Unmarshal([]byte(rawElement), &element); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"depresourceapi: failed unpacking raw topology: %s\", err)\n\t\t}\n\n\t\tif err := element.Validate(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tt = append(t, element)\n\t}\n\treturn t, nil\n}", "func NewTreeTopology(fanout, nTasks uint64) *TreeTopology {\n\tm := &TreeTopology{\n\t\tfanout: fanout,\n\t\tnumOfTasks: nTasks,\n\t}\n\treturn m\n}", "func TopologyTree() CustomizeWorkItemLinkTypeFunc {\n\treturn Topology(link.TopologyTree)\n}", "func Get(ctx context.Context, clusters *clusters.Clusters) *Topology {\n\tvar edges []Edge\n\tvar nodes []Node\n\n\tfor _, c := range clusters.Clusters {\n\t\tapplications, err := c.GetApplications(ctx, \"\")\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, application := range applications {\n\t\t\tnodes = append(nodes, Node{\n\t\t\t\tData: NodeData{\n\t\t\t\t\tapplication.Cluster + \"-\" + application.Namespace + \"-\" + application.Name,\n\t\t\t\t\t\"application\",\n\t\t\t\t\tapplication.Name,\n\t\t\t\t\tapplication.Cluster + \"-\" + application.Namespace,\n\t\t\t\t\tapplication,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\t// The cluster and namespace field in the reference for a dependency is optional. So that we have to set the\n\t\t\t// cluster and namespace to the cluster and namespace of the current application, when it isn't defined in\n\t\t\t// the dependency reference.\n\t\t\tfor _, dependency := range application.Dependencies {\n\t\t\t\tdependencyCluster := dependency.Cluster\n\t\t\t\tif dependencyCluster == \"\" {\n\t\t\t\t\tdependencyCluster = application.Cluster\n\t\t\t\t}\n\n\t\t\t\tdependencyNamespace := dependency.Namespace\n\t\t\t\tif dependencyNamespace == \"\" {\n\t\t\t\t\tdependencyNamespace = application.Namespace\n\t\t\t\t}\n\n\t\t\t\tdependencyName := dependency.Name\n\n\t\t\t\tedges = append(edges, Edge{\n\t\t\t\t\tData: EdgeData{\n\t\t\t\t\t\tID: application.Cluster + \"-\" + application.Namespace + \"-\" + application.Name + \"-\" + dependencyCluster + \"-\" + dependencyNamespace + \"-\" + dependencyName,\n\t\t\t\t\t\tSource: application.Cluster + \"-\" + application.Namespace + \"-\" + application.Name,\n\t\t\t\t\t\tSourceCluster: application.Cluster,\n\t\t\t\t\t\tSourceNamespace: application.Namespace,\n\t\t\t\t\t\tSourceName: application.Name,\n\t\t\t\t\t\tTarget: dependencyCluster + \"-\" + dependencyNamespace + \"-\" + dependencyName,\n\t\t\t\t\t\tTargetCluster: dependencyCluster,\n\t\t\t\t\t\tTargetNamespace: dependencyNamespace,\n\t\t\t\t\t\tTargetName: dependencyName,\n\t\t\t\t\t\tDescription: dependency.Description,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\t// Loop through all edges and remove the edge, when the source or target node doesn't exists. This is needed, so\n\t// that we only have edges were the source and target nodes exists, because the topology component in the React\n\t// UI will crash when it founds an edge but no corresponding node.\n\tvar filterEdges []Edge\n\tfor _, edge := range edges {\n\t\tif doesNodeExists(nodes, edge.Data.Source) && doesNodeExists(nodes, edge.Data.Target) {\n\t\t\tfilterEdges = append(filterEdges, edge)\n\t\t}\n\t}\n\n\treturn &Topology{\n\t\tEdges: filterEdges,\n\t\tNodes: nodes,\n\t}\n}", "func DescribeNodeResource(nodeNonTerminatedPodsList *corev1.PodList, node *corev1.Node) *NodeUsage {\n\tallocatable := node.Status.Capacity\n\tif len(node.Status.Allocatable) > 0 {\n\t\tallocatable = node.Status.Allocatable\n\t}\n\n\treqs, limits := getPodsTotalRequestsAndLimits(nodeNonTerminatedPodsList)\n\tcpuReqs, cpuLimits, memoryReqs, memoryLimits, ephemeralstorageReqs, ephemeralstorageLimits :=\n\t\treqs[corev1.ResourceCPU], limits[corev1.ResourceCPU], reqs[corev1.ResourceMemory], limits[corev1.ResourceMemory], reqs[corev1.ResourceEphemeralStorage], limits[corev1.ResourceEphemeralStorage]\n\tfractionCpuReqs := float64(0)\n\tfractionCpuLimits := float64(0)\n\tif allocatable.Cpu().MilliValue() != 0 {\n\t\tfractionCpuReqs = float64(cpuReqs.MilliValue()) / float64(allocatable.Cpu().MilliValue()) * 100\n\t\tfractionCpuLimits = float64(cpuLimits.MilliValue()) / float64(allocatable.Cpu().MilliValue()) * 100\n\t}\n\tfractionMemoryReqs := float64(0)\n\tfractionMemoryLimits := float64(0)\n\tif allocatable.Memory().Value() != 0 {\n\t\tfractionMemoryReqs = float64(memoryReqs.Value()) / float64(allocatable.Memory().Value()) * 100\n\t\tfractionMemoryLimits = float64(memoryLimits.Value()) / float64(allocatable.Memory().Value()) * 100\n\t}\n\tfractionEphemeralStorageReqs := float64(0)\n\tfractionEphemeralStorageLimits := float64(0)\n\tif allocatable.StorageEphemeral().Value() != 0 {\n\t\tfractionEphemeralStorageReqs = float64(ephemeralstorageReqs.Value()) / float64(allocatable.StorageEphemeral().Value()) * 100\n\t\tfractionEphemeralStorageLimits = float64(ephemeralstorageLimits.Value()) / float64(allocatable.StorageEphemeral().Value()) * 100\n\t}\n\n\treturn &NodeUsage{\n\t\tcpuReqs: cpuReqs.String(),\n\t\tmemoryReqs: memoryReqs.String(),\n\t\tephemeralStorageReqs: ephemeralstorageReqs.String(),\n\t\tfractionCpuReqs: fractionCpuReqs,\n\t\tfractionCpuLimits: fractionCpuLimits,\n\t\tfractionMemoryReqs: fractionMemoryReqs,\n\t\tfractionMemoryLimits: fractionMemoryLimits,\n\t\tfractionEphemeralStorageReqs: fractionEphemeralStorageReqs,\n\t\tfractionEphemeralStorageLimits: fractionEphemeralStorageLimits,\n\t}\n}", "func (m *ClusterService) getTopology(ctx context.Context, args struct{}) (*proto.GeneralResp, error) {\n\tif _, _, err := permissions(ctx, ADMIN); err != nil {\n\t\treturn nil, err\n\t}\n\ttv := &TopologyView{\n\t\tZones: make([]*ZoneView, 0),\n\t}\n\tzones := m.cluster.t.getAllZones()\n\tfor _, zone := range zones {\n\t\tcv := newZoneView(zone.name)\n\t\tcv.Status = zone.getStatusToString()\n\t\ttv.Zones = append(tv.Zones, cv)\n\t\tnsc := zone.getAllNodeSet()\n\t\tfor _, ns := range nsc {\n\t\t\tnsView := newNodeSetView(ns.dataNodeLen(), ns.metaNodeLen())\n\t\t\tcv.NodeSet[ns.ID] = nsView\n\t\t\tns.dataNodes.Range(func(key, value interface{}) bool {\n\t\t\t\tdataNode := value.(*DataNode)\n\t\t\t\tnsView.DataNodes = append(nsView.DataNodes, proto.NodeView{ID: dataNode.ID, Addr: dataNode.Addr, Status: dataNode.isActive, IsWritable: dataNode.isWriteAble()})\n\t\t\t\treturn true\n\t\t\t})\n\t\t\tns.metaNodes.Range(func(key, value interface{}) bool {\n\t\t\t\tmetaNode := value.(*MetaNode)\n\t\t\t\tnsView.MetaNodes = append(nsView.MetaNodes, proto.NodeView{ID: metaNode.ID, Addr: metaNode.Addr, Status: metaNode.IsActive, IsWritable: metaNode.isWritable()})\n\t\t\t\treturn true\n\t\t\t})\n\t\t}\n\t}\n\n\tbs, e := json.Marshal(tv)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\treturn proto.Success(string(bs)), e\n}", "func NewResource() (Resource, error) {\n\t// Get cluster config\n\tconfig, err := rest.InClusterConfig()\n\tif err != nil {\n\t\tlog.Fatalf(\"Error getting in cluster config: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\t// Setup event source client\n\teventSrcClient, err := eventsrcclientset.NewForConfig(config)\n\tif err != nil {\n\t\tlog.Printf(\"Error building event source client: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\t// Setup tektoncd client\n\ttektonClient, err := tektoncdclientset.NewForConfig(config)\n\tif err != nil {\n\t\tlog.Printf(\"Error building tekton clientset: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\t// Setup k8s client\n\tk8sClient, err := k8sclientset.NewForConfig(config)\n\tif err != nil {\n\t\tlog.Printf(\"Error building k8s clientset: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\tr := Resource{\n\t\tK8sClient: k8sClient,\n\t\tTektonClient: tektonClient,\n\t\tEventSrcClient: eventSrcClient,\n\t}\n\treturn r, nil\n}", "func NewAreaTopology(areas ...*Area) *AreaTopology {\n\tt := &AreaTopology{areas: areas}\n\n\tcounter := 0\n\n\t// Initialization phase to create the topology for each individual area.\n\tfor _, area := range t.areas {\n\t\tarea.nodes = make(map[Node][]Link)\n\t\tnodes := make([]Node, area.N)\n\n\t\t// 1. Create the nodes of the area\n\t\tfor i := range nodes {\n\t\t\tnodes[i] = Node{Name: NodeID(fmt.Sprintf(\"node%d\", counter))}\n\t\t\tcounter++\n\t\t}\n\n\t\t// 2. Create the links to the area members with the given latency.\n\t\tfor i, node := range nodes {\n\t\t\tlinks := make([]Link, 0, area.N-1)\n\n\t\t\tfor j, peer := range nodes {\n\t\t\t\tif i != j {\n\t\t\t\t\tlinks = append(links, Link{\n\t\t\t\t\t\tDistant: peer,\n\t\t\t\t\t\tDelay: area.Latency,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tarea.nodes[node] = links\n\t\t}\n\t}\n\n\t// Then the links between the areas are calculated.\n\tfor i, from := range t.areas {\n\t\tfor j, to := range areas {\n\t\t\tif i != j {\n\t\t\t\tt.makeAreaLinks(from, to)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn t\n}", "func resourceNodeV1() *schema.Resource {\n\treturn &schema.Resource{\n\t\tCreate: resourceNodeV1Create,\n\t\tRead: resourceNodeV1Read,\n\t\tUpdate: resourceNodeV1Update,\n\t\tDelete: resourceNodeV1Delete,\n\n\t\tSchema: map[string]*schema.Schema{\n\t\t\t\"name\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"boot_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"clean\": {\n\t\t\t\tType: schema.TypeBool,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"conductor_group\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"console_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"deploy_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"driver\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t},\n\t\t\t\"driver_info\": {\n\t\t\t\tType: schema.TypeMap,\n\t\t\t\tOptional: true,\n\t\t\t\tDiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {\n\t\t\t\t\t/* FIXME: Password updates aren't considered. How can I know if the *local* data changed? */\n\t\t\t\t\t/* FIXME: Support drivers other than IPMI */\n\t\t\t\t\tif k == \"driver_info.ipmi_password\" && old == \"******\" {\n\t\t\t\t\t\treturn true\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false\n\t\t\t\t},\n\n\t\t\t\t// driver_info could contain passwords\n\t\t\t\tSensitive: true,\n\t\t\t},\n\t\t\t\"properties\": {\n\t\t\t\tType: schema.TypeMap,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"root_device\": {\n\t\t\t\tType: schema.TypeMap,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"extra\": {\n\t\t\t\tType: schema.TypeMap,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"inspect_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"instance_uuid\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"inspect\": {\n\t\t\t\tType: schema.TypeBool,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"available\": {\n\t\t\t\tType: schema.TypeBool,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"manage\": {\n\t\t\t\tType: schema.TypeBool,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"management_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"network_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"power_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"raid_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"rescue_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"resource_class\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"storage_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"vendor_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"owner\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"ports\": {\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\tType: schema.TypeMap,\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"provision_state\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"power_state\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"target_power_state\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\n\t\t\t\t// If power_state is same as target_power_state, we have no changes to apply\n\t\t\t\tDiffSuppressFunc: func(_, old, new string, d *schema.ResourceData) bool {\n\t\t\t\t\treturn new == d.Get(\"power_state\").(string)\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"power_state_timeout\": {\n\t\t\t\tType: schema.TypeInt,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"raid_config\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"bios_settings\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t},\n\t}\n}", "func resourceNodeV1Create(d *schema.ResourceData, meta interface{}) error {\n\tclient, err := meta.(*Clients).GetIronicClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create the node object in Ironic\n\tcreateOpts := schemaToCreateOpts(d)\n\tresult, err := nodes.Create(client, createOpts).Extract()\n\tif err != nil {\n\t\td.SetId(\"\")\n\t\treturn err\n\t}\n\n\t// Setting the ID is what tells terraform we were successful in creating the node\n\tlog.Printf(\"[DEBUG] Node created with ID %s\\n\", d.Id())\n\td.SetId(result.UUID)\n\n\t// Create ports as part of the node object - you may also use the native port resource\n\tportSet := d.Get(\"ports\").(*schema.Set)\n\tif portSet != nil {\n\t\tportList := portSet.List()\n\t\tfor _, portInterface := range portList {\n\t\t\tport := portInterface.(map[string]interface{})\n\n\t\t\t// Terraform map can't handle bool... seriously.\n\t\t\tvar pxeEnabled bool\n\t\t\tif port[\"pxe_enabled\"] != nil {\n\t\t\t\tif port[\"pxe_enabled\"] == \"true\" {\n\t\t\t\t\tpxeEnabled = true\n\t\t\t\t} else {\n\t\t\t\t\tpxeEnabled = false\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t// FIXME: All values other than address and pxe\n\t\t\tportCreateOpts := ports.CreateOpts{\n\t\t\t\tNodeUUID: d.Id(),\n\t\t\t\tAddress: port[\"address\"].(string),\n\t\t\t\tPXEEnabled: &pxeEnabled,\n\t\t\t}\n\t\t\t_, err := ports.Create(client, portCreateOpts).Extract()\n\t\t\tif err != nil {\n\t\t\t\t_ = resourcePortV1Read(d, meta)\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Make node manageable\n\tif d.Get(\"manage\").(bool) || d.Get(\"clean\").(bool) || d.Get(\"inspect\").(bool) {\n\t\tif err := ChangeProvisionStateToTarget(client, d.Id(), \"manage\", nil, nil, nil); err != nil {\n\t\t\treturn fmt.Errorf(\"could not manage: %s\", err)\n\t\t}\n\t}\n\n\t// Clean node\n\tif d.Get(\"clean\").(bool) {\n\t\tif err := setRAIDConfig(client, d); err != nil {\n\t\t\treturn fmt.Errorf(\"fail to set raid config: %s\", err)\n\t\t}\n\n\t\tvar cleanSteps []nodes.CleanStep\n\t\tif cleanSteps, err = buildManualCleaningSteps(d.Get(\"raid_interface\").(string), d.Get(\"raid_config\").(string), d.Get(\"bios_settings\").(string)); err != nil {\n\t\t\treturn fmt.Errorf(\"fail to build raid clean steps: %s\", err)\n\t\t}\n\n\t\tif err := ChangeProvisionStateToTarget(client, d.Id(), \"clean\", nil, nil, cleanSteps); err != nil {\n\t\t\treturn fmt.Errorf(\"could not clean: %s\", err)\n\t\t}\n\t}\n\n\t// Inspect node\n\tif d.Get(\"inspect\").(bool) {\n\t\tif err := ChangeProvisionStateToTarget(client, d.Id(), \"inspect\", nil, nil, nil); err != nil {\n\t\t\treturn fmt.Errorf(\"could not inspect: %s\", err)\n\t\t}\n\t}\n\n\t// Make node available\n\tif d.Get(\"available\").(bool) {\n\t\tif err := ChangeProvisionStateToTarget(client, d.Id(), \"provide\", nil, nil, nil); err != nil {\n\t\t\treturn fmt.Errorf(\"could not make node available: %s\", err)\n\t\t}\n\t}\n\n\t// Change power state, if required\n\tif targetPowerState := d.Get(\"target_power_state\").(string); targetPowerState != \"\" {\n\t\terr := changePowerState(client, d, nodes.TargetPowerState(targetPowerState))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not change power state: %s\", err)\n\t\t}\n\t}\n\n\treturn resourceNodeV1Read(d, meta)\n}", "func (router *Router) createResource(w http.ResponseWriter, r *http.Request) {\n\tclusterName := r.URL.Query().Get(\"cluster\")\n\tnamespace := r.URL.Query().Get(\"namespace\")\n\tname := r.URL.Query().Get(\"name\")\n\tresource := r.URL.Query().Get(\"resource\")\n\tsubResource := r.URL.Query().Get(\"subResource\")\n\tpath := r.URL.Query().Get(\"path\")\n\n\tlog.WithFields(logrus.Fields{\"cluster\": clusterName, \"namespace\": namespace, \"name\": name, \"path\": path, \"resource\": resource, \"subResource\": subResource}).Tracef(\"createResource\")\n\n\tcluster := router.clusters.GetCluster(clusterName)\n\tif cluster == nil {\n\t\terrresponse.Render(w, r, nil, http.StatusBadRequest, \"Invalid cluster name\")\n\t\treturn\n\t}\n\n\tif router.isForbidden(resource) {\n\t\terrresponse.Render(w, r, nil, http.StatusForbidden, fmt.Sprintf(\"Access for resource %s is forbidding\", resource))\n\t\treturn\n\t}\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\terrresponse.Render(w, r, err, http.StatusBadRequest, \"Could not decode request body\")\n\t\treturn\n\t}\n\n\terr = cluster.CreateResource(r.Context(), namespace, name, path, resource, subResource, body)\n\tif err != nil {\n\t\terrresponse.Render(w, r, err, http.StatusBadRequest, \"Could not create resource\")\n\t\treturn\n\t}\n\n\trender.JSON(w, r, nil)\n}", "func (sdk *SDK) NewNode(prefer *cloudsvr.PreferAttrs) (*cloudsvr.CloudNode, *cloudsvr.PreferAttrs, error) {\n\n\tvar (\n\t\tpassword, _ = utils.GenPassword(24)\n\t\treq = &CreateInstanceRequest{\n\t\t\tImageID: OsImage,\n\t\t\tPassword: password,\n\t\t\tInstanceName: NodeName,\n\t\t\tInstanceChargeType: \"PostPaid\", // require RMB 100+\n\t\t\tSecurityGroupID: \"whatever\", // will be automatic rewrite\n\t\t\tInternetChargeType: \"PayByTraffic\", // traffic payment\n\t\t\tInternetMaxBandwidthOut: \"100\", // 100M\n\t\t\tLabels: NodeLabels,\n\t\t}\n\t)\n\n\t// if prefered attributes set, use prefer region & instance-type\n\tif prefer != nil && prefer.Valid() == nil {\n\t\tvar (\n\t\t\treg = prefer.RegionOrZone\n\t\t\ttyp = prefer.InstanceType\n\t\t)\n\t\tlog.Printf(\"create aliyun ecs by using prefered region %s, instance type %s ...\", reg, typ)\n\n\t\treq.RegionID = reg // cn-beijing\n\t\treq.InstanceType = typ // ecs.n4.large\n\n\t\tcreated, err := sdk.createNode(req)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\tlog.Printf(\"created prefered aliyun ecs succeed: %s\", created.ID)\n\t\treturn created, prefer, nil\n\t}\n\n\tlog.Infoln(\"creating aliyun ecs by trying all regions & types ...\")\n\n\t// if prefered created failed, or without prefer region & instance-type\n\t// try best on all region & instance-types to create the new aliyun ecs\n\tvar (\n\t\tregions []RegionType // all of aliyun regions\n\t\ttypes []InstanceTypeItemType // all of instance types within given range of mems & cpus\n\t\terr error\n\t\tcreated *cloudsvr.CloudNode\n\t)\n\n\t// list all regions\n\tregions, err = sdk.ListRegions()\n\tif err != nil {\n\t\tlog.Errorf(\"sdk.NewNode.ListRegions() error: %v\", err)\n\t\treturn nil, nil, err\n\t}\n\n\t// list specified range of instance types\n\ttypes, err = sdk.ListInstanceTypes(2, 4, 2, 8) // TODO range of given cpus/mems ranges\n\tif err != nil {\n\t\tlog.Errorf(\"sdk.NewNode.ListInstanceTypes() error: %v\", err)\n\t\treturn nil, nil, err\n\t}\n\n\tvar (\n\t\tuseRegionID, useInsType string\n\t)\n\t// range all regions & types to try to create ecs instance\n\tfor _, reg := range regions {\n\t\tfor _, typ := range types {\n\t\t\treq.RegionID = reg.RegionID // cn-beijing\n\t\t\treq.InstanceType = typ.InstanceTypeID // ecs.n4.large\n\n\t\t\t// if created succeed, directly return\n\t\t\tcreated, err = sdk.createNode(req)\n\t\t\tif err == nil {\n\t\t\t\tuseRegionID, useInsType = reg.RegionID, typ.InstanceTypeID\n\t\t\t\tgoto END\n\t\t\t}\n\n\t\t\tif sdk.isFatalError(err) {\n\t\t\t\tlog.Errorf(\"create aliyun ecs got fatal error, stop retry: %v\", err)\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\n\t\t\tlog.Warnf(\"create aliyun ecs failed: %v, will retry another region or type\", err)\n\t\t}\n\t}\n\nEND:\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tlog.Printf(\"created aliyun ecs %s at %s and type is %s\", created.ID, useRegionID, useInsType)\n\treturn created, &cloudsvr.PreferAttrs{RegionOrZone: useRegionID, InstanceType: useInsType}, nil\n}", "func TestNodeTopology(t *testing.T) {\n\ttestcases := map[string]struct {\n\t\tdriverName string\n\t\tinitialNodes []testNode\n\t\texpectedSegments []*Segment\n\t\tupdate func(t *testing.T, client *fakeclientset.Clientset)\n\t\texpectedUpdatedSegments []*Segment\n\t}{\n\t\t\"empty\": {},\n\t\t\"one-node\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{localStorageNode1},\n\t\t},\n\t\t\"missing-csi-node\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t\tskipCSINodeCreation: true,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t\"missing-node\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t\tskipNodeCreation: true,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t\"missing-node-labels\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t\"two-nodes\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: node2,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode2,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{localStorageNode1, localStorageNode2},\n\t\t},\n\t\t\"shared-storage\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: node2,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{localStorageNode1},\n\t\t},\n\t\t\"other-shared-storage\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode2,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: node2,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode2,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{localStorageNode2},\n\t\t},\n\t\t\"deep-topology\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: networkStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: networkStorageLabels,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: node2,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: networkStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: networkStorageLabels,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{networkStorage},\n\t\t},\n\t\t\"mixed-topology\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: node2,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: networkStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: networkStorageLabels,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{localStorageNode1, networkStorage},\n\t\t},\n\t\t\"partial-match\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: networkStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: networkStorageLabels,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: node2,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: networkStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: networkStorageLabels2,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{networkStorage, networkStorage2},\n\t\t},\n\t\t\"unsorted-keys\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\t// This node reports keys in reverse order, which must not make a difference.\n\t\t\t\t\t\tdriverName: []string{networkStorageKeys[2], networkStorageKeys[1], networkStorageKeys[0]},\n\t\t\t\t\t},\n\t\t\t\t\tlabels: networkStorageLabels,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: node2,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: networkStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: networkStorageLabels,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{networkStorage},\n\t\t},\n\t\t\"wrong-driver\": {\n\t\t\tdriverName: \"other-driver\",\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t\"remove-csi-node\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{localStorageNode1},\n\t\t\tupdate: func(t *testing.T, client *fakeclientset.Clientset) {\n\t\t\t\tremoveCSINode(t, client, node1)\n\t\t\t},\n\t\t},\n\t\t\"remove-node\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{localStorageNode1},\n\t\t\tupdate: func(t *testing.T, client *fakeclientset.Clientset) {\n\t\t\t\tremoveNode(t, client, node1)\n\t\t\t},\n\t\t},\n\t\t\"remove-driver\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{localStorageNode1},\n\t\t\tupdate: func(t *testing.T, client *fakeclientset.Clientset) {\n\t\t\t\tcsiNode, err := client.StorageV1().CSINodes().Get(context.Background(), node1, metav1.GetOptions{})\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t\t\t\t}\n\t\t\t\tcsiNode.Spec.Drivers = nil\n\t\t\t\tif _, err := client.StorageV1().CSINodes().Update(context.Background(), csiNode, metav1.UpdateOptions{}); err != nil {\n\t\t\t\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t\"change-labels\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{localStorageNode1},\n\t\t\tupdate: func(t *testing.T, client *fakeclientset.Clientset) {\n\t\t\t\tnode, err := client.CoreV1().Nodes().Get(context.Background(), node1, metav1.GetOptions{})\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t\t\t\t}\n\t\t\t\t// This isn't a realistic test case because CSI drivers cannot change their topology?\n\t\t\t\t// We support it anyway.\n\t\t\t\tnode.Labels[localStorageKey] = node2\n\t\t\t\tif _, err := client.CoreV1().Nodes().Update(context.Background(), node, metav1.UpdateOptions{}); err != nil {\n\t\t\t\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t\t\t\t}\n\t\t\t},\n\t\t\texpectedUpdatedSegments: []*Segment{localStorageNode2},\n\t\t},\n\t}\n\n\tfor name, tc := range testcases {\n\t\t// Not run in parallel. That doesn't work well in combination with global logging.\n\t\tt.Run(name, func(t *testing.T) {\n\t\t\t// There is no good way to shut down the informers. They spawn\n\t\t\t// various goroutines and some of them (in particular shared informer)\n\t\t\t// become very unhappy (\"close on closed channel\") when using a context\n\t\t\t// that gets cancelled. Therefore we just keep everything running.\n\t\t\t//\n\t\t\t// The informers also catch up with changes made via the client API\n\t\t\t// asynchronously. To ensure expected input for sync(), we wait until\n\t\t\t// the content of the informers is identical to what is currently stored.\n\t\t\tctx := context.Background()\n\n\t\t\ttestDriverName := tc.driverName\n\t\t\tif testDriverName == \"\" {\n\t\t\t\ttestDriverName = driverName\n\t\t\t}\n\n\t\t\tvar objects []runtime.Object\n\t\t\tobjects = append(objects, makeNodes(tc.initialNodes)...)\n\t\t\tclientSet := fakeclientset.NewSimpleClientset(objects...)\n\t\t\tnt := fakeNodeTopology(ctx, testDriverName, clientSet)\n\t\t\tif err := waitForInformers(ctx, nt); err != nil {\n\t\t\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t\t\t}\n\t\t\tvalidate(t, nt, tc.expectedSegments, nil, tc.expectedSegments)\n\n\t\t\tif tc.update != nil {\n\t\t\t\ttc.update(t, clientSet)\n\t\t\t\tif err := waitForInformers(ctx, nt); err != nil {\n\t\t\t\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t\t\t\t}\n\n\t\t\t\t// Determine the expected changes based on the delta.\n\t\t\t\tvar expectedAdded, expectedRemoved []*Segment\n\t\t\t\tfor _, segment := range tc.expectedUpdatedSegments {\n\t\t\t\t\tif !containsSegment(tc.expectedSegments, segment) {\n\t\t\t\t\t\texpectedAdded = append(expectedAdded, segment)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, segment := range tc.expectedSegments {\n\t\t\t\t\tif !containsSegment(tc.expectedUpdatedSegments, segment) {\n\t\t\t\t\t\texpectedRemoved = append(expectedRemoved, segment)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvalidate(t, nt, expectedAdded, expectedRemoved, tc.expectedUpdatedSegments)\n\t\t\t}\n\t\t})\n\t}\n}", "func BuildNodeTrafficMap(o graph.TelemetryOptions, client *prometheus.Client, globalInfo *graph.AppenderGlobalInfo) graph.TrafficMap {\n\tn := graph.NewNode(o.NodeOptions.Namespace, o.NodeOptions.Service, o.NodeOptions.Namespace, o.NodeOptions.Workload, o.NodeOptions.App, o.NodeOptions.Version, o.GraphType)\n\n\tlog.Tracef(\"Build graph for node [%+v]\", n)\n\n\tappenders := appender.ParseAppenders(o)\n\ttrafficMap := buildNodeTrafficMap(o.NodeOptions.Namespace, n, o, client)\n\n\tnamespaceInfo := graph.NewAppenderNamespaceInfo(o.NodeOptions.Namespace)\n\n\tfor _, a := range appenders {\n\t\tappenderTimer := internalmetrics.GetGraphAppenderTimePrometheusTimer(a.Name())\n\t\ta.AppendGraph(trafficMap, globalInfo, namespaceInfo)\n\t\tappenderTimer.ObserveDuration()\n\t}\n\n\t// The appenders can add/remove/alter nodes. After the manipulations are complete\n\t// we can make some final adjustments:\n\t// - mark the outsiders (i.e. nodes not in the requested namespaces)\n\t// - mark the traffic generators\n\tmarkOutsideOrInaccessible(trafficMap, o)\n\tmarkTrafficGenerators(trafficMap)\n\n\t// Note that this is where we would call reduceToServiceGraph for graphTypeService but\n\t// the current decision is to not reduce the node graph to provide more detail. This may be\n\t// confusing to users, we'll see...\n\n\treturn trafficMap\n}", "func New() Nodetool {\n\treturn &nodetool{}\n}", "func (g genericPlugin) Create(yamlFilePath string, namespace string, client plugin.KubernetesConnector) (string, error) {\n\tif namespace == \"\" {\n\t\tnamespace = \"default\"\n\t}\n\n\t//Decode the yaml file to create a runtime.Object\n\tunstruct := &unstructured.Unstructured{}\n\t//Ignore the returned obj as we expect the data in unstruct\n\t_, err := utils.DecodeYAML(yamlFilePath, unstruct)\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Decode deployment object error\")\n\t}\n\n\tdynClient := client.GetDynamicClient()\n\tmapper := client.GetMapper()\n\n\tgvk := unstruct.GroupVersionKind()\n\tmapping, err := mapper.RESTMapping(schema.GroupKind{Group: gvk.Group, Kind: gvk.Kind}, gvk.Version)\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Mapping kind to resource error\")\n\t}\n\n\t//Add the tracking label to all resources created here\n\tlabels := unstruct.GetLabels()\n\t//Check if labels exist for this object\n\tif labels == nil {\n\t\tlabels = map[string]string{}\n\t}\n\tlabels[config.GetConfiguration().KubernetesLabelName] = client.GetInstanceID()\n\tunstruct.SetLabels(labels)\n\n\t// This checks if the resource we are creating has a podSpec in it\n\t// Eg: Deployment, StatefulSet, Job etc..\n\t// If a PodSpec is found, the label will be added to it too.\n\tplugin.TagPodsIfPresent(unstruct, client.GetInstanceID())\n\n\tgvr := mapping.Resource\n\tvar createdObj *unstructured.Unstructured\n\n\tswitch mapping.Scope.Name() {\n\tcase meta.RESTScopeNameNamespace:\n\t\tcreatedObj, err = dynClient.Resource(gvr).Namespace(namespace).Create(unstruct, metav1.CreateOptions{})\n\tcase meta.RESTScopeNameRoot:\n\t\tcreatedObj, err = dynClient.Resource(gvr).Create(unstruct, metav1.CreateOptions{})\n\tdefault:\n\t\treturn \"\", pkgerrors.New(\"Got an unknown RESTSCopeName for mapping: \" + gvk.String())\n\t}\n\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Create object error\")\n\t}\n\n\treturn createdObj.GetName(), nil\n}", "func createNodeClientMap(ctx context.Context, clients []provisioner.API) map[string]provisioner.API {\n\tresult := make(map[string]provisioner.API)\n\tfor _, c := range clients {\n\t\tif info, err := c.GetNodeInfo(ctx); err == nil {\n\t\t\tresult[info.NodeName] = c\n\t\t}\n\t}\n\treturn result\n}", "func CreateNodes(client *rancher.Client, rolesPerPool []string, quantityPerPool []int32) (ec2Nodes []*nodes.Node, err error) {\n\tec2Client, err := client.GetEC2Client()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trunningReservations := []*ec2.Reservation{}\n\treservationConfigs := []*rancherEc2.AWSEC2Config{}\n\t// provisioning instances in reverse order to allow windows instances time to become ready\n\tfor i := len(quantityPerPool) - 1; i >= 0; i-- {\n\t\tconfig := MatchRoleToConfig(rolesPerPool[i], ec2Client.ClientConfig.AWSEC2Config)\n\t\tif config == nil {\n\t\t\treturn nil, errors.New(\"No matching nodesAndRole for AWSEC2Config with role:\" + rolesPerPool[i])\n\t\t}\n\t\tsshName := getSSHKeyName(config.AWSSSHKeyName)\n\t\trunInstancesInput := &ec2.RunInstancesInput{\n\t\t\tImageId: aws.String(config.AWSAMI),\n\t\t\tInstanceType: aws.String(config.InstanceType),\n\t\t\tMinCount: aws.Int64(int64(quantityPerPool[i])),\n\t\t\tMaxCount: aws.Int64(int64(quantityPerPool[i])),\n\t\t\tKeyName: aws.String(sshName),\n\t\t\tBlockDeviceMappings: []*ec2.BlockDeviceMapping{\n\t\t\t\t{\n\t\t\t\t\tDeviceName: aws.String(\"/dev/sda1\"),\n\t\t\t\t\tEbs: &ec2.EbsBlockDevice{\n\t\t\t\t\t\tVolumeSize: aws.Int64(int64(config.VolumeSize)),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tIamInstanceProfile: &ec2.IamInstanceProfileSpecification{\n\t\t\t\tName: aws.String(config.AWSIAMProfile),\n\t\t\t},\n\t\t\tPlacement: &ec2.Placement{\n\t\t\t\tAvailabilityZone: aws.String(config.AWSRegionAZ),\n\t\t\t},\n\t\t\tNetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{\n\t\t\t\t{\n\t\t\t\t\tDeviceIndex: aws.Int64(0),\n\t\t\t\t\tAssociatePublicIpAddress: aws.Bool(true),\n\t\t\t\t\tGroups: aws.StringSlice(config.AWSSecurityGroups),\n\t\t\t\t},\n\t\t\t},\n\t\t\tTagSpecifications: []*ec2.TagSpecification{\n\t\t\t\t{\n\t\t\t\t\tResourceType: aws.String(\"instance\"),\n\t\t\t\t\tTags: []*ec2.Tag{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tKey: aws.String(\"Name\"),\n\t\t\t\t\t\t\tValue: aws.String(nodeBaseName),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tKey: aws.String(\"CICD\"),\n\t\t\t\t\t\t\tValue: aws.String(config.AWSCICDInstanceTag),\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\t\treservation, err := ec2Client.SVC.RunInstances(runInstancesInput)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// instead of waiting on each node pool to complete provisioning, add to a queue and check run status later\n\t\trunningReservations = append(runningReservations, reservation)\n\t\treservationConfigs = append(reservationConfigs, config)\n\t}\n\n\tfor i := 0; i < len(quantityPerPool); i++ {\n\t\tvar listOfInstanceIds []*string\n\n\t\tfor _, instance := range runningReservations[i].Instances {\n\t\t\tlistOfInstanceIds = append(listOfInstanceIds, instance.InstanceId)\n\t\t}\n\n\t\t//wait until instance is running\n\t\terr = ec2Client.SVC.WaitUntilInstanceRunning(&ec2.DescribeInstancesInput{\n\t\t\tInstanceIds: listOfInstanceIds,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t//wait until instance status is ok\n\t\terr = ec2Client.SVC.WaitUntilInstanceStatusOk(&ec2.DescribeInstanceStatusInput{\n\t\t\tInstanceIds: listOfInstanceIds,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// describe instance to get attributes\n\t\tdescribe, err := ec2Client.SVC.DescribeInstances(&ec2.DescribeInstancesInput{\n\t\t\tInstanceIds: listOfInstanceIds,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treadyInstances := describe.Reservations[0].Instances\n\n\t\tsshKey, err := nodes.GetSSHKey(reservationConfigs[i].AWSSSHKeyName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, readyInstance := range readyInstances {\n\t\t\tec2Node := &nodes.Node{\n\t\t\t\tNodeID: *readyInstance.InstanceId,\n\t\t\t\tPublicIPAddress: *readyInstance.PublicIpAddress,\n\t\t\t\tPrivateIPAddress: *readyInstance.PrivateIpAddress,\n\t\t\t\tSSHUser: reservationConfigs[i].AWSUser,\n\t\t\t\tSSHKey: sshKey,\n\t\t\t}\n\t\t\t// re-reverse the list so that the order is corrected\n\t\t\tec2Nodes = append([]*nodes.Node{ec2Node}, ec2Nodes...)\n\t\t}\n\t}\n\n\tclient.Session.RegisterCleanupFunc(func() error {\n\t\treturn DeleteNodes(client, ec2Nodes)\n\t})\n\n\treturn ec2Nodes, nil\n}", "func (config *AppConfig) CreateNodeAllocations(newNodeAllocations AllocationAttributes, nodeID int) (err error) {\n\tendpoint := fmt.Sprintf(\"nodes/%d/allocations\", nodeID)\n\n\tnewNodeAllocBytes, err := json.Marshal(newNodeAllocations)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// get json bytes from the panel.\n\t_, err = config.queryApplicationAPI(endpoint, \"post\", newNodeAllocBytes)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func (r *Reconciler) createResource(ctx context.Context, resourceName string, serverClient k8sclient.Client) (runtime.Object, error) {\n\tif r.extraParams == nil {\n\t\tr.extraParams = map[string]string{}\n\t}\n\tr.extraParams[\"MonitoringKey\"] = r.Config.GetLabelSelector()\n\tr.extraParams[\"Namespace\"] = r.Config.GetOperatorNamespace()\n\n\ttemplateHelper := NewTemplateHelper(r.extraParams)\n\tresource, err := templateHelper.CreateResource(resourceName)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"createResource failed: %w\", err)\n\t}\n\n\tmetaObj, err := meta.Accessor(resource)\n\tif err == nil {\n\t\towner.AddIntegreatlyOwnerAnnotations(metaObj, r.installation)\n\t}\n\n\terr = serverClient.Create(ctx, resource)\n\tif err != nil {\n\t\tif !k8serr.IsAlreadyExists(err) {\n\t\t\treturn nil, fmt.Errorf(\"error creating resource: %w\", err)\n\t\t}\n\t}\n\n\treturn resource, nil\n}", "func (c *VrouterNode) Create(contrailClient contrailclient.ApiClient) error {\n\tvrouterInfoLog.Printf(\"Creating %s %s\", c.Hostname, nodeType)\n\tgscObjects := []*contrailtypes.GlobalSystemConfig{}\n\tgscObjectsList, err := contrailClient.List(\"global-system-config\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(gscObjectsList) == 0 {\n\t\tvrouterInfoLog.Println(\"no gscObject\")\n\t}\n\n\tfor _, gscObject := range gscObjectsList {\n\t\tobj, err := contrailClient.ReadListResult(\"global-system-config\", &gscObject)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tgscObjects = append(gscObjects, obj.(*contrailtypes.GlobalSystemConfig))\n\t}\n\tfor _, gsc := range gscObjects {\n\t\tvirtualRouter := &contrailtypes.VirtualRouter{}\n\t\tvirtualRouter.SetVirtualRouterIpAddress(c.IPAddress)\n\t\tvirtualRouter.SetParent(gsc)\n\t\tvirtualRouter.SetName(c.Hostname)\n\t\tannotations := contrailclient.ConvertMapToContrailKeyValuePairs(c.Annotations)\n\t\tvirtualRouter.SetAnnotations(&annotations)\n\t\tif err := contrailClient.Create(virtualRouter); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn c.ensureVMIVhost0Interface(contrailClient)\n}", "func createLBRPNode(node *k8sNode) error {\n\tlog.Debugf(\"Creating %s\", k8switchName)\n\n\t// port connected to br0\n\ttoStack := k8switch.Ports{Name: \"toStack\"}\n\n\t// port connected to physical nic (through k8sfilter)\n\ttoNodePort := k8switch.Ports{Name: \"toNodePort\", Type_: \"NODEPORT\"}\n\n\tports := []k8switch.Ports{toStack, toNodePort}\n\n\tserviceClusterIPRange := os.Getenv(\"POLYCUBE_SERVICE_CLUSTERIP_RANGE\")\n\tif serviceClusterIPRange == \"\" {\n\t\tlog.Warningf(\"POLYCUBE_SERVICE_CLUSTERIP_RANGE not found, defaulting to %s\",\n\t\tserviceClusterIPRangeDefault)\n\t\t\tserviceClusterIPRange = serviceClusterIPRangeDefault\n\t}\n\n\tlb := k8switch.K8switch{\n\t\tName: k8switchName,\n\t\tPorts: ports,\n\t\tClusterIpSubnet: serviceClusterIPRange,\n\t\tClientSubnet: node.GetPodCIDR().String(),\n\t\tVirtualClientSubnet: node.GetVPodCIDR().String()}\n\n\tif _, err := k8switchAPI.CreateK8switchByID(k8switchName, lb); err != nil {\n\t\treturn err\n\t}\n\n\tlog.Debugf(\"%s created\", k8switchName)\n\treturn nil\n}", "func (nc *NodeController) Create(r types.Resource) (err error) {\n\tn, err := assertNode(r)\n\tif err != nil {\n\t\treturn\n\t}\n\targs := make(map[string]interface{})\n\tq := \"WITH \" + nc.newNode(n, args) + \",\" + nc.newLinks(n, args) + \",\" + nc.newNodeMetric(n, args) + \" \" + selectNode(\"new_node\", nc.db.table(\"nodes\"), \"new_links\", \"new_node_metric\", \"\")\n\tstmt, err := nc.db.PrepareNamed(q)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = stmt.Get(n, args)\n\treturn\n}", "func (m *ManagedNodeGroupResourceSet) AddAllResources() error {\n\tm.resourceSet.template.Description = fmt.Sprintf(\n\t\t\"%s (SSH access: %v) %s\",\n\t\t\"EKS Managed Nodes\",\n\t\tapi.IsEnabled(m.nodeGroup.SSH.Allow),\n\t\t\"[created by eksctl]\")\n\n\tm.template.Mappings[servicePrincipalPartitionMapName] = servicePrincipalPartitionMappings\n\n\tvar nodeRole *gfnt.Value\n\tif m.nodeGroup.IAM.InstanceRoleARN == \"\" {\n\t\tif err := createRole(m.resourceSet, m.nodeGroup.IAM, true); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tnodeRole = gfnt.MakeFnGetAttString(cfnIAMInstanceRoleName, \"Arn\")\n\t} else {\n\t\tnodeRole = gfnt.NewString(m.nodeGroup.IAM.InstanceRoleARN)\n\t}\n\n\tsubnets, err := AssignSubnets(m.nodeGroup.AvailabilityZones, m.clusterStackName, m.clusterConfig, m.nodeGroup.PrivateNetworking)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tscalingConfig := gfneks.Nodegroup_ScalingConfig{}\n\tif m.nodeGroup.MinSize != nil {\n\t\tscalingConfig.MinSize = gfnt.NewInteger(*m.nodeGroup.MinSize)\n\t}\n\tif m.nodeGroup.MaxSize != nil {\n\t\tscalingConfig.MaxSize = gfnt.NewInteger(*m.nodeGroup.MaxSize)\n\t}\n\tif m.nodeGroup.DesiredCapacity != nil {\n\t\tscalingConfig.DesiredSize = gfnt.NewInteger(*m.nodeGroup.DesiredCapacity)\n\t}\n\tmanagedResource := &gfneks.Nodegroup{\n\t\tClusterName: gfnt.NewString(m.clusterConfig.Metadata.Name),\n\t\tNodegroupName: gfnt.NewString(m.nodeGroup.Name),\n\t\tScalingConfig: &scalingConfig,\n\t\tSubnets: subnets,\n\t\t// Currently the API supports specifying only one instance type\n\t\tInstanceTypes: gfnt.NewStringSlice(m.nodeGroup.InstanceType),\n\t\tAmiType: gfnt.NewString(getAMIType(m.nodeGroup.InstanceType)),\n\t\tNodeRole: nodeRole,\n\t\tLabels: m.nodeGroup.Labels,\n\t\tTags: m.nodeGroup.Tags,\n\t}\n\n\tif api.IsEnabled(m.nodeGroup.SSH.Allow) {\n\t\tmanagedResource.RemoteAccess = &gfneks.Nodegroup_RemoteAccess{\n\t\t\tEc2SshKey: gfnt.NewString(*m.nodeGroup.SSH.PublicKeyName),\n\t\t\tSourceSecurityGroups: gfnt.NewStringSlice(m.nodeGroup.SSH.SourceSecurityGroupIDs...),\n\t\t}\n\t}\n\tif m.nodeGroup.VolumeSize != nil {\n\t\tmanagedResource.DiskSize = gfnt.NewInteger(*m.nodeGroup.VolumeSize)\n\t}\n\n\tm.newResource(\"ManagedNodeGroup\", managedResource)\n\n\treturn nil\n}", "func newServiceNode(port int, httpport int, wsport int, modules ...string) (*node.Node, error) {\n\tcfg := &node.DefaultConfig\n\tcfg.P2P.ListenAddr = fmt.Sprintf(\":%d\", port)\n\tcfg.P2P.EnableMsgEvents = true\n\tcfg.P2P.NoDiscovery = true\n\tcfg.IPCPath = ipcpath\n\tcfg.DataDir = fmt.Sprintf(\"%s%d\", datadirPrefix, port)\n\tif httpport > 0 {\n\t\tcfg.HTTPHost = node.DefaultHTTPHost\n\t\tcfg.HTTPPort = httpport\n\t}\n\tif wsport > 0 {\n\t\tcfg.WSHost = node.DefaultWSHost\n\t\tcfg.WSPort = wsport\n\t\tcfg.WSOrigins = []string{\"*\"}\n\t\tfor i := 0; i < len(modules); i++ {\n\t\t\tcfg.WSModules = append(cfg.WSModules, modules[i])\n\t\t}\n\t}\n\tstack, err := node.New(cfg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ServiceNode create fail: %v\", err)\n\t}\n\treturn stack, nil\n}", "func CreateDescribeNodeToolExecutionHistoriesRequest() (request *DescribeNodeToolExecutionHistoriesRequest) {\n\trequest = &DescribeNodeToolExecutionHistoriesRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Cassandra\", \"2019-01-01\", \"DescribeNodeToolExecutionHistories\", \"Cassandra\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func newDeploymentNode(nodeName string, node v1alpha1.ElasticsearchNode, cluster *v1alpha1.Elasticsearch, roleMap map[v1alpha1.ElasticsearchNodeRole]bool) NodeTypeInterface {\n\tdeploymentNode := deploymentNode{}\n\n\tdeploymentNode.populateReference(nodeName, node, cluster, roleMap, int32(1))\n\n\treturn &deploymentNode\n}", "func MakeTopology() Topology {\n\treturn Topology{\n\t\tNodes: map[string]Node{},\n\t}\n}", "func makeTopologyList(rep Reporter) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvar (\n\t\t\trpt = rep.Report()\n\t\t\ttopologies = []APITopologyDesc{}\n\t\t)\n\t\tfor name, def := range topologyRegistry {\n\t\t\tif def.parent != \"\" {\n\t\t\t\tcontinue // subtopology, don't show at top level\n\t\t\t}\n\t\t\tsubTopologies := []APITopologyDesc{}\n\t\t\tfor subName, subDef := range topologyRegistry {\n\t\t\t\tif subDef.parent == name {\n\t\t\t\t\tsubTopologies = append(subTopologies, APITopologyDesc{\n\t\t\t\t\t\tName: subDef.human,\n\t\t\t\t\t\tURL: \"/api/topology/\" + subName,\n\t\t\t\t\t\tStats: stats(subDef.renderer.Render(rpt)),\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t\ttopologies = append(topologies, APITopologyDesc{\n\t\t\t\tName: def.human,\n\t\t\t\tURL: \"/api/topology/\" + name,\n\t\t\t\tSubTopologies: subTopologies,\n\t\t\t\tStats: stats(def.renderer.Render(rpt)),\n\t\t\t})\n\t\t}\n\t\trespondWith(w, http.StatusOK, topologies)\n\t}\n}", "func testTrafficMapIssue2783() map[string]*graph.Node {\n\ttrafficMap := make(map[string]*graph.Node)\n\n\tn0, _ := graph.NewNode(config.DefaultClusterID, \"testNamespace\", \"a\", \"testNamespace\", \"a-v1\", \"a\", \"v1\", graph.GraphTypeVersionedApp)\n\n\tn1, _ := graph.NewNode(config.DefaultClusterID, \"testNamespace\", \"b\", graph.Unknown, graph.Unknown, graph.Unknown, graph.Unknown, graph.GraphTypeVersionedApp)\n\n\tn2, _ := graph.NewNode(config.DefaultClusterID, \"testNamespace\", \"b\", \"testNamespace\", \"b-v1\", \"b\", \"v1\", graph.GraphTypeVersionedApp)\n\n\ttrafficMap[n0.ID] = n0\n\ttrafficMap[n1.ID] = n1\n\ttrafficMap[n2.ID] = n2\n\n\tn0.AddEdge(n1)\n\tn1.AddEdge(n2)\n\n\treturn trafficMap\n}", "func NewTapestryNode(node RemoteNode) *Node {\n\tserverOptions := []grpc.ServerOption{}\n\t// Uncomment for xtrace\n\t// serverOptions = append(serverOptions, grpc.UnaryInterceptor(util.XTraceServerInterceptor))\n\tn := new(Node)\n\n\tn.node = node\n\tn.table = NewRoutingTable(node)\n\tn.backpointers = NewBackpointers(node)\n\tn.locationsByKey = NewLocationMap()\n\tn.blobstore = NewBlobStore()\n\tn.server = grpc.NewServer(serverOptions...)\n\n\treturn n\n}", "func (r *registry) makeTopologyList(rep Reporter) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\tvar (\n\t\t\trpt = rep.Report()\n\t\t\ttopologies = []APITopologyDesc{}\n\t\t)\n\t\tr.walk(func(desc APITopologyDesc) {\n\t\t\trenderer := renderedForRequest(req, desc)\n\t\t\tdesc.Stats = decorateWithStats(rpt, renderer)\n\t\t\tfor i := range desc.SubTopologies {\n\t\t\t\trenderer := renderedForRequest(req, desc.SubTopologies[i])\n\t\t\t\tdesc.SubTopologies[i].Stats = decorateWithStats(rpt, renderer)\n\t\t\t}\n\t\t\ttopologies = append(topologies, desc)\n\t\t})\n\t\trespondWith(w, http.StatusOK, topologies)\n\t}\n}", "func (ot *openTelemetryWrapper) newResource(\n\twebEngineName,\n\twebEngineVersion string,\n) (*resource.Resource, error) {\n\treturn resource.Merge(resource.Default(), resource.NewSchemaless(\n\t\tsemconv.WebEngineName(webEngineName),\n\t\tsemconv.WebEngineVersion(webEngineVersion),\n\t))\n}", "func newResource(tm unversioned.TypeMetadata) (unversioned.Resource, error) {\n\trh, ok := resourceToType[tm]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Unknown resource type (%s) and/or version (%s)\", tm.Kind, tm.APIVersion)\n\t}\n\tlog.Debugf(\"Found resource helper: %s\", rh)\n\n\t// Create new resource and fill in the type metadata.\n\tnew := reflect.New(rh)\n\telem := new.Elem()\n\telem.FieldByName(\"Kind\").SetString(tm.GetTypeMetadata().Kind)\n\telem.FieldByName(\"APIVersion\").SetString(tm.GetTypeMetadata().APIVersion)\n\n\treturn new.Interface().(unversioned.Resource), nil\n}", "func NewNode(ctx *pulumi.Context,\n\tname string, args *NodeArgs, opts ...pulumi.ResourceOption) (*Node, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.AcceleratorType == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'AcceleratorType'\")\n\t}\n\tif args.TensorflowVersion == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'TensorflowVersion'\")\n\t}\n\treplaceOnChanges := pulumi.ReplaceOnChanges([]string{\n\t\t\"location\",\n\t\t\"project\",\n\t})\n\topts = append(opts, replaceOnChanges)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Node\n\terr := ctx.RegisterResource(\"google-native:tpu/v1:Node\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (cm *ClusterManager) GetTopologyNodes(ctx context.Context,\n\treq *cmproto.GetTopologyNodesRequest, resp *cmproto.GetTopologyNodesResponse) error {\n\treqID, err := requestIDFromContext(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := time.Now()\n\tla := thirdparty.NewGetTopoNodesAction()\n\tla.Handle(ctx, req, resp)\n\tmetrics.ReportAPIRequestMetric(\"GetTopologyNodes\", \"grpc\", strconv.Itoa(int(resp.Code)), start)\n\tblog.V(3).Infof(\"reqID: %s, action: GetTopologyNodes, req %v\", reqID, req)\n\treturn nil\n}", "func NewResource(k8s *k8s.Client, res string) (Resource, error) {\n\tvar err error\n\tr := resource{\n\t\tk8s: k8s,\n\t\tNamespace: defaultNamespace,\n\t\tType: TypePod,\n\t}\n\tchunks := strings.Split(res, \"/\")\n\tnbc := len(chunks)\n\tif nbc == 1 {\n\t\t// Z: the pod \"Z\" in namespace \"default\"\n\t\tr.Name = chunks[0]\n\t} else if nbc == 2 {\n\t\t// Y/Z: all the pods of the resource \"Z\" of type \"Y\" in namespace \"default\"\n\t\tr.Type, err = strTypeToConst(chunks[0])\n\t\tr.Name = chunks[1]\n\t} else if nbc == 3 {\n\t\t// X/Y/Z: all the pods of the resource \"Z\" of type \"Y\" in namespace \"X\"\n\t\tr.Namespace = chunks[0]\n\t\tr.Type, err = strTypeToConst(chunks[1])\n\t\tr.Name = chunks[2]\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn types[r.Type](r), nil\n\t// var ret Resource\n\t// switch r.Type {\n\t// case TypePod:\n\t// \tret = &Pod{r}\n\t// case TypeDeploy:\n\t// \tret = &Deployment{r}\n\t// case TypeStatefulSet:\n\t// \tret = &StatefulSet{r}\n\t// }\n\t// return ret, nil\n}", "func NewNode(name string, w Worker) *Node {\n\tid := getID()\n\tn := &Node{id: id, w: w, name: name}\n\tn.chained = make(map[string]struct{})\n\tn.close = make(chan struct{})\n\treturn n\n}", "func CreateAllOperatorResources(args *FactoryArgs) ([]runtime.Object, error) {\n\tvar resources []runtime.Object\n\tfor group := range operatorFactoryFunctions {\n\t\trs, err := CreateOperatorResourceGroup(group, args)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresources = append(resources, rs...)\n\t}\n\treturn resources, nil\n}", "func newNode() *topicNode {\n\treturn &topicNode{\n\t\tchildren: children{},\n\t\tclients: make(clientOpts),\n\t\tshared: make(map[string]clientOpts),\n\t}\n}", "func NewNodePool(n v1.Node) (*NodePool, error) {\n\tnp := &NodePool{}\n\tvar err error\n\tnp.project, err = metadata.ProjectID()\n\tif err != nil {\n\t\treturn np, errors.Wrap(err, \"Could not get project id from metadata\")\n\t}\n\n\tnp.zone, err = metadata.Zone()\n\tif err != nil {\n\t\treturn np, errors.Wrap(err, \"Could not get zone from metadata\")\n\t}\n\n\tctx := context.Background()\n\tclient, err := google.DefaultClient(ctx, compute.ComputeScope, container.CloudPlatformScope)\n\tif err != nil {\n\t\treturn np, errors.Wrap(err, \"Could not create google default client\")\n\t}\n\n\tig, err := np.nodeInstanceGroup(n, client)\n\tif err != nil {\n\t\treturn np, err\n\t}\n\tnp.instanceGroup = ig\n\n\tcmpService, err := compute.New(client)\n\tif err != nil {\n\t\treturn np, errors.Wrap(err, \"Could not create compute service\")\n\t}\n\tnp.instanceGroupService = compute.NewInstanceGroupManagersService(cmpService)\n\n\tlog.Printf(\"[Info][NewNodePool] Connected to nodepool: %#v\", np)\n\n\treturn np, nil\n}", "func NewNodeCommand(clientset kubernetes.Clientset) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"node\",\n\t\tShort: \"Manage Swarm nodes\",\n\t\tRunE: cmd.ShowHelp(),\n\t}\n\tcmd.AddCommand(\n\t\tnewListCommand(clientset),\n\t)\n\treturn cmd\n}", "func NewNode(ctx *pulumi.Context,\n\tname string, args *NodeArgs, opts ...pulumi.ResourceOption) (*Node, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.AcceleratorType == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'AcceleratorType'\")\n\t}\n\tif args.TensorflowVersion == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'TensorflowVersion'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Node\n\terr := ctx.RegisterResource(\"gcp:tpu/node:Node\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func createNewNodeNetworkObject(writer *bufio.Writer, sourceOsmNode *osm.Node) {\n\ttags := sourceOsmNode.TagMap()\n\n\t// Punktnetzwerk 'Fahrrad'\n\tnewOsmNode := *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found := tags[\"icn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_bicycle\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t} else {\n\t\trefValue, found = tags[\"ncn_ref\"]\n\t\tif found {\n\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_bicycle\"}\n\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t} else {\n\t\t\trefValue, found = tags[\"rcn_ref\"]\n\t\t\tif found {\n\t\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_bicycle\"}\n\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t\t} else {\n\t\t\t\trefValue, found = tags[\"lcn_ref\"]\n\t\t\t\tif found {\n\t\t\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_bicycle\"}\n\t\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Punktnetzwerk 'Wandern'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"iwn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_hiking\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t} else {\n\t\trefValue, found = tags[\"nwn_ref\"]\n\t\tif found {\n\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_hiking\"}\n\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t} else {\n\t\t\trefValue, found = tags[\"rwn_ref\"]\n\t\t\tif found {\n\t\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_hiking\"}\n\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t\t} else {\n\t\t\t\trefValue, found = tags[\"lwn_ref\"]\n\t\t\t\tif found {\n\t\t\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_hiking\"}\n\t\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Punktnetzwerk 'Inline-Skaten'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"rin_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_inline_skates\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t}\n\n\t// Punktnetzwerk 'Reiten'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"rhn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_horse\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t}\n\n\t// Punktnetzwerk 'Kanu'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"rpn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_canoe\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t}\n\n\t// Punktnetzwerk 'Motorboot'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"rmn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_motorboat\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t}\n}", "func newReplicaSet(name, namespace string, replicas int32, podLabels map[string]string, imageName, image string) *appsv1.ReplicaSet {\n\treturn &appsv1.ReplicaSet{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"ReplicaSet\",\n\t\t\tAPIVersion: \"apps/v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: namespace,\n\t\t\tName: name,\n\t\t},\n\t\tSpec: appsv1.ReplicaSetSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: podLabels,\n\t\t\t},\n\t\t\tReplicas: &replicas,\n\t\t\tTemplate: apiv1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: podLabels,\n\t\t\t\t},\n\t\t\t\tSpec: apiv1.PodSpec{\n\t\t\t\t\tContainers: []apiv1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: imageName,\n\t\t\t\t\t\t\tImage: image,\n\t\t\t\t\t\t\tSecurityContext: &apiv1.SecurityContext{},\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}", "func resourceVolterraNetworkPolicyRule() *schema.Resource {\n\treturn &schema.Resource{\n\t\tCreate: resourceVolterraNetworkPolicyRuleCreate,\n\t\tRead: resourceVolterraNetworkPolicyRuleRead,\n\t\tUpdate: resourceVolterraNetworkPolicyRuleUpdate,\n\t\tDelete: resourceVolterraNetworkPolicyRuleDelete,\n\n\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\"annotations\": {\n\t\t\t\tType: schema.TypeMap,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"description\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"disable\": {\n\t\t\t\tType: schema.TypeBool,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"labels\": {\n\t\t\t\tType: schema.TypeMap,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"name\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t\tForceNew: true,\n\t\t\t},\n\n\t\t\t\"namespace\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t\tForceNew: true,\n\t\t\t},\n\n\t\t\t\"action\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"advanced_action\": {\n\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\"action\": {\n\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\tOptional: true,\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\t\"label_matcher\": {\n\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\"keys\": {\n\n\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\tType: schema.TypeString,\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\n\t\t\t\"ports\": {\n\n\t\t\t\tType: schema.TypeList,\n\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t\"protocol\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"ip_prefix_set\": {\n\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\"ref\": {\n\n\t\t\t\t\t\t\tType: schema.TypeList,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\"kind\": {\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tComputed: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"name\": {\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"namespace\": {\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"tenant\": {\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t\"prefix\": {\n\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\"ipv6_prefix\": {\n\n\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"prefix\": {\n\n\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\tType: schema.TypeString,\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\n\t\t\t\"prefix_selector\": {\n\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\"expressions\": {\n\n\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\tRequired: true,\n\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\tType: schema.TypeString,\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}", "func (c *VrouterNode) Create(contrailClient ApiClient) error {\n\tgscObjects := []*contrailTypes.GlobalSystemConfig{}\n\tgscObjectsList, err := contrailClient.List(\"global-system-config\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(gscObjectsList) == 0 {\n\t\tfmt.Println(\"no gscObject\")\n\t}\n\n\tfor _, gscObject := range gscObjectsList {\n\t\tobj, err := contrailClient.ReadListResult(\"global-system-config\", &gscObject)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tgscObjects = append(gscObjects, obj.(*contrailTypes.GlobalSystemConfig))\n\t}\n\tfor _, gsc := range gscObjects {\n\t\tvncNode := &contrailTypes.VirtualRouter{}\n\t\tvncNode.SetVirtualRouterIpAddress(c.IPAddress)\n\t\tvncNode.SetParent(gsc)\n\t\tvncNode.SetName(c.Hostname)\n\t\tif err := contrailClient.Create(vncNode); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\treturn nil\n}", "func resourceVolterraModifySite() *schema.Resource {\n\treturn &schema.Resource{\n\t\tCreate: resourceVolterraModifySiteCreate,\n\t\tRead: resourceVolterraModifySiteRead,\n\t\tUpdate: resourceVolterraModifySiteUpdate,\n\t\tDelete: resourceVolterraModifySiteDelete,\n\n\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\"annotations\": {\n\t\t\t\tType: schema.TypeMap,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"description\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"disable\": {\n\t\t\t\tType: schema.TypeBool,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"labels\": {\n\t\t\t\tType: schema.TypeMap,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"name\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t},\n\n\t\t\t\"namespace\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t},\n\n\t\t\t\"address\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"bgp_peer_address\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"bgp_router_id\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"coordinates\": {\n\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\tSchema: map[string]*schema.Schema{\n\t\t\t\t\t\t\"latitude\": {\n\t\t\t\t\t\t\tType: schema.TypeFloat,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"longitude\": {\n\t\t\t\t\t\t\tType: schema.TypeFloat,\n\t\t\t\t\t\t\tOptional: true,\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\t\"desired_pool_count\": {\n\t\t\t\tType: schema.TypeInt,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"inside_nameserver\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"inside_vip\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"operating_system_version\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"volterra_software_version\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"outside_nameserver\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"outside_vip\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"site_to_site_network_type\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"site_to_site_tunnel_ip\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"tunnel_dead_timeout\": {\n\t\t\t\tType: schema.TypeInt,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"tunnel_type\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"vip_vrrp_mode\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"volterra_software_overide\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"retry\": {\n\t\t\t\tType: schema.TypeInt,\n\t\t\t\tOptional: true,\n\t\t\t\tDefault: 1,\n\t\t\t},\n\t\t\t\"wait_time\": {\n\t\t\t\tType: schema.TypeInt,\n\t\t\t\tOptional: true,\n\t\t\t\tDefault: 1,\n\t\t\t},\n\t\t},\n\t}\n}", "func buildNodeTrafficMap(namespace string, n graph.Node, o graph.TelemetryOptions, client *prometheus.Client) graph.TrafficMap {\n\thttpMetric := \"istio_requests_total\"\n\tinterval := o.Namespaces[namespace].Duration\n\n\t// create map to aggregate traffic by response code\n\ttrafficMap := graph.NewTrafficMap()\n\n\t// query prometheus for request traffic in two queries:\n\t// 1) query for incoming traffic\n\tvar query string\n\tgroupBy := \"source_workload_namespace,source_workload,source_app,source_version,destination_service_namespace,destination_service_name,destination_workload_namespace,destination_workload,destination_app,destination_version,request_protocol,response_code,response_flags\"\n\tswitch n.NodeType {\n\tcase graph.NodeTypeWorkload:\n\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"destination\",destination_workload_namespace=\"%s\",destination_workload=\"%s\"} [%vs])) by (%s)`,\n\t\t\thttpMetric,\n\t\t\tnamespace,\n\t\t\tn.Workload,\n\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\tgroupBy)\n\tcase graph.NodeTypeApp:\n\t\tif graph.IsOK(n.Version) {\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"destination\",destination_service_namespace=\"%s\",destination_app=\"%s\",destination_version=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\thttpMetric,\n\t\t\t\tnamespace,\n\t\t\t\tn.App,\n\t\t\t\tn.Version,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\tgroupBy)\n\t\t} else {\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"destination\",destination_service_namespace=\"%s\",destination_app=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\thttpMetric,\n\t\t\t\tnamespace,\n\t\t\t\tn.App,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\tgroupBy)\n\t\t}\n\tcase graph.NodeTypeService:\n\t\t// for service requests we want source reporting to capture source-reported errors. But unknown only generates destination telemetry. So\n\t\t// perform a special query just to capture [successful] request telemetry from unknown.\n\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"destination\",source_workload=\"unknown\",destination_service_namespace=\"%s\",destination_service_name=\"%s\"} [%vs])) by (%s)`,\n\t\t\thttpMetric,\n\t\t\tnamespace,\n\t\t\tn.Service,\n\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\tgroupBy)\n\t\tvector := promQuery(query, time.Unix(o.QueryTime, 0), client.API())\n\t\tpopulateTrafficMap(trafficMap, &vector, o)\n\n\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",destination_service_namespace=\"%s\",destination_service_name=\"%s\"} [%vs])) by (%s)`,\n\t\t\thttpMetric,\n\t\t\tnamespace,\n\t\t\tn.Service,\n\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\tgroupBy)\n\tdefault:\n\t\tgraph.Error(fmt.Sprintf(\"NodeType [%s] not supported\", n.NodeType))\n\t}\n\tinVector := promQuery(query, time.Unix(o.QueryTime, 0), client.API())\n\tpopulateTrafficMap(trafficMap, &inVector, o)\n\n\t// 2) query for outbound traffic\n\tswitch n.NodeType {\n\tcase graph.NodeTypeWorkload:\n\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",source_workload_namespace=\"%s\",source_workload=\"%s\"} [%vs])) by (%s)`,\n\t\t\thttpMetric,\n\t\t\tnamespace,\n\t\t\tn.Workload,\n\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\tgroupBy)\n\tcase graph.NodeTypeApp:\n\t\tif graph.IsOK(n.Version) {\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",source_workload_namespace=\"%s\",source_app=\"%s\",source_version=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\thttpMetric,\n\t\t\t\tnamespace,\n\t\t\t\tn.App,\n\t\t\t\tn.Version,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\tgroupBy)\n\t\t} else {\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",source_workload_namespace=\"%s\",source_app=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\thttpMetric,\n\t\t\t\tnamespace,\n\t\t\t\tn.App,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\tgroupBy)\n\t\t}\n\tcase graph.NodeTypeService:\n\t\tquery = \"\"\n\tdefault:\n\t\tgraph.Error(fmt.Sprintf(\"NodeType [%s] not supported\", n.NodeType))\n\t}\n\toutVector := promQuery(query, time.Unix(o.QueryTime, 0), client.API())\n\tpopulateTrafficMap(trafficMap, &outVector, o)\n\n\t// istio component telemetry is only reported destination-side, so we must perform additional queries\n\n\tif appender.IncludeIstio(o) {\n\t\tistioNamespace := config.Get().IstioNamespace\n\n\t\t// 3) supplemental query for outbound traffic to the istio namespace\n\t\tswitch n.NodeType {\n\t\tcase graph.NodeTypeWorkload:\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"destination\",source_workload_namespace=\"%s\",source_workload=\"%s\",destination_service_namespace=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\thttpMetric,\n\t\t\t\tnamespace,\n\t\t\t\tn.Workload,\n\t\t\t\tistioNamespace,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\tgroupBy)\n\t\tcase graph.NodeTypeApp:\n\t\t\tif graph.IsOK(n.Version) {\n\t\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"destination\",source_workload_namespace=\"%s\",source_app=\"%s\",source_version=\"%s\",destination_service_namespace=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\t\thttpMetric,\n\t\t\t\t\tnamespace,\n\t\t\t\t\tn.App,\n\t\t\t\t\tn.Version,\n\t\t\t\t\tistioNamespace,\n\t\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\t\tgroupBy)\n\t\t\t} else {\n\t\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"destination\",source_workload_namespace=\"%s\",source_app=\"%s\",destination_service_namespace=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\t\thttpMetric,\n\t\t\t\t\tnamespace,\n\t\t\t\t\tn.App,\n\t\t\t\t\tistioNamespace,\n\t\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\t\tgroupBy)\n\t\t\t}\n\t\tcase graph.NodeTypeService:\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"destination\",destination_service_namespace=\"%s\",destination_service_name=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\thttpMetric,\n\t\t\t\tistioNamespace,\n\t\t\t\tn.Service,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\tgroupBy)\n\t\tdefault:\n\t\t\tgraph.Error(fmt.Sprintf(\"NodeType [%s] not supported\", n.NodeType))\n\t\t}\n\t\toutIstioVector := promQuery(query, time.Unix(o.QueryTime, 0), client.API())\n\t\tpopulateTrafficMap(trafficMap, &outIstioVector, o)\n\t}\n\n\t// Section for TCP services\n\ttcpMetric := \"istio_tcp_sent_bytes_total\"\n\n\ttcpGroupBy := \"source_workload_namespace,source_workload,source_app,source_version,destination_service_namespace,destination_service_name,destination_workload_namespace,destination_workload,destination_app,destination_version,response_flags\"\n\tswitch n.NodeType {\n\tcase graph.NodeTypeWorkload:\n\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",destination_workload_namespace=\"%s\",destination_workload=\"%s\"} [%vs])) by (%s)`,\n\t\t\ttcpMetric,\n\t\t\tnamespace,\n\t\t\tn.Workload,\n\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\ttcpGroupBy)\n\tcase graph.NodeTypeApp:\n\t\tif graph.IsOK(n.Version) {\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",destination_service_namespace=\"%s\",destination_app=\"%s\",destination_version=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\ttcpMetric,\n\t\t\t\tnamespace,\n\t\t\t\tn.App,\n\t\t\t\tn.Version,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\ttcpGroupBy)\n\t\t} else {\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",destination_service_namespace=\"%s\",destination_app=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\ttcpMetric,\n\t\t\t\tnamespace,\n\t\t\t\tn.App,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\ttcpGroupBy)\n\t\t}\n\tcase graph.NodeTypeService:\n\t\t// TODO: Do we need to handle requests from unknown in a special way (like in HTTP above)? Not sure how tcp is reported from unknown.\n\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",destination_service_namespace=\"%s\",destination_service_name=\"%s\"} [%vs])) by (%s)`,\n\t\t\ttcpMetric,\n\t\t\tnamespace,\n\t\t\tn.Service,\n\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\ttcpGroupBy)\n\tdefault:\n\t\tgraph.Error(fmt.Sprintf(\"NodeType [%s] not supported\", n.NodeType))\n\t}\n\ttcpInVector := promQuery(query, time.Unix(o.QueryTime, 0), client.API())\n\tpopulateTrafficMapTcp(trafficMap, &tcpInVector, o)\n\n\t// 2) query for outbound traffic\n\tswitch n.NodeType {\n\tcase graph.NodeTypeWorkload:\n\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",source_workload_namespace=\"%s\",source_workload=\"%s\"} [%vs])) by (%s)`,\n\t\t\ttcpMetric,\n\t\t\tnamespace,\n\t\t\tn.Workload,\n\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\ttcpGroupBy)\n\tcase graph.NodeTypeApp:\n\t\tif graph.IsOK(n.Version) {\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",source_workload_namespace=\"%s\",source_app=\"%s\",source_version=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\ttcpMetric,\n\t\t\t\tnamespace,\n\t\t\t\tn.App,\n\t\t\t\tn.Version,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\ttcpGroupBy)\n\t\t} else {\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",source_workload_namespace=\"%s\",source_app=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\ttcpMetric,\n\t\t\t\tnamespace,\n\t\t\t\tn.App,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\ttcpGroupBy)\n\t\t}\n\tcase graph.NodeTypeService:\n\t\tquery = \"\"\n\tdefault:\n\t\tgraph.Error(fmt.Sprintf(\"NodeType [%s] not supported\", n.NodeType))\n\t}\n\ttcpOutVector := promQuery(query, time.Unix(o.QueryTime, 0), client.API())\n\tpopulateTrafficMapTcp(trafficMap, &tcpOutVector, o)\n\n\treturn trafficMap\n}", "func testTrafficMapIssue2982() map[string]*graph.Node {\n\ttrafficMap := make(map[string]*graph.Node)\n\n\tn0, _ := graph.NewNode(config.DefaultClusterID, \"testNamespace\", \"testPodsWithTraffic\", \"testNamespace\", \"testPodsWithTraffic-v1\", \"testPodsWithTraffic\", \"v1\", graph.GraphTypeVersionedApp)\n\tn0.Metadata[\"httpIn\"] = 0.8\n\n\tn1, _ := graph.NewNode(config.DefaultClusterID, \"testNamespace\", \"b\", graph.Unknown, graph.Unknown, graph.Unknown, graph.Unknown, graph.GraphTypeVersionedApp)\n\n\tn2, _ := graph.NewNode(config.DefaultClusterID, \"testNamespace\", \"b\", \"testNamespace\", \"b-v1\", \"b\", \"v1\", graph.GraphTypeVersionedApp)\n\n\ttrafficMap[n0.ID] = n0\n\ttrafficMap[n1.ID] = n1\n\ttrafficMap[n2.ID] = n2\n\n\tn0.AddEdge(n1)\n\tn1.AddEdge(n2)\n\n\treturn trafficMap\n}", "func newFindNodeProtocol(service service.Service, rt RoutingTable) *findNodeProtocol {\n\n\tp := &findNodeProtocol{\n\t\trt: rt,\n\t\tpending: make(map[crypto.UUID]chan findNodeResults),\n\t\tingressChannel: service.RegisterDirectProtocol(protocol),\n\t\tservice: service,\n\t}\n\n\tif srv, ok := service.(localService); ok {\n\t\tp.log = srv.LocalNode().Log\n\t} else {\n\t\tp.log = log.AppLog\n\t}\n\n\tgo p.readLoop()\n\n\treturn p\n}", "func (t TopologyResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"associations\", t.Associations)\n\tpopulate(objectMap, \"id\", t.ID)\n\tpopulate(objectMap, \"location\", t.Location)\n\tpopulate(objectMap, \"name\", t.Name)\n\treturn json.Marshal(objectMap)\n}", "func newResource(r interface{}) corev2.Resource {\n\treturn reflect.New(reflect.ValueOf(r).Elem().Type()).Interface().(corev2.Resource)\n}", "func createNode(id int, myConf *Config, sm *State_Machine) cluster.Server {\n\tinitNode(id, myConf, sm)\n\t//Set up details about cluster nodes form json file.\n\tserver, err := cluster.New(id, \"config/cluster_config.json\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn server\n}", "func (cc *ContrailCommand) CreateNode(host vcenter.ESXIHost) error {\n\tlog.Debug(\"Create Node:\", cc.AuthToken)\n\tnodeResource := contrailCommandNodeSync{\n\t\tResources: []*nodeResources{\n\t\t\t{\n\t\t\t\tKind: \"node\",\n\t\t\t\tData: &nodeData{\n\t\t\t\t\tNodeType: \"esxi\",\n\t\t\t\t\tUUID: host.UUID,\n\t\t\t\t\tHostname: host.Hostname,\n\t\t\t\t\tFqName: []string{\"default-global-system-config\", host.Hostname},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tjsonData, err := json.Marshal(nodeResource)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Debug(\"Sending Request\")\n\tresp, _, err := cc.sendRequest(\"/sync\", string(jsonData), \"POST\") //nolint: bodyclose\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Debug(\"Got status : \", resp.StatusCode)\n\tswitch resp.StatusCode {\n\tdefault:\n\t\treturn fmt.Errorf(\"resource creation failed, %d\", resp.StatusCode)\n\tcase 200, 201:\n\t}\n\treturn nil\n}", "func newNodes(c *Client) *nodes {\n\treturn &nodes{c}\n}", "func (o Iperf3SpecClientConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v Iperf3SpecClientConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func New(cells ...string) *MemoryTopo {\n\tmt := &MemoryTopo{\n\t\tcells: make(map[string]*node),\n\t}\n\tmt.cells[topo.GlobalCell] = mt.newDirectory(topo.GlobalCell, nil)\n\n\tctx := context.Background()\n\tts := topo.Server{Impl: mt}\n\tfor _, cell := range cells {\n\t\tif err := ts.CreateCellInfo(ctx, cell, &topodatapb.CellInfo{\n\t\t\tRoot: \"/\",\n\t\t}); err != nil {\n\t\t\tlog.Fatalf(\"ts.CreateCellInfo(%v) failed: %v\", cell, err)\n\t\t}\n\t\tmt.cells[cell] = mt.newDirectory(cell, nil)\n\t}\n\treturn mt\n}", "func CreateOrUpdate(ctx context.Context, client client.Interface, node *libapi.Node) (*libapi.Node, error) {\n\tif node.ResourceVersion != \"\" {\n\t\treturn client.Nodes().Update(ctx, node, options.SetOptions{})\n\t}\n\n\treturn client.Nodes().Create(ctx, node, options.SetOptions{})\n}", "func resourceVolterraNetworkPolicyRuleCreate(d *schema.ResourceData, meta interface{}) error {\n\tclient := meta.(*APIClient)\n\n\tcreateMeta := &ves_io_schema.ObjectCreateMetaType{}\n\tcreateSpec := &ves_io_schema_network_policy_rule.CreateSpecType{}\n\tcreateReq := &ves_io_schema_network_policy_rule.CreateRequest{\n\t\tMetadata: createMeta,\n\t\tSpec: createSpec,\n\t}\n\n\tif v, ok := d.GetOk(\"annotations\"); ok && !isIntfNil(v) {\n\n\t\tms := map[string]string{}\n\n\t\tfor k, v := range v.(map[string]interface{}) {\n\t\t\tval := v.(string)\n\t\t\tms[k] = val\n\t\t}\n\t\tcreateMeta.Annotations = ms\n\t}\n\n\tif v, ok := d.GetOk(\"description\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Description =\n\t\t\tv.(string)\n\t}\n\n\tif v, ok := d.GetOk(\"disable\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Disable =\n\t\t\tv.(bool)\n\t}\n\n\tif v, ok := d.GetOk(\"labels\"); ok && !isIntfNil(v) {\n\n\t\tms := map[string]string{}\n\n\t\tfor k, v := range v.(map[string]interface{}) {\n\t\t\tval := v.(string)\n\t\t\tms[k] = val\n\t\t}\n\t\tcreateMeta.Labels = ms\n\t}\n\n\tif v, ok := d.GetOk(\"name\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Name =\n\t\t\tv.(string)\n\t}\n\n\tif v, ok := d.GetOk(\"namespace\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Namespace =\n\t\t\tv.(string)\n\t}\n\n\t//action\n\tif v, ok := d.GetOk(\"action\"); ok && !isIntfNil(v) {\n\n\t\tcreateSpec.Action = ves_io_schema_network_policy_rule.NetworkPolicyRuleAction(ves_io_schema_network_policy_rule.NetworkPolicyRuleAction_value[v.(string)])\n\n\t}\n\n\t//advanced_action\n\tif v, ok := d.GetOk(\"advanced_action\"); ok && !isIntfNil(v) {\n\n\t\tsl := v.(*schema.Set).List()\n\t\tadvancedAction := &ves_io_schema_network_policy_rule.NetworkPolicyRuleAdvancedAction{}\n\t\tcreateSpec.AdvancedAction = advancedAction\n\t\tfor _, set := range sl {\n\t\t\tadvancedActionMapStrToI := set.(map[string]interface{})\n\n\t\t\tif v, ok := advancedActionMapStrToI[\"action\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tadvancedAction.Action = ves_io_schema_network_policy_rule.LogAction(ves_io_schema_network_policy_rule.LogAction_value[v.(string)])\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t//label_matcher\n\tif v, ok := d.GetOk(\"label_matcher\"); ok && !isIntfNil(v) {\n\n\t\tsl := v.(*schema.Set).List()\n\t\tlabelMatcher := &ves_io_schema.LabelMatcherType{}\n\t\tcreateSpec.LabelMatcher = labelMatcher\n\t\tfor _, set := range sl {\n\t\t\tlabelMatcherMapStrToI := set.(map[string]interface{})\n\n\t\t\tif w, ok := labelMatcherMapStrToI[\"keys\"]; ok && !isIntfNil(w) {\n\t\t\t\tls := make([]string, len(w.([]interface{})))\n\t\t\t\tfor i, v := range w.([]interface{}) {\n\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t}\n\t\t\t\tlabelMatcher.Keys = ls\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t//ports\n\tif v, ok := d.GetOk(\"ports\"); ok && !isIntfNil(v) {\n\n\t\tls := make([]string, len(v.([]interface{})))\n\t\tfor i, v := range v.([]interface{}) {\n\t\t\tls[i] = v.(string)\n\t\t}\n\t\tcreateSpec.Ports = ls\n\n\t}\n\n\t//protocol\n\tif v, ok := d.GetOk(\"protocol\"); ok && !isIntfNil(v) {\n\n\t\tcreateSpec.Protocol =\n\t\t\tv.(string)\n\n\t}\n\n\t//remote_endpoint\n\n\tremoteEndpointTypeFound := false\n\n\tif v, ok := d.GetOk(\"ip_prefix_set\"); ok && !remoteEndpointTypeFound {\n\n\t\tremoteEndpointTypeFound = true\n\t\tremoteEndpointInt := &ves_io_schema_network_policy_rule.CreateSpecType_IpPrefixSet{}\n\t\tremoteEndpointInt.IpPrefixSet = &ves_io_schema.IpPrefixSetRefType{}\n\t\tcreateSpec.RemoteEndpoint = remoteEndpointInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tif v, ok := cs[\"ref\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.([]interface{})\n\t\t\t\trefInt := make([]*ves_io_schema.ObjectRefType, len(sl))\n\t\t\t\tremoteEndpointInt.IpPrefixSet.Ref = refInt\n\t\t\t\tfor i, ps := range sl {\n\n\t\t\t\t\trMapToStrVal := ps.(map[string]interface{})\n\t\t\t\t\trefInt[i] = &ves_io_schema.ObjectRefType{}\n\n\t\t\t\t\trefInt[i].Kind = \"ip_prefix_set\"\n\n\t\t\t\t\tif v, ok := rMapToStrVal[\"name\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\trefInt[i].Name = v.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rMapToStrVal[\"namespace\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\trefInt[i].Namespace = v.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rMapToStrVal[\"tenant\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\trefInt[i].Tenant = v.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rMapToStrVal[\"uid\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\trefInt[i].Uid = v.(string)\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"prefix\"); ok && !remoteEndpointTypeFound {\n\n\t\tremoteEndpointTypeFound = true\n\t\tremoteEndpointInt := &ves_io_schema_network_policy_rule.CreateSpecType_Prefix{}\n\t\tremoteEndpointInt.Prefix = &ves_io_schema.PrefixListType{}\n\t\tcreateSpec.RemoteEndpoint = remoteEndpointInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tif v, ok := cs[\"ipv6_prefix\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t}\n\t\t\t\tremoteEndpointInt.Prefix.Ipv6Prefix = ls\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"prefix\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t}\n\t\t\t\tremoteEndpointInt.Prefix.Prefix = ls\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"prefix_selector\"); ok && !remoteEndpointTypeFound {\n\n\t\tremoteEndpointTypeFound = true\n\t\tremoteEndpointInt := &ves_io_schema_network_policy_rule.CreateSpecType_PrefixSelector{}\n\t\tremoteEndpointInt.PrefixSelector = &ves_io_schema.LabelSelectorType{}\n\t\tcreateSpec.RemoteEndpoint = remoteEndpointInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tif v, ok := cs[\"expressions\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t}\n\t\t\t\tremoteEndpointInt.PrefixSelector.Expressions = ls\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tlog.Printf(\"[DEBUG] Creating Volterra NetworkPolicyRule object with struct: %+v\", createReq)\n\n\tcreateNetworkPolicyRuleResp, err := client.CreateObject(context.Background(), ves_io_schema_network_policy_rule.ObjectType, createReq)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating NetworkPolicyRule: %s\", err)\n\t}\n\td.SetId(createNetworkPolicyRuleResp.GetObjSystemMetadata().GetUid())\n\n\treturn resourceVolterraNetworkPolicyRuleRead(d, meta)\n}", "func resourceComputeRouterNatPatchCreateEncoder(d *schema.ResourceData, meta interface{}, obj map[string]interface{}) (map[string]interface{}, error) {\n\tcurrItems, err := resourceComputeRouterNatListForPatch(d, meta)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, found, err := resourceComputeRouterNatFindNestedObjectInList(d, meta, currItems)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Return error if item already created.\n\tif found != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to create RouterNat, existing object already found: %+v\", found)\n\t}\n\n\t// Return list with the resource to create appended\n\tres := map[string]interface{}{\n\t\t\"nats\": append(currItems, obj),\n\t}\n\n\treturn res, nil\n}", "func CreateDescribeNodeToolExecutionHistoriesResponse() (response *DescribeNodeToolExecutionHistoriesResponse) {\n\tresponse = &DescribeNodeToolExecutionHistoriesResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (n *NodeController) New() (r types.Resource) {\n\treturn new(types.Node)\n}", "func makeNodesReconciler(cniConfigWriter *CNIConfigWriter, hostIP string) func(*corev1.NodeList) error {\n\t// reconciles a node\n\treconcileNode := func(node corev1.Node) error {\n\t\t// first get this node's IP\n\t\tnodeIP := internalIP(node)\n\t\tfmt.Printf(\"Handling node with IP: %s\\n\", nodeIP)\n\n\t\t// This is our node. We don't need to add routes, but we might need to\n\t\t// update the cni config.\n\t\tif nodeIP == hostIP {\n\t\t\tfmt.Printf(\"handling current node\\n\")\n\t\t\t// compute the current cni config inputs\n\t\t\tif err := cniConfigWriter.Write(\n\t\t\t\tComputeCNIConfigInputs(node),\n\t\t\t); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// we're done handling this node\n\t\t\treturn nil\n\t\t}\n\n\t\t// don't do anything unless there is a PodCIDR\n\t\tpodCIDR := node.Spec.PodCIDR\n\t\tif podCIDR == \"\" {\n\t\t\tfmt.Printf(\"Node %v has no CIDR, ignoring\\n\", node.Name)\n\t\t\treturn nil\n\t\t}\n\n\t\t// parse subnet\n\t\tdst, err := netlink.ParseIPNet(podCIDR)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Printf(\"Node %v has CIDR %s \\n\", node.Name, podCIDR)\n\n\t\t// Check if the route exists to the other node's PodCIDR\n\t\tip := net.ParseIP(nodeIP)\n\t\trouteToDst := netlink.Route{Dst: dst, Gw: ip}\n\t\troute, err := netlink.RouteListFiltered(nl.GetIPFamily(ip), &routeToDst, netlink.RT_FILTER_DST)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Add route if not present\n\t\tif len(route) == 0 {\n\t\t\tif err := netlink.RouteAdd(&routeToDst); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfmt.Printf(\"Adding route %v \\n\", routeToDst)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\t// return a reconciler for all the nodes\n\treturn func(nodes *corev1.NodeList) error {\n\t\tfor _, node := range nodes.Items {\n\t\t\tif err := reconcileNode(node); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n}", "func New(opts ...Option) (*Topology, error) {\n\tcfg, err := newConfig(opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tt := &Topology{\n\t\tcfg: cfg,\n\t\tfsm: newFSM(),\n\t\tchanges: make(chan description.Server),\n\t\tsubscribers: make(map[uint64]chan description.Topology),\n\t\tservers: make(map[addr.Addr]*Server),\n\t}\n\n\tif cfg.replicaSetName != \"\" {\n\t\tt.fsm.SetName = cfg.replicaSetName\n\t\tt.fsm.Kind = description.ReplicaSetNoPrimary\n\t}\n\n\tif cfg.mode == SingleMode {\n\t\tt.fsm.Kind = description.Single\n\t}\n\n\treturn t, nil\n}", "func (c *Controller) NewTrafficRoutingReconciler(roCtx *rolloutContext) (trafficrouting.TrafficRoutingReconciler, error) {\n\trollout := roCtx.rollout\n\tif rollout.Spec.Strategy.Canary.TrafficRouting == nil {\n\t\treturn nil, nil\n\t}\n\tif rollout.Spec.Strategy.Canary.TrafficRouting.Istio != nil {\n\t\tif c.IstioController.VirtualServiceInformer.HasSynced() {\n\t\t\treturn istio.NewReconciler(rollout, c.IstioController.DynamicClientSet, c.recorder, c.IstioController.VirtualServiceLister, c.IstioController.DestinationRuleLister), nil\n\t\t} else {\n\t\t\treturn istio.NewReconciler(rollout, c.IstioController.DynamicClientSet, c.recorder, nil, nil), nil\n\t\t}\n\t}\n\tif rollout.Spec.Strategy.Canary.TrafficRouting.Nginx != nil {\n\t\treturn nginx.NewReconciler(nginx.ReconcilerConfig{\n\t\t\tRollout: rollout,\n\t\t\tClient: c.kubeclientset,\n\t\t\tRecorder: c.recorder,\n\t\t\tControllerKind: controllerKind,\n\t\t\tIngressLister: c.ingressesLister,\n\t\t}), nil\n\t}\n\tif rollout.Spec.Strategy.Canary.TrafficRouting.ALB != nil {\n\t\treturn alb.NewReconciler(alb.ReconcilerConfig{\n\t\t\tRollout: rollout,\n\t\t\tClient: c.kubeclientset,\n\t\t\tRecorder: c.recorder,\n\t\t\tControllerKind: controllerKind,\n\t\t\tIngressLister: c.ingressesLister,\n\t\t})\n\t}\n\tif rollout.Spec.Strategy.Canary.TrafficRouting.SMI != nil {\n\t\treturn smi.NewReconciler(smi.ReconcilerConfig{\n\t\t\tRollout: rollout,\n\t\t\tClient: c.smiclientset,\n\t\t\tRecorder: c.recorder,\n\t\t\tControllerKind: controllerKind,\n\t\t})\n\t}\n\tif rollout.Spec.Strategy.Canary.TrafficRouting.Ambassador != nil {\n\t\tac := ambassador.NewDynamicClient(c.dynamicclientset, rollout.GetNamespace())\n\t\treturn ambassador.NewReconciler(rollout, ac, c.recorder), nil\n\t}\n\treturn nil, nil\n}", "func createNodeRoute(w http.ResponseWriter, r *http.Request) {\n\troute := \"CreateNode\"\n\n\tquery := r.URL.Query()\n\tnodeID, initAmount := query.Get(\"nodeID\"), query.Get(\"initAmount\")\n\n\thandleRoute(route, nodeID, initAmount)\n}", "func New(client api.Client, callbacks api.SyncerCallbacks, node string, watchAllNodes bool) api.Syncer {\r\n\t// Create the set of ResourceTypes required for Felix. Since the update processors\r\n\t// also cache state, we need to create individual ones per syncer rather than create\r\n\t// a common global set.\r\n\t// For BGP we always only care about affinity blocks assigned to our own particuar node.\r\n\t// However, depending on whether we are in full-mesh mode or not changes whether we want\r\n\t// to watch all Node resources or just our own.\r\n\tnodeToWatch := node\r\n\tif watchAllNodes {\r\n\t\tnodeToWatch = \"\"\r\n\t}\r\n\tresourceTypes := []watchersyncer.ResourceType{\r\n\t\t{\r\n\t\t\tListInterface: model.ResourceListOptions{Kind: apiv3.KindIPPool},\r\n\t\t\tUpdateProcessor: updateprocessors.NewIPPoolUpdateProcessor(),\r\n\t\t},\r\n\t\t{\r\n\t\t\tListInterface: model.ResourceListOptions{Kind: apiv3.KindBGPConfiguration},\r\n\t\t\tUpdateProcessor: updateprocessors.NewBGPConfigUpdateProcessor(),\r\n\t\t},\r\n\t\t{\r\n\t\t\tListInterface: model.ResourceListOptions{\r\n\t\t\t\tKind: apiv3.KindNode,\r\n\t\t\t\tName: nodeToWatch,\r\n\t\t\t},\r\n\t\t\tUpdateProcessor: updateprocessors.NewBGPNodeUpdateProcessor(),\r\n\t\t},\r\n\t\t{\r\n\t\t\tListInterface: model.ResourceListOptions{Kind: apiv3.KindBGPPeer},\r\n\t\t\tUpdateProcessor: updateprocessors.NewBGPPeerUpdateProcessor(),\r\n\t\t},\r\n\t}\r\n\t// When this syncer is used (via confd) in calico/node, it needs to know the affinity blocks\r\n\t// for that node so that it can set up the blackhole routes; in that case,\r\n\t// node is non-empty. When this syncer is used (also via confd) in\r\n\t// calico/routereflector, it has no need for affinity block information, so we skip that\r\n\t// here; in that case, node is empty.\r\n\tif node != \"\" {\r\n\t\tresourceTypes = append(resourceTypes, watchersyncer.ResourceType{\r\n\t\t\tListInterface: model.BlockAffinityListOptions{Host: node},\r\n\t\t})\r\n\t}\r\n\r\n\treturn watchersyncer.New(\r\n\t\tclient,\r\n\t\tresourceTypes,\r\n\t\tcallbacks,\r\n\t)\r\n}", "func createTopo() *topo.Server {\n\tts := memorytopo.NewServer(testCell)\n\tctx := context.Background()\n\tif err := ts.CreateKeyspace(ctx, testKeyspace, &topodatapb.Keyspace{}); err != nil {\n\t\tpanic(err)\n\t}\n\tif err := ts.CreateShard(ctx, testKeyspace, testShard); err != nil {\n\t\tpanic(err)\n\t}\n\treturn ts\n}", "func NewNodePool(nodes []Node, alloced []string) *nodePool {\n\tnodeMap := make(map[string]Node, len(nodes))\n\tfor _, node := range nodes {\n\t\tnodeMap[node.Addr()] = node\n\t}\n\tp := &nodePool{\n\t\tnodes: nodeMap,\n\t\tallocated: make(map[string]struct{}),\n\t}\n\tfor _, alloc := range alloced {\n\t\tp.allocated[alloc] = struct{}{}\n\t}\n\treturn p\n}", "func (o FioSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FioSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (o IopingSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v IopingSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (o QperfSpecClientConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v QperfSpecClientConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (g *ServiceLevelObjectiveGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewServiceLevelObjectivesApi(datadogClient)\n\n\tvar slos []datadogV1.ServiceLevelObjective\n\tresp, _, err := api.ListSLOs(auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tslos = append(slos, resp.GetData()...)\n\tg.Resources = g.createResources(slos)\n\treturn nil\n}" ]
[ "0.7307852", "0.5481046", "0.51689094", "0.51133436", "0.5092512", "0.5070375", "0.50654244", "0.50550437", "0.49681288", "0.4944798", "0.49046588", "0.48953402", "0.48414528", "0.48259762", "0.48138842", "0.4809819", "0.47841248", "0.47633776", "0.47466254", "0.47246203", "0.47053877", "0.4692237", "0.46719792", "0.46555617", "0.46460685", "0.46280834", "0.46251658", "0.46082118", "0.45979464", "0.45745367", "0.45743358", "0.45705885", "0.4567995", "0.45604703", "0.45443705", "0.45040536", "0.4503565", "0.44901952", "0.4476097", "0.44760644", "0.4475593", "0.4471096", "0.4468884", "0.4445672", "0.44290075", "0.44122237", "0.44071257", "0.43909314", "0.4378531", "0.4376446", "0.43747187", "0.43722045", "0.43589255", "0.43540743", "0.4347205", "0.43310854", "0.43234923", "0.43201268", "0.43172526", "0.43091342", "0.43062347", "0.4302825", "0.4302532", "0.4295766", "0.42812923", "0.42759305", "0.427049", "0.42586026", "0.4258441", "0.42563337", "0.4239556", "0.42365643", "0.4235389", "0.4234087", "0.42333797", "0.4232348", "0.42245764", "0.42237133", "0.42220673", "0.42141747", "0.4185856", "0.41804326", "0.41803828", "0.4177519", "0.417597", "0.41631785", "0.41625118", "0.4161989", "0.41594157", "0.41560537", "0.41542998", "0.41479447", "0.41448352", "0.4144777", "0.41444087", "0.41433752", "0.4135018", "0.41292253", "0.41215858", "0.41206205" ]
0.7762249
0
CreateNodeResourceTopologies creates the NodeResourceTopology in the cluster if the CRD doesn't exists already. Returns the CRD golang object present in the cluster.
func CreateNodeResourceTopologies(ctx context.Context, extClient extclient.Interface) (*apiextensionsv1.CustomResourceDefinition, error) { crd, err := NewNodeResourceTopologies() if err != nil { return nil, err } // Delete existing CRD (if any) with this we also get rid of stale objects err = extClient.ApiextensionsV1().CustomResourceDefinitions().Delete(ctx, crd.Name, metav1.DeleteOptions{}) if err != nil && !errors.IsNotFound(err) { return nil, fmt.Errorf("failed to delete NodeResourceTopology CRD: %w", err) } // It takes time for the delete operation, wait until the CRD completely gone if err = wait.PollUntilContextTimeout(ctx, 5*time.Second, 1*time.Minute, true, func(ctx context.Context) (bool, error) { _, err = extClient.ApiextensionsV1().CustomResourceDefinitions().Get(ctx, crd.Name, metav1.GetOptions{}) if err == nil { return false, nil } if errors.IsNotFound(err) { return true, nil } return false, err }); err != nil { return nil, fmt.Errorf("failed to get NodeResourceTopology CRD: %w", err) } return extClient.ApiextensionsV1().CustomResourceDefinitions().Create(ctx, crd, metav1.CreateOptions{}) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewNodeResourceTopologies() (*apiextensionsv1.CustomResourceDefinition, error) {\n\t_, file, _, ok := runtime.Caller(0)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"cannot retrieve manifests directory\")\n\t}\n\n\tbaseDir := filepath.Dir(file)\n\tcrdPath := filepath.Clean(filepath.Join(baseDir, \"..\", \"..\", \"..\", \"deployment\", \"base\", \"noderesourcetopologies-crd\", \"noderesourcetopologies.yaml\"))\n\n\tdata, err := os.ReadFile(crdPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdecode := scheme.Codecs.UniversalDeserializer().Decode\n\tobj, _, err := decode(data, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcrd, ok := obj.(*apiextensionsv1.CustomResourceDefinition)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unexpected type, got %t\", obj)\n\t}\n\treturn crd, nil\n}", "func GetNodeTopology(ctx context.Context, topologyClient *topologyclientset.Clientset, nodeName string) *v1alpha2.NodeResourceTopology {\n\tvar nodeTopology *v1alpha2.NodeResourceTopology\n\tvar err error\n\tgomega.EventuallyWithOffset(1, func() bool {\n\t\tnodeTopology, err = topologyClient.TopologyV1alpha2().NodeResourceTopologies().Get(ctx, nodeName, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\tframework.Logf(\"failed to get the node topology resource: %v\", err)\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}, time.Minute, 5*time.Second).Should(gomega.BeTrue())\n\treturn nodeTopology\n}", "func NewResourceNode(networkID string, pubKey crypto.PubKey, ownerAddr sdk.AccAddress,\n\tdescription Description, nodeType string, creationTime time.Time) ResourceNode {\n\treturn ResourceNode{\n\t\tNetworkID: networkID,\n\t\tPubKey: pubKey,\n\t\tSuspend: false,\n\t\tStatus: sdk.Unbonded,\n\t\tTokens: sdk.ZeroInt(),\n\t\tOwnerAddress: ownerAddr,\n\t\tDescription: description,\n\t\tNodeType: nodeType,\n\t\tCreationTime: creationTime,\n\t}\n}", "func (zic *ZoneInterconnectHandler) createRemoteZoneNodeResources(node *corev1.Node, nodeID int, chassisId string) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port Ips : %w\", err)\n\t}\n\n\tnetworkId, err := util.ParseNetworkIDAnnotation(node, zic.GetNetworkName())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get the network id for the network %s on node %s: %v\", zic.GetNetworkName(), node.Name, err)\n\t}\n\n\ttransitSwitchTunnelKey := BaseTransitSwitchTunnelKey + networkId\n\tts := &nbdb.LogicalSwitch{\n\t\tName: zic.networkTransitSwitchName,\n\t\tOtherConfig: map[string]string{\n\t\t\t\"interconn-ts\": zic.networkTransitSwitchName,\n\t\t\t\"requested-tnl-key\": strconv.Itoa(transitSwitchTunnelKey),\n\t\t\t\"mcast_snoop\": \"true\",\n\t\t\t\"mcast_flood_unregistered\": \"true\",\n\t\t},\n\t}\n\n\t// Create transit switch if it doesn't exist\n\tif err := libovsdbops.CreateOrUpdateLogicalSwitch(zic.nbClient, ts); err != nil {\n\t\treturn fmt.Errorf(\"failed to create/update transit switch %s: %w\", zic.networkTransitSwitchName, err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\tremotePortAddr := transitRouterPortMac.String()\n\tfor _, tsNetwork := range transitRouterPortNetworks {\n\t\tremotePortAddr = remotePortAddr + \" \" + tsNetwork\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\n\tremotePortName := zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix + node.Name)\n\tif err := zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, remotePortName, lportTypeRemote, []string{remotePortAddr}, lspOptions, externalIDs); err != nil {\n\t\treturn err\n\t}\n\t// Set the port binding chassis.\n\tif err := zic.setRemotePortBindingChassis(node.Name, remotePortName, chassisId); err != nil {\n\t\treturn err\n\t}\n\n\tif err := zic.addRemoteNodeStaticRoutes(node, nodeTransitSwitchPortIPs); err != nil {\n\t\treturn err\n\t}\n\n\t// Cleanup the logical router port connecting to the transit switch for the remote node (if present)\n\t// Cleanup would be required when a local zone node moves to a remote zone.\n\treturn zic.cleanupNodeClusterRouterPort(node.Name)\n}", "func (zic *ZoneInterconnectHandler) createRemoteZoneNodeResources(node *corev1.Node, nodeID int, chassisId string) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port Ips : %w\", err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\tremotePortAddr := transitRouterPortMac.String()\n\tfor _, tsNetwork := range transitRouterPortNetworks {\n\t\tremotePortAddr = remotePortAddr + \" \" + tsNetwork\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\n\tremotePortName := zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix + node.Name)\n\tif err := zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, remotePortName, lportTypeRemote, []string{remotePortAddr}, lspOptions, externalIDs); err != nil {\n\t\treturn err\n\t}\n\t// Set the port binding chassis.\n\tif err := zic.setRemotePortBindingChassis(node.Name, remotePortName, chassisId); err != nil {\n\t\treturn err\n\t}\n\n\tif err := zic.addRemoteNodeStaticRoutes(node, nodeTransitSwitchPortIPs); err != nil {\n\t\treturn err\n\t}\n\n\t// Cleanup the logical router port connecting to the transit switch for the remote node (if present)\n\t// Cleanup would be required when a local zone node moves to a remote zone.\n\treturn zic.cleanupNodeClusterRouterPort(node.Name)\n}", "func (nc *NodeController) Create(r types.Resource) (err error) {\n\tn, err := assertNode(r)\n\tif err != nil {\n\t\treturn\n\t}\n\targs := make(map[string]interface{})\n\tq := \"WITH \" + nc.newNode(n, args) + \",\" + nc.newLinks(n, args) + \",\" + nc.newNodeMetric(n, args) + \" \" + selectNode(\"new_node\", nc.db.table(\"nodes\"), \"new_links\", \"new_node_metric\", \"\")\n\tstmt, err := nc.db.PrepareNamed(q)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = stmt.Get(n, args)\n\treturn\n}", "func (router *Router) createResource(w http.ResponseWriter, r *http.Request) {\n\tclusterName := r.URL.Query().Get(\"cluster\")\n\tnamespace := r.URL.Query().Get(\"namespace\")\n\tname := r.URL.Query().Get(\"name\")\n\tresource := r.URL.Query().Get(\"resource\")\n\tsubResource := r.URL.Query().Get(\"subResource\")\n\tpath := r.URL.Query().Get(\"path\")\n\n\tlog.WithFields(logrus.Fields{\"cluster\": clusterName, \"namespace\": namespace, \"name\": name, \"path\": path, \"resource\": resource, \"subResource\": subResource}).Tracef(\"createResource\")\n\n\tcluster := router.clusters.GetCluster(clusterName)\n\tif cluster == nil {\n\t\terrresponse.Render(w, r, nil, http.StatusBadRequest, \"Invalid cluster name\")\n\t\treturn\n\t}\n\n\tif router.isForbidden(resource) {\n\t\terrresponse.Render(w, r, nil, http.StatusForbidden, fmt.Sprintf(\"Access for resource %s is forbidding\", resource))\n\t\treturn\n\t}\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\terrresponse.Render(w, r, err, http.StatusBadRequest, \"Could not decode request body\")\n\t\treturn\n\t}\n\n\terr = cluster.CreateResource(r.Context(), namespace, name, path, resource, subResource, body)\n\tif err != nil {\n\t\terrresponse.Render(w, r, err, http.StatusBadRequest, \"Could not create resource\")\n\t\treturn\n\t}\n\n\trender.JSON(w, r, nil)\n}", "func (r *Reconciler) createResource(ctx context.Context, resourceName string, serverClient k8sclient.Client) (runtime.Object, error) {\n\tif r.extraParams == nil {\n\t\tr.extraParams = map[string]string{}\n\t}\n\tr.extraParams[\"MonitoringKey\"] = r.Config.GetLabelSelector()\n\tr.extraParams[\"Namespace\"] = r.Config.GetOperatorNamespace()\n\n\ttemplateHelper := NewTemplateHelper(r.extraParams)\n\tresource, err := templateHelper.CreateResource(resourceName)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"createResource failed: %w\", err)\n\t}\n\n\tmetaObj, err := meta.Accessor(resource)\n\tif err == nil {\n\t\towner.AddIntegreatlyOwnerAnnotations(metaObj, r.installation)\n\t}\n\n\terr = serverClient.Create(ctx, resource)\n\tif err != nil {\n\t\tif !k8serr.IsAlreadyExists(err) {\n\t\t\treturn nil, fmt.Errorf(\"error creating resource: %w\", err)\n\t\t}\n\t}\n\n\treturn resource, nil\n}", "func (zic *ZoneInterconnectHandler) createLocalZoneNodeResources(node *corev1.Node, nodeID int) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port ips for node %s: %w\", node.Name, err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\t// Connect transit switch to the cluster router by creating a pair of logical switch port - logical router port\n\tlogicalRouterPortName := zic.GetNetworkScopedName(types.RouterToTransitSwitchPrefix + node.Name)\n\tlogicalRouterPort := nbdb.LogicalRouterPort{\n\t\tName: logicalRouterPortName,\n\t\tMAC: transitRouterPortMac.String(),\n\t\tNetworks: transitRouterPortNetworks,\n\t\tOptions: map[string]string{\n\t\t\t\"mcast_flood\": \"true\",\n\t\t},\n\t}\n\tlogicalRouter := nbdb.LogicalRouter{\n\t\tName: zic.networkClusterRouterName,\n\t}\n\n\tif err := libovsdbops.CreateOrUpdateLogicalRouterPort(zic.nbClient, &logicalRouter, &logicalRouterPort, nil); err != nil {\n\t\treturn fmt.Errorf(\"failed to create/update cluster router %s to add transit switch port %s for the node %s: %w\", zic.networkClusterRouterName, logicalRouterPortName, node.Name, err)\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"router-port\": logicalRouterPortName,\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\terr = zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix+node.Name),\n\t\tlportTypeRouter, []string{lportTypeRouterAddr}, lspOptions, externalIDs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Its possible that node is moved from a remote zone to the local zone. Check and delete the remote zone routes\n\t// for this node as it's no longer needed.\n\treturn zic.deleteLocalNodeStaticRoutes(node, nodeID, nodeTransitSwitchPortIPs)\n}", "func NewTerraNodeResource(node db.Node) TerraNodeResource {\n\treturn TerraNodeResource{\n\t\tJAID: NewJAIDInt32(node.ID),\n\t\tName: node.Name,\n\t\tTerraChainID: node.TerraChainID,\n\t\tTendermintURL: node.TendermintURL,\n\t\tCreatedAt: node.CreatedAt,\n\t\tUpdatedAt: node.UpdatedAt,\n\t}\n}", "func (ktdm *MasterlessTurndownStrategy) CreateOrGetHostNode() (*v1.Node, error) {\n\t// Determine if there is autoscaling node pools\n\tnodePools, err := ktdm.provider.GetNodePools()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar autoScalingNodePool cp.NodePool = nil\n\tfor _, np := range nodePools {\n\t\tif np.AutoScaling() {\n\t\t\tautoScalingNodePool = np\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// The Target Node for deployment selection\n\tvar tnode *v1.Node\n\n\t// When AutoScaling is Not Enabled, Create a Turndown Node\n\tif autoScalingNodePool == nil {\n\t\tktdm.log.Log(\"Finite node backed cluster. Creating singleton nodepool for turndown.\")\n\n\t\t// There isn't a node pool for the turndown pod, so create one\n\t\tif !ktdm.provider.IsTurndownNodePool() {\n\t\t\t// Create a new singleton node pool with a small instance capable of hosting the turndown\n\t\t\t// pod -- this implementation will create and wait for the node to exist before returning\n\t\t\terr := ktdm.provider.CreateSingletonNodePool(ktdm.nodePoolLabels)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\t// Lookup the turndown node in the kubernetes API\n\t\tnodeList, err := ktdm.client.CoreV1().Nodes().List(metav1.ListOptions{\n\t\t\tLabelSelector: provider.TurndownNodeLabelSelector,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttnode = &nodeList.Items[0]\n\t} else {\n\t\t// Otherwise, have the current pod move to autoscaling node pool\n\t\tnodeList, err := ktdm.client.CoreV1().Nodes().List(metav1.ListOptions{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar targetNode *v1.Node\n\t\tfor _, node := range nodeList.Items {\n\t\t\tpoolID := ktdm.provider.GetPoolID(&node)\n\t\t\tif poolID == autoScalingNodePool.Name() {\n\t\t\t\ttargetNode = &node\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif targetNode == nil {\n\t\t\treturn nil, fmt.Errorf(\"Target node was not located for autoscaling cluster.\")\n\t\t}\n\n\t\t// Patch and get the updated node\n\t\ttnode, err = patcher.UpdateNodeLabel(ktdm.client, *targetNode, provider.TurndownNodeLabel, \"true\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Patch Node with Taint\n\treturn patcher.PatchNode(ktdm.client, *tnode, func(n *v1.Node) error {\n\t\ttaints := n.Spec.Taints\n\t\tfor _, taint := range taints {\n\t\t\tif taint.Key == MasterlessTaintKey {\n\t\t\t\treturn patcher.NoUpdates\n\t\t\t}\n\t\t}\n\n\t\tn.Spec.Taints = append(taints, v1.Taint{\n\t\t\tKey: MasterlessTaintKey,\n\t\t\tValue: \"true\",\n\t\t\tEffect: v1.TaintEffectNoSchedule,\n\t\t})\n\n\t\treturn nil\n\t})\n}", "func (cc *ContrailCommand) CreateNode(host vcenter.ESXIHost) error {\n\tlog.Debug(\"Create Node:\", cc.AuthToken)\n\tnodeResource := contrailCommandNodeSync{\n\t\tResources: []*nodeResources{\n\t\t\t{\n\t\t\t\tKind: \"node\",\n\t\t\t\tData: &nodeData{\n\t\t\t\t\tNodeType: \"esxi\",\n\t\t\t\t\tUUID: host.UUID,\n\t\t\t\t\tHostname: host.Hostname,\n\t\t\t\t\tFqName: []string{\"default-global-system-config\", host.Hostname},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tjsonData, err := json.Marshal(nodeResource)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Debug(\"Sending Request\")\n\tresp, _, err := cc.sendRequest(\"/sync\", string(jsonData), \"POST\") //nolint: bodyclose\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Debug(\"Got status : \", resp.StatusCode)\n\tswitch resp.StatusCode {\n\tdefault:\n\t\treturn fmt.Errorf(\"resource creation failed, %d\", resp.StatusCode)\n\tcase 200, 201:\n\t}\n\treturn nil\n}", "func resourceNodeV1Create(d *schema.ResourceData, meta interface{}) error {\n\tclient, err := meta.(*Clients).GetIronicClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create the node object in Ironic\n\tcreateOpts := schemaToCreateOpts(d)\n\tresult, err := nodes.Create(client, createOpts).Extract()\n\tif err != nil {\n\t\td.SetId(\"\")\n\t\treturn err\n\t}\n\n\t// Setting the ID is what tells terraform we were successful in creating the node\n\tlog.Printf(\"[DEBUG] Node created with ID %s\\n\", d.Id())\n\td.SetId(result.UUID)\n\n\t// Create ports as part of the node object - you may also use the native port resource\n\tportSet := d.Get(\"ports\").(*schema.Set)\n\tif portSet != nil {\n\t\tportList := portSet.List()\n\t\tfor _, portInterface := range portList {\n\t\t\tport := portInterface.(map[string]interface{})\n\n\t\t\t// Terraform map can't handle bool... seriously.\n\t\t\tvar pxeEnabled bool\n\t\t\tif port[\"pxe_enabled\"] != nil {\n\t\t\t\tif port[\"pxe_enabled\"] == \"true\" {\n\t\t\t\t\tpxeEnabled = true\n\t\t\t\t} else {\n\t\t\t\t\tpxeEnabled = false\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t// FIXME: All values other than address and pxe\n\t\t\tportCreateOpts := ports.CreateOpts{\n\t\t\t\tNodeUUID: d.Id(),\n\t\t\t\tAddress: port[\"address\"].(string),\n\t\t\t\tPXEEnabled: &pxeEnabled,\n\t\t\t}\n\t\t\t_, err := ports.Create(client, portCreateOpts).Extract()\n\t\t\tif err != nil {\n\t\t\t\t_ = resourcePortV1Read(d, meta)\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Make node manageable\n\tif d.Get(\"manage\").(bool) || d.Get(\"clean\").(bool) || d.Get(\"inspect\").(bool) {\n\t\tif err := ChangeProvisionStateToTarget(client, d.Id(), \"manage\", nil, nil, nil); err != nil {\n\t\t\treturn fmt.Errorf(\"could not manage: %s\", err)\n\t\t}\n\t}\n\n\t// Clean node\n\tif d.Get(\"clean\").(bool) {\n\t\tif err := setRAIDConfig(client, d); err != nil {\n\t\t\treturn fmt.Errorf(\"fail to set raid config: %s\", err)\n\t\t}\n\n\t\tvar cleanSteps []nodes.CleanStep\n\t\tif cleanSteps, err = buildManualCleaningSteps(d.Get(\"raid_interface\").(string), d.Get(\"raid_config\").(string), d.Get(\"bios_settings\").(string)); err != nil {\n\t\t\treturn fmt.Errorf(\"fail to build raid clean steps: %s\", err)\n\t\t}\n\n\t\tif err := ChangeProvisionStateToTarget(client, d.Id(), \"clean\", nil, nil, cleanSteps); err != nil {\n\t\t\treturn fmt.Errorf(\"could not clean: %s\", err)\n\t\t}\n\t}\n\n\t// Inspect node\n\tif d.Get(\"inspect\").(bool) {\n\t\tif err := ChangeProvisionStateToTarget(client, d.Id(), \"inspect\", nil, nil, nil); err != nil {\n\t\t\treturn fmt.Errorf(\"could not inspect: %s\", err)\n\t\t}\n\t}\n\n\t// Make node available\n\tif d.Get(\"available\").(bool) {\n\t\tif err := ChangeProvisionStateToTarget(client, d.Id(), \"provide\", nil, nil, nil); err != nil {\n\t\t\treturn fmt.Errorf(\"could not make node available: %s\", err)\n\t\t}\n\t}\n\n\t// Change power state, if required\n\tif targetPowerState := d.Get(\"target_power_state\").(string); targetPowerState != \"\" {\n\t\terr := changePowerState(client, d, nodes.TargetPowerState(targetPowerState))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not change power state: %s\", err)\n\t\t}\n\t}\n\n\treturn resourceNodeV1Read(d, meta)\n}", "func NetworkResourceCreate(w http.ResponseWriter, r *http.Request) {\n\tvar req openapi.NetworkResourceCreateRequest\n\tif err := json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\thandleError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\tnetwork, err := ctr.CreateNetworkResource(&req)\n\tif err != nil {\n\t\thandleError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\thandleResult(w, http.StatusCreated, network)\n\treturn\n}", "func CreateResource(kubedata *krd.GenericKubeResourceData, kubeclient *kubernetes.Clientset) (string, error) {\n\tif kubedata.Namespace == \"\" {\n\t\tkubedata.Namespace = \"default\"\n\t}\n\n\tif _, err := os.Stat(kubedata.YamlFilePath); err != nil {\n\t\treturn \"\", pkgerrors.New(\"File \" + kubedata.YamlFilePath + \" not found\")\n\t}\n\n\tlog.Println(\"Reading deployment YAML\")\n\trawBytes, err := ioutil.ReadFile(kubedata.YamlFilePath)\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Deployment YAML file read error\")\n\t}\n\n\tlog.Println(\"Decoding deployment YAML\")\n\tdecode := scheme.Codecs.UniversalDeserializer().Decode\n\tobj, _, err := decode(rawBytes, nil, nil)\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Deserialize deployment error\")\n\t}\n\n\tswitch o := obj.(type) {\n\tcase *appsV1.Deployment:\n\t\tkubedata.DeploymentData = o\n\tdefault:\n\t\treturn \"\", pkgerrors.New(kubedata.YamlFilePath + \" contains another resource different than Deployment\")\n\t}\n\n\tkubedata.DeploymentData.Namespace = kubedata.Namespace\n\tkubedata.DeploymentData.Name = kubedata.InternalVNFID + \"-\" + kubedata.DeploymentData.Name\n\n\tresult, err := kubeclient.AppsV1().Deployments(kubedata.Namespace).Create(kubedata.DeploymentData)\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Create Deployment error\")\n\t}\n\n\treturn result.GetObjectMeta().GetName(), nil\n}", "func (h *httpCloud) GetNodeResources(instance string) (*api.NodeResources, error) {\n\tvar resp api.NodeResources\n\tif err := h.get(h.instancesURL+path.Join(InstancesPath, instance, InstanceResourcesPath), &resp); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &resp, nil\n}", "func (zic *ZoneInterconnectHandler) createLocalZoneNodeResources(node *corev1.Node, nodeID int) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port ips for node %s: %w\", node.Name, err)\n\t}\n\n\tnetworkId, err := util.ParseNetworkIDAnnotation(node, zic.GetNetworkName())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get the network id for the network %s on node %s: %v\", zic.GetNetworkName(), node.Name, err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\ttransitSwitchTunnelKey := BaseTransitSwitchTunnelKey + networkId\n\tts := &nbdb.LogicalSwitch{\n\t\tName: zic.networkTransitSwitchName,\n\t\tOtherConfig: map[string]string{\n\t\t\t\"interconn-ts\": zic.networkTransitSwitchName,\n\t\t\t\"requested-tnl-key\": strconv.Itoa(transitSwitchTunnelKey),\n\t\t\t\"mcast_snoop\": \"true\",\n\t\t\t\"mcast_flood_unregistered\": \"true\",\n\t\t},\n\t}\n\n\t// Create transit switch if it doesn't exist\n\tif err := libovsdbops.CreateOrUpdateLogicalSwitch(zic.nbClient, ts); err != nil {\n\t\treturn fmt.Errorf(\"failed to create/update transit switch %s: %w\", zic.networkTransitSwitchName, err)\n\t}\n\n\t// Connect transit switch to the cluster router by creating a pair of logical switch port - logical router port\n\tlogicalRouterPortName := zic.GetNetworkScopedName(types.RouterToTransitSwitchPrefix + node.Name)\n\tlogicalRouterPort := nbdb.LogicalRouterPort{\n\t\tName: logicalRouterPortName,\n\t\tMAC: transitRouterPortMac.String(),\n\t\tNetworks: transitRouterPortNetworks,\n\t\tOptions: map[string]string{\n\t\t\t\"mcast_flood\": \"true\",\n\t\t},\n\t}\n\tlogicalRouter := nbdb.LogicalRouter{\n\t\tName: zic.networkClusterRouterName,\n\t}\n\n\tif err := libovsdbops.CreateOrUpdateLogicalRouterPort(zic.nbClient, &logicalRouter, &logicalRouterPort, nil); err != nil {\n\t\treturn fmt.Errorf(\"failed to create/update cluster router %s to add transit switch port %s for the node %s: %w\", zic.networkClusterRouterName, logicalRouterPortName, node.Name, err)\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"router-port\": logicalRouterPortName,\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\terr = zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix+node.Name),\n\t\tlportTypeRouter, []string{lportTypeRouterAddr}, lspOptions, externalIDs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Its possible that node is moved from a remote zone to the local zone. Check and delete the remote zone routes\n\t// for this node as it's no longer needed.\n\treturn zic.deleteLocalNodeStaticRoutes(node, nodeID, nodeTransitSwitchPortIPs)\n}", "func getNode(ctx context.Context, client client.Interface, nodeName string) *libapi.Node {\n\tnode, err := client.Nodes().Get(ctx, nodeName, options.GetOptions{})\n\tif err != nil {\n\t\tif _, ok := err.(cerrors.ErrorResourceDoesNotExist); !ok {\n\t\t\tlog.WithError(err).WithField(\"Name\", nodeName).Info(\"Unable to query node configuration\")\n\t\t\tlog.Warn(\"Unable to access datastore to query node configuration\")\n\t\t\tutils.Terminate()\n\t\t}\n\n\t\tlog.WithField(\"Name\", nodeName).Info(\"Building new node resource\")\n\t\tnode = libapi.NewNode()\n\t\tnode.Name = nodeName\n\t}\n\n\treturn node\n}", "func (api *nodeAPI) Create(obj *cluster.Node) error {\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = apicl.ClusterV1().Node().Create(context.Background(), obj)\n\t\tif err != nil && strings.Contains(err.Error(), \"AlreadyExists\") {\n\t\t\t_, err = apicl.ClusterV1().Node().Update(context.Background(), obj)\n\n\t\t}\n\t\treturn err\n\t}\n\n\tapi.ct.handleNodeEvent(&kvstore.WatchEvent{Object: obj, Type: kvstore.Created})\n\treturn nil\n}", "func (rc *ResourceCache) GetNodeResources(nodeName string) []*Resource {\n\trc.lock.Lock()\n\tdefer rc.lock.Unlock()\n\tnode, ok := rc.Nodes[nodeName]\n\tif !ok {\n\t\treturn nil\n\t}\n\tretRes := make([]*Resource, 0)\n\tfor _, r := range node.Resources {\n\t\tretRes = append(retRes, r.DeepCopy())\n\t}\n\tsort.Slice(retRes, func(i, j int) bool {\n\t\treturn retRes[i].Key() < retRes[j].Key()\n\t})\n\treturn retRes\n}", "func GetNodeObject(clientset kubernetes.Interface, hostnameOverride string) (*apiv1.Node, error) {\n\t// assuming kube-router is running as pod, first check env NODE_NAME\n\tnodeName := os.Getenv(\"NODE_NAME\")\n\tif nodeName != \"\" {\n\t\tnode, err := clientset.CoreV1().Nodes().Get(context.Background(), nodeName, metav1.GetOptions{})\n\t\tif err == nil {\n\t\t\treturn node, nil\n\t\t}\n\t}\n\n\t// if env NODE_NAME is not set then check if node is register with hostname\n\thostName, _ := os.Hostname()\n\tnode, err := clientset.CoreV1().Nodes().Get(context.Background(), hostName, metav1.GetOptions{})\n\tif err == nil {\n\t\treturn node, nil\n\t}\n\n\t// if env NODE_NAME is not set and node is not registered with hostname, then use host name override\n\tif hostnameOverride != \"\" {\n\t\tnode, err = clientset.CoreV1().Nodes().Get(context.Background(), hostnameOverride, metav1.GetOptions{})\n\t\tif err == nil {\n\t\t\treturn node, nil\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"Failed to identify the node by NODE_NAME, hostname or --hostname-override\")\n}", "func CreateOrUpdate(ctx context.Context, client client.Interface, node *libapi.Node) (*libapi.Node, error) {\n\tif node.ResourceVersion != \"\" {\n\t\treturn client.Nodes().Update(ctx, node, options.SetOptions{})\n\t}\n\n\treturn client.Nodes().Create(ctx, node, options.SetOptions{})\n}", "func (s *ResourcesService) Create(ctx context.Context, realm, clientID string, resource *Resource) (*Resource, *http.Response, error) {\n\tu := fmt.Sprintf(\"admin/realms/%s/clients/%s/authz/resource-server/resource\", realm, clientID)\n\treq, err := s.keycloak.NewRequest(http.MethodPost, u, resource)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar created Resource\n\tres, err := s.keycloak.Do(ctx, req, &created)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn &created, res, nil\n}", "func (g genericPlugin) Create(yamlFilePath string, namespace string, client plugin.KubernetesConnector) (string, error) {\n\tif namespace == \"\" {\n\t\tnamespace = \"default\"\n\t}\n\n\t//Decode the yaml file to create a runtime.Object\n\tunstruct := &unstructured.Unstructured{}\n\t//Ignore the returned obj as we expect the data in unstruct\n\t_, err := utils.DecodeYAML(yamlFilePath, unstruct)\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Decode deployment object error\")\n\t}\n\n\tdynClient := client.GetDynamicClient()\n\tmapper := client.GetMapper()\n\n\tgvk := unstruct.GroupVersionKind()\n\tmapping, err := mapper.RESTMapping(schema.GroupKind{Group: gvk.Group, Kind: gvk.Kind}, gvk.Version)\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Mapping kind to resource error\")\n\t}\n\n\t//Add the tracking label to all resources created here\n\tlabels := unstruct.GetLabels()\n\t//Check if labels exist for this object\n\tif labels == nil {\n\t\tlabels = map[string]string{}\n\t}\n\tlabels[config.GetConfiguration().KubernetesLabelName] = client.GetInstanceID()\n\tunstruct.SetLabels(labels)\n\n\t// This checks if the resource we are creating has a podSpec in it\n\t// Eg: Deployment, StatefulSet, Job etc..\n\t// If a PodSpec is found, the label will be added to it too.\n\tplugin.TagPodsIfPresent(unstruct, client.GetInstanceID())\n\n\tgvr := mapping.Resource\n\tvar createdObj *unstructured.Unstructured\n\n\tswitch mapping.Scope.Name() {\n\tcase meta.RESTScopeNameNamespace:\n\t\tcreatedObj, err = dynClient.Resource(gvr).Namespace(namespace).Create(unstruct, metav1.CreateOptions{})\n\tcase meta.RESTScopeNameRoot:\n\t\tcreatedObj, err = dynClient.Resource(gvr).Create(unstruct, metav1.CreateOptions{})\n\tdefault:\n\t\treturn \"\", pkgerrors.New(\"Got an unknown RESTSCopeName for mapping: \" + gvk.String())\n\t}\n\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Create object error\")\n\t}\n\n\treturn createdObj.GetName(), nil\n}", "func (builder clusterDTOBuilder) getNodeResourceCapacity(clusterName string, commodityType proto.CommodityDTO_CommodityType,\n\tnodeResourceCapacityMap map[proto.CommodityDTO_CommodityType]float64) float64 {\n\tresourceCapacity, ok := nodeResourceCapacityMap[commodityType]\n\tif !ok {\n\t\tglog.Errorf(\"%s commodity does not exist in nodeResourceCapacityMap\", commodityType)\n\t\treturn 0\n\t}\n\tif resourceCapacity == 0 {\n\t\tglog.Errorf(\"%s commodity capacity from all nodes in cluster %s is 0.\", commodityType, clusterName)\n\t\treturn 0\n\t}\n\treturn resourceCapacity\n}", "func (r *ReconcileKogitoInfra) createRequiredResources(instance *v1alpha1.KogitoInfra) (resources map[reflect.Type][]resource.KubernetesResource, err error) {\n\tresourcesInfinispan, err := infinispan.CreateRequiredResources(instance, r.client)\n\tif err != nil {\n\t\treturn\n\t}\n\tresourcesKafka, err := kafka.CreateRequiredResources(instance)\n\tif err != nil {\n\t\treturn\n\t}\n\tresourcesKeycloak, err := keycloak.CreateRequiredResources(instance)\n\tif err != nil {\n\t\treturn\n\t}\n\tresources = make(map[reflect.Type][]resource.KubernetesResource, len(resourcesInfinispan)+len(resourcesKafka)+len(resourcesKeycloak))\n\tmergeResourceMaps(resources, resourcesKafka, resourcesInfinispan, resourcesKeycloak)\n\treturn\n}", "func (ktdm *StandardTurndownStrategy) CreateOrGetHostNode() (*v1.Node, error) {\n\t// Locate the master node using role labels\n\tnodeList, err := ktdm.client.CoreV1().Nodes().List(metav1.ListOptions{\n\t\tLabelSelector: MasterNodeLabelKey,\n\t})\n\tif err != nil || len(nodeList.Items) == 0 {\n\t\t// Try an alternate selector in case the first fails\n\t\tnodeList, err = ktdm.client.CoreV1().Nodes().List(metav1.ListOptions{\n\t\t\tLabelSelector: fmt.Sprintf(\"%s=master\", NodeRoleLabelKey),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif len(nodeList.Items) == 0 {\n\t\t\treturn nil, fmt.Errorf(\"Failed to locate master node in standard turndown strategy.\")\n\t\t}\n\t}\n\n\t// Pick a master node\n\tmasterNode := &nodeList.Items[0]\n\n\t// Patch and get the updated node\n\treturn patcher.UpdateNodeLabel(ktdm.client, *masterNode, provider.TurndownNodeLabel, \"true\")\n}", "func (client RoverClusterClient) createRoverCluster(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodPost, \"/roverClusters\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response CreateRoverClusterResponse\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/rover/20201210/RoverCluster/CreateRoverCluster\"\n\t\terr = common.PostProcessServiceError(err, \"RoverCluster\", \"CreateRoverCluster\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func (r *ResourceInfo) Get(brief bool) (apistructs.ClusterResourceInfoData, error) {\n\tpodLi := &v1.PodList{Items: nil}\n\tif !brief {\n\t\tvar err error\n\t\tpodLi, err = r.podUtil.ListAllNamespace([]string{\"status.phase!=Succeeded\", \"status.phase!=Failed\"})\n\t\tif err != nil {\n\t\t\treturn apistructs.ClusterResourceInfoData{}, nil\n\t\t}\n\t}\n\n\tnodeList, err := r.cs.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{})\n\tif err != nil {\n\t\tlogrus.Errorf(\"failed to list nodes: %v\", err)\n\t\treturn apistructs.ClusterResourceInfoData{}, nil\n\t}\n\n\tpodMap := splitPodsByNodeName(podLi)\n\tnodeResourceInfoMap := make(map[string]*apistructs.NodeResourceInfo)\n\n\tfor _, node := range nodeList.Items {\n\t\tvar ip net.IP\n\t\tfor _, addr := range node.Status.Addresses {\n\t\t\tif addr.Type == v1.NodeInternalIP {\n\t\t\t\tip = net.ParseIP(addr.Address)\n\t\t\t}\n\t\t}\n\t\tif ip == nil {\n\t\t\t// ignore, if internalIP not found\n\t\t\tcontinue\n\t\t}\n\t\tnodeResourceInfoMap[ip.String()] = &apistructs.NodeResourceInfo{}\n\t\tinfo := nodeResourceInfoMap[ip.String()]\n\t\tinfo.Labels = nodeLabels(&node)\n\t\tinfo.Ready = nodeReady(&node)\n\t\tcpuAllocatable, err := strconv.ParseFloat(fmt.Sprintf(\"%f\", node.Status.Allocatable.Cpu().AsDec()), 64)\n\t\tif err != nil {\n\t\t\treturn apistructs.ClusterResourceInfoData{}, err\n\t\t}\n\t\tmemAllocatable, _ := node.Status.Allocatable.Memory().AsInt64()\n\t\tinfo.CPUAllocatable = cpuAllocatable\n\t\tinfo.MemAllocatable = memAllocatable\n\t\tpods := podMap[node.Name]\n\t\tpodlist := &v1.PodList{Items: pods}\n\t\treqs, limits := getPodsTotalRequestsAndLimits(podlist)\n\t\tcpuReqs, cpuLimit, memReqs, memLimit := reqs[v1.ResourceCPU], limits[v1.ResourceCPU], reqs[v1.ResourceMemory], limits[v1.ResourceMemory]\n\t\tcpuReqsNum, err := strconv.ParseFloat(fmt.Sprintf(\"%f\", cpuReqs.AsDec()), 64)\n\t\tif err != nil {\n\t\t\treturn apistructs.ClusterResourceInfoData{}, err\n\t\t}\n\t\tmemReqsNum, _ := memReqs.AsInt64()\n\t\tcpuLimitNum, err := strconv.ParseFloat(fmt.Sprintf(\"%f\", cpuLimit.AsDec()), 64)\n\t\tif err != nil {\n\t\t\treturn apistructs.ClusterResourceInfoData{}, err\n\t\t}\n\t\tmemLimitNum, _ := memLimit.AsInt64()\n\t\tinfo.CPUReqsUsage = cpuReqsNum\n\t\tinfo.CPULimitUsage = cpuLimitNum\n\t\tinfo.MemReqsUsage = memReqsNum\n\t\tinfo.MemLimitUsage = memLimitNum\n\t}\n\n\treturn apistructs.ClusterResourceInfoData{Nodes: nodeResourceInfoMap}, nil\n}", "func DescribeNodeResource(nodeNonTerminatedPodsList *corev1.PodList, node *corev1.Node) *NodeUsage {\n\tallocatable := node.Status.Capacity\n\tif len(node.Status.Allocatable) > 0 {\n\t\tallocatable = node.Status.Allocatable\n\t}\n\n\treqs, limits := getPodsTotalRequestsAndLimits(nodeNonTerminatedPodsList)\n\tcpuReqs, cpuLimits, memoryReqs, memoryLimits, ephemeralstorageReqs, ephemeralstorageLimits :=\n\t\treqs[corev1.ResourceCPU], limits[corev1.ResourceCPU], reqs[corev1.ResourceMemory], limits[corev1.ResourceMemory], reqs[corev1.ResourceEphemeralStorage], limits[corev1.ResourceEphemeralStorage]\n\tfractionCpuReqs := float64(0)\n\tfractionCpuLimits := float64(0)\n\tif allocatable.Cpu().MilliValue() != 0 {\n\t\tfractionCpuReqs = float64(cpuReqs.MilliValue()) / float64(allocatable.Cpu().MilliValue()) * 100\n\t\tfractionCpuLimits = float64(cpuLimits.MilliValue()) / float64(allocatable.Cpu().MilliValue()) * 100\n\t}\n\tfractionMemoryReqs := float64(0)\n\tfractionMemoryLimits := float64(0)\n\tif allocatable.Memory().Value() != 0 {\n\t\tfractionMemoryReqs = float64(memoryReqs.Value()) / float64(allocatable.Memory().Value()) * 100\n\t\tfractionMemoryLimits = float64(memoryLimits.Value()) / float64(allocatable.Memory().Value()) * 100\n\t}\n\tfractionEphemeralStorageReqs := float64(0)\n\tfractionEphemeralStorageLimits := float64(0)\n\tif allocatable.StorageEphemeral().Value() != 0 {\n\t\tfractionEphemeralStorageReqs = float64(ephemeralstorageReqs.Value()) / float64(allocatable.StorageEphemeral().Value()) * 100\n\t\tfractionEphemeralStorageLimits = float64(ephemeralstorageLimits.Value()) / float64(allocatable.StorageEphemeral().Value()) * 100\n\t}\n\n\treturn &NodeUsage{\n\t\tcpuReqs: cpuReqs.String(),\n\t\tmemoryReqs: memoryReqs.String(),\n\t\tephemeralStorageReqs: ephemeralstorageReqs.String(),\n\t\tfractionCpuReqs: fractionCpuReqs,\n\t\tfractionCpuLimits: fractionCpuLimits,\n\t\tfractionMemoryReqs: fractionMemoryReqs,\n\t\tfractionMemoryLimits: fractionMemoryLimits,\n\t\tfractionEphemeralStorageReqs: fractionEphemeralStorageReqs,\n\t\tfractionEphemeralStorageLimits: fractionEphemeralStorageLimits,\n\t}\n}", "func createNode(cfg *meta.ClusterConfig, nodeUUID, nodeURL string) (*meta.Watcher, *meta.Node, *rpckit.RPCServer, error) {\n\t// create watcher\n\tw, err := meta.NewWatcher(nodeUUID, cfg)\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\n\t// Start a rpc server\n\trpcSrv, err := rpckit.NewRPCServer(fmt.Sprintf(\"datanode-%s\", nodeUUID), nodeURL, rpckit.WithLoggerEnabled(false))\n\tif err != nil {\n\t\tlog.Errorf(\"failed to listen to %s: Err %v\", nodeURL, err)\n\t\treturn nil, nil, nil, err\n\t}\n\n\t// register RPC handlers\n\ttproto.RegisterDataNodeServer(rpcSrv.GrpcServer, &fakeDataNode{nodeUUID: nodeUUID})\n\trpcSrv.Start()\n\ttime.Sleep(time.Millisecond * 50)\n\n\t// create node\n\tnd, err := meta.NewNode(cfg, nodeUUID, nodeURL)\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\n\treturn w, nd, rpcSrv, nil\n}", "func (r *ReconcileGrafana) createResource(cr *i8ly.Grafana, resourceName string) error {\n\tresourceHelper := newResourceHelper(cr)\n\tresource, err := resourceHelper.createResource(resourceName)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn r.deployResource(cr, resource, resourceName)\n}", "func NewTCPCluster(name string, mutationFunc ...ClusterMutator) (ciliumv2.XDSResource, error) {\n\tcluster := &envoy_config_cluster_v3.Cluster{\n\t\tName: name,\n\t\tClusterDiscoveryType: &envoy_config_cluster_v3.Cluster_Type{\n\t\t\tType: envoy_config_cluster_v3.Cluster_EDS,\n\t\t},\n\t}\n\n\t// Apply mutation functions for customizing the cluster.\n\tfor _, fn := range mutationFunc {\n\t\tcluster = fn(cluster)\n\t}\n\n\tclusterBytes, err := proto.Marshal(cluster)\n\tif err != nil {\n\t\treturn ciliumv2.XDSResource{}, err\n\t}\n\n\treturn ciliumv2.XDSResource{\n\t\tAny: &anypb.Any{\n\t\t\tTypeUrl: envoy.ClusterTypeURL,\n\t\t\tValue: clusterBytes,\n\t\t},\n\t}, nil\n}", "func (mg *CassandraKeySpace) GetTerraformResourceType() string {\n\treturn \"azurerm_cosmosdb_cassandra_keyspace\"\n}", "func createNode(id int, myConf *Config, sm *State_Machine) cluster.Server {\n\tinitNode(id, myConf, sm)\n\t//Set up details about cluster nodes form json file.\n\tserver, err := cluster.New(id, \"config/cluster_config.json\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn server\n}", "func nodesToCreate(clusterName string, flags *CreateOptions) []nodeSpec {\n\tvar desiredNodes []nodeSpec\n\n\t// prepare nodes explicitly\n\tfor n := 0; n < flags.controlPlanes; n++ {\n\t\trole := constants.ControlPlaneNodeRoleValue\n\t\tdesiredNode := nodeSpec{\n\t\t\tName: fmt.Sprintf(\"%s-%s-%d\", clusterName, role, n+1),\n\t\t\tRole: role,\n\t\t}\n\t\tdesiredNodes = append(desiredNodes, desiredNode)\n\t}\n\tfor n := 0; n < flags.workers; n++ {\n\t\trole := constants.WorkerNodeRoleValue\n\t\tdesiredNode := nodeSpec{\n\t\t\tName: fmt.Sprintf(\"%s-%s-%d\", clusterName, role, n+1),\n\t\t\tRole: role,\n\t\t}\n\t\tdesiredNodes = append(desiredNodes, desiredNode)\n\t}\n\n\t// add an external load balancer if explicitly requested or if there are multiple control planes\n\tif flags.externalLoadBalancer || flags.controlPlanes > 1 {\n\t\trole := constants.ExternalLoadBalancerNodeRoleValue\n\t\tdesiredNodes = append(desiredNodes, nodeSpec{\n\t\t\tName: fmt.Sprintf(\"%s-lb\", clusterName),\n\t\t\tRole: role,\n\t\t})\n\t}\n\n\treturn desiredNodes\n}", "func buildNormalizedNodeResourceMap(pods []*core_v1.Pod, nodes []*core_v1.Node) nodeResourceMap { // nolint: gocyclo\n\tnrm := nodeResourceMap{}\n\n\tfor _, n := range nodes {\n\t\tnrm[n.ObjectMeta.Name] = allocatedNodeResources{node: n}\n\t}\n\n\t// We sum the total allocated resources on every node from our list of pods.\n\t// Some strategies may wish to price pods based on their fraction of allocated\n\t// node resources, rather than the total resources available on a node. This\n\t// may punish lone pods that are initially scheduled onto large nodes, but this\n\t// may be desirable as it rightfully punishes applications that may cause\n\t// frequent node turnover.\n\tfor _, p := range pods {\n\t\tnr, ok := nrm[p.Spec.NodeName]\n\t\tif !ok {\n\t\t\tlog.Log.Warnw(\"unexpected missing node from NodeMap\", zap.String(\"nodeName\", p.Spec.NodeName))\n\t\t\tcontinue\n\t\t}\n\t\tnr.cpuUsed += sumPodResource(p, core_v1.ResourceCPU)\n\t\tnr.memoryUsed += sumPodResource(p, core_v1.ResourceMemory)\n\t\tnr.gpuUsed += sumPodResource(p, ResourceGPU)\n\t\tnrm[p.Spec.NodeName] = nr\n\t}\n\n\tfor k, v := range nrm {\n\t\tc := v.node.Status.Capacity.Cpu()\n\t\tif c != nil {\n\t\t\tv.cpuAvailable = c.MilliValue()\n\t\t}\n\n\t\tm := v.node.Status.Capacity.Memory()\n\t\tif m != nil {\n\t\t\tv.memoryAvailable = m.Value()\n\t\t}\n\n\t\tg := gpuCapacity(&v.node.Status.Capacity)\n\t\tif g != nil {\n\t\t\tv.gpuAvailable = g.Value()\n\t\t}\n\n\t\t// The ratio of cpuUsed / cpuAvailable is used for proportional scaling of\n\t\t// resources to \"normalize\" pod resource utilization to a full node. If\n\t\t// cpuUsed is 0 because the pods that are running have not made resource\n\t\t// requests, there's a possible divide by 0 in calling code so we default to\n\t\t// setting cpuUsed to cpuAvailable.\n\t\tif v.cpuUsed == 0 {\n\t\t\tv.cpuUsed = v.cpuAvailable\n\t\t}\n\n\t\tif v.memoryUsed == 0 {\n\t\t\tv.memoryUsed = v.memoryAvailable\n\t\t}\n\n\t\tif v.gpuUsed == 0 {\n\t\t\tv.gpuUsed = v.gpuAvailable\n\t\t}\n\n\t\tnrm[k] = v\n\t}\n\n\treturn nrm\n}", "func (api *nodeAPI) SyncCreate(obj *cluster.Node) error {\n\tnewObj := obj\n\tevtType := kvstore.Created\n\tvar writeErr error\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\tnewObj, writeErr = apicl.ClusterV1().Node().Create(context.Background(), obj)\n\t\tif writeErr != nil && strings.Contains(writeErr.Error(), \"AlreadyExists\") {\n\t\t\tnewObj, writeErr = apicl.ClusterV1().Node().Update(context.Background(), obj)\n\t\t\tevtType = kvstore.Updated\n\t\t}\n\t}\n\n\tif writeErr == nil {\n\t\tapi.ct.handleNodeEvent(&kvstore.WatchEvent{Object: newObj, Type: evtType})\n\t}\n\treturn writeErr\n}", "func createNewNode(ctx context.Context, nodeName string, virtual bool, clientset kubernetes.Interface) (*corev1.Node, error) {\n\tresources := corev1.ResourceList{}\n\tresources[corev1.ResourceCPU] = *resource.NewScaledQuantity(5000, resource.Milli)\n\tresources[corev1.ResourceMemory] = *resource.NewScaledQuantity(5, resource.Mega)\n\tnode := &corev1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: nodeName,\n\t\t},\n\t}\n\tif virtual {\n\t\tnode.Labels = map[string]string{\n\t\t\tconsts.TypeLabel: consts.TypeNode,\n\t\t}\n\t}\n\tnode.Status = corev1.NodeStatus{\n\t\tCapacity: resources,\n\t\tAllocatable: resources,\n\t\tConditions: []corev1.NodeCondition{\n\t\t\t0: {\n\t\t\t\tType: corev1.NodeReady,\n\t\t\t\tStatus: corev1.ConditionTrue,\n\t\t\t},\n\t\t},\n\t}\n\tnode, err := clientset.CoreV1().Nodes().Create(ctx, node, metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn node, nil\n}", "func CreateChaosResource(testsDetails *types.TestDetails, fileData []byte, namespace string, clients environment.ClientSets) error {\n\n\tdecoder := yamlutil.NewYAMLOrJSONDecoder(bytes.NewReader(fileData), 100)\n\n\t// for loop to install all the resouces\n\tfor {\n\t\t//runtime defines conversions between generic types and structs to map query strings to struct objects.\n\t\tvar rawObj runtime.RawExtension\n\t\tif err = decoder.Decode(&rawObj); err != nil {\n\t\t\t// if the object is null, successfully installed all manifest\n\t\t\tif rawObj.Raw == nil {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\t// NewDecodingSerializer adds YAML decoding support to a serializer that supports JSON.\n\t\tobj, gvk, _ := yaml.NewDecodingSerializer(unstructured.UnstructuredJSONScheme).Decode(rawObj.Raw, nil, nil)\n\t\tunstructuredMap, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tunstructuredObj := &unstructured.Unstructured{Object: unstructuredMap}\n\n\t\t// GetAPIGroupResources uses the provided discovery client to gather\n\t\t// discovery information and populate a slice of APIGroupResources.\n\t\tgr, err := restmapper.GetAPIGroupResources(clients.KubeClient.DiscoveryClient)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tmapper := restmapper.NewDiscoveryRESTMapper(gr)\n\n\t\t// RESTMapping returns a struct representing the resource path and conversion interfaces a\n\t\t// RESTClient should use to operate on the provided group/kind in order of versions.\n\t\tmapping, err := mapper.RESTMapping(gvk.GroupKind(), gvk.Version)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t//ResourceInterface is an API interface to a specific resource under a dynamic client\n\t\tvar dri dynamic.ResourceInterface\n\t\tif mapping.Scope.Name() == meta.RESTScopeNameNamespace {\n\t\t\tunstructuredObj.SetNamespace(namespace)\n\t\t\tdri = clients.DynamicClient.Resource(mapping.Resource).Namespace(unstructuredObj.GetNamespace())\n\t\t} else {\n\t\t\tdri = clients.DynamicClient.Resource(mapping.Resource)\n\t\t}\n\n\t\t// Create Chaos Resource using dynamic resource interface\n\t\tif _, err := dri.Create(unstructuredObj, v1.CreateOptions{}); err != nil {\n\t\t\tif !k8serrors.IsAlreadyExists(err) {\n\t\t\t\treturn err\n\t\t\t} else {\n\t\t\t\tif unstructuredObj.GetKind() == \"ChaosEngine\" {\n\t\t\t\t\treturn UpdateEngine(testsDetails, clients)\n\t\t\t\t} else if unstructuredObj.GetKind() == \"ChaosExperiment\" {\n\t\t\t\t\treturn UpdateExperiment(testsDetails, clients)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (config *AppConfig) CreateNode(newNode NodeAttributes) (node Node, err error) {\n\tendpoint := fmt.Sprintf(\"nodes/\")\n\n\tnewNodeBytes, err := json.Marshal(newNode)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// get json bytes from the panel.\n\tnodeBytes, err := config.queryApplicationAPI(endpoint, \"post\", newNodeBytes)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Get server info from the panel\n\t// Unmarshal the bytes to a usable struct.\n\terr = json.Unmarshal(nodeBytes, &node)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func CreateCRD(clientset apiextensionsclient.Interface) error {\n\t// The CustomResourceDefinition is not found, create it now.\n\tsparkAppCrd := &apiextensionsv1beta1.CustomResourceDefinition{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: FullName,\n\t\t},\n\t\tSpec: apiextensionsv1beta1.CustomResourceDefinitionSpec{\n\t\t\tGroup: Group,\n\t\t\tVersion: Version,\n\t\t\tScope: apiextensionsv1beta1.NamespaceScoped,\n\t\t\tNames: apiextensionsv1beta1.CustomResourceDefinitionNames{\n\t\t\t\tPlural: Plural,\n\t\t\t\tSingular: Singular,\n\t\t\t\tShortNames: []string{ShortName},\n\t\t\t\tKind: reflect.TypeOf(v1alpha1.SparkApplication{}).Name(),\n\t\t\t},\n\t\t},\n\t}\n\t_, err := clientset.ApiextensionsV1beta1().CustomResourceDefinitions().Create(sparkAppCrd)\n\tif err != nil {\n\t\tif apierrors.IsAlreadyExists(err) {\n\t\t\tglog.Warningf(\"CustomResourceDefinition %s already exists\", FullName)\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\t// Wait for the CustomResourceDefinition to become registered.\n\terr = waitForCRDEstablishment(clientset)\n\t// Try deleting the CustomResourceDefinition if it fails to be registered on time.\n\tif err != nil {\n\t\tdeleteErr := clientset.ApiextensionsV1beta1().CustomResourceDefinitions().Delete(FullName, &metav1.DeleteOptions{})\n\t\tif deleteErr != nil {\n\t\t\treturn errors.NewAggregate([]error{err, deleteErr})\n\t\t}\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func InitializeReplicaCreation(restclient *rest.RESTClient, clusterName,\n\tnamespace string) error {\n\n\tpgreplicaList := &crv1.PgreplicaList{}\n\tselector := config.LABEL_PG_CLUSTER + \"=\" + clusterName\n\terr := kubeapi.GetpgreplicasBySelector(restclient, pgreplicaList, selector, namespace)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn err\n\t}\n\tfor _, pgreplica := range pgreplicaList.Items {\n\n\t\tif pgreplica.Annotations == nil {\n\t\t\tpgreplica.Annotations = make(map[string]string)\n\t\t}\n\n\t\tpgreplica.Annotations[config.ANNOTATION_PGHA_BOOTSTRAP_REPLICA] = \"true\"\n\n\t\tif err = kubeapi.Updatepgreplica(restclient, &pgreplica, pgreplica.Name,\n\t\t\tnamespace); err != nil {\n\n\t\t\tlog.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func NewNodeConfigCRD() *apiextensionsv1beta1.CustomResourceDefinition {\n\treturn &apiextensionsv1beta1.CustomResourceDefinition{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: apiextensionsv1beta1.SchemeGroupVersion.String(),\n\t\t\tKind: \"CustomResourceDefinition\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"nodeconfigs.core.giantswarm.io\",\n\t\t},\n\t\tSpec: apiextensionsv1beta1.CustomResourceDefinitionSpec{\n\t\t\tGroup: \"core.giantswarm.io\",\n\t\t\tScope: \"Namespaced\",\n\t\t\tVersion: \"v1alpha1\",\n\t\t\tNames: apiextensionsv1beta1.CustomResourceDefinitionNames{\n\t\t\t\tKind: \"NodeConfig\",\n\t\t\t\tPlural: \"nodeconfigs\",\n\t\t\t\tSingular: \"nodeconfig\",\n\t\t\t},\n\t\t},\n\t}\n}", "func (m *ManagedNodeGroupResourceSet) AddAllResources() error {\n\tm.resourceSet.template.Description = fmt.Sprintf(\n\t\t\"%s (SSH access: %v) %s\",\n\t\t\"EKS Managed Nodes\",\n\t\tapi.IsEnabled(m.nodeGroup.SSH.Allow),\n\t\t\"[created by eksctl]\")\n\n\tm.template.Mappings[servicePrincipalPartitionMapName] = servicePrincipalPartitionMappings\n\n\tvar nodeRole *gfnt.Value\n\tif m.nodeGroup.IAM.InstanceRoleARN == \"\" {\n\t\tif err := createRole(m.resourceSet, m.nodeGroup.IAM, true); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tnodeRole = gfnt.MakeFnGetAttString(cfnIAMInstanceRoleName, \"Arn\")\n\t} else {\n\t\tnodeRole = gfnt.NewString(m.nodeGroup.IAM.InstanceRoleARN)\n\t}\n\n\tsubnets, err := AssignSubnets(m.nodeGroup.AvailabilityZones, m.clusterStackName, m.clusterConfig, m.nodeGroup.PrivateNetworking)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tscalingConfig := gfneks.Nodegroup_ScalingConfig{}\n\tif m.nodeGroup.MinSize != nil {\n\t\tscalingConfig.MinSize = gfnt.NewInteger(*m.nodeGroup.MinSize)\n\t}\n\tif m.nodeGroup.MaxSize != nil {\n\t\tscalingConfig.MaxSize = gfnt.NewInteger(*m.nodeGroup.MaxSize)\n\t}\n\tif m.nodeGroup.DesiredCapacity != nil {\n\t\tscalingConfig.DesiredSize = gfnt.NewInteger(*m.nodeGroup.DesiredCapacity)\n\t}\n\tmanagedResource := &gfneks.Nodegroup{\n\t\tClusterName: gfnt.NewString(m.clusterConfig.Metadata.Name),\n\t\tNodegroupName: gfnt.NewString(m.nodeGroup.Name),\n\t\tScalingConfig: &scalingConfig,\n\t\tSubnets: subnets,\n\t\t// Currently the API supports specifying only one instance type\n\t\tInstanceTypes: gfnt.NewStringSlice(m.nodeGroup.InstanceType),\n\t\tAmiType: gfnt.NewString(getAMIType(m.nodeGroup.InstanceType)),\n\t\tNodeRole: nodeRole,\n\t\tLabels: m.nodeGroup.Labels,\n\t\tTags: m.nodeGroup.Tags,\n\t}\n\n\tif api.IsEnabled(m.nodeGroup.SSH.Allow) {\n\t\tmanagedResource.RemoteAccess = &gfneks.Nodegroup_RemoteAccess{\n\t\t\tEc2SshKey: gfnt.NewString(*m.nodeGroup.SSH.PublicKeyName),\n\t\t\tSourceSecurityGroups: gfnt.NewStringSlice(m.nodeGroup.SSH.SourceSecurityGroupIDs...),\n\t\t}\n\t}\n\tif m.nodeGroup.VolumeSize != nil {\n\t\tmanagedResource.DiskSize = gfnt.NewInteger(*m.nodeGroup.VolumeSize)\n\t}\n\n\tm.newResource(\"ManagedNodeGroup\", managedResource)\n\n\treturn nil\n}", "func (r *ServiceGraphReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"servicegraph\", req.NamespacedName)\n\n\t// your logic here\n\tservicegraph := &onlabv2.ServiceGraph{}\n\terr := r.Get(ctx, req.NamespacedName, servicegraph)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\tlog.Info(\"Servicegraph resource not found. Ignoring since object must be deleted\")\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\tlog.Error(err, \"Failed to get ServiceGraph resource\")\n\t\treturn ctrl.Result{}, err\n\t}\n\t// printServiceGraph(servicegraph)\n\n\tfor _, node := range servicegraph.Spec.Nodes {\n\t\t// Check if the deployment for the node already exists, if not create a new one\n\t\tfound := &appsv1.Deployment{}\n\n\t\terr = r.Get(ctx, types.NamespacedName{Name: node.Name, Namespace: \"default\"}, found)\n\t\tif err != nil && errors.IsNotFound(err) {\n\t\t\t//fmt.Printf(\"######### CREATE: %d node type: %T\\n\", i, node)\n\t\t\t// Define a new deployment for the node\n\t\t\tdep := r.deploymentForNode(node, servicegraph)\n\t\t\tlog.Info(\"Creating a new Deployment\", \"Deployment.Namespace\", dep.Namespace, \"Deployment.Name\", dep.Name)\n\n\t\t\terr = r.Create(ctx, dep)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"Failed to create new Deployment\", \"Deployment.Namespace\", dep.Namespace, \"Deployment.Name\", dep.Name)\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\t// Deployment created successfully - return and requeue\n\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t} else if err != nil {\n\t\t\tlog.Error(err, \"Failed to get Deployment\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\t// Ensure the deployment size is the same as the spec\n\t\tsize := int32(node.Replicas)\n\t\tif *found.Spec.Replicas != size {\n\t\t\tfound.Spec.Replicas = &size\n\t\t\terr = r.Update(ctx, found)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"Failed to update Deployment\", \"Deployment.Namespace\", found.Namespace, \"Deployment.Name\", found.Name)\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\t// Spec updated - return and requeue\n\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t}\n\n\t\t// // Update/create services\n\n\t\t// foundSvc := &corev1.Service{}\n\n\t\t// err = r.Get(ctx, client.ObjectKey{Namespace: \"default\", Name: \"name\"}, foundSvc)\n\n\t\t// if err != nil && errors.IsNotFound(err) {\n\t\t// \tsvc := r.serviceForNode(node, servicegraph)\n\t\t// \tlog.Info(\"Creating a new Service\", \"Service.Namespace\", svc.Namespace, \"Service.Name\", svc.Name)\n\t\t// \t// Yes. This is not awesome, but works\n\t\t// \t// \t_ = r.Delete(ctx, svc)\n\t\t// \t// err = r.Create(ctx, svc)\n\t\t// \terr = r.Create(ctx, svc)\n\t\t// \tif err != nil {\n\t\t// \t\tlog.Error(err, \"Failed to create new Service\", \"Service.Namespace\", svc.Namespace, \"Service.Name\", svc.Name)\n\t\t// \t\treturn ctrl.Result{}, err\n\t\t// \t}\n\t\t// \t// Deployment created successfully - return and requeue\n\t\t// \treturn ctrl.Result{Requeue: true}, nil\n\t\t// } else if err != nil {\n\t\t// \tlog.Error(err, \"Failed to get SVC\")\n\t\t// \treturn ctrl.Result{}, err\n\t\t// }\n\t}\n\n\t// Update/create services\n\tfor _, node := range servicegraph.Spec.Nodes {\n\t\tsvc := r.serviceForNode(node, servicegraph)\n\t\t// Yes. This is not awesome, but works\n\t\t//_ = r.Delete(ctx, svc)\n\t\terr = r.Create(ctx, svc)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Failed to create new Service\", \"Service.Namespace\", svc.Namespace, \"Service.Name\", svc.Name)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\t// Deployment created successfully - return and requeue\n\t\treturn ctrl.Result{Requeue: true}, nil\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func (ng *NodeGroup) TemplateNodeInfo() (*schedulerframework.NodeInfo, error) {\n\t// Forge node template in a node group\n\tnode := &apiv1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: fmt.Sprintf(\"%s-node-%d\", ng.Id(), rand.Int63()),\n\t\t\tLabels: ng.Template.Metadata.Labels,\n\t\t\tAnnotations: ng.Template.Metadata.Annotations,\n\t\t\tFinalizers: ng.Template.Metadata.Finalizers,\n\t\t},\n\t\tSpec: apiv1.NodeSpec{\n\t\t\tTaints: ng.Template.Spec.Taints,\n\t\t},\n\t\tStatus: apiv1.NodeStatus{\n\t\t\tCapacity: apiv1.ResourceList{},\n\t\t\tConditions: cloudprovider.BuildReadyConditions(),\n\t\t},\n\t}\n\n\t// Add the nodepool label\n\tif node.ObjectMeta.Labels == nil {\n\t\tnode.ObjectMeta.Labels = make(map[string]string)\n\t}\n\tnode.ObjectMeta.Labels[NodePoolLabel] = ng.Id()\n\n\tflavor, err := ng.Manager.getFlavorByName(ng.Flavor)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get specs for flavor %q: %w\", ng.Flavor, err)\n\t}\n\n\tnode.Status.Capacity[apiv1.ResourcePods] = *resource.NewQuantity(110, resource.DecimalSI)\n\tnode.Status.Capacity[apiv1.ResourceCPU] = *resource.NewQuantity(int64(flavor.VCPUs), resource.DecimalSI)\n\tnode.Status.Capacity[gpu.ResourceNvidiaGPU] = *resource.NewQuantity(int64(flavor.GPUs), resource.DecimalSI)\n\tnode.Status.Capacity[apiv1.ResourceMemory] = *resource.NewQuantity(int64(flavor.RAM)*int64(math.Pow(1024, 3)), resource.DecimalSI)\n\n\tnode.Status.Allocatable = node.Status.Capacity\n\n\t// Setup node info template\n\tnodeInfo := schedulerframework.NewNodeInfo(cloudprovider.BuildKubeProxy(ng.Id()))\n\tnodeInfo.SetNode(node)\n\n\treturn nodeInfo, nil\n}", "func NewResource() (Resource, error) {\n\t// Get cluster config\n\tconfig, err := rest.InClusterConfig()\n\tif err != nil {\n\t\tlog.Fatalf(\"Error getting in cluster config: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\t// Setup event source client\n\teventSrcClient, err := eventsrcclientset.NewForConfig(config)\n\tif err != nil {\n\t\tlog.Printf(\"Error building event source client: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\t// Setup tektoncd client\n\ttektonClient, err := tektoncdclientset.NewForConfig(config)\n\tif err != nil {\n\t\tlog.Printf(\"Error building tekton clientset: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\t// Setup k8s client\n\tk8sClient, err := k8sclientset.NewForConfig(config)\n\tif err != nil {\n\t\tlog.Printf(\"Error building k8s clientset: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\tr := Resource{\n\t\tK8sClient: k8sClient,\n\t\tTektonClient: tektonClient,\n\t\tEventSrcClient: eventSrcClient,\n\t}\n\treturn r, nil\n}", "func createNodeClientMap(ctx context.Context, clients []provisioner.API) map[string]provisioner.API {\n\tresult := make(map[string]provisioner.API)\n\tfor _, c := range clients {\n\t\tif info, err := c.GetNodeInfo(ctx); err == nil {\n\t\t\tresult[info.NodeName] = c\n\t\t}\n\t}\n\treturn result\n}", "func CreateResources(f *os.File, cfg *rest.Config, dynamicClient dynamic.Interface) error {\n\tvar err error\n\tdata, err := os.ReadFile(f.Name())\n\tif err != nil {\n\t\treturn err\n\t}\n\tdecoder := yamlutil.NewYAMLOrJSONDecoder(bytes.NewReader(data), 100)\n\tmapper, err := apiutil.NewDiscoveryRESTMapper(cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor {\n\t\tresource, unstructuredObj, err := getResource(decoder, mapper, dynamicClient)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\t_, err = resource.Create(context.Background(), unstructuredObj, metav1.CreateOptions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (c *Client) CreateResource(ctx context.Context, resource models.Resource) ([]*models.Object, error) {\n\tvar out models.WhoisResource\n\tif err := c.transport.Post(ctx, \"/\"+resource.TypeString(), &out, transport.WithJSONRequestBody(resource.RIPEWhoisResource())); err != nil {\n\t\treturn nil, err\n\t}\n\treturn out.Objects.Object, nil\n}", "func CreateNode(p CreateParams, cmder runner.Cmder) (*Node, error) {\n\trunArgs := []string{\n\t\tfmt.Sprintf(\"--cpus=%s\", p.Cpus),\n\t\tfmt.Sprintf(\"--memory=%s\", p.Memory),\n\t\t\"-d\", // run the container detached\n\t\t\"-t\", // allocate a tty for entrypoint logs\n\t\t// running containers in a container requires privileged\n\t\t// NOTE: we could try to replicate this with --cap-add, and use less\n\t\t// privileges, but this flag also changes some mounts that are necessary\n\t\t// including some ones docker would otherwise do by default.\n\t\t// for now this is what we want. in the future we may revisit this.\n\t\t\"--privileged\",\n\t\t\"--security-opt\", \"seccomp=unconfined\", // also ignore seccomp\n\t\t\"--tmpfs\", \"/tmp\", // various things depend on working /tmp\n\t\t\"--tmpfs\", \"/run\", // systemd wants a writable /run\n\t\t// some k8s things want /lib/modules\n\t\t\"-v\", \"/lib/modules:/lib/modules:ro\",\n\t\t\"--hostname\", p.Name, // make hostname match container name\n\t\t\"--name\", p.Name, // ... and set the container name\n\t\t// label the node with the cluster ID\n\t\t\"--label\", p.ClusterLabel,\n\t\t// label the node with the role ID\n\t\t\"--label\", fmt.Sprintf(\"%s=%s\", NodeRoleKey, p.Role),\n\t}\n\n\tfor key, val := range p.Envs {\n\t\trunArgs = append(runArgs, \"-e\", fmt.Sprintf(\"%s=%s\", key, val))\n\t}\n\n\t// adds node specific args\n\trunArgs = append(runArgs, p.ExtraArgs...)\n\n\tif oci.UsernsRemap() {\n\t\t// We need this argument in order to make this command work\n\t\t// in systems that have userns-remap enabled on the docker daemon\n\t\trunArgs = append(runArgs, \"--userns=host\")\n\t}\n\n\t_, err := oci.CreateContainer(\n\t\tp.Image,\n\t\toci.WithRunArgs(runArgs...),\n\t\toci.WithMounts(p.Mounts),\n\t\toci.WithPortMappings(p.PortMappings),\n\t)\n\n\t// we should return a handle so the caller can clean it up\n\tnode := fromName(p.Name, cmder)\n\tif err != nil {\n\t\treturn node, fmt.Errorf(\"docker run error %v\", err)\n\t}\n\n\treturn node, nil\n}", "func (e *execution) deployNode(ctx context.Context, clientset kubernetes.Interface, generator *k8sGenerator, nbInstances int32) error {\n\tnamespace, err := defaultNamespace(e.deploymentID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = createNamespaceIfMissing(e.deploymentID, namespace, clientset)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = e.checkRepository(ctx, clientset, generator)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te.envInputs, _, err = operations.ResolveInputs(e.kv, e.deploymentID, e.nodeName, e.taskID, e.operation)\n\tif err != nil {\n\t\treturn err\n\t}\n\tinputs := e.parseEnvInputs()\n\n\tdeployment, service, err := generator.generateDeployment(e.deploymentID, e.nodeName, e.operation, e.nodeType, e.secretRepoName, inputs, nbInstances)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = clientset.ExtensionsV1beta1().Deployments(namespace).Create(&deployment)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Failed to create deployment\")\n\t}\n\n\tif service.Name != \"\" {\n\t\tserv, err := clientset.CoreV1().Services(namespace).Create(&service)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed to create service\")\n\t\t}\n\t\tvar s string\n\t\tnode, err := getHealthyNode(clientset)\n\t\tif err != nil {\n\t\t\tevents.WithContextOptionalFields(ctx).NewLogEntry(events.LogLevelWARN, e.deploymentID).Registerf(\"Not able to find an healthy node\")\n\t\t}\n\t\th, err := getExternalIPAdress(clientset, node)\n\t\tif err != nil {\n\t\t\tevents.WithContextOptionalFields(ctx).NewLogEntry(events.LogLevelWARN, e.deploymentID).Registerf(\"Error getting external ip of node %s\", node)\n\t\t}\n\t\tfor _, val := range serv.Spec.Ports {\n\t\t\tstr := fmt.Sprintf(\"http://%s:%d\", h, val.NodePort)\n\n\t\t\tlog.Printf(\"%s : %s: %d:%d mapped to %s\", serv.Name, val.Name, val.Port, val.TargetPort.IntVal, str)\n\n\t\t\ts = fmt.Sprintf(\"%s %d ==> %s \\n\", s, val.Port, str)\n\n\t\t\tif val.NodePort != 0 {\n\t\t\t\t// The service is accessible to an external IP address through\n\t\t\t\t// this port. Updating the corresponding public endpoints\n\t\t\t\t// kubernetes port mapping\n\t\t\t\terr := e.updatePortMappingPublicEndpoints(val.Port, h, val.NodePort)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.Wrap(err, \"Failed to update endpoint capabilities port mapping\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\terr = deployments.SetAttributeForAllInstances(e.kv, e.deploymentID, e.nodeName, \"k8s_service_url\", s)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed to set attribute\")\n\t\t}\n\n\t\t// Legacy\n\t\terr = deployments.SetAttributeForAllInstances(e.kv, e.deploymentID, e.nodeName, \"ip_address\", service.Name)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed to set attribute\")\n\t\t}\n\n\t\terr = deployments.SetAttributeForAllInstances(e.kv, e.deploymentID, e.nodeName, \"k8s_service_name\", service.Name)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed to set attribute\")\n\t\t}\n\t\t// TODO check that it is a good idea to use it as endpoint ip_address\n\t\terr = deployments.SetCapabilityAttributeForAllInstances(e.kv, e.deploymentID, e.nodeName, \"endpoint\", \"ip_address\", service.Name)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed to set capability attribute\")\n\t\t}\n\t}\n\n\t// TODO this is very bad but we need to add a hook in order to undeploy our pods we the tosca node stops\n\t// It will be better if we have a Kubernetes node type with a default stop implementation that will be inherited by\n\t// sub components.\n\t// So let's add an implementation of the stop operation in the node type\n\treturn e.setUnDeployHook()\n}", "func (fm *FCFSModel)TaskNodeToResource(td *TaskDescriptor,rd *ResDescriptor)*ArcDescriptor{\n\t//ct := uint64(rand.Intn(100))\n\treturn &ArcDescriptor{\n\t\tcost: fm.TaskToResCost(td,rd),\n\t\tcapLower :0,\n\t\tcapUpper: 1,\n\t}\n}", "func getRandomNode(c *calcium, podname string) (*types.Node, error) {\n\tnodes, err := c.ListPodNodes(podname, false)\n\tif err != nil {\n\t\tlog.Errorf(\"[getRandomNode] Error during ListPodNodes for %s: %v\", podname, err)\n\t\treturn nil, err\n\t}\n\tif len(nodes) == 0 {\n\t\terr = fmt.Errorf(\"No nodes available in pod %s\", podname)\n\t\tlog.Errorf(\"[getRandomNode] Error during getRandomNode from %s: %v\", podname, err)\n\t\treturn nil, err\n\t}\n\n\tnodemap := make(map[string]types.CPUMap)\n\tfor _, n := range nodes {\n\t\tnodemap[n.Name] = n.CPU\n\t}\n\tnodename, err := c.scheduler.RandomNode(nodemap)\n\tif err != nil {\n\t\tlog.Errorf(\"[getRandomNode] Error during getRandomNode from %s: %v\", podname, err)\n\t\treturn nil, err\n\t}\n\tif nodename == \"\" {\n\t\terr = fmt.Errorf(\"Got empty node during getRandomNode from %s\", podname)\n\t\treturn nil, err\n\t}\n\n\treturn c.GetNode(podname, nodename)\n}", "func createApplyCustomResource(resource, namespace, name string, crd *crd.TestCrd) error {\n\tginkgo.By(\"successfully create CR\")\n\tif _, err := e2ekubectl.RunKubectlInput(namespace, resource, \"create\", \"--validate=true\", \"-f\", \"-\"); err != nil {\n\t\treturn fmt.Errorf(\"failed to create CR %s in namespace %s: %w\", resource, namespace, err)\n\t}\n\tif _, err := e2ekubectl.RunKubectl(namespace, \"delete\", crd.Crd.Spec.Names.Plural, name); err != nil {\n\t\treturn fmt.Errorf(\"failed to delete CR %s: %w\", name, err)\n\t}\n\tginkgo.By(\"successfully apply CR\")\n\tif _, err := e2ekubectl.RunKubectlInput(namespace, resource, \"apply\", \"--validate=true\", \"-f\", \"-\"); err != nil {\n\t\treturn fmt.Errorf(\"failed to apply CR %s in namespace %s: %w\", resource, namespace, err)\n\t}\n\tif _, err := e2ekubectl.RunKubectl(namespace, \"delete\", crd.Crd.Spec.Names.Plural, name); err != nil {\n\t\treturn fmt.Errorf(\"failed to delete CR %s: %w\", name, err)\n\t}\n\treturn nil\n}", "func AllocatableResourceListFromNodeResourceTopology(nodeTopo *v1alpha2.NodeResourceTopology) map[string]corev1.ResourceList {\n\tallocRes := make(map[string]corev1.ResourceList)\n\tfor _, zone := range nodeTopo.Zones {\n\t\tif zone.Type != \"Node\" {\n\t\t\tcontinue\n\t\t}\n\t\tresList := make(corev1.ResourceList)\n\t\tfor _, res := range zone.Resources {\n\t\t\tresList[corev1.ResourceName(res.Name)] = res.Allocatable.DeepCopy()\n\t\t}\n\t\tif len(resList) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tallocRes[zone.Name] = resList\n\t}\n\treturn allocRes\n}", "func (c *VrouterNode) Create(contrailClient contrailclient.ApiClient) error {\n\tvrouterInfoLog.Printf(\"Creating %s %s\", c.Hostname, nodeType)\n\tgscObjects := []*contrailtypes.GlobalSystemConfig{}\n\tgscObjectsList, err := contrailClient.List(\"global-system-config\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(gscObjectsList) == 0 {\n\t\tvrouterInfoLog.Println(\"no gscObject\")\n\t}\n\n\tfor _, gscObject := range gscObjectsList {\n\t\tobj, err := contrailClient.ReadListResult(\"global-system-config\", &gscObject)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tgscObjects = append(gscObjects, obj.(*contrailtypes.GlobalSystemConfig))\n\t}\n\tfor _, gsc := range gscObjects {\n\t\tvirtualRouter := &contrailtypes.VirtualRouter{}\n\t\tvirtualRouter.SetVirtualRouterIpAddress(c.IPAddress)\n\t\tvirtualRouter.SetParent(gsc)\n\t\tvirtualRouter.SetName(c.Hostname)\n\t\tannotations := contrailclient.ConvertMapToContrailKeyValuePairs(c.Annotations)\n\t\tvirtualRouter.SetAnnotations(&annotations)\n\t\tif err := contrailClient.Create(virtualRouter); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn c.ensureVMIVhost0Interface(contrailClient)\n}", "func (n *NodeServiceImpl) Create(tx interface{}, namespace string, node *specV1.Node) (*specV1.Node, error) {\n\tres, err := n.Node.CreateNode(tx, namespace, node)\n\tif err != nil {\n\t\tlog.L().Error(\"create node failed\", log.Error(err))\n\t\treturn nil, err\n\t}\n\n\t_, err = n.SysAppService.GenApps(tx, namespace, node)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err = n.InsertOrUpdateNodeAndAppIndex(tx, namespace, res, models.NewShadowFromNode(res), true); err != nil {\n\t\treturn nil, err\n\t}\n\treturn res, err\n}", "func (n *NodeController) New() (r types.Resource) {\n\treturn new(types.Node)\n}", "func (c *Client) GetNodeOperator() scheduler.NodeOperator {\n\treturn c.Node\n}", "func CreateResourceFromFile(config *rest.Config, filename string) error {\n\t// Create a restmapper to determine the resource type.\n\tdiscoveryClient, err := discovery.NewDiscoveryClientForConfig(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcacheClient := ksUtil.NewMemcachedDiscoveryClient(discoveryClient)\n\tmapper := discovery.NewDeferredDiscoveryRESTMapper(cacheClient, dynamic.VersionInterfaces)\n\n\tdata, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tobjects := bytes.Split(data, []byte(yamlSeparator))\n\tvar o map[string]interface{}\n\tfor _, object := range objects {\n\t\tif err = yaml.Unmarshal(object, &o); err != nil {\n\t\t\treturn err\n\t\t}\n\t\ta := o[\"apiVersion\"]\n\t\tif a == nil {\n\t\t\tlog.Warnf(\"Unknown resource: %v\", object)\n\t\t\tcontinue\n\t\t}\n\t\tapiVersion := strings.Split(a.(string), \"/\")\n\t\tvar group, version string\n\t\tif len(apiVersion) == 1 {\n\t\t\t// core v1, no group. e.g. namespace\n\t\t\tgroup, version = \"\", apiVersion[0]\n\t\t} else {\n\t\t\tgroup, version = apiVersion[0], apiVersion[1]\n\t\t}\n\t\tkind := o[\"kind\"].(string)\n\t\tgk := schema.GroupKind{\n\t\t\tGroup: group,\n\t\t\tKind: kind,\n\t\t}\n\t\tresult, err := mapper.RESTMapping(gk, version)\n\t\t// result.resource is the resource we need (e.g. pods, services)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// build config for restClient\n\t\tc := rest.CopyConfig(config)\n\t\tc.GroupVersion = &schema.GroupVersion{\n\t\t\tGroup: group,\n\t\t\tVersion: version,\n\t\t}\n\t\tc.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}\n\t\tif group == \"\" {\n\t\t\tc.APIPath = \"/api\"\n\t\t} else {\n\t\t\tc.APIPath = \"/apis\"\n\t\t}\n\t\trestClient, err := rest.RESTClientFor(c)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// build the request\n\t\tmetadata := o[\"metadata\"].(map[string]interface{})\n\t\tname := metadata[\"name\"].(string)\n\t\tlog.Infof(\"creating %v\\n\", name)\n\n\t\tvar namespace string\n\t\tif metadata[\"namespace\"] != nil {\n\t\t\tnamespace = metadata[\"namespace\"].(string)\n\t\t} else {\n\t\t\tnamespace = \"default\"\n\t\t}\n\n\t\t// Get first to see if object already exists\n\t\tgetRequest := restClient.Get().Resource(result.Resource).Name(name)\n\t\tif result.Scope.Name() == \"namespace\" {\n\t\t\tgetRequest = getRequest.Namespace(namespace)\n\t\t}\n\t\t_, err = getRequest.DoRaw()\n\t\tif err == nil {\n\t\t\tlog.Infof(\"object already exists...\\n\")\n\t\t\tcontinue\n\t\t}\n\n\t\t// Post to create the resource.\n\t\tbody, err := json.Marshal(o)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trequest := restClient.Post().Resource(result.Resource).Body(body)\n\t\tif result.Scope.Name() == \"namespace\" {\n\t\t\trequest = request.Namespace(namespace)\n\t\t}\n\t\t_, err = request.DoRaw()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func IsValidNodeTopology(nodeTopology *v1alpha2.NodeResourceTopology, kubeletConfig *kubeletconfig.KubeletConfiguration) bool {\n\tif nodeTopology == nil || len(nodeTopology.TopologyPolicies) == 0 {\n\t\tframework.Logf(\"failed to get topology policy from the node topology resource\")\n\t\treturn false\n\t}\n\n\ttmPolicy := string(topologypolicy.DetectTopologyPolicy(kubeletConfig.TopologyManagerPolicy, kubeletConfig.TopologyManagerScope))\n\tif nodeTopology.TopologyPolicies[0] != tmPolicy {\n\t\tframework.Logf(\"topology policy mismatch got %q expected %q\", nodeTopology.TopologyPolicies[0], tmPolicy)\n\t\treturn false\n\t}\n\n\texpectedPolicyAttribute := v1alpha2.AttributeInfo{\n\t\tName: nfdtopologyupdater.TopologyManagerPolicyAttributeName,\n\t\tValue: kubeletConfig.TopologyManagerPolicy,\n\t}\n\tif !containsAttribute(nodeTopology.Attributes, expectedPolicyAttribute) {\n\t\tframework.Logf(\"topology policy attributes don't have correct topologyManagerPolicy attribute expected %v attributeList %v\", expectedPolicyAttribute, nodeTopology.Attributes)\n\t\treturn false\n\t}\n\n\texpectedScopeAttribute := v1alpha2.AttributeInfo{\n\t\tName: nfdtopologyupdater.TopologyManagerScopeAttributeName,\n\t\tValue: kubeletConfig.TopologyManagerScope,\n\t}\n\tif !containsAttribute(nodeTopology.Attributes, expectedScopeAttribute) {\n\t\tframework.Logf(\"topology policy attributes don't have correct topologyManagerScope attribute expected %v attributeList %v\", expectedScopeAttribute, nodeTopology.Attributes)\n\t\treturn false\n\t}\n\n\tif nodeTopology.Zones == nil || len(nodeTopology.Zones) == 0 {\n\t\tframework.Logf(\"failed to get topology zones from the node topology resource\")\n\t\treturn false\n\t}\n\n\tfoundNodes := 0\n\tfor _, zone := range nodeTopology.Zones {\n\t\t// TODO constant not in the APIs\n\t\tif !strings.HasPrefix(strings.ToUpper(zone.Type), \"NODE\") {\n\t\t\tcontinue\n\t\t}\n\t\tfoundNodes++\n\n\t\tif !isValidCostList(zone.Name, zone.Costs) {\n\t\t\tframework.Logf(\"invalid cost list for zone %q\", zone.Name)\n\t\t\treturn false\n\t\t}\n\n\t\tif !isValidResourceList(zone.Name, zone.Resources) {\n\t\t\tframework.Logf(\"invalid resource list for zone %q\", zone.Name)\n\t\t\treturn false\n\t\t}\n\t}\n\treturn foundNodes > 0\n}", "func GetNodeTypeInterface(nodeIndex int, node v1alpha1.ElasticsearchNode, cluster *v1alpha1.Elasticsearch) []NodeTypeInterface {\n\n\tnodes := []NodeTypeInterface{}\n\n\troleMap := getNodeRoleMap(node)\n\n\t// common spec => cluster.Spec.Spec\n\tnodeName := fmt.Sprintf(\"%s-%s\", cluster.Name, getNodeSuffix(nodeIndex, roleMap))\n\n\t// if we have a data node then we need to create one deployment per replica\n\tif isDataNode(node) {\n\t\t// for loop from 1 to replica as replicaIndex\n\t\t// it is 1 instead of 0 because of legacy code\n\t\tfor replicaIndex := int32(1); replicaIndex <= node.NodeCount; replicaIndex++ {\n\t\t\tdataNodeName := addDataNodeSuffix(nodeName, replicaIndex)\n\t\t\tnode := newDeploymentNode(dataNodeName, node, cluster, roleMap)\n\t\t\tnodes = append(nodes, node)\n\t\t}\n\t} else {\n\t\tnode := newStatefulSetNode(nodeName, node, cluster, roleMap)\n\t\tnodes = append(nodes, node)\n\t}\n\n\treturn nodes\n}", "func makeNodesReconciler(cniConfigWriter *CNIConfigWriter, hostIP string) func(*corev1.NodeList) error {\n\t// reconciles a node\n\treconcileNode := func(node corev1.Node) error {\n\t\t// first get this node's IP\n\t\tnodeIP := internalIP(node)\n\t\tfmt.Printf(\"Handling node with IP: %s\\n\", nodeIP)\n\n\t\t// This is our node. We don't need to add routes, but we might need to\n\t\t// update the cni config.\n\t\tif nodeIP == hostIP {\n\t\t\tfmt.Printf(\"handling current node\\n\")\n\t\t\t// compute the current cni config inputs\n\t\t\tif err := cniConfigWriter.Write(\n\t\t\t\tComputeCNIConfigInputs(node),\n\t\t\t); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// we're done handling this node\n\t\t\treturn nil\n\t\t}\n\n\t\t// don't do anything unless there is a PodCIDR\n\t\tpodCIDR := node.Spec.PodCIDR\n\t\tif podCIDR == \"\" {\n\t\t\tfmt.Printf(\"Node %v has no CIDR, ignoring\\n\", node.Name)\n\t\t\treturn nil\n\t\t}\n\n\t\t// parse subnet\n\t\tdst, err := netlink.ParseIPNet(podCIDR)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Printf(\"Node %v has CIDR %s \\n\", node.Name, podCIDR)\n\n\t\t// Check if the route exists to the other node's PodCIDR\n\t\tip := net.ParseIP(nodeIP)\n\t\trouteToDst := netlink.Route{Dst: dst, Gw: ip}\n\t\troute, err := netlink.RouteListFiltered(nl.GetIPFamily(ip), &routeToDst, netlink.RT_FILTER_DST)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Add route if not present\n\t\tif len(route) == 0 {\n\t\t\tif err := netlink.RouteAdd(&routeToDst); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfmt.Printf(\"Adding route %v \\n\", routeToDst)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\t// return a reconciler for all the nodes\n\treturn func(nodes *corev1.NodeList) error {\n\t\tfor _, node := range nodes.Items {\n\t\t\tif err := reconcileNode(node); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n}", "func (n *Namespace) CreateNode(backend Backend, node *Node) error {\n\n\t// ensure the namespace exists\n\terr := n.checkOrCreateNamespace(backend)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn node.JoinCluster(backend)\n}", "func GetResourceRequest(pod *v1.Pod) *schedulernodeinfo.Resource {\n\tresult := &schedulernodeinfo.Resource{}\n\tfor _, container := range pod.Spec.Containers {\n\t\tresult.Add(container.Resources.Requests)\n\t}\n\n\t// take max_resource(sum_pod, any_init_container)\n\tfor _, container := range pod.Spec.InitContainers {\n\t\tresult.SetMaxResource(container.Resources.Requests)\n\t}\n\n\t// If Overhead is being utilized, add to the total requests for the pod\n\tif pod.Spec.Overhead != nil && utilfeature.DefaultFeatureGate.Enabled(features.PodOverhead) {\n\t\tresult.Add(pod.Spec.Overhead)\n\t}\n\n\treturn result\n}", "func (c *nodes) Create(node *api.Node) (*api.Node, error) {\n\tresult := &api.Node{}\n\terr := c.r.Post().Resource(c.resourceName()).Body(node).Do().Into(result)\n\treturn result, err\n}", "func Create(kubeConfigFile string) (*kubernetes.Clientset, error) {\n\tkubeconfig, err := rest.InClusterConfig()\n\tif err != nil {\n\t\t// If not in cluster, use kube config file\n\t\tkubeconfig, err = clientcmd.BuildConfigFromFlags(\"\", kubeConfigFile)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn kubernetes.NewForConfig(kubeconfig)\n}", "func (d *DryccCmd) ResourcesCreate(appID, plan string, name string, params []string) error {\n\ts, appID, err := load(d.ConfigFile, appID)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.Printf(\"Creating %s to %s... \", name, appID)\n\n\tparamsMap, err := parseParams(params)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tquit := progress(d.WOut)\n\tresource := api.Resource{\n\t\tName: name,\n\t\tPlan: plan,\n\t\tOptions: paramsMap,\n\t}\n\t_, err = resources.Create(s.Client, appID, resource)\n\tquit <- true\n\t<-quit\n\tif d.checkAPICompatibility(s.Client, err) != nil {\n\t\treturn err\n\t}\n\n\td.Println(\"done\")\n\treturn nil\n}", "func getRandomNode(c *calcium, podname string) (*types.Node, error) {\n\tnodes, err := c.ListPodNodes(podname, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(nodes) == 0 {\n\t\treturn nil, fmt.Errorf(\"No nodes available in pod %s\", podname)\n\t}\n\n\tnodemap := make(map[string]types.CPUMap)\n\tfor _, n := range nodes {\n\t\tnodemap[n.Name] = n.CPU\n\t}\n\tnodename, err := c.scheduler.RandomNode(nodemap)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.GetNode(podname, nodename)\n}", "func Create(namespace string, resourceAndArgs ...string) (err error) {\n\tcreate := []string{\"create\", \"-n\", namespace}\n\t_, err = kubectl(append(create, resourceAndArgs...)...)\n\treturn\n}", "func (client RoverClusterClient) CreateRoverCluster(ctx context.Context, request CreateRoverClusterRequest) (response CreateRoverClusterResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.DefaultRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\n\tif !(request.OpcRetryToken != nil && *request.OpcRetryToken != \"\") {\n\t\trequest.OpcRetryToken = common.String(common.RetryToken())\n\t}\n\n\tociResponse, err = common.Retry(ctx, request, client.createRoverCluster, 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 = CreateRoverClusterResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = CreateRoverClusterResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(CreateRoverClusterResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into CreateRoverClusterResponse\")\n\t}\n\treturn\n}", "func (r *NodeReconciler) getNodeAffinity(node *ethereumv1alpha1.Node) *corev1.Affinity {\n\tif node.Spec.HighlyAvailable {\n\t\treturn &corev1.Affinity{\n\t\t\tPodAntiAffinity: &corev1.PodAntiAffinity{\n\t\t\t\tRequiredDuringSchedulingIgnoredDuringExecution: []corev1.PodAffinityTerm{\n\t\t\t\t\t{\n\t\t\t\t\t\tLabelSelector: &metav1.LabelSelector{\n\t\t\t\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\t\t\t\"name\": \"node\",\n\t\t\t\t\t\t\t\t\"network\": node.Name,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tTopologyKey: node.Spec.TopologyKey,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n\treturn nil\n}", "func (r *NodeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error) {\n\n\tvar node ethereumv1alpha1.Node\n\n\tif err = r.Client.Get(ctx, req.NamespacedName, &node); err != nil {\n\t\terr = client.IgnoreNotFound(err)\n\t\treturn\n\t}\n\n\t// default the node if webhooks are disabled\n\tif !shared.IsWebhookEnabled() {\n\t\tnode.Default()\n\t}\n\n\tr.updateLabels(&node)\n\tr.updateStaticNodes(&node)\n\n\tif err = r.reconcileNodeDataPVC(ctx, &node); err != nil {\n\t\treturn\n\t}\n\n\tif err = r.reconcileNodeConfigmap(ctx, &node); err != nil {\n\t\treturn\n\t}\n\n\tip, err := r.reconcileNodeService(ctx, &node)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif err = r.reconcileNodeStatefulSet(ctx, &node); err != nil {\n\t\treturn\n\t}\n\n\tif node.Spec.Nodekey == \"\" && node.Spec.Import == nil {\n\t\treturn\n\t}\n\n\tvar publicKey string\n\tif publicKey, err = r.reconcileNodeSecret(ctx, &node); err != nil {\n\t\treturn\n\t}\n\n\tif node.Spec.Bootnode != true {\n\t\treturn\n\t}\n\n\tenodeURL := fmt.Sprintf(\"enode://%s@%s:%d\", publicKey, ip, node.Spec.P2PPort)\n\n\tif err = r.updateStatus(ctx, &node, enodeURL); err != nil {\n\t\treturn\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func getNode(nd *wssdcloud.Node) *cloud.Node {\n\treturn &cloud.Node{\n\t\tName: &nd.Name,\n\t\tLocation: &nd.LocationName,\n\t\tNodeProperties: &cloud.NodeProperties{\n\t\t\tFQDN: &nd.Fqdn,\n\t\t\tPort: &nd.Port,\n\t\t\tAuthorizerPort: &nd.AuthorizerPort,\n\t\t\tCertificate: &nd.Certificate,\n\t\t\tStatuses: getNodeStatuses(nd),\n\t\t},\n\t\tVersion: &nd.Status.Version.Number,\n\t}\n}", "func (m *InstancesManager) CreateNode(obj *v2.CiliumNode, n *ipam.Node) ipam.NodeOperations {\n\treturn &Node{manager: m, node: n}\n}", "func computeClusterResources(nodes map[string]*repository.KubeNode) map[metrics.ResourceType]*repository.KubeDiscoveredResource {\n\t// sum the capacities of the node resources\n\tcomputeResources := make(map[metrics.ResourceType]float64)\n\tfor _, node := range nodes {\n\t\tnodeActive := util.NodeIsReady(node.Node) && util.NodeIsSchedulable(node.Node)\n\t\tif nodeActive {\n\t\t\t// Iterate over all ready and schedulable compute resource types\n\t\t\tfor _, rt := range metrics.KubeComputeResourceTypes {\n\t\t\t\t// get the compute resource if it exists\n\t\t\t\tnodeResource, exists := node.ComputeResources[rt]\n\t\t\t\tif !exists {\n\t\t\t\t\tglog.Errorf(\"Missing %s resource in node %s\", rt, node.Name)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// add the capacity to the cluster compute resource map\n\t\t\t\tcomputeCap, exists := computeResources[rt]\n\t\t\t\tif !exists {\n\t\t\t\t\tcomputeCap = nodeResource.Capacity\n\t\t\t\t} else {\n\t\t\t\t\tcomputeCap = computeCap + nodeResource.Capacity\n\t\t\t\t}\n\t\t\t\tcomputeResources[rt] = computeCap\n\t\t\t}\n\t\t}\n\t}\n\n\t// create KubeDiscoveredResource object for each compute resource type\n\tclusterResources := make(map[metrics.ResourceType]*repository.KubeDiscoveredResource)\n\tfor _, rt := range metrics.KubeComputeResourceTypes {\n\t\tcapacity := computeResources[rt]\n\t\tr := &repository.KubeDiscoveredResource{\n\t\t\tType: rt,\n\t\t\tCapacity: capacity,\n\t\t}\n\t\tclusterResources[rt] = r\n\t}\n\treturn clusterResources\n}", "func (w *ClusterDynamicClient) Create(obj *unstructured.Unstructured, options metav1.CreateOptions, subresources ...string) (*unstructured.Unstructured, error) {\n\treturn w.dClient.Resource(w.resource).Namespace(w.namespace).Create(w.ctx, obj, options, subresources...)\n}", "func (pub *Publisher) CreateNode(nodeHWID string, nodeType types.NodeType) *types.NodeDiscoveryMessage {\n\tnode := pub.registeredNodes.CreateNode(nodeHWID, nodeType)\n\treturn node\n}", "func CreateNodes(client *rancher.Client, rolesPerPool []string, quantityPerPool []int32) (ec2Nodes []*nodes.Node, err error) {\n\tec2Client, err := client.GetEC2Client()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trunningReservations := []*ec2.Reservation{}\n\treservationConfigs := []*rancherEc2.AWSEC2Config{}\n\t// provisioning instances in reverse order to allow windows instances time to become ready\n\tfor i := len(quantityPerPool) - 1; i >= 0; i-- {\n\t\tconfig := MatchRoleToConfig(rolesPerPool[i], ec2Client.ClientConfig.AWSEC2Config)\n\t\tif config == nil {\n\t\t\treturn nil, errors.New(\"No matching nodesAndRole for AWSEC2Config with role:\" + rolesPerPool[i])\n\t\t}\n\t\tsshName := getSSHKeyName(config.AWSSSHKeyName)\n\t\trunInstancesInput := &ec2.RunInstancesInput{\n\t\t\tImageId: aws.String(config.AWSAMI),\n\t\t\tInstanceType: aws.String(config.InstanceType),\n\t\t\tMinCount: aws.Int64(int64(quantityPerPool[i])),\n\t\t\tMaxCount: aws.Int64(int64(quantityPerPool[i])),\n\t\t\tKeyName: aws.String(sshName),\n\t\t\tBlockDeviceMappings: []*ec2.BlockDeviceMapping{\n\t\t\t\t{\n\t\t\t\t\tDeviceName: aws.String(\"/dev/sda1\"),\n\t\t\t\t\tEbs: &ec2.EbsBlockDevice{\n\t\t\t\t\t\tVolumeSize: aws.Int64(int64(config.VolumeSize)),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tIamInstanceProfile: &ec2.IamInstanceProfileSpecification{\n\t\t\t\tName: aws.String(config.AWSIAMProfile),\n\t\t\t},\n\t\t\tPlacement: &ec2.Placement{\n\t\t\t\tAvailabilityZone: aws.String(config.AWSRegionAZ),\n\t\t\t},\n\t\t\tNetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{\n\t\t\t\t{\n\t\t\t\t\tDeviceIndex: aws.Int64(0),\n\t\t\t\t\tAssociatePublicIpAddress: aws.Bool(true),\n\t\t\t\t\tGroups: aws.StringSlice(config.AWSSecurityGroups),\n\t\t\t\t},\n\t\t\t},\n\t\t\tTagSpecifications: []*ec2.TagSpecification{\n\t\t\t\t{\n\t\t\t\t\tResourceType: aws.String(\"instance\"),\n\t\t\t\t\tTags: []*ec2.Tag{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tKey: aws.String(\"Name\"),\n\t\t\t\t\t\t\tValue: aws.String(nodeBaseName),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tKey: aws.String(\"CICD\"),\n\t\t\t\t\t\t\tValue: aws.String(config.AWSCICDInstanceTag),\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\t\treservation, err := ec2Client.SVC.RunInstances(runInstancesInput)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// instead of waiting on each node pool to complete provisioning, add to a queue and check run status later\n\t\trunningReservations = append(runningReservations, reservation)\n\t\treservationConfigs = append(reservationConfigs, config)\n\t}\n\n\tfor i := 0; i < len(quantityPerPool); i++ {\n\t\tvar listOfInstanceIds []*string\n\n\t\tfor _, instance := range runningReservations[i].Instances {\n\t\t\tlistOfInstanceIds = append(listOfInstanceIds, instance.InstanceId)\n\t\t}\n\n\t\t//wait until instance is running\n\t\terr = ec2Client.SVC.WaitUntilInstanceRunning(&ec2.DescribeInstancesInput{\n\t\t\tInstanceIds: listOfInstanceIds,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t//wait until instance status is ok\n\t\terr = ec2Client.SVC.WaitUntilInstanceStatusOk(&ec2.DescribeInstanceStatusInput{\n\t\t\tInstanceIds: listOfInstanceIds,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// describe instance to get attributes\n\t\tdescribe, err := ec2Client.SVC.DescribeInstances(&ec2.DescribeInstancesInput{\n\t\t\tInstanceIds: listOfInstanceIds,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treadyInstances := describe.Reservations[0].Instances\n\n\t\tsshKey, err := nodes.GetSSHKey(reservationConfigs[i].AWSSSHKeyName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, readyInstance := range readyInstances {\n\t\t\tec2Node := &nodes.Node{\n\t\t\t\tNodeID: *readyInstance.InstanceId,\n\t\t\t\tPublicIPAddress: *readyInstance.PublicIpAddress,\n\t\t\t\tPrivateIPAddress: *readyInstance.PrivateIpAddress,\n\t\t\t\tSSHUser: reservationConfigs[i].AWSUser,\n\t\t\t\tSSHKey: sshKey,\n\t\t\t}\n\t\t\t// re-reverse the list so that the order is corrected\n\t\t\tec2Nodes = append([]*nodes.Node{ec2Node}, ec2Nodes...)\n\t\t}\n\t}\n\n\tclient.Session.RegisterCleanupFunc(func() error {\n\t\treturn DeleteNodes(client, ec2Nodes)\n\t})\n\n\treturn ec2Nodes, nil\n}", "func getNodeClient() corev1.NodeInterface {\n\tlog.Debug(\"Creating Node client.\")\n\treturn client.CoreV1().Nodes()\n}", "func (r *Resource) EnsureCreated(ctx context.Context, obj interface{}) error {\n\tcr, err := key.ToCustomResource(obj)\n\tif err != nil {\n\t\treturn microerror.Mask(err)\n\t}\n\n\tvar tcVnet network.VirtualNetwork\n\t{\n\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", fmt.Sprintf(\"Checking if TC virtual network %#q exists in resource group %#q\", key.VnetName(cr), key.ResourceGroupName(cr)))\n\n\t\tvirtualNetworksClient, err := r.clientFactory.GetVirtualNetworksClient(ctx, cr.ObjectMeta)\n\t\tif err != nil {\n\t\t\treturn microerror.Mask(err)\n\t\t}\n\n\t\ttcVnet, err = virtualNetworksClient.Get(ctx, key.ResourceGroupName(cr), key.VnetName(cr), \"\")\n\t\tif IsNotFound(err) {\n\t\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", \"TC Virtual network does not exist in resource group\")\n\t\t\treconciliationcanceledcontext.SetCanceled(ctx)\n\t\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", \"canceling reconciliation\")\n\t\t\treturn nil\n\t\t} else if err != nil {\n\t\t\treturn microerror.Mask(err)\n\t\t}\n\n\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", \"TC Virtual network exists in resource group\")\n\t}\n\n\tvar cpVnet network.VirtualNetwork\n\t{\n\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", fmt.Sprintf(\"Checking if CP virtual network %#q exists in resource group %#q\", r.mcVirtualNetworkName, r.mcResourceGroup))\n\n\t\tcpVnet, err = r.cpAzureClientSet.VirtualNetworkClient.Get(ctx, r.mcResourceGroup, r.mcVirtualNetworkName, \"\")\n\t\tif IsNotFound(err) {\n\t\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", \"CP Virtual network does not exist in resource group\")\n\t\t\treconciliationcanceledcontext.SetCanceled(ctx)\n\t\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", \"canceling reconciliation\")\n\t\t\treturn nil\n\t\t} else if err != nil {\n\t\t\treturn microerror.Mask(err)\n\t\t}\n\n\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", \"CP Virtual network exists\")\n\t}\n\n\t{\n\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", fmt.Sprintf(\"Ensuring vnet peering %#q exists on the tenant cluster vnet %#q in resource group %#q\", r.mcVirtualNetworkName, key.VnetName(cr), key.ResourceGroupName(cr)))\n\n\t\tvnetPeeringsClient, err := r.clientFactory.GetVnetPeeringsClient(ctx, cr.ObjectMeta)\n\t\tif err != nil {\n\t\t\treturn microerror.Mask(err)\n\t\t}\n\n\t\ttcPeering := r.getTCVnetPeering(*cpVnet.ID)\n\t\t_, err = vnetPeeringsClient.CreateOrUpdate(ctx, key.ResourceGroupName(cr), key.VnetName(cr), r.mcVirtualNetworkName, tcPeering)\n\t\tif err != nil {\n\t\t\treturn microerror.Mask(err)\n\t\t}\n\t}\n\n\t{\n\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", fmt.Sprintf(\"Ensuring vnet peering %#q exists on the control plane vnet %#q in resource group %#q\", key.ResourceGroupName(cr), r.mcVirtualNetworkName, r.mcResourceGroup))\n\t\tcpPeering := r.getCPVnetPeering(*tcVnet.ID)\n\t\t_, err = r.cpAzureClientSet.VnetPeeringClient.CreateOrUpdate(ctx, r.mcResourceGroup, r.mcVirtualNetworkName, key.ResourceGroupName(cr), cpPeering)\n\t\tif err != nil {\n\t\t\treturn microerror.Mask(err)\n\t\t}\n\t}\n\n\treturn nil\n}", "func CreatePodResourceRecommender() PodResourceRecommender {\n\ttargetCPUPercentile := 0.9\n\tlowerBoundCPUPercentile := 0.5\n\tupperBoundCPUPercentile := 0.95\n\n\ttargetMemoryPeaksPercentile := 0.9\n\tlowerBoundMemoryPeaksPercentile := 0.5\n\tupperBoundMemoryPeaksPercentile := 0.95\n\n\ttargetEstimator := NewPercentileEstimator(targetCPUPercentile, targetMemoryPeaksPercentile)\n\tlowerBoundEstimator := NewPercentileEstimator(lowerBoundCPUPercentile, lowerBoundMemoryPeaksPercentile)\n\tupperBoundEstimator := NewPercentileEstimator(upperBoundCPUPercentile, upperBoundMemoryPeaksPercentile)\n\n\ttargetEstimator = WithMargin(*safetyMarginFraction, targetEstimator)\n\tlowerBoundEstimator = WithMargin(*safetyMarginFraction, lowerBoundEstimator)\n\tupperBoundEstimator = WithMargin(*safetyMarginFraction, upperBoundEstimator)\n\n\t// Apply confidence multiplier to the upper bound estimator. This means\n\t// that the updater will be less eager to evict pods with short history\n\t// in order to reclaim unused resources.\n\t// Using the confidence multiplier 1 with exponent +1 means that\n\t// the upper bound is multiplied by (1 + 1/history-length-in-days).\n\t// See estimator.go to see how the history length and the confidence\n\t// multiplier are determined. The formula yields the following multipliers:\n\t// No history : *INF (do not force pod eviction)\n\t// 12h history : *3 (force pod eviction if the request is > 3 * upper bound)\n\t// 24h history : *2\n\t// 1 week history : *1.14\n\tupperBoundEstimator = WithConfidenceMultiplier(1.0, 1.0, upperBoundEstimator)\n\n\t// Apply confidence multiplier to the lower bound estimator. This means\n\t// that the updater will be less eager to evict pods with short history\n\t// in order to provision them with more resources.\n\t// Using the confidence multiplier 0.001 with exponent -2 means that\n\t// the lower bound is multiplied by the factor (1 + 0.001/history-length-in-days)^-2\n\t// (which is very rapidly converging to 1.0).\n\t// See estimator.go to see how the history length and the confidence\n\t// multiplier are determined. The formula yields the following multipliers:\n\t// No history : *0 (do not force pod eviction)\n\t// 5m history : *0.6 (force pod eviction if the request is < 0.6 * lower bound)\n\t// 30m history : *0.9\n\t// 60m history : *0.95\n\tlowerBoundEstimator = WithConfidenceMultiplier(0.001, -2.0, lowerBoundEstimator)\n\n\treturn &podResourceRecommender{\n\t\ttargetEstimator,\n\t\tlowerBoundEstimator,\n\t\tupperBoundEstimator}\n}", "func CreateResource(clientset apiextcs.Interface) error {\n\tresource := &apiextv1beta1.CustomResourceDefinition{\n\t\tObjectMeta: meta_v1.ObjectMeta{Name: ResourcePlural + \".\" + ResourceGroup},\n\t\tSpec: apiextv1beta1.CustomResourceDefinitionSpec{\n\t\t\tGroup: ResourceGroup,\n\t\t\tVersion: ResourceVersion,\n\t\t\tScope: apiextv1beta1.NamespaceScoped,\n\t\t\tNames: apiextv1beta1.CustomResourceDefinitionNames{\n\t\t\t\tPlural: ResourcePlural,\n\t\t\t\tKind: reflect.TypeOf(Resource{}).Name(),\n\t\t\t},\n\t\t},\n\t}\n\n\t_, err := clientset.ApiextensionsV1beta1().CustomResourceDefinitions().Create(resource)\n\tif err != nil && apierrors.IsAlreadyExists(err) {\n\t\treturn nil\n\t}\n\treturn err\n\n\t// TODO: add logic to wait for creation and exception handling\n}", "func createCRD(apiclient apiextensionsclient.Interface, resource CustomResource) error {\n\tcrdName := fmt.Sprintf(\"%s.%s\", resource.Plural, resource.Group)\n\tcrd := &apiextensionsv1beta1.CustomResourceDefinition{\n\t\tObjectMeta: metav1.ObjectMeta{Name: crdName},\n\t\tSpec: apiextensionsv1beta1.CustomResourceDefinitionSpec{\n\t\t\tGroup: resource.Group,\n\t\t\tVersion: resource.Version,\n\t\t\tScope: resource.Scope,\n\t\t\tNames: apiextensionsv1beta1.CustomResourceDefinitionNames{\n\t\t\t\tSingular: resource.Name,\n\t\t\t\tPlural: resource.Plural,\n\t\t\t\tKind: resource.Kind,\n\t\t\t\tShortNames: resource.ShortNames,\n\t\t\t},\n\t\t},\n\t}\n\n\t_, err := apiclient.ApiextensionsV1beta1().CustomResourceDefinitions().Create(crd)\n\tif err != nil {\n\t\tif !errors.IsAlreadyExists(err) {\n\t\t\treturn fmt.Errorf(\"failed to create %s CRD. %+v\", resource.Name, err)\n\t\t}\n\t}\n\treturn nil\n}", "func resourceVolterraNetworkPolicyRuleCreate(d *schema.ResourceData, meta interface{}) error {\n\tclient := meta.(*APIClient)\n\n\tcreateMeta := &ves_io_schema.ObjectCreateMetaType{}\n\tcreateSpec := &ves_io_schema_network_policy_rule.CreateSpecType{}\n\tcreateReq := &ves_io_schema_network_policy_rule.CreateRequest{\n\t\tMetadata: createMeta,\n\t\tSpec: createSpec,\n\t}\n\n\tif v, ok := d.GetOk(\"annotations\"); ok && !isIntfNil(v) {\n\n\t\tms := map[string]string{}\n\n\t\tfor k, v := range v.(map[string]interface{}) {\n\t\t\tval := v.(string)\n\t\t\tms[k] = val\n\t\t}\n\t\tcreateMeta.Annotations = ms\n\t}\n\n\tif v, ok := d.GetOk(\"description\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Description =\n\t\t\tv.(string)\n\t}\n\n\tif v, ok := d.GetOk(\"disable\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Disable =\n\t\t\tv.(bool)\n\t}\n\n\tif v, ok := d.GetOk(\"labels\"); ok && !isIntfNil(v) {\n\n\t\tms := map[string]string{}\n\n\t\tfor k, v := range v.(map[string]interface{}) {\n\t\t\tval := v.(string)\n\t\t\tms[k] = val\n\t\t}\n\t\tcreateMeta.Labels = ms\n\t}\n\n\tif v, ok := d.GetOk(\"name\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Name =\n\t\t\tv.(string)\n\t}\n\n\tif v, ok := d.GetOk(\"namespace\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Namespace =\n\t\t\tv.(string)\n\t}\n\n\t//action\n\tif v, ok := d.GetOk(\"action\"); ok && !isIntfNil(v) {\n\n\t\tcreateSpec.Action = ves_io_schema_network_policy_rule.NetworkPolicyRuleAction(ves_io_schema_network_policy_rule.NetworkPolicyRuleAction_value[v.(string)])\n\n\t}\n\n\t//advanced_action\n\tif v, ok := d.GetOk(\"advanced_action\"); ok && !isIntfNil(v) {\n\n\t\tsl := v.(*schema.Set).List()\n\t\tadvancedAction := &ves_io_schema_network_policy_rule.NetworkPolicyRuleAdvancedAction{}\n\t\tcreateSpec.AdvancedAction = advancedAction\n\t\tfor _, set := range sl {\n\t\t\tadvancedActionMapStrToI := set.(map[string]interface{})\n\n\t\t\tif v, ok := advancedActionMapStrToI[\"action\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tadvancedAction.Action = ves_io_schema_network_policy_rule.LogAction(ves_io_schema_network_policy_rule.LogAction_value[v.(string)])\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t//label_matcher\n\tif v, ok := d.GetOk(\"label_matcher\"); ok && !isIntfNil(v) {\n\n\t\tsl := v.(*schema.Set).List()\n\t\tlabelMatcher := &ves_io_schema.LabelMatcherType{}\n\t\tcreateSpec.LabelMatcher = labelMatcher\n\t\tfor _, set := range sl {\n\t\t\tlabelMatcherMapStrToI := set.(map[string]interface{})\n\n\t\t\tif w, ok := labelMatcherMapStrToI[\"keys\"]; ok && !isIntfNil(w) {\n\t\t\t\tls := make([]string, len(w.([]interface{})))\n\t\t\t\tfor i, v := range w.([]interface{}) {\n\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t}\n\t\t\t\tlabelMatcher.Keys = ls\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t//ports\n\tif v, ok := d.GetOk(\"ports\"); ok && !isIntfNil(v) {\n\n\t\tls := make([]string, len(v.([]interface{})))\n\t\tfor i, v := range v.([]interface{}) {\n\t\t\tls[i] = v.(string)\n\t\t}\n\t\tcreateSpec.Ports = ls\n\n\t}\n\n\t//protocol\n\tif v, ok := d.GetOk(\"protocol\"); ok && !isIntfNil(v) {\n\n\t\tcreateSpec.Protocol =\n\t\t\tv.(string)\n\n\t}\n\n\t//remote_endpoint\n\n\tremoteEndpointTypeFound := false\n\n\tif v, ok := d.GetOk(\"ip_prefix_set\"); ok && !remoteEndpointTypeFound {\n\n\t\tremoteEndpointTypeFound = true\n\t\tremoteEndpointInt := &ves_io_schema_network_policy_rule.CreateSpecType_IpPrefixSet{}\n\t\tremoteEndpointInt.IpPrefixSet = &ves_io_schema.IpPrefixSetRefType{}\n\t\tcreateSpec.RemoteEndpoint = remoteEndpointInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tif v, ok := cs[\"ref\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.([]interface{})\n\t\t\t\trefInt := make([]*ves_io_schema.ObjectRefType, len(sl))\n\t\t\t\tremoteEndpointInt.IpPrefixSet.Ref = refInt\n\t\t\t\tfor i, ps := range sl {\n\n\t\t\t\t\trMapToStrVal := ps.(map[string]interface{})\n\t\t\t\t\trefInt[i] = &ves_io_schema.ObjectRefType{}\n\n\t\t\t\t\trefInt[i].Kind = \"ip_prefix_set\"\n\n\t\t\t\t\tif v, ok := rMapToStrVal[\"name\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\trefInt[i].Name = v.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rMapToStrVal[\"namespace\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\trefInt[i].Namespace = v.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rMapToStrVal[\"tenant\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\trefInt[i].Tenant = v.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rMapToStrVal[\"uid\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\trefInt[i].Uid = v.(string)\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"prefix\"); ok && !remoteEndpointTypeFound {\n\n\t\tremoteEndpointTypeFound = true\n\t\tremoteEndpointInt := &ves_io_schema_network_policy_rule.CreateSpecType_Prefix{}\n\t\tremoteEndpointInt.Prefix = &ves_io_schema.PrefixListType{}\n\t\tcreateSpec.RemoteEndpoint = remoteEndpointInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tif v, ok := cs[\"ipv6_prefix\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t}\n\t\t\t\tremoteEndpointInt.Prefix.Ipv6Prefix = ls\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"prefix\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t}\n\t\t\t\tremoteEndpointInt.Prefix.Prefix = ls\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"prefix_selector\"); ok && !remoteEndpointTypeFound {\n\n\t\tremoteEndpointTypeFound = true\n\t\tremoteEndpointInt := &ves_io_schema_network_policy_rule.CreateSpecType_PrefixSelector{}\n\t\tremoteEndpointInt.PrefixSelector = &ves_io_schema.LabelSelectorType{}\n\t\tcreateSpec.RemoteEndpoint = remoteEndpointInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tif v, ok := cs[\"expressions\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t}\n\t\t\t\tremoteEndpointInt.PrefixSelector.Expressions = ls\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tlog.Printf(\"[DEBUG] Creating Volterra NetworkPolicyRule object with struct: %+v\", createReq)\n\n\tcreateNetworkPolicyRuleResp, err := client.CreateObject(context.Background(), ves_io_schema_network_policy_rule.ObjectType, createReq)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating NetworkPolicyRule: %s\", err)\n\t}\n\td.SetId(createNetworkPolicyRuleResp.GetObjSystemMetadata().GetUid())\n\n\treturn resourceVolterraNetworkPolicyRuleRead(d, meta)\n}", "func (ac *AWSCluster) CreateAWSKubernetesCluster() {\n\tsess := session.Must(session.NewSession())\n\tiamClient := iam.New(sess)\n\teksClient := eks.New(sess)\n\tcfClient := cloudformation.New(sess)\n\tec2Client := ec2.New(sess)\n\n\t// Creating Amazon EKS Role\n\teksRoleName := awsRolePrefix + ac.serviceSuffix\n\teksRoleArn := ac.createEksRole(iamClient, &eksRoleName)\n\n\t// Creating Amazon EKS Cluster VPC\n\tclusterStackName := awsClusterStackPrefix + ac.serviceSuffix\n\tclusterStackOutputs := ac.createEksClusterVpc(cfClient, &clusterStackName)\n\n\t// Creating Amazon EKS Cluster\n\tclusterName := awsClusterPrefix + ac.serviceSuffix\n\tcluster := ac.createEksCluster(eksClient, &clusterName, eksRoleArn, clusterStackOutputs)\n\n\t// Creating kubeconfig file\n\tac.createKubeConfigFile(cluster)\n\n\t// Creating Amazon EKS Worker Nodes\n\tkeyPairName := awsKeyPairPrefix + ac.serviceSuffix\n\tac.createEksEc2KeyPair(ec2Client, &keyPairName)\n\n\tnodesStackName := awsNodesStackPrefix + ac.serviceSuffix\n\tnodeGroupName := awsNodeGroupPrefix + ac.serviceSuffix\n\tnodeSequrityGroup, nodeInstanceRole := ac.createEksWorkerNodes(cfClient, &nodesStackName, &nodeGroupName, &clusterName, &keyPairName, clusterStackOutputs)\n\n\tac.authorizeSecurityGroupIngress(ec2Client, nodeSequrityGroup)\n\n\t// Enable worker nodes to join the cluster\n\tsf, err := ioutil.ReadFile(path.Join(ac.configPath, \"aws-auth-cm-temp.yaml\"))\n\tac.checkError(err)\n\n\tf, err := ioutil.TempFile(os.TempDir(), \"aws-auth-cm-temp-*.yaml\")\n\tac.checkError(err)\n\n\ts := string(sf)\n\t_, err = f.Write([]byte(strings.Replace(s, \"<NodeInstanceRole>\", *nodeInstanceRole, -1)))\n\tac.checkError(err)\n\n\t_ = f.Close()\n\n\tac.execCommand(\"kubectl\", \"apply\", \"-f\", f.Name())\n\t_ = os.Remove(f.Name())\n\n\tac.createSSHConfig(ec2Client, clusterStackOutputs.VpcId, \"scp-config\"+ac.serviceSuffix)\n\n\tac.execCommand(\"kubectl\", \"apply\", \"-f\", \"aws-k8s-cni.yaml\")\n}", "func (s *K8sSvc) CreateReplicaSet(ctx context.Context, opts *containersvc.CreateServiceOptions) error {\n\trequuid := utils.GetReqIDFromContext(ctx)\n\n\t// set replicaset resource limits and requests\n\tres := s.createResource(opts)\n\tglog.Infoln(\"create replicaset resource\", res, \"requuid\", requuid, opts.Common)\n\n\t// set env\n\tenvs := make([]corev1.EnvVar, len(opts.Envkvs))\n\tfor i, e := range opts.Envkvs {\n\t\tenvs[i] = corev1.EnvVar{\n\t\t\tName: e.Name,\n\t\t\tValue: e.Value,\n\t\t}\n\t}\n\n\tlabels := make(map[string]string)\n\tlabels[serviceNameLabel] = opts.Common.ServiceName\n\tlabels[serviceUUIDLabel] = opts.Common.ServiceUUID\n\n\treplicaset := &appsv1.ReplicaSet{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: opts.Common.ServiceName,\n\t\t\tNamespace: s.namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: appsv1.ReplicaSetSpec{\n\t\t\tReplicas: utils.Int32Ptr(int32(opts.Replicas)),\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: labels,\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tNamespace: s.namespace,\n\t\t\t\t\tLabels: labels,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: opts.Common.ServiceName,\n\t\t\t\t\t\t\tImage: opts.Common.ContainerImage,\n\t\t\t\t\t\t\tResources: res,\n\t\t\t\t\t\t\tImagePullPolicy: corev1.PullAlways,\n\t\t\t\t\t\t\tEnv: envs,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tRestartPolicy: corev1.RestartPolicyAlways,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\t// set port exposing\n\tif len(opts.PortMappings) != 0 {\n\t\tglog.Infoln(\"expose port\", opts.PortMappings, \"requuid\", requuid, opts.Common)\n\n\t\tports := make([]corev1.ContainerPort, len(opts.PortMappings))\n\t\tfor i, p := range opts.PortMappings {\n\t\t\tports[i] = corev1.ContainerPort{\n\t\t\t\tContainerPort: int32(p.ContainerPort),\n\t\t\t}\n\t\t\tif opts.ExternalDNS {\n\t\t\t\t// TODO current needs to expose the host port for ExternalDNS, so replicas could talk with each other.\n\t\t\t\t// refactor it when using the k8s external dns project.\n\t\t\t\tports[i].HostPort = int32(p.HostPort)\n\t\t\t}\n\t\t}\n\n\t\treplicaset.Spec.Template.Spec.Containers[0].Ports = ports\n\n\t\t// use host network by default for better performance.\n\t\t// k8s requires \"If this option is set, the ports that will be used must be specified.\"\n\t\treplicaset.Spec.Template.Spec.HostNetwork = true\n\t}\n\n\t_, err := s.cliset.AppsV1beta2().ReplicaSets(s.namespace).Create(replicaset)\n\treturn err\n}", "func Create(ctx context.Context, client *v1.ServiceClient, clusterID string, opts *CreateOpts) (*v1.ResponseResult, error) {\n\tcreateNodegroupOpts := struct {\n\t\tNodegroup *CreateOpts `json:\"nodegroup\"`\n\t}{\n\t\tNodegroup: opts,\n\t}\n\trequestBody, err := json.Marshal(createNodegroupOpts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\turl := strings.Join([]string{client.Endpoint, v1.ResourceURLCluster, clusterID, v1.ResourceURLNodegroup}, \"/\")\n\tresponseResult, err := client.DoRequest(ctx, http.MethodPost, url, bytes.NewReader(requestBody))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif responseResult.Err != nil {\n\t\terr = responseResult.Err\n\t}\n\n\treturn responseResult, err\n}", "func (sm *Statemgr) CreateNode(node *cluster.Node) (*NodeState, error) {\n\t// see if we already have it\n\tehs, err := sm.FindNode(node.ObjectMeta.Name)\n\tif err == nil {\n\t\t// Object exists in cache, but we got a watcher event with event-type:Created\n\t\t// and this can happen if there is a watcher error/reset and we need to update\n\t\t// the cache to handle it gracefully as an Update.\n\t\tlog.Infof(\"Objects exists, updating Node OldState: {%+v}. New state: {%+v}\", ehs, node)\n\t\tehs.Lock()\n\t\tdefer ehs.Unlock()\n\t\treturn ehs, sm.UpdateNode(node, false)\n\t}\n\n\t// create new Node state\n\tnodeState, err := NewNodeState(node)\n\tif err != nil {\n\t\tlog.Errorf(\"Error creating new Node state. Err: %v\", err)\n\t\treturn nil, err\n\t}\n\n\t// store it in local DB\n\terr = sm.memDB.AddObject(nodeState)\n\tif err != nil {\n\t\tlog.Errorf(\"Error storing the Node state in memdb. Err: %v\", err)\n\t\treturn nil, err\n\t}\n\n\t// Node creates are never written back to ApiServer\n\tlog.Infof(\"Created Node state {%+v}\", node.ObjectMeta)\n\treturn nodeState, nil\n}", "func (az *Cloud) GetNodeResourceGroup(nodeName string) (string, error) {\n\t// Kubelet won't set az.nodeInformerSynced, always return configured resourceGroup.\n\tif az.nodeInformerSynced == nil {\n\t\treturn az.ResourceGroup, nil\n\t}\n\n\taz.nodeCachesLock.RLock()\n\tdefer az.nodeCachesLock.RUnlock()\n\tif !az.nodeInformerSynced() {\n\t\treturn \"\", fmt.Errorf(\"node informer is not synced when trying to GetNodeResourceGroup\")\n\t}\n\n\t// Return external resource group if it has been cached.\n\tif cachedRG, ok := az.nodeResourceGroups[nodeName]; ok {\n\t\treturn cachedRG, nil\n\t}\n\n\t// Return resource group from cloud provider options.\n\treturn az.ResourceGroup, nil\n}", "func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error) {\n\tlistenersToNotify := []nodeNetworkConfigListener{}\n\tnnc, err := r.nnccli.Get(ctx, req.NamespacedName)\n\tif err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\tlogger.Printf(\"[cns-rc] CRD not found, ignoring %v\", err)\n\t\t\treturn reconcile.Result{}, errors.Wrapf(client.IgnoreNotFound(err), \"NodeNetworkConfig %v not found\", req.NamespacedName)\n\t\t}\n\t\tlogger.Errorf(\"[cns-rc] Error retrieving CRD from cache : %v\", err)\n\t\treturn reconcile.Result{}, errors.Wrapf(err, \"failed to get NodeNetworkConfig %v\", req.NamespacedName)\n\t}\n\n\tlogger.Printf(\"[cns-rc] CRD Spec: %+v\", nnc.Spec)\n\n\tipAssignments := 0\n\n\t// for each NC, parse it in to a CreateNCRequest and forward it to the appropriate Listener\n\tfor i := range nnc.Status.NetworkContainers {\n\t\t// check if this NC matches the Node IP if we have one to check against\n\t\tif r.nodeIP != \"\" {\n\t\t\tif r.nodeIP != nnc.Status.NetworkContainers[i].NodeIP {\n\t\t\t\t// skip this NC since it was created for a different node\n\t\t\t\tlogger.Printf(\"[cns-rc] skipping network container %s found in NNC because node IP doesn't match, got %s, expected %s\",\n\t\t\t\t\tnnc.Status.NetworkContainers[i].ID, nnc.Status.NetworkContainers[i].NodeIP, r.nodeIP)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tvar req *cns.CreateNetworkContainerRequest\n\t\tvar err error\n\t\tswitch nnc.Status.NetworkContainers[i].AssignmentMode { //nolint:exhaustive // skipping dynamic case\n\t\t// For Overlay and Vnet Scale Scenarios\n\t\tcase v1alpha.Static:\n\t\t\treq, err = CreateNCRequestFromStaticNC(nnc.Status.NetworkContainers[i])\n\t\t// For Pod Subnet scenario\n\t\tdefault: // For backward compatibility, default will be treated as Dynamic too.\n\t\t\treq, err = CreateNCRequestFromDynamicNC(nnc.Status.NetworkContainers[i])\n\t\t\t// in dynamic, we will also push this NNC to the IPAM Pool Monitor when we're done.\n\t\t\tlistenersToNotify = append(listenersToNotify, r.ipampoolmonitorcli)\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"[cns-rc] failed to generate CreateNCRequest from NC: %v, assignmentMode %s\", err,\n\t\t\t\tnnc.Status.NetworkContainers[i].AssignmentMode)\n\t\t\treturn reconcile.Result{}, errors.Wrapf(err, \"failed to generate CreateNCRequest from NC \"+\n\t\t\t\t\"assignmentMode %s\", nnc.Status.NetworkContainers[i].AssignmentMode)\n\t\t}\n\n\t\tresponseCode := r.cnscli.CreateOrUpdateNetworkContainerInternal(req)\n\t\tif err := restserver.ResponseCodeToError(responseCode); err != nil {\n\t\t\tlogger.Errorf(\"[cns-rc] Error creating or updating NC in reconcile: %v\", err)\n\t\t\treturn reconcile.Result{}, errors.Wrap(err, \"failed to create or update network container\")\n\t\t}\n\t\tipAssignments += len(req.SecondaryIPConfigs)\n\t}\n\n\t// record assigned IPs metric\n\tallocatedIPs.Set(float64(ipAssignments))\n\n\t// push the NNC to the registered NNC listeners.\n\tfor _, l := range listenersToNotify {\n\t\tif err := l.Update(nnc); err != nil {\n\t\t\treturn reconcile.Result{}, errors.Wrap(err, \"nnc listener return error during update\")\n\t\t}\n\t}\n\n\t// we have received and pushed an NNC update, we are \"Started\"\n\tr.once.Do(func() {\n\t\tclose(r.started)\n\t\tlogger.Printf(\"[cns-rc] CNS NNC Reconciler Started\")\n\t})\n\treturn reconcile.Result{}, nil\n}", "func (ph *phaseHandler) createResource(sso *v1alpha1.Keycloak, resourceName string) (bool, error) {\n\tkc := sso.DeepCopy()\n\tresourceHelper := newResourceHelper(kc)\n\tresource, err := resourceHelper.createResource(resourceName)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tgvk := resource.GetObjectKind().GroupVersionKind()\n\tapiVersion, kind := gvk.ToAPIVersionAndKind()\n\tresourceClient, _, err := ph.dynamicResourceClientFactory(apiVersion, kind, kc.Namespace)\n\tif err != nil {\n\t\t// The resource cannot be created because the CRD is not installed in the cluster.\n\t\t// We can try again later.\n\t\treturn false, nil\n\t}\n\n\tresource, err = resourceClient.Create(resource)\n\tif err != nil && !errors2.IsAlreadyExists(err) {\n\t\treturn false, errors.Wrap(err, \"failed to create unstructured object\")\n\t}\n\n\treturn true, nil\n}", "func getRCWithInterPodAffinityNodeSelector(name string, labelsMap map[string]string, replica int, affinity *v1.Affinity, image string, nodeSelector map[string]string) *v1.ReplicationController {\n\treplicaInt32 := int32(replica)\n\treturn &v1.ReplicationController{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t},\n\t\tSpec: v1.ReplicationControllerSpec{\n\t\t\tReplicas: &replicaInt32,\n\t\t\tSelector: labelsMap,\n\t\t\tTemplate: &v1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: labelsMap,\n\t\t\t\t},\n\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\tAffinity: affinity,\n\t\t\t\t\tContainers: []v1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: name,\n\t\t\t\t\t\t\tImage: image,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tDNSPolicy: v1.DNSDefault,\n\t\t\t\t\tNodeSelector: nodeSelector,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "func GetNodePoolTemplate() (string, error) {\n\treturn internalcloudformation.GetCloudFormationTemplate(\n\t\tglobal.Config.Distribution.EKS.TemplateLocation, eksNodePoolTemplateName,\n\t)\n}", "func (a *ConfluentCloudApi) CreateConfluentResource(ctx _context.Context, accountId string, body ConfluentResourceRequest) (ConfluentResourceResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarReturnValue ConfluentResourceResponse\n\t)\n\n\tlocalBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, \"v2.ConfluentCloudApi.CreateConfluentResource\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v2/integrations/confluent-cloud/accounts/{account_id}/resources\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"account_id\"+\"}\", _neturl.PathEscape(datadog.ParameterToString(accountId, \"\")), -1)\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 == 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}", "func (client OpenShiftManagedClustersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters v20180930preview.OpenShiftManagedCluster) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"resourceName\": autorest.Encode(\"path\", resourceName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": v20180930preview.APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "func (c *APIGateway) CreateResourceRequest(input *CreateResourceInput) (req *request.Request, output *Resource) {\n\top := &request.Operation{\n\t\tName: opCreateResource,\n\t\tHTTPMethod: \"POST\",\n\t\tHTTPPath: \"/restapis/{restapi_id}/resources/{parent_id}\",\n\t}\n\n\tif input == nil {\n\t\tinput = &CreateResourceInput{}\n\t}\n\n\treq = c.newRequest(op, input, output)\n\toutput = &Resource{}\n\treq.Data = output\n\treturn\n}", "func (r *Resource) createReadAllClusterRole(ctx context.Context) error {\n\n\tlists, err := r.K8sClient().Discovery().ServerPreferredResources()\n\tif err != nil {\n\t\treturn microerror.Mask(err)\n\t}\n\n\tvar policyRules []rbacv1.PolicyRule\n\t{\n\t\tfor _, list := range lists {\n\t\t\tif len(list.APIResources) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tgv, err := schema.ParseGroupVersion(list.GroupVersion)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, resource := range list.APIResources {\n\t\t\t\tif len(resource.Verbs) == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif isRestrictedResource(resource.Name) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tpolicyRule := rbacv1.PolicyRule{\n\t\t\t\t\tAPIGroups: []string{gv.Group},\n\t\t\t\t\tResources: []string{resource.Name},\n\t\t\t\t\tVerbs: []string{\"get\", \"list\", \"watch\"},\n\t\t\t\t}\n\t\t\t\tpolicyRules = append(policyRules, policyRule)\n\t\t\t}\n\t\t}\n\t}\n\n\t// ServerPreferredResources explicitely ignores any resource containing a '/'\n\t// but we require this for enabling pods/logs for customer access to\n\t// kubernetes pod logging. This is appended as a specific rule instead.\n\tpolicyRule := rbacv1.PolicyRule{\n\t\tAPIGroups: []string{\"\"},\n\t\tResources: []string{\"pods/log\"},\n\t\tVerbs: []string{\"get\", \"list\"},\n\t}\n\tpolicyRules = append(policyRules, policyRule)\n\n\treadOnlyClusterRole := &rbacv1.ClusterRole{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: pkgkey.DefaultReadAllPermissionsName,\n\t\t\tLabels: map[string]string{\n\t\t\t\tlabel.ManagedBy: project.Name(),\n\t\t\t\tlabel.DisplayInUserInterface: \"true\",\n\t\t\t},\n\t\t\tAnnotations: map[string]string{\n\t\t\t\tannotation.Notes: \"Grants read-only (get, list, watch) permissions to almost all resource types known on the management cluster, with exception of ConfigMap and Secret.\",\n\t\t\t},\n\t\t},\n\t\tRules: policyRules,\n\t}\n\n\treturn rbac.CreateOrUpdateClusterRole(r, ctx, readOnlyClusterRole)\n}" ]
[ "0.76723534", "0.56957585", "0.5255607", "0.52420557", "0.5161676", "0.51323014", "0.51153105", "0.5114872", "0.51094985", "0.50911283", "0.50660753", "0.5031809", "0.50017095", "0.49854472", "0.49768355", "0.49335805", "0.49045685", "0.48949906", "0.48829058", "0.4836229", "0.47845647", "0.47814444", "0.4772862", "0.47690067", "0.4766219", "0.47438952", "0.46845406", "0.46693474", "0.46602583", "0.4656761", "0.46531802", "0.46361092", "0.46097073", "0.45974606", "0.45932958", "0.45862812", "0.45681697", "0.4563888", "0.4553754", "0.4533314", "0.4530141", "0.45221964", "0.45202425", "0.45173743", "0.45150152", "0.45090434", "0.4504507", "0.44962138", "0.4494682", "0.44926536", "0.44881374", "0.4487703", "0.44808802", "0.44786954", "0.44718102", "0.44697562", "0.4462198", "0.4452288", "0.444802", "0.44438487", "0.44340524", "0.4433146", "0.44284296", "0.44244948", "0.44216114", "0.44147718", "0.4412288", "0.44097692", "0.44018888", "0.43954247", "0.43878362", "0.4387403", "0.43872783", "0.43831387", "0.43818253", "0.43763995", "0.4375229", "0.43729588", "0.43602747", "0.4358433", "0.435558", "0.4351317", "0.4351061", "0.4349946", "0.4342458", "0.43403167", "0.43402493", "0.4339511", "0.43377727", "0.43362677", "0.4332552", "0.4331112", "0.43267825", "0.43204704", "0.43171397", "0.43156573", "0.4311378", "0.43093958", "0.43088225", "0.43086216" ]
0.80550957
0
GetNodeTopology returns the NodeResourceTopology data for the node identified by `nodeName`.
func GetNodeTopology(ctx context.Context, topologyClient *topologyclientset.Clientset, nodeName string) *v1alpha2.NodeResourceTopology { var nodeTopology *v1alpha2.NodeResourceTopology var err error gomega.EventuallyWithOffset(1, func() bool { nodeTopology, err = topologyClient.TopologyV1alpha2().NodeResourceTopologies().Get(ctx, nodeName, metav1.GetOptions{}) if err != nil { framework.Logf("failed to get the node topology resource: %v", err) return false } return true }, time.Minute, 5*time.Second).Should(gomega.BeTrue()) return nodeTopology }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (ct *ClusterTopology) GetNodeByName(name string) (node *ClusterTopologyNode, ind int) {\n\tmux.RLock()\n\tdefer mux.RUnlock()\n\treturn ct.getNodeByName(name)\n}", "func IsValidNodeTopology(nodeTopology *v1alpha2.NodeResourceTopology, kubeletConfig *kubeletconfig.KubeletConfiguration) bool {\n\tif nodeTopology == nil || len(nodeTopology.TopologyPolicies) == 0 {\n\t\tframework.Logf(\"failed to get topology policy from the node topology resource\")\n\t\treturn false\n\t}\n\n\ttmPolicy := string(topologypolicy.DetectTopologyPolicy(kubeletConfig.TopologyManagerPolicy, kubeletConfig.TopologyManagerScope))\n\tif nodeTopology.TopologyPolicies[0] != tmPolicy {\n\t\tframework.Logf(\"topology policy mismatch got %q expected %q\", nodeTopology.TopologyPolicies[0], tmPolicy)\n\t\treturn false\n\t}\n\n\texpectedPolicyAttribute := v1alpha2.AttributeInfo{\n\t\tName: nfdtopologyupdater.TopologyManagerPolicyAttributeName,\n\t\tValue: kubeletConfig.TopologyManagerPolicy,\n\t}\n\tif !containsAttribute(nodeTopology.Attributes, expectedPolicyAttribute) {\n\t\tframework.Logf(\"topology policy attributes don't have correct topologyManagerPolicy attribute expected %v attributeList %v\", expectedPolicyAttribute, nodeTopology.Attributes)\n\t\treturn false\n\t}\n\n\texpectedScopeAttribute := v1alpha2.AttributeInfo{\n\t\tName: nfdtopologyupdater.TopologyManagerScopeAttributeName,\n\t\tValue: kubeletConfig.TopologyManagerScope,\n\t}\n\tif !containsAttribute(nodeTopology.Attributes, expectedScopeAttribute) {\n\t\tframework.Logf(\"topology policy attributes don't have correct topologyManagerScope attribute expected %v attributeList %v\", expectedScopeAttribute, nodeTopology.Attributes)\n\t\treturn false\n\t}\n\n\tif nodeTopology.Zones == nil || len(nodeTopology.Zones) == 0 {\n\t\tframework.Logf(\"failed to get topology zones from the node topology resource\")\n\t\treturn false\n\t}\n\n\tfoundNodes := 0\n\tfor _, zone := range nodeTopology.Zones {\n\t\t// TODO constant not in the APIs\n\t\tif !strings.HasPrefix(strings.ToUpper(zone.Type), \"NODE\") {\n\t\t\tcontinue\n\t\t}\n\t\tfoundNodes++\n\n\t\tif !isValidCostList(zone.Name, zone.Costs) {\n\t\t\tframework.Logf(\"invalid cost list for zone %q\", zone.Name)\n\t\t\treturn false\n\t\t}\n\n\t\tif !isValidResourceList(zone.Name, zone.Resources) {\n\t\t\tframework.Logf(\"invalid resource list for zone %q\", zone.Name)\n\t\t\treturn false\n\t\t}\n\t}\n\treturn foundNodes > 0\n}", "func (p *Provider) GetTopology(ctx context.Context) (*hardware.Topology, error) {\n\tch := make(chan topologyResult)\n\tgo p.getTopologyAsync(ctx, ch)\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn nil, ctx.Err()\n\tcase result := <-ch:\n\t\treturn result.topology, result.err\n\t}\n}", "func getTopologyFromPod(pod *v1.Pod, nodeList *v1.NodeList) (string, string, error) {\n\tfor _, node := range nodeList.Items {\n\t\tif pod.Spec.NodeName == node.Name {\n\t\t\tpodRegion := node.Labels[regionKey]\n\t\t\tpodZone := node.Labels[zoneKey]\n\t\t\treturn podRegion, podZone, nil\n\t\t}\n\t}\n\terr := errors.New(\"Could not find the topology from pod\")\n\treturn \"\", \"\", err\n}", "func (ctl *Ctl) GetTopology() *CtlTopology {\n\tctl.m.Lock()\n\trv := ctl.getTopologyLOCKED()\n\tctl.m.Unlock()\n\n\treturn rv\n}", "func (az *Cloud) GetNodeResourceGroup(nodeName string) (string, error) {\n\t// Kubelet won't set az.nodeInformerSynced, always return configured resourceGroup.\n\tif az.nodeInformerSynced == nil {\n\t\treturn az.ResourceGroup, nil\n\t}\n\n\taz.nodeCachesLock.RLock()\n\tdefer az.nodeCachesLock.RUnlock()\n\tif !az.nodeInformerSynced() {\n\t\treturn \"\", fmt.Errorf(\"node informer is not synced when trying to GetNodeResourceGroup\")\n\t}\n\n\t// Return external resource group if it has been cached.\n\tif cachedRG, ok := az.nodeResourceGroups[nodeName]; ok {\n\t\treturn cachedRG, nil\n\t}\n\n\t// Return resource group from cloud provider options.\n\treturn az.ResourceGroup, nil\n}", "func (cm *ClusterManager) GetTopologyNodes(ctx context.Context,\n\treq *cmproto.GetTopologyNodesRequest, resp *cmproto.GetTopologyNodesResponse) error {\n\treqID, err := requestIDFromContext(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := time.Now()\n\tla := thirdparty.NewGetTopoNodesAction()\n\tla.Handle(ctx, req, resp)\n\tmetrics.ReportAPIRequestMetric(\"GetTopologyNodes\", \"grpc\", strconv.Itoa(int(resp.Code)), start)\n\tblog.V(3).Infof(\"reqID: %s, action: GetTopologyNodes, req %v\", reqID, req)\n\treturn nil\n}", "func (m *TelemetryV2StackDriverConfig) GetTopology() *types.BoolValue {\n\tif m != nil {\n\t\treturn m.Topology\n\t}\n\treturn nil\n}", "func (ct *ClusterTopology) getNodeByName(name string) (node *ClusterTopologyNode, ind int) {\n\tfor ind, nd := range ct.Nodes {\n\t\tif nd.Node.Name == name {\n\t\t\treturn nd, ind\n\t\t}\n\t}\n\treturn nil, 0\n}", "func (r *QueryRequest) getTopologyInfo() *topologyInfo {\n\tif r.PreparedStatement == nil {\n\t\treturn nil\n\t}\n\n\treturn r.PreparedStatement.topologyInfo\n}", "func GetNodeName(ctx context.Context) (string, bool) {\n\tif val := ctx.Value(nodeNameKey); val != nil {\n\t\tresult, ok := val.(string)\n\t\treturn result, ok\n\t}\n\treturn \"\", false\n}", "func (info *BaseEndpointInfo) GetNodeName() string {\n\treturn info.NodeName\n}", "func (info *endpointsInfo) GetNodeName() string {\n\treturn \"\"\n}", "func (m *ClusterService) getTopology(ctx context.Context, args struct{}) (*proto.GeneralResp, error) {\n\tif _, _, err := permissions(ctx, ADMIN); err != nil {\n\t\treturn nil, err\n\t}\n\ttv := &TopologyView{\n\t\tZones: make([]*ZoneView, 0),\n\t}\n\tzones := m.cluster.t.getAllZones()\n\tfor _, zone := range zones {\n\t\tcv := newZoneView(zone.name)\n\t\tcv.Status = zone.getStatusToString()\n\t\ttv.Zones = append(tv.Zones, cv)\n\t\tnsc := zone.getAllNodeSet()\n\t\tfor _, ns := range nsc {\n\t\t\tnsView := newNodeSetView(ns.dataNodeLen(), ns.metaNodeLen())\n\t\t\tcv.NodeSet[ns.ID] = nsView\n\t\t\tns.dataNodes.Range(func(key, value interface{}) bool {\n\t\t\t\tdataNode := value.(*DataNode)\n\t\t\t\tnsView.DataNodes = append(nsView.DataNodes, proto.NodeView{ID: dataNode.ID, Addr: dataNode.Addr, Status: dataNode.isActive, IsWritable: dataNode.isWriteAble()})\n\t\t\t\treturn true\n\t\t\t})\n\t\t\tns.metaNodes.Range(func(key, value interface{}) bool {\n\t\t\t\tmetaNode := value.(*MetaNode)\n\t\t\t\tnsView.MetaNodes = append(nsView.MetaNodes, proto.NodeView{ID: metaNode.ID, Addr: metaNode.Addr, Status: metaNode.IsActive, IsWritable: metaNode.isWritable()})\n\t\t\t\treturn true\n\t\t\t})\n\t\t}\n\t}\n\n\tbs, e := json.Marshal(tv)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\treturn proto.Success(string(bs)), e\n}", "func GetNodeCapabilityType(kv *api.KV, deploymentID, nodeName, capabilityName string) (string, error) {\n\t// Now look at capability type for default\n\tnodeType, err := GetNodeType(kv, deploymentID, nodeName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn GetNodeTypeCapabilityType(kv, deploymentID, nodeType, capabilityName)\n}", "func (s NodeService) GetCapacityByNodeName(ctx context.Context, name, deviceGroup string) (int64, error) {\n\tnode := new(corev1.Node)\n\terr := s.Get(ctx, client.ObjectKey{Name: name}, node)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tfor key, v := range node.Status.Allocatable {\n\t\tif string(key) == deviceGroup || string(key) == utils.DeviceCapacityKeyPrefix+deviceGroup {\n\t\t\treturn v.Value(), nil\n\t\t}\n\t}\n\treturn 0, errors.New(\"device group not found\")\n}", "func NodeName() string {\n\treturn nodeName\n}", "func (o Iperf3SpecClientConfigurationPodSchedulingOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Iperf3SpecClientConfigurationPodScheduling) *string { return v.NodeName }).(pulumi.StringPtrOutput)\n}", "func (rc *ResourceCache) GetNodeResources(nodeName string) []*Resource {\n\trc.lock.Lock()\n\tdefer rc.lock.Unlock()\n\tnode, ok := rc.Nodes[nodeName]\n\tif !ok {\n\t\treturn nil\n\t}\n\tretRes := make([]*Resource, 0)\n\tfor _, r := range node.Resources {\n\t\tretRes = append(retRes, r.DeepCopy())\n\t}\n\tsort.Slice(retRes, func(i, j int) bool {\n\t\treturn retRes[i].Key() < retRes[j].Key()\n\t})\n\treturn retRes\n}", "func (c *Client) GetNodeOperator() scheduler.NodeOperator {\n\treturn c.Node\n}", "func getNode(ctx context.Context, client client.Interface, nodeName string) *libapi.Node {\n\tnode, err := client.Nodes().Get(ctx, nodeName, options.GetOptions{})\n\tif err != nil {\n\t\tif _, ok := err.(cerrors.ErrorResourceDoesNotExist); !ok {\n\t\t\tlog.WithError(err).WithField(\"Name\", nodeName).Info(\"Unable to query node configuration\")\n\t\t\tlog.Warn(\"Unable to access datastore to query node configuration\")\n\t\t\tutils.Terminate()\n\t\t}\n\n\t\tlog.WithField(\"Name\", nodeName).Info(\"Building new node resource\")\n\t\tnode = libapi.NewNode()\n\t\tnode.Name = nodeName\n\t}\n\n\treturn node\n}", "func (o QperfSpecClientConfigurationPodSchedulingOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v QperfSpecClientConfigurationPodScheduling) *string { return v.NodeName }).(pulumi.StringPtrOutput)\n}", "func FindIPForNodeName(nodeName string) string {\n\tcfg := &etcd.ClientConfig{\n\t\tConfig: &clientv3.Config{\n\t\t\tEndpoints: []string{\"127.0.0.1:32379\"},\n\t\t},\n\t\tOpTimeout: 1 * time.Second,\n\t}\n\t// Create connection to etcd.\n\tdb, err := etcd.NewEtcdConnectionWithBytes(*cfg, logrus.DefaultLogger())\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\titr, err := db.ListValues(\"/vnf-agent/contiv-ksr/allocatedIDs/\")\n\tif err != nil {\n\t\tfmt.Printf(\"Error getting values\")\n\t\treturn \"\"\n\t}\n\tfor {\n\t\tkv, stop := itr.GetNext()\n\t\tif stop {\n\t\t\tbreak\n\t\t}\n\t\tbuf := kv.GetValue()\n\t\t//key := kv.GetKey()\n\t\t//fmt.Printf(\"Key: %s, value: %s\\n\", key, string(buf))\n\t\tnodeInfo := &nodeinfomodel.NodeInfo{}\n\t\terr = json.Unmarshal(buf, nodeInfo)\n\t\tif nodeInfo.Name == nodeName {\n\t\t\treturn nodeInfo.ManagementIpAddress\n\t\t}\n\t}\n\tdb.Close()\n\treturn \"\"\n}", "func (o Iperf3SpecClientConfigurationPodSchedulingPtrOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Iperf3SpecClientConfigurationPodScheduling) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.NodeName\n\t}).(pulumi.StringPtrOutput)\n}", "func Topology(node uint32) (*TopologyConn, error) {\n\tsa := &unix.TIPCServiceName{\n\t\tType: unix.TIPC_TOP_SRV,\n\t\tInstance: unix.TIPC_TOP_SRV,\n\t\tDomain: node,\n\t}\n\n\tst := &unix.SockaddrTIPC{\n\t\tScope: unix.TIPC_CLUSTER_SCOPE,\n\t\tAddr: sa,\n\t}\n\n\tc, err := tipc.DialSequentialPacket(st)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &TopologyConn{conn: c}, nil\n}", "func GetNodeName(appName string, local bool) (string, error) {\n\thostName, err := os.Hostname()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tretHostName := hostName\n\tif local {\n\t\tretHostName = \"local-\" + hostName\n\t}\n\n\treturn appName + \"-\" + retHostName, nil\n}", "func (o Iperf3SpecServerConfigurationPodSchedulingOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Iperf3SpecServerConfigurationPodScheduling) *string { return v.NodeName }).(pulumi.StringPtrOutput)\n}", "func (o GetChainsChainChainConfigRouterFromOutput) NodeName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetChainsChainChainConfigRouterFrom) string { return v.NodeName }).(pulumi.StringOutput)\n}", "func (o QperfSpecClientConfigurationPodSchedulingPtrOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *QperfSpecClientConfigurationPodScheduling) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.NodeName\n\t}).(pulumi.StringPtrOutput)\n}", "func (o DrillSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DrillSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (o DrillSpecPodConfigPodSchedulingOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v DrillSpecPodConfigPodScheduling) *string { return v.NodeName }).(pulumi.StringPtrOutput)\n}", "func (o ChainChainConfigRouterFromOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ChainChainConfigRouterFrom) *string { return v.NodeName }).(pulumi.StringPtrOutput)\n}", "func (o PgbenchSpecPodConfigPodSchedulingOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v PgbenchSpecPodConfigPodScheduling) *string { return v.NodeName }).(pulumi.StringPtrOutput)\n}", "func (o IopingSpecPodConfigPodSchedulingOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IopingSpecPodConfigPodScheduling) *string { return v.NodeName }).(pulumi.StringPtrOutput)\n}", "func (c *Cleaner) getNodeObjectByNodeName(nodeName string) (*v1.Node, error) {\n\tnode := &v1.Node{}\n\terr := c.Client.Get(context.TODO(), client.ObjectKey{Namespace: \"\", Name: nodeName}, node)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn node, nil\n}", "func (o QperfSpecServerConfigurationPodSchedulingOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v QperfSpecServerConfigurationPodScheduling) *string { return v.NodeName }).(pulumi.StringPtrOutput)\n}", "func (o FioSpecPodConfigPodSchedulingOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FioSpecPodConfigPodScheduling) *string { return v.NodeName }).(pulumi.StringPtrOutput)\n}", "func (c *kubernetesClient) GetNode(ctx context.Context, nodeName string) (node *v1.Node, err error) {\n\tnode, err = c.kubeClientset.CoreV1().Nodes().Get(ctx, nodeName, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (o DrillSpecPodConfigPodSchedulingAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DrillSpecPodConfigPodSchedulingAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (o FioSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FioSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func GetCurrentNode() *ClusterTopologyNode {\n\treturn currentNode\n}", "func (o SysbenchSpecPodSchedulingOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SysbenchSpecPodScheduling) *string { return v.NodeName }).(pulumi.StringPtrOutput)\n}", "func (o SysbenchSpecPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SysbenchSpecPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (o Iperf3SpecClientConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v Iperf3SpecClientConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (o PgbenchSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v PgbenchSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (o DrillSpecPodConfigPodSchedulingAffinityPodAffinityRequiredDuringSchedulingIgnoredDuringExecutionOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DrillSpecPodConfigPodSchedulingAffinityPodAffinityRequiredDuringSchedulingIgnoredDuringExecution) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func Get(name string) (*Node, error) {\n\tcmd := exec.Command(\"kubectl\", \"get\", \"node\", \"-ojson\", name)\n\tutil.PrintCommand(cmd)\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Failed to get nodes from the Kubernetes cluster: %s\", string(out))\n\t}\n\n\tvar n Node\n\tif err := json.Unmarshal(out, &n); err != nil {\n\t\treturn nil, errors.Wrap(err, \"error unmarshalling node\")\n\t}\n\treturn &n, nil\n}", "func (m *Model) GetNode(name string) *Node {\n\treturn m.learnableMp[name]\n}", "func (o DrillSpecPodConfigPodSchedulingPtrOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DrillSpecPodConfigPodScheduling) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.NodeName\n\t}).(pulumi.StringPtrOutput)\n}", "func (o Iperf3SpecServerConfigurationPodSchedulingPtrOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Iperf3SpecServerConfigurationPodScheduling) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.NodeName\n\t}).(pulumi.StringPtrOutput)\n}", "func (o QperfSpecClientConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v QperfSpecClientConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (o GetChainsChainChainConfigRouterToOutput) NodeName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetChainsChainChainConfigRouterTo) string { return v.NodeName }).(pulumi.StringOutput)\n}", "func (c *Conn) GetNode(path ...NodeName) (Node, error) {\n\tvar node Node\n\terr := c.Request(\"get\", &node, pathToArgs(path)...)\n\treturn node, err\n}", "func (c *client) getNode(name string) (result, error) {\n\tnode, err := c.queryEndpoint(APINodesEndpoint, name+\"?memory=true\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(node) > 1 {\n\t\treturn nil, fmt.Errorf(\"Error: more than one result returned\")\n\t}\n\treturn node[0], nil\n}", "func (r *nodeRegistry) GetNodeClient(ctx context.Context, nodeName string) (NodeClient, error) {\n\tr.mutex.Lock()\n\tdefer r.mutex.Unlock()\n\n\te, found := r.nodes[nodeName]\n\tif !found {\n\t\treturn nil, nil\n\t}\n\n\t// Create client if needed\n\tif e.Client == nil {\n\t\t// Create a connection\n\t\tconn, err := grpc.Dial(e.Address, grpc.WithInsecure())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\te.Client = NewNodeClient(conn)\n\t}\n\n\treturn e.Client, nil\n}", "func (d *QuobyteDriver) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {\n\treturn &csi.NodeGetCapabilitiesResponse{\n\t\tCapabilities: []*csi.NodeServiceCapability{\n\t\t\t{\n\t\t\t\tType: &csi.NodeServiceCapability_Rpc{\n\t\t\t\t\tRpc: &csi.NodeServiceCapability_RPC{\n\t\t\t\t\t\tType: csi.NodeServiceCapability_RPC_UNKNOWN,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}, nil\n}", "func (o ChainChainConfigRouterToOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ChainChainConfigRouterTo) *string { return v.NodeName }).(pulumi.StringPtrOutput)\n}", "func (o FioSpecPodConfigPodSchedulingAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FioSpecPodConfigPodSchedulingAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func GetKeyNodeName(cluster, node string) string {\n\t// WARNING - STABLE API: Changing the structure of the key may break\n\t// backwards compatibility\n\treturn path.Join(cluster, node)\n}", "func (nsp *NameSpacePriority) CalculateNodeNameSpacePriority(pod *v1.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo, nodes []*v1.Node) (schedulerapi.HostPriorityList, error) {\n\tvar count int\n\tvar skipPodCount int\n\tselectors := nsp.getSelectors(pod)\n\tresult := []schedulerapi.HostPriority{}\n\tfor _, node := range nodes {\n\t\tcount = 0\n\t\tskipPodCount = 0\n\t\tmatches := false\n\t\tfor _, nodePod := range nodeNameToInfo[node.Name].Pods() {\n\t\t\tif nodePod.Namespace == \"kube-system\" || isPodShouldSkip(nodePod) {\n\t\t\t\tskipPodCount++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, selector := range selectors {\n\t\t\t\tif selector.Matches(labels.Set(nodePod.ObjectMeta.Labels)) {\n\t\t\t\t\tmatches = true\n\t\t\t\t\tglog.V(4).Infof(\"skipping node %s because pod %s:%s\", node.Name, nodePod.Namespace, nodePod.Name)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif pod.Namespace == nodePod.Namespace {\n\t\t\t\tcount++\n\t\t\t}\n\t\t}\n\t\tfScore := float64(0)\n\n\t\t// has an another pod on the node belong to the same rc, rs or service\n\t\tif matches == false {\n\t\t\tvar nodePodsCount int\n\t\t\tnodePodsCount = len(nodeNameToInfo[node.Name].Pods()) - skipPodCount\n\n\t\t\tfScore = 10 * (float64(count+1) / float64(nodePodsCount+1))\n\t\t}\n\n\t\tresult = append(result, schedulerapi.HostPriority{Host: node.Name, Score: int(fScore)})\n\t}\n\treturn result, nil\n}", "func (o FioSpecPodConfigPodSchedulingAffinityPodAffinityRequiredDuringSchedulingIgnoredDuringExecutionOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FioSpecPodConfigPodSchedulingAffinityPodAffinityRequiredDuringSchedulingIgnoredDuringExecution) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (o SysbenchSpecPodSchedulingAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SysbenchSpecPodSchedulingAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func getNodeMetrics() []plugin.MetricType {\n\tvar mts []plugin.MetricType\n\tnsPrefix := []string{\"intel\", \"rabbitmq\", \"nodes\"}\n\tfor k := range nodeMetrics {\n\t\tmts = append(mts, plugin.MetricType{\n\t\t\tNamespace_: core.NewNamespace(nsPrefix...).\n\t\t\t\tAddDynamicElement(\"node_name\", \"Name of the node\").\n\t\t\t\tAddStaticElements(strings.Split(k, \"/\")...),\n\t\t})\n\t}\n\treturn mts\n}", "func (o PgbenchSpecPodConfigPodSchedulingAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v PgbenchSpecPodConfigPodSchedulingAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func getNodePriority(ip string, nodes []string) int {\n\treturn 100 + stringSlice(nodes).pos(ip)\n}", "func (o Iperf3SpecClientConfigurationPodSchedulingAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v Iperf3SpecClientConfigurationPodSchedulingAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (o DrillSpecPodConfigPodSchedulingAffinityPodAntiAffinityRequiredDuringSchedulingIgnoredDuringExecutionOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DrillSpecPodConfigPodSchedulingAffinityPodAntiAffinityRequiredDuringSchedulingIgnoredDuringExecution) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func GetOperationOutputForNode(ctx context.Context, deploymentID, nodeName, instanceName, interfaceName, operationName, outputName string) (string, error) {\n\tinstancesPath := path.Join(consulutil.DeploymentKVPrefix, deploymentID, \"topology/instances\", nodeName)\n\n\texist, output, err := consulutil.GetStringValue(filepath.Join(instancesPath, instanceName, \"outputs\", strings.ToLower(interfaceName), strings.ToLower(operationName), outputName))\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, consulutil.ConsulGenericErrMsg)\n\t}\n\tif exist && output != \"\" {\n\t\treturn output, nil\n\t}\n\t// Look at host node\n\tvar host string\n\thost, err = GetHostedOnNode(ctx, deploymentID, nodeName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif host != \"\" {\n\t\t// TODO we consider that instance name is the same for the host but we should not\n\t\treturn GetOperationOutputForNode(ctx, deploymentID, host, instanceName, interfaceName, operationName, outputName)\n\t}\n\treturn \"\", nil\n}", "func (o QperfSpecClientConfigurationPodSchedulingAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v QperfSpecClientConfigurationPodSchedulingAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (o Iperf3SpecServerConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v Iperf3SpecServerConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (o QperfSpecServerConfigurationPodSchedulingPtrOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *QperfSpecServerConfigurationPodScheduling) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.NodeName\n\t}).(pulumi.StringPtrOutput)\n}", "func (o PgbenchSpecPodConfigPodSchedulingPtrOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *PgbenchSpecPodConfigPodScheduling) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.NodeName\n\t}).(pulumi.StringPtrOutput)\n}", "func (d *Driver) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {\n\tnscaps := []*csi.NodeServiceCapability{\n\t\t&csi.NodeServiceCapability{\n\t\t\tType: &csi.NodeServiceCapability_Rpc{\n\t\t\t\tRpc: &csi.NodeServiceCapability_RPC{\n\t\t\t\t\tType: csi.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t&csi.NodeServiceCapability{\n\t\t\tType: &csi.NodeServiceCapability_Rpc{\n\t\t\t\tRpc: &csi.NodeServiceCapability_RPC{\n\t\t\t\t\tType: csi.NodeServiceCapability_RPC_EXPAND_VOLUME,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t&csi.NodeServiceCapability{\n\t\t\tType: &csi.NodeServiceCapability_Rpc{\n\t\t\t\tRpc: &csi.NodeServiceCapability_RPC{\n\t\t\t\t\tType: csi.NodeServiceCapability_RPC_GET_VOLUME_STATS,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\td.log.WithFields(logrus.Fields{\n\t\t\"node_capabilities\": nscaps,\n\t\t\"method\": \"node_get_capabilities\",\n\t}).Info(\"node get capabilities called\")\n\treturn &csi.NodeGetCapabilitiesResponse{\n\t\tCapabilities: nscaps,\n\t}, nil\n}", "func (o IopingSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v IopingSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (m *OpenChannelRequest) GetNodePubkeyString() string {\n\tif m != nil {\n\t\treturn m.NodePubkeyString\n\t}\n\treturn \"\"\n}", "func (m *OpenChannelRequest) GetNodePubkeyString() string {\n\tif m != nil {\n\t\treturn m.NodePubkeyString\n\t}\n\treturn \"\"\n}", "func (m *OpenChannelRequest) GetNodePubkeyString() string {\n\tif m != nil {\n\t\treturn m.NodePubkeyString\n\t}\n\treturn \"\"\n}", "func (m *OpenChannelRequest) GetNodePubkeyString() string {\n\tif m != nil {\n\t\treturn m.NodePubkeyString\n\t}\n\treturn \"\"\n}", "func (m *OpenChannelRequest) GetNodePubkeyString() string {\n\tif m != nil {\n\t\treturn m.NodePubkeyString\n\t}\n\treturn \"\"\n}", "func (o SysbenchSpecPodSchedulingAffinityPodAffinityRequiredDuringSchedulingIgnoredDuringExecutionOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SysbenchSpecPodSchedulingAffinityPodAffinityRequiredDuringSchedulingIgnoredDuringExecution) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (o PgbenchSpecPodConfigPodSchedulingAffinityPodAffinityRequiredDuringSchedulingIgnoredDuringExecutionOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v PgbenchSpecPodConfigPodSchedulingAffinityPodAffinityRequiredDuringSchedulingIgnoredDuringExecution) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (o QperfSpecServerConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v QperfSpecServerConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func GetNodeTypeCapabilityType(kv *api.KV, deploymentID, nodeType, capabilityName string) (string, error) {\n\n\tkvp, _, err := kv.Get(path.Join(consulutil.DeploymentKVPrefix, deploymentID, \"topology/types\", nodeType, \"capabilities\", capabilityName, \"type\"), nil)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, consulutil.ConsulGenericErrMsg)\n\t}\n\tif kvp != nil && len(kvp.Value) != 0 {\n\t\treturn string(kvp.Value), nil\n\t}\n\tparentType, err := GetParentType(kv, deploymentID, nodeType)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif parentType == \"\" {\n\t\treturn \"\", nil\n\t}\n\treturn GetNodeTypeCapabilityType(kv, deploymentID, parentType, capabilityName)\n}", "func (dagServiceAPI *dagServiceAPI) DAGGetNode(ctx context.Context, ref string) (interface{}, error) {\n\treturn dagServiceAPI.dagService.Dag.GetNode(ctx, ref)\n}", "func (a *App) getZoneForNode(nodeName string) string {\n\tif zone, ok := a.zonePerNode[nodeName]; ok {\n\t\treturn zone\n\t}\n\n\tnode, err := a.kubeClient.Nodes().Get(nodeName, kubemeta_v1.GetOptions{})\n\tif err != nil {\n\t\tlog.Warnf(\"error getting node %s: %s\", nodeName, err)\n\t\treturn \"\"\n\t}\n\n\tzone, _ := node.Labels[kubemeta_v1.LabelZoneFailureDomain]\n\ta.zonePerNode[nodeName] = zone\n\n\treturn zone\n}", "func (o Iperf3SpecClientConfigurationPodSchedulingAffinityPodAffinityRequiredDuringSchedulingIgnoredDuringExecutionOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v Iperf3SpecClientConfigurationPodSchedulingAffinityPodAffinityRequiredDuringSchedulingIgnoredDuringExecution) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (o QperfSpecClientConfigurationPodSchedulingAffinityPodAffinityRequiredDuringSchedulingIgnoredDuringExecutionOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v QperfSpecClientConfigurationPodSchedulingAffinityPodAffinityRequiredDuringSchedulingIgnoredDuringExecution) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (ns *NodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {\n\tutil.DebugLog(ctx, \"get node Capabilities\")\n\treturn &csi.NodeGetCapabilitiesResponse{\n\t\tCapabilities: []*csi.NodeServiceCapability{\n\t\t\t{\n\t\t\t\tType: &csi.NodeServiceCapability_Rpc{\n\t\t\t\t\tRpc: &csi.NodeServiceCapability_RPC{\n\t\t\t\t\t\tType: csi.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tType: &csi.NodeServiceCapability_Rpc{\n\t\t\t\t\tRpc: &csi.NodeServiceCapability_RPC{\n\t\t\t\t\t\tType: csi.NodeServiceCapability_RPC_GET_VOLUME_STATS,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tType: &csi.NodeServiceCapability_Rpc{\n\t\t\t\t\tRpc: &csi.NodeServiceCapability_RPC{\n\t\t\t\t\t\tType: csi.NodeServiceCapability_RPC_EXPAND_VOLUME,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}, nil\n}", "func (_m *IService) GetTopology() models.Topology {\n\tret := _m.Called()\n\n\tvar r0 models.Topology\n\tif rf, ok := ret.Get(0).(func() models.Topology); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(models.Topology)\n\t}\n\n\treturn r0\n}", "func (o FioSpecPodConfigPodSchedulingAffinityPodAntiAffinityRequiredDuringSchedulingIgnoredDuringExecutionOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FioSpecPodConfigPodSchedulingAffinityPodAntiAffinityRequiredDuringSchedulingIgnoredDuringExecution) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (r *NodeReconciler) getNodeAffinity(node *ethereumv1alpha1.Node) *corev1.Affinity {\n\tif node.Spec.HighlyAvailable {\n\t\treturn &corev1.Affinity{\n\t\t\tPodAntiAffinity: &corev1.PodAntiAffinity{\n\t\t\t\tRequiredDuringSchedulingIgnoredDuringExecution: []corev1.PodAffinityTerm{\n\t\t\t\t\t{\n\t\t\t\t\t\tLabelSelector: &metav1.LabelSelector{\n\t\t\t\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\t\t\t\"name\": \"node\",\n\t\t\t\t\t\t\t\t\"network\": node.Name,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tTopologyKey: node.Spec.TopologyKey,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n\treturn nil\n}", "func GetClusterControlPlaneTopology(cs *framework.ClientSet) (configv1.TopologyMode, error) {\n\tconst infraResourceName = \"cluster\"\n\n\tinfra, err := cs.ConfigV1Interface.Infrastructures().Get(context.TODO(), infraResourceName, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"unable to get cluster infrastructure status: %v\", err)\n\t}\n\treturn infra.Status.ControlPlaneTopology, nil\n}", "func (o FioSpecPodConfigPodSchedulingPtrOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *FioSpecPodConfigPodScheduling) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.NodeName\n\t}).(pulumi.StringPtrOutput)\n}", "func (d *Driver) NodeGetCapabilities(ctx context.Context, request *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {\n\tcaps := []*csi.NodeServiceCapability{\n\t\t{\n\t\t\tType: &csi.NodeServiceCapability_Rpc{\n\t\t\t\tRpc: &csi.NodeServiceCapability_RPC{\n\t\t\t\t\tType: csi.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tType: &csi.NodeServiceCapability_Rpc{\n\t\t\t\tRpc: &csi.NodeServiceCapability_RPC{\n\t\t\t\t\tType: csi.NodeServiceCapability_RPC_GET_VOLUME_STATS,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tType: &csi.NodeServiceCapability_Rpc{\n\t\t\t\tRpc: &csi.NodeServiceCapability_RPC{\n\t\t\t\t\tType: csi.NodeServiceCapability_RPC_UNKNOWN,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\td.log.WithFields(logrus.Fields{\n\t\t\"node_capabilities\": caps,\n\t\t\"method\": \"node_get_capabilities\",\n\t}).Info(\"node get capabilities called\")\n\treturn &csi.NodeGetCapabilitiesResponse{\n\t\tCapabilities: caps,\n\t}, nil\n}", "func (esm *ESMetric) GetNodeData() (map[string]map[string]plugin.MetricType, error) {\n\tresp, err := esm.client.httpClient.Get(esm.client.GetUrl())\n\tif err != nil {\n\t\tesLog.WithFields(log.Fields{\n\t\t\t\"_block\": \"get-node-data-http\",\n\t\t\t\"error\": err,\n\t\t}).Error(\"get ES data error\")\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tvar v esData\n\terr = json.NewDecoder(resp.Body).Decode(&v)\n\tif err != nil {\n\t\tesLog.WithFields(log.Fields{\n\t\t\t\"_block\": \"get-node-data-decoding\",\n\t\t\t\"error\": err,\n\t\t}).Error(\"decoding response error\")\n\t\treturn nil, err\n\t}\n\n\tnodes := v.Nodes\n\tnsStack := NewStack(0)\n\n\t// loops through different nodes in the same elasticsearch cluster\n\tfor id, node := range nodes {\n\t\t// builds namespace based on the node id\n\t\tprefix := fmt.Sprintf(nodeNsPrefix, id)\n\n\t\t// pushes the node namespace onto the stack\n\t\tnsStack.Clear()\n\t\tnsStack.Push(prefix)\n\n\t\t// stores a map entry of the node namespace along with the number of fields\n\t\ttreeMap[nodeNsPrefix] = reflect.TypeOf(node).Elem().NumField()\n\n\t\tesm.id = id\n\t\tesm.host = node.Host\n\t\tesm.timestamp = node.Timestamp\n\t\tesm.dataMap = map[string]interface{}{}\n\n\t\t// parses the data from the node\n\t\terr = esm.parseData(reflect.ValueOf(node), nsStack)\n\t\tesm.setESNodeMetrics()\n\t}\n\treturn mtsMap, err\n}", "func (o Iperf3SpecServerConfigurationPodSchedulingAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v Iperf3SpecServerConfigurationPodSchedulingAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (s *server) GetNode(context.Context, *goblinpb.GetNodeRequest) (*goblinpb.GetNodeResponse, error) {\n\treturn &goblinpb.GetNodeResponse{\n\t\tName: s.pool.GetName(),\n\t\tAddr: s.pool.GetMemberlistAddress(),\n\t}, nil\n}", "func (o SysbenchSpecPodSchedulingPtrOutput) NodeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SysbenchSpecPodScheduling) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.NodeName\n\t}).(pulumi.StringPtrOutput)\n}", "func (s *HTTPServer) nodeName() string {\n\treturn s.agent.config.NodeName\n}", "func (builder clusterDTOBuilder) getNodeResourceCapacity(clusterName string, commodityType proto.CommodityDTO_CommodityType,\n\tnodeResourceCapacityMap map[proto.CommodityDTO_CommodityType]float64) float64 {\n\tresourceCapacity, ok := nodeResourceCapacityMap[commodityType]\n\tif !ok {\n\t\tglog.Errorf(\"%s commodity does not exist in nodeResourceCapacityMap\", commodityType)\n\t\treturn 0\n\t}\n\tif resourceCapacity == 0 {\n\t\tglog.Errorf(\"%s commodity capacity from all nodes in cluster %s is 0.\", commodityType, clusterName)\n\t\treturn 0\n\t}\n\treturn resourceCapacity\n}" ]
[ "0.5269962", "0.52621764", "0.5247785", "0.52404493", "0.51715285", "0.5158596", "0.510464", "0.4999241", "0.49666396", "0.484828", "0.48107776", "0.47864768", "0.47457278", "0.4745136", "0.4700492", "0.4690143", "0.46838033", "0.46773323", "0.46604025", "0.4645714", "0.46251312", "0.4586101", "0.45664036", "0.45631284", "0.4559667", "0.45209822", "0.44867384", "0.44848168", "0.4478172", "0.44715446", "0.44704112", "0.4442198", "0.44408813", "0.4411098", "0.4409062", "0.440592", "0.4403694", "0.4403376", "0.44021925", "0.44017443", "0.43989268", "0.4393087", "0.43795973", "0.43627486", "0.43614152", "0.43588015", "0.43575808", "0.43550855", "0.43546516", "0.43522584", "0.43482506", "0.43453556", "0.43404344", "0.4335316", "0.4333771", "0.43320945", "0.43256095", "0.4325014", "0.4324147", "0.43138885", "0.4313318", "0.43099445", "0.43090606", "0.4303684", "0.4303419", "0.42983037", "0.42968303", "0.42863637", "0.4281944", "0.4281823", "0.4281742", "0.42797676", "0.42793837", "0.42780435", "0.42625985", "0.42625985", "0.42625985", "0.42625985", "0.42625985", "0.42620653", "0.42583653", "0.4254026", "0.42525807", "0.42492956", "0.42484033", "0.42479008", "0.42477605", "0.424305", "0.42378053", "0.42368454", "0.4236823", "0.42320755", "0.42302206", "0.42292163", "0.42269105", "0.4224069", "0.42216617", "0.42200163", "0.42186046", "0.4213176" ]
0.69008017
0
AllocatableResourceListFromNodeResourceTopology extract the map zone:allocatableResources from the given NodeResourceTopology instance.
func AllocatableResourceListFromNodeResourceTopology(nodeTopo *v1alpha2.NodeResourceTopology) map[string]corev1.ResourceList { allocRes := make(map[string]corev1.ResourceList) for _, zone := range nodeTopo.Zones { if zone.Type != "Node" { continue } resList := make(corev1.ResourceList) for _, res := range zone.Resources { resList[corev1.ResourceName(res.Name)] = res.Allocatable.DeepCopy() } if len(resList) == 0 { continue } allocRes[zone.Name] = resList } return allocRes }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetMemoryResources(reservedMemory map[int]int64, getAvailableMemory func() ([]*topology.Node, []*rtesysinfo.Hugepages, error)) (map[string]PerNUMACounters, error) {\n\tnumaMemory := make(map[string]PerNUMACounters)\n\tnodes, hugepages, err := getAvailableMemory()\n\tif err != nil {\n\t\treturn numaMemory, err\n\t}\n\n\tcounters := make(PerNUMACounters)\n\tfor _, node := range nodes {\n\t\tcounters[node.ID] += node.Memory.TotalUsableBytes\n\t}\n\tmemCounters := make(PerNUMACounters)\n\tfor numaID, amount := range counters {\n\t\treserved := reservedMemory[numaID]\n\t\tif reserved > amount {\n\t\t\t// TODO log\n\t\t\tmemCounters[numaID] = 0\n\t\t}\n\t\tmemCounters[numaID] = amount - reserved\n\t}\n\tnumaMemory[string(corev1.ResourceMemory)] = memCounters\n\n\tfor _, hp := range hugepages {\n\t\tname := rtesysinfo.HugepageResourceNameFromSize(hp.SizeKB)\n\t\thpCounters, ok := numaMemory[name]\n\t\tif !ok {\n\t\t\thpCounters = make(PerNUMACounters)\n\t\t}\n\t\thpCounters[hp.NodeID] += int64(hp.Total)\n\t\tnumaMemory[name] = hpCounters\n\t}\n\n\treturn numaMemory, nil\n}", "func CompareAllocatableResources(expected, got map[string]corev1.ResourceList) (string, string, int, bool) {\n\tif len(got) != len(expected) {\n\t\tframework.Logf(\"-> expected=%v (len=%d) got=%v (len=%d)\", expected, len(expected), got, len(got))\n\t\treturn \"\", \"\", 0, false\n\t}\n\tfor expZoneName, expResList := range expected {\n\t\tgotResList, ok := got[expZoneName]\n\t\tif !ok {\n\t\t\treturn expZoneName, \"\", 0, false\n\t\t}\n\t\tif resName, cmp, ok := CompareResourceList(expResList, gotResList); !ok || cmp != 0 {\n\t\t\treturn expZoneName, resName, cmp, ok\n\t\t}\n\t}\n\treturn \"\", \"\", 0, true\n}", "func (config *AppConfig) GetNodeAllocations(nodeID int) (allocations NodeAllocations, err error) {\n\t// Get allocation info from the panel\n\tallocBytes, err := config.queryApplicationAPI(fmt.Sprintf(\"nodes/%d/allocations?page=%d\", nodeID), \"get\", nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Unmarshal the bytes to a usable struct.\n\terr = json.Unmarshal(allocBytes, &allocations)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor i := 1; i >= allocations.Meta.Pagination.TotalPages; i++ {\n\t\tallocations, err := config.getNodeAllocationsByPage(nodeID, i)\n\t\tif err != nil {\n\t\t\treturn allocations, err\n\t\t}\n\t\tfor _, allocation := range allocations.Allocations {\n\t\t\tallocations.Allocations = append(allocations.Allocations, allocation)\n\t\t}\n\t}\n\n\treturn\n}", "func (a *ResourcepoolApiService) GetResourcepoolLeaseResourceList(ctx context.Context) ApiGetResourcepoolLeaseResourceListRequest {\n\treturn ApiGetResourcepoolLeaseResourceListRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (rc *ResourceCache) GetNodeResources(nodeName string) []*Resource {\n\trc.lock.Lock()\n\tdefer rc.lock.Unlock()\n\tnode, ok := rc.Nodes[nodeName]\n\tif !ok {\n\t\treturn nil\n\t}\n\tretRes := make([]*Resource, 0)\n\tfor _, r := range node.Resources {\n\t\tretRes = append(retRes, r.DeepCopy())\n\t}\n\tsort.Slice(retRes, func(i, j int) bool {\n\t\treturn retRes[i].Key() < retRes[j].Key()\n\t})\n\treturn retRes\n}", "func (p *ResourcePool) Allocs(ctx context.Context) ([]Alloc, error) {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tallocs := make([]Alloc, len(p.allocs))\n\ti := 0\n\tfor _, a := range p.allocs {\n\t\tallocs[i] = a\n\t\ti++\n\t}\n\treturn allocs, nil\n}", "func resourcesNode(node *yaml.Node) yit.Iterator {\n\treturn yit.FromNode(node).\n\t\t// Access nested 'resources' attribute\n\t\tValuesForMap(\n\t\t\tyit.WithStringValue(\"resources\"),\n\t\t\tyit.WithKind(yaml.SequenceNode),\n\t\t)\n}", "func buildNodeCapacityMap(acs []accrd.AvailableCapacity) NodeCapacityMap {\n\tcapMap := NodeCapacityMap{}\n\tfor _, ac := range acs {\n\t\tac := ac\n\t\tif _, ok := capMap[ac.Spec.NodeId]; !ok {\n\t\t\tcapMap[ac.Spec.NodeId] = ACMap{}\n\t\t}\n\t\tcapMap[ac.Spec.NodeId][ac.Name] = &ac\n\t}\n\treturn capMap\n}", "func (n *resPool) GetTotalAllocatedResources() *scalar.Resources {\n\tn.RLock()\n\tdefer n.RUnlock()\n\treturn n.allocation.GetByType(scalar.TotalAllocation)\n}", "func buildNormalizedNodeResourceMap(pods []*core_v1.Pod, nodes []*core_v1.Node) nodeResourceMap { // nolint: gocyclo\n\tnrm := nodeResourceMap{}\n\n\tfor _, n := range nodes {\n\t\tnrm[n.ObjectMeta.Name] = allocatedNodeResources{node: n}\n\t}\n\n\t// We sum the total allocated resources on every node from our list of pods.\n\t// Some strategies may wish to price pods based on their fraction of allocated\n\t// node resources, rather than the total resources available on a node. This\n\t// may punish lone pods that are initially scheduled onto large nodes, but this\n\t// may be desirable as it rightfully punishes applications that may cause\n\t// frequent node turnover.\n\tfor _, p := range pods {\n\t\tnr, ok := nrm[p.Spec.NodeName]\n\t\tif !ok {\n\t\t\tlog.Log.Warnw(\"unexpected missing node from NodeMap\", zap.String(\"nodeName\", p.Spec.NodeName))\n\t\t\tcontinue\n\t\t}\n\t\tnr.cpuUsed += sumPodResource(p, core_v1.ResourceCPU)\n\t\tnr.memoryUsed += sumPodResource(p, core_v1.ResourceMemory)\n\t\tnr.gpuUsed += sumPodResource(p, ResourceGPU)\n\t\tnrm[p.Spec.NodeName] = nr\n\t}\n\n\tfor k, v := range nrm {\n\t\tc := v.node.Status.Capacity.Cpu()\n\t\tif c != nil {\n\t\t\tv.cpuAvailable = c.MilliValue()\n\t\t}\n\n\t\tm := v.node.Status.Capacity.Memory()\n\t\tif m != nil {\n\t\t\tv.memoryAvailable = m.Value()\n\t\t}\n\n\t\tg := gpuCapacity(&v.node.Status.Capacity)\n\t\tif g != nil {\n\t\t\tv.gpuAvailable = g.Value()\n\t\t}\n\n\t\t// The ratio of cpuUsed / cpuAvailable is used for proportional scaling of\n\t\t// resources to \"normalize\" pod resource utilization to a full node. If\n\t\t// cpuUsed is 0 because the pods that are running have not made resource\n\t\t// requests, there's a possible divide by 0 in calling code so we default to\n\t\t// setting cpuUsed to cpuAvailable.\n\t\tif v.cpuUsed == 0 {\n\t\t\tv.cpuUsed = v.cpuAvailable\n\t\t}\n\n\t\tif v.memoryUsed == 0 {\n\t\t\tv.memoryUsed = v.memoryAvailable\n\t\t}\n\n\t\tif v.gpuUsed == 0 {\n\t\t\tv.gpuUsed = v.gpuAvailable\n\t\t}\n\n\t\tnrm[k] = v\n\t}\n\n\treturn nrm\n}", "func (p *mockPolicy) GetAllocatableMemory(s state.State) []state.Block {\n\treturn []state.Block{}\n}", "func computeClusterResources(nodes map[string]*repository.KubeNode) map[metrics.ResourceType]*repository.KubeDiscoveredResource {\n\t// sum the capacities of the node resources\n\tcomputeResources := make(map[metrics.ResourceType]float64)\n\tfor _, node := range nodes {\n\t\tnodeActive := util.NodeIsReady(node.Node) && util.NodeIsSchedulable(node.Node)\n\t\tif nodeActive {\n\t\t\t// Iterate over all ready and schedulable compute resource types\n\t\t\tfor _, rt := range metrics.KubeComputeResourceTypes {\n\t\t\t\t// get the compute resource if it exists\n\t\t\t\tnodeResource, exists := node.ComputeResources[rt]\n\t\t\t\tif !exists {\n\t\t\t\t\tglog.Errorf(\"Missing %s resource in node %s\", rt, node.Name)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// add the capacity to the cluster compute resource map\n\t\t\t\tcomputeCap, exists := computeResources[rt]\n\t\t\t\tif !exists {\n\t\t\t\t\tcomputeCap = nodeResource.Capacity\n\t\t\t\t} else {\n\t\t\t\t\tcomputeCap = computeCap + nodeResource.Capacity\n\t\t\t\t}\n\t\t\t\tcomputeResources[rt] = computeCap\n\t\t\t}\n\t\t}\n\t}\n\n\t// create KubeDiscoveredResource object for each compute resource type\n\tclusterResources := make(map[metrics.ResourceType]*repository.KubeDiscoveredResource)\n\tfor _, rt := range metrics.KubeComputeResourceTypes {\n\t\tcapacity := computeResources[rt]\n\t\tr := &repository.KubeDiscoveredResource{\n\t\t\tType: rt,\n\t\t\tCapacity: capacity,\n\t\t}\n\t\tclusterResources[rt] = r\n\t}\n\treturn clusterResources\n}", "func ConvertToResmgrResource(resource *task.ResourceConfig) *Resources {\n\treturn &Resources{\n\t\tCPU: resource.GetCpuLimit(),\n\t\tDISK: resource.GetDiskLimitMb(),\n\t\tGPU: resource.GetGpuLimit(),\n\t\tMEMORY: resource.GetMemLimitMb(),\n\t}\n}", "func DescribeNodeResource(nodeNonTerminatedPodsList *corev1.PodList, node *corev1.Node) *NodeUsage {\n\tallocatable := node.Status.Capacity\n\tif len(node.Status.Allocatable) > 0 {\n\t\tallocatable = node.Status.Allocatable\n\t}\n\n\treqs, limits := getPodsTotalRequestsAndLimits(nodeNonTerminatedPodsList)\n\tcpuReqs, cpuLimits, memoryReqs, memoryLimits, ephemeralstorageReqs, ephemeralstorageLimits :=\n\t\treqs[corev1.ResourceCPU], limits[corev1.ResourceCPU], reqs[corev1.ResourceMemory], limits[corev1.ResourceMemory], reqs[corev1.ResourceEphemeralStorage], limits[corev1.ResourceEphemeralStorage]\n\tfractionCpuReqs := float64(0)\n\tfractionCpuLimits := float64(0)\n\tif allocatable.Cpu().MilliValue() != 0 {\n\t\tfractionCpuReqs = float64(cpuReqs.MilliValue()) / float64(allocatable.Cpu().MilliValue()) * 100\n\t\tfractionCpuLimits = float64(cpuLimits.MilliValue()) / float64(allocatable.Cpu().MilliValue()) * 100\n\t}\n\tfractionMemoryReqs := float64(0)\n\tfractionMemoryLimits := float64(0)\n\tif allocatable.Memory().Value() != 0 {\n\t\tfractionMemoryReqs = float64(memoryReqs.Value()) / float64(allocatable.Memory().Value()) * 100\n\t\tfractionMemoryLimits = float64(memoryLimits.Value()) / float64(allocatable.Memory().Value()) * 100\n\t}\n\tfractionEphemeralStorageReqs := float64(0)\n\tfractionEphemeralStorageLimits := float64(0)\n\tif allocatable.StorageEphemeral().Value() != 0 {\n\t\tfractionEphemeralStorageReqs = float64(ephemeralstorageReqs.Value()) / float64(allocatable.StorageEphemeral().Value()) * 100\n\t\tfractionEphemeralStorageLimits = float64(ephemeralstorageLimits.Value()) / float64(allocatable.StorageEphemeral().Value()) * 100\n\t}\n\n\treturn &NodeUsage{\n\t\tcpuReqs: cpuReqs.String(),\n\t\tmemoryReqs: memoryReqs.String(),\n\t\tephemeralStorageReqs: ephemeralstorageReqs.String(),\n\t\tfractionCpuReqs: fractionCpuReqs,\n\t\tfractionCpuLimits: fractionCpuLimits,\n\t\tfractionMemoryReqs: fractionMemoryReqs,\n\t\tfractionMemoryLimits: fractionMemoryLimits,\n\t\tfractionEphemeralStorageReqs: fractionEphemeralStorageReqs,\n\t\tfractionEphemeralStorageLimits: fractionEphemeralStorageLimits,\n\t}\n}", "func (builder clusterDTOBuilder) getNodeResourceCapacity(clusterName string, commodityType proto.CommodityDTO_CommodityType,\n\tnodeResourceCapacityMap map[proto.CommodityDTO_CommodityType]float64) float64 {\n\tresourceCapacity, ok := nodeResourceCapacityMap[commodityType]\n\tif !ok {\n\t\tglog.Errorf(\"%s commodity does not exist in nodeResourceCapacityMap\", commodityType)\n\t\treturn 0\n\t}\n\tif resourceCapacity == 0 {\n\t\tglog.Errorf(\"%s commodity capacity from all nodes in cluster %s is 0.\", commodityType, clusterName)\n\t\treturn 0\n\t}\n\treturn resourceCapacity\n}", "func getTotalAllocatableMemory(f *framework.Framework) *resource.Quantity {\n\tselector := labels.Set{\"beta.kubernetes.io/os\": \"windows\"}.AsSelector()\n\tnodeList, err := f.ClientSet.CoreV1().Nodes().List(metav1.ListOptions{\n\t\tLabelSelector: selector.String(),\n\t})\n\tframework.ExpectNoError(err)\n\n\tginkgo.By(\"Summing allocatable memory across all agent nodes\")\n\n\ttotalAllocatable := resource.NewQuantity(0, resource.BinarySI)\n\n\tfor _, node := range nodeList.Items {\n\t\tstatus := node.Status\n\n\t\ttotalAllocatable.Add(status.Allocatable[v1.ResourceMemory])\n\t}\n\n\treturn totalAllocatable\n}", "func (p *ResourcePool) Available() reflow.Resources {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tvar reserved reflow.Resources\n\tfor _, alloc := range p.allocs {\n\t\tif !AllocExpired(alloc) {\n\t\t\treserved.Add(reserved, alloc.Resources())\n\t\t}\n\t}\n\tvar avail reflow.Resources\n\tavail.Sub(p.resources, reserved)\n\treturn avail\n}", "func GetTaskAllocation(rmTask *resmgr.Task) *Allocation {\n\talloc := initializeZeroAlloc()\n\n\ttaskResource := ConvertToResmgrResource(rmTask.Resource)\n\n\t// check if the task is non-preemptible\n\tif rmTask.GetPreemptible() {\n\t\talloc.Value[PreemptibleAllocation] = taskResource\n\t} else {\n\t\talloc.Value[NonPreemptibleAllocation] = taskResource\n\t}\n\n\t// check if its a controller task\n\tif rmTask.GetController() {\n\t\talloc.Value[ControllerAllocation] = taskResource\n\t}\n\n\tif rmTask.GetRevocable() {\n\t\talloc.Value[SlackAllocation] = taskResource\n\t} else {\n\t\talloc.Value[NonSlackAllocation] = taskResource\n\t}\n\n\t// every task account for total allocation\n\talloc.Value[TotalAllocation] = taskResource\n\n\treturn alloc\n}", "func (n *resPool) AggregatedChildrenReservations() (map[string]float64, error) {\n\ttotalReservation := make(map[string]float64)\n\tn.RLock()\n\tdefer n.RUnlock()\n\n\tnodes := n.children\n\t// We need to find out the total reservation\n\tfor e := nodes.Front(); e != nil; e = e.Next() {\n\t\tn, ok := e.Value.(ResPool)\n\t\tif !ok {\n\t\t\treturn totalReservation, errors.Errorf(\n\t\t\t\t\"failed to type assert child resource pool %v\",\n\t\t\t\te.Value)\n\t\t}\n\t\tresources := n.Resources()\n\t\tfor kind, resource := range resources {\n\t\t\ttotalReservation[kind] =\n\t\t\t\ttotalReservation[kind] + resource.Reservation\n\t\t}\n\t}\n\treturn totalReservation, nil\n}", "func checkNodeAllocatableTest(f *framework.Framework) {\n\n\tnodeMem := getNodeMemory(f)\n\tframework.Logf(\"nodeMem says: %+v\", nodeMem)\n\n\t// calculate the allocatable mem based on capacity - reserved amounts\n\tcalculatedNodeAlloc := nodeMem.capacity.Copy()\n\tcalculatedNodeAlloc.Sub(nodeMem.systemReserve)\n\tcalculatedNodeAlloc.Sub(nodeMem.kubeReserve)\n\tcalculatedNodeAlloc.Sub(nodeMem.softEviction)\n\tcalculatedNodeAlloc.Sub(nodeMem.hardEviction)\n\n\tginkgo.By(fmt.Sprintf(\"Checking stated allocatable memory %v against calculated allocatable memory %v\", &nodeMem.allocatable, calculatedNodeAlloc))\n\n\t// sanity check against stated allocatable\n\tgomega.Expect(calculatedNodeAlloc.Cmp(nodeMem.allocatable)).To(gomega.Equal(0))\n}", "func Allocs(nomad *NomadServer) []Alloc {\n\tallocs := make([]Alloc, 0)\n\tdecodeJSON(url(nomad)+\"/v1/allocations\", &allocs)\n\treturn allocs\n}", "func (n *resPool) CalculateTotalAllocatedResources() *scalar.Resources {\n\tn.Lock()\n\tdefer n.Unlock()\n\treturn n.calculateAllocation().GetByType(scalar.TotalAllocation)\n}", "func getValidTopology(topologyMap map[string][]string) ([]string, []string) {\n\tvar regionValues []string\n\tvar zoneValues []string\n\tfor region, zones := range topologyMap {\n\t\tregionValues = append(regionValues, region)\n\t\tzoneValues = append(zoneValues, zones...)\n\t}\n\treturn regionValues, zoneValues\n}", "func (r *ReconcileKogitoInfra) getDeployedResources(instance *v1alpha1.KogitoInfra) (resources map[reflect.Type][]resource.KubernetesResource, err error) {\n\tresourcesInfinispan, err := infinispan.GetDeployedResources(instance, r.client)\n\tif err != nil {\n\t\treturn\n\t}\n\tresourcesKafka, err := kafka.GetDeployedResources(instance, r.client)\n\tif err != nil {\n\t\treturn\n\t}\n\tresourcesKeycloak, err := keycloak.GetDeployedResources(instance, r.client)\n\tif err != nil {\n\t\treturn\n\t}\n\tresources = make(map[reflect.Type][]resource.KubernetesResource, len(resourcesInfinispan)+len(resourcesKafka)+len(resourcesKeycloak))\n\tmergeResourceMaps(resources, resourcesKafka, resourcesInfinispan, resourcesKeycloak)\n\treturn\n}", "func (config *AppConfig) getNodeAllocationsByPage(nodeID int, pageID int) (NodeAllocations, error) {\n\tvar allocations NodeAllocations\n\tendpoint := fmt.Sprintf(\"nodes/%d/allocations?page=%d\", nodeID, pageID)\n\n\tnodeAllocBytes, err := config.queryApplicationAPI(endpoint, \"get\", nil)\n\tif err != nil {\n\t\treturn allocations, err\n\t}\n\n\t// Get node info from the panel\n\t// Unmarshal the bytes to a usable struct.\n\terr = json.Unmarshal(nodeAllocBytes, &allocations)\n\tif err != nil {\n\t\treturn allocations, err\n\t}\n\treturn allocations, nil\n}", "func getDeviceResourcesForNode(deviceGroupStats []*api.DeviceGroupStats, node *api.Node) []string {\n\tstatsSummaryMap := buildDeviceStatsSummaryMap(deviceGroupStats)\n\n\tdevices := []string{}\n\tfor _, dg := range node.NodeResources.Devices {\n\t\tfor _, inst := range dg.Instances {\n\t\t\tid := deviceQualifiedID(dg.Vendor, dg.Type, dg.Name, inst.ID)\n\t\t\tstatStr := \"\"\n\t\t\tif stats, ok := statsSummaryMap[id]; ok && stats != nil {\n\t\t\t\tstatStr = stats.String()\n\t\t\t}\n\n\t\t\tdevices = append(devices, fmt.Sprintf(\"%v|%v\", id, statStr))\n\t\t}\n\t}\n\n\tsort.Strings(devices)\n\n\treturn devices\n}", "func MapsToResources(resources map[string]string) map[ResourceName]string {\n\tif resources == nil {\n\t\treturn nil\n\t}\n\trns := make(map[ResourceName]string, 0)\n\tfor k, data := range resources {\n\t\tname := stringToResourceName(k)\n\t\tif name == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\trns[name] = data\n\t}\n\treturn rns\n}", "func (n *resPool) GetNonSlackAllocatedResources() *scalar.Resources {\n\tn.RLock()\n\tdefer n.RUnlock()\n\treturn n.allocation.GetByType(scalar.NonSlackAllocation)\n}", "func MapToResourceTags(tagMap map[string]string) []interface{} {\n\tvar tags []interface{}\n\tfor eachKey, eachValue := range tagMap {\n\t\ttags = append(tags, map[string]interface{}{\n\t\t\t\"Key\": eachKey,\n\t\t\t\"Value\": eachValue,\n\t\t})\n\t}\n\treturn tags\n}", "func IsValidNodeTopology(nodeTopology *v1alpha2.NodeResourceTopology, kubeletConfig *kubeletconfig.KubeletConfiguration) bool {\n\tif nodeTopology == nil || len(nodeTopology.TopologyPolicies) == 0 {\n\t\tframework.Logf(\"failed to get topology policy from the node topology resource\")\n\t\treturn false\n\t}\n\n\ttmPolicy := string(topologypolicy.DetectTopologyPolicy(kubeletConfig.TopologyManagerPolicy, kubeletConfig.TopologyManagerScope))\n\tif nodeTopology.TopologyPolicies[0] != tmPolicy {\n\t\tframework.Logf(\"topology policy mismatch got %q expected %q\", nodeTopology.TopologyPolicies[0], tmPolicy)\n\t\treturn false\n\t}\n\n\texpectedPolicyAttribute := v1alpha2.AttributeInfo{\n\t\tName: nfdtopologyupdater.TopologyManagerPolicyAttributeName,\n\t\tValue: kubeletConfig.TopologyManagerPolicy,\n\t}\n\tif !containsAttribute(nodeTopology.Attributes, expectedPolicyAttribute) {\n\t\tframework.Logf(\"topology policy attributes don't have correct topologyManagerPolicy attribute expected %v attributeList %v\", expectedPolicyAttribute, nodeTopology.Attributes)\n\t\treturn false\n\t}\n\n\texpectedScopeAttribute := v1alpha2.AttributeInfo{\n\t\tName: nfdtopologyupdater.TopologyManagerScopeAttributeName,\n\t\tValue: kubeletConfig.TopologyManagerScope,\n\t}\n\tif !containsAttribute(nodeTopology.Attributes, expectedScopeAttribute) {\n\t\tframework.Logf(\"topology policy attributes don't have correct topologyManagerScope attribute expected %v attributeList %v\", expectedScopeAttribute, nodeTopology.Attributes)\n\t\treturn false\n\t}\n\n\tif nodeTopology.Zones == nil || len(nodeTopology.Zones) == 0 {\n\t\tframework.Logf(\"failed to get topology zones from the node topology resource\")\n\t\treturn false\n\t}\n\n\tfoundNodes := 0\n\tfor _, zone := range nodeTopology.Zones {\n\t\t// TODO constant not in the APIs\n\t\tif !strings.HasPrefix(strings.ToUpper(zone.Type), \"NODE\") {\n\t\t\tcontinue\n\t\t}\n\t\tfoundNodes++\n\n\t\tif !isValidCostList(zone.Name, zone.Costs) {\n\t\t\tframework.Logf(\"invalid cost list for zone %q\", zone.Name)\n\t\t\treturn false\n\t\t}\n\n\t\tif !isValidResourceList(zone.Name, zone.Resources) {\n\t\t\tframework.Logf(\"invalid resource list for zone %q\", zone.Name)\n\t\t\treturn false\n\t\t}\n\t}\n\treturn foundNodes > 0\n}", "func newKubeNodeStatusAllocatableMemoryBytesMetric(fqname, node string, value float64) KubeNodeStatusAllocatableMemoryBytesMetric {\n\treturn KubeNodeStatusAllocatableMemoryBytesMetric{\n\t\tfqName: fqname,\n\t\thelp: \"kube_node_status_allocatable_memory_bytes node allocatable memory in bytes\",\n\t\tnode: node,\n\t\tvalue: value,\n\t}\n}", "func (c *AgonesDiscoverAllocator) Allocate(ctx context.Context, req *pb.AssignTicketsRequest) error {\n\tlogger := runtime.Logger().WithField(\"component\", \"allocator\")\n\n\tfor _, assignmentGroup := range req.Assignments {\n\t\tif err := IsAssignmentGroupValidForAllocation(assignmentGroup); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfilter, err := extensions.ExtractFilterFromExtensions(assignmentGroup.Assignment.Extensions)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"the assignment does not have a valid filter extension\")\n\t\t}\n\n\t\tgameservers, err := c.ListGameServers(ctx, filter)\n\t\tif err != nil {\n\t\t\tlogger.Error(err)\n\t\t\treturn err\n\t\t}\n\n\t\tif len(gameservers) == 0 {\n\t\t\tlogger.Debugf(\"gameservers not found for request with filter %v\", filter.Map())\n\t\t\tcontinue\n\t\t}\n\n\t\t// NiceToHave: Filter GameServers by Capacity and Count\n\t\t// Remove not assigned tickets based on playersCapacity - Count\n\t\t// strategy: allTogether, CapacityBased FallBack\n\t\tfor _, gs := range gameservers {\n\t\t\tif HasCapacity(assignmentGroup, gs) {\n\t\t\t\tassignmentGroup.Assignment.Connection = gs.Status.Address\n\t\t\t\t//logger.Debugf(\"extension %v\", assignmentGroup.Assignment.Extensions)\n\t\t\t\tlogger.Infof(\"gameserver %s connection %s assigned to request, total tickets: %d\", gs.Name, assignmentGroup.Assignment.Connection, len(assignmentGroup.TicketIds))\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func GetReservationsforNodeInstanceIds(ec2Client ec2iface.EC2API, nodeInstanceIds []string) ([]*ec2.Reservation, error) {\n\toutput, err := ec2Client.DescribeInstances(&ec2.DescribeInstancesInput{\n\t\tInstanceIds: aws.StringSlice(nodeInstanceIds),\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn output.Reservations, nil\n}", "func (o *DeviceNode) GetResources() []map[string]interface{} {\n\tif o == nil || o.Resources == nil {\n\t\tvar ret []map[string]interface{}\n\t\treturn ret\n\t}\n\treturn *o.Resources\n}", "func (dc *dataCenter) allocateServers(n int, totalGb float64, filterFunc func(*pb.StoreResource) bool) (stores []*pb.StoreResource, err error) {\n\tvar servers []*pb.StoreResource\n\n\teachRequiredGb := uint32(math.Ceil(totalGb / float64(n)))\n\n\t// 1. select servers that has all the requiredTags and enough disk\n\tdc.RLock()\n\tfor _, server := range dc.servers {\n\t\tif filterFunc(server) && (server.DiskSizeGb-server.AllocatedSizeGb) > eachRequiredGb {\n\t\t\tservers = append(servers, server)\n\t\t}\n\t}\n\tdc.RUnlock()\n\n\tif len(servers) < n {\n\t\treturn nil, fmt.Errorf(\"only has %d servers meet the requirement\", len(servers))\n\t}\n\n\t// 2. sort by free capacity desc\n\tsort.Slice(servers, func(i, j int) bool {\n\t\treturn (servers[i].DiskSizeGb - servers[i].AllocatedSizeGb) >= (servers[j].DiskSizeGb - servers[j].AllocatedSizeGb)\n\t})\n\n\t// 3. pick the top n\n\treturn servers[:n], nil\n}", "func GetResourceRequest(pod *v1.Pod) *schedulernodeinfo.Resource {\n\tresult := &schedulernodeinfo.Resource{}\n\tfor _, container := range pod.Spec.Containers {\n\t\tresult.Add(container.Resources.Requests)\n\t}\n\n\t// take max_resource(sum_pod, any_init_container)\n\tfor _, container := range pod.Spec.InitContainers {\n\t\tresult.SetMaxResource(container.Resources.Requests)\n\t}\n\n\t// If Overhead is being utilized, add to the total requests for the pod\n\tif pod.Spec.Overhead != nil && utilfeature.DefaultFeatureGate.Enabled(features.PodOverhead) {\n\t\tresult.Add(pod.Spec.Overhead)\n\t}\n\n\treturn result\n}", "func (fm *FCFSModel)TaskNodeToResource(td *TaskDescriptor,rd *ResDescriptor)*ArcDescriptor{\n\t//ct := uint64(rand.Intn(100))\n\treturn &ArcDescriptor{\n\t\tcost: fm.TaskToResCost(td,rd),\n\t\tcapLower :0,\n\t\tcapUpper: 1,\n\t}\n}", "func (p *staticPolicy) GetAllocatableCPUs(s state.State) cpuset.CPUSet {\n\treturn p.topology.CPUDetails.CPUs().Difference(p.reservedCPUs)\n}", "func calculateResources(numNodes uint64, resources []Resource) api.ResourceList {\n\tresourceList := make(api.ResourceList)\n\tfor _, r := range resources {\n\t\t// Since we want to enable passing values smaller than e.g. 1 millicore per node,\n\t\t// we need to have some more hacky solution here than operating on MilliValues.\n\t\tperNodeString := r.ExtraPerNode.String()\n\t\tvar perNode float64\n\t\tread, _ := fmt.Sscanf(perNodeString, \"%f\", &perNode)\n\t\toverhead := resource.MustParse(fmt.Sprintf(\"%f%s\", perNode*float64(numNodes), perNodeString[read:]))\n\n\t\tnewRes := r.Base\n\t\tnewRes.Add(overhead)\n\n\t\tlog.V(4).Infof(\"New requirement for resource %s with %d nodes is %s\", r.Name, numNodes, newRes.String())\n\n\t\tresourceList[r.Name] = newRes\n\t}\n\treturn resourceList\n}", "func (n *resPool) SetTotalAllocatedResources(allocation *scalar.Resources) {\n\tn.Lock()\n\tdefer n.Unlock()\n\tn.allocation.Value[scalar.TotalAllocation] = allocation\n}", "func newKubeNodeStatusAllocatableMetric(fqname, node, resource, unit string, value float64) KubeNodeStatusAllocatableMetric {\n\treturn KubeNodeStatusAllocatableMetric{\n\t\tfqName: fqname,\n\t\thelp: \"kube_node_status_allocatable node allocatable\",\n\t\tnode: node,\n\t\tresource: resource,\n\t\tunit: unit,\n\t\tvalue: value,\n\t}\n}", "func (n *resPool) Resources() map[string]*respool.ResourceConfig {\n\tn.RLock()\n\tdefer n.RUnlock()\n\treturn n.resourceConfigs\n}", "func (p *president) EvaluateAllocationRequests(resourceRequest map[shared.ClientID]shared.Resources, availCommonPool shared.Resources) shared.PresidentReturnContent {\n\tp.c.clientPrint(\"Evaluating allocations...\")\n\tvar avgResource, avgRequest shared.Resources\n\tvar allocSum, commonPoolThreshold, sumRequest float64\n\n\t// Make sure resource skew is greater than 1\n\tresourceSkew := math.Max(float64(p.c.params.resourcesSkew), 1)\n\n\tresources := make(map[shared.ClientID]shared.Resources)\n\tallocations := make(map[shared.ClientID]float64)\n\tallocWeights := make(map[shared.ClientID]float64)\n\tfinalAllocations := make(map[shared.ClientID]shared.Resources)\n\n\tfor island, req := range resourceRequest {\n\t\tsumRequest += float64(req)\n\t\tresources[island] = shared.Resources(float64(p.c.declaredResources[island]) * math.Pow(resourceSkew, ((100-p.c.trustScore[island])/100)))\n\t}\n\n\tp.c.clientPrint(\"Resource requests: %+v\\n\", resourceRequest)\n\tp.c.clientPrint(\"Their resource estimation: %+v\\n\", p.c.declaredResources)\n\tp.c.clientPrint(\"Our estimation: %+v\\n\", resources)\n\tp.c.clientPrint(\"Trust Scores: %+v\\n\", p.c.trustScore)\n\n\tavgRequest = findAvgNoTails(resourceRequest)\n\tavgResource = findAvgNoTails(resources)\n\n\tfor island, resource := range resources {\n\t\tallocations[island] = float64(avgRequest) + p.c.params.equity*(float64(avgResource-resource)+float64(resourceRequest[island]-avgRequest))\n\t\t// p.c.clientPrint(\"Allocation for island %v: %f\", island, allocations[island])\n\t\tif island == p.c.GetID() {\n\t\t\tallocations[island] += math.Max(float64(resourceRequest[island])-allocations[island]*p.c.params.selfishness, 0)\n\t\t} else {\n\t\t\tallocations[island] = math.Min(float64(resourceRequest[island]), allocations[island]) // to prevent overallocating\n\t\t\tallocations[island] = math.Max(allocations[island], 0)\n\t\t}\n\t}\n\n\t// Collect weights\n\tfor _, alloc := range allocations {\n\t\tallocSum += alloc\n\t}\n\t// Normalise\n\tfor island, alloc := range allocations {\n\t\tallocWeights[island] = alloc / allocSum\n\t}\n\t// p.c.clientPrint(\"Allocation wieghts: %+v\\n\", allocWeights)\n\n\tcommonPoolThreshold = math.Min(float64(availCommonPool)*(1.0-p.c.params.riskFactor), sumRequest)\n\tif p.c.params.saveCriticalIsland {\n\t\tfor island := range resourceRequest {\n\t\t\tif resources[island] < p.c.criticalThreshold {\n\t\t\t\tfinalAllocations[island] = shared.Resources(math.Max((allocWeights[island] * commonPoolThreshold), float64(p.c.criticalThreshold-resources[island])))\n\t\t\t} else {\n\t\t\t\tfinalAllocations[island] = 0\n\t\t\t}\n\t\t}\n\t}\n\n\tfor island := range resourceRequest {\n\t\tif finalAllocations[island] == 0 {\n\t\t\tif sumRequest < commonPoolThreshold {\n\t\t\t\tfinalAllocations[island] = shared.Resources(math.Max(allocWeights[island]*float64(sumRequest), 0))\n\t\t\t} else {\n\t\t\t\tfinalAllocations[island] = shared.Resources(math.Max(allocWeights[island]*commonPoolThreshold, 0))\n\t\t\t}\n\t\t}\n\t}\n\n\tp.c.clientPrint(\"Final allocations: %+v\\n\", finalAllocations)\n\n\t// Curently always evaluate, would there be a time when we don't want to?\n\treturn shared.PresidentReturnContent{\n\t\tContentType: shared.PresidentAllocation,\n\t\tResourceMap: finalAllocations,\n\t\tActionTaken: true,\n\t}\n}", "func getRequestedResources(container corev1.Container) (map[string]int64, error) {\n\tfor _, v := range container.Env {\n\t\tif strings.HasPrefix(v.Name, \"FPGA_REGION\") || strings.HasPrefix(v.Name, \"FPGA_AFU\") {\n\t\t\treturn nil, errors.Errorf(\"environment variable '%s' is not allowed\", v.Name)\n\t\t}\n\t}\n\n\t// Container may happen to have Requests, but not Limits. Check Requests first,\n\t// then in the next loop iterate over Limits.\n\tfor resourceName, resourceQuantity := range container.Resources.Requests {\n\t\trname := strings.ToLower(string(resourceName))\n\t\tif !strings.HasPrefix(rname, namespace) {\n\t\t\t// Skip non-FPGA resources in Requests.\n\t\t\tcontinue\n\t\t}\n\n\t\tif container.Resources.Limits[resourceName] != resourceQuantity {\n\t\t\treturn nil, errors.Errorf(\n\t\t\t\t\"'limits' and 'requests' for %q must be equal as extended resources cannot be overcommitted\",\n\t\t\t\trname)\n\t\t}\n\t}\n\n\tresources := make(map[string]int64)\n\tfor resourceName, resourceQuantity := range container.Resources.Limits {\n\t\trname := strings.ToLower(string(resourceName))\n\t\tif !strings.HasPrefix(rname, namespace) {\n\t\t\t// Skip non-FPGA resources in Limits.\n\t\t\tcontinue\n\t\t}\n\n\t\tif container.Resources.Requests[resourceName] != resourceQuantity {\n\t\t\treturn nil, errors.Errorf(\n\t\t\t\t\"'limits' and 'requests' for %q must be equal as extended resources cannot be overcommitted\",\n\t\t\t\trname)\n\t\t}\n\n\t\tquantity, ok := resourceQuantity.AsInt64()\n\t\tif !ok {\n\t\t\treturn nil, errors.Errorf(\"resource quantity isn't of integral type for %q\", rname)\n\t\t}\n\n\t\tresources[rname] = quantity\n\t}\n\n\treturn resources, nil\n}", "func VertexaiBetaModelDeploymentDedicatedResourcesToProto(o *beta.ModelDeploymentDedicatedResources) *betapb.VertexaiBetaModelDeploymentDedicatedResources {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &betapb.VertexaiBetaModelDeploymentDedicatedResources{}\n\tp.SetMachineSpec(VertexaiBetaModelDeploymentDedicatedResourcesMachineSpecToProto(o.MachineSpec))\n\tp.SetMinReplicaCount(dcl.ValueOrEmptyInt64(o.MinReplicaCount))\n\tp.SetMaxReplicaCount(dcl.ValueOrEmptyInt64(o.MaxReplicaCount))\n\treturn p\n}", "func GetRequestsResourceListFromPipeline(pipelineInfo *pps.PipelineInfo) (*v1.ResourceList, error) {\n\treturn getResourceListFromSpec(pipelineInfo.ResourceRequests, pipelineInfo.CacheSize)\n}", "func MustMarshalResourceNode(cdc *codec.Codec, resourceNode ResourceNode) []byte {\n\treturn cdc.MustMarshalBinaryLengthPrefixed(resourceNode)\n}", "func (c *Client) MetricResourcesPerNode() (result float64, err error) {\n\tret := ValueMetricJSON{}\n\treturn ret.Value, c.Metric(&ret, \"com.puppetlabs.puppetdb.query.population:type=default,name=avg-resources-per-node\")\n}", "func GetResourceListFromPipeline(pipelineInfo *pps.PipelineInfo) (*api.ResourceList, error) {\n\tvar result api.ResourceList = make(map[api.ResourceName]resource.Quantity)\n\tresources, cacheSize := pipelineInfo.ResourceSpec, pipelineInfo.CacheSize\n\tcpuStr := fmt.Sprintf(\"%f\", resources.Cpu)\n\tcpuQuantity, err := resource.ParseQuantity(cpuStr)\n\tif err != nil {\n\t\tlog.Warnf(\"error parsing cpu string: %s: %+v\", cpuStr, err)\n\t} else {\n\t\tresult[api.ResourceCPU] = cpuQuantity\n\t}\n\n\tmemQuantity, err := resource.ParseQuantity(resources.Memory)\n\tif err != nil {\n\t\tlog.Warnf(\"error parsing memory string: %s: %+v\", resources.Memory, err)\n\t} else {\n\t\tresult[api.ResourceMemory] = memQuantity\n\t}\n\n\t// Here we are sanity checking. A pipeline should request at least\n\t// as much memory as it needs for caching.\n\tcacheQuantity, err := resource.ParseQuantity(cacheSize)\n\tif err != nil {\n\t\tlog.Warnf(\"error parsing cache string: %s: %+v\", cacheSize, err)\n\t} else if cacheQuantity.Cmp(memQuantity) > 0 {\n\t\tresult[api.ResourceMemory] = cacheQuantity\n\t}\n\n\tgpuStr := fmt.Sprintf(\"%d\", resources.Gpu)\n\tgpuQuantity, err := resource.ParseQuantity(gpuStr)\n\tif err != nil {\n\t\tlog.Warnf(\"error parsing gpu string: %s: %+v\", gpuStr, err)\n\t} else {\n\t\tresult[api.ResourceNvidiaGPU] = gpuQuantity\n\t}\n\treturn &result, nil\n}", "func resourceComputeRouterNatListForPatch(d *schema.ResourceData, meta interface{}) ([]interface{}, error) {\n\tconfig := meta.(*transport_tpg.Config)\n\turl, err := tpgresource.ReplaceVars(d, config, \"{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/routers/{{router}}\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tproject, err := tpgresource.GetProject(d, config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tuserAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{\n\t\tConfig: config,\n\t\tMethod: \"GET\",\n\t\tProject: project,\n\t\tRawURL: url,\n\t\tUserAgent: userAgent,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar v interface{}\n\tvar ok bool\n\n\tv, ok = res[\"nats\"]\n\tif ok && v != nil {\n\t\tls, lsOk := v.([]interface{})\n\t\tif !lsOk {\n\t\t\treturn nil, fmt.Errorf(`expected list for nested field \"nats\"`)\n\t\t}\n\t\treturn ls, nil\n\t}\n\treturn nil, nil\n}", "func GetResourceMapping() map[string][]Resource { return resourceMapping.ResourceIDToResource }", "func NewStakingInfoByResourceNodeAddr(\n\tresourceNode types.ResourceNode,\n\tunbondingStake sdk.Int,\n\tunbondedStake sdk.Int,\n\tbondedStake sdk.Int,\n\n) StakingInfoByResourceNodeAddr {\n\treturn StakingInfoByResourceNodeAddr{\n\t\tResourceNode: resourceNode,\n\t\tUnbondingStake: sdk.NewCoin(defaultDenom, unbondingStake),\n\t\tUnbondedStake: sdk.NewCoin(defaultDenom, unbondedStake),\n\t\tBondedStake: sdk.NewCoin(defaultDenom, bondedStake),\n\t}\n}", "func (n *resPool) GetSlackAllocatedResources() *scalar.Resources {\n\tn.RLock()\n\tdefer n.RUnlock()\n\treturn n.allocation.GetByType(scalar.SlackAllocation)\n}", "func InitResourceMapping(m *ResourceMapping) { resourceMapping = m }", "func collectPreferredResources(discovery discovery.DiscoveryInterface) ([]*metav1.APIResourceList, error) {\n\tresources, err := discovery.ServerPreferredNamespacedResources()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, res := range resources {\n\t\tres.APIResources = excludeSubresources(res.APIResources)\n\t\t// Some resources appear not to have permissions to list, need to exclude those.\n\t\tres.APIResources = listAllowed(res.APIResources)\n\t}\n\n\treturn resources, nil\n}", "func _dirtySeriesMapAlloc(opts _dirtySeriesMapOptions) *dirtySeriesMap {\n\tm := &dirtySeriesMap{_dirtySeriesMapOptions: opts}\n\tm.Reallocate()\n\treturn m\n}", "func parseResources(resources []ResourceCache) map[envoy_xds.ResponseType]ResourceCache {\n\n\tresourceMap := make(map[envoy_xds.ResponseType]ResourceCache, len(resources))\n\n\tfor _, r := range resources {\n\t\tswitch r.TypeURL() {\n\t\tcase resource.ClusterType:\n\t\t\tresourceMap[envoy_xds.Cluster] = r\n\t\tcase resource.RouteType:\n\t\t\tresourceMap[envoy_xds.Route] = r\n\t\tcase resource.ListenerType:\n\t\t\tresourceMap[envoy_xds.Listener] = r\n\t\tcase resource.SecretType:\n\t\t\tresourceMap[envoy_xds.Secret] = r\n\t\tcase resource.EndpointType:\n\t\t\tresourceMap[envoy_xds.Endpoint] = r\n\t\t}\n\t}\n\treturn resourceMap\n}", "func (zic *ZoneInterconnectHandler) createLocalZoneNodeResources(node *corev1.Node, nodeID int) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port ips for node %s: %w\", node.Name, err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\t// Connect transit switch to the cluster router by creating a pair of logical switch port - logical router port\n\tlogicalRouterPortName := zic.GetNetworkScopedName(types.RouterToTransitSwitchPrefix + node.Name)\n\tlogicalRouterPort := nbdb.LogicalRouterPort{\n\t\tName: logicalRouterPortName,\n\t\tMAC: transitRouterPortMac.String(),\n\t\tNetworks: transitRouterPortNetworks,\n\t\tOptions: map[string]string{\n\t\t\t\"mcast_flood\": \"true\",\n\t\t},\n\t}\n\tlogicalRouter := nbdb.LogicalRouter{\n\t\tName: zic.networkClusterRouterName,\n\t}\n\n\tif err := libovsdbops.CreateOrUpdateLogicalRouterPort(zic.nbClient, &logicalRouter, &logicalRouterPort, nil); err != nil {\n\t\treturn fmt.Errorf(\"failed to create/update cluster router %s to add transit switch port %s for the node %s: %w\", zic.networkClusterRouterName, logicalRouterPortName, node.Name, err)\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"router-port\": logicalRouterPortName,\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\terr = zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix+node.Name),\n\t\tlportTypeRouter, []string{lportTypeRouterAddr}, lspOptions, externalIDs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Its possible that node is moved from a remote zone to the local zone. Check and delete the remote zone routes\n\t// for this node as it's no longer needed.\n\treturn zic.deleteLocalNodeStaticRoutes(node, nodeID, nodeTransitSwitchPortIPs)\n}", "func ComputePodResourceRequest(pod *v1.Pod) *Resource {\n\tresource := &Resource{}\n\tfor _, container := range pod.Spec.Containers {\n\t\tresource.Add(container.Resources.Requests)\n\t}\n\n\t// take max_resource(sum_pod, any_init_container)\n\tfor _, container := range pod.Spec.InitContainers {\n\t\tresource.SetMaxResource(container.Resources.Requests)\n\t}\n\n\t// If Overhead is being utilized, add to the total requests for the pod\n\tif pod.Spec.Overhead != nil {\n\t\tresource.Add(pod.Spec.Overhead)\n\t}\n\n\treturn resource\n}", "func VertexaiEndpointDeployedModelsDedicatedResourcesToProto(o *vertexai.EndpointDeployedModelsDedicatedResources) *vertexaipb.VertexaiEndpointDeployedModelsDedicatedResources {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &vertexaipb.VertexaiEndpointDeployedModelsDedicatedResources{}\n\tp.SetMachineSpec(VertexaiEndpointDeployedModelsDedicatedResourcesMachineSpecToProto(o.MachineSpec))\n\tp.SetMinReplicaCount(dcl.ValueOrEmptyInt64(o.MinReplicaCount))\n\tp.SetMaxReplicaCount(dcl.ValueOrEmptyInt64(o.MaxReplicaCount))\n\tsAutoscalingMetricSpecs := make([]*vertexaipb.VertexaiEndpointDeployedModelsDedicatedResourcesAutoscalingMetricSpecs, len(o.AutoscalingMetricSpecs))\n\tfor i, r := range o.AutoscalingMetricSpecs {\n\t\tsAutoscalingMetricSpecs[i] = VertexaiEndpointDeployedModelsDedicatedResourcesAutoscalingMetricSpecsToProto(&r)\n\t}\n\tp.SetAutoscalingMetricSpecs(sAutoscalingMetricSpecs)\n\treturn p\n}", "func NewResourceCacheMap() *ResourceCacheMap {\n\treturn &ResourceCacheMap{\n\t\tcache: make(map[object.ObjMetadata]*unstructured.Unstructured),\n\t}\n}", "func (zic *ZoneInterconnectHandler) createRemoteZoneNodeResources(node *corev1.Node, nodeID int, chassisId string) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port Ips : %w\", err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\tremotePortAddr := transitRouterPortMac.String()\n\tfor _, tsNetwork := range transitRouterPortNetworks {\n\t\tremotePortAddr = remotePortAddr + \" \" + tsNetwork\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\n\tremotePortName := zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix + node.Name)\n\tif err := zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, remotePortName, lportTypeRemote, []string{remotePortAddr}, lspOptions, externalIDs); err != nil {\n\t\treturn err\n\t}\n\t// Set the port binding chassis.\n\tif err := zic.setRemotePortBindingChassis(node.Name, remotePortName, chassisId); err != nil {\n\t\treturn err\n\t}\n\n\tif err := zic.addRemoteNodeStaticRoutes(node, nodeTransitSwitchPortIPs); err != nil {\n\t\treturn err\n\t}\n\n\t// Cleanup the logical router port connecting to the transit switch for the remote node (if present)\n\t// Cleanup would be required when a local zone node moves to a remote zone.\n\treturn zic.cleanupNodeClusterRouterPort(node.Name)\n}", "func GetResourceLimits(pod *api.Pod) (cpuCapacity float64, memCapacity float64, err error) {\n\tif pod == nil {\n\t\terr = errors.New(\"pod passed in is nil.\")\n\t\treturn\n\t}\n\n\tfor _, container := range pod.Spec.Containers {\n\t\tlimits := container.Resources.Limits\n\n\t\tmemCap := limits.Memory().Value()\n\t\tcpuCap := limits.Cpu().MilliValue()\n\t\tmemCapacity += float64(memCap) / 1024\n\t\tcpuCapacity += float64(cpuCap) / 1000\n\t}\n\treturn\n}", "func InitAllocator(addr uint32) {\n\t// Warning: Lot of unsafe pointer usage and manipulation ahead.\n\t// This function basically initializes memory at given address, so that\n\t// _buddyAllocator, and it's members, point to this address.\n\n\t// create freeBuddiesList\n\tvar _freeBuddiesList *[MaxOrder + 1]freeBuddiesList\n\t_freeBuddiesList = (*[MaxOrder + 1]freeBuddiesList)(pointer.Get(addr))\n\taddr += (MaxOrder + 1) * uint32(unsafe.Sizeof(freeBuddiesList{}))\n\n\t// set freeBuddiesList in buddyAllocator\n\t_buddyAllocator.buddies = (*_freeBuddiesList)[:MaxOrder+1]\n\n\t// create bigPagesBitmap\n\t// _nBigPages size for array is way more than needed. this is done since\n\t// array sizes need to be constant.\n\tvar _bigPagesBitmap *[_nBigPages]uint32\n\t_bigPagesBitmap = (*[_nBigPages]uint32)(pointer.Get(addr))\n\taddr += nMaps(_nBigPages) * 4\n\n\t// set bigPagesBitmap in buddyAllocator\n\t_buddyAllocator.buddies[MaxOrder].freeMap.maps = (*_bigPagesBitmap)[:nMaps(_nBigPages)]\n\n\t// mark all big pages as free\n\tfor i := uint32(0); i < nMaps(_nBigPages); i++ {\n\t\t_buddyAllocator.buddies[MaxOrder].freeMap.maps[i] = _allSet\n\t}\n\n\t// create the individual freeBuddiesList\n\tfor i := 0; i < MaxOrder; i++ {\n\t\t// maxOrder - 1 pages of order i, further divide by 2 since we use 1 bit\n\t\t// for buddy pair.\n\t\tvar nBuddies uint32 = _nBigPages * (1 << uint32(MaxOrder-i-1))\n\t\tnMaps := nMaps(nBuddies)\n\n\t\t// set address for this freeBuddiesList\n\t\t// we are addressing way more memory than needed, because array sizes need\n\t\t// to be constant. this will be more than enough for largest freeBuddiesList\n\t\tvar maps *[_nBigPages * _nBigPages]uint32\n\t\tmaps = (*[_nBigPages * _nBigPages]uint32)(pointer.Get(addr))\n\t\taddr += nMaps * 4\n\n\t\t// set the freeBuddiesList\n\t\t_buddyAllocator.buddies[i].freeMap.maps = (*maps)[:nMaps]\n\n\t\t// zero out the freeBuddiesList\n\t\tfor j := uint32(0); j < nMaps; j++ {\n\t\t\t_buddyAllocator.buddies[i].freeMap.maps[j] = 0\n\t\t}\n\t}\n\n\tinitNodePool(addr)\n}", "func SpaceMapAllocate() (* SpaceMap) {\n return &SpaceMap{}\n}", "func (o ArgoCDSpecServerResourcesOutput) Requests() ArgoCDSpecServerResourcesRequestsMapOutput {\n\treturn o.ApplyT(func(v ArgoCDSpecServerResources) map[string]ArgoCDSpecServerResourcesRequests { return v.Requests }).(ArgoCDSpecServerResourcesRequestsMapOutput)\n}", "func allResources(container *api.Container) map[api.ResourceName]bool {\n\tresources := map[api.ResourceName]bool{}\n\tfor _, resource := range supportedComputeResources {\n\t\tresources[resource] = false\n\t}\n\tfor resource := range container.Resources.Requests {\n\t\tresources[resource] = true\n\t}\n\tfor resource := range container.Resources.Limits {\n\t\tresources[resource] = true\n\t}\n\treturn resources\n}", "func (a *appRuntimeStore) GetTenantResourceList() []TenantResource {\n\treturn a.resourceCache.GetAllTenantResource()\n}", "func (o LookupRegionCommitmentResultOutput) Resources() ResourceCommitmentResponseArrayOutput {\n\treturn o.ApplyT(func(v LookupRegionCommitmentResult) []ResourceCommitmentResponse { return v.Resources }).(ResourceCommitmentResponseArrayOutput)\n}", "func initializeZeroAlloc() *Allocation {\n\talloc := &Allocation{\n\t\tValue: make(map[AllocationType]*Resources),\n\t}\n\n\talloc.Value[TotalAllocation] = ZeroResource\n\talloc.Value[NonPreemptibleAllocation] = ZeroResource\n\talloc.Value[ControllerAllocation] = ZeroResource\n\talloc.Value[PreemptibleAllocation] = ZeroResource\n\talloc.Value[SlackAllocation] = ZeroResource\n\talloc.Value[NonSlackAllocation] = ZeroResource\n\n\treturn alloc\n}", "func toOCIResources(r *pb.LinuxContainerResources) *rspec.LinuxResources {\n\tvar swap int64\n\tmemory := r.GetMemoryLimitInBytes()\n\tif cgroupHasMemorySwap() {\n\t\tswap = memory\n\t}\n\treturn &rspec.LinuxResources{\n\t\tCPU: &rspec.LinuxCPU{\n\t\t\tShares: proto.Uint64(uint64(r.GetCpuShares())),\n\t\t\tQuota: proto.Int64(r.GetCpuQuota()),\n\t\t\tPeriod: proto.Uint64(uint64(r.GetCpuPeriod())),\n\t\t\tCpus: r.GetCpusetCpus(),\n\t\t\tMems: r.GetCpusetMems(),\n\t\t},\n\t\tMemory: &rspec.LinuxMemory{\n\t\t\tLimit: proto.Int64(memory),\n\t\t\tSwap: proto.Int64(swap),\n\t\t},\n\t\t// TODO(runcom): OOMScoreAdj is missing\n\t}\n}", "func (o PgbenchSpecPodConfigOutput) Resources() PgbenchSpecPodConfigResourcesPtrOutput {\n\treturn o.ApplyT(func(v PgbenchSpecPodConfig) *PgbenchSpecPodConfigResources { return v.Resources }).(PgbenchSpecPodConfigResourcesPtrOutput)\n}", "func (m *IngressGatewayConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *IngressGatewayConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *IngressGatewayConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *IngressGatewayConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *IngressGatewayConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *IngressGatewayConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *IngressGatewayConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *IngressGatewayConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (o SysbenchSpecOutput) Resources() SysbenchSpecResourcesPtrOutput {\n\treturn o.ApplyT(func(v SysbenchSpec) *SysbenchSpecResources { return v.Resources }).(SysbenchSpecResourcesPtrOutput)\n}", "func (parser *Parser) parseResourceTable() {\n\tchunk := parser.getLEWord(parser.ParserOffset + (1 * WORD_SIZE))\n\tparser.ResCount = (chunk / 4) - 2\n\n\tparser.ResourcesIds = make([]int, parser.ResCount)\n\tfor i := 0; i < parser.ResCount; i++ {\n\t\tparser.ResourcesIds[i] = parser.getLEWord(parser.ParserOffset + ((i + 2) * WORD_SIZE))\n\t}\n\n\tparser.ParserOffset += chunk\n}", "func parseReplsetResourceRequirements(replset *v1alpha1.ReplsetSpec) (corev1.ResourceRequirements, error) {\n\tvar err error\n\trr := corev1.ResourceRequirements{\n\t\tLimits: corev1.ResourceList{},\n\t\tRequests: corev1.ResourceList{},\n\t}\n\n\trr.Limits, err = parseResourceRequirementsList(replset.Limits)\n\tif err != nil {\n\t\treturn rr, err\n\t}\n\n\t// only set cpu+memory resource requests if limits are set\n\t// https://jira.percona.com/browse/CLOUD-44\n\trequests, err := parseResourceRequirementsList(replset.Requests)\n\tif err != nil {\n\t\treturn rr, err\n\t}\n\tif _, ok := rr.Limits[corev1.ResourceCPU]; ok {\n\t\trr.Requests[corev1.ResourceCPU] = requests[corev1.ResourceCPU]\n\t}\n\tif _, ok := rr.Limits[corev1.ResourceMemory]; ok {\n\t\trr.Requests[corev1.ResourceMemory] = requests[corev1.ResourceMemory]\n\t}\n\n\treturn rr, nil\n}", "func (o ArgoCDSpecServerResourcesPtrOutput) Requests() ArgoCDSpecServerResourcesRequestsMapOutput {\n\treturn o.ApplyT(func(v *ArgoCDSpecServerResources) map[string]ArgoCDSpecServerResourcesRequests {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Requests\n\t}).(ArgoCDSpecServerResourcesRequestsMapOutput)\n}", "func (m *TracingOpencensusConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *TracingOpencensusConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *TracingOpencensusConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *TracingOpencensusConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *TracingOpencensusConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *TracingOpencensusConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *TracingOpencensusConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (r *ReconcileKogitoInfra) createRequiredResources(instance *v1alpha1.KogitoInfra) (resources map[reflect.Type][]resource.KubernetesResource, err error) {\n\tresourcesInfinispan, err := infinispan.CreateRequiredResources(instance, r.client)\n\tif err != nil {\n\t\treturn\n\t}\n\tresourcesKafka, err := kafka.CreateRequiredResources(instance)\n\tif err != nil {\n\t\treturn\n\t}\n\tresourcesKeycloak, err := keycloak.CreateRequiredResources(instance)\n\tif err != nil {\n\t\treturn\n\t}\n\tresources = make(map[reflect.Type][]resource.KubernetesResource, len(resourcesInfinispan)+len(resourcesKafka)+len(resourcesKeycloak))\n\tmergeResourceMaps(resources, resourcesKafka, resourcesInfinispan, resourcesKeycloak)\n\treturn\n}", "func newKubeNodeStatusAllocatableCPUCoresMetric(fqname, node string, value float64) KubeNodeStatusAllocatableCPUCoresMetric {\n\treturn KubeNodeStatusAllocatableCPUCoresMetric{\n\t\tfqName: fqname,\n\t\thelp: \"kube_node_status_allocatable_cpu_cores node allocatable cpu cores\",\n\t\tnode: node,\n\t\tvalue: value,\n\t}\n}", "func (p *ResourcePool) New(ctx context.Context, meta AllocMeta) (Alloc, error) {\n\tif meta.Want.Equal(nil) {\n\t\treturn nil, errors.E(\"ResourcePool.New\", errors.Precondition, fmt.Errorf(\"illegal request for an empty resources: %s\", meta.Want))\n\t}\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tif p.stopped {\n\t\treturn nil, errors.Errorf(\"alloc %v: shutting down\", meta)\n\t}\n\tvar (\n\t\ttotal = p.resources\n\t\tused reflow.Resources\n\t\texpired []Alloc\n\t)\n\tfor _, alloc := range p.allocs {\n\t\tused.Add(used, alloc.Resources())\n\t\tif AllocExpired(alloc) {\n\t\t\texpired = append(expired, alloc)\n\t\t}\n\t}\n\t// ACHTUNG N²! (But n is small.)\n\tn := 0\n\tcollect := expired[:]\n\t// TODO: preferentially prefer those allocs which will give us the\n\t// resource types we need.\n\tp.log.Printf(\"alloc total%s used%s want%s\", total, used, meta.Want)\n\tvar free reflow.Resources\n\tfor {\n\t\tfree.Sub(total, used)\n\t\tif free.Available(meta.Want) || len(expired) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tmax := 0\n\t\tfor i := 1; i < len(expired); i++ {\n\t\t\tif AllocExpiredBy(expired[i]) > AllocExpiredBy(expired[max]) {\n\t\t\t\tmax = i\n\t\t\t}\n\t\t}\n\t\talloc := expired[max]\n\t\texpired[0], expired[max] = expired[max], expired[0]\n\t\texpired = expired[1:]\n\t\tused.Sub(used, alloc.Resources())\n\t\tn++\n\t}\n\tcollect = collect[:n]\n\tif !free.Available(meta.Want) {\n\t\treturn nil, errors.E(\"alloc\", errors.NotExist, errOfferExpired)\n\t}\n\tremainingIds := map[string]bool{}\n\tfor id := range p.allocs {\n\t\tremainingIds[id] = true\n\t}\n\tfor _, alloc := range collect {\n\t\tdelete(remainingIds, alloc.ID())\n\t}\n\tvar remaining []Alloc\n\tfor id, alloc := range p.allocs {\n\t\tif _, ok := remainingIds[id]; ok {\n\t\t\tremaining = append(remaining, alloc)\n\t\t}\n\t}\n\tid := newID()\n\talloc, err := p.manager.New(ctx, id, meta, keepaliveInterval, remaining)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp.allocs[id] = alloc\n\tfor _, alloc := range collect {\n\t\tdelete(p.allocs, alloc.ID())\n\t\tif err := p.manager.Kill(alloc); err != nil {\n\t\t\tp.log.Errorf(\"error killing alloc: %s\", err)\n\t\t} else {\n\t\t\tp.log.Printf(\"alloc reclaim %s\", alloc.ID())\n\t\t}\n\t}\n\treturn alloc, nil\n}", "func (c *Clients) GetKubeResources(r *ReleaseData) (map[string]interface{}, error) {\n\tlog.Printf(\"Getting resources for %s\", r.Name)\n\tif r.Manifest == \"\" {\n\t\treturn nil, errors.New(\"manifest not provided in the request\")\n\t}\n\tresources := map[string]interface{}{}\n\tinfos, err := c.getManifestDetails(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnamespace := \"default\"\n\tfor _, info := range infos {\n\t\tvar spec interface{}\n\t\tkind := info.Object.GetObjectKind().GroupVersionKind().GroupKind().Kind\n\t\tv := kube.AsVersioned(info)\n\t\tif checkSize(resources, ResourcesOutputSize) {\n\t\t\tbreak\n\t\t}\n\n\t\tif stringInSlice(reflect.TypeOf(v).String(), ResourcesOutputIgnoredTypes) {\n\t\t\tcontinue\n\t\t}\n\t\tinner := make(map[string]interface{})\n\t\tname, ok := ScanFromStruct(v, \"ObjectMeta.Name\")\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tns, ok := ScanFromStruct(v, \"ObjectMeta.Namespace\")\n\t\tif ok {\n\t\t\tnamespace = fmt.Sprint(ns)\n\t\t}\n\t\tif stringInSlice(reflect.TypeOf(v).String(), ResourcesOutputIncludedSpec) {\n\t\t\tspec, ok = ScanFromStruct(v, \"Spec\")\n\t\t\tif ok {\n\t\t\t\tspec = structToMap(spec)\n\t\t\t}\n\t\t}\n\t\tstatus, ok := ScanFromStruct(v, \"Status\")\n\t\tif ok {\n\t\t\tstatus = structToMap(status)\n\t\t}\n\t\tinner = map[string]interface{}{\n\t\t\tfmt.Sprint(name): map[string]interface{}{\n\t\t\t\t\"Namespace\": namespace,\n\t\t\t\t\"Spec\": spec,\n\t\t\t\t\"Status\": status,\n\t\t\t},\n\t\t}\n\t\tif IsZero(resources[kind]) {\n\t\t\tresources[kind] = map[string]interface{}{}\n\t\t}\n\t\ttemp := resources[kind].(map[string]interface{})\n\t\tresources[kind] = mergeMaps(temp, inner)\n\t}\n\treturn resources, nil\n}", "func (o SysbenchSpecPtrOutput) Resources() SysbenchSpecResourcesPtrOutput {\n\treturn o.ApplyT(func(v *SysbenchSpec) *SysbenchSpecResources {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Resources\n\t}).(SysbenchSpecResourcesPtrOutput)\n}", "func (o ApplicationMetricDescriptionResponseOutput) ReservationCapacity() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v ApplicationMetricDescriptionResponse) *float64 { return v.ReservationCapacity }).(pulumi.Float64PtrOutput)\n}", "func newUnstructuredResourceMap(unstructured *unstructured.Unstructured) *UnstructuredResourceMap {\n\treturn &UnstructuredResourceMap{\n\t\tValues: unstructured.UnstructuredContent(),\n\t}\n}", "func (config *AppConfig) CreateNodeAllocations(newNodeAllocations AllocationAttributes, nodeID int) (err error) {\n\tendpoint := fmt.Sprintf(\"nodes/%d/allocations\", nodeID)\n\n\tnewNodeAllocBytes, err := json.Marshal(newNodeAllocations)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// get json bytes from the panel.\n\t_, err = config.queryApplicationAPI(endpoint, \"post\", newNodeAllocBytes)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func (s *SchedulerSpec) ExpectedResources(rsrc interface{}) []ResourceInfo {\n\tr := rsrc.(*AirflowCluster)\n\trsrcInfos := []ResourceInfo{\n\t\tResourceInfo{LifecycleManaged, s.serviceaccount(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.rb(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.sts(r), \"\"},\n\t}\n\n\tif r.Spec.DAGs != nil {\n\t\tgit := r.Spec.DAGs.Git\n\t\tif git != nil && git.CredSecretRef != nil {\n\t\t\trsrcInfos = append(rsrcInfos,\n\t\t\t\tResourceInfo{LifecycleReferred,\n\t\t\t\t\t&resources.Secret{\n\t\t\t\t\t\tSecret: &corev1.Secret{\n\t\t\t\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\t\t\t\tNamespace: r.Namespace,\n\t\t\t\t\t\t\t\tName: git.CredSecretRef.Name,\n\t\t\t\t\t\t\t}}},\n\t\t\t\t\t\"\"})\n\t\t}\n\t}\n\n\treturn rsrcInfos\n}" ]
[ "0.5364796", "0.50617653", "0.5001727", "0.4769316", "0.47181323", "0.4706976", "0.46147397", "0.4606428", "0.45965248", "0.45897478", "0.45863438", "0.45834994", "0.45776933", "0.45581096", "0.45503893", "0.4532366", "0.45284724", "0.45280227", "0.45074448", "0.45017514", "0.44999886", "0.44834998", "0.44781455", "0.44741762", "0.4465793", "0.4437779", "0.44334468", "0.43932492", "0.43895382", "0.4384445", "0.4381486", "0.4375834", "0.4350357", "0.43499005", "0.43254673", "0.43205452", "0.43168655", "0.43108317", "0.4310188", "0.42976826", "0.42919666", "0.4268014", "0.4264607", "0.42624584", "0.42537066", "0.4227662", "0.42260298", "0.42155516", "0.42130893", "0.42034942", "0.41992792", "0.41820672", "0.41684532", "0.41522512", "0.41410953", "0.4129822", "0.4123427", "0.41079575", "0.4097854", "0.40956327", "0.4082428", "0.40791067", "0.4076077", "0.40714467", "0.4063384", "0.40620002", "0.4061962", "0.40524742", "0.40408853", "0.40395823", "0.40354556", "0.40307948", "0.4021607", "0.4021607", "0.4021607", "0.4021607", "0.4021607", "0.4021607", "0.4021607", "0.4021607", "0.40171707", "0.40171063", "0.4013267", "0.40128037", "0.40126944", "0.40126944", "0.40126944", "0.40126944", "0.40126944", "0.40126944", "0.40126944", "0.40059823", "0.40041333", "0.40032664", "0.39942688", "0.39923197", "0.39910674", "0.39862433", "0.39725223", "0.39712763" ]
0.8464234
0