// You can read doc at https://www.alibabacloud.com/help/doc-detail/52844.htm
555922
func (client *Client) DescribeInstanceAutoRenewAttribute(args *DescribeInstanceAutoRenewAttributeArgs) (*DescribeInstanceAutoRenewAttributeResponse, error) {
	response := &DescribeInstanceAutoRenewAttributeResponse{}
	err := client.Invoke("DescribeInstanceAutoRenewAttribute", args, response)
	return response, err
}
159330
func (obj *Global) GetActiveDoc(ctx context.Context) (*Doc, error) {
	result := &struct {
		Return *ObjectInterface	`json:"qReturn"`
	} {}
	err := obj.rpc(ctx, "GetActiveDoc", result)
	if err != nil {
		return nil, err
	}
	return &Doc{obj.session.getRemoteObject(result.Return)}, err 
}
62046
func (dbclient *CouchDatabase) BatchRetrieveDocumentMetadata(keys []string) ([]*DocMetadata, error) {

	logger.Debugf("[%s] Entering BatchRetrieveDocumentMetadata()  keys=%s", dbclient.DBName, keys)

	batchRetrieveURL, err := url.Parse(dbclient.CouchInstance.conf.URL)
	if err != nil {
		logger.Errorf("URL parse error: %s", err)
		return nil, errors.Wrapf(err, "error parsing CouchDB URL: %s", dbclient.CouchInstance.conf.URL)
	}

	queryParms := batchRetrieveURL.Query()

	// While BatchRetrieveDocumentMetadata() does not return the entire document,
	// for reads/writes, we do need to get document so that we can get the ledger version of the key.
	// TODO For blind writes we do not need to get the version, therefore when we bulk get
	// the revision numbers for the write keys that were not represented in read set
	// (the second time BatchRetrieveDocumentMetadata is called during block processing),
	// we could set include_docs to false to optimize the response.
	queryParms.Add("include_docs", "true")

	keymap := make(map[string]interface{})

	keymap["keys"] = keys

	jsonKeys, err := json.Marshal(keymap)
	if err != nil {
		return nil, errors.Wrap(err, "error marshalling json data")
	}

	//get the number of retries
	maxRetries := dbclient.CouchInstance.conf.MaxRetries

	resp, _, err := dbclient.handleRequest(http.MethodPost, "BatchRetrieveDocumentMetadata", batchRetrieveURL, jsonKeys, "", "", maxRetries, true, &queryParms, "_all_docs")
	if err != nil {
		return nil, err
	}
	defer closeResponseBody(resp)

	if logger.IsEnabledFor(zapcore.DebugLevel) {
		dump, _ := httputil.DumpResponse(resp, false)
		// compact debug log by replacing carriage return / line feed with dashes to separate http headers
		logger.Debugf("[%s] HTTP Response: %s", dbclient.DBName, bytes.Replace(dump, []byte{0x0d, 0x0a}, []byte{0x20, 0x7c, 0x20}, -1))
	}

	//handle as JSON document
	jsonResponseRaw, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, errors.Wrap(err, "error reading response body")
	}

	var jsonResponse = &BatchRetrieveDocMetadataResponse{}

	err2 := json.Unmarshal(jsonResponseRaw, &jsonResponse)
	if err2 != nil {
		return nil, errors.Wrap(err2, "error unmarshalling json data")
	}

	docMetadataArray := []*DocMetadata{}

	for _, row := range jsonResponse.Rows {
		docMetadata := &DocMetadata{ID: row.ID, Rev: row.DocMetadata.Rev, Version: row.DocMetadata.Version}
		docMetadataArray = append(docMetadataArray, docMetadata)
	}

	logger.Debugf("[%s] Exiting BatchRetrieveDocumentMetadata()", dbclient.DBName)

	return docMetadataArray, nil

}
1278153
func (l *Client) GetDocuments(urls []string, limit int) (Documents, error) {
	res := ApiResp{}
	data := Documents{}
	params := url.Values{}

	if limit > 0 {
		params.Add("limit", strconv.Itoa(limit))
	}

	if len(urls) > 0 {
		params.Add("urls", strings.Join(urls, ","))
	}

	err := l.Get(documentsEndpoint, params, nil, &res, &data)
	if err != nil {
		return data, err
	}

	return data, nil
}
239819
func doc2resource(doc resourceDoc) (storedResource, error) {
	res, err := doc2basicResource(doc)
	if err != nil {
		return storedResource{}, errors.Trace(err)
	}

	stored := storedResource{
		Resource:    res,
		storagePath: doc.StoragePath,
	}
	return stored, nil
}
1220060
func (d *domainClient) GetFlattenedDocument(ctx context.Context, args *GetFlattenedDocumentArgs) (reply *GetFlattenedDocumentReply, err error) {
	reply = new(GetFlattenedDocumentReply)
	if args != nil {
		err = rpcc.Invoke(ctx, "DOM.getFlattenedDocument", args, reply, d.conn)
	} else {
		err = rpcc.Invoke(ctx, "DOM.getFlattenedDocument", nil, reply, d.conn)
	}
	if err != nil {
		err = &internal.OpError{Domain: "DOM", Op: "GetFlattenedDocument", Err: err}
	}
	return
}
1179338
func (obj *Doc) GetLocaleInfo(ctx context.Context) (*LocaleInfo, error) {
	result := &struct {
		Return *LocaleInfo	`json:"qReturn"`
	} {}
	err := obj.rpc(ctx, "GetLocaleInfo", result)
	return result.Return, err 
}
516045
func docsDefinition() (*design.DocsDefinition, bool) {
	a, ok := dslengine.CurrentDefinition().(*design.DocsDefinition)
	if !ok {
		dslengine.IncompatibleDSL()
	}
	return a, ok
}
417590
func (doc *PluginDocument) DumpString() string {
	str := ""
	str += "==================== START DUMP ============================\n"
	str += "PackageName: [" + doc.PackageName + "]\n"
	str += "PluginName:  [" + doc.PluginName + "]\n"
	str += "BlockHeading: [" + doc.BlockHeading + "]\n"
	str += "Description: [" + doc.Description + "]\n\n"
	str += "Parameters: [" + "\n"
	str += doc.Parameters.dumpString() + "\n"
	str += "]\n\n"
	for parentName, defMap := range doc.InheritedParameters {
		str += "Parameters (from " + parentName + ")[\n"
		str += defMap.dumpString() + "\n"
		str += "]\n\n"
	}
	str += "Metadata: [" + "\n"
	str += doc.Metadata.dumpString() + "\n"
	for parentName, defMap := range doc.InheritedMetadata {
		str += "Metadata (from " + parentName + ")[\n"
		str += defMap.dumpString() + "\n"
		str += "]\n\n"
	}
	str += "Example: [" + "\n------------\n" + doc.Example + "\n----------]\n"
	str += "==================== END DUMP ============================\n"
	return str
}
803639
func (p *Parser) Document(payload io.ReadCloser, mode DocumentMode) (*Document, *Error) {
	defer closeReader(payload)

	err := validateHeaders(p.Headers)
	if err != nil {
		return nil, err
	}

	document := &Document{
		Data: List{},
		Mode: mode,
	}

	decodeErr := json.NewDecoder(io.LimitReader(payload, MaxContentLength)).Decode(document)
	if decodeErr != nil {
		return nil, ISE(fmt.Sprintf("Error parsing JSON Document: %s", decodeErr.Error()))
	}

	// If the document has data, validate against specification
	if document.HasData() {
		for _, object := range document.Data {

			// TODO: currently this doesn't really do any user input
			// validation since it is validating against the jsh
			// "Object" type. Figure out how to options pass the
			// corressponding user object struct in to enable this
			// without making the API super clumsy.
			inputErr := validateInput(object)
			if inputErr != nil {
				return nil, inputErr[0]
			}

			// if we have a list, then all resource objects should have IDs, will
			// cross the bridge of bulk creation if and when there is a use case
			if len(document.Data) > 1 && object.ID == "" {
				return nil, InputError("Object without ID present in list", "id")
			}
		}
	}

	return document, nil
}
1292717
func ReadOne(rd io.Reader) (BSON, error) {
	// Read length of document.
	docLen, err := readInt32(rd)
	if err != nil {
		return nil, err
	}

	// Sanity check length.
	if docLen > maxDocLen {
		return nil, errors.New("Doc exceeded maximum size.")
	}

	// Read the document.
	buf := make([]byte, int(docLen))
	binary.LittleEndian.PutUint32(buf, uint32(docLen))
	if _, err := io.ReadFull(rd, buf[4:]); err != nil {
		return nil, err
	}

	return buf, nil
}
525032
func (c *Config) ReadList() []map[string]map[string]string {

	file, err := os.Open(c.filepath)
	if err != nil {
		CheckErr(err)
	}
	defer file.Close()
	var data map[string]map[string]string
	var section string
	buf := bufio.NewReader(file)
	for {
		l, err := buf.ReadString('\n')
		line := strings.TrimSpace(l)
		if err != nil {
			if err != io.EOF {
				CheckErr(err)
			}
			if len(line) == 0 {
				break
			}
		}
		switch {
		case len(line) == 0:
		case string(line[0]) == "#":	//增加配置文件备注
		case line[0] == '[' && line[len(line)-1] == ']':
			section = strings.TrimSpace(line[1 : len(line)-1])
			data = make(map[string]map[string]string)
			data[section] = make(map[string]string)
		default:
			i := strings.IndexAny(line, "=")
			if i == -1 {
				continue
			}
			value := strings.TrimSpace(line[i+1 : len(line)])
			data[section][strings.TrimSpace(line[0:i])] = value
			if c.uniquappend(section) == true {
				c.conflist = append(c.conflist, data)
			}
		}

	}

	return c.conflist
}
1014818
func (mc MongoClient) ReadingsByDeviceAndValueDescriptor(deviceId, valueDescriptor string, limit int) ([]contract.Reading, error) {
	return mapReadings(mc.getReadingsLimit(bson.M{"device": deviceId, "name": valueDescriptor}, limit))
}
77319
func (s *DocumentLinterV2) analyzeDocument(document *openapi.Document) []*plugins.Message {
	messages := make([]*plugins.Message, 0, 0)
	for _, pair := range document.Paths.Path {
		path := pair.Value
		if path.Get != nil {
			messages = append(messages, s.analyzeOperation([]string{"paths", pair.Name, "get"}, path.Get)...)
		}
		if path.Post != nil {
			messages = append(messages, s.analyzeOperation([]string{"paths", pair.Name, "post"}, path.Post)...)
		}
		if path.Put != nil {
			messages = append(messages, s.analyzeOperation([]string{"paths", pair.Name, "put"}, path.Put)...)
		}
		if path.Delete != nil {
			messages = append(messages, s.analyzeOperation([]string{"paths", pair.Name, "delete"}, path.Delete)...)
		}
	}
	if document.Definitions != nil {
		for _, pair := range document.Definitions.AdditionalProperties {
			definition := pair.Value
			messages = append(messages, s.analyzeDefinition([]string{"definitions", pair.Name}, definition)...)
		}
	}
	return messages
}
1236338
func (p *CouchbaseProvider) Read(sid string) (session.RawStore, error) {
	p.b = p.getBucket()

	var doc []byte

	err := p.b.Get(sid, &doc)
	var kv map[interface{}]interface{}
	if doc == nil {
		kv = make(map[interface{}]interface{})
	} else {
		kv, err = session.DecodeGob(doc)
		if err != nil {
			return nil, err
		}
	}

	cs := &CouchbaseSessionStore{b: p.b, sid: sid, data: kv, maxlifetime: p.maxlifetime}
	return cs, nil
}
24685
func (i *indexImpl) Document(id string) (doc *document.Document, err error) {
	i.mutex.RLock()
	defer i.mutex.RUnlock()

	if !i.open {
		return nil, ErrorIndexClosed
	}
	indexReader, err := i.i.Reader()
	if err != nil {
		return nil, err
	}
	defer func() {
		if cerr := indexReader.Close(); err == nil && cerr != nil {
			err = cerr
		}
	}()

	doc, err = indexReader.Document(id)
	if err != nil {
		return nil, err
	}
	return doc, nil
}
1122667
func (c *ConnectorRemote) Docs(ctx context.Context, ddd *protos.Doc) (*protos.Doc, error) {
	d, err := pitaya.Documentation(true)
	if err != nil {
		return nil, err
	}
	doc, err := json.Marshal(d)

	if err != nil {
		return nil, err
	}

	return &protos.Doc{Doc: string(doc)}, nil
}