mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-03 23:51:44 +02:00
Merge branch 'master' into fes-support
This commit is contained in:
@@ -32,6 +32,7 @@ type Interface interface {
|
||||
GetMemberData(server *v1.Pod) (MemberData, error)
|
||||
Restart(server *v1.Pod) error
|
||||
GetConfig(server *v1.Pod) (map[string]interface{}, error)
|
||||
SetConfig(server *v1.Pod, config map[string]interface{}) error
|
||||
}
|
||||
|
||||
// Patroni API client
|
||||
@@ -163,6 +164,20 @@ func (p *Patroni) SetPostgresParameters(server *v1.Pod, parameters map[string]st
|
||||
return p.httpPostOrPatch(http.MethodPatch, apiURLString+configPath, buf)
|
||||
}
|
||||
|
||||
//SetConfig sets Patroni options via Patroni patch API call.
|
||||
func (p *Patroni) SetConfig(server *v1.Pod, config map[string]interface{}) error {
|
||||
buf := &bytes.Buffer{}
|
||||
err := json.NewEncoder(buf).Encode(config)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not encode json: %v", err)
|
||||
}
|
||||
apiURLString, err := apiURL(server)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return p.httpPostOrPatch(http.MethodPatch, apiURLString+configPath, buf)
|
||||
}
|
||||
|
||||
// MemberDataPatroni child element
|
||||
type MemberDataPatroni struct {
|
||||
Version string `json:"version"`
|
||||
|
||||
Reference in New Issue
Block a user