forked from gophercloud/gophercloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
55 lines (43 loc) · 1.16 KB
/
doc.go
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
/*
Package tasks enables management and retrieval of tasks from the OpenStack
Imageservice.
Example to List Tasks
listOpts := tasks.ListOpts{
Owner: "424e7cf0243c468ca61732ba45973b3e",
}
allPages, err := tasks.List(imagesClient, listOpts).AllPages()
if err != nil {
panic(err)
}
allTasks, err := tasks.ExtractTasks(allPages)
if err != nil {
panic(err)
}
for _, task := range allTasks {
fmt.Printf("%+v\n", task)
}
Example to Get a Task
task, err := tasks.Get(imagesClient, "1252f636-1246-4319-bfba-c47cde0efbe0").Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", task)
Example to Create a Task
createOpts := tasks.CreateOpts{
Type: "import",
Input: map[string]interface{}{
"image_properties": map[string]interface{}{
"container_format": "bare",
"disk_format": "raw",
},
"import_from_format": "raw",
"import_from": "https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img",
},
}
task, err := tasks.Create(imagesClient, createOpts).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", task)
*/
package tasks