snowflake

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlterComputePoolOptions

type AlterComputePoolOptions struct {
	IfExists        bool
	MinNodes        int
	MaxNodes        int
	AutoResume      bool
	AutoSuspendSecs int
	Comment         string
}

type AlterComputePoolStateOptions

type AlterComputePoolStateOptions struct {
	IfExists    bool
	StateAction ComputePoolStateAction
}

type AlterListingOptions

type AlterListingOptions struct {
	ListingManifest *ListingManifest
	IfExists        bool
	Publish         bool
	Review          bool
}

type AlterServiceOptions

type AlterServiceOptions struct {
	IfExists                  bool
	MinInstances              *int
	MaxInstances              *int
	QueryWarehouse            *sdk.AccountObjectIdentifier
	AutoResume                *bool
	ExternalAccessIntegration []sdk.AccountObjectIdentifier
	Comment                   *string
}

type ApplicationPackageManifest

type ApplicationPackageManifest struct {
}

type ApplicationPackageVersion

type ApplicationPackageVersion struct {
	Version      string         `db:"version"`
	Patch        int            `db:"patch"`
	Label        string         `db:"label"`
	Comment      sql.NullString `db:"comment"`
	CreatedOn    sql.NullTime   `db:"created_on"`
	DroppedOn    sql.NullTime   `db:"dropped_on"`
	LogLevel     string         `db:"log_level"`
	TraceLevel   string         `db:"trace_level"`
	State        string         `db:"state"`
	ReviewStatus string         `db:"review_status"`
}

type ApplicationPackageVersions

type ApplicationPackageVersions interface {
	Show(ctx context.Context, id sdk.AccountObjectIdentifier) ([]ApplicationPackageVersion, error)
}

type Client

type Client struct {
	SDKClient *sdk.Client

	// Modeled after the SDKClient we create the missing interfaces
	Listings                   Listings
	ImageRepositories          ImageRepositories
	ComputePools               ComputePools
	Services                   Services
	ServiceInstances           ServiceInstances
	ServiceContainers          ServiceContainers
	Endpoints                  Endpoints
	Snapshots                  Snapshots
	Secrets                    Secrets
	Files                      Files
	ReleaseDirectives          ReleaseDirectives
	ApplicationPackageVersions ApplicationPackageVersions
}

func (*Client) Close

func (c *Client) Close()

type ComputePool

type ComputePool struct {
	Name            string         `db:"name"`
	State           string         `db:"state"`
	MinNodes        int            `db:"min_nodes"`
	MaxNodes        int            `db:"max_nodes"`
	InstanceFamily  string         `db:"instance_family"`
	NumServices     int            `db:"num_services"`
	NumJobs         int            `db:"num_jobs"`
	AutoSuspendSecs int            `db:"auto_suspend_secs"`
	AutoResume      bool           `db:"auto_resume"`
	ActiveNodes     int            `db:"active_nodes"`
	IdleNodes       int            `db:"idle_nodes"`
	CreatedOn       sql.NullTime   `db:"created_on"`
	ResumedOn       sql.NullTime   `db:"resumed_on"`
	UpdatedOn       sql.NullTime   `db:"updated_on"`
	Owner           string         `db:"owner"`
	Comment         sql.NullString `db:"comment"`
	IsExclusive     bool           `db:"is_exclusive"`
	Application     sql.NullString `db:"application"`
}

type ComputePoolDetails

type ComputePoolDetails struct {
	Name            string         `db:"name"`
	State           string         `db:"state"`
	MinNodes        int            `db:"min_nodes"`
	MaxNodes        int            `db:"max_nodes"`
	InstanceFamily  string         `db:"instance_family"`
	NumServices     int            `db:"num_services"`
	NumJobs         int            `db:"num_jobs"`
	AutoSuspendSecs int            `db:"auto_suspend_secs"`
	AutoResume      bool           `db:"auto_resume"`
	ActiveNodes     int            `db:"active_nodes"`
	IdleNodes       int            `db:"idle_nodes"`
	CreatedOn       sql.NullTime   `db:"created_on"`
	ResumedOn       sql.NullTime   `db:"resumed_on"`
	UpdatedOn       sql.NullTime   `db:"updated_on"`
	Owner           string         `db:"owner"`
	Comment         string         `db:"comment"`
	IsExclusive     bool           `db:"is_exclusive"`
	Application     sql.NullString `db:"application"`
}

