gravity

package
v0.0.0-...-3bfe646 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 29 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(resource storage.UnknownResource) (err error)

Validate checks whether the specified resource represents a valid resource.

Types

type ClusterOperationHandler

type ClusterOperationHandler interface {
	// RemoveResource removes the specified resource
	RemoveResource(resources.RemoveRequest) error
	// UpdateResource creates or updates the specified resource
	UpdateResource(resources.CreateRequest) error
}

ClusterOperationHandler defines a service to manage resources based on cluster operations

type Config

type Config struct {
	// Operator is local cluster ops client
	Operator ops.Operator
	// CurrentUser is the currently logged in user
	CurrentUser string
	// Silent provides methods for printing
	localenv.Silent
	// ClusterOperationHandler specifies the optional handler
	// for resources that require special handling
	ClusterOperationHandler
}

Config is gravity resource controller configuration

func (Config) Check

func (c Config) Check() error

Check makes sure the config is valid

type Resources

type Resources struct {
	// Config is the controller configuration
	Config
	// Log is used for logging.
	Log logrus.FieldLogger
}

Resources is a controller that manages cluster local resources

func New

func New(config Config) (*Resources, error)

New creates a new gravity resource controller

func (*Resources) Create

func (r *Resources) Create(ctx context.Context, req resources.CreateRequest) error

Create creates the provided resource

func (*Resources) GetCollection

func (r *Resources) GetCollection(req resources.ListRequest) (resources.Collection, error)

GetCollection retrieves a collection of specified resources

func (*Resources) Remove

func (r *Resources) Remove(ctx context.Context, req resources.RemoveRequest) error

Remove removes the specified resource

type Suite

type Suite struct {
	// Services is a set of initialized test services
	Services opsservice.TestServices
	// Handler is the initializes operator web handler
	Handler *opshandler.WebHandler
	// Creds is the credentials for the test cluster admin agent
	Creds *storage.LoginEntry
}

Suite is the gravity resource controller test suite helper

func (*Suite) SetUp

func (s *Suite) SetUp(c *check.C)

SetUp prepares services and database for a test

func (*Suite) TearDown

func (s *Suite) TearDown(c *check.C)

TearDown performs post-test cleanups

Jump to

Keyboard shortcuts

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