Skip to content

Commit

Permalink
feat(quotas): delete loadbalancer and networking quotas
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien Pensart committed Aug 9, 2024
1 parent a132703 commit 5fa8f06
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 0 deletions.
8 changes: 8 additions & 0 deletions openstack/loadbalancer/v2/quotas/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,11 @@ func Update(c *gophercloud.ServiceClient, projectID string, opts UpdateOptsBuild
_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)
return
}

func Delete(c *gophercloud.ServiceClient, projectID string) (r DeleteResult) {
resp, err := c.Delete(deleteURL(c, projectID), &gophercloud.RequestOpts{
OkCodes: []int{204},
})
_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)
return
}
5 changes: 5 additions & 0 deletions openstack/loadbalancer/v2/quotas/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ type UpdateResult struct {
commonResult
}

// DeleteResult represents the result of a delete operation.
type DeleteResult struct {
gophercloud.ErrResult
}

// Quota contains load balancer quotas for a project.
type Quota struct {
// Loadbalancer represents the number of load balancers. A "-1" value means no limit.
Expand Down
4 changes: 4 additions & 0 deletions openstack/loadbalancer/v2/quotas/urls.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ func getURL(c *gophercloud.ServiceClient, projectID string) string {
func updateURL(c *gophercloud.ServiceClient, projectID string) string {
return resourceURL(c, projectID)
}

func deleteURL(c *gophercloud.ServiceClient, projectID string) string {
return resourceURL(c, projectID)
}
8 changes: 8 additions & 0 deletions openstack/networking/v2/extensions/quotas/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,11 @@ func Update(c *gophercloud.ServiceClient, projectID string, opts UpdateOptsBuild
_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)
return
}

func Delete(c *gophercloud.ServiceClient, projectID string) (r DeleteResult) {
resp, err := c.Delete(deleteURL(c, projectID), &gophercloud.RequestOpts{
OkCodes: []int{204},
})
_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)
return
}
5 changes: 5 additions & 0 deletions openstack/networking/v2/extensions/quotas/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ type UpdateResult struct {
commonResult
}

// DeleteResult represents the result of a delete operation.
type DeleteResult struct {
gophercloud.ErrResult
}

// Quota contains Networking quotas for a project.
type Quota struct {
// FloatingIP represents a number of floating IPs. A "-1" value means no limit.
Expand Down
4 changes: 4 additions & 0 deletions openstack/networking/v2/extensions/quotas/urls.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ func getDetailURL(c *gophercloud.ServiceClient, projectID string) string {
func updateURL(c *gophercloud.ServiceClient, projectID string) string {
return resourceURL(c, projectID)
}

func deleteURL(c *gophercloud.ServiceClient, projectID string) string {
return resourceURL(c, projectID)
}

0 comments on commit 5fa8f06

Please sign in to comment.