github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/imageservice/v2/imagedata/doc.go (about) 1 /* 2 Package imagedata enables management of image data. 3 4 Example to Upload Image Data 5 6 imageID := "da3b75d9-3f4a-40e7-8a2c-bfab23927dea" 7 8 imageData, err := os.Open("/path/to/image/file") 9 if err != nil { 10 panic(err) 11 } 12 defer imageData.Close() 13 14 err = imagedata.Upload(imageClient, imageID, imageData).ExtractErr() 15 if err != nil { 16 panic(err) 17 } 18 19 Example to Stage Image Data 20 21 imageID := "da3b75d9-3f4a-40e7-8a2c-bfab23927dea" 22 23 imageData, err := os.Open("/path/to/image/file") 24 if err != nil { 25 panic(err) 26 } 27 defer imageData.Close() 28 29 err = imagedata.Stage(imageClient, imageID, imageData).ExtractErr() 30 if err != nil { 31 panic(err) 32 } 33 34 Example to Download Image Data 35 36 imageID := "da3b75d9-3f4a-40e7-8a2c-bfab23927dea" 37 38 image, err := imagedata.Download(imageClient, imageID).Extract() 39 if err != nil { 40 panic(err) 41 } 42 43 // close the reader, when reading has finished 44 defer image.Close() 45 46 imageData, err := ioutil.ReadAll(image) 47 if err != nil { 48 panic(err) 49 } 50 */ 51 package imagedata