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

use v2 api only #359

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions axiom/client_export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestClient_Manual(t *testing.T) {
test: "test",
}

path, err := axiom.AddURLOptions("/v1/test", opts)
path, err := axiom.AddURLOptions("/v2/test", opts)
require.NoError(t, err)

req, err := client.NewRequest(context.Background(), http.MethodGet, path, nil)
Expand Down Expand Up @@ -67,7 +67,7 @@ func TestClient_Call(t *testing.T) {
test: "test",
}

path, err := axiom.AddURLOptions("/v1/test", opts)
path, err := axiom.AddURLOptions("/v2/test", opts)
require.NoError(t, err)

err = client.Call(context.Background(), http.MethodGet, path, nil, nil)
Expand Down
4 changes: 2 additions & 2 deletions axiom/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,8 @@ func TestClient_do_ValidOnlyAPITokenPaths(t *testing.T) {
hf := func(http.ResponseWriter, *http.Request) {}

tests := []string{
"/v1/datasets/test/query",
"/v1/datasets/_apl",
"/v2/datasets/test/query",
"/v2/datasets/_apl",
}
for _, tt := range tests {
t.Run(tt, func(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions axiom/datasets.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,7 @@ func (s *DatasetsService) Query(ctx context.Context, apl string, options ...quer
Format: "tabular", // Hardcode tabular result format for now.
}

// TODO(lukasmalkmus): Use 's.basePath' once ingest v2 is available.
path, err := url.JoinPath("/v1/datasets", "_apl")
path, err := url.JoinPath(s.basePath, "query")
if err != nil {
return nil, spanError(span, err)
} else if path, err = AddURLOptions(path, queryParams); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions axiom/datasets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ func TestDatasetsService_Query(t *testing.T) {
assert.NoError(t, err)
}

client := setup(t, "POST /v1/datasets/_apl", hf)
client := setup(t, "POST /v2/datasets/query", hf)

res, err := client.Datasets.Query(context.Background(),
"['test'] | where response == 304",
Expand Down Expand Up @@ -1128,7 +1128,7 @@ func TestDatasetsService_QueryLegacy(t *testing.T) {
assert.Equal(t, expLegacyQueryRes, res)
}

func TestDatasetsService_QueryInvalid_InvalidSaveKind(t *testing.T) {
func TestDatasetsService_QueryLegacyInvalid_InvalidSaveKind(t *testing.T) {
client := setup(t, "POST /v1/datasets/test/query", nil)

_, err := client.Datasets.QueryLegacy(context.Background(), "test", querylegacy.Query{}, querylegacy.Options{
Expand Down
2 changes: 1 addition & 1 deletion axiom/orgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ type wrappedOrganization struct {
// OrganizationsService handles communication with the organization related
// operations of the Axiom API.
//
// Axiom API Reference: /v1/orgs
// Axiom API Reference: /v2/orgs
type OrganizationsService service

// List all available organizations.
Expand Down
Loading