Documentation ¶
Overview ¶
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) }
Index ¶
- func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- type BatchCreateOpts
- type BatchCreateOptsBuilder
- type CreateOpts
- type CreateResult
- type DeleteResult
- type EnforcementModel
- type EnforcementModelResult
- type GetResult
- type Limit
- type LimitOutput
- type LimitPage
- type LimitsOutput
- type ListOpts
- type ListOptsBuilder
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List enumerates the limits.
Types ¶
type BatchCreateOpts ¶ added in v1.3.0
type BatchCreateOpts []CreateOpts
BatchCreateOpts provides options used to create limits.
func (BatchCreateOpts) ToLimitsCreateMap ¶ added in v1.3.0
func (opts BatchCreateOpts) ToLimitsCreateMap() (map[string]interface{}, error)
ToLimitsCreateMap formats a BatchCreateOpts into a create request.
type BatchCreateOptsBuilder ¶ added in v1.3.0
BatchCreateOptsBuilder allows extensions to add additional parameters to the Create request.
type CreateOpts ¶ added in v1.3.0
type CreateOpts struct { // RegionID is the ID of the region where the limit is applied. RegionID string `json:"region_id,omitempty"` // ProjectID is the ID of the project where the limit is applied. ProjectID string `json:"project_id,omitempty"` // DomainID is the ID of the domain where the limit is applied. DomainID string `json:"domain_id,omitempty"` // ServiceID is the ID of the service where the limit is applied. ServiceID string `json:"service_id" required:"true"` // Description of the limit. Description string `json:"description,omitempty"` // ResourceName is the name of the resource that the limit is applied to. ResourceName string `json:"resource_name" required:"true"` // ResourceLimit is the override limit. ResourceLimit int `json:"resource_limit"` }
func (CreateOpts) ToMap ¶ added in v1.3.0
func (opts CreateOpts) ToMap() (map[string]interface{}, error)
type CreateResult ¶ added in v1.3.0
type CreateResult struct {
gophercloud.Result
}
CreateResult is the response from a Create operation. Call its Extract method to interpret it as a Limits.
func BatchCreate ¶ added in v1.3.0
func BatchCreate(client *gophercloud.ServiceClient, opts BatchCreateOptsBuilder) (r CreateResult)
BatchCreate creates new Limits.
func (CreateResult) Extract ¶ added in v1.3.0
func (r CreateResult) Extract() ([]Limit, error)
Extract interprets CreateResult as slice of Limits.
type DeleteResult ¶ added in v1.4.0
type DeleteResult struct {
gophercloud.ErrResult
}
DeleteResult is the response from a Delete operation. Call its ExtractErr to determine if the request succeeded or failed.
func Delete ¶ added in v1.4.0
func Delete(client *gophercloud.ServiceClient, limitID string) (r DeleteResult)
Delete deletes a limit.
type EnforcementModel ¶ added in v1.1.0
type EnforcementModel struct { // The name of the enforcement model. Name string `json:"name"` // A short description of the enforcement model used. Description string `json:"description"` }
A model describing the configured enforcement model used by the deployment.
type EnforcementModelResult ¶ added in v1.1.0
type EnforcementModelResult struct {
gophercloud.Result
}
EnforcementModelResult is the response from a GetEnforcementModel operation. Call its Extract method to interpret it as a EnforcementModel.
func GetEnforcementModel ¶ added in v1.1.0
func GetEnforcementModel(client *gophercloud.ServiceClient) (r EnforcementModelResult)
Get retrieves details on a single limit, by ID.
func (EnforcementModelResult) Extract ¶ added in v1.1.0
func (r EnforcementModelResult) Extract() (*EnforcementModel, error)
Extract interprets EnforcementModelResult as a EnforcementModel.
type GetResult ¶ added in v1.4.0
type GetResult struct {
// contains filtered or unexported fields
}
GetResult is the response from a Get operation. Call its Extract method to interpret it as a Limit.
func Get ¶ added in v1.4.0
func Get(client *gophercloud.ServiceClient, limitID string) (r GetResult)
Get retrieves details on a single limit, by ID.
type Limit ¶
type Limit struct { // ID is the unique ID of the limit. ID string `json:"id"` // RegionID is the ID of the region where the limit is applied. RegionID string `json:"region_id"` // ProjectID is the ID of the project where the limit is applied. ProjectID string `json:"project_id"` // DomainID is the ID of the domain where the limit is applied. DomainID string `json:"domain_id"` // ServiceID is the ID of the service where the limit is applied. ServiceID string `json:"service_id"` // Description of the limit. Description string `json:"description"` // ResourceName is the name of the resource that the limit is applied to. ResourceName string `json:"resource_name"` // ResourceLimit is the override limit. ResourceLimit int `json:"resource_limit"` // Links contains referencing links to the limit. Links map[string]interface{} `json:"links"` }
A limit is the limit that override the registered limit for each project.
func ExtractLimits ¶
func ExtractLimits(r pagination.Page) ([]Limit, error)
ExtractLimits returns a slice of Limits contained in a single page of results.
type LimitOutput ¶ added in v1.4.0
type LimitOutput struct {
Limit *Limit `json:"limit"`
}
A LimitOutput is an encapsulated Limit returned by Get and Update operations
type LimitPage ¶
type LimitPage struct {
pagination.LinkedPageBase
}
LimitPage is a single page of Limit results.
func (LimitPage) NextPageURL ¶
NextPageURL extracts the "next" link from the links section of the result.
type LimitsOutput ¶ added in v1.3.0
type LimitsOutput struct {
Limits []Limit `json:"limits"`
}
A LimitsOutput is an array of limits returned by List and BatchCreate operations
type ListOpts ¶
type ListOpts struct { // Filters the response by a region ID. RegionID string `q:"region_id"` // Filters the response by a project ID. ProjectID string `q:"project_id"` // Filters the response by a domain ID. DomainID string `q:"domain_id"` // Filters the response by a service ID. ServiceID string `q:"service_id"` // Filters the response by a resource name. ResourceName string `q:"resource_name"` }
ListOpts provides options to filter the List results.
func (ListOpts) ToLimitListQuery ¶
ToLimitListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request
type UpdateOpts ¶ added in v1.4.0
type UpdateOpts struct { // Description of the limit. Description *string `json:"description,omitempty"` // ResourceLimit is the override limit. ResourceLimit *int `json:"resource_limit,omitempty"` }
UpdateOpts represents parameters to update a domain.
func (UpdateOpts) ToLimitUpdateMap ¶ added in v1.4.0
func (opts UpdateOpts) ToLimitUpdateMap() (map[string]interface{}, error)
ToLimitUpdateMap formats UpdateOpts into an update request.
type UpdateOptsBuilder ¶ added in v1.4.0
UpdateOptsBuilder allows extensions to add additional parameters to the Update request.
type UpdateResult ¶ added in v1.4.0
type UpdateResult struct {
// contains filtered or unexported fields
}
UpdateResult is the result of an Update request. Call its Extract method to interpret it as a Limit.
func Update ¶ added in v1.4.0
func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)
Update modifies the attributes of a limit.