export

package
v3.22.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: GPL-3.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeExportEndpoint

func MakeExportEndpoint(c Component) endpoint.Endpoint

MakeExportEndpoint makes endpoint that reads the config in DB.

func MakeHTTPExportHandler

func MakeHTTPExportHandler(e endpoint.Endpoint) *http_transport.Server

MakeHTTPExportHandler makes a HTTP handler for the export endpoint.

func MakeStoreAndExportEndpoint

func MakeStoreAndExportEndpoint(c Component) endpoint.Endpoint

MakeStoreAndExportEndpoint makes the endpoint that forces the keycloak exportation and stores the config in DB.

Types

type Component

type Component interface {
	Export(ctx context.Context) (map[string]interface{}, error)
	StoreAndExport(ctx context.Context) (map[string]interface{}, error)
}

Component is the user component interface.

func NewComponent

func NewComponent(componentName, componentVersion string, logger internal.Logger, re RealmExporter, s Storage) Component

NewComponent returns an export component.

type DB

type DB interface {
	Exec(query string, args ...interface{}) (sql.Result, error)
	QueryRow(query string, args ...interface{}) sqltypes.SQLRow
}

DB interface

type Endpoints

type Endpoints struct {
	Endpoint endpoint.Endpoint
}

Endpoints wraps a service behind a set of endpoints.

type KeycloakClient

type KeycloakClient interface {
	GetRealms(accessToken string) ([]keycloak.RealmRepresentation, error)
	ExportRealm(accessToken string, realmName string) (keycloak.RealmRepresentation, error)
}

KeycloakClient is the interface of the keycloak client.

type Module

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

Module wraps a KeycloakClient to Get/Export realms

func NewModule

func NewModule(kc KeycloakClient, logger internal.Logger) *Module

NewModule returns a user module.

func (*Module) ExportRealm

func (m *Module) ExportRealm(ctx context.Context, realmName string) (keycloak.RealmRepresentation, error)

ExportRealm exports the desired realm.

func (*Module) GetRealms

func (m *Module) GetRealms(ctx context.Context) ([]string, error)

GetRealms returns the list of all realms.

type RealmExporter

type RealmExporter interface {
	GetRealms(ctx context.Context) ([]string, error)
	ExportRealm(ctx context.Context, realmName string) (keycloak.RealmRepresentation, error)
}

RealmExporter interface

type Storage

type Storage interface {
	Save(componentName, version string, config []byte) error
	Read(componentName, version string) ([]byte, error)
}

Storage interface

type StorageModule

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

StorageModule is the module that saves configs in Storage DB.

func NewConfigStorageModule

func NewConfigStorageModule(db DB) *StorageModule

NewConfigStorageModule returns the storage module.

func (*StorageModule) Read

func (c *StorageModule) Read(componentName, version string) ([]byte, error)

func (*StorageModule) Save

func (c *StorageModule) Save(componentName, version string, config []byte) error

Save is used to save config in database

Jump to

Keyboard shortcuts

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