github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/core/model/job.go (about) 1 // Copyright 2019 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package model 5 6 // MachineJob values define responsibilities that machines may be 7 // expected to fulfil. 8 type MachineJob string 9 10 const ( 11 JobHostUnits MachineJob = "JobHostUnits" 12 JobManageModel MachineJob = "JobManageModel" 13 ) 14 15 // NeedsState returns true if the job requires a state connection. 16 func (job MachineJob) NeedsState() bool { 17 return job == JobManageModel 18 } 19 20 // AnyJobNeedsState returns true if any of the provided jobs 21 // require a state connection. 22 func AnyJobNeedsState(jobs ...MachineJob) bool { 23 for _, j := range jobs { 24 if j.NeedsState() { 25 return true 26 } 27 } 28 return false 29 }