Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 7e8d8ed

Browse files
author
Dan Kirkwood
committed
use QuotaSet consistently; fix unit test
1 parent c0a8099 commit 7e8d8ed

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
// Package quotasets provides information and interaction with Quotaset
1+
// Package quotasets provides information and interaction with QuotaSet
22
// extension for the OpenStack Compute service.
33
package quotasets

openstack/compute/v2/extensions/quotasets/fixtures.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ const GetOutput = `
3131

3232
const FirstTenantID = "555544443333222211110000ffffeeee"
3333

34-
// FirstQuotaset is the first result in ListOutput.
35-
var FirstQuota = Quotaset{
34+
// FirstQuotaSet is the first result in ListOutput.
35+
var FirstQuotaSet = QuotaSet{
3636
FixedIps: 0,
3737
FloatingIps: 0,
3838
InjectedFileContentBytes: 10240,

openstack/compute/v2/extensions/quotasets/requests.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"github.com/rackspace/gophercloud"
55
)
66

7-
// Get returns public data about a previously created Quotaset.
7+
// Get returns public data about a previously created QuotaSet.
88
func Get(client *gophercloud.ServiceClient, tenantID string) GetResult {
99
var res GetResult
1010
_, res.Err = client.Get(getURL(client, tenantID), &res.Body, nil)

openstack/compute/v2/extensions/quotasets/requests_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ func TestGet(t *testing.T) {
1212
HandleGetSuccessfully(t)
1313
actual, err := Get(client.ServiceClient(), FirstTenantID).Extract()
1414
th.AssertNoErr(t, err)
15-
th.CheckDeepEquals(t, &FirstQuotaset, actual)
15+
th.CheckDeepEquals(t, &FirstQuotaSet, actual)
1616
}

openstack/compute/v2/extensions/quotasets/results.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/rackspace/gophercloud/pagination"
77
)
88

9-
// Quotaset is a set of operational limits that allow for control of compute usage.
9+
// QuotaSet is a set of operational limits that allow for control of compute usage.
1010
const sample = `
1111
{
1212
"quota_set" : {
@@ -26,7 +26,7 @@ const sample = `
2626
}
2727
`
2828

29-
type Quotaset struct {
29+
type QuotaSet struct {
3030
//ID is tenant associated with this quota_set
3131
ID string `mapstructure:"id"`
3232
//FixedIps is number of fixed ips alloted this quota_set
@@ -55,26 +55,26 @@ type Quotaset struct {
5555
Instances int `mapstructure:"instances"`
5656
}
5757

58-
// QuotasetPage stores a single, only page of Quotaset results from a List call.
59-
type QuotasetPage struct {
58+
// QuotaSetPage stores a single, only page of QuotaSet results from a List call.
59+
type QuotaSetPage struct {
6060
pagination.SinglePageBase
6161
}
6262

63-
// IsEmpty determines whether or not a QuotasetsetPage is empty.
64-
func (page QuotasetPage) IsEmpty() (bool, error) {
65-
ks, err := ExtractQuotasets(page)
63+
// IsEmpty determines whether or not a QuotaSetsetPage is empty.
64+
func (page QuotaSetPage) IsEmpty() (bool, error) {
65+
ks, err := ExtractQuotaSets(page)
6666
return len(ks) == 0, err
6767
}
6868

69-
// ExtractQuotasets interprets a page of results as a slice of Quotasets.
70-
func ExtractQuotasets(page pagination.Page) ([]Quotaset, error) {
69+
// ExtractQuotaSets interprets a page of results as a slice of QuotaSets.
70+
func ExtractQuotaSets(page pagination.Page) ([]QuotaSet, error) {
7171
var resp struct {
72-
Quotasets []Quotaset `mapstructure:"quotas"`
72+
QuotaSets []QuotaSet `mapstructure:"quotas"`
7373
}
7474

75-
err := mapstructure.Decode(page.(QuotasetPage).Body, &resp)
76-
results := make([]Quotaset, len(resp.Quotasets))
77-
for i, q := range resp.Quotasets {
75+
err := mapstructure.Decode(page.(QuotaSetPage).Body, &resp)
76+
results := make([]QuotaSet, len(resp.QuotaSets))
77+
for i, q := range resp.QuotaSets {
7878
results[i] = q
7979
}
8080
return results, err
@@ -84,22 +84,22 @@ type quotaResult struct {
8484
gophercloud.Result
8585
}
8686

87-
// Extract is a method that attempts to interpret any Quotaset resource response as a Quotaset struct.
88-
func (r quotaResult) Extract() (*Quotaset, error) {
87+
// Extract is a method that attempts to interpret any QuotaSet resource response as a QuotaSet struct.
88+
func (r quotaResult) Extract() (*QuotaSet, error) {
8989
if r.Err != nil {
9090
return nil, r.Err
9191
}
9292

9393
var res struct {
94-
Quotaset *Quotaset `json:"quota_set" mapstructure:"quota_set"`
94+
QuotaSet *QuotaSet `json:"quota_set" mapstructure:"quota_set"`
9595
}
9696

9797
err := mapstructure.Decode(r.Body, &res)
98-
return res.Quotaset, err
98+
return res.QuotaSet, err
9999
}
100100

101101
// GetResult is the response from a Get operation. Call its Extract method to interpret it
102-
// as a Quotaset.
102+
// as a QuotaSet.
103103
type GetResult struct {
104104
quotaResult
105105
}

0 commit comments

Comments
 (0)