Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConnections ¶
func NewConnections() defaultConnections
Types ¶
type Connection ¶
type Connection struct { Account string User string PrivateKeyFile string `toml:"private_key_file"` Token string Authenticator string // private_key_path is an alternate way to specify the key file... PrivateKeyPath string `toml:"private_key_path"` }
Connection represents the configuration options we need to do keypair auth with Snowflake.
type Connections ¶
type Connections interface { Get(name string) (*Connection, error) List() (map[string]*Connection, error) }
type JWTTokenProvider ¶ added in v1.18.0
type JWTTokenProvider struct {
// contains filtered or unexported fields
}
JWTTokenProvider uses key-pair authentication.
func NewJWTTokenProvider ¶ added in v1.18.0
func NewJWTTokenProvider( account string, user string, privateKeyFile string, role string, ) (*JWTTokenProvider, error)
NewJWTTokenProvider creates a new TokenProvider that uses JWT authentication, loading the private key from the specified file path
type MockConnections ¶
func (*MockConnections) Get ¶
func (m *MockConnections) Get(name string) (*Connection, error)
func (*MockConnections) List ¶
func (m *MockConnections) List() (map[string]*Connection, error)
type MockTokenProvider ¶ added in v1.18.0
type OAuthTokenProvider ¶ added in v1.18.0
type OAuthTokenProvider struct {
// contains filtered or unexported fields
}
OAuthTokenProvider uses Snowflake's login-request flow with OAUTH authenticator.
func NewOAuthTokenProvider ¶ added in v1.18.0
func NewOAuthTokenProvider(account string, token string) *OAuthTokenProvider
NewOAuthTokenProvider creates a new TokenProvider that uses Snowflake's login-request flow.
func (*OAuthTokenProvider) GetToken ¶ added in v1.18.0
func (p *OAuthTokenProvider) GetToken(host string) (string, error)
GetToken logs in to Snowflake using the OAuth token and retrieves a session token.
This mimics the alternative to key pair auth documented at https://docs.snowflake.com/en/developer-guide/snowpark-container-services/working-with-services#ingress-authentication by doing the same login request as the Snowflake Connector for Python and extracting the session token from the response.
See https://github.com/snowflakedb/snowflake-connector-python/blob/e43f03e86297eea43a39019e194fe3bef3918363/src/snowflake/connector/auth/_auth.py#L127-L182 and https://github.com/snowflakedb/snowflake-connector-python/blob/e43f03e86297eea43a39019e194fe3bef3918363/src/snowflake/connector/auth/oauth.py#L43-L49
type TokenProvider ¶ added in v1.18.0
type TokenProvider interface { // GetToken returns an access token for the given host GetToken(host string) (string, error) }
TokenProvider uses a snowflake connection to get an ingress access token.