snowflake

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package snowflake implements a steampipe plugin for Snowflake.

This plugin provides data that Steampipe uses to present foreign tables that represent Snowflake resources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigInstance

func ConfigInstance() interface{}

func DSN

func DSN(ctx context.Context, account, user,
	password string,
	browserAuth bool,
	privateKeyPath,
	privateKey,
	privateKeyPassphrase,
	oauthAccessToken,
	region,
	role, database, schema, warehouse string) (string, error)

func DescribeNetworkPolicy

func DescribeNetworkPolicy(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error)

func DescribeSessionPolicy

func DescribeSessionPolicy(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error)

func DescribeUser

func DescribeUser(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error)

func GetConfig

func GetConfig(connection *plugin.Connection) snowflakeConfig

GetConfig :: retrieve and cast connection config from query data

func GetOauthAccessToken

func GetOauthAccessToken(
	endPoint,
	client_id,
	client_secret string,
	data url.Values) (string, error)

func GetOauthData

func GetOauthData(refreshToken, redirectUrl string) url.Values

func GetOauthRequest

func GetOauthRequest(dataContent io.Reader, endPoint, clientId, clientSecret string) (*http.Request, error)

func LoginHistoryCol added in v0.0.2

func LoginHistoryCol(colname string, item *LoginHistory) interface{}

LoginHistoryCol returns a reference for a column of a LoginHistory

func ParameterCol added in v0.0.2

func ParameterCol(colname string, item *Parameter) interface{}

ParameterCol returns a reference for a column of a Parameter

func ParsePrivateKey

func ParsePrivateKey(privateKeyBytes []byte, passhrase []byte) (*rsa.PrivateKey, error)

func Plugin

func Plugin(ctx context.Context) *plugin.Plugin

Plugin creates this (snowflake) plugin

func ReadPrivateKeyFile

func ReadPrivateKeyFile(privateKeyPath string) ([]byte, error)

func SchemataCol added in v0.0.2

func SchemataCol(colname string, item *Schemata) interface{}

SchemataCol returns a reference for a column of a Schemata

func SessionCol added in v0.0.2

func SessionCol(colname string, item *Session) interface{}

SessionCol returns a reference for a column of a Session

func SessionPolicyCol

func SessionPolicyCol(colname string, sp *SessionPolicy) interface{}

SessionPolicyCol returns a reference for a column of a SessionPolicy

func UserGrantCol

func UserGrantCol(colname string, sp *UserGrant) interface{}

UserGrantCol returns a reference for a column of a UserGrant

func WarehouseMeteringHistoryCol added in v0.6.0

func WarehouseMeteringHistoryCol(colname string, item *WarehouseMeteringHistory) interface{}

WarehouseMeteringHistoryCol returns a reference for a column of a WarehouseMeteringHistory

Types

type AccountGrant

type AccountGrant struct {
	CreatedOn   sql.NullTime   `json:"created_on"`
	Privilege   sql.NullString `json:"privilege"`
	GrantedOn   sql.NullString `json:"granted_on"`
	Name        sql.NullString `json:"name"`
	GrantedTo   sql.NullString `json:"granted_to"`
	GranteeName sql.NullString `json:"grantee_name"`
	GrantOption sql.NullBool   `json:"grant_option"`
	GrantedBy   sql.NullString `json:"granted_by"`
	Role        sql.NullString `json:"role"`
}

type Database

type Database struct {
	CreatedOn     sql.NullString `json:"created_on"`
	Name          sql.NullString `json:"name"`
	IsDefault     sql.NullString `json:"is_default"`
	IsCurrent     sql.NullString `json:"is_current"`
	Origin        sql.NullString `json:"origin"`
	Owner         sql.NullString `json:"owner"`
	Comment       sql.NullString `json:"comment"`
	Options       sql.NullString `json:"options"`
	RetentionTime sql.NullString `json:"retention_time"`
	Kind          sql.NullString `json:"kind"`
	Budget        sql.NullString `json:"budget"`
	OwnerRoleType sql.NullString `json:"owner_role_type"`
}

type DatabaseGrant

type DatabaseGrant AccountGrant

type LoginHistory added in v0.0.2