type ComputePoolInstance

type ComputePoolInstance string
const (
	CPU_X64_XS    ComputePoolInstance = "CPU_X64_XS"
	CPU_X64_S     ComputePoolInstance = "CPU_X64_S"
	CPU_X64_M     ComputePoolInstance = "CPU_X64_M"
	CPU_X64_L     ComputePoolInstance = "CPU_X64_L"
	HIGHMEM_X64_S ComputePoolInstance = "HIGHMEM_X64_S"
	HIGHMEM_X64_M ComputePoolInstance = "HIGHMEM_X64_M"
	HIGHMEM_X64_L ComputePoolInstance = "HIGHMEM_X64_L"
)

type ComputePoolStateAction

type ComputePoolStateAction string
const (
	ComputePoolStateActionSuspend ComputePoolStateAction = "SUSPEND"
	ComputePoolStateActionResume  ComputePoolStateAction = "RESUME"
	ComputePoolStateActionStopAll ComputePoolStateAction = "STOP ALL"
)

type Connection

type Connection interface {
	SnowflakeConfig() *sf.Config
}

type ConnectionManager

type ConnectionManager struct {
	// contains filtered or unexported fields
}

func NewConnectionManager

func NewConnectionManager() (*ConnectionManager, error)

func (*ConnectionManager) AvailableClients

func (cm *ConnectionManager) AvailableClients() map[string]*sf.Config

func (*ConnectionManager) GetClient

func (cm *ConnectionManager) GetClient() *Client

func (*ConnectionManager) SetClient

func (cm *ConnectionManager) SetClient(name string) error

type CreateComputePoolOptions

type CreateComputePoolOptions struct {
	IfNotExists        bool
	Application        *sdk.AccountObjectIdentifier
	MinNodes           int
	MaxNodes           int
	InstanceFamily     ComputePoolInstance
	AutoResume         *bool
	InitiallySuspended *bool
	AutoSuspendSecs    *int
	Comment            *string
}

type CreateImageRepositoryOptions

type CreateImageRepositoryOptions struct {
	IfNotExists bool
}

type CreateListingOptions

type CreateListingOptions struct {
	ListingManifest    *ListingManifest
	IfNotExists        bool
	ApplicationPackage string
	Publish            bool
	Review             bool
}

type CreateServiceOptions

type CreateServiceOptions struct {
	IfNotExists                bool
	ComputePool                sdk.AccountObjectIdentifier
	ServiceManifest            *ServiceManifest
	ExternalAccessIntegrations []sdk.AccountObjectIdentifier
	AutoResume                 bool
	MinInstances               int
	MaxInstances               int
	QueryWarehouse             sdk.AccountObjectIdentifier
	Comment                    string
}

type DropComputePoolOptions

type DropComputePoolOptions struct {
	IfExists bool
}

type DropImageRepositoryOptions

type DropImageRepositoryOptions struct {
	IfExists bool
}

type DropListingOptions

type DropListingOptions struct {
	IfExists bool
}

type DropSecretsOptions

type DropSecretsOptions struct {
	IfExists bool
	Secret   *sdk.SchemaObjectIdentifier
}

type DropServiceOptions

type DropServiceOptions struct {
	IfExists bool
}

type DropSnapshotOptions

type DropSnapshotOptions struct {
	IfExists bool
	Snapshot *sdk.SchemaObjectIdentifier
}

type Endpoint

type Endpoint struct {
	Name       string         `db:"name"`
	Port       string         `db:"port"`
	PortRange  sql.NullString `db:"port_range"`
	Protocol   string         `db:"protocol"`
	IsPublic   bool           `db:"is_public"`
	IngressUrl string         `db:"ingress_url"`
}

type Endpoints

type Endpoints interface {
	Show(ctx context.Context, id *sdk.SchemaObjectIdentifier) ([]Endpoint, error)
}

