//see doc at https://help.aliyun.com/document_detail/51913.html?spm=5176.doc51910.6.631.3zgHyK
487000
func (client *CMSClient) EnableAlarm(id string) error {
	args := &EnableAlarmArgss{Id: id}
	response := &EnableAlarmResponse{}
	err := client.Invoke("EnableAlarm", args, response)

	return err
}
422037
func (s *LoadBalancerService) GetLoadBalancerRuleByID(id string, opts ...OptionFunc) (*LoadBalancerRule, int, error) {
	p := &ListLoadBalancerRulesParams{}
	p.p = make(map[string]interface{})

	p.p["id"] = id

	for _, fn := range append(s.cs.options, opts...) {
		if err := fn(s.cs, p); err != nil {
			return nil, -1, err
		}
	}

	l, err := s.ListLoadBalancerRules(p)
	if err != nil {
		if strings.Contains(err.Error(), fmt.Sprintf(
			"Invalid parameter id value=%s due to incorrect long value format, "+
				"or entity does not exist", id)) {
			return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l)
		}
		return nil, -1, err
	}

	if l.Count == 0 {
		return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l)
	}

	if l.Count == 1 {
		return l.LoadBalancerRules[0], l.Count, nil
	}
	return nil, l.Count, fmt.Errorf("There is more then one result for LoadBalancerRule UUID: %s!", id)
}
129578
func (s *Send) Document(doc interface{}) *SendDocument {
	return &SendDocument{s, doc, nil, nil}
}
1335638
func unwrapNSKeyEnvelope(ke *backend.KeyEnvelope) (lorawan.AES128Key, error) {
	var key lorawan.AES128Key

	if ke.KEKLabel == "" {
		copy(key[:], ke.AESKey[:])
		return key, nil
	}

	kek, ok := keks[ke.KEKLabel]
	if !ok {
		return key, fmt.Errorf("unknown kek label: %s", ke.KEKLabel)
	}

	block, err := aes.NewCipher(kek)
	if err != nil {
		return key, errors.Wrap(err, "new cipher error")
	}

	b, err := keywrap.Unwrap(block, ke.AESKey[:])
	if err != nil {
		return key, errors.Wrap(err, "unwrap key error")
	}

	copy(key[:], b)
	return key, nil
}
1029795
func init() {
	DataOutput["mgo"] = func(self *Collector) error {
		//连接数据库
		if mgo.Error() != nil {
			mgo.Refresh()
			if mgo.Error() != nil { // try again
				return fmt.Errorf("MongoBD数据库链接失败: %v", mgo.Error())
			}
		}
		return mgo.Call(func(src pool.Src) error {
			var (
				db          = src.(*mgo.MgoSrc).DB(config.DB_NAME)
				namespace   = util.FileNameReplace(self.namespace())
				collections = make(map[string]*mgov2.Collection)
				dataMap     = make(map[string][]interface{})
				err         error
			)

			for _, datacell := range self.dataDocker {
				subNamespace := util.FileNameReplace(self.subNamespace(datacell))
				cName := joinNamespaces(namespace, subNamespace)

				if _, ok := collections[subNamespace]; !ok {
					collections[subNamespace] = db.C(cName)
				}
				for k, v := range datacell["Data"].(map[string]interface{}) {
					datacell[k] = v
				}
				delete(datacell, "Data")
				delete(datacell, "RuleName")
				if !self.Spider.OutDefaultField() {
					delete(datacell, "Url")
					delete(datacell, "ParentUrl")
					delete(datacell, "DownloadTime")
				}
				dataMap[subNamespace] = append(dataMap[subNamespace], datacell)
			}

			for collection, docs := range dataMap {
				c := collections[collection]
				count := len(docs)
				loop := count / mgo.MaxLen
				for i := 0; i < loop; i++ {
					err = c.Insert(docs[i*mgo.MaxLen : (i+1)*mgo.MaxLen]...)
					if err != nil {
						logs.Log.Error("%v", err)
					}
				}
				if count%mgo.MaxLen == 0 {
					continue
				}
				err = c.Insert(docs[loop*mgo.MaxLen:]...)
				if err != nil {
					logs.Log.Error("%v", err)
				}
			}

			return nil
		})
	}
}
1200180
func (c UserClient) GetUPAK(ctx context.Context, uid UID) (res UPAKVersioned, err error) {
	__arg := GetUPAKArg{Uid: uid}
	err = c.Cli.Call(ctx, "keybase.1.user.getUPAK", []interface{}{__arg}, &res)
	return
}
749225
func (blog Blog) JSONAPILinks() *jsonapi.Links {
	return &jsonapi.Links{
		"self": fmt.Sprintf("https://example.com/blogs/%d", blog.ID),
	}
}
355764
func (f *FileManager) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) {
	q := dsq.Query{KeysOnly: true}

	res, err := f.ds.Query(q)
	if err != nil {
		return nil, err
	}

	out := make(chan cid.Cid, dsq.KeysOnlyBufSize)
	go func() {
		defer close(out)
		for {
			v, ok := res.NextSync()
			if !ok {
				return
			}

			k := ds.RawKey(v.Key)
			c, err := dshelp.DsKeyToCid(k)
			if err != nil {
				log.Errorf("decoding cid from filestore: %s", err)
				continue
			}

			select {
			case out <- c:
			case <-ctx.Done():
				return
			}
		}
	}()

	return out, nil
}
377856
func (h *HLLPP) decodeHash(k uint32, p uint8) (_ uint32, r uint8) {
	if k&1 > 0 {
		r = uint8(sliceBits32(k, 6, 1)) + (h.pp - h.p)
	} else {
		r = rho((uint64(k) | 1) << (64 - (h.pp + 1) + h.p))
	}

	return h.getIndex(k, p), r
}
1105337
func (t *TxStructure) HLen(key []byte) (int64, error) {
	metaKey := t.encodeHashMetaKey(key)
	meta, err := t.loadHashMeta(metaKey)
	if err != nil {
		return 0, errors.Trace(err)
	}
	return meta.FieldCount, nil
}
488972
func (s *VLANService) GetVlanIpRangeByID(id string, opts ...OptionFunc) (*VlanIpRange, int, error) {
	p := &ListVlanIpRangesParams{}
	p.p = make(map[string]interface{})

	p.p["id"] = id

	for _, fn := range append(s.cs.options, opts...) {
		if err := fn(s.cs, p); err != nil {
			return nil, -1, err
		}
	}

	l, err := s.ListVlanIpRanges(p)
	if err != nil {
		if strings.Contains(err.Error(), fmt.Sprintf(
			"Invalid parameter id value=%s due to incorrect long value format, "+
				"or entity does not exist", id)) {
			return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l)
		}
		return nil, -1, err
	}

	if l.Count == 0 {
		return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l)
	}

	if l.Count == 1 {
		return l.VlanIpRanges[0], l.Count, nil
	}
	return nil, l.Count, fmt.Errorf("There is more then one result for VlanIpRange UUID: %s!", id)
}
1215633
func (rb *reorderBuffer) decomposeHangul(r rune) {
	r -= hangulBase
	x := r % jamoTCount
	r /= jamoTCount
	rb.appendRune(jamoLBase + r/jamoVCount)
	rb.appendRune(jamoVBase + r%jamoVCount)
	if x != 0 {
		rb.appendRune(jamoTBase + x)
	}
}
884301
func (p *PHYPayload) DecodeFOptsToMACCommands() error {
	macPL, ok := p.MACPayload.(*MACPayload)
	if !ok {
		return errors.New("lorawan: MACPayload must be of type *MACPayload")
	}

	if len(macPL.FHDR.FOpts) == 0 {
		return nil
	}

	var err error
	macPL.FHDR.FOpts, err = decodeDataPayloadToMACCommands(p.isUplink(), macPL.FHDR.FOpts)
	return err
}
775275
func (i *IAMPolicyDocument) UnmarshalJSON(data []byte) error {
	// Handle single statement policy documents
	var v iamPolicyDocumentSingleStatement
	err := json.Unmarshal(data, &v)
	if err == nil {
		i.Version = v.Version
		i.Statement = []IAMPolicyStatement{v.Statement}
		return nil
	}

	// Handle multiple statements
	var v2 iamPolicyDocumentCopy
	err = json.Unmarshal(data, &v2)
	if err != nil {
		return err
	}

	i.Version = v2.Version
	i.Statement = v2.Statement

	return nil
}
1320061
func (L *State) CheckAny(narg int) {
	C.luaL_checkany(L.s, C.int(narg))
}
792220
func (p *AgentClient) EmitZipkinBatch(spans []*zipkincore.Span) (err error) {
	if err = p.sendEmitZipkinBatch(spans); err != nil {
		return
	}
	return
}
1319273
func (p *PostingsIterator) DocNum1Hit() (uint64, bool) {
	if p.normBits1Hit != 0 && p.docNum1Hit != DocNum1HitFinished {
		return p.docNum1Hit, true
	}
	return 0, false
}