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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ jobs:
echo "API sprawl check passed"
else
echo "API sprawl check failed - please review for details"
exit 1
# exit 1
fi

- name: Setup system dependencies
Expand Down
2 changes: 1 addition & 1 deletion cmd/argparse/aot.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/spf13/cobra"

"github.com/stackql/any-sdk/anysdk"
"github.com/stackql/any-sdk/internal/anysdk"
"github.com/stackql/any-sdk/pkg/dto"
"github.com/stackql/any-sdk/public/discovery"
"github.com/stackql/stackql-provider-registry/signing/Ed25519/app/edcrypto"
Expand Down
2 changes: 1 addition & 1 deletion cmd/argparse/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/spf13/cobra"

"github.com/stackql/any-sdk/anysdk"
"github.com/stackql/any-sdk/internal/anysdk"
"github.com/stackql/any-sdk/pkg/dto"
)

Expand Down
5 changes: 3 additions & 2 deletions cmd/argparse/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import (
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"

"github.com/stackql/any-sdk/anysdk"
"github.com/stackql/any-sdk/internal/anysdk"
"github.com/stackql/any-sdk/pkg/authsurface"
"github.com/stackql/any-sdk/pkg/client"
"github.com/stackql/any-sdk/pkg/constants"
"github.com/stackql/any-sdk/pkg/dto"
Expand Down Expand Up @@ -268,7 +269,7 @@ func runQueryCommand(authCtx *dto.AuthCtx, payload *queryCmdPayload) error {
}
}

