github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dws/v1/snapshot/ListSnapshots.go (about)

     1  package snapshot
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  	"github.com/opentelekomcloud/gophertelekomcloud/openstack"
     7  )
     8  
     9  func ListSnapshot(client *golangsdk.ServiceClient) (*ListSnapshotsResponse, error) {
    10  	// GET /v1.0/{project_id}/snapshots
    11  	raw, err := client.Get(client.ServiceURL("snapshots"), nil, openstack.StdRequestOpts())
    12  	if err != nil {
    13  		return nil, err
    14  	}
    15  
    16  	var res ListSnapshotsResponse
    17  	err = extract.Into(raw.Body, &res)
    18  	return &res, err
    19  }
    20  
    21  type ListSnapshotsResponse struct {
    22  	// List of snapshot objects
    23  	Snapshots []Snapshots `json:"snapshots,omitempty"`
    24  	// Total number of snapshot objects
    25  	Count int `json:"count,omitempty"`
    26  }
    27  
    28  type Snapshots struct {
    29  	// Snapshot ID
    30  	Id string `json:"id"`
    31  	// Snapshot name
    32  	Name string `json:"name"`
    33  	// Snapshot description
    34  	Description string `json:"description"`
    35  	// Time when a snapshot starts to be created. Format: ISO8601: YYYY-MM-DDThh:mm:ssZ
    36  	Started string `json:"started"`
    37  	// Time when a snapshot is complete. Format: ISO8601: YYYY-MM-DDThh:mm:ssZ
    38  	Finished string `json:"finished"`
    39  	// Snapshot size, in GB
    40  	Size float64 `json:"size"`
    41  	// Snapshot status:
    42  	// CREATING
    43  	// AVAILABLE
    44  	// UNAVAILABLE
    45  	Status string `json:"status"`
    46  	// Snapshot type. It can be:
    47  	// MANUAL
    48  	// AUTOMATED
    49  	Type string `json:"type"`
    50  	// ID of the cluster for which snapshots are created For details about how to obtain the ID, see 7.6 Obtaining the Cluster ID.
    51  	ClusterId string `json:"cluster_id"`
    52  }