Skip to content

Commit 714e4e7

Browse files
authored
Add support for API version 8 (#112)
1 parent 3bf899b commit 714e4e7

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ This project includes a client library for working with NGINX Plus API.
1111

1212
## Compatibility
1313

14-
This Client works against versions 4 to 7 of the NGINX Plus API. The table below shows the version of NGINX Plus where the API was first introduced.
14+
This Client works against versions 4 to 8 of the NGINX Plus API. The table below shows the version of NGINX Plus where the API was first introduced.
1515

1616
| API version | NGINX Plus version |
1717
|-------------|--------------------|
1818
| 4 | R18 |
1919
| 5 | R19 |
2020
| 6 | R20 |
2121
| 7 | R25 |
22+
| 8 | R27 |
2223

2324
## Using the Client
2425

client/nginx.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
const (
1818
// APIVersion is the default version of NGINX Plus API supported by the client.
19-
APIVersion = 7
19+
APIVersion = 8
2020

2121
pathNotFoundCode = "PathNotFound"
2222
streamContext = true
@@ -25,7 +25,7 @@ const (
2525
)
2626

2727
var (
28-
supportedAPIVersions = versions{4, 5, 6, 7}
28+
supportedAPIVersions = versions{4, 5, 6, 7, 8}
2929

3030
// Default values for servers in Upstreams.
3131
defaultMaxConns = 0
@@ -235,6 +235,7 @@ type ServerZone struct {
235235
Discarded uint64
236236
Received uint64
237237
Sent uint64
238+
SSL SSL
238239
}
239240

240241
// StreamServerZones is map of stream server zone stats by zone name.
@@ -248,6 +249,7 @@ type StreamServerZone struct {
248249
Discarded uint64
249250
Received uint64
250251
Sent uint64
252+
SSL SSL
251253
}
252254

253255
// StreamZoneSync represents the sync information per each shared memory zone and the sync information per node in a cluster
@@ -373,6 +375,7 @@ type Peer struct {
373375
Weight int
374376
State string
375377
Active uint64
378+
SSL SSL
376379
MaxConns int `json:"max_conns"`
377380
Requests uint64
378381
Responses Responses
@@ -398,6 +401,7 @@ type StreamPeer struct {
398401
Weight int
399402
State string
400403
Active uint64
404+
SSL SSL
401405
MaxConns int `json:"max_conns"`
402406
Connections uint64
403407
ConnectTime int `json:"connect_time"`

tests/client_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,10 +657,13 @@ func TestStats(t *testing.T) {
657657
if val.Requests < 1 {
658658
t.Errorf("ServerZone stats missing: %v", val)
659659
}
660+
if val.Responses.Codes.HTTPOk < 1 {
661+
t.Errorf("ServerZone response codes missing: %v", val.Responses.Codes)
662+
}
660663
} else {
661664
t.Errorf("ServerZone 'test' not found")
662665
}
663-
if ups, ok := stats.Upstreams["test"]; ok {
666+
if ups, ok := stats.Upstreams[upstream]; ok {
664667
if len(ups.Peers) < 1 {
665668
t.Errorf("upstream server not visible in stats")
666669
} else {

0 commit comments

Comments
 (0)