model

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package model contains application data structures and small struct methods

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DesiredState

type DesiredState struct {
	// Extensions is a list of Postgres extensions (e.g. postgres_fdw)
	Extensions []Extension `yaml:"Extensions,omitempty" json:"Extensions,omitempty"`
	// Servers is a list of foreign servers
	Servers []ForeignServer `yaml:"Servers,omitempty" json:"Servers,omitempty"`
}

DesiredState is the data structure that describes the desired state to apply to the FDW database

func (DesiredState) String

func (d DesiredState) String() string

type Extension

type Extension struct {
	Name    string `yaml:"name" json:"name"`
	Version string `yaml:"-" json:"-"`
}

Extension represents a Postgres extension

func (*Extension) Equals

func (ex *Extension) Equals(ext Extension) bool

Equals determines if this object is equal to the supplied object

func (*Extension) String

func (ex *Extension) String() string

type ForeignServer

type ForeignServer struct {
	Name     string    `yaml:"name" json:"name"`
	Host     string    `yaml:"host" json:"host"`
	DB       string    `yaml:"db" json:"db"`
	Wrapper  string    `yaml:"wrapper,omitempty" json:"wrapper,omitempty"`
	Owner    string    `yaml:"-" json:"-"`
	UserMaps []UserMap `yaml:"UserMap,omitempty" json:"UserMap,omitempty"`
	Schemas  []Schema  `yaml:"Schemas,omitempty" json:"Schemas,omitempty"`
	Port     int       `yaml:"port" json:"port"`
}

ForeignServer represents a Postgres foreign server including related user mappings and remote schemas

func (*ForeignServer) Equals

func (fs *ForeignServer) Equals(fserver ForeignServer) bool

Equals determines if this object is equal to the supplied object

func (*ForeignServer) String

func (fs *ForeignServer) String() string

type Grants

type Grants struct {
	// Users is the list of users to apply the permissions to
	Users []string `yaml:"users" json:"users"`
}

Grants represents a permission configuration for an imported remote schema

func (Grants) String

func (g Grants) String() string

type Schema

type Schema struct {
	ENUMSecret     Secret `yaml:"enumsecret,omitempty" json:"enumsecret,omitempty"`
	ServerName     string `yaml:"-" json:"-"`
	LocalSchema    string `yaml:"localschema" json:"localschema"`
	RemoteSchema   string `yaml:"remoteschema" json:"remoteschema"`
	ENUMConnection string `yaml:"enumconnection,omitempty" json:"enumconnection,omitempty"`
	SchemaGrants   Grants `yaml:"grants,omitempty" json:"grants,omitempty"`
	ImportENUMs    bool   `yaml:"importenums" json:"importenums"`
}

Schema represents a foreign schema configuration

func (Schema) String

func (s Schema) String() string

type SchemaEnum

type SchemaEnum struct {
	Schema string
	Name   string
}

func (*SchemaEnum) String

func (se *SchemaEnum) String() string

type Secret

type Secret struct {
	// Value represents an explicit credential value to be used verbatim
	Value string `yaml:"value,omitempty" json:"value,omitempty"`
	// FromEnv represents an environment variable to read the credential from
	FromEnv string `yaml:"fromEnv,omitempty" json:"fromEnv,omitempty"`
	// FromFile represents a path and filename to read the credential from
	FromFile string `yaml:"fromFile,omitempty" json:"fromFile,omitempty"`
	// FromK8sSecret represents a Kubernetes secret to read the credential from
	FromK8sSecret SecretK8s `yaml:"fromK8s,omitempty" json:"fromK8s,omitempty"`
}

Secret defines where to retrieve a credential from

func (*Secret) Equals

func (s *Secret) Equals(secret Secret) bool

Equals determines if this object is equal to the supplied object

func (*Secret) IsDefined

func (s *Secret) IsDefined() bool

func (*Secret) String

func (s *Secret) String() string

type SecretK8s

type SecretK8s struct {
	// Namespace is the Kubernetes namespace that contains the secret
	Namespace string `yaml:"namespace" json:"namespace"`
	// SecretName is the name of the Kubernetes secret object
	SecretName string `yaml:"secretName" json:"secretName"`
	// SecretKey is the name of the key underneath .data which contains the credential
	SecretKey string `yaml:"secretKey" json:"secretKey"`
}

SecretK8s represents the location of a base64-encoded credential in a Kubernetes secret

func (*SecretK8s) Equals

func (sk *SecretK8s) Equals(secret SecretK8s) bool

Equals determines if this object is equal to the supplied object

func (*SecretK8s) String

func (sk *SecretK8s) String() string

type UserMap

type UserMap struct {
	// ServerName is the name of the foreign server
	ServerName string `yaml:"-" json:"-"`
	// LocalUser is the name of the local database user to map
	LocalUser string `yaml:"localuser" json:"localuser"`
	// RemoteUser is the name of the remote database user to connect as
	RemoteUser string `yaml:"remoteuser" json:"remoteuser"`
	// RemoteSecret configures how to retrieve the optional credential for the RemoteUser user
	RemoteSecret Secret `yaml:"remotesecret" json:"remotesecret"`
}

UserMap represents a Postgres user mapping

func (*UserMap) Equals

func (um *UserMap) Equals(umap UserMap) bool

Equals determines if this object is equal to the supplied object

func (*UserMap) String

func (um *UserMap) String() string

Jump to

Keyboard shortcuts

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