github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/vbs/v2/shares/doc.go (about) 1 /* 2 Package shares enables management and retrieval of Shares 3 VBS service. 4 5 Example to List Shares 6 7 listOpts := shares.ListOpts{} 8 allShares, err := shares.List(vbsClient, listOpts) 9 if err != nil { 10 panic(err) 11 } 12 13 for _, share := range allShares { 14 fmt.Printf("%+v\n", share) 15 } 16 17 Example to Get a Share 18 19 getshare,err:=shares.Get(vbsClient, "6149e448-dcac-4691-96d9-041e09ef617f").ExtractShare() 20 if err != nil { 21 panic(err) 22 } 23 24 fmt.Println(getshare) 25 26 Example to Create a Share 27 28 createOpts := shares.CreateOpts{BackupID:"87566ed6-72cb-4053-aa6e-6f6216b3d507", 29 ToProjectIDs:[]string{"91d687759aed45d28b5f6084bc2fa8ad"}} 30 31 share, err := shares.Create(vbsClient, createOpts).Extract() 32 if err != nil { 33 panic(err) 34 } 35 36 Example to Delete a Share 37 38 shareID := "4e8e5957-649f-477b-9e5b-f1f75b21c03c" 39 40 deleteopts := shares.DeleteOpts{IsBackupID:false} 41 err := shares.Delete(vbsclient,shareID,deleteopts).ExtractErr() 42 if err != nil { 43 panic(err) 44 } 45 */ 46 package shares