github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/identity/v3/projects/doc.go (about) 1 /* 2 Package projects manages and retrieves Projects in the OpenStack Identity 3 Service. 4 5 Example to List Projects 6 7 listOpts := projects.ListOpts{ 8 Enabled: golangsdk.Enabled, 9 } 10 11 allPages, err := projects.List(identityClient, listOpts).AllPages() 12 if err != nil { 13 panic(err) 14 } 15 16 allProjects, err := projects.ExtractProjects(allPages) 17 if err != nil { 18 panic(err) 19 } 20 21 for _, project := range allProjects { 22 fmt.Printf("%+v\n", project) 23 } 24 25 Example to Create a Project 26 27 createOpts := projects.CreateOpts{ 28 Name: "project_name", 29 Description: "Project Description" 30 } 31 32 project, err := projects.Create(identityClient, createOpts).Extract() 33 if err != nil { 34 panic(err) 35 } 36 37 Example to Update a Project 38 39 projectID := "966b3c7d36a24facaf20b7e458bf2192" 40 41 updateOpts := projects.UpdateOpts{ 42 Enabled: golangsdk.Disabled, 43 } 44 45 project, err := projects.Update(identityClient, projectID, updateOpts).Extract() 46 if err != nil { 47 panic(err) 48 } 49 50 Example to Delete a Project 51 52 projectID := "966b3c7d36a24facaf20b7e458bf2192" 53 err := projects.Delete(identityClient, projectID).ExtractErr() 54 if err != nil { 55 panic(err) 56 } 57 */ 58 package projects