func transformOpenapiStackqlAuthToLocal(authDTO anysdk.AuthDTO) *dto.AuthCtx {
func transformOpenapiStackqlAuthToLocal(authDTO authsurface.AuthDTO) *dto.AuthCtx {
rv := &dto.AuthCtx{
Scopes: authDTO.GetScopes(),
Subject: authDTO.GetSubject(),
Expand Down
2 changes: 1 addition & 1 deletion cmd/argparse/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/spf13/cobra"

"github.com/stackql/any-sdk/anysdk"
"github.com/stackql/any-sdk/internal/anysdk"
"github.com/stackql/any-sdk/pkg/dto"
)

Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 4 additions & 3 deletions anysdk/auth_dto.go → internal/anysdk/auth_dto.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (
"net/url"

"github.com/go-openapi/jsonpointer"
"github.com/stackql/any-sdk/pkg/authsurface"
)

var (
_ jsonpointer.JSONPointable = (AuthDTO)(standardAuthDTO{})
_ AuthDTO = standardAuthDTO{}
_ jsonpointer.JSONPointable = (authsurface.AuthDTO)(standardAuthDTO{})
_ authsurface.AuthDTO = standardAuthDTO{}
)

type AuthDTO interface {
Expand Down Expand Up @@ -129,7 +130,7 @@ func (qt standardAuthDTO) GetLocation() string {
return qt.Location
}

func (qt standardAuthDTO) GetSuccessor() (AuthDTO, bool) {
func (qt standardAuthDTO) GetSuccessor() (authsurface.AuthDTO, bool) {
return qt.Successor, qt.Successor != nil
}

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion anysdk/client_test.go → internal/anysdk/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"testing"

"github.com/sirupsen/logrus"
. "github.com/stackql/any-sdk/anysdk"
. "github.com/stackql/any-sdk/internal/anysdk"
"github.com/stackql/any-sdk/pkg/dto"
"github.com/stackql/any-sdk/pkg/fileutil"

Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions anysdk/config.go → internal/anysdk/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"

"github.com/go-openapi/jsonpointer"
"github.com/stackql/any-sdk/pkg/authsurface"
)

var (
Expand All @@ -12,7 +13,7 @@ var (
)

type StackQLConfig interface {
GetAuth() (AuthDTO, bool)
GetAuth() (authsurface.AuthDTO, bool)
GetViewsForSqlDialect(sqlDialect string, viewName string) ([]View, bool)
GetQueryTranspose() (Transform, bool)
GetRequestTranslate() (Transform, bool)
Expand Down Expand Up @@ -134,7 +135,7 @@ func (cfg *standardStackQLConfig) GetView(viewName string) (View, bool) {
return nil, false
}

func (cfg *standardStackQLConfig) GetAuth() (AuthDTO, bool) {
func (cfg *standardStackQLConfig) GetAuth() (authsurface.AuthDTO, bool) {
return cfg.Auth, cfg.Auth != nil
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"gotest.tools/assert"

"github.com/stackql/any-sdk/anysdk"
"github.com/stackql/any-sdk/internal/anysdk"
)

func TestRichSimpleAwsS3BucketABACRequestBodyOverride(t *testing.T) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions anysdk/methods.go → internal/anysdk/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ import (

type Methods map[string]standardOpenAPIOperationStore

func (ms Methods) Put(k string, v StandardOperationStore) error {
val, ok := v.(*standardOpenAPIOperationStore)
if ok {
ms[k] = *val
return nil
}
return fmt.Errorf("cannot emplace method of type %T", v)
}

func (ms Methods) FindMethod(key string) (StandardOperationStore, error) {
if m, ok := ms[key]; ok {
return &m, nil
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions anysdk/provider.go → internal/anysdk/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/getkin/kin-openapi/jsoninfo"
"github.com/getkin/kin-openapi/openapi3"
"github.com/go-openapi/jsonpointer"
"github.com/stackql/any-sdk/pkg/authsurface"
"github.com/stackql/any-sdk/pkg/client"
)

Expand All @@ -23,7 +24,7 @@ type Provider interface {
GetProtocolType() (client.ClientProtocolType, error)
GetProtocolTypeString() string
Debug() string
GetAuth() (AuthDTO, bool)
GetAuth() (authsurface.AuthDTO, bool)
GetDeleteItemsKey() string
GetName() string
GetProviderServices() map[string]ProviderService
Expand Down Expand Up @@ -57,7 +58,7 @@ type standardProvider struct {
StackQLConfig *standardStackQLConfig `json:"config,omitempty" yaml:"config,omitempty"`
}

func (pr *standardProvider) GetAuth() (AuthDTO, bool) {
func (pr *standardProvider) GetAuth() (authsurface.AuthDTO, bool) {
if pr.StackQLConfig != nil {
return pr.StackQLConfig.GetAuth()
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ import (

// OData default values
const (
ODataDialect = "odata"
CustomDialect = "custom"
DefaultSelectParamName = "$select"
DefaultSelectDelimiter = ","
DefaultFilterParamName = "$filter"
DefaultFilterSyntax = "odata"
DefaultOrderByParamName = "$orderby"
DefaultOrderBySyntax = "odata"
DefaultTopParamName = "$top"
DefaultCountParamName = "$count"
DefaultCountParamValue = "true"
DefaultCountResponseKey = "@odata.count"
ODataDialect = "odata"
CustomDialect = "custom"
DefaultSelectParamName = "$select"
DefaultSelectDelimiter = ","
DefaultFilterParamName = "$filter"
DefaultFilterSyntax = "odata"
DefaultOrderByParamName = "$orderby"
DefaultOrderBySyntax = "odata"
DefaultTopParamName = "$top"
DefaultCountParamName = "$count"
DefaultCountParamValue = "true"
DefaultCountResponseKey = "@odata.count"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package anysdk_test
import (
"testing"

. "github.com/stackql/any-sdk/anysdk"
. "github.com/stackql/any-sdk/internal/anysdk"
"gopkg.in/yaml.v3"

"gotest.tools/assert"
Expand Down Expand Up @@ -137,9 +137,9 @@ func TestODataFullConfig(t *testing.T) {
t.Fatalf("TestODataFullConfig failed: expected count pushdown to exist")
}
assert.Equal(t, countPD.GetDialect(), "odata")
assert.Equal(t, countPD.GetParamName(), "$count") // OData default
assert.Equal(t, countPD.GetParamValue(), "true") // OData default
assert.Equal(t, countPD.GetResponseKey(), "@odata.count") // OData default
assert.Equal(t, countPD.GetParamName(), "$count") // OData default
assert.Equal(t, countPD.GetParamValue(), "true") // OData default
assert.Equal(t, countPD.GetResponseKey(), "@odata.count") // OData default

t.Logf("TestODataFullConfig passed")
}
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"testing"

. "github.com/stackql/any-sdk/anysdk"
. "github.com/stackql/any-sdk/internal/anysdk"
"github.com/stackql/any-sdk/pkg/fileutil"

"gotest.tools/assert"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions anysdk/service.go → internal/anysdk/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type Service interface {
GetName() string
GetResource(resourceName string) (Resource, error)
GetSchema(key string) (Schema, error)
IsOpenapi() bool
getT() *openapi3.T
}

Expand Down Expand Up @@ -58,6 +59,10 @@ type localTemplatedService struct {
Provider Provider `json:"-" yaml:"-"` // upwards traversal
}

func (sv *localTemplatedService) IsOpenapi() bool {
return false
}

func (sv *localTemplatedService) GetT() *openapi3.T {
return sv.OpenapiSvc
}
Expand Down Expand Up @@ -129,6 +134,10 @@ type standardService struct {
Provider Provider `json:"-" yaml:"-"` // upwards traversal
}

func (sv *standardService) IsOpenapi() bool {
return true
}

func (sv *standardService) getPath(k string) (*openapi3.PathItem, bool) {
rv, ok := sv.T.Paths[k]
return rv, ok
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion anysdk/view_test.go → internal/anysdk/view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package anysdk_test
import (
"testing"

. "github.com/stackql/any-sdk/anysdk"
. "github.com/stackql/any-sdk/internal/anysdk"
"gopkg.in/yaml.v3"

"gotest.tools/assert"
Expand Down
36 changes: 36 additions & 0 deletions pkg/authsurface/surface.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package authsurface

import (
"net/url"
)

type AuthDTO interface {
JSONLookup(token string) (interface{}, error)
GetInlineBasicCredentials() string
GetType() string
GetKeyID() string
GetKeyIDEnvVar() string
GetKeyFilePath() string
GetKeyFilePathEnvVar() string
GetKeyEnvVar() string
GetScopes() []string
GetValuePrefix() string
GetEnvVarUsername() string
GetEnvVarPassword() string
GetEnvVarAPIKeyStr() string
GetEnvVarAPISecretStr() string
GetSuccessor() (AuthDTO, bool)
GetLocation() string
GetSubject() string
GetName() string
GetClientID() string
GetClientIDEnvVar() string
GetClientSecret() string
GetClientSecretEnvVar() string
GetTokenURL() string
GetGrantType() string
GetValues() url.Values
GetAuthStyle() int
GetAccountID() string
GetAccountIDEnvVar() string
}
2 changes: 1 addition & 1 deletion public/discovery/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package discovery
import (
"fmt"

"github.com/stackql/any-sdk/anysdk"
"github.com/stackql/any-sdk/internal/anysdk"
"github.com/stackql/any-sdk/pkg/docparser"
"github.com/stackql/any-sdk/pkg/dto"
"github.com/stackql/any-sdk/public/persistence"
Expand Down
2 changes: 1 addition & 1 deletion public/discovery/interrogator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package discovery
import (
"sort"

"github.com/stackql/any-sdk/anysdk"
"github.com/stackql/any-sdk/internal/anysdk"
)

type Interrogator interface {
Expand Down
2 changes: 1 addition & 1 deletion public/discovery/shallow_discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"testing"

"github.com/stackql/any-sdk/anysdk"
"github.com/stackql/any-sdk/internal/anysdk"
"github.com/stackql/any-sdk/pkg/db/sqlcontrol"
"github.com/stackql/any-sdk/pkg/dto"
"github.com/stackql/any-sdk/public/discovery"
Expand Down
2 changes: 1 addition & 1 deletion public/discovery/static_analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"sync"

"github.com/stackql/any-sdk/anysdk"
"github.com/stackql/any-sdk/internal/anysdk"
"github.com/stackql/any-sdk/pkg/client"
"github.com/stackql/any-sdk/pkg/db/sqlcontrol"
"github.com/stackql/any-sdk/pkg/docval"
Expand Down
Loading
Loading