@@ -467,13 +467,12 @@ type FleetServerHost struct {
467467}
468468
469469type ListFleetServerHostsRequest struct {
470- HostURLs []string `json:"host_urls"`
471- ID string `json:"id"`
472- IsDefault bool `json:"is_default"`
473- IsInternal bool `json:"is_internal"`
474- IsPreconfigured bool `json:"is_preconfigured"`
475- Name string `json:"name"`
476- ProxyID string `json:"proxy_id"`
470+ HostURLs []string `json:"host_urls"`
471+ ID string `json:"id"`
472+ IsDefault bool `json:"is_default"`
473+ IsInternal bool `json:"is_internal"`
474+ Name string `json:"name"`
475+ ProxyID string `json:"proxy_id"`
477476}
478477
479478type ListFleetServerHostsResponse struct {
@@ -519,22 +518,10 @@ func (client *Client) CreateFleetServerHosts(ctx context.Context, req ListFleetS
519518 return FleetServerHostsResponse {}, fmt .Errorf ("error calling new fleet server hosts API: %w" , err )
520519 }
521520 defer resp .Body .Close ()
522- if resp .StatusCode != http .StatusOK {
523- return FleetServerHostsResponse {}, fmt .Errorf ("error creating fleet-server host: unexpected status code: %s" , resp .Status )
524- }
525-
526- body , err := io .ReadAll (resp .Body )
527- if err != nil {
528- return FleetServerHostsResponse {}, fmt .Errorf ("error reading fleet response: %w" , err )
529- }
530521
531522 var fleetResp FleetServerHostsResponse
532- err = json .Unmarshal (body , & fleetResp )
533- if err != nil {
534- return FleetServerHostsResponse {}, fmt .Errorf ("error parsing fleet response: %w" , err )
535- }
536-
537- return fleetResp , nil
523+ err = readJSONResponse (resp , & fleetResp )
524+ return fleetResp , err
538525}
539526
540527type GetFleetServerHostRequest struct {
@@ -664,7 +651,6 @@ type ProxiesRequest struct {
664651 CertificateAuthorities string `json:"certificate_authorities"`
665652 CertificateKey string `json:"certificate_key"`
666653 ID string `json:"id"`
667- IsPreconfigured bool `json:"is_preconfigured"`
668654 Name string `json:"name"`
669655 ProxyHeaders map [string ]string `json:"proxy_headers"`
670656 URL string `json:"url"`
@@ -685,6 +671,10 @@ type ProxiesResponse struct {
685671
686672// CreateFleetProxy creates a new proxy
687673func (client * Client ) CreateFleetProxy (ctx context.Context , req ProxiesRequest ) (ProxiesResponse , error ) {
674+ // if `proxy_headers` is `null` 8.x kibana/Fleet will return a 400 - Bad request
675+ if req .ProxyHeaders == nil {
676+ req .ProxyHeaders = map [string ]string {}
677+ }
688678 bs , err := json .Marshal (req )
689679 if err != nil {
690680 return ProxiesResponse {}, fmt .Errorf ("could not marshal ListFleetServerHostsRequest: %w" , err )
@@ -698,17 +688,10 @@ func (client *Client) CreateFleetProxy(ctx context.Context, req ProxiesRequest)
698688 return ProxiesResponse {}, err
699689 }
700690 defer r .Body .Close ()
701- if r .StatusCode != http .StatusOK {
702- return ProxiesResponse {}, fmt .Errorf ("error creating proxy: unexpected status code: %s" , r .Status )
703- }
704691
705692 resp := ProxiesResponse {}
706693 err = readJSONResponse (r , & resp )
707- if err != nil {
708- return ProxiesResponse {}, fmt .Errorf ("failes parsing response: %w" , err )
709- }
710-
711- return resp , nil
694+ return resp , err
712695}
713696
714697type UninstallTokenResponse struct {
0 commit comments