model

package
v0.0.0-...-465781a Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: MIT Imports: 0 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

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

type ForeignServer

type ForeignServer struct {
	// Name is the display name of the foreign server
	Name string `yaml:"name" json:"name"`
	// Host is the hostname of the foreign server
	Host string `yaml:"host" json:"host"`
	// Port is the port number of the foreign server
	Port int `yaml:"port" json:"port"`
	// DB is the name of the database on the foreign server
	DB string `yaml:"db" json:"db"`
	// Wrapper is the name of the foreign data wrapper to use with this foreign server
	Wrapper string `yaml:"wrapper,omitempty" json:"wrapper,omitempty"`
	// Owner is the owner of the foreign server
	Owner string `yaml:"-" json:"-"`
	// UserMaps is the list of user mappings to create using this foreign server
	UserMaps []UserMap `yaml:"UserMap,omitempty" json:"UserMap,omitempty"`
	// Schemas is the list of remote schemas to import from this foreign server
	Schemas []Schema `yaml:"Schemas,omitempty" json:"Schemas,omitempty"`
}

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

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 permissions configuration for an imported remote schema

type Schema

type Schema struct {
	// ServerName is the name of the foreign server that will be used to import the remote schema
	ServerName string `yaml:"-" json:"-"`
	// LocalSchema is the name of the local schema that the remote schema will be imported into
	LocalSchema string `yaml:"localschema" json:"localschema"`
	// RemoteSchema is the name of the remote schema to import
	RemoteSchema string `yaml:"remoteschema" json:"remoteschema"`
	// ImportENUMs indicates whether remote ENUM types should be auto-created locally before importing
	ImportENUMs bool `yaml:"importenums" json:"importenums"`
	// ENUMConnection specifies the connection string to the remote database for reading ENUM definitions
	ENUMConnection string `yaml:"enumconnection,omitempty" json:"enumconnection,omitempty"`
	// ENUMSecret configures how to retrieve the optional credential for the ENUMConnection connection string
	ENUMSecret Secret `yaml:"enumsecret,omitempty" json:"enumsecret,omitempty"`
	// SchemaGrants is the permission configuration for this foreign schema
	SchemaGrants Grants `yaml:"grants,omitempty" json:"grants,omitempty"`
}

Schema represents a foreign schema configuration

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

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

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

Jump to

Keyboard shortcuts

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