github.com/gophercloud/gophercloud@v1.11.0/openstack/blockstorage/v3/snapshots/doc.go (about) 1 /* 2 Package snapshots provides information and interaction with snapshots in the 3 OpenStack Block Storage service. A snapshot is a point in time copy of the 4 data contained in an external storage volume, and can be controlled 5 programmatically. 6 7 Example to list Snapshots 8 9 allPages, err := snapshots.List(client, snapshots.ListOpts{}).AllPages() 10 if err != nil{ 11 panic(err) 12 } 13 snapshots, err := snapshots.ExtractSnapshots(allPages) 14 if err != nil{ 15 panic(err) 16 } 17 for _,s := range snapshots{ 18 fmt.Println(s) 19 } 20 21 Example to get a Snapshot 22 23 snapshotID := "4a584cae-e4ce-429b-9154-d4c9eb8fda4c" 24 snapshot, err := snapshots.Get(client, snapshotID).Extract() 25 if err != nil{ 26 panic(err) 27 } 28 fmt.Println(snapshot) 29 30 Example to create a Snapshot 31 32 snapshot, err := snapshots.Create(client, snapshots.CreateOpts{ 33 Name:"snapshot_001", 34 VolumeID:"5aa119a8-d25b-45a7-8d1b-88e127885635", 35 }).Extract() 36 if err != nil{ 37 panic(err) 38 } 39 fmt.Println(snapshot) 40 41 Example to delete a Snapshot 42 43 snapshotID := "4a584cae-e4ce-429b-9154-d4c9eb8fda4c" 44 err := snapshots.Delete(client, snapshotID).ExtractErr() 45 if err != nil{ 46 panic(err) 47 } 48 49 Example to update a Snapshot 50 51 snapshotID := "4a584cae-e4ce-429b-9154-d4c9eb8fda4c" 52 snapshot, err = snapshots.Update(client, snapshotID, snapshots.UpdateOpts{ 53 Name: "snapshot_002", 54 Description:"description_002", 55 }).Extract() 56 if err != nil{ 57 panic(err) 58 } 59 fmt.Println(snapshot) 60 */ 61 package snapshots