@@ -10,9 +10,9 @@ import (
1010)
1111
1212// APIVersion is a version of NGINX Plus API.
13- const APIVersion = 2
13+ const APIVersion = 4
1414
15- const streamNotConfiguredCode = "StreamNotConfigured "
15+ const pathNotFoundCode = "PathNotFound "
1616
1717const streamContext = true
1818const httpContext = false
@@ -44,16 +44,14 @@ type StreamUpstreamServer struct {
4444}
4545
4646type apiErrorResponse struct {
47- Path string
48- Method string
4947 Error apiError
5048 RequestID string `json:"request_id"`
5149 Href string
5250}
5351
5452func (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 )
5755}
5856
5957type apiError struct {
@@ -792,7 +790,7 @@ func (client *NginxClient) getStreamServerZones() (*StreamServerZones, error) {
792790 err := client .get ("stream/server_zones" , & zones )
793791 if err != nil {
794792 if err , ok := err .(* internalError ); ok {
795- if err .Code == streamNotConfiguredCode {
793+ if err .Code == pathNotFoundCode {
796794 return & zones , nil
797795 }
798796 }
@@ -815,7 +813,7 @@ func (client *NginxClient) getStreamUpstreams() (*StreamUpstreams, error) {
815813 err := client .get ("stream/upstreams" , & upstreams )
816814 if err != nil {
817815 if err , ok := err .(* internalError ); ok {
818- if err .Code == streamNotConfiguredCode {
816+ if err .Code == pathNotFoundCode {
819817 return & upstreams , nil
820818 }
821819 }
0 commit comments