Documentation
¶
Index ¶
- Constants
- Variables
- func ConstructUserAgentString() (ua_string string)
- func GetHostNameURL() string
- func MakeCanonicalUrl(url string) string
- type AuthenticationResponse
- type BaseClient
- type Client
- type ClientImpl
- type ClientImplCore
- type ClientImplV0
- type ConnectionControl
- type MockClient
- func (m *MockClient) GetConnectionParameters(ctx context.Context, engineName string, databaseName string) (string, map[string]string, error)
- func (m *MockClient) IsNewVersion() bool
- func (m *MockClient) Query(ctx context.Context, engineUrl, query string, parameters map[string]string, ...) (*Response, error)
- type Response
Constants ¶
const ( ContentTypeForm = "application/x-www-form-urlencoded" ContentTypeJSON = "application/json" )
const ( ServiceAccountLoginURLSuffix = "/oauth/token" EngineUrlByAccountName = "/web/v3/account/%s/engineUrl" //API v0 UsernamePasswordURLSuffix = "/auth/v1/login" DefaultAccountURL = "/iam/v2/account" AccountIdByNameURL = "/iam/v2/accounts:getIdByName" EngineIdByNameURL = "/core/v1/accounts/%s/engines:getIdByName" EngineByIdURL = "/core/v1/accounts/%s/engines/%s" EngineUrlByDatabaseNameURL = "/core/v1/accounts/%s/engines:getURLByDatabaseName" )
const AuthAudienceValue = "https://api.firebolt.io"
Variables ¶
var AccountCache cache.Cache
Static caches on pacakge level
var URLCache cache.Cache
Functions ¶
func ConstructUserAgentString ¶
func ConstructUserAgentString() (ua_string string)
ConstructUserAgentString returns a string with go, GoSDK and os type and versions additionally user can set "FIREBOLT_GO_DRIVERS" and "FIREBOLT_GO_CLIENTS" env variable, and they will be concatenated with the final user-agent string
func GetHostNameURL ¶
func GetHostNameURL() string
GetHostNameURL returns a hostname url, either default or overwritten with the environment variable
func MakeCanonicalUrl ¶
MakeCanonicalUrl checks whether url starts with https:// and if not prepends it
Types ¶
type AuthenticationResponse ¶
type BaseClient ¶
type Client ¶
type Client interface {
GetConnectionParameters(ctx context.Context, engineName string, databaseName string) (string, map[string]string, error)
Query(ctx context.Context, engineUrl, query string, parameters map[string]string, control ConnectionControl) (*Response, error)
}
func ClientFactory ¶
func ClientFactory(settings *types.FireboltSettings, apiEndpoint string) (Client, error)
ClientFactory sends an authentication request, and returns a newly constructed client object
type ClientImpl ¶
type ClientImpl struct {
ConnectedToSystemEngine bool
AccountName string
BaseClient
}
func MakeClient ¶
func MakeClient(settings *types.FireboltSettings, apiEndpoint string) (*ClientImpl, error)
func (*ClientImpl) GetConnectionParameters ¶
func (c *ClientImpl) GetConnectionParameters(ctx context.Context, engineName, databaseName string) (string, map[string]string, error)
GetConnectionParameters returns engine URL and parameters based on engineName and databaseName
func (*ClientImpl) GetQueryParams ¶
type ClientImplCore ¶ added in v1.10.0
type ClientImplCore struct {
AccountName string
BaseClient
}
func MakeClientCore ¶ added in v1.10.0
func MakeClientCore(settings *types.FireboltSettings) (*ClientImplCore, error)
func (*ClientImplCore) GetConnectionParameters ¶ added in v1.10.0
func (c *ClientImplCore) GetConnectionParameters(_ context.Context, _, databaseName string) (string, map[string]string, error)
GetConnectionParameters returns engine URL and parameters based on engineName and databaseName
func (*ClientImplCore) GetQueryParams ¶ added in v1.10.0
type ClientImplV0 ¶
type ClientImplV0 struct {
AccountID string
BaseClient
}
func MakeClientV0 ¶
func MakeClientV0(settings *types.FireboltSettings, apiEndpoint string) (*ClientImplV0, error)
func (*ClientImplV0) GetAccountID ¶ added in v1.8.0
func (*ClientImplV0) GetConnectionParameters ¶
func (c *ClientImplV0) GetConnectionParameters(ctx context.Context, engineName, databaseName string) (string, map[string]string, error)
GetConnectionParameters returns engine URL and engine name based on engineName and accountId
type ConnectionControl ¶
type ConnectionControl struct {
UpdateParameters func(string, string)
ResetParameters func(*[]string) // if list is nil, reset all parameters
SetEngineURL func(string)
}
ConnectionControl is a struct that holds methods for updating connection properties it's passed to Query method to allow it to update connection parameters and engine URL
type MockClient ¶
type MockClient struct {
ParametersCalled []map[string]string
// contains filtered or unexported fields
}
MockClient rudimentary mocks Client and tracks the parameters passed to Query
func MakeMockClient ¶
func MakeMockClient() *MockClient
func MakeMockClientWithError ¶
func MakeMockClientWithError(errorToRaise error) *MockClient
func (*MockClient) GetConnectionParameters ¶
func (*MockClient) IsNewVersion ¶
func (m *MockClient) IsNewVersion() bool
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
func DoHttpRequest ¶
func DoHttpRequest(reqParams requestParameters) *Response
DoHttpRequest sends a request using "POST" or "GET" method on a specified url additionally it passes the parameters and a bodyStr as a payload if accessToken is passed, it is used for authorization returns Response struct
func MakeResponse ¶
func (*Response) Body ¶
func (r *Response) Body() io.ReadCloser