github.com/gophercloud/gophercloud@v1.11.0/openstack/identity/v3/limits/doc.go (about) 1 /* 2 Package limits provides information and interaction with limits for the 3 Openstack Identity service. 4 5 Example to Get EnforcementModel 6 7 model, err := limits.GetEnforcementModel(identityClient).Extract() 8 if err != nil { 9 panic(err) 10 } 11 12 Example to List Limits 13 14 listOpts := limits.ListOpts{ 15 ProjectID: "3d596369fd2043bf8aca3c8decb0189e", 16 } 17 18 allPages, err := limits.List(identityClient, listOpts).AllPages() 19 if err != nil { 20 panic(err) 21 } 22 23 allLimits, err := limits.ExtractLimits(allPages) 24 if err != nil { 25 panic(err) 26 } 27 28 Example to Create Limits 29 30 batchCreateOpts := limits.BatchCreateOpts{ 31 limits.CreateOpts{ 32 ServiceID: "9408080f1970482aa0e38bc2d4ea34b7", 33 ProjectID: "3a705b9f56bb439381b43c4fe59dccce", 34 RegionID: "RegionOne", 35 ResourceName: "snapshot", 36 ResourceLimit: 5, 37 }, 38 limits.CreateOpts{ 39 ServiceID: "9408080f1970482aa0e38bc2d4ea34b7", 40 DomainID: "edbafc92be354ffa977c58aa79c7bdb2", 41 ResourceName: "volume", 42 ResourceLimit: 10, 43 Description: "Number of volumes for project 3a705b9f56bb439381b43c4fe59dccce", 44 }, 45 } 46 47 createdLimits, err := limits.Create(identityClient, batchCreateOpts).Extract() 48 if err != nil { 49 panic(err) 50 } 51 52 Example to Get a Limit 53 54 limit, err := limits.Get(identityClient, "25a04c7a065c430590881c646cdcdd58").Extract() 55 if err != nil { 56 panic(err) 57 } 58 59 Example to Update a Limit 60 61 limitID := "0fe36e73809d46aeae6705c39077b1b3" 62 63 description := "Number of snapshots for project 3a705b9f56bb439381b43c4fe59dccce" 64 resourceLimit := 5 65 updateOpts := limits.UpdateOpts{ 66 Description: &description, 67 ResourceLimit: &resourceLimit, 68 } 69 70 limit, err := limits.Update(identityClient, limitID, updateOpts).Extract() 71 if err != nil { 72 panic(err) 73 } 74 75 Example to Delete a Limit 76 77 limitID := "0fe36e73809d46aeae6705c39077b1b3" 78 err := limits.Delete(identityClient, limitID).ExtractErr() 79 if err != nil { 80 panic(err) 81 } 82 */ 83 package limits