Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration of Fleet -> ingest_manager affect the API paths #16314

Merged
merged 1 commit into from
Feb 13, 2020
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
8 changes: 4 additions & 4 deletions x-pack/agent/pkg/agent/application/enroll_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestEnroll(t *testing.T) {
t.Run("fail to save is propagated", withTLSServer(
func(t *testing.T) *http.ServeMux {
mux := http.NewServeMux()
mux.HandleFunc("/api/fleet/agents/enroll", func(w http.ResponseWriter, r *http.Request) {
mux.HandleFunc("/api/ingest_manager/fleet/agents/enroll", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Write([]byte(`
{
Expand Down Expand Up @@ -101,7 +101,7 @@ func TestEnroll(t *testing.T) {
t.Run("successfully enroll with TLS and save access api key in the store", withTLSServer(
func(t *testing.T) *http.ServeMux {
mux := http.NewServeMux()
mux.HandleFunc("/api/fleet/agents/enroll", func(w http.ResponseWriter, r *http.Request) {
mux.HandleFunc("/api/ingest_manager/fleet/agents/enroll", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Write([]byte(`
{
Expand Down Expand Up @@ -163,7 +163,7 @@ func TestEnroll(t *testing.T) {
t.Run("successfully enroll without TLS and save access api key in the store", withServer(
func(t *testing.T) *http.ServeMux {
mux := http.NewServeMux()
mux.HandleFunc("/api/fleet/agents/enroll", func(w http.ResponseWriter, r *http.Request) {
mux.HandleFunc("/api/ingest_manager/fleet/agents/enroll", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Write([]byte(`
{
Expand Down Expand Up @@ -223,7 +223,7 @@ func TestEnroll(t *testing.T) {
t.Run("fail to enroll without TLS", withServer(
func(t *testing.T) *http.ServeMux {
mux := http.NewServeMux()
mux.HandleFunc("/api/fleet/agents/enroll", func(w http.ResponseWriter, r *http.Request) {
mux.HandleFunc("/api/ingest_manager/fleet/agents/enroll", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte(`
{
Expand Down
2 changes: 1 addition & 1 deletion x-pack/agent/pkg/fleetapi/ack_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/elastic/beats/x-pack/agent/pkg/agent/errors"
)

const ackPath = "/api/fleet/agents/%s/acks"
const ackPath = "/api/ingest_manager/fleet/agents/%s/acks"

// AckRequest consists of multiple actions acked to fleet ui.
// POST /agents/{agentId}/acks
Expand Down
2 changes: 1 addition & 1 deletion x-pack/agent/pkg/fleetapi/ack_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestAck(t *testing.T) {
}
`
mux := http.NewServeMux()
path := fmt.Sprintf("/api/fleet/agents/%s/acks", agentInfo.AgentID())
path := fmt.Sprintf("/api/ingest_manager/fleet/agents/%s/acks", agentInfo.AgentID())
mux.HandleFunc(path, authHandler(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)

Expand Down
2 changes: 1 addition & 1 deletion x-pack/agent/pkg/fleetapi/checkin_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/elastic/beats/x-pack/agent/pkg/agent/errors"
)

const checkingPath = "/api/fleet/agents/%s/checkin"
const checkingPath = "/api/ingest_manager/fleet/agents/%s/checkin"

// CheckinRequest consists of multiple events reported to fleet ui.
type CheckinRequest struct {
Expand Down
12 changes: 6 additions & 6 deletions x-pack/agent/pkg/fleetapi/checkin_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Something went wrong
}
`
mux := http.NewServeMux()
path := fmt.Sprintf("/api/fleet/agents/%s/checkin", agentInfo.AgentID())
path := fmt.Sprintf("/api/ingest_manager/fleet/agents/%s/checkin", agentInfo.AgentID())
mux.HandleFunc(path, authHandler(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusInternalServerError)
fmt.Fprintf(w, raw)
Expand Down Expand Up @@ -83,7 +83,7 @@ Something went wrong
}
`
mux := http.NewServeMux()
path := fmt.Sprintf("/api/fleet/agents/%s/checkin", agentInfo.AgentID())
path := fmt.Sprintf("/api/ingest_manager/fleet/agents/%s/checkin", agentInfo.AgentID())
mux.HandleFunc(path, authHandler(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, raw)
Expand Down Expand Up @@ -145,7 +145,7 @@ Something went wrong
}
`
mux := http.NewServeMux()
path := fmt.Sprintf("/api/fleet/agents/%s/checkin", agentInfo.AgentID())
path := fmt.Sprintf("/api/ingest_manager/fleet/agents/%s/checkin", agentInfo.AgentID())
mux.HandleFunc(path, authHandler(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, raw)
Expand Down Expand Up @@ -183,7 +183,7 @@ Something went wrong
}
`
mux := http.NewServeMux()
path := fmt.Sprintf("/api/fleet/agents/%s/checkin", agentInfo.AgentID())
path := fmt.Sprintf("/api/ingest_manager/fleet/agents/%s/checkin", agentInfo.AgentID())
mux.HandleFunc(path, authHandler(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, raw)
Expand Down Expand Up @@ -212,7 +212,7 @@ Something went wrong
}
`
mux := http.NewServeMux()
path := fmt.Sprintf("/api/fleet/agents/%s/checkin", agentInfo.AgentID())
path := fmt.Sprintf("/api/ingest_manager/fleet/agents/%s/checkin", agentInfo.AgentID())
mux.HandleFunc(path, authHandler(func(w http.ResponseWriter, r *http.Request) {
type Request struct {
Metadata map[string]interface{} `json:"local_metadata"`
Expand Down Expand Up @@ -262,7 +262,7 @@ Something went wrong
}
`
mux := http.NewServeMux()
path := fmt.Sprintf("/api/fleet/agents/%s/checkin", agentInfo.AgentID())
path := fmt.Sprintf("/api/ingest_manager/fleet/agents/%s/checkin", agentInfo.AgentID())
mux.HandleFunc(path, authHandler(func(w http.ResponseWriter, r *http.Request) {
req := make(map[string]interface{})

Expand Down
4 changes: 2 additions & 2 deletions x-pack/agent/pkg/fleetapi/enroll_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (p EnrollType) MarshalJSON() ([]byte, error) {
// EnrollRequest is the data required to enroll the agent into Fleet.
//
// Example:
// POST /api/fleet/agents/enroll
// POST /api/ingest_manager/fleet/agents/enroll
// {
// "type": "PERMANENT",
// "metadata": {
Expand Down Expand Up @@ -166,7 +166,7 @@ type EnrollCmd struct {

// Execute enroll the Agent in the Fleet.
func (e *EnrollCmd) Execute(ctx context.Context, r *EnrollRequest) (*EnrollResponse, error) {
const p = "/api/fleet/agents/enroll"
const p = "/api/ingest_manager/fleet/agents/enroll"
const key = "Authorization"
const prefix = "ApiKey "

Expand Down
4 changes: 2 additions & 2 deletions x-pack/agent/pkg/fleetapi/enroll_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestEnroll(t *testing.T) {
t.Run("Successful enroll", withServer(
func(t *testing.T) *http.ServeMux {
mux := http.NewServeMux()
mux.HandleFunc("/api/fleet/agents/enroll", func(w http.ResponseWriter, r *http.Request) {
mux.HandleFunc("/api/ingest_manager/fleet/agents/enroll", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Header().Set("Content-Type", "application/json")

Expand Down Expand Up @@ -97,7 +97,7 @@ func TestEnroll(t *testing.T) {
t.Run("Raise back any server errors", withServer(
func(t *testing.T) *http.ServeMux {
mux := http.NewServeMux()
mux.HandleFunc("/api/fleet/agents/enroll", func(w http.ResponseWriter, r *http.Request) {
mux.HandleFunc("/api/ingest_manager/fleet/agents/enroll", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusInternalServerError)
w.Header().Set("Content-Type", "application/json")
w.Write([]byte(`{"statusCode": 500, "error":"Something is really bad here"}`))
Expand Down