@@ -100,6 +100,10 @@ type HostServiceIface interface {
100100 NewDeclareHostAsDegradedParams (id string ) * DeclareHostAsDegradedParams
101101 UpdateSecondaryStorageSelector (p * UpdateSecondaryStorageSelectorParams ) (* UpdateSecondaryStorageSelectorResponse , error )
102102 NewUpdateSecondaryStorageSelectorParams (heuristicrule string , id string ) * UpdateSecondaryStorageSelectorParams
103+ PrepareForMaintenance (p * PrepareForMaintenanceParams ) (* PrepareForMaintenanceResponse , error )
104+ NewPrepareForMaintenanceParams (managementserverid UUID ) * PrepareForMaintenanceParams
105+ CancelMaintenance (p * CancelMaintenanceParams ) (* CancelMaintenanceResponse , error )
106+ NewCancelMaintenanceParams (managementserverid UUID ) * CancelMaintenanceParams
103107}
104108
105109type AddBaremetalHostParams struct {
@@ -6645,3 +6649,223 @@ type UpdateSecondaryStorageSelectorResponse struct {
66456649 Type string `json:"type"`
66466650 Zoneid string `json:"zoneid"`
66476651}
6652+
6653+ type PrepareForMaintenanceParams struct {
6654+ p map [string ]interface {}
6655+ }
6656+
6657+ func (p * PrepareForMaintenanceParams ) toURLValues () url.Values {
6658+ u := url.Values {}
6659+ if p .p == nil {
6660+ return u
6661+ }
6662+ if v , found := p .p ["algorithm" ]; found {
6663+ u .Set ("algorithm" , v .(string ))
6664+ }
6665+ if v , found := p .p ["forced" ]; found {
6666+ vv := strconv .FormatBool (v .(bool ))
6667+ u .Set ("forced" , vv )
6668+ }
6669+ if v , found := p .p ["managementserverid" ]; found {
6670+ u .Set ("managementserverid" , v .(string ))
6671+ }
6672+ return u
6673+ }
6674+
6675+ func (p * PrepareForMaintenanceParams ) SetAlgorithm (v string ) {
6676+ if p .p == nil {
6677+ p .p = make (map [string ]interface {})
6678+ }
6679+ p .p ["algorithm" ] = v
6680+ }
6681+
6682+ func (p * PrepareForMaintenanceParams ) ResetAlgorithm () {
6683+ if p .p != nil && p .p ["algorithm" ] != nil {
6684+ delete (p .p , "algorithm" )
6685+ }
6686+ }
6687+
6688+ func (p * PrepareForMaintenanceParams ) GetAlgorithm () (string , bool ) {
6689+ if p .p == nil {
6690+ p .p = make (map [string ]interface {})
6691+ }
6692+ value , ok := p .p ["algorithm" ].(string )
6693+ return value , ok
6694+ }
6695+
6696+ func (p * PrepareForMaintenanceParams ) SetForced (v bool ) {
6697+ if p .p == nil {
6698+ p .p = make (map [string ]interface {})
6699+ }
6700+ p .p ["forced" ] = v
6701+ }
6702+
6703+ func (p * PrepareForMaintenanceParams ) ResetForced () {
6704+ if p .p != nil && p .p ["forced" ] != nil {
6705+ delete (p .p , "forced" )
6706+ }
6707+ }
6708+
6709+ func (p * PrepareForMaintenanceParams ) GetForced () (bool , bool ) {
6710+ if p .p == nil {
6711+ p .p = make (map [string ]interface {})
6712+ }
6713+ value , ok := p .p ["forced" ].(bool )
6714+ return value , ok
6715+ }
6716+
6717+ func (p * PrepareForMaintenanceParams ) SetManagementserverid (v UUID ) {
6718+ if p .p == nil {
6719+ p .p = make (map [string ]interface {})
6720+ }
6721+ p .p ["managementserverid" ] = v
6722+ }
6723+
6724+ func (p * PrepareForMaintenanceParams ) ResetManagementserverid () {
6725+ if p .p != nil && p .p ["managementserverid" ] != nil {
6726+ delete (p .p , "managementserverid" )
6727+ }
6728+ }
6729+
6730+ func (p * PrepareForMaintenanceParams ) GetManagementserverid () (UUID , bool ) {
6731+ if p .p == nil {
6732+ p .p = make (map [string ]interface {})
6733+ }
6734+ value , ok := p .p ["managementserverid" ].(UUID )
6735+ return value , ok
6736+ }
6737+
6738+ // You should always use this function to get a new PrepareForMaintenanceParams instance,
6739+ // as then you are sure you have configured all required params
6740+ func (s * HostService ) NewPrepareForMaintenanceParams (managementserverid UUID ) * PrepareForMaintenanceParams {
6741+ p := & PrepareForMaintenanceParams {}
6742+ p .p = make (map [string ]interface {})
6743+ p .p ["managementserverid" ] = managementserverid
6744+ return p
6745+ }
6746+
6747+ // Prepares management server for maintenance by preventing new jobs from being accepted after completion of active jobs and migrating the agents
6748+ func (s * HostService ) PrepareForMaintenance (p * PrepareForMaintenanceParams ) (* PrepareForMaintenanceResponse , error ) {
6749+ resp , err := s .cs .newPostRequest ("prepareForMaintenance" , p .toURLValues ())
6750+ if err != nil {
6751+ return nil , err
6752+ }
6753+
6754+ var r PrepareForMaintenanceResponse
6755+ if err := json .Unmarshal (resp , & r ); err != nil {
6756+ return nil , err
6757+ }
6758+
6759+ return & r , nil
6760+ }
6761+
6762+ type PrepareForMaintenanceResponse struct {
6763+ Agents []string `json:"agents"`
6764+ Agentscount int64 `json:"agentscount"`
6765+ JobID string `json:"jobid"`
6766+ Jobstatus int `json:"jobstatus"`
6767+ Maintenanceinitiated bool `json:"maintenanceinitiated"`
6768+ Managementserverid UUID `json:"managementserverid"`
6769+ Pendingjobscount int64 `json:"pendingjobscount"`
6770+ Readyforshutdown bool `json:"readyforshutdown"`
6771+ Shutdowntriggered bool `json:"shutdowntriggered"`
6772+ State string `json:"state"`
6773+ }
6774+
6775+ type CancelMaintenanceParams struct {
6776+ p map [string ]interface {}
6777+ }
6778+
6779+ func (p * CancelMaintenanceParams ) toURLValues () url.Values {
6780+ u := url.Values {}
6781+ if p .p == nil {
6782+ return u
6783+ }
6784+ if v , found := p .p ["managementserverid" ]; found {
6785+ u .Set ("managementserverid" , v .(string ))
6786+ }
6787+ if v , found := p .p ["rebalance" ]; found {
6788+ vv := strconv .FormatBool (v .(bool ))
6789+ u .Set ("rebalance" , vv )
6790+ }
6791+ return u
6792+ }
6793+
6794+ func (p * CancelMaintenanceParams ) SetManagementserverid (v UUID ) {
6795+ if p .p == nil {
6796+ p .p = make (map [string ]interface {})
6797+ }
6798+ p .p ["managementserverid" ] = v
6799+ }
6800+
6801+ func (p * CancelMaintenanceParams ) ResetManagementserverid () {
6802+ if p .p != nil && p .p ["managementserverid" ] != nil {
6803+ delete (p .p , "managementserverid" )
6804+ }
6805+ }
6806+
6807+ func (p * CancelMaintenanceParams ) GetManagementserverid () (UUID , bool ) {
6808+ if p .p == nil {
6809+ p .p = make (map [string ]interface {})
6810+ }
6811+ value , ok := p .p ["managementserverid" ].(UUID )
6812+ return value , ok
6813+ }
6814+
6815+ func (p * CancelMaintenanceParams ) SetRebalance (v bool ) {
6816+ if p .p == nil {
6817+ p .p = make (map [string ]interface {})
6818+ }
6819+ p .p ["rebalance" ] = v
6820+ }
6821+
6822+ func (p * CancelMaintenanceParams ) ResetRebalance () {
6823+ if p .p != nil && p .p ["rebalance" ] != nil {
6824+ delete (p .p , "rebalance" )
6825+ }
6826+ }
6827+
6828+ func (p * CancelMaintenanceParams ) GetRebalance () (bool , bool ) {
6829+ if p .p == nil {
6830+ p .p = make (map [string ]interface {})
6831+ }
6832+ value , ok := p .p ["rebalance" ].(bool )
6833+ return value , ok
6834+ }
6835+
6836+ // You should always use this function to get a new CancelMaintenanceParams instance,
6837+ // as then you are sure you have configured all required params
6838+ func (s * HostService ) NewCancelMaintenanceParams (managementserverid UUID ) * CancelMaintenanceParams {
6839+ p := & CancelMaintenanceParams {}
6840+ p .p = make (map [string ]interface {})
6841+ p .p ["managementserverid" ] = managementserverid
6842+ return p
6843+ }
6844+
6845+ // Cancels maintenance of the management server
6846+ func (s * HostService ) CancelMaintenance (p * CancelMaintenanceParams ) (* CancelMaintenanceResponse , error ) {
6847+ resp , err := s .cs .newPostRequest ("cancelMaintenance" , p .toURLValues ())
6848+ if err != nil {
6849+ return nil , err
6850+ }
6851+
6852+ var r CancelMaintenanceResponse
6853+ if err := json .Unmarshal (resp , & r ); err != nil {
6854+ return nil , err
6855+ }
6856+
6857+ return & r , nil
6858+ }
6859+
6860+ type CancelMaintenanceResponse struct {
6861+ Agents []string `json:"agents"`
6862+ Agentscount int64 `json:"agentscount"`
6863+ JobID string `json:"jobid"`
6864+ Jobstatus int `json:"jobstatus"`
6865+ Maintenanceinitiated bool `json:"maintenanceinitiated"`
6866+ Managementserverid UUID `json:"managementserverid"`
6867+ Pendingjobscount int64 `json:"pendingjobscount"`
6868+ Readyforshutdown bool `json:"readyforshutdown"`
6869+ Shutdowntriggered bool `json:"shutdowntriggered"`
6870+ State string `json:"state"`
6871+ }
0 commit comments