MCPcopy Create free account
hub / github.com/cloudbase/garm / GetRunner

Method GetRunner

util/github/scalesets/runners.go:74–101  ·  view source on GitHub ↗
(ctx context.Context, runnerID int64)

Source from the content-addressed store, hash-verified

72}
73
74func (s *ScaleSetClient) GetRunner(ctx context.Context, runnerID int64) (_ params.RunnerReference, err error) {
75 s.recordOperation("GetRunner")
76 defer func() {
77 if err != nil {
78 s.recordFailedOperation("GetRunner")
79 }
80 }()
81
82 path := fmt.Sprintf("%s/%d", runnerEndpoint, runnerID)
83
84 req, err := s.newActionsRequest(ctx, http.MethodGet, path, nil)
85 if err != nil {
86 return params.RunnerReference{}, fmt.Errorf("failed to construct request: %w", err)
87 }
88
89 resp, err := s.Do(req)
90 if err != nil {
91 return params.RunnerReference{}, fmt.Errorf("request failed for %s: %w", req.URL.String(), err)
92 }
93 defer resp.Body.Close()
94
95 var runnerReference params.RunnerReference
96 if err := json.NewDecoder(resp.Body).Decode(&runnerReference); err != nil {
97 return params.RunnerReference{}, fmt.Errorf("failed to decode response: %w", err)
98 }
99
100 return runnerReference, nil
101}
102
103func (s *ScaleSetClient) ListAllRunners(ctx context.Context) (_ params.RunnerReferenceList, err error) {
104 s.recordOperation("ListAllRunners")

Callers 1

StartMethod · 0.80

Calls 6

recordOperationMethod · 0.95
recordFailedOperationMethod · 0.95
newActionsRequestMethod · 0.95
DoMethod · 0.95
CloseMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected