Skip to content

Commit

Permalink
Remove support for Endpoints (#513)
Browse files Browse the repository at this point in the history
* Endpoints are not longer supported
Remove all references to endpoints in the CLI.
  • Loading branch information
lyuboxa authored Oct 31, 2022
1 parent 815ffff commit 4569c4a
Show file tree
Hide file tree
Showing 37 changed files with 23 additions and 1,760 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ GIT_UNTRACKED = $(shell git diff-index --quiet HEAD -- || echo "(updated)")
LDFLAGS += -X main.GitUntracked=${GIT_UNTRACKED}
GIT_TAG = $(shell git describe)
LDFLAGS += -X main.GitLatestTag=${GIT_TAG}
REBUILD_DOCS ?= "true"
REBUILD_DOCS ?= true

.PHONY: build
build: docs
Expand All @@ -24,7 +24,7 @@ test:
go test -v ${GO_TEST_FLAGS} -count=1 -timeout 5m ./...

.PHONY: docs
ifeq ($(REBUILD_DOCS), "true")
ifeq ($(REBUILD_DOCS), true)
docs:
rm -rf docs/cmd && mkdir -p docs/cmd/{md,www}
rm -rf etc && mkdir -p etc/man/man1 && mkdir -p etc/completion
Expand Down
4 changes: 2 additions & 2 deletions cmd/meroxa/root/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ func (a *API) Docs() builder.Docs {
return builder.Docs{
Short: "Invoke Meroxa API",
Example: `
meroxa api GET /v1/endpoints
meroxa api POST /v1/endpoints '{"protocol": "HTTP", "stream": "resource-2-499379-public.accounts", "name": "1234"}'`,
meroxa api GET /v1/resources
meroxa api POST /v1/resources '{"type":"postgres", "name":"pg", "url":"postgres://.."}'`,
}
}

Expand Down
22 changes: 12 additions & 10 deletions cmd/meroxa/root/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,27 @@ func TestDescribeAPIArgs(t *testing.T) {
err: errors.New("requires METHOD and PATH"),
},
{
args: []string{"GET", "/v1/endpoints"},
args: []string{"GET", "/v1/resources"},
err: nil,
method: "GET",
path: "/v1/endpoints",
path: "/v1/resources",
},
{
args: []string{"get", "/v1/endpoints"}, // lowercase
args: []string{"get", "/v1/resources"}, // lowercase
err: nil,
method: "GET",
path: "/v1/endpoints",
path: "/v1/resources",
},
{
args: []string{
"POST",
"/v1/endpoints",
"'{\"protocol\": \"HTTP\", \"stream\": \"resource-2-499379-public.accounts\", \"name\": \"1234\"}'"},
"/v1/resources",
`'{"type":"postgres", "name":"pg", "url":"postgres://u:[email protected]:5432/db"}'`,
},
err: nil,
method: "POST",
path: "/v1/endpoints",
body: "'{\"protocol\": \"HTTP\", \"stream\": \"resource-2-499379-public.accounts\", \"name\": \"1234\"}'",
path: "/v1/resources",
body: `'{"type":"postgres", "name":"pg", "url":"postgres://u:[email protected]:5432/db"}'`,
},
}

Expand Down Expand Up @@ -107,6 +108,7 @@ func TestAPIExecution(t *testing.T) {
var httpResponse = &http.Response{
Status: "200 OK",
StatusCode: 200,
Proto: "HTTP/1.1",
Body: io.NopCloser(bytes.NewReader([]byte(bodyResponse))),
}

Expand All @@ -133,9 +135,9 @@ func TestAPIExecution(t *testing.T) {

gotLeveledOutput := logger.LeveledOutput()
wantLeveledOutput := fmt.Sprintf(`> %s %s
< %s
< %s %s
%s
`, a.args.Method, a.args.Path, httpResponse.Status, expectedBody)
`, a.args.Method, a.args.Path, httpResponse.Status, httpResponse.Proto, expectedBody)

if gotLeveledOutput != wantLeveledOutput {
t.Fatalf("expected output:\n%s\ngot:\n%s", wantLeveledOutput, gotLeveledOutput)
Expand Down
103 changes: 0 additions & 103 deletions cmd/meroxa/root/endpoints/create.go

This file was deleted.

126 changes: 0 additions & 126 deletions cmd/meroxa/root/endpoints/create_test.go

This file was deleted.

Loading

0 comments on commit 4569c4a

Please sign in to comment.