github.com/gophercloud/gophercloud@v1.11.0/openstack/blockstorage/extensions/quotasets/doc.go (about)

     1  /*
     2  Package quotasets enables retrieving and managing Block Storage quotas.
     3  
     4  Example to Get a Quota Set
     5  
     6  	quotaset, err := quotasets.Get(blockStorageClient, "project-id").Extract()
     7  	if err != nil {
     8  		panic(err)
     9  	}
    10  
    11  	fmt.Printf("%+v\n", quotaset)
    12  
    13  Example to Get Quota Set Usage
    14  
    15  	quotaset, err := quotasets.GetUsage(blockStorageClient, "project-id").Extract()
    16  	if err != nil {
    17  		panic(err)
    18  	}
    19  
    20  	fmt.Printf("%+v\n", quotaset)
    21  
    22  Example to Update a Quota Set
    23  
    24  	updateOpts := quotasets.UpdateOpts{
    25  		Volumes: gophercloud.IntToPointer(100),
    26  	}
    27  
    28  	quotaset, err := quotasets.Update(blockStorageClient, "project-id", updateOpts).Extract()
    29  	if err != nil {
    30  		panic(err)
    31  	}
    32  
    33  	fmt.Printf("%+v\n", quotaset)
    34  
    35  Example to Update a Quota set with volume_type quotas
    36  
    37  	updateOpts := quotasets.UpdateOpts{
    38  		Volumes: gophercloud.IntToPointer(100),
    39  		Extra: map[string]interface{}{
    40  			"gigabytes_foo": gophercloud.IntToPointer(100),
    41  			"snapshots_foo": gophercloud.IntToPointer(10),
    42  			"volumes_foo":   gophercloud.IntToPointer(10),
    43  		},
    44  	}
    45  
    46  	quotaset, err := quotasets.Update(blockStorageClient, "project-id", updateOpts).Extract()
    47  	if err != nil {
    48  		panic(err)
    49  	}
    50  
    51  	fmt.Printf("%+v\n", quotaset)
    52  
    53  Example to Delete a Quota Set
    54  
    55  	err := quotasets.Delete(blockStorageClient, "project-id").ExtractErr()
    56  	if err != nil {
    57  		panic(err)
    58  	}
    59  */
    60  package quotasets