type Files

type Files interface {
	Put(ctx context.Context, id sdk.SchemaObjectIdentifier, opts *PutFileOptions) error
}

type Image

type Image struct {
	CreatedOn sql.NullTime `db:"created_on"`
	ImageName string       `db:"image_name"`
	Tags      string       `db:"tags"`
	Digest    string       `db:"digest"`
	ImagePath string       `db:"image_path"`
}

type ImageRepository

type ImageRepository struct {
	CreatedOn     sql.NullTime `db:"created_on"`
	Name          string       `db:"name"`
	DatabaseName  string       `db:"database_name"`
	SchemaName    string       `db:"schema_name"`
	RepositoryURL string       `db:"repository_url"`
	Owner         string       `db:"owner"`
	OwnerRoleType string       `db:"owner_role_type"`
	Comment       string       `db:"comment"`
}

type Listing

type Listing struct {
	GlobalName             string         `db:"global_name"`
	Name                   string         `db:"name"`
	Title                  string         `db:"title"`
	Subtitle               sql.NullString `db:"subtitle"`
	Profile                string         `db:"profile"`
	CreatedOn              sql.NullTime   `db:"created_on"`
	UpdatedOn              sql.NullTime   `db:"updated_on"`
	PublishedOn            sql.NullTime   `db:"published_on"`
	State                  string         `db:"state"`
	ReviewState            sql.NullString `db:"review_state"`
	Comment                sql.NullString `db:"comment"`
	Owner                  string         `db:"owner"`
	OwnerRoleType          string         `db:"owner_role_type"`
	Regions                sql.NullString `db:"regions"`
	TargetAccounts         string         `db:"target_accounts"`
	IsMonetized            bool           `db:"is_monetized"`
	IsApplication          bool           `db:"is_application"`
	IsTargeted             bool           `db:"is_targeted"`
	IsLimitedTrial         bool           `db:"is_limited_trial"`
	IsByRequest            bool           `db:"is_by_request"`
	RejectedOn             sql.NullTime   `db:"rejected_on"`
	DetailedTargetAccounts sql.NullString `db:"detailed_target_accounts"`
}

type ListingDetails

type ListingDetails struct {
	GlobalName               string         `db:"global_name"`
	Name                     string         `db:"name"`
	Owner                    string         `db:"owner"`
	OwnerRoleType            string         `db:"owner_role_type"`
	CreatedOn                sql.NullTime   `db:"created_on"`
	UpdatedOn                sql.NullTime   `db:"updated_on"`
	PublishedOn              sql.NullTime   `db:"published_on"`
	Title                    string         `db:"title"`
	Subtitle                 sql.NullString `db:"subtitle"`
	Description              sql.NullString `db:"description"`
	ListingTerms             sql.NullString `db:"listing_terms"`
	State                    string         `db:"state"`
	Share                    sql.NullString `db:"share"`
	ApplicationPackage       string         `db:"application_package"`
	BusinessNeeds            sql.NullString `db:"business_needs"`
	UsageExamples            sql.NullString `db:"usage_examples"`
	DataAttributes           sql.NullString `db:"data_attributes"`
	Categories               sql.NullString `db:"categories"`
	Resources                sql.NullString `db:"resources"`
	Profile                  sql.NullString `db:"profile"`
	CustomizedContactInfo    sql.NullString `db:"customized_contact_info"`
	DataDictionary           sql.NullString `db:"data_dictionary"`
	DataPreview              sql.NullString `db:"data_preview"`
	Comment                  sql.NullString `db:"comment"`
	Revisions                string         `db:"revisions"`
	TargetAccounts           sql.NullString `db:"target_accounts"`
	Regions                  sql.NullString `db:"regions"`
	RefreshSchedule          sql.NullString `db:"refresh_schedule"`
	RefreshType              sql.NullString `db:"refresh_type"`
	ReviewState              sql.NullString `db:"review_state"`
	RejectionReason          sql.NullString `db:"rejection_reason"`
	UnpublishedByAdminReason sql.NullString `db:"unpublished_by_admin_reason"`
	IsMonetized              bool           `db:"is_monetized"`
	IsApplication            bool           `db:"is_application"`
	IsTargeted               bool           `db:"is_targeted"`
	IsLimitedTrial           bool           `db:"is_limited_trial"`
	IsByRequest              bool           `db:"is_by_request"`
	LimitedTrialPlan         sql.NullString `db:"limited_trial_plan"`
	RetiredOn                sql.NullTime   `db:"retired_on"`
	ScheduledDropTime        sql.NullTime   `db:"scheduled_drop_time"`
	ManifestYAML             string         `db:"manifest_yaml"`
}

