Documentation ¶
Index ¶
- Constants
- func GetUserAgentString(name string) string
- func ShouldCacheQuery(resp *backend.QueryDataResponse) bool
- type AWSDatasourceSettings
- type AmazonSessionProvider
- type AsyncAWSDatasource
- type AsyncDB
- type AsyncDriver
- type AsyncQuery
- type AuthSettings
- type AuthType
- type QueryMeta
- type QueryStatus
- type SessionCache
- type SessionConfig
Constants ¶
const AllowedAuthProvidersEnvVarKeyName = "AWS_AUTH_AllowedAuthProviders"
AllowedAuthProvidersEnvVarKeyName is the string literal for the aws allowed auth providers environment variable key name
const AssumeRoleEnabledEnvVarKeyName = "AWS_AUTH_AssumeRoleEnabled"
AssumeRoleEnabledEnvVarKeyName is the string literal for the aws assume role enabled environment variable key name
const CredentialsPath = ""
path to the shared credentials file in the instance for the aws/aws-sdk if empty string, the path is ~/.aws/credentials
const GrafargAssumeRoleExternalIdKeyName = "AWS_AUTH_EXTERNAL_ID"
GrafargAssumeRoleExternalIdKeyName is the string literal for the grafarg assume role external id environment variable key name
const ProfileName = "assume_role_credentials"
the profile containing credentials for GrafargAssueRole auth type in the shared credentials file
const SessionDurationEnvVarKeyName = "AWS_AUTH_SESSION_DURATION"
SessionDurationEnvVarKeyName is the string literal for the session duration variable key name
Variables ¶
This section is empty.
Functions ¶
func GetUserAgentString ¶
GetUserAgentString returns an agent that can be parsed in server logs
func ShouldCacheQuery ¶
func ShouldCacheQuery(resp *backend.QueryDataResponse) bool
ShouldCacheQuery checks whether resp contains a running query, and returns false if it does
Types ¶
type AWSDatasourceSettings ¶
type AWSDatasourceSettings struct { Profile string `json:"profile"` Region string `json:"region"` AuthType AuthType `json:"authType"` AssumeRoleARN string `json:"assumeRoleARN"` ExternalID string `json:"externalId"` // Override the client endpoint Endpoint string `json:"endpoint"` //go:deprecated Use Region instead DefaultRegion string `json:"defaultRegion"` // Loaded from DecryptedSecureJSONData (not the json object) AccessKey string `json:"-"` SecretKey string `json:"-"` SessionToken string `json:"-"` }
DatasourceSettings holds basic connection info
func (*AWSDatasourceSettings) Load ¶
func (s *AWSDatasourceSettings) Load(config backend.DataSourceInstanceSettings) error
LoadSettings will read and validate Settings from the DataSourceConfg
type AmazonSessionProvider ¶
type AmazonSessionProvider func(region string, s AWSDatasourceSettings) (*session.Session, error)
AmazonSessionProvider will return a session (perhaps cached) for given region and settings
type AsyncAWSDatasource ¶
type AsyncAWSDatasource struct { *sqlds.SQLDatasource // contains filtered or unexported fields }
func NewAsyncAWSDatasource ¶
func NewAsyncAWSDatasource(driver AsyncDriver) *AsyncAWSDatasource
func (*AsyncAWSDatasource) NewDatasource ¶
func (ds *AsyncAWSDatasource) NewDatasource(settings backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
func (*AsyncAWSDatasource) QueryData ¶
func (ds *AsyncAWSDatasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
type AsyncDB ¶
type AsyncDB interface { // DB generic methods driver.Conn Ping(ctx context.Context) error // Async flow StartQuery(ctx context.Context, query string, args ...interface{}) (string, error) GetQueryID(ctx context.Context, query string, args ...interface{}) (bool, string, error) QueryStatus(ctx context.Context, queryID string) (QueryStatus, error) CancelQuery(ctx context.Context, queryID string) error GetRows(ctx context.Context, queryID string) (driver.Rows, error) }
AsyncDB represents an async SQL connection
type AsyncDriver ¶
type AsyncDriver interface {
sqlds.Driver
GetAsyncDB(settings backend.DataSourceInstanceSettings, queryArgs json.RawMessage) (AsyncDB, error)
}
AsyncDriver extends the driver interface to also connect to async SQL datasources
type AsyncQuery ¶
type AuthSettings ¶
type AuthSettings struct { AllowedAuthProviders []string AssumeRoleEnabled bool SessionDuration *time.Duration }
AuthSettings defines whether certain auth types and provider can be used or not
func ReadAuthSettingsFromEnvironmentVariables ¶
func ReadAuthSettingsFromEnvironmentVariables() *AuthSettings
type AuthType ¶
type AuthType int
func ToAuthType ¶
func (*AuthType) MarshalJSON ¶
MarshalJSON marshals the enum as a quoted json string
func (*AuthType) UnmarshalJSON ¶
UnmarshalJSON unmashals a quoted json string to the enum value
type QueryStatus ¶
type QueryStatus uint32
QueryStatus represents the status of an async query
const ( QueryUnknown QueryStatus = iota QuerySubmitted QueryRunning QueryFinished QueryCanceled QueryFailed )
func (QueryStatus) Finished ¶
func (qs QueryStatus) Finished() bool
func (QueryStatus) String ¶
func (qs QueryStatus) String() string
type SessionCache ¶
type SessionCache struct {
// contains filtered or unexported fields
}
SessionCache cache sessions for a while
func NewSessionCache ¶
func NewSessionCache() *SessionCache
NewSessionCache creates a new session cache using the default settings loaded from environment variables
func (*SessionCache) GetSession ¶
func (sc *SessionCache) GetSession(c SessionConfig) (*session.Session, error)
GetSession returns a session from the config and possible region overrides -- implements AmazonSessionProvider
type SessionConfig ¶
type SessionConfig struct { Settings AWSDatasourceSettings HTTPClient *http.Client UserAgentName *string }