@@ -301,33 +301,17 @@ func (c *Client) GetLatestWorkflowVersion(ctx context.Context, workflowID uuid.U
301301}
302302
303303// GetWorkflowVersionMaxMachines retrieves the maximum machines for a workflow version
304- func (c * Client ) GetWorkflowVersionMaxMachines (ctx context.Context , versionID uuid.UUID , fleetID uuid.UUID ) (* Machines , error ) {
305- var machines Machines
304+ func (c * Client ) GetWorkflowVersionMaxMachines (ctx context.Context , versionID uuid.UUID , fleetID uuid.UUID ) (int , error ) {
305+ var parallelism Parallelism
306306 path := fmt .Sprintf ("/workflow-version/%s/max-machines/?fleet=%s" , versionID , fleetID )
307307
308- if err := c .Hive .doJSON (ctx , http .MethodGet , path , nil , & machines ); err != nil {
309- return nil , fmt .Errorf ("failed to get workflow version max machines: %w" , err )
310- }
311-
312- return & machines , nil
313- }
314-
315- // GetWorkflowVersionMaxMachineCount is a convenience function that retrieves the maximum machines for a workflow version as an int
316- func (c * Client ) GetWorkflowVersionMaxMachineCount (ctx context.Context , versionID uuid.UUID , fleetID uuid.UUID ) (int , error ) {
317- machines , err := c .GetWorkflowVersionMaxMachines (ctx , versionID , fleetID )
318- if err != nil {
308+ if err := c .Hive .doJSON (ctx , http .MethodGet , path , nil , & parallelism ); err != nil {
319309 return 0 , fmt .Errorf ("failed to get workflow version max machines: %w" , err )
320310 }
321-
322- if machines .Default != nil {
323- return * machines .Default , nil
324- }
325-
326- if machines .SelfHosted != nil {
327- return * machines .SelfHosted , nil
311+ if parallelism .Parallelism <= 0 {
312+ return 0 , fmt .Errorf ("invalid max machines value: %d" , parallelism .Parallelism )
328313 }
329-
330- return 0 , fmt .Errorf ("no max machines found for workflow version" )
314+ return parallelism .Parallelism , nil
331315}
332316
333317func (c * Client ) CreateWorkflowVersion (ctx context.Context , version * WorkflowVersion ) (* WorkflowVersion , error ) {
0 commit comments