restapi

package
v0.0.0-...-f4f4b6c Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// SwaggerJSON embedded version of the swagger document used at generation time
	SwaggerJSON json.RawMessage
	// FlatSwaggerJSON embedded flattened version of the swagger document used at generation time
	FlatSwaggerJSON json.RawMessage
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Address           string
	Debug             bool
	InsecureHTTP      bool
	AuthDisabled      bool
	TLSCertFile       string
	TLSKeyFile        string
	WellKnownDisabled bool
	TokenURL          string
	Tracer            opentracing.Tracer
}

Config defines the config options for the API server.

func (*Config) Parse

func (c *Config) Parse() error

Parse parses configuration from commandline flags.

func (*Config) WithDefaultFlags

func (c *Config) WithDefaultFlags() *Config

WithDefaultFlags creates a Config with default address ':8080'

type Routes

type Routes struct {
	*gin.Engine
	AddOrUpdateConfigItem struct {
		*gin.RouterGroup
		Auth gin.HandlerFunc
	}
	CreateCluster struct {
		*gin.RouterGroup
		Auth gin.HandlerFunc
	}
	CreateInfrastructureAccount struct {
		*gin.RouterGroup
		Auth gin.HandlerFunc
	}
	CreateOrUpdateNodePool struct {
		*gin.RouterGroup
		Auth gin.HandlerFunc
	}
	DeleteCluster struct {
		*gin.RouterGroup
		Auth gin.HandlerFunc
	}
	DeleteConfigItem struct {
		*gin.RouterGroup
		Auth gin.HandlerFunc
	}
	DeleteNodePool struct {
		*gin.RouterGroup
		Auth gin.HandlerFunc
	}
	GetCluster struct {
		*gin.RouterGroup
		Auth gin.HandlerFunc
	}
	GetInfrastructureAccount struct {
		*gin.RouterGroup
		Auth gin.HandlerFunc
	}
	ListClusters struct {
		*gin.RouterGroup
		Auth gin.HandlerFunc
	}
	ListInfrastructureAccounts struct {
		*gin.RouterGroup
		Auth gin.HandlerFunc
	}
	ListNodePools struct {
		*gin.RouterGroup
		Auth gin.HandlerFunc
	}
	UpdateCluster struct {
		*gin.RouterGroup
		Auth gin.HandlerFunc
	}
	UpdateInfrastructureAccount struct {
		*gin.RouterGroup
		Auth gin.HandlerFunc
	}
}

Routes defines all the routes of the Server service.

type Server

type Server struct {
	Routes *Routes

	Title   string
	Version string
	// contains filtered or unexported fields
}

Server defines the Server service.

func NewServer

func NewServer(svc Service, config *Config) *Server

NewServer initializes a new Server service.

func (*Server) ConfigureRoutes

func (s *Server) ConfigureRoutes()

ConfigureRoutes starts the internal configureRoutes methode.

func (*Server) Run

func (s *Server) Run() error

Run runs the Server. It will listen on either HTTP or HTTPS depending on the config passed to NewServer.

func (*Server) RunWithSigHandler

func (s *Server) RunWithSigHandler(shutdown ...func() error) error

RunWithSigHandler runs the Server server with SIGTERM handling automatically enabled. The server will listen for a SIGTERM signal and gracefully shutdown the web server. It's possible to optionally pass any number shutdown functions which will execute one by one after the webserver has been shutdown successfully.

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown will gracefully shutdown the Server server.

type Service

type Service interface {
	Healthy() bool
	AddOrUpdateConfigItem(ctx *gin.Context, params *config_items.AddOrUpdateConfigItemParams) *api.Response
	CreateCluster(ctx *gin.Context, params *clusters.CreateClusterParams) *api.Response
	CreateInfrastructureAccount(ctx *gin.Context, params *infrastructure_accounts.CreateInfrastructureAccountParams) *api.Response
	CreateOrUpdateNodePool(ctx *gin.Context, params *node_pools.CreateOrUpdateNodePoolParams) *api.Response
	DeleteCluster(ctx *gin.Context, params *clusters.DeleteClusterParams) *api.Response
	DeleteConfigItem(ctx *gin.Context, params *config_items.DeleteConfigItemParams) *api.Response
	DeleteNodePool(ctx *gin.Context, params *node_pools.DeleteNodePoolParams) *api.Response
	GetCluster(ctx *gin.Context, params *clusters.GetClusterParams) *api.Response
	GetInfrastructureAccount(ctx *gin.Context, params *infrastructure_accounts.GetInfrastructureAccountParams) *api.Response
	ListClusters(ctx *gin.Context, params *clusters.ListClustersParams) *api.Response
	ListInfrastructureAccounts(ctx *gin.Context) *api.Response
	ListNodePools(ctx *gin.Context, params *node_pools.ListNodePoolsParams) *api.Response
	UpdateCluster(ctx *gin.Context, params *clusters.UpdateClusterParams) *api.Response
	UpdateInfrastructureAccount(ctx *gin.Context, params *infrastructure_accounts.UpdateInfrastructureAccountParams) *api.Response
}

Service is the interface that must be implemented in order to provide business logic for the Server service.

Directories

Path Synopsis
operations

Jump to

Keyboard shortcuts

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