Remove unused fields (#48)

This commit is contained in:
Francesco Renzi
2026-01-13 17:19:16 +00:00
committed by GitHub
parent 1208e1216e
commit 0015641f99
3 changed files with 15 additions and 9 deletions
+15
View File
@@ -415,11 +415,24 @@ func (c *Client) GetRunnerGroupByName(ctx context.Context, runnerGroup string) (
return &runnerGroupList.RunnerGroups[0], nil
}
// applyDefaultLabelTypes ensures that each label in the runner scale set has a Type set,
// defaulting to "System" when the field is empty. This encapsulates the legacy API detail
// so that callers do not need to manage label types explicitly.
func applyDefaultLabelTypes(runnerScaleSet *RunnerScaleSet) {
for i := range runnerScaleSet.Labels {
if runnerScaleSet.Labels[i].Type == "" {
runnerScaleSet.Labels[i].Type = "System"
}
}
}
// CreateRunnerScaleSet creates a new runner scale set. Note that runner scale set names must be unique within a runner group.
func (c *Client) CreateRunnerScaleSet(ctx context.Context, runnerScaleSet *RunnerScaleSet) (*RunnerScaleSet, error) {
c.mu.Lock()
defer c.mu.Unlock()
applyDefaultLabelTypes(runnerScaleSet)
body, err := json.Marshal(runnerScaleSet)
if err != nil {
return nil, fmt.Errorf("failed to marshal runner scale set: %w", err)
@@ -454,6 +467,8 @@ func (c *Client) UpdateRunnerScaleSet(ctx context.Context, runnerScaleSetID int,
c.mu.Lock()
defer c.mu.Unlock()
applyDefaultLabelTypes(runnerScaleSet)
path := fmt.Sprintf("%s/%d", scaleSetEndpoint, runnerScaleSetID)
body, err := json.Marshal(runnerScaleSet)