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

handlers

package
v0.0.63 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WTLocations               = "WALKTHROUGH_LOCATIONS"
	IntegreatlyVersion        = "INTEGREATLY_VERSION"
	ClusterType               = "CLUSTER_TYPE"
	OpenShiftVersion          = "OPENSHIFT_VERSION"
	OpenShiftAPIHost          = "OPENSHIFT_API"
	InstalledServices         = "INSTALLED_SERVICES"
	InstallationType          = "INSTALLATION_TYPE"
	WTLocationsDefault        = "https://github.com/integr8ly/tutorial-web-app-walkthroughs#v1.12.3"
	IntegreatlyVersionDefault = "not set"
	ClusterTypeDefault        = "not set"
	OpenShiftVersionDefault   = "3"
	OpenShiftAPIHostDefault   = "openshift.default.svc"
	WebAppImage               = "quay.io/integreatly/tutorial-web-app:2.28.1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppHandler

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

func NewWebHandler

func NewWebHandler(m *metrics.Metrics, osClient openshift.OSClientInterface, factory ClientFactory, cruder SdkCruder) AppHandler

func (*AppHandler) CreateRoute added in v0.0.48

func (h *AppHandler) CreateRoute(cr *v1alpha1.WebApp) *routev1.Route

func (*AppHandler) Delete

func (h *AppHandler) Delete(cr *v1alpha1.WebApp) error

func (*AppHandler) GetRuntimeObjs

func (h *AppHandler) GetRuntimeObjs(exts []runtime.RawExtension) ([]runtime.Object, error)

func (*AppHandler) Handle

func (h *AppHandler) Handle(ctx context.Context, event sdk.Event) error

func (*AppHandler) IsAppReady

func (h *AppHandler) IsAppReady(cr *v1alpha1.WebApp) bool

func (*AppHandler) ProcessTemplate

func (h *AppHandler) ProcessTemplate(cr *v1alpha1.WebApp) ([]runtime.RawExtension, error)

func (*AppHandler) ProvisionObjects

func (h *AppHandler) ProvisionObjects(objects []runtime.Object, cr *v1alpha1.WebApp) error

func (*AppHandler) SetStatus

func (h *AppHandler) SetStatus(msg string, cr *v1alpha1.WebApp)

type ClientFactory

type ClientFactory func(apiVersion, kind, namespace string) (dynamic.ResourceInterface, string, error)

type Handler

type Handler interface {
	Handle(ctx context.Context, event sdk.Event) error
	Delete(cr *v1alpha1.WebApp) error
	SetStatus(msg string, cr *v1alpha1.WebApp)
	ProcessTemplate(cr *v1alpha1.WebApp) ([]runtime.RawExtension, error)
	GetRuntimeObjs(exts []runtime.RawExtension) ([]runtime.Object, error)
	ProvisionObjects(objects []runtime.Object, cr *v1alpha1.WebApp) error
	IsAppReady(cr *v1alpha1.WebApp) bool
}

type Handlers

type Handlers struct {
	WebAppHandler Handler
}

func NewHandler

func NewHandler(webHandler Handler) Handlers

type Metrics

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

type SdkCruder

type SdkCruder interface {
	Create(object sdk.Object) error
	Update(object sdk.Object) error
	Delete(object sdk.Object, opts ...sdk.DeleteOption) error
	Get(object sdk.Object, opts ...sdk.GetOption) error
	List(namespace string, into sdk.Object, opts ...sdk.ListOption) error
}

type SdkCruderMock

type SdkCruderMock struct {
	// CreateFunc mocks the Create method.
	CreateFunc func(object sdk.Object) error

	// DeleteFunc mocks the Delete method.
	DeleteFunc func(object sdk.Object, opts ...sdk.DeleteOption) error

	// GetFunc mocks the Get method.
	GetFunc func(object sdk.Object, opts ...sdk.GetOption) error

	// ListFunc mocks the List method.
	ListFunc func(namespace string, into sdk.Object, opts ...sdk.ListOption) error

	// UpdateFunc mocks the Update method.
	UpdateFunc func(object sdk.Object) error
	// contains filtered or unexported fields
}

SdkCruderMock is a mock implementation of SdkCruder.

    func TestSomethingThatUsesSdkCruder(t *testing.T) {

        // make and configure a mocked SdkCruder
        mockedSdkCruder := &SdkCruderMock{
            CreateFunc: func(object sdk.Object) error {
	               panic("mock out the Create method")
            },
            DeleteFunc: func(object sdk.Object, opts ...sdk.DeleteOption) error {
	               panic("mock out the Delete method")
            },
            GetFunc: func(object sdk.Object, opts ...sdk.GetOption) error {
	               panic("mock out the Get method")
            },
            ListFunc: func(namespace string, into sdk.Object, opts ...sdk.ListOption) error {
	               panic("mock out the List method")
            },
            UpdateFunc: func(object sdk.Object) error {
	               panic("mock out the Update method")
            },
        }

        // use mockedSdkCruder in code that requires SdkCruder
        // and then make assertions.

    }

func (*SdkCruderMock) Create

func (mock *SdkCruderMock) Create(object sdk.Object) error

Create calls CreateFunc.

func (*SdkCruderMock) CreateCalls

func (mock *SdkCruderMock) CreateCalls() []struct {
	Object sdk.Object
}

CreateCalls gets all the calls that were made to Create. Check the length with:

len(mockedSdkCruder.CreateCalls())

func (*SdkCruderMock) Delete

func (mock *SdkCruderMock) Delete(object sdk.Object, opts ...sdk.DeleteOption) error

Delete calls DeleteFunc.

func (*SdkCruderMock) DeleteCalls

func (mock *SdkCruderMock) DeleteCalls() []struct {
	Object sdk.Object
	Opts   []sdk.DeleteOption
}

DeleteCalls gets all the calls that were made to Delete. Check the length with:

len(mockedSdkCruder.DeleteCalls())

func (*SdkCruderMock) Get

func (mock *SdkCruderMock) Get(object sdk.Object, opts ...sdk.GetOption) error

Get calls GetFunc.

func (*SdkCruderMock) GetCalls

func (mock *SdkCruderMock) GetCalls() []struct {
	Object sdk.Object
	Opts   []sdk.GetOption
}

GetCalls gets all the calls that were made to Get. Check the length with:

len(mockedSdkCruder.GetCalls())

func (*SdkCruderMock) List

func (mock *SdkCruderMock) List(namespace string, into sdk.Object, opts ...sdk.ListOption) error

List calls ListFunc.

func (*SdkCruderMock) ListCalls

func (mock *SdkCruderMock) ListCalls() []struct {
	Namespace string
	Into      sdk.Object
	Opts      []sdk.ListOption
}

ListCalls gets all the calls that were made to List. Check the length with:

len(mockedSdkCruder.ListCalls())

func (*SdkCruderMock) Update

func (mock *SdkCruderMock) Update(object sdk.Object) error

Update calls UpdateFunc.

func (*SdkCruderMock) UpdateCalls

func (mock *SdkCruderMock) UpdateCalls() []struct {
	Object sdk.Object
}

UpdateCalls gets all the calls that were made to Update. Check the length with:

len(mockedSdkCruder.UpdateCalls())

Jump to

Keyboard shortcuts

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