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
|
/*
Package limits provides information and interaction with limits for the
Openstack Identity service.
Example to Get EnforcementModel
model, err := limits.GetEnforcementModel(identityClient).Extract()
if err != nil {
panic(err)
}
Example to List Limits
listOpts := limits.ListOpts{
ProjectID: "3d596369fd2043bf8aca3c8decb0189e",
}
allPages, err := limits.List(identityClient, listOpts).AllPages()
if err != nil {
panic(err)
}
allLimits, err := limits.ExtractLimits(allPages)
if err != nil {
panic(err)
}
Example to Create Limits
batchCreateOpts := limits.BatchCreateOpts{
limits.CreateOpts{
ServiceID: "9408080f1970482aa0e38bc2d4ea34b7",
ProjectID: "3a705b9f56bb439381b43c4fe59dccce",
RegionID: "RegionOne",
ResourceName: "snapshot",
ResourceLimit: 5,
},
limits.CreateOpts{
ServiceID: "9408080f1970482aa0e38bc2d4ea34b7",
DomainID: "edbafc92be354ffa977c58aa79c7bdb2",
ResourceName: "volume",
ResourceLimit: 10,
Description: "Number of volumes for project 3a705b9f56bb439381b43c4fe59dccce",
},
}
createdLimits, err := limits.Create(identityClient, batchCreateOpts).Extract()
if err != nil {
panic(err)
}
Example to Get a Limit
limit, err := limits.Get(identityClient, "25a04c7a065c430590881c646cdcdd58").Extract()
if err != nil {
panic(err)
}
Example to Update a Limit
limitID := "0fe36e73809d46aeae6705c39077b1b3"
description := "Number of snapshots for project 3a705b9f56bb439381b43c4fe59dccce"
resourceLimit := 5
updateOpts := limits.UpdateOpts{
Description: &description,
ResourceLimit: &resourceLimit,
}
limit, err := limits.Update(identityClient, limitID, updateOpts).Extract()
if err != nil {
panic(err)
}
Example to Delete a Limit
limitID := "0fe36e73809d46aeae6705c39077b1b3"
err := limits.Delete(identityClient, limitID).ExtractErr()
if err != nil {
panic(err)
}
*/
package limits
|