github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/css/v1/snapshots/List.go (about)

     1  package snapshots
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  )
     7  
     8  // List retrieves the Snapshots with the provided ID. To extract the Snapshot
     9  // objects from the response, call the Extract method on the GetResult.
    10  func List(client *golangsdk.ServiceClient, clusterId string) ([]Snapshot, error) {
    11  	raw, err := client.Get(client.ServiceURL("clusters", clusterId, "index_snapshots"), nil, nil)
    12  	if err != nil {
    13  		return nil, err
    14  	}
    15  
    16  	var res []Snapshot
    17  	err = extract.IntoSlicePtr(raw.Body, &res, "backups")
    18  	return res, err
    19  }