Skip to content

Commit b63d2fd

Browse files
stonejtopjian
authored andcommitted
availability_zone_hints for network(s) (#662)
* availability_zone_hints for network(s) * Add missing commit for field AvailabilityZoneHints
1 parent 157d751 commit b63d2fd

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

openstack/networking/v2/networks/requests.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ type CreateOptsBuilder interface {
6666

6767
// CreateOpts represents options used to create a network.
6868
type CreateOpts struct {
69-
AdminStateUp *bool `json:"admin_state_up,omitempty"`
70-
Name string `json:"name,omitempty"`
71-
Shared *bool `json:"shared,omitempty"`
72-
TenantID string `json:"tenant_id,omitempty"`
69+
AdminStateUp *bool `json:"admin_state_up,omitempty"`
70+
Name string `json:"name,omitempty"`
71+
Shared *bool `json:"shared,omitempty"`
72+
TenantID string `json:"tenant_id,omitempty"`
73+
AvailabilityZoneHints []string `json:"availability_zone_hints,omitempty"`
7374
}
7475

7576
// ToNetworkCreateMap builds a request body from CreateOpts.

openstack/networking/v2/networks/results.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ type Network struct {
6969

7070
// Specifies whether the network resource can be accessed by any tenant.
7171
Shared bool `json:"shared"`
72+
73+
// Availability zone hints groups network nodes that run services like DHCP, L3, FW, and others.
74+
// Used to make network resources highly available.
75+
AvailabilityZoneHints []string `json:"availability_zone_hints"`
7276
}
7377

7478
// NetworkPage is the page returned by a pager when traversing over a

openstack/networking/v2/networks/testing/fixtures.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ const CreateOptionalFieldsRequest = `
9292
"name": "public",
9393
"admin_state_up": true,
9494
"shared": true,
95-
"tenant_id": "12345"
95+
"tenant_id": "12345",
96+
"availability_zone_hints": ["zone1", "zone2"]
9697
}
9798
}`
9899

openstack/networking/v2/networks/testing/requests_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,13 @@ func TestCreateWithOptionalFields(t *testing.T) {
166166
})
167167

168168
iTrue := true
169-
options := networks.CreateOpts{Name: "public", AdminStateUp: &iTrue, Shared: &iTrue, TenantID: "12345"}
169+
options := networks.CreateOpts{
170+
Name: "public",
171+
AdminStateUp: &iTrue,
172+
Shared: &iTrue,
173+
TenantID: "12345",
174+
AvailabilityZoneHints: []string{"zone1", "zone2"},
175+
}
170176
_, err := networks.Create(fake.ServiceClient(), options).Extract()
171177
th.AssertNoErr(t, err)
172178
}

0 commit comments

Comments
 (0)