Modifying opts and model structs with stricter types
diff --git a/openstack/networking/v2/networks/requests.go b/openstack/networking/v2/networks/requests.go
index 73b8a1f..4f1037e 100644
--- a/openstack/networking/v2/networks/requests.go
+++ b/openstack/networking/v2/networks/requests.go
@@ -23,7 +23,7 @@
SortDir string
}
-type NetworkOpts struct {
+type networkOpts struct {
AdminStateUp bool
Name string
Shared *bool
@@ -98,7 +98,9 @@
return &n, nil
}
-func Create(c *gophercloud.ServiceClient, opts NetworkOpts) (*NetworkCreateResult, error) {
+type CreateOpts networkOpts
+
+func Create(c *gophercloud.ServiceClient, opts CreateOpts) (*NetworkCreateResult, error) {
// Define structures
type network struct {
AdminStateUp bool `json:"admin_state_up"`
@@ -144,13 +146,14 @@
return res.Network, nil
}
-func Update(c *gophercloud.ServiceClient, networkID string, opts NetworkOpts) (*Network, error) {
+type UpdateOpts networkOpts
+
+func Update(c *gophercloud.ServiceClient, networkID string, opts UpdateOpts) (*Network, error) {
// Define structures
type network struct {
- AdminStateUp bool `json:"admin_state_up"`
- Name string `json:"name"`
- Shared *bool `json:"shared,omitempty"`
- TenantID *string `json:"tenant_id,omitempty"`
+ AdminStateUp bool `json:"admin_state_up"`
+ Name string `json:"name"`
+ Shared *bool `json:"shared,omitempty"`
}
type request struct {
@@ -167,10 +170,6 @@
Shared: opts.Shared,
}}
- if opts.TenantID != "" {
- reqBody.Network.TenantID = &opts.TenantID
- }
-
// Send request to API
var res response
_, err := perigee.Request("PUT", GetURL(c, networkID), perigee.Options{