// GetRunstatusIncident retrieves the details of a specific incident.
358210
func (client *Client) GetRunstatusIncident(ctx context.Context, incident RunstatusIncident) (*RunstatusIncident, error) {
	if incident.URL != "" {
		return client.getRunstatusIncident(ctx, incident.URL)
	}

	if incident.PageURL == "" {
		return nil, fmt.Errorf("empty Page URL for %#v", incident)
	}

	page, err := client.getRunstatusPage(ctx, incident.PageURL)
	if err != nil {
		return nil, err
	}

	for i := range page.Incidents {
		j := &page.Incidents[i]
		if j.Match(incident) {
			return j, nil
		}
	}

	return nil, fmt.Errorf("%#v not found", incident)
}
1359756
func (s *Service) UpdateRunState(ctx context.Context, taskID, runID influxdb.ID, when time.Time, state backend.RunStatus) error {
	err := s.kv.Update(ctx, func(tx Tx) error {
		err := s.updateRunState(ctx, tx, taskID, runID, when, state)
		if err != nil {
			return err
		}
		return nil
	})
	return err
}
1047815
func (p *StatusTable) IsRunning(name string) bool {
	p.RLock()
	defer p.RUnlock()

	return p.pool[name]
}
384835
func getClaimStatusForLogging(claim *v1.PersistentVolumeClaim) string {
	bound := metav1.HasAnnotation(claim.ObjectMeta, annBindCompleted)
	boundByController := metav1.HasAnnotation(claim.ObjectMeta, annBoundByController)

	return fmt.Sprintf("phase: %s, bound to: %q, bindCompleted: %v, boundByController: %v", claim.Status.Phase, claim.Spec.VolumeName, bound, boundByController)
}
968190
func (c *Client) GetIncidents() (IncidentsResponse, error) {
	i := IncidentsResponse{}
	err := c.request("api/v2/incidents.json", &i)
	return i, err
}
124976
func (c *Connection) IndexStatus(indexList []string) (*Response, error) {
	r := Request{
		Conn:      c,
		IndexList: indexList,
		method:    "GET",
		api:       "_status",
	}

	return r.Run()
}
851220
func (u *UpdateCheckRunOptions) GetStatus() string {
	if u == nil || u.Status == nil {
		return ""
	}
	return *u.Status
}
571757
func (client *Client) DeleteRunstatusService(ctx context.Context, service RunstatusService) error {
	if service.URL == "" {
		return fmt.Errorf("empty URL for %#v", service)
	}

	_, err := client.runstatusRequest(ctx, service.URL, nil, "DELETE")
	return err
}
893453
func GetAppStatusCode(err error) (code keybase1.StatusCode, ok bool) {
	code = keybase1.StatusCode_SCGeneric
	switch err := err.(type) {
	case AppStatusError:
		return keybase1.StatusCode(err.Code), true
	default:
		return code, false
	}
}
955656
func (r *RuntimeStatus) GetRuntimeCondition(t RuntimeConditionType) *RuntimeCondition {
	for i := range r.Conditions {
		c := &r.Conditions[i]
		if c.Type == t {
			return c
		}
	}
	return nil
}
441421
func (a *HorizontalController) computeStatusForResourceMetric(currentReplicas int32, metricSpec autoscalingv2.MetricSpec, hpa *autoscalingv2.HorizontalPodAutoscaler, selector labels.Selector, status *autoscalingv2.MetricStatus) (int32, time.Time, string, error) {
	if metricSpec.Resource.Target.AverageValue != nil {
		var rawProposal int64
		replicaCountProposal, rawProposal, timestampProposal, err := a.replicaCalc.GetRawResourceReplicas(currentReplicas, metricSpec.Resource.Target.AverageValue.MilliValue(), metricSpec.Resource.Name, hpa.Namespace, selector)
		if err != nil {
			a.eventRecorder.Event(hpa, v1.EventTypeWarning, "FailedGetResourceMetric", err.Error())
			setCondition(hpa, autoscalingv2.ScalingActive, v1.ConditionFalse, "FailedGetResourceMetric", "the HPA was unable to compute the replica count: %v", err)
			return 0, time.Time{}, "", fmt.Errorf("failed to get %s utilization: %v", metricSpec.Resource.Name, err)
		}
		metricNameProposal := fmt.Sprintf("%s resource", metricSpec.Resource.Name)
		*status = autoscalingv2.MetricStatus{
			Type: autoscalingv2.ResourceMetricSourceType,
			Resource: &autoscalingv2.ResourceMetricStatus{
				Name: metricSpec.Resource.Name,
				Current: autoscalingv2.MetricValueStatus{
					AverageValue: resource.NewMilliQuantity(rawProposal, resource.DecimalSI),
				},
			},
		}
		return replicaCountProposal, timestampProposal, metricNameProposal, nil
	} else {
		if metricSpec.Resource.Target.AverageUtilization == nil {
			errMsg := "invalid resource metric source: neither a utilization target nor a value target was set"
			a.eventRecorder.Event(hpa, v1.EventTypeWarning, "FailedGetResourceMetric", errMsg)
			setCondition(hpa, autoscalingv2.ScalingActive, v1.ConditionFalse, "FailedGetResourceMetric", "the HPA was unable to compute the replica count: %s", errMsg)
			return 0, time.Time{}, "", fmt.Errorf(errMsg)
		}
		targetUtilization := *metricSpec.Resource.Target.AverageUtilization
		var percentageProposal int32
		var rawProposal int64
		replicaCountProposal, percentageProposal, rawProposal, timestampProposal, err := a.replicaCalc.GetResourceReplicas(currentReplicas, targetUtilization, metricSpec.Resource.Name, hpa.Namespace, selector)
		if err != nil {
			a.eventRecorder.Event(hpa, v1.EventTypeWarning, "FailedGetResourceMetric", err.Error())
			setCondition(hpa, autoscalingv2.ScalingActive, v1.ConditionFalse, "FailedGetResourceMetric", "the HPA was unable to compute the replica count: %v", err)
			return 0, time.Time{}, "", fmt.Errorf("failed to get %s utilization: %v", metricSpec.Resource.Name, err)
		}
		metricNameProposal := fmt.Sprintf("%s resource utilization (percentage of request)", metricSpec.Resource.Name)
		*status = autoscalingv2.MetricStatus{
			Type: autoscalingv2.ResourceMetricSourceType,
			Resource: &autoscalingv2.ResourceMetricStatus{
				Name: metricSpec.Resource.Name,
				Current: autoscalingv2.MetricValueStatus{
					AverageUtilization: &percentageProposal,
					AverageValue:       resource.NewMilliQuantity(rawProposal, resource.DecimalSI),
				},
			},
		}
		return replicaCountProposal, timestampProposal, metricNameProposal, nil
	}
}
292656
func (h *Handler) healthStatus() status.Status {
	info, err := h.Process.Info()
	if err != nil || !info.Running {
		return status.Unhealthy
	}
	return status.Healthy
}
180496
func (r Monitoring_Agent) GetStatusName() (resp string, err error) {
	err = r.Session.DoRequest("SoftLayer_Monitoring_Agent", "getStatusName", nil, &r.Options, &resp)
	return
}
48615
func (k *KeybaseDaemonLocal) NotifySyncStatus(ctx context.Context,
	_ *keybase1.FSPathSyncStatus) error {
	return checkContext(ctx)
}
626261
func (client *Client) PaginateRunstatusMaintenances(ctx context.Context, page RunstatusPage, callback func(*RunstatusMaintenance, error) bool) { // nolint: dupl
	if page.MaintenancesURL == "" {
		callback(nil, fmt.Errorf("empty Maintenances URL for %#v", page))
		return
	}

	maintenancesURL := page.MaintenancesURL
	for maintenancesURL != "" {
		resp, err := client.runstatusRequest(ctx, maintenancesURL, nil, "GET")
		if err != nil {
			callback(nil, err)
			return
		}

		var ms *RunstatusMaintenanceList
		if err := json.Unmarshal(resp, &ms); err != nil {
			callback(nil, err)
			return
		}

		for i := range ms.Maintenances {
			if err := ms.Maintenances[i].FakeID(); err != nil {
				log.Printf("bad fake ID for %#v, %s", ms.Maintenances[i], err)
			}
			if cont := callback(&ms.Maintenances[i], nil); !cont {
				return
			}
		}

		maintenancesURL = ms.Next
	}
}
769978
func (s *HIT) SetHITReviewStatus(v string) *HIT {
	s.HITReviewStatus = &v
	return s
}
637962
func (client *Client) ListRunstatusMaintenances(ctx context.Context, page RunstatusPage) ([]RunstatusMaintenance, error) {
	if page.MaintenancesURL == "" {
		return nil, fmt.Errorf("empty Maintenances URL for %#v", page)
	}

	results := make([]RunstatusMaintenance, 0)

	var err error
	client.PaginateRunstatusMaintenances(ctx, page, func(maintenance *RunstatusMaintenance, e error) bool {
		if e != nil {
			err = e
			return false
		}

		results = append(results, *maintenance)
		return true
	})

	return results, err
}