// GetJobState implements the corresponding RPC method, see the proto doc.
19473
func (impl *adminImpl) FixMarkedTags(c context.Context, id *api.JobID) (*api.TagFixReport, error) {
	tags, err := fixMarkedTags(c, mapper.JobID(id.JobId))
	if err != nil {
		return nil, toStatus(err)
	}
	return &api.TagFixReport{Fixed: tags}, nil
}
799345
func (e *engineImpl) getJob(c context.Context, jobID string) (*Job, error) {
	job := &Job{JobID: jobID}
	switch err := ds.Get(c, job); {
	case err == nil:
		return job, nil
	case err == ds.ErrNoSuchEntity:
		return nil, nil
	default:
		return nil, transient.Tag.Apply(err)
	}
}
746866
func (p *PullRequestReview) GetState() string {
	if p == nil || p.State == nil {
		return ""
	}
	return *p.State
}
1233532
func (c *Ctx) GetOperationState(sh SessionHandle) ([]byte, error) {
	var (
		state    C.CK_BYTE_PTR
		statelen C.CK_ULONG
	)
	e := C.GetOperationState(c.ctx, C.CK_SESSION_HANDLE(sh), &state, &statelen)
	defer C.free(unsafe.Pointer(state))
	if toError(e) != nil {
		return nil, toError(e)
	}
	b := C.GoBytes(unsafe.Pointer(state), C.int(statelen))
	return b, nil
}
1114535
func (p *MemoryLedger) GetState(namespace string, key string) ([]byte, error) {
	value := p.entries[key]

	return value, nil
}
350972
func (job *QorJob) GetJob() *Job {
	if job.Job != nil {
		return job.Job
	}
	return nil
}
926574
func (d *Driver) GetState() (state.State, error) {
	if err := d.verifyRootPermissions(); err != nil {
		return state.Error, err
	}

	pid := d.getPid()
	log.Debugf("hyperkit pid from json: %d", pid)
	return pidState(pid)
}
767156
func (vm *VM) GetState() (string, error) {
	if vm.MockGetState != nil {
		return vm.MockGetState()
	}
	return "", lvm.ErrNotImplemented
}
1112532
func (m TaskManager) GetDebugState(c context.Context, ctl task.ControllerReadOnly) (*internal.DebugManagerState, error) {
	return nil, fmt.Errorf("no debug state")
}
294817
func (s *adminServer) GetDebugJobState(c context.Context, r *schedulerpb.JobRef) (resp *internal.DebugJobState, err error) {
	switch state, err := s.Engine.GetDebugJobState(c, r.Project+"/"+r.Job); {
	case err == engine.ErrNoSuchJob:
		return nil, status.Errorf(codes.NotFound, "no such job")
	case err != nil:
		return nil, err
	default:
		return &internal.DebugJobState{
			Enabled:    state.Job.Enabled,
			Paused:     state.Job.Paused,
			LastTriage: google.NewTimestamp(state.Job.LastTriage),
			CronState: &internal.DebugJobState_CronState{
				Enabled:       state.Job.Cron.Enabled,
				Generation:    state.Job.Cron.Generation,
				LastRewind:    google.NewTimestamp(state.Job.Cron.LastRewind),
				LastTickWhen:  google.NewTimestamp(state.Job.Cron.LastTick.When),
				LastTickNonce: state.Job.Cron.LastTick.TickNonce,
			},
			ManagerState:        state.ManagerState,
			ActiveInvocations:   state.Job.ActiveInvocations,
			FinishedInvocations: state.FinishedInvocations,
			RecentlyFinishedSet: state.RecentlyFinishedSet,
			PendingTriggersSet:  state.PendingTriggersSet,
		}, nil
	}
}
442101
func (s *boshDirector) ChangeJobState(deployment, job, state string, index int) (int, error) {
	endpoint := fmt.Sprintf("%s:%d/deployments/%s/jobs/%s/%d?state=%s", s.ip, s.port, deployment, job, index, state)
	req, err := s.client.NewRequest("PUT", endpoint, nil)
	if err != nil {
		return 0, errwrap.Wrap(err, "failed creating request")
	}
	req.Header.Set("content-type", "text/yaml")
	res, err := s.client.HTTPClient().Do(req)
	if err != nil {
		return 0, errwrap.Wrap(err, "failed calling http client")
	}
	taskID, err := retrieveTaskID(res)
	if err != nil {
		return 0, errwrap.Wrap(err, "failed retrieving taskid from response body")
	}

	if taskID == 0 {
		return 0, fmt.Errorf("invalid taskid returned. value is: %v", taskID)
	}
	return taskID, nil
}
415473
func (r *TasksService) GetStates() *TasksGetStatesCall {
	c := &TasksGetStatesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	return c
}
593953
func (client *Client) GetJob(jobGUID string) (Job, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetJobRequest,
		URIParams:   Params{"job_guid": jobGUID},
	})
	if err != nil {
		return Job{}, nil, err
	}

	var job Job
	response := cloudcontroller.Response{
		DecodeJSONResponseInto: &job,
	}

	err = client.connection.Make(request, &response)
	return job, response.Warnings, err
}
1028898
func (s *JobListEntry) SetJobState(v string) *JobListEntry {
	s.JobState = &v
	return s
}
530474
func (p *PullRequest) GetState() string {
	if p == nil || p.State == nil {
		return ""
	}
	return *p.State
}
998265
func (c *Client) GetStateFromCluster() (*State, error) {
	resp, err := c.GetHTTPResponseFromCluster(c.GetURLForStateFile)
	return c.parseStateResponse(resp, err)
}
595804
func StateJobs(jobs []multiwatcher.MachineJob) ([]state.MachineJob, error) {
	newJobs := make([]state.MachineJob, len(jobs))
	for i, job := range jobs {
		newJob, err := machineJobFromParams(job)
		if err != nil {
			return nil, err
		}
		newJobs[i] = newJob
	}
	return newJobs, nil
}