File: doc.go

package info (click to toggle)
golang-github-gophercloud-gophercloud 0.0~git20180917.45f1c769-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,768 kB
  • sloc: sh: 98; makefile: 14
file content (60 lines) | stat: -rw-r--r-- 1,133 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
Package images enables management and retrieval of images from the OpenStack
Image Service.

Example to List Images

	images.ListOpts{
		Owner: "a7509e1ae65945fda83f3e52c6296017",
	}

	allPages, err := images.List(imagesClient, listOpts).AllPages()
	if err != nil {
		panic(err)
	}

	allImages, err := images.ExtractImages(allPages)
	if err != nil {
		panic(err)
	}

	for _, image := range allImages {
		fmt.Printf("%+v\n", image)
	}

Example to Create an Image

	createOpts := images.CreateOpts{
		Name:       "image_name",
		Visibility: images.ImageVisibilityPrivate,
	}

	image, err := images.Create(imageClient, createOpts)
	if err != nil {
		panic(err)
	}

Example to Update an Image

	imageID := "1bea47ed-f6a9-463b-b423-14b9cca9ad27"

	updateOpts := images.UpdateOpts{
		images.ReplaceImageName{
			NewName: "new_name",
		},
	}

	image, err := images.Update(imageClient, imageID, updateOpts).Extract()
	if err != nil {
		panic(err)
	}

Example to Delete an Image

	imageID := "1bea47ed-f6a9-463b-b423-14b9cca9ad27"
	err := images.Delete(imageClient, imageID).ExtractErr()
	if err != nil {
		panic(err)
	}
*/
package images