scope

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProviderClient

func NewProviderClient(cloud clientconfig.Cloud, caCert []byte, logger logr.Logger) (*gophercloud.ProviderClient, *clientconfig.ClientOpts, string, error)

Types

type Factory

type Factory interface {
	NewClientScopeFromMachine(ctx context.Context, ctrlClient client.Client, openStackMachine *infrav1.OpenStackMachine, defaultCACert []byte, logger logr.Logger) (Scope, error)
	NewClientScopeFromCluster(ctx context.Context, ctrlClient client.Client, openStackCluster *infrav1.OpenStackCluster, defaultCACert []byte, logger logr.Logger) (Scope, error)
}

Factory instantiates a new Scope using credentials from either a cluster or a machine.

func NewFactory

func NewFactory(maxCacheSize int) Factory

NewFactory creates the default scope factory. It generates service clients which make OpenStack API calls against a running cloud.

type MockScopeFactory

type MockScopeFactory struct {
	ComputeClient *mock.MockComputeClient
	NetworkClient *mock.MockNetworkClient
	VolumeClient  *mock.MockVolumeClient
	ImageClient   *mock.MockImageClient
	LbClient      *mock.MockLbClient
	// contains filtered or unexported fields
}

MockScopeFactory implements both the ScopeFactory and ClientScope interfaces. It can be used in place of the default ProviderScopeFactory when we want to use mocked service clients which do not attempt to connect to a running OpenStack cloud.

func NewMockScopeFactory

func NewMockScopeFactory(mockCtrl *gomock.Controller, projectID string, logger logr.Logger) *MockScopeFactory

func (*MockScopeFactory) ExtractToken

func (f *MockScopeFactory) ExtractToken() (*tokens.Token, error)

func (*MockScopeFactory) Logger

func (f *MockScopeFactory) Logger() logr.Logger

func (*MockScopeFactory) NewClientScopeFromCluster

func (f *MockScopeFactory) NewClientScopeFromCluster(_ context.Context, _ client.Client, _ *infrav1.OpenStackCluster, _ []byte, _ logr.Logger) (Scope, error)

func (*MockScopeFactory) NewClientScopeFromMachine

func (f *MockScopeFactory) NewClientScopeFromMachine(_ context.Context, _ client.Client, _ *infrav1.OpenStackMachine, _ []byte, _ logr.Logger) (Scope, error)

func (*MockScopeFactory) NewComputeClient

func (f *MockScopeFactory) NewComputeClient() (clients.ComputeClient, error)

func (*MockScopeFactory) NewImageClient

func (f *MockScopeFactory) NewImageClient() (clients.ImageClient, error)

func (*MockScopeFactory) NewLbClient

func (f *MockScopeFactory) NewLbClient() (clients.LbClient, error)

func (*MockScopeFactory) NewNetworkClient

func (f *MockScopeFactory) NewNetworkClient() (clients.NetworkClient, error)

func (*MockScopeFactory) NewVolumeClient

func (f *MockScopeFactory) NewVolumeClient() (clients.VolumeClient, error)

func (*MockScopeFactory) ProjectID

func (f *MockScopeFactory) ProjectID() string

func (*MockScopeFactory) SetClientScopeCreateError

func (f *MockScopeFactory) SetClientScopeCreateError(err error)

type Scope

type Scope interface {
	NewComputeClient() (clients.ComputeClient, error)
	NewVolumeClient() (clients.VolumeClient, error)
	NewImageClient() (clients.ImageClient, error)
	NewNetworkClient() (clients.NetworkClient, error)
	NewLbClient() (clients.LbClient, error)
	Logger() logr.Logger
	ProjectID() string
	ExtractToken() (*tokens.Token, error)
}

Scope contains arguments common to most operations.

func NewCachedProviderScope

func NewCachedProviderScope(cache *cache.LRUExpireCache, cloud clientconfig.Cloud, caCert []byte, logger logr.Logger) (Scope, error)

func NewProviderScope

func NewProviderScope(cloud clientconfig.Cloud, caCert []byte, logger logr.Logger) (Scope, error)

Jump to

Keyboard shortcuts

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