github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/identity/v3/groups/doc.go (about) 1 /* 2 Package groups manages and retrieves Groups in the OpenStack Identity Service. 3 4 Example to List Groups 5 6 listOpts := groups.ListOpts{ 7 DomainID: "default", 8 } 9 10 allPages, err := groups.List(identityClient, listOpts).AllPages() 11 if err != nil { 12 panic(err) 13 } 14 15 allGroups, err := groups.ExtractGroups(allPages) 16 if err != nil { 17 panic(err) 18 } 19 20 for _, group := range allGroups { 21 fmt.Printf("%+v\n", group) 22 } 23 24 Example to Create a Group 25 26 createOpts := groups.CreateOpts{ 27 Name: "groupname", 28 DomainID: "default", 29 Extra: map[string]interface{}{ 30 "email": "groupname@example.com", 31 } 32 } 33 34 group, err := groups.Create(identityClient, createOpts).Extract() 35 if err != nil { 36 panic(err) 37 } 38 39 Example to Update a Group 40 41 groupID := "0fe36e73809d46aeae6705c39077b1b3" 42 43 updateOpts := groups.UpdateOpts{ 44 Description: "Updated Description for group", 45 } 46 47 group, err := groups.Update(identityClient, groupID, updateOpts).Extract() 48 if err != nil { 49 panic(err) 50 } 51 52 Example to Delete a Group 53 54 groupID := "0fe36e73809d46aeae6705c39077b1b3" 55 err := groups.Delete(identityClient, groupID).ExtractErr() 56 if err != nil { 57 panic(err) 58 } 59 */ 60 package groups