Help us shape the future of Go! Take the 2026 Go Developer Survey

mocks

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockClient

type MockClient struct {
	DetectNetworkForIPFunc func(ctx context.Context, ipAddress string) (string, string, error)

	CreatePortFunc func(
		ctx context.Context,
		networkID, subnetID, portName, ipAddress, description string,
		serviceNamespace, serviceName string,
	) (string, error)

	GetPortFunc         func(ctx context.Context, portID string) (bool, error)
	DeletePortFunc      func(ctx context.Context, portID string) error
	GetManagedPortsFunc func(ctx context.Context, serviceNamespace, serviceName string) ([]ports.Port, error)

	CreateFloatingIPFunc func(
		ctx context.Context,
		networkID, portID, description string,
		serviceNamespace, serviceName string,
	) (string, string, error)

	GetFloatingIPFunc         func(ctx context.Context, floatingIPID string) (bool, error)
	DeleteFloatingIPFunc      func(ctx context.Context, floatingIPID string) error
	GetFloatingIPByPortIDFunc func(ctx context.Context, portID string) (string, string, error)

	GetManagedFloatingIPsFunc func(
		ctx context.Context,
		serviceNamespace, serviceName string,
	) ([]floatingips.FloatingIP, error)

	GetAllFloatingIPsFunc    func(ctx context.Context) ([]floatingips.FloatingIP, error)
	GetAllPortsFunc          func(ctx context.Context) ([]ports.Port, error)
	GetFloatingIPDetailsFunc func(ctx context.Context, floatingIPID string) (*floatingips.FloatingIP, error)
}

MockClient is a mock implementation of the OpenStack client for testing

func (*MockClient) CreateFloatingIP

func (m *MockClient) CreateFloatingIP(
	ctx context.Context,
	networkID, portID, description string,
	serviceNamespace, serviceName string,
) (string, string, error)

CreateFloatingIP implements the corresponding interface method

func (*MockClient) CreatePort

func (m *MockClient) CreatePort(
	ctx context.Context,
	networkID, subnetID, portName, ipAddress, description string,
	serviceNamespace, serviceName string,
) (string, error)

CreatePort implements the corresponding interface method

func (*MockClient) DeleteFloatingIP

func (m *MockClient) DeleteFloatingIP(ctx context.Context, floatingIPID string) error

DeleteFloatingIP implements the corresponding interface method

func (*MockClient) DeletePort

func (m *MockClient) DeletePort(ctx context.Context, portID string) error

DeletePort implements the corresponding interface method

func (*MockClient) DetectNetworkForIP

func (m *MockClient) DetectNetworkForIP(ctx context.Context, ipAddress string) (string, string, error)

DetectNetworkForIP implements the corresponding interface method

func (*MockClient) GetAllFloatingIPs

func (m *MockClient) GetAllFloatingIPs(ctx context.Context) ([]floatingips.FloatingIP, error)

GetAllFloatingIPs implements the corresponding interface method

func (*MockClient) GetAllPorts

func (m *MockClient) GetAllPorts(ctx context.Context) ([]ports.Port, error)

GetAllPorts implements the corresponding interface method

func (*MockClient) GetFloatingIP

func (m *MockClient) GetFloatingIP(ctx context.Context, floatingIPID string) (bool, error)

GetFloatingIP implements the corresponding interface method

func (*MockClient) GetFloatingIPByPortID

func (m *MockClient) GetFloatingIPByPortID(ctx context.Context, portID string) (string, string, error)

GetFloatingIPByPortID implements the corresponding interface method

func (*MockClient) GetFloatingIPDetails added in v0.3.0

func (m *MockClient) GetFloatingIPDetails(ctx context.Context, floatingIPID string) (*floatingips.FloatingIP, error)

func (*MockClient) GetManagedFloatingIPs

func (m *MockClient) GetManagedFloatingIPs(
	ctx context.Context,
	serviceNamespace, serviceName string,
) ([]floatingips.FloatingIP, error)

GetManagedFloatingIPs implements the corresponding interface method

func (*MockClient) GetManagedPorts

func (m *MockClient) GetManagedPorts(ctx context.Context, serviceNamespace, serviceName string) ([]ports.Port, error)

GetManagedPorts implements the corresponding interface method

func (*MockClient) GetPort

func (m *MockClient) GetPort(ctx context.Context, portID string) (bool, error)

GetPort implements the corresponding interface method

Jump to

Keyboard shortcuts

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