github.com/leeclow-ops/gophercloud@v1.2.1/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  package limits