Documentation
¶
Index ¶
- Constants
- func GetUserAgentString(name string) string
- func ShouldCacheQuery(resp *backend.QueryDataResponse) bool
- type AWSDatasourceSettings
- type AsyncAWSDatasource
- func (ds *AsyncAWSDatasource) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
- func (ds *AsyncAWSDatasource) NewDatasource(ctx context.Context, settings backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
- func (ds *AsyncAWSDatasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- type AsyncDB
- type AsyncDriver
- type AsyncQuery
- type AuthSettings
- type AuthType
- type DownstreamErrorCause
- type QueryExecutionError
- type QueryMeta
- type QueryStatus
- type SigV4Settings
Constants ¶
const ( // AllowedAuthProvidersEnvVarKeyName is the string literal for the aws allowed auth providers environment variable key name AllowedAuthProvidersEnvVarKeyName = "AWS_AUTH_AllowedAuthProviders" // AssumeRoleEnabledEnvVarKeyName is the string literal for the aws assume role enabled environment variable key name AssumeRoleEnabledEnvVarKeyName = "AWS_AUTH_AssumeRoleEnabled" // SessionDurationEnvVarKeyName is the string literal for the session duration variable key name SessionDurationEnvVarKeyName = "AWS_AUTH_SESSION_DURATION" // GrafanaAssumeRoleExternalIdKeyName is the string literal for the grafana assume role external id environment variable key name GrafanaAssumeRoleExternalIdKeyName = "AWS_AUTH_EXTERNAL_ID" // ListMetricsPageLimitKeyName is the string literal for the cloudwatch list metrics page limit key name ListMetricsPageLimitKeyName = "AWS_CW_LIST_METRICS_PAGE_LIMIT" // SigV4AuthEnabledEnvVarKeyName is the string literal for the sigv4 auth enabled environment variable key name SigV4AuthEnabledEnvVarKeyName = "AWS_SIGV4_AUTH_ENABLED" // SigV4VerboseLoggingEnvVarKeyName is the string literal for the sigv4 verbose logging environment variable key name SigV4VerboseLoggingEnvVarKeyName = "AWS_SIGV4_VERBOSE_LOGGING" )
Variables ¶
This section is empty.
Functions ¶
func GetUserAgentString ¶ added in v0.8.0
GetUserAgentString returns an agent that can be parsed in server logs
func ShouldCacheQuery ¶ added in v0.16.0
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 AsyncAWSDatasource ¶ added in v0.11.1
type AsyncAWSDatasource struct { *sqlds.SQLDatasource // contains filtered or unexported fields }
func NewAsyncAWSDatasource ¶ added in v0.11.1
func NewAsyncAWSDatasource(driver AsyncDriver) *AsyncAWSDatasource
func (*AsyncAWSDatasource) CheckHealth ¶ added in v0.24.0
func (ds *AsyncAWSDatasource) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
func (*AsyncAWSDatasource) NewDatasource ¶ added in v0.11.1
func (ds *AsyncAWSDatasource) NewDatasource(ctx context.Context, settings backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
func (*AsyncAWSDatasource) QueryData ¶ added in v0.11.1
func (ds *AsyncAWSDatasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
type AsyncDB ¶ added in v0.11.1
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 ¶ added in v0.11.1
type AsyncDriver interface {
sqlds.Driver
GetAsyncDB(ctx context.Context, settings backend.DataSourceInstanceSettings, queryArgs json.RawMessage) (AsyncDB, error)
}
AsyncDriver extends the driver interface to also connect to async SQL datasources
type AsyncQuery ¶ added in v0.11.1
type AuthSettings ¶ added in v0.2.0
type AuthSettings struct { AllowedAuthProviders []string AssumeRoleEnabled bool SessionDuration *time.Duration ExternalID string ListMetricsPageLimit int MultiTenantTempCredentials bool // necessary for a work around until https://github.com/grafana/grafana/issues/39089 is implemented SecureSocksDSProxyEnabled bool }
AuthSettings stores the AWS settings from Grafana
func ReadAuthSettings ¶ added in v0.22.0
func ReadAuthSettings(ctx context.Context) *AuthSettings
ReadAuthSettings gets the Grafana auth settings from the context if its available, the environment variables if not Note: This function is mainly for backwards compatibility with older versions of Grafana; generally ReadAuthSettingsFromContext should be used instead
func ReadAuthSettingsFromContext ¶ added in v0.22.0
func ReadAuthSettingsFromContext(ctx context.Context) (*AuthSettings, bool)
ReadAuthSettingsFromContext tries to get the auth settings from the GrafanaConfig in ctx, and returns true if it finds a config
func ReadAuthSettingsFromEnvironmentVariables ¶ added in v0.3.0
func ReadAuthSettingsFromEnvironmentVariables() *AuthSettings
ReadAuthSettingsFromEnvironmentVariables gets the Grafana auth settings from the environment variables Deprecated: Use ReadAuthSettingsFromContext instead
type AuthType ¶
type AuthType int
func ToAuthType ¶ added in v0.3.0
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 DownstreamErrorCause ¶ added in v0.32.0
type DownstreamErrorCause uint32
const ( QueryFailedInternal DownstreamErrorCause = iota QueryFailedUser )
type QueryExecutionError ¶ added in v0.32.0
type QueryExecutionError struct { Err error Cause DownstreamErrorCause }
QueryExecutionError error type can be returned from datasource's Execute or QueryStatus methods this will mark the downstream cause in errorResponse.Status
func (*QueryExecutionError) Error ¶ added in v0.32.0
func (e *QueryExecutionError) Error() string
func (*QueryExecutionError) Unwrap ¶ added in v0.32.0
func (e *QueryExecutionError) Unwrap() error
type QueryMeta ¶ added in v0.11.1
type QueryMeta struct {
QueryFlow string `json:"queryFlow,omitempty"`
}
type QueryStatus ¶ added in v0.11.1
type QueryStatus uint32
QueryStatus represents the status of an async query
const ( QueryUnknown QueryStatus = iota QuerySubmitted QueryRunning QueryFinished QueryCanceled QueryFailed )
func (QueryStatus) Finished ¶ added in v0.11.1
func (qs QueryStatus) Finished() bool
func (QueryStatus) String ¶ added in v0.11.1
func (qs QueryStatus) String() string
type SigV4Settings ¶ added in v0.25.0
SigV4Settings stores the settings for SigV4 authentication
func ReadSigV4Settings ¶ added in v0.25.0
func ReadSigV4Settings(ctx context.Context) *SigV4Settings
ReadSigV4Settings gets the SigV4 settings from the context if its available