// EntityId returns a unique identifier for a machine across
// models.
8447
func (i *MachineInfo) EntityId() EntityId {
	return EntityId{
		Kind:      "machine",
		ModelUUID: i.ModelUUID,
		Id:        i.Id,
	}
}
1105862
func (i *ActionInfo) EntityId() EntityId {
	return EntityId{
		Kind:      "action",
		ModelUUID: i.ModelUUID,
		Id:        i.Id,
	}
}
69001
func (s *RegisterToWorkMailInput) SetEntityId(v string) *RegisterToWorkMailInput {
	s.EntityId = &v
	return s
}
230507
func InstanceID(ctx types.Context) (*types.InstanceID, error) {

	// UUID can be obtained as descried in
	// https://azure.microsoft.com/en-us/blog/accessing-and-using-azure-vm-unique-id/
	// but this code will use hostname as ID

	hostname, err := os.Hostname()
	if err != nil {
		return nil, err
	}
	return &types.InstanceID{
		ID:     hostname,
		Driver: azureud.Name,
	}, nil
}
978572
func (i *UnitInfo) EntityId() EntityId {
	return EntityId{
		Kind:      "unit",
		ModelUUID: i.ModelUUID,
		Id:        i.Name,
	}
}
888496
func (s *TermvectorsService) Id(id string) *TermvectorsService {
	s.id = id
	return s
}
1182847
func (s *DeleteMailboxPermissionsInput) SetEntityId(v string) *DeleteMailboxPermissionsInput {
	s.EntityId = &v
	return s
}
1134971
func ID() (string, error) {
	id, err := machineID()
	if err != nil {
		return "", fmt.Errorf("machineid: %v", err)
	}
	return id, nil
}
1199234
func (c *UnitStateListCall) MachineID(machineID string) *UnitStateListCall {
	c.urlParams_.Set("machineID", machineID)
	return c
}
941732
func (addr *Address) DocID() string {
	return addr.st.docID(addr.doc.DocID)
}
96822
func (n NetID) ID() []byte {
	switch n.Type() {
	case 0, 1:
		return n.getID(6)
	case 2:
		return n.getID(9)
	case 3, 4, 5, 6, 7:
		return n.getID(21)
	default:
		return nil
	}
}
983477
func (r renderer) Entity(out *bytes.Buffer, entity []byte) {
	out.Write(entity)
}
265561
func (i *BlockInfo) EntityId() EntityId {
	return EntityId{
		Kind:      "block",
		ModelUUID: i.ModelUUID,
		Id:        i.Id,
	}
}
1337247
func (m BoolMapper) ID(bi ...interface{}) (rowIDs []int64, err error) {
	return []int64{bi[0].(int64)}, nil
}
1195915
func (s *SegmentBase) DocID(num uint64) ([]byte, error) {
	if num >= s.numDocs {
		return nil, nil
	}

	vdc := visitDocumentCtxPool.Get().(*visitDocumentCtx)

	meta, compressed := s.getDocStoredMetaAndCompressed(num)

	vdc.reader.Reset(meta)

	// handle _id field special case
	idFieldValLen, err := binary.ReadUvarint(&vdc.reader)
	if err != nil {
		return nil, err
	}
	idFieldVal := compressed[:idFieldValLen]

	visitDocumentCtxPool.Put(vdc)

	return idFieldVal, nil
}
894051
func (m FloatMapper) ID(fi ...interface{}) (rowIDs []int64, err error) {
	f := fi[0].(float64)
	externalID := int64(len(m.Buckets))
	if f < m.Buckets[0] || f > m.Buckets[len(m.Buckets)-1] {
		if m.allowExternal {
			return []int64{externalID}, nil
		}
		return []int64{0}, fmt.Errorf("float %v out of range", f)
	}
	// TODO: make clear decision about which way the equality goes, and document it
	// TODO: use binary search if there are a lot of buckets
	for i, v := range m.Buckets {
		if f < v {
			return []int64{int64(i)}, nil
		}
	}

	// this should be unreachable (TODO test)
	return []int64{0}, nil
}
652125
func (st *State) InstanceIds(tags []names.MachineTag) ([]params.StringResult, error) {
	var results params.StringResults
	args := params.Entities{
		Entities: make([]params.Entity, len(tags)),
	}
	for i, tag := range tags {
		args.Entities[i].Tag = tag.String()
	}
	err := st.facade.FacadeCall("InstanceId", args, &results)
	if err != nil {
		return nil, errors.Trace(err)
	}
	if len(results.Results) != 1 {
		return nil, errors.Errorf("expected %d result(s), got %d", len(results.Results), len(tags))
	}
	return results.Results, nil
}