type ListingManifest

type ListingManifest struct {
	Title        string `json:"title" yaml:"title"`
	Subtitle     string `json:"subtitle" yaml:"subtitle"`
	Description  string `json:"description" yaml:"description"`
	Profile      string `json:"profile" yaml:"profile"`
	ListingTerms *struct {
		Type string `json:"type" yaml:"type"`
		Link string `json:"link,omitempty" yaml:"link,omitempty"`
	} `json:"listing_terms,omitempty" yaml:"listing_terms,omitempty"`
	Targets *struct {
		Accounts []string `json:"accounts,omitempty" yaml:"accounts,omitempty"`
		Regions  []string `json:"regions,omitempty" yaml:"regions,omitempty"`
	} `json:"targets,omitempty" yaml:"targets,omitempty"`
	AutoFulfillment *struct {
		RefreshSchedule string `json:"refresh_schedule,omitempty" yaml:"refresh_schedule,omitempty"`
		RefreshType     string `json:"refresh_type,omitempty" yaml:"refresh_type,omitempty"`
	} `json:"auto_fulfillment,omitempty" yaml:"auto_fulfillment,omitempty"`
	BusinessNeeds []struct {
		Name        string `json:"name" yaml:"name"`
		Description string `json:"description" yaml:"description"`
		Type        string `json:"type,omitempty" yaml:"type,omitempty"`
	} `json:"business_needs,omitempty" yaml:"business_needs,omitempty"`
	Categories []string `json:"categories,omitempty" yaml:"categories,omitempty"`
	// DataAttributes
	// DataDictionary
	// UsageExamples
	Resources *struct {
		Documentation string `json:"documentation,omitempty" yaml:"documentation,omitempty"`
		Media         string `json:"media,omitempty" yaml:"media,omitempty"`
	} `json:"resources,omitempty" yaml:"resources,omitempty"`
}

https://other-docs.snowflake.com/en/progaccess/listing-manifest-reference

type Listings

type Listings interface {
	Create(ctx context.Context, id string, opts *CreateListingOptions) error
	Alter(ctx context.Context, id string, opts *AlterListingOptions) error
	Show(ctx context.Context) ([]Listing, error)
	Describe(ctx context.Context, id string) (*ListingDetails, error)
	Drop(ctx context.Context, id string, opts *DropListingOptions) error
}

type ManifestContainer

type ManifestContainer struct {
	Name    string   `json:"name"`
	Image   string   `json:"image"`
	Command []string `json:"command"`
	Args    []string `json:"args"`
	Env     []string `json:"env"`

	ReadinessProbe struct {
		Port int    `json:"port"`
		Path string `json:"path"`
	} `json:"readinessProbe"`

	VolumeMounts []struct {
		Name      string `json:"name"`
		MountPath string `json:"mountPath"`
	}

	Resources struct {
		Requests struct {
			Memory       string `json:"memory"`
			CPU          string `json:"cpu"`
			NvidiaComGpu int    `json:"nvidia.com/gpu"`
		} `json:"requests"`

		Limits struct {
			Memory       string `json:"memory"`
			CPU          string `json:"cpu"`
			NvidiaComGpu int    `json:"nvidia.com/gpu"`
		} `json:"limits"`
	} `json:"resources"`

	Secrets []struct {
		SnowflakeSecret string `json:"snowflake_secret"`
		SecretKeyRef    string `json:"secretKeyRef"`
		EnvVarName      string `json:"envVarName"`
		DirectoryPath   string `json:"directoryPath"`
	} `json:"secrets"`
}

