adapters

package
v0.0.0-...-e080771 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventAdapter

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

EventAdapter communicates to IncomingEventPort and implements OutgoingEventPort

func NewEventAdapter

func NewEventAdapter(connection messaging2.EventConnection) *EventAdapter

NewEventAdapter ...

func (*EventAdapter) SetHandlers

func (adapter *EventAdapter) SetHandlers(handlers ports.IncomingEventHandlers)

SetHandlers ...

func (*EventAdapter) Start

func (adapter *EventAdapter) Start(ctx context.Context, wg *sync.WaitGroup) error

Start starts the adapter

type GuacamoleAdapter

type GuacamoleAdapter struct {
	Config *types.Config
}

GuacamoleAdapter implements SessionSetupPort

func (*GuacamoleAdapter) CheckPrerequisites

func (adapter *GuacamoleAdapter) CheckPrerequisites(protocol cacao_common_service.InteractiveSessionProtocol, instanceAddress string, instanceAdminUsername string) (bool, error)

CheckPrerequisites checks if prerequisites are met for the protocol setup

func (*GuacamoleAdapter) Finalize

func (adapter *GuacamoleAdapter) Finalize()

Finalize finalizes mongodb adapter

func (*GuacamoleAdapter) Init

func (adapter *GuacamoleAdapter) Init(config *types.Config)

Init initialize session adapter

func (*GuacamoleAdapter) Setup

func (adapter *GuacamoleAdapter) Setup(user string, cloudID string, protocol cacao_common_service.InteractiveSessionProtocol, instanceAddress string, instanceAdminUsername string) (string, error)

Setup sets up a new interactive session and returns redirect URL

type MongoAdapter

type MongoAdapter struct {
	Config *types.Config
	Store  cacao_common_db.ObjectStore
}

MongoAdapter implements PersistentStoragePort

func (*MongoAdapter) Create

func (adapter *MongoAdapter) Create(interactiveSession types.InteractiveSession) error

Create inserts an interactive session

func (*MongoAdapter) DeactivateAllByInstanceID

func (adapter *MongoAdapter) DeactivateAllByInstanceID(user, instanceID string) (int64, error)

DeactivateAllByInstanceID deactivates all interactive sessions by instance ID

func (*MongoAdapter) Finalize

func (adapter *MongoAdapter) Finalize()

Finalize finalizes mongodb adapter

func (*MongoAdapter) Get

func (adapter *MongoAdapter) Get(user string, interactiveSessionID cacao_common.ID) (types.InteractiveSession, error)

Get returns the interactive session with the ID

func (*MongoAdapter) GetByInstanceAddress

func (adapter *MongoAdapter) GetByInstanceAddress(user string, instanceAddress string) (types.InteractiveSession, error)

GetByInstanceAddress returns the interactive session with the Instance Address

func (*MongoAdapter) GetByInstanceID

func (adapter *MongoAdapter) GetByInstanceID(user string, instanceID string) (types.InteractiveSession, error)

GetByInstanceID returns the interactive session with the instance ID

func (*MongoAdapter) GetMock

func (adapter *MongoAdapter) GetMock() *mock.Mock

GetMock returns Mock

func (*MongoAdapter) Init

func (adapter *MongoAdapter) Init(config *types.Config)

Init initialize mongodb adapter

func (*MongoAdapter) InitMock

func (adapter *MongoAdapter) InitMock(config *types.Config)

InitMock initialize mongodb adapter with mock_objectstore

func (*MongoAdapter) List

func (adapter *MongoAdapter) List(user string) ([]types.InteractiveSession, error)

List returns active/creating interactive sessions owned by a user

func (*MongoAdapter) MockCreate

func (adapter *MongoAdapter) MockCreate(interactiveSession types.InteractiveSession, expectedError error) error

MockCreate sets expected results for Create

func (*MongoAdapter) MockDeactivateAllByInstanceID

func (adapter *MongoAdapter) MockDeactivateAllByInstanceID(user, instanceID string, expectedRecords int, expectedError error) error

MockDeactivateAllByInstanceID sets expected results for DeactivateAllByInstanceID

func (*MongoAdapter) MockGet

func (adapter *MongoAdapter) MockGet(user string, interactiveSessionID cacao_common.ID, expectedInteractiveSession types.InteractiveSession, expectedError error) error

MockGet sets expected results for Get

func (*MongoAdapter) MockGetByInstanceAddress

func (adapter *MongoAdapter) MockGetByInstanceAddress(user string, instanceAddress string, expectedInteractiveSession types.InteractiveSession, expectedError error) error

MockGetByInstanceAddress sets expected results for GetByInstanceAddress

func (*MongoAdapter) MockGetByInstanceID

func (adapter *MongoAdapter) MockGetByInstanceID(user string, instanceID string, expectedInteractiveSession types.InteractiveSession, expectedError error) error

MockGetByInstanceID sets expected results for GetByInstanceID

func (*MongoAdapter) MockList

func (adapter *MongoAdapter) MockList(user string, expectedInteractiveSessions []types.InteractiveSession, expectedError error) error

MockList sets expected results for List

func (*MongoAdapter) MockUpdate

func (adapter *MongoAdapter) MockUpdate(existingInteractiveSession types.InteractiveSession, newInteractiveSession types.InteractiveSession, expectedError error) error

MockUpdate sets expected results for Update

func (*MongoAdapter) Update

func (adapter *MongoAdapter) Update(interactiveSession types.InteractiveSession, updateFieldNames []string) error

Update updates/edits an interactive session

type QueryAdapter

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

QueryAdapter communicates to IncomingQueryPort

func NewQueryAdapter

func NewQueryAdapter(connection messaging2.QueryConnection) *QueryAdapter

NewQueryAdapter ...

func (*QueryAdapter) SetHandlers

func (adapter *QueryAdapter) SetHandlers(handlers ports.IncomingQueryHandlers)

SetHandlers ...

func (*QueryAdapter) Start

func (adapter *QueryAdapter) Start(ctx context.Context, wg *sync.WaitGroup) error

Start starts the adapter

func (*QueryAdapter) Wait

func (adapter *QueryAdapter) Wait()

Wait for QueryAdapter to shut down properly

Jump to

Keyboard shortcuts

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