// ReadRecord gets a record by the ID specified and returns a Record and an
// error.
420993
func (c *Client) ReadRecord(domainID string, recordID string) (*Record, error) {
	body := bytes.NewBuffer(nil)
	path := retrieve.endpoint(domainID, recordID)
	req, err := c.NewRequest("GET", path, body, "")
	if err != nil {
		return nil, err
	}

	resp, err := checkResp(c.HTTP.Do(req))
	if err != nil {
		return nil, fmt.Errorf("Error retrieving record: %s", err)
	}

	dataResp := DataResponse{}
	err = decodeBody(resp, &dataResp)
	if err != nil {
		return nil, fmt.Errorf("Error decoding data response: %s", err)
	}
	var result Record
	var found bool
	for _, record := range dataResp.Data {
		if record.StringRecordID() == recordID {
			result = record // not pointer, so data copied
			found = true
			break
		}
	}

	if !found {
		return nil, fmt.Errorf("Unable to find record %s", recordID)
	}
	return &result, nil
}
1232130
func (s *PredictInput) SetRecord(v map[string]*string) *PredictInput {
	s.Record = v
	return s
}
1068697
func ReadAll(reader Reader) ([]Record, error) {
	all := make([]Record, 0, 1)
	for record := range reader.C() {
		all = append(all, record)
	}
	return all, reader.Error()
}
1172537
func (s *OvsDriverOperState) Read(id string) error {
	key := fmt.Sprintf(ovsOperPath, id)
	return s.StateDriver.ReadState(key, s, json.Unmarshal)
}
393139
func NewRecord(f sql.SelectObjectFormat) *Record {
	return &Record{
		KVS:          jstream.KVS{},
		SelectFormat: f,
	}
}
455763
func (s *PutRecordBatchResponseEntry) SetRecordId(v string) *PutRecordBatchResponseEntry {
	s.RecordId = &v
	return s
}
42196
func (m *Main) readID(path string) (string, error) {
	buf, err := ioutil.ReadFile(path)
	if err != nil && !os.IsNotExist(err) {
		return "", fmt.Errorf("error reading instance ID: %s", err)
	}

	// If the ID exists then return it immediately.
	id := string(buf)
	if id != "" {
		return id, nil
	}

	// Generate a new ID and write it to file.
	id = random.UUID()
	if err := ioutil.WriteFile(path, []byte(id), 0644); err != nil {
		return "", fmt.Errorf("error writing instance ID: %s", err)
	}
	return id, nil
}
14787
func (t *partitionedTable) AddRecord(ctx sessionctx.Context, r []types.Datum, opts ...*table.AddRecordOpt) (recordID int64, err error) {
	partitionInfo := t.meta.GetPartitionInfo()
	pid, err := t.locatePartition(ctx, partitionInfo, r)
	if err != nil {
		return 0, errors.Trace(err)
	}

	tbl := t.GetPartition(pid)
	return tbl.AddRecord(ctx, r, opts...)
}
1204300
func (c *Client) GetRecordID(domainID, recordName, recordType, data string) (string, error) {
	recordList := &RecordListResponse{}

	err := c.do(http.MethodGet, fmt.Sprintf("/v1/domains/%s/records", domainID), nil, recordList)
	if err != nil {
		return "", err
	}

	for _, record := range recordList.Records {
		if record.Name == recordName && record.Type == recordType && record.Data == data {
			return record.ID, nil
		}
	}
	return "", errors.New("no such record")
}
710483
func (_class PIFClass) GetRecord(sessionID SessionRef, self PIFRef) (_retval PIFRecord, _err error) {
	_method := "PIF.get_record"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertPIFRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertPIFRecordToGo(_method + " -> ", _result.Value)
	return
}
1088071
func (_class PVSServerClass) GetRecord(sessionID SessionRef, self PVSServerRef) (_retval PVSServerRecord, _err error) {
	_method := "PVS_server.get_record"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertPVSServerRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertPVSServerRecordToGo(_method + " -> ", _result.Value)
	return
}
601025
func (c *Client) CreateRecord(domain string, opts *CreateRecord) (*Record, error) {
	// Make the request parameters
	params := make(map[string]string)
	params["z"] = domain

	params["type"] = opts.Type

	if opts.Name != "" {
		params["name"] = opts.Name
	}

	if opts.Content != "" {
		params["content"] = opts.Content
	}

	if opts.Priority != "" {
		params["prio"] = opts.Priority
	}

	if opts.Ttl != "" {
		params["ttl"] = opts.Ttl
	} else {
		params["ttl"] = "1"
	}

	req, err := c.NewRequest(params, "POST", "rec_new")
	if err != nil {
		return nil, err
	}

	resp, err := checkResp(c.Http.Do(req))

	if err != nil {
		return nil, fmt.Errorf("Error creating record: %s", err)
	}

	recordResp := new(RecordResponse)

	err = decodeBody(resp, &recordResp)

	if err != nil {
		return nil, fmt.Errorf("Error parsing record response: %s", err)
	}
	record, err := recordResp.GetRecord()
	if err != nil {
		return nil, err
	}

	// The request was successful
	return record, nil
}
1070275
func (c *Client) DestroyRecord(domain string, id string) error {
	var body map[string]interface{}
	req, err := c.NewRequest(body, "DELETE", fmt.Sprintf("/domains/%s/records/%s", domain, id))

	if err != nil {
		return err
	}

	_, err = checkResp(c.Http.Do(req))

	if err != nil {
		return fmt.Errorf("Error destroying record: %s", err)
	}

	// The request was successful
	return nil
}
832561
func (r *Reader) ReadAll() (records [][]string, err error) {
	for {
		record, err := r.Read()
		if err == io.EOF {
			return records, nil
		}
		if err != nil {
			return nil, err
		}
		records = append(records, record)
	}
}
321556
func (mr *MockConnMockRecorder) Read(b interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockConn)(nil).Read), b)
}
473105
func (vt *VirtualTable) AddRecord(ctx sessionctx.Context, r []types.Datum, opts ...*table.AddRecordOpt) (recordID int64, err error) {
	return 0, table.ErrUnsupportedOp
}
381545
func CheckRecordID(recordID string) error {
	recordIDParts := strings.SplitN(recordID, "/", 2)
	if len(recordIDParts) < 2 || recordIDParts[0] == "" || recordIDParts[1] == "" {
		return errors.New("Error: Record ID not in correct format.")
	}
	return nil
}