// projectID returns the GCE project ID used for running this camweb on GCE
// and/or for logging on Google Cloud Logging, if any.
161076
func projectID() string {
	if *gceProjectID != "" {
		return *gceProjectID
	}
	projID, err := metadata.ProjectID()
	if projID == "" || err != nil {
		log.Fatalf("GCE project ID needed but --gce_project_id not specified (and not running on GCE); metadata error: %v", err)
	}
	return projID
}
1057878
func (h *Client) ApplicationID(applicationID string) *Client {
	h.applicationID = applicationID
	h.applicationIDSet = true
	return h
}
220618
func (m GridMapper) ID(xyi ...interface{}) (rowIDs []int64, err error) {
	x := xyi[0].(float64)
	y := xyi[1].(float64)
	externalID := m.Xres * m.Yres

	// bounds check
	if x < m.Xmin || x > m.Xmax || y < m.Ymin || y > m.Ymax {
		if m.allowExternal {
			return []int64{externalID}, nil
		}
		return []int64{0}, fmt.Errorf("point (%v, %v) out of range", x, y)
	}

	// compute x bin
	xInt := int64(float64(m.Xres) * (x - m.Xmin) / (m.Xmax - m.Xmin))
	// compute y bin
	yInt := int64(float64(m.Yres) * (y - m.Ymin) / (m.Ymax - m.Ymin))

	rowID := (m.Yres * xInt) + yInt
	return []int64{rowID}, nil

}
1262744
func (p *ProjectColumnEvent) GetAfterID() int64 {
	if p == nil || p.AfterID == nil {
		return 0
	}
	return *p.AfterID
}
65109
func (s *TasksCancelService) TaskId(taskId string) *TasksCancelService {
	s.taskId = taskId
	return s
}
339538
func (c *ApiController) GetProjectBadgeUrl() {
	log.Debug("Get project badge url")

	// TODO(tobe): use the address of server instead of 127.0.0.1
	// The link should look like "http://127.0.0.1:10010/v1/badge/1)"
	projectId, _ := c.GetInt64(":projectId")
	link := fmt.Sprintf("http://127.0.0.1:10010/v1/badge/%d", projectId)

	c.Ctx.WriteString(link)
}
107747
func (p *ProjectColumn) GetID() int64 {
	if p == nil || p.ID == nil {
		return 0
	}
	return *p.ID
}
571581
func (pc peerConn) ID() ID {
	return PubKeyToID(pc.conn.(*tmconn.SecretConnection).RemotePubKey())
}
264739
func (addr *Address) ProviderID() network.Id {
	return network.Id(addr.doc.ProviderID)
}
686098
func (pg *GoEvtxMap) EventID() int64 {
	eid, err := pg.GetInt(&EventIDPath)
	if err != nil {
		eid, err = pg.GetInt(&EventIDPath2)
		if err != nil {
			panic(err)
		}
		return eid
	}
	return eid
}
633196
func (b *UpdateService) ScriptId(scriptId string) *UpdateService {
	b.scriptId = scriptId
	return b
}
1313929
func (s *DescribeProjectOutput) SetProjectTemplateId(v string) *DescribeProjectOutput {
	s.ProjectTemplateId = &v
	return s
}
488261
func (d *DeploymentStatus) GetID() int64 {
	if d == nil || d.ID == nil {
		return 0
	}
	return *d.ID
}
274475
func (cpcode *CpCode) ID() int {
	id, err := strconv.Atoi(strings.TrimPrefix(cpcode.CpcodeID, "cpc_"))
	if err != nil {
		return 0
	}

	return id
}
165389
func (i *RemoteApplicationInfo) EntityId() EntityId {
	return EntityId{
		Kind:      "remoteApplication",
		ModelUUID: i.ModelUUID,
		Id:        i.Name,
	}
}
153479
func DeleteBuildsWithProjectId(projectId int64) error {
	o := orm.NewOrm()

	_, err := o.Delete(&Build{ProjectId: projectId})

	return err
}
495784
func (cs *CSCloud) InstanceID(ctx context.Context, name types.NodeName) (string, error) {
	instance, count, err := cs.client.VirtualMachine.GetVirtualMachineByName(
		string(name),
		cloudstack.WithProject(cs.projectID),
	)
	if err != nil {
		if count == 0 {
			return "", cloudprovider.InstanceNotFound
		}
		return "", fmt.Errorf("error retrieving instance ID: %v", err)
	}

	return instance.Id, nil
}