@@ -10,9 +10,9 @@ import (
10
10
)
11
11
12
12
// APIVersion is a version of NGINX Plus API.
13
- const APIVersion = 2
13
+ const APIVersion = 4
14
14
15
- const streamNotConfiguredCode = "StreamNotConfigured "
15
+ const pathNotFoundCode = "PathNotFound "
16
16
17
17
const streamContext = true
18
18
const httpContext = false
@@ -44,16 +44,14 @@ type StreamUpstreamServer struct {
44
44
}
45
45
46
46
type apiErrorResponse struct {
47
- Path string
48
- Method string
49
47
Error apiError
50
48
RequestID string `json:"request_id"`
51
49
Href string
52
50
}
53
51
54
52
func (resp * apiErrorResponse ) toString () string {
55
- return fmt .Sprintf ("path=%v; method=%v; error.status=%v; error.text=%v; error.code=%v; request_id=%v; href=%v" ,
56
- resp .Path , resp . Method , resp . Error .Status , resp .Error .Text , resp .Error .Code , resp .RequestID , resp .Href )
53
+ return fmt .Sprintf ("error.status=%v; error.text=%v; error.code=%v; request_id=%v; href=%v" ,
54
+ resp .Error .Status , resp .Error .Text , resp .Error .Code , resp .RequestID , resp .Href )
57
55
}
58
56
59
57
type apiError struct {
@@ -792,7 +790,7 @@ func (client *NginxClient) getStreamServerZones() (*StreamServerZones, error) {
792
790
err := client .get ("stream/server_zones" , & zones )
793
791
if err != nil {
794
792
if err , ok := err .(* internalError ); ok {
795
- if err .Code == streamNotConfiguredCode {
793
+ if err .Code == pathNotFoundCode {
796
794
return & zones , nil
797
795
}
798
796
}
@@ -815,7 +813,7 @@ func (client *NginxClient) getStreamUpstreams() (*StreamUpstreams, error) {
815
813
err := client .get ("stream/upstreams" , & upstreams )
816
814
if err != nil {
817
815
if err , ok := err .(* internalError ); ok {
818
- if err .Code == streamNotConfiguredCode {
816
+ if err .Code == pathNotFoundCode {
819
817
return & upstreams , nil
820
818
}
821
819
}
0 commit comments