Skip to content

Commit 4b5f03e

Browse files
author
Michael Weibel
committed
refactor: rename interface -> serverInterface
1 parent 0021bdd commit 4b5f03e

3 files changed

Lines changed: 36 additions & 36 deletions

File tree

‎servers.go‎

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type Server struct {
2424
Flavor FlavorStub `json:"flavor"`
2525
Image ImageServerStub `json:"image"`
2626
Volumes []VolumeStub `json:"volumes"`
27-
Interfaces []Interface `json:"interfaces"`
27+
Interfaces []ServerInterface `json:"interfaces"`
2828
SSHFingerprints []string `json:"ssh_fingerprints"`
2929
SSHHostKeys []string `json:"ssh_host_keys"`
3030
AntiAfinityWith []ServerStub `json:"anti_affinity_with"`
@@ -65,13 +65,13 @@ type VolumeStub struct {
6565
SizeGB int `json:"size_gb"`
6666
}
6767

68-
type Interface struct {
69-
Type string `json:"type,omitempty"`
70-
Network NetworkStub `json:"network,omitempty"`
71-
Addresses []Address `json:"addresses,omitempty"`
68+
type ServerInterface struct {
69+
Type string `json:"type,omitempty"`
70+
Network NetworkStub `json:"network,omitempty"`
71+
Addresses []ServerAddress `json:"addresses,omitempty"`
7272
}
7373

74-
type Address struct {
74+
type ServerAddress struct {
7575
Version int `json:"version"`
7676
Address string `json:"address"`
7777
PrefixLength int `json:"prefix_length"`
@@ -83,38 +83,38 @@ type Address struct {
8383
type ServerRequest struct {
8484
ZonalResourceRequest
8585
TaggedResourceRequest
86-
Name string `json:"name"`
87-
Flavor string `json:"flavor"`
88-
Image string `json:"image"`
89-
Zone string `json:"zone,omitempty"`
90-
VolumeSizeGB int `json:"volume_size_gb,omitempty"`
91-
Volumes *[]ServerVolumeRequest `json:"volumes,omitempty"`
92-
Interfaces *[]InterfaceRequest `json:"interfaces,omitempty"`
93-
BulkVolumeSizeGB int `json:"bulk_volume_size_gb,omitempty"`
94-
SSHKeys []string `json:"ssh_keys"`
95-
Password string `json:"password,omitempty"`
96-
UsePublicNetwork *bool `json:"use_public_network,omitempty"`
97-
UsePrivateNetwork *bool `json:"use_private_network,omitempty"`
98-
UseIPV6 *bool `json:"use_ipv6,omitempty"`
99-
AntiAffinityWith string `json:"anti_affinity_with,omitempty"`
100-
ServerGroups []string `json:"server_groups,omitempty"`
101-
UserData string `json:"user_data,omitempty"`
86+
Name string `json:"name"`
87+
Flavor string `json:"flavor"`
88+
Image string `json:"image"`
89+
Zone string `json:"zone,omitempty"`
90+
VolumeSizeGB int `json:"volume_size_gb,omitempty"`
91+
Volumes *[]ServerVolumeRequest `json:"volumes,omitempty"`
92+
Interfaces *[]ServerInterfaceRequest `json:"interfaces,omitempty"`
93+
BulkVolumeSizeGB int `json:"bulk_volume_size_gb,omitempty"`
94+
SSHKeys []string `json:"ssh_keys"`
95+
Password string `json:"password,omitempty"`
96+
UsePublicNetwork *bool `json:"use_public_network,omitempty"`
97+
UsePrivateNetwork *bool `json:"use_private_network,omitempty"`
98+
UseIPV6 *bool `json:"use_ipv6,omitempty"`
99+
AntiAffinityWith string `json:"anti_affinity_with,omitempty"`
100+
ServerGroups []string `json:"server_groups,omitempty"`
101+
UserData string `json:"user_data,omitempty"`
102102
}
103103

104104
type ServerUpdateRequest struct {
105105
TaggedResourceRequest
106-
Name string `json:"name,omitempty"`
107-
Status string `json:"status,omitempty"`
108-
Flavor string `json:"flavor,omitempty"`
109-
Interfaces *[]InterfaceRequest `json:"interfaces,omitempty"`
106+
Name string `json:"name,omitempty"`
107+
Status string `json:"status,omitempty"`
108+
Flavor string `json:"flavor,omitempty"`
109+
Interfaces *[]ServerInterfaceRequest `json:"interfaces,omitempty"`
110110
}
111111

112112
type ServerVolumeRequest struct {
113113
SizeGB int `json:"size_gb,omitempty"`
114114
Type string `json:"type,omitempty"`
115115
}
116116

117-
type InterfaceRequest struct {
117+
type ServerInterfaceRequest struct {
118118
Network string `json:"network,omitempty"`
119119
Addresses *[]AddressRequest `json:"addresses,omitempty"`
120120
}

‎test/integration/load_balancer_pool_members_integration_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ func TestIntegrationLoadBalancerPoolMember_MonitorStatus(t *testing.T) {
214214

215215
// Step 2: Create a server on the private network
216216
serverRequest := getDefaultServerRequest()
217-
serverRequest.Interfaces = &[]cloudscale.InterfaceRequest{{Network: network.UUID}}
217+
serverRequest.Interfaces = &[]cloudscale.ServerInterfaceRequest{{Network: network.UUID}}
218218
serverRequest.SSHKeys = []string{}
219219
serverRequest.Password = randomNotVerySecurePassword(10)
220220

‎test/integration/networks_integration_test.go‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,16 @@ func TestIntegrationNetwork_CreateAttached(t *testing.T) {
112112

113113
cases := []struct {
114114
name string
115-
in *[]cloudscale.InterfaceRequest
115+
in *[]cloudscale.ServerInterfaceRequest
116116
expectedNumNetworks int
117117
expectedIP string
118118
}{
119-
{"Attach by network UUID", &[]cloudscale.InterfaceRequest{
119+
{"Attach by network UUID", &[]cloudscale.ServerInterfaceRequest{
120120
{
121121
Network: network.UUID,
122122
},
123123
}, 1, `192\.168\.42\.[0-9]*`},
124-
{"Attach by subnet UUID", &[]cloudscale.InterfaceRequest{
124+
{"Attach by subnet UUID", &[]cloudscale.ServerInterfaceRequest{
125125
{
126126
Addresses: &[]cloudscale.AddressRequest{
127127
{
@@ -130,7 +130,7 @@ func TestIntegrationNetwork_CreateAttached(t *testing.T) {
130130
},
131131
},
132132
}, 1, `192\.168\.42\.[0-9]*`},
133-
{"Attach by subnet UUID with predefined IP", &[]cloudscale.InterfaceRequest{
133+
{"Attach by subnet UUID with predefined IP", &[]cloudscale.ServerInterfaceRequest{
134134
{
135135
Addresses: &[]cloudscale.AddressRequest{
136136
{
@@ -140,7 +140,7 @@ func TestIntegrationNetwork_CreateAttached(t *testing.T) {
140140
},
141141
},
142142
}, 1, `192\.168\.42\.242`},
143-
{"Attach by network UUID without IP (Layer 2)", &[]cloudscale.InterfaceRequest{
143+
{"Attach by network UUID without IP (Layer 2)", &[]cloudscale.ServerInterfaceRequest{
144144
{
145145
Network: "public",
146146
},
@@ -233,7 +233,7 @@ func TestIntegrationNetwork_Reattach(t *testing.T) {
233233
t.Fatalf("Subnets.Create returned error %s\n", err)
234234
}
235235

236-
interfaces := []cloudscale.InterfaceRequest{
236+
interfaces := []cloudscale.ServerInterfaceRequest{
237237
{Network: "public"},
238238
}
239239
createServerRequest := &cloudscale.ServerRequest{
@@ -268,7 +268,7 @@ func TestIntegrationNetwork_Reattach(t *testing.T) {
268268
Subnet: subnet.UUID,
269269
Address: "192.168.77.77",
270270
}}
271-
interfaces = append(interfaces, cloudscale.InterfaceRequest{
271+
interfaces = append(interfaces, cloudscale.ServerInterfaceRequest{
272272
Addresses: &addresses,
273273
})
274274
updateRequest := cloudscale.ServerUpdateRequest{
@@ -323,7 +323,7 @@ func TestIntegrationNetwork_Reorder(t *testing.T) {
323323
t.Fatalf("Subnets.Create returned error %s\n", err)
324324
}
325325

326-
interfaces := []cloudscale.InterfaceRequest{
326+
interfaces := []cloudscale.ServerInterfaceRequest{
327327
{Network: "public"},
328328
{Network: network.UUID},
329329
}

0 commit comments

Comments
 (0)