type LoginHistory struct {
	EventId                    sql.NullInt64  `json:"EVENT_ID"`
	EventTimestamp             sql.NullTime   `json:"EVENT_TIMESTAMP"`
	EventType                  sql.NullString `json:"EVENT_TYPE"`
	UserName                   sql.NullString `json:"USER_NAME"`
	ClientIp                   sql.NullString `json:"CLIENT_IP"`
	ReportedClientType         sql.NullString `json:"REPORTED_CLIENT_TYPE"`
	ReportedClientVersion      sql.NullString `json:"REPORTED_CLIENT_VERSION"`
	FirstAuthenticationFactor  sql.NullString `json:"FIRST_AUTHENTICATION_FACTOR"`
	SecondAuthenticationFactor sql.NullString `json:"SECOND_AUTHENTICATION_FACTOR"`
	IsSuccess                  sql.NullString `json:"IS_SUCCESS"`
	ErrorCode                  sql.NullInt64  `json:"ERROR_CODE"`
	ErrorMessage               sql.NullString `json:"ERROR_MESSAGE"`
	RelatedEventId             sql.NullInt64  `json:"RELATED_EVENT_ID"`
	Connection                 sql.NullString `json:"CONNECTION"`
}

type NetworkPolicy

type NetworkPolicy struct {
	Name                         sql.NullString `json:"name"`
	CreatedOn                    sql.NullTime   `json:"created_on"`
	Comment                      sql.NullString `json:"comment"`
	EntriesInAllowedIPList       sql.NullInt64  `json:"entries_in_allowed_ip_list"`
	EntriesInBlockedIPList       sql.NullInt64  `json:"entries_in_blocked_ip_list"`
	EntriesInAllowedNetworkRules sql.NullString `json:"entries_in_allowed_network_rules"`
	EntriesInBlockedNetworkRules sql.NullString `json:"entries_in_blocked_network_rules"`
}

type Parameter added in v0.0.2

type Parameter struct {
	Key         sql.NullString `json:"key"`
	Value       sql.NullString `json:"value"`
	Default     sql.NullString `json:"default"`
	Level       sql.NullString `json:"level"`
	Description sql.NullString `json:"description"`
	Type        sql.NullString `json:"type"`
}

type Policy

type Policy struct {
	CreatedOn    sql.NullString `db:"created_on"`
	Name         sql.NullString `db:"name"`
	DatabaseName sql.NullString `db:"database_name"`
	SchemaName   sql.NullString `db:"schema_name"`
	Kind         sql.NullString `db:"kind"`
	Owner        sql.NullString `db:"owner"`
	Comment      sql.NullString `db:"comment"`
}

type ResourceMonitor added in v0.2.0

type ResourceMonitor struct {
	Name                 sql.NullString `json:"name" db:"name"`
	CreditQuota          sql.NullString `json:"credit_quota" db:"credit_quota"`
	UsedCredits          sql.NullString `json:"used_credits" db:"used_credits"`
	RemainingCredits     sql.NullString `json:"remaining_credits" db:"remaining_credits"`
	Level                sql.NullString `json:"level" db:"level"`
	Frequency            sql.NullString `json:"frequency" db:"frequency"`
	StartTime            sql.NullTime   `json:"start_time" db:"start_time"`
	EndTime              sql.NullTime   `json:"end_time" db:"end_time"`
	NotifyAt             sql.NullString `json:"notify_at" db:"notify_at"`
	SuspendAt            sql.NullString `json:"suspend_at" db:"suspend_at"`
	SuspendImmediatelyAt sql.NullString `json:"suspend_immediately_at" db:"suspend_immediately_at"`
	CreatedOn            sql.NullTime   `json:"created_on" db:"created_on"`
	Owner                sql.NullString `json:"owner" db:"owner"`
	Comment              sql.NullString `json:"comment" db:"comment"`
	NotifyUsers          sql.NullString `json:"notify_users" db:"notify_users"`
}

type Result

type Result struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int    `json:"expires_in"`
}

type Role

type Role struct {
	CreatedOn       sql.NullTime   `json:"created_on"`
	Name            sql.NullString `json:"name"`
	IsDefault       sql.NullString `json:"is_default"`
	IsCurrent       sql.NullString `json:"is_current"`
	IsInherited     sql.NullString `json:"is_inherited"`
	AssignedToUsers sql.NullInt64  `json:"assigned_to_users"`
	GrantedToRoles  sql.NullInt64  `json:"granted_to_roles"`
	GrantedRoles    sql.NullInt64  `json:"granted_roles"`
	Owner           sql.NullString `json:"owner"`
	Comment         sql.NullString `json:"comment"`
}

type RoleGrant

