Moving IDs back to strings
diff --git a/openstack/compute/v2/extensions/defsecrules/fixtures.go b/openstack/compute/v2/extensions/defsecrules/fixtures.go
index 9b1480f..c28e492 100644
--- a/openstack/compute/v2/extensions/defsecrules/fixtures.go
+++ b/openstack/compute/v2/extensions/defsecrules/fixtures.go
@@ -3,7 +3,6 @@
import (
"fmt"
"net/http"
- "strconv"
"testing"
th "github.com/rackspace/gophercloud/testhelper"
@@ -25,7 +24,7 @@
"security_group_default_rules": [
{
"from_port": 80,
- "id": 1,
+ "id": "{ruleID}",
"ip_protocol": "TCP",
"ip_range": {
"cidr": "10.10.10.0/24"
@@ -61,7 +60,7 @@
{
"security_group_default_rule": {
"from_port": 80,
- "id": 1,
+ "id": "{ruleID}",
"ip_protocol": "TCP",
"ip_range": {
"cidr": "10.10.12.0/24"
@@ -73,8 +72,8 @@
})
}
-func mockGetRuleResponse(t *testing.T, ruleID int) {
- url := rootPath + "/" + strconv.Itoa(ruleID)
+func mockGetRuleResponse(t *testing.T, ruleID string) {
+ url := rootPath + "/" + ruleID
th.Mux.HandleFunc(url, func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "GET")
th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
@@ -85,7 +84,7 @@
fmt.Fprintf(w, `
{
"security_group_default_rule": {
- "id": 1,
+ "id": "{ruleID}",
"from_port": 80,
"to_port": 80,
"ip_protocol": "TCP",
@@ -98,8 +97,8 @@
})
}
-func mockDeleteRuleResponse(t *testing.T, ruleID int) {
- url := rootPath + "/" + strconv.Itoa(ruleID)
+func mockDeleteRuleResponse(t *testing.T, ruleID string) {
+ url := rootPath + "/" + ruleID
th.Mux.HandleFunc(url, func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "DELETE")
th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
diff --git a/openstack/compute/v2/extensions/defsecrules/requests.go b/openstack/compute/v2/extensions/defsecrules/requests.go
index 702a7a7..7d19741 100644
--- a/openstack/compute/v2/extensions/defsecrules/requests.go
+++ b/openstack/compute/v2/extensions/defsecrules/requests.go
@@ -86,7 +86,7 @@
}
// Get will return details for a particular default rule.
-func Get(client *gophercloud.ServiceClient, id int) GetResult {
+func Get(client *gophercloud.ServiceClient, id string) GetResult {
var result GetResult
_, result.Err = perigee.Request("GET", resourceURL(client, id), perigee.Options{
@@ -99,7 +99,7 @@
}
// Delete will permanently delete a default rule from the project.
-func Delete(client *gophercloud.ServiceClient, id int) gophercloud.ErrResult {
+func Delete(client *gophercloud.ServiceClient, id string) gophercloud.ErrResult {
var result gophercloud.ErrResult
_, result.Err = perigee.Request("DELETE", resourceURL(client, id), perigee.Options{
diff --git a/openstack/compute/v2/extensions/defsecrules/requests_test.go b/openstack/compute/v2/extensions/defsecrules/requests_test.go
index 5f43b34..d4ebe87 100644
--- a/openstack/compute/v2/extensions/defsecrules/requests_test.go
+++ b/openstack/compute/v2/extensions/defsecrules/requests_test.go
@@ -9,7 +9,7 @@
"github.com/rackspace/gophercloud/testhelper/client"
)
-const ruleID = 1
+const ruleID = "{ruleID}"
func TestList(t *testing.T) {
th.SetupHTTP()
diff --git a/openstack/compute/v2/extensions/defsecrules/urls.go b/openstack/compute/v2/extensions/defsecrules/urls.go
index 07244f7..cc928ab 100644
--- a/openstack/compute/v2/extensions/defsecrules/urls.go
+++ b/openstack/compute/v2/extensions/defsecrules/urls.go
@@ -1,15 +1,11 @@
package defsecrules
-import (
- "strconv"
-
- "github.com/rackspace/gophercloud"
-)
+import "github.com/rackspace/gophercloud"
const rulepath = "os-security-group-default-rules"
-func resourceURL(c *gophercloud.ServiceClient, id int) string {
- return c.ServiceURL(rulepath, strconv.Itoa(id))
+func resourceURL(c *gophercloud.ServiceClient, id string) string {
+ return c.ServiceURL(rulepath, id)
}
func rootURL(c *gophercloud.ServiceClient) string {