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 (85 lines) | stat: -rw-r--r-- 1,696 bytes parent folder | download
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
Package profiles provides information and interaction with profiles through
the OpenStack Clustering service.

Example to Create a Profile

	networks := []map[string]interface{} {
		{"network": "test-network"},
	}

	props := map[string]interface{}{
		"name":            "test_gophercloud_profile",
		"flavor":          "t2.micro",
		"image":           "centos7.3-latest",
		"networks":        networks,
		"security_groups": "",
	}

	createOpts := profiles.CreateOpts {
		Name: "test_profile",
		Spec: profiles.Spec{
			Type:       "os.nova.server",
			Version:    "1.0",
			Properties: props,
		},
	}

	profile, err := profiles.Create(serviceClient, createOpts).Extract()
	if err != nil {
		panic(err)
	}

	fmt.Println("Profile", profile)

Example to Get a Profile

	profile, err := profiles.Get(serviceClient, "profile-name").Extract()
	if err != nil {
		panic(err)
	}

	fmt.Print("profile", profile)


Example to List Profiles

	listOpts := profiles.ListOpts{
		Limit: 2,
	}

	profiles.List(serviceClient, listOpts).EachPage(func(page pagination.Page) (bool, error) {
		allProfiles, err := profiles.ExtractProfiles(page)
		if err != nil {
			panic(err)
		}

		for _, profile := range allProfiles {
			fmt.Printf("%+v\n", profile)
		}
		return true, nil
	})

Example to Update a Profile

	updateOpts := profiles.UpdateOpts{
		Name: "new-name",
	}

	profile, err := profiles.Update(serviceClient, profileName, updateOpts).Extract()
	if err != nil {
		panic(err)
	}

	fmt.Print("profile", profile)

Example to Delete a Profile

	profileID := "6dc6d336e3fc4c0a951b5698cd1236ee"
	err := profiles.Delete(serviceClient, profileID).ExtractErr()
	if err != nil {
		panic(err)
	}

*/
package profiles