Skip to content

Commit 3bf899b

Browse files
authored
Add support for API version 7 (#110)
1 parent 43df4f7 commit 3bf899b

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed

README.md

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

1212
## Compatibility
1313

14-
This Client works against versions 4 to 6 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 7 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 |
21+
| 7 | R25 |
2122

2223
## Using the Client
2324

client/nginx.go

Lines changed: 47 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 = 6
19+
APIVersion = 7
2020

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

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

3030
// Default values for servers in Upstreams.
3131
defaultMaxConns = 0
@@ -273,6 +273,7 @@ type StreamZoneSyncStatus struct {
273273

274274
// Responses represents HTTP response related stats.
275275
type Responses struct {
276+
Codes HTTPCodes
276277
Responses1xx uint64 `json:"1xx"`
277278
Responses2xx uint64 `json:"2xx"`
278279
Responses3xx uint64 `json:"3xx"`
@@ -281,6 +282,50 @@ type Responses struct {
281282
Total uint64
282283
}
283284

285+
// HTTPCodes represents HTTP response codes
286+
type HTTPCodes struct {
287+
HTTPContinue uint64 `json:"100,omitempty"`
288+
HTTPSwitchingProtocols uint64 `json:"101,omitempty"`
289+
HTTPProcessing uint64 `json:"102,omitempty"`
290+
HTTPOk uint64 `json:"200,omitempty"`
291+
HTTPCreated uint64 `json:"201,omitempty"`
292+
HTTPAccepted uint64 `json:"202,omitempty"`
293+
HTTPNoContent uint64 `json:"204,omitempty"`
294+
HTTPPartialContent uint64 `json:"206,omitempty"`
295+
HTTPSpecialResponse uint64 `json:"300,omitempty"`
296+
HTTPMovedPermanently uint64 `json:"301,omitempty"`
297+
HTTPMovedTemporarily uint64 `json:"302,omitempty"`
298+
HTTPSeeOther uint64 `json:"303,omitempty"`
299+
HTTPNotModified uint64 `json:"304,omitempty"`
300+
HTTPTemporaryRedirect uint64 `json:"307,omitempty"`
301+
HTTPBadRequest uint64 `json:"400,omitempty"`
302+
HTTPUnauthorized uint64 `json:"401,omitempty"`
303+
HTTPForbidden uint64 `json:"403,omitempty"`
304+
HTTPNotFound uint64 `json:"404,omitempty"`
305+
HTTPNotAllowed uint64 `json:"405,omitempty"`
306+
HTTPRequestTimeOut uint64 `json:"408,omitempty"`
307+
HTTPConflict uint64 `json:"409,omitempty"`
308+
HTTPLengthRequired uint64 `json:"411,omitempty"`
309+
HTTPPreconditionFailed uint64 `json:"412,omitempty"`
310+
HTTPRequestEntityTooLarge uint64 `json:"413,omitempty"`
311+
HTTPRequestURITooLarge uint64 `json:"414,omitempty"`
312+
HTTPUnsupportedMediaType uint64 `json:"415,omitempty"`
313+
HTTPRangeNotSatisfiable uint64 `json:"416,omitempty"`
314+
HTTPTooManyRequests uint64 `json:"429,omitempty"`
315+
HTTPClose uint64 `json:"444,omitempty"`
316+
HTTPRequestHeaderTooLarge uint64 `json:"494,omitempty"`
317+
HTTPSCertError uint64 `json:"495,omitempty"`
318+
HTTPSNoCert uint64 `json:"496,omitempty"`
319+
HTTPToHTTPS uint64 `json:"497,omitempty"`
320+
HTTPClientClosedRequest uint64 `json:"499,omitempty"`
321+
HTTPInternalServerError uint64 `json:"500,omitempty"`
322+
HTTPNotImplemented uint64 `json:"501,omitempty"`
323+
HTTPBadGateway uint64 `json:"502,omitempty"`
324+
HTTPServiceUnavailable uint64 `json:"503,omitempty"`
325+
HTTPGatewayTimeOut uint64 `json:"504,omitempty"`
326+
HTTPInsufficientStorage uint64 `json:"507,omitempty"`
327+
}
328+
284329
// Sessions represents stream session related stats.
285330
type Sessions struct {
286331
Sessions2xx uint64 `json:"2xx"`

0 commit comments

Comments
 (0)