File: doc.go

package info (click to toggle)
golang-github-gophercloud-gophercloud 0.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, bullseye-backports
  • size: 10,224 kB
  • sloc: sh: 125; makefile: 21
file content (63 lines) | stat: -rw-r--r-- 1,369 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
61
62
63
/*
Package regions manages and retrieves Regions in the OpenStack Identity Service.

Example to List Regions

	listOpts := regions.ListOpts{
		ParentRegionID: "RegionOne",
	}

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

	allRegions, err := regions.ExtractRegions(allPages)
	if err != nil {
		panic(err)
	}

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

Example to Create a Region

	createOpts := regions.CreateOpts{
		ID:             "TestRegion",
		Description: "Region for testing"
		Extra: map[string]interface{}{
			"email": "testregionsupport@example.com",
		}
	}

	region, err := regions.Create(identityClient, createOpts).Extract()
	if err != nil {
		panic(err)
	}

Example to Update a Region

	regionID := "TestRegion"

	// There is currently a bug in Keystone where updating the optional Extras
	// attributes set in regions.Create is not supported, see:
	// https://bugs.launchpad.net/keystone/+bug/1729933
	updateOpts := regions.UpdateOpts{
		Description: "Updated Description for region",
	}

	region, err := regions.Update(identityClient, regionID, updateOpts).Extract()
	if err != nil {
		panic(err)
	}

Example to Delete a Region

	regionID := "TestRegion"
	err := regions.Delete(identityClient, regionID).ExtractErr()
	if err != nil {
		panic(err)
	}
*/
package regions