type ManifestEndpoint

type ManifestEndpoint struct {
	Name     string `json:"name"`
	Port     int    `json:"port"`
	Public   bool   `json:"public"`
	Protocol string `json:"protocol"`
}

type ManifestServiceRole

type ManifestServiceRole struct {
	Name      string   `json:"name"`
	Endpoints []string `json:"endpoints"`
}

type ManifestVolume

type ManifestVolume struct {
	Name        string `json:"name"`
	Source      string `json:"source"`
	Size        string `json:"size"`
	BlockConfig *struct {
		InitialContents struct {
			FromSnapshot string `json:"fromSnapshot"`
		} `json:"initialContents"`
	} `json:"blockConfig"`
	Uid int `json:"uid"`
	Gid int `json:"gid"`
}

type PutFileOptions

type PutFileOptions struct {
	SourcePath      string
	DestinationPath string
	Overwrite       bool
	AutoCompress    bool
}

type ReleaseDirective

type ReleaseDirective struct {
	Name           string         `db:"name"`
	TargetType     sql.NullString `db:"target_type"`
	TargetName     sql.NullString `db:"target_name"`
	CreatedOn      sql.NullTime   `db:"created_on"`
	Version        string         `db:"version"`
	Patch          int            `db:"patch"`
	ModifiedOn     sql.NullTime   `db:"modified_on"`
	ActiveRegions  string         `db:"active_regions"`
	PendingRegions sql.NullString `db:"pending_regions"`
	ReleaseStatus  string         `db:"release_status"`
	DeployedOn     sql.NullTime   `db:"deployed_on"`
}

type ReleaseDirectives

type ReleaseDirectives interface {
	Show(ctx context.Context, id sdk.AccountObjectIdentifier) ([]ReleaseDirective, error)
}

type Secret

type Secret struct {
	CreatedOn     string         `db:"created_on"`
	Name          string         `db:"name"`
	SchemaName    string         `db:"schema_name"`
	DatabaseName  string         `db:"database_name"`
	Owner         string         `db:"owner"`
	Comment       sql.NullString `db:"comment"`
	SecretType    string         `db:"secret_type"`
	OAuthScopes   sql.NullString `db:"oauth_scopes"`
	OwnerRoleType string         `db:"owner_role_type"`
}

type Secrets

type Secrets interface {
	Show(ctx context.Context, opts *ShowSecretsOptions) ([]Secret, error)
	Drop(ctx context.Context, opts *DropSecretsOptions) error
}

type Service

type Service struct {
	Name                      string         `db:"name"`
	Status                    string         `db:"status"`
	DatabaseName              string         `db:"database_name"`
	SchemaName                string         `db:"schema_name"`
	Owner                     string         `db:"owner"`
	ComputePool               string         `db:"compute_pool"`
	DNSName                   string         `db:"dns_name"`
	MinInstances              int            `db:"min_instances"`
	MaxInstances              int            `db:"max_instances"`
	AutoResume                bool           `db:"auto_resume"`
	ExternalAccessIntegration string         `db:"external_access_integration"`
	CreatedOn                 sql.NullTime   `db:"created_on"`
	UpdatedOn                 sql.NullTime   `db:"updated_on"`
	ResumedOn                 sql.NullTime   `db:"resumed_on"`
	Comment                   sql.NullString `db:"comment"`
	OwnerRoleType             string         `db:"owner_role_type"`
	QueryWarehouse            sql.NullString `db:"query_warehouse"`
	IsJob                     bool           `db:"is_job"`
}

type ServiceContainer

type ServiceContainer struct {
	DatabaseName  string `db:"database_name"`
	SchemaName    string `db:"schema_name"`
	ServiceName   string `db:"service_name"`
	InstanceId    int    `db:"instance_id"`
	ContainerName string `db:"container_name"`
	Status        string `db:"status"`
	Message       string `db:"message"`
	ImageName     string `db:"image_name"`
	ImageDigest   string `db:"image_digest"`
	RestartCount  int    `db:"restart_count"`
	StartTime     string `db:"start_time"`
}

