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

Method GetRunnerScaleSetByID

util/github/scalesets/scalesets.go:72–97  ·  view source on GitHub ↗
(ctx context.Context, runnerScaleSetID int)

Source from the content-addressed store, hash-verified

70}
71
72func (s *ScaleSetClient) GetRunnerScaleSetByID(ctx context.Context, runnerScaleSetID int) (_ params.RunnerScaleSet, err error) {
73 s.recordOperation("GetRunnerScaleSetByID")
74 defer func() {
75 if err != nil {
76 s.recordFailedOperation("GetRunnerScaleSetByID")
77 }
78 }()
79
80 path := fmt.Sprintf("%s/%d", scaleSetEndpoint, runnerScaleSetID)
81 req, err := s.newActionsRequest(ctx, http.MethodGet, path, nil)
82 if err != nil {
83 return params.RunnerScaleSet{}, err
84 }
85
86 resp, err := s.Do(req)
87 if err != nil {
88 return params.RunnerScaleSet{}, fmt.Errorf("failed to get runner scaleset with ID %d: %w", runnerScaleSetID, err)
89 }
90 defer resp.Body.Close()
91
92 var runnerScaleSet params.RunnerScaleSet
93 if err := json.NewDecoder(resp.Body).Decode(&runnerScaleSet); err != nil {
94 return params.RunnerScaleSet{}, fmt.Errorf("failed to decode response: %w", err)
95 }
96 return runnerScaleSet, nil
97}
98
99// ListRunnerScaleSets lists all runner scale sets in a github entity.
100func (s *ScaleSetClient) ListRunnerScaleSets(ctx context.Context) (_ *params.RunnerScaleSetsResponse, err error) {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected