nginx/nginx-plus-go-client

Add backup to UpstreamServer

Closed this issue · 1 comments

Is your feature request related to a problem? Please describe.
Feature

Describe the solution you'd like
I would like the backup struct member added to UpstreamServer. The current API call returns backup as part of its response.

curl 'http://localhost:8080/api/4/http/upstreams'
.....
{"application-":{"peers":[{"id":2,"server":"1.2.3.4:8443","name":"1.2.3.4:8443","backup":false,"weight":1,"state":"up","active":0,"requests":0,"responses":{"1xx":0,"2xx":0,"3xx":0,"4xx":0,"5xx":0,"total":0},"sent":0,"received":0,"fails":0,"unavail":0,"health_checks":{"checks":95,"fails":0,"unhealthy":0,"last_passed":true},"downtime":0},{"id":4,"server":"4.3.2.1:8443","name":"4.3.2.1:8443","backup":false,"weight":1,"state":"up","active":0,"requests":0,"responses":{"1xx":0,"2xx":0,"3xx":0,"4xx":0,"5xx":0,"total":0},"sent":0,"received":0,"fails":0,"unavail":0,"health_checks":{"checks":94,"fails":0,"unhealthy":0,"last_passed":true},"downtime":0}],"keepalive":0,"zombies":0,"zone":"application"}
....

type UpstreamServer struct {
	ID          int    `json:"id,omitempty"`
	Server      string `json:"server"`
	MaxConns    int    `json:"max_conns"`
	MaxFails    int    `json:"max_fails"`
	FailTimeout string `json:"fail_timeout,omitempty"`
	SlowStart   string `json:"slow_start,omitempty"`
        Backup  <type here>
}

@jrmercier1
thanks for the feature request! it makes sense. We can add it shortly