github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dcs/v1/others/ListMaintenanceWindows.go (about)

     1  package others
     2  
     3  import (
     4  	"strings"
     5  
     6  	"github.com/opentelekomcloud/gophertelekomcloud"
     7  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     8  )
     9  
    10  func ListMaintenanceWindows(client *golangsdk.ServiceClient) ([]MaintainWindow, error) {
    11  	// remove projectId from endpoint
    12  	raw, err := client.Get(strings.Replace(client.ServiceURL("instances/maintain-windows"), "/"+client.ProjectID, "", -1), nil, nil)
    13  	if err != nil {
    14  		return nil, err
    15  	}
    16  
    17  	var res []MaintainWindow
    18  	err = extract.IntoSlicePtr(raw.Body, &res, "maintain_windows")
    19  	return res, err
    20  }
    21  
    22  type MaintainWindow struct {
    23  	// Start time of the maintenance time window.
    24  	ID int `json:"seq"`
    25  	// Start time of the maintenance time window.
    26  	Begin string `json:"begin"`
    27  	// End time of the maintenance time window.
    28  	End string `json:"end"`
    29  	// An indicator of whether the maintenance time window is set to the default time segment.
    30  	Default bool `json:"default"`
    31  }