Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions kibana/fleet.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
return r, fmt.Errorf("unable to marshal create policy request into JSON: %w", err)
}

resp, err := client.Connection.SendWithContext(ctx, http.MethodPost, fleetAgentPoliciesAPI, nil, nil, bytes.NewReader(reqBody))

Check failure on line 135 in kibana/fleet.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

QF1008: could remove embedded field "Connection" from selector (staticcheck)
if err != nil {
return r, fmt.Errorf("error calling create policy API: %w", err)
}
Expand Down Expand Up @@ -166,7 +166,7 @@
fmt.Errorf("unable to marshal DownloadSource into JSON: %w", err)
}

resp, err := client.Connection.SendWithContext(

Check failure on line 169 in kibana/fleet.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

QF1008: could remove embedded field "Connection" from selector (staticcheck)
ctx,
http.MethodPost,
fleetAgentDownloadSourcesAPI,
Expand Down Expand Up @@ -207,7 +207,7 @@
// GetPolicy returns the policy with 'policy_id' id.
func (client *Client) GetPolicy(ctx context.Context, id string) (r PolicyResponse, err error) {
apiURL := fmt.Sprintf(fleetAgentPolicyAPI, id)
resp, err := client.Connection.SendWithContext(ctx, http.MethodGet, apiURL, nil, nil, nil)

Check failure on line 210 in kibana/fleet.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

QF1008: could remove embedded field "Connection" from selector (staticcheck)
if err != nil {
return r, fmt.Errorf("error calling get policy API: %w", err)
}
Expand All @@ -225,7 +225,7 @@
}

apiURL := fmt.Sprintf(fleetAgentPolicyAPI, id)
resp, err := client.Connection.SendWithContext(ctx, http.MethodPut, apiURL, nil, nil, bytes.NewReader(reqBody))

Check failure on line 228 in kibana/fleet.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

QF1008: could remove embedded field "Connection" from selector (staticcheck)
if err != nil {
return r, fmt.Errorf("error calling update policy API: %w", err)
}
Expand All @@ -248,7 +248,7 @@
return fmt.Errorf("unable to marshal delete policy request into JSON: %w", err)
}

resp, err := client.Connection.SendWithContext(ctx, http.MethodPost, fleetAgentsDeleteAPI, nil, nil, bytes.NewReader(reqBody))

Check failure on line 251 in kibana/fleet.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

QF1008: could remove embedded field "Connection" from selector (staticcheck)
if err != nil {
return fmt.Errorf("error calling delete policy API: %w", err)
}
Expand Down Expand Up @@ -290,7 +290,7 @@
return r, fmt.Errorf("unable to marshal create enrollment API key request into JSON: %w", err)
}

resp, err := client.Connection.SendWithContext(ctx, http.MethodPost, fleetEnrollmentAPIKeysAPI, nil, nil, bytes.NewReader(reqBody))

Check failure on line 293 in kibana/fleet.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

QF1008: could remove embedded field "Connection" from selector (staticcheck)
if err != nil {
return r, fmt.Errorf("error calling create enrollment API key API: %w", err)
}
Expand Down Expand Up @@ -321,6 +321,11 @@
Host struct {
Hostname string `json:"hostname"`
} `json:"host"`
Elastic struct {
Agent struct {
FIPS bool `json:"fips"`
} `json:"agent"`
} `json:"elastic"`
} `json:"local_metadata"`
PolicyID string `json:"policy_id"`
PolicyRevision int `json:"policy_revision"`
Expand Down Expand Up @@ -355,7 +360,7 @@

// ListAgents returns a list of agents known to Kibana
func (client *Client) ListAgents(ctx context.Context, _ ListAgentsRequest) (r ListAgentsResponse, err error) {
resp, err := client.Connection.SendWithContext(ctx, http.MethodGet, fleetAgentsAPI, nil, nil, nil)

Check failure on line 363 in kibana/fleet.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

QF1008: could remove embedded field "Connection" from selector (staticcheck)
if err != nil {
return r, fmt.Errorf("error calling list agents API: %w", err)
}
Expand All @@ -375,7 +380,7 @@
func (client *Client) GetAgent(ctx context.Context, request GetAgentRequest) (r GetAgentResponse, err error) {
apiURL := fmt.Sprintf(fleetAgentAPI, request.ID)

resp, err := client.Connection.SendWithContext(ctx, http.MethodGet, apiURL, nil, nil, nil)

Check failure on line 383 in kibana/fleet.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

QF1008: could remove embedded field "Connection" from selector (staticcheck)
if err != nil {
return r, fmt.Errorf("error calling get agent API: %w", err)
}
Expand Down Expand Up @@ -411,7 +416,7 @@
}
apiURL := fmt.Sprintf(fleetUnEnrollAgentAPI, request.ID)

resp, err := client.Connection.SendWithContext(ctx, http.MethodPost, apiURL, nil, nil, bytes.NewReader(reqBody))

Check failure on line 419 in kibana/fleet.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

QF1008: could remove embedded field "Connection" from selector (staticcheck)
if err != nil {
return r, fmt.Errorf("error calling unenroll agent API: %w", err)
}
Expand Down Expand Up @@ -440,7 +445,7 @@
}

apiURL := fmt.Sprintf(fleetUpgradeAgentAPI, request.ID)
resp, err := client.Connection.SendWithContext(ctx, http.MethodPost, apiURL, nil, nil, bytes.NewReader(reqBody))

Check failure on line 448 in kibana/fleet.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

QF1008: could remove embedded field "Connection" from selector (staticcheck)
if err != nil {
return r, fmt.Errorf("error calling upgrade agent API: %w", err)
}
Expand Down
1 change: 1 addition & 0 deletions kibana/fleet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ func TestFleetListAgents(t *testing.T) {
require.Equal(t, "eba58282-ec1c-4d9e-aac0-2b29f754b437", item.Agent.ID)
require.Equal(t, "8.8.0", item.Agent.Version)
require.Equal(t, "c75d66b1dac5", item.LocalMetadata.Host.Hostname)
require.Equal(t, true, item.LocalMetadata.Elastic.Agent.FIPS)
}

func TestFleetGetAgent(t *testing.T) {
Expand Down
6 changes: 4 additions & 2 deletions kibana/testdata/fleet_list_agents_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"log_level": "info",
"snapshot": false,
"upgradeable": false,
"version": "8.8.0"
"version": "8.8.0",
"fips": true
}
},
"host": {
Expand Down Expand Up @@ -134,7 +135,8 @@
"log_level": "info",
"snapshot": false,
"upgradeable": false,
"version": "8.8.0"
"version": "8.8.0",
"fips": true
}
},
"host": {
Expand Down
Loading