provider/openstack: gophercloud migration: Refactor existing resources to use 'MapValueSpecs' function
This commit is contained in:
parent
ffd5370213
commit
56cc232956
|
@ -107,7 +107,7 @@ func resourceNetworkingNetworkV2Create(d *schema.ResourceData, meta interface{})
|
|||
createOpts := NetworkCreateOpts{
|
||||
Name: d.Get("name").(string),
|
||||
TenantID: d.Get("tenant_id").(string),
|
||||
ValueSpecs: networkValueSpecs(d),
|
||||
ValueSpecs: MapValueSpecs(d),
|
||||
}
|
||||
|
||||
asuRaw := d.Get("admin_state_up").(string)
|
||||
|
@ -284,11 +284,3 @@ func waitForNetworkDelete(networkingClient *gophercloud.ServiceClient, networkId
|
|||
return n, "ACTIVE", nil
|
||||
}
|
||||
}
|
||||
|
||||
func networkValueSpecs(d *schema.ResourceData) map[string]string {
|
||||
m := make(map[string]string)
|
||||
for key, val := range d.Get("value_specs").(map[string]interface{}) {
|
||||
m[key] = val.(string)
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ func resourceNetworkingRouterV2Create(d *schema.ResourceData, meta interface{})
|
|||
createOpts := RouterCreateOpts{
|
||||
Name: d.Get("name").(string),
|
||||
TenantID: d.Get("tenant_id").(string),
|
||||
ValueSpecs: routerValueSpecs(d),
|
||||
ValueSpecs: MapValueSpecs(d),
|
||||
}
|
||||
|
||||
if asuRaw, ok := d.GetOk("admin_state_up"); ok {
|
||||
|
@ -292,11 +292,3 @@ func waitForRouterDelete(networkingClient *gophercloud.ServiceClient, routerId s
|
|||
return r, "ACTIVE", nil
|
||||
}
|
||||
}
|
||||
|
||||
func routerValueSpecs(d *schema.ResourceData) map[string]string {
|
||||
m := make(map[string]string)
|
||||
for key, val := range d.Get("value_specs").(map[string]interface{}) {
|
||||
m[key] = val.(string)
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ func resourceNetworkingSubnetV2Create(d *schema.ResourceData, meta interface{})
|
|||
HostRoutes: resourceSubnetHostRoutesV2(d),
|
||||
EnableDHCP: nil,
|
||||
},
|
||||
subnetValueSpecs(d),
|
||||
MapValueSpecs(d),
|
||||
}
|
||||
|
||||
if v, ok := d.GetOk("gateway_ip"); ok {
|
||||
|
@ -384,11 +384,3 @@ func waitForSubnetDelete(networkingClient *gophercloud.ServiceClient, subnetId s
|
|||
return s, "ACTIVE", nil
|
||||
}
|
||||
}
|
||||
|
||||
func subnetValueSpecs(d *schema.ResourceData) map[string]string {
|
||||
m := make(map[string]string)
|
||||
for key, val := range d.Get("value_specs").(map[string]interface{}) {
|
||||
m[key] = val.(string)
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue