helpers

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: May 16, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SDKAPIFactoryKey = Key{}

A Key used to store the SDKFactory in a Context

Functions

func GetAllGatewayConsumers

func GetAllGatewayConsumers(ctx context.Context, requestPageSize int64, cpID string, kkClient *kk.SDK,
) ([]kkComps.Consumer, error)

func GetAllGatewayRoutes

func GetAllGatewayRoutes(ctx context.Context, requestPageSize int64, cpID string, kkClient *kk.SDK,
) ([]kkComps.Route, error)

func GetAllGatewayServices

func GetAllGatewayServices(ctx context.Context, requestPageSize int64, cpID string, kkClient *kk.SDK,
) ([]kkComps.ServiceOutput, error)

func GetControlPlaneID

func GetControlPlaneID(ctx context.Context, kkClient ControlPlaneAPI, cpName string) (string, error)

Types

type ControlPlaneAPI

type ControlPlaneAPI interface {
	ListControlPlanes(ctx context.Context, request kkOPS.ListControlPlanesRequest,
		opts ...kkOPS.Option) (*kkOPS.ListControlPlanesResponse, error)
	CreateControlPlane(ctx context.Context, request kkCOM.CreateControlPlaneRequest,
		opts ...kkOPS.Option) (*kkOPS.CreateControlPlaneResponse, error)
	GetControlPlane(ctx context.Context, id string,
		opts ...kkOPS.Option) (*kkOPS.GetControlPlaneResponse, error)
	UpdateControlPlane(ctx context.Context, id string, updateControlPlaneRequest kkCOM.UpdateControlPlaneRequest,
		opts ...kkOPS.Option) (*kkOPS.UpdateControlPlaneResponse, error)
	DeleteControlPlane(ctx context.Context, id string,
		opts ...kkOPS.Option) (*kkOPS.DeleteControlPlaneResponse, error)
}

type Key

type Key struct{}

type KonnectSDK

type KonnectSDK struct {
	SDK *kkSDK.SDK
}

This is the real implementation of the SDKAPI which wraps the actual SDK implmentation

func (*KonnectSDK) GetControlPlaneAPI

func (k *KonnectSDK) GetControlPlaneAPI() ControlPlaneAPI

Returns the real implementation of the GetControlPlaneAPI from the Konnect SDK

type MockControlPlaneAPI

type MockControlPlaneAPI struct {
	mock.Mock
}

MockControlPlaneAPI is an autogenerated mock type for the ControlPlaneAPI type

func NewMockControlPlaneAPI

func NewMockControlPlaneAPI(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockControlPlaneAPI

NewMockControlPlaneAPI creates a new instance of MockControlPlaneAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockControlPlaneAPI) CreateControlPlane

CreateControlPlane provides a mock function with given fields: ctx, request, opts

func (*MockControlPlaneAPI) DeleteControlPlane

DeleteControlPlane provides a mock function with given fields: ctx, id, opts

func (*MockControlPlaneAPI) EXPECT

func (*MockControlPlaneAPI) GetControlPlane

GetControlPlane provides a mock function with given fields: ctx, id, opts

func (*MockControlPlaneAPI) ListControlPlanes

ListControlPlanes provides a mock function with given fields: ctx, request, opts

func (*MockControlPlaneAPI) UpdateControlPlane

func (_m *MockControlPlaneAPI) UpdateControlPlane(ctx context.Context, id string, updateControlPlaneRequest components.UpdateControlPlaneRequest, opts ...operations.Option) (*operations.UpdateControlPlaneResponse, error)

UpdateControlPlane provides a mock function with given fields: ctx, id, updateControlPlaneRequest, opts

type MockControlPlaneAPI_CreateControlPlane_Call

type MockControlPlaneAPI_CreateControlPlane_Call struct {
	*mock.Call
}

MockControlPlaneAPI_CreateControlPlane_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateControlPlane'

func (*MockControlPlaneAPI_CreateControlPlane_Call) Return

func (*MockControlPlaneAPI_CreateControlPlane_Call) Run

type MockControlPlaneAPI_DeleteControlPlane_Call

type MockControlPlaneAPI_DeleteControlPlane_Call struct {
	*mock.Call
}

MockControlPlaneAPI_DeleteControlPlane_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteControlPlane'

func (*MockControlPlaneAPI_DeleteControlPlane_Call) Return

func (*MockControlPlaneAPI_DeleteControlPlane_Call) Run

type MockControlPlaneAPI_Expecter

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

func (*MockControlPlaneAPI_Expecter) CreateControlPlane

func (_e *MockControlPlaneAPI_Expecter) CreateControlPlane(ctx interface{}, request interface{}, opts ...interface{}) *MockControlPlaneAPI_CreateControlPlane_Call

CreateControlPlane is a helper method to define mock.On call

  • ctx context.Context
  • request components.CreateControlPlaneRequest
  • opts ...operations.Option

func (*MockControlPlaneAPI_Expecter) DeleteControlPlane

func (_e *MockControlPlaneAPI_Expecter) DeleteControlPlane(ctx interface{}, id interface{}, opts ...interface{}) *MockControlPlaneAPI_DeleteControlPlane_Call

DeleteControlPlane is a helper method to define mock.On call

  • ctx context.Context
  • id string
  • opts ...operations.Option

func (*MockControlPlaneAPI_Expecter) GetControlPlane

func (_e *MockControlPlaneAPI_Expecter) GetControlPlane(ctx interface{}, id interface{}, opts ...interface{}) *MockControlPlaneAPI_GetControlPlane_Call

GetControlPlane is a helper method to define mock.On call

  • ctx context.Context
  • id string
  • opts ...operations.Option

func (*MockControlPlaneAPI_Expecter) ListControlPlanes

func (_e *MockControlPlaneAPI_Expecter) ListControlPlanes(ctx interface{}, request interface{}, opts ...interface{}) *MockControlPlaneAPI_ListControlPlanes_Call

ListControlPlanes is a helper method to define mock.On call

  • ctx context.Context
  • request operations.ListControlPlanesRequest
  • opts ...operations.Option

func (*MockControlPlaneAPI_Expecter) UpdateControlPlane

func (_e *MockControlPlaneAPI_Expecter) UpdateControlPlane(ctx interface{}, id interface{}, updateControlPlaneRequest interface{}, opts ...interface{}) *MockControlPlaneAPI_UpdateControlPlane_Call

UpdateControlPlane is a helper method to define mock.On call

  • ctx context.Context
  • id string
  • updateControlPlaneRequest components.UpdateControlPlaneRequest
  • opts ...operations.Option

type MockControlPlaneAPI_GetControlPlane_Call

type MockControlPlaneAPI_GetControlPlane_Call struct {
	*mock.Call
}

MockControlPlaneAPI_GetControlPlane_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetControlPlane'

func (*MockControlPlaneAPI_GetControlPlane_Call) Return

func (*MockControlPlaneAPI_GetControlPlane_Call) Run

type MockControlPlaneAPI_ListControlPlanes_Call

type MockControlPlaneAPI_ListControlPlanes_Call struct {
	*mock.Call
}

MockControlPlaneAPI_ListControlPlanes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListControlPlanes'

func (*MockControlPlaneAPI_ListControlPlanes_Call) Return

func (*MockControlPlaneAPI_ListControlPlanes_Call) Run

type MockControlPlaneAPI_UpdateControlPlane_Call

type MockControlPlaneAPI_UpdateControlPlane_Call struct {
	*mock.Call
}

MockControlPlaneAPI_UpdateControlPlane_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateControlPlane'

func (*MockControlPlaneAPI_UpdateControlPlane_Call) Return

func (*MockControlPlaneAPI_UpdateControlPlane_Call) Run

type MockKonnectSDK

type MockKonnectSDK struct {
	Token        string
	T            *testing.T
	CPAPIFactory func() ControlPlaneAPI
}

This is a mock implementation of the SDKAPI interface

func (*MockKonnectSDK) GetControlPlaneAPI

func (m *MockKonnectSDK) GetControlPlaneAPI() ControlPlaneAPI

Returns a mock instance of the ControlPlaneAPI

type MockKonnectSDKFactory

type MockKonnectSDKFactory struct {
	T *testing.T
}

This is a mock implementation of the SDKFactory interface which can associate a Testing.T instance with any MockKonnectSDK instances Built by it

func (*MockKonnectSDKFactory) Build

func (m *MockKonnectSDKFactory) Build(token string) (SDKAPI, error)

Returns the mock implementation of the SDKAPI interface

type SDKAPI

type SDKAPI interface {
	GetControlPlaneAPI() ControlPlaneAPI
}

Provides an interface for the Konnect Go SDK "github.com/Kong/sdk-konnect-go" SDK struct allowing for easier testing and mocking

type SDKAPIFactory added in v0.0.13

type SDKAPIFactory func(cfg config.Hook, logger *slog.Logger) (SDKAPI, error)

A function that can build an SDKAPI with a given configuration

Jump to

Keyboard shortcuts

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