type ServiceContainers

type ServiceContainers interface {
	Show(ctx context.Context, id *sdk.SchemaObjectIdentifier) ([]ServiceContainer, error)
}

type ServiceDetails

type ServiceDetails struct {
	Name                      string       `db:"name"`
	DatabaseName              string       `db:"database_name"`
	SchemaName                string       `db:"schema_name"`
	Owner                     string       `db:"owner"`
	ComputePool               string       `db:"compute_pool"`
	DNSName                   string       `db:"dns_name"`
	MinInstances              int          `db:"min_instances"`
	MaxInstances              int          `db:"max_instances"`
	AutoResume                bool         `db:"auto_resume"`
	ExternalAccessIntegration string       `db:"external_access_integration"`
	CreatedOn                 sql.NullTime `db:"created_on"`
	UpdatedOn                 sql.NullTime `db:"updated_on"`
	ResumedOn                 sql.NullTime `db:"resumed_on"`
	Comment                   string       `db:"comment"`
	OwnerRoleType             string       `db:"owner_role_type"`
	QueryWarehouse            string       `db:"query_warehouse"`
	IsJob                     bool         `db:"is_job"`
}

type ServiceInstance

type ServiceInstance struct {
	DatabaseName string `db:"database_name"`
	SchemaName   string `db:"schema_name"`
	ServiceName  string `db:"service_name"`
	InstanceId   int    `db:"instance_id"`
	Status       string `db:"status"`
	SpecDigest   string `db:"spec_digest"`
	CreationTime string `db:"creation_time"`
	StartTime    string `db:"start_time"`
}

type ServiceInstances

type ServiceInstances interface {
	Show(ctx context.Context, id *sdk.SchemaObjectIdentifier) ([]ServiceInstance, error)
}

type ServiceManifest

type ServiceManifest struct {
	Spec struct {
		Containers []*ManifestContainer `json:"containers"`
		Endpoints  []*ManifestEndpoint  `json:"endpoints"`
		Volumes    []*ManifestVolume    `json:"volumes"`

		LogExporters struct {
			EventTableConfig struct {
				LogLevel string `json:"logLevel"`
			} `json:"eventTableConfig"`
		}

		ServiceRoles []*ManifestServiceRole `json:"serviceRoles"`
	} `json:"spec"`
}

type ShowImageRepositoryOptions

type ShowImageRepositoryOptions struct {
	Database *sdk.AccountObjectIdentifier
	Schema   *sdk.DatabaseObjectIdentifier
}

type ShowSecretsOptions

type ShowSecretsOptions struct {
	Database           *sdk.AccountObjectIdentifier
	Schema             *sdk.DatabaseObjectIdentifier
	Application        *sdk.AccountObjectIdentifier
	ApplicationPackage *sdk.AccountObjectIdentifier
}

type ShowServiceOptions

type ShowServiceOptions struct {
	ComputePool *sdk.AccountObjectIdentifier
	Database    *sdk.AccountObjectIdentifier
	Schema      *sdk.DatabaseObjectIdentifier
}

type ShowSnapshotOptions

type ShowSnapshotOptions struct {
	Database *sdk.AccountObjectIdentifier
	Schema   *sdk.DatabaseObjectIdentifier
}

type Snapshot

type Snapshot struct {
	Name          string         `db:"name"`
	State         string         `db:"state"`
	DatabaseName  string         `db:"database_name"`
	SchemaName    string         `db:"schema_name"`
	ServiceName   string         `db:"service_name"`
	VolumeName    string         `db:"volume_name"`
	Instance      int            `db:"instance"`
	Size          string         `db:"size"`
	Comment       sql.NullString `db:"comment"`
	Owner         string         `db:"owner"`
	OwnerRoleType string         `db:"owner_role_type"`
	CreatedOn     string         `db:"created_on"`
	UpdatedOn     string         `db:"updated_on"`
}

type Snapshots

type Snapshots interface {
	Show(ctx context.Context, opts *ShowSnapshotOptions) ([]Snapshot, error)
	Drop(ctx context.Context, opts *DropSnapshotOptions) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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