type RoleGrant struct {
	CreatedOn   sql.NullTime   `json:"created_on"`
	Role        sql.NullString `json:"role"`
	GrantedTo   sql.NullString `json:"granted_to"`
	GranteeName sql.NullString `json:"grantee_name"`
	GrantedBy   sql.NullString `json:"granted_by"`
}

type Schemata added in v0.0.2

type Schemata struct {
	SchemaId                   sql.NullInt64  `json:"SCHEMA_ID"`
	SchemaName                 sql.NullString `json:"SCHEMA_NAME"`
	CatalogId                  sql.NullInt64  `json:"CATALOG_ID"`
	CatalogName                sql.NullString `json:"CATALOG_NAME"`
	SchemaOwner                sql.NullString `json:"SCHEMA_OWNER"`
	RetentionTime              sql.NullInt64  `json:"RETENTION_TIME"`
	IsTransient                sql.NullString `json:"IS_TRANSIENT"`
	IsManagedAccess            sql.NullString `json:"IS_MANAGED_ACCESS"`
	DefaultCharacterSetCatalog sql.NullString `json:"DEFAULT_CHARACTER_SET_CATALOG"`
	DefaultCharacterSetSchema  sql.NullString `json:"DEFAULT_CHARACTER_SET_SCHEMA"`
	DefaultCharacterSetName    sql.NullString `json:"DEFAULT_CHARACTER_SET_NAME"`
	SqlPath                    sql.NullString `json:"SQL_PATH"`
	Comment                    sql.NullString `json:"COMMENT"`
	Created                    sql.NullTime   `json:"CREATED"`
	LastAltered                sql.NullTime   `json:"LAST_ALTERED"`
	Deleted                    sql.NullTime   `json:"DELETED"`
	OwnerRoleType              sql.NullString `json:"OWNER_ROLE_TYPE"`
	SchemaType                 sql.NullString `json:"SCHEMA_TYPE"`
	VersionName                sql.NullString `json:"VERSION_NAME"`
	VersionedSchemaId          sql.NullString `json:"VERSIONED_SCHEMA_ID"`
}

type Session added in v0.0.2

type Session struct {
	SessionId                sql.NullInt64  `json:"SESSION_ID"`
	CreatedOn                sql.NullTime   `json:"CREATED_ON"`
	UserName                 sql.NullString `json:"USER_NAME"`
	AuthenticationMethod     sql.NullString `json:"AUTHENTICATION_METHOD"`
	LoginEventId             sql.NullInt64  `json:"LOGIN_EVENT_ID"`
	ClientApplicationVersion sql.NullString `json:"CLIENT_APPLICATION_VERSION"`
	ClientApplicationId      sql.NullString `json:"CLIENT_APPLICATION_ID"`
	ClientEnvironment        sql.NullString `json:"CLIENT_ENVIRONMENT"`
	ClientBuildId            sql.NullString `json:"CLIENT_BUILD_ID"`
	ClientVersion            sql.NullString `json:"CLIENT_VERSION"`
	ClosedReason             sql.NullString `json:"CLOSED_REASON"`
}

type SessionPolicy

type SessionPolicy Policy

type User

type User struct {
	Name                  sql.NullString `json:"name"`
	CreatedOn             sql.NullTime   `json:"created_on"`
	LoginName             sql.NullString `json:"login_name"`
	DisplayName           sql.NullString `json:"display_name"`
	FirstName             sql.NullString `json:"first_name"`
	LastName              sql.NullString `json:"last_name"`
	Email                 sql.NullString `json:"email"`
	MinsToUnlock          sql.NullString `json:"mins_to_unlock"`
	DaysToExpiry          sql.NullString `json:"days_to_expiry"`
	Comment               sql.NullString `json:"comment"`
	Disabled              sql.NullString `json:"disabled"`
	MustChangePassword    sql.NullString `json:"must_change_password"`
	SnowflakeLock         sql.NullString `json:"snowflake_lock"`
	DefaultWarehouse      sql.NullString `json:"default_warehouse"`
	DefaultNamespace      sql.NullString `json:"default_namespace"`
	DefaultRole           sql.NullString `json:"default_role"`
	DefaultSecondaryRoles sql.NullString `json:"default_secondary_roles"`
	ExtAuthnDuo           sql.NullString `json:"ext_authn_duo"`
	ExtAuthnUid           sql.NullString `json:"ext_authn_uid"`
	MinsToBypassMFA       sql.NullString `json:"mins_to_bypass_mfa"`
	Owner                 sql.NullString `json:"owner"`
	LastSuccessLogin      sql.NullTime   `json:"last_success_login"`
	ExpiresAtTime         sql.NullTime   `json:"expires_at_time"`
	LockedUntilTime       sql.NullTime   `json:"locked_until_time"`
	HasPassword           sql.NullString `json:"has_password"`
	HasRsaPublicKey       sql.NullString `json:"has_rsa_public_key"`
	Type                  sql.NullString `json:"type"`
	HasMFA                sql.NullBool   `json:"has_mfa"`
}

type UserGrant

type UserGrant RoleGrant

type View

type View struct {
	CreatedOn      sql.NullTime   `json:"created_on"`
	Name           sql.NullString `json:"name"`
	Reserved       sql.NullString `json:"reserved"`
	DatabaseName   sql.NullString `json:"database_name"`
	SchemaName     sql.NullString `json:"schema_name"`
	Owner          sql.NullString `json:"owner"`
	Comment        sql.NullString `json:"comment"`
	Text           sql.NullString `json:"text"`
	IsSecure       sql.NullString `json:"is_secure"`
	IsMaterialized sql.NullString `json:"is_materialized"`
	TableName      sql.NullString `json:"table_name"`
	TableCatalog   sql.NullString `json:"table_catalog"`
}

type ViewGrant

type ViewGrant AccountGrant

type Warehouse

type Warehouse struct {
	Name            sql.NullString `json:"name" db:"name"`
	State           sql.NullString `json:"state" db:"state"`
	Type            sql.NullString `json:"type" db:"type"`
	Size            sql.NullString `json:"size" db:"size"`
	MinClusterCount sql.NullInt64  `json:"min_cluster_count" db:"min_cluster_count"`
	MaxClusterCount sql.NullInt64  `json:"max_cluster_count" db:"max_cluster_count"`
	StartedClusters sql.NullInt64  `json:"started_clusters" db:"started_clusters"`
	Running         sql.NullInt64  `json:"running" db:"running"`
	Queued          sql.NullInt64  `json:"queued" db:"queued"`
	IsDefault       sql.NullString `json:"is_default" db:"is_default"`
	IsCurrent       sql.NullString `json:"is_current" db:"is_current"`
	AutoSuspend     sql.NullInt64  `json:"auto_suspend" db:"auto_suspend"`
	AutoResume      sql.NullBool   `json:"auto_resume" db:"auto_resume"`
	Available       sql.NullString `json:"available" db:"available"`
	Provisioning    sql.NullString `json:"provisioning" db:"provisioning"`
	Quiescing       sql.NullString `json:"quiescing" db:"quiescing"`
	Other           sql.NullString `json:"other" db:"other"`
	CreatedOn       sql.NullTime   `json:"created_on" db:"created_on"`
	ResumedOn       sql.NullTime   `json:"resumed_on" db:"resumed_on"`
	UpdatedOn       sql.NullTime   `json:"updated_on" db:"updated_on"`
	Owner           sql.NullString `json:"owner" db:"owner"`
	Comment         sql.NullString `json:"comment" db:"comment"`
	ResourceMonitor sql.NullString `json:"resource_monitor" db:"resource_monitor"`
	Actives         sql.NullInt64  `json:"actives" db:"actives"`
	Pendings        sql.NullInt64  `json:"pendings" db:"pendings"`
	Failed          sql.NullInt64  `json:"failed" db:"failed"`
	Suspended       sql.NullInt64  `json:"suspended" db:"suspended"`
	UUID            sql.NullString `json:"uuid" db:"uuid"`
	ScalingPolicy   sql.NullString `json:"scaling_policy" db:"scaling_policy"`
	Budget          sql.NullString `json:"budget" db:"budget"`
	OwnerRoleType   sql.NullString `json:"owner_role_type" db:"owner_role_type"`
}

func ScanWarehouse added in v0.0.2

func ScanWarehouse(row *sqlx.Row) (*Warehouse, error)

type WarehouseMeteringHistory added in v0.6.0

type WarehouseMeteringHistory struct {
	StartTime                sql.NullTime   `json:"START_TIME"`
	EndTime                  sql.NullTime   `json:"END_TIME"`
	WarehouseName            sql.NullString `json:"WAREHOUSE_NAME"`
	WarehouseId              sql.NullString `json:"WAREHOUSE_Id"`
	CreditsUsed              sql.NullString `json:"CREDITS_USED"`
	CreditsUsedCompute       sql.NullString `json:"CREDITS_USED_COMPUTE"`
	CreditsUsedCloudServices sql.NullString `json:"CREDITS_USED_CLOUD_SERVICES"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL