Remove unused fields (#48)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user