restapi

package
v0.0.0-...-13bd798 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package restapi REST API FrostFS

REST API for native integration with FrostFS.
Schemes:
  http
Host: localhost:8090
BasePath: /v1
Version: v1

Consumes:
  - application/json

Produces:
  - application/json

swagger:meta

Index

Constants

View Source
const (
	FlagScheme           = "scheme"
	FlagCleanupTimeout   = "cleanup-timeout"
	FlagGracefulTimeout  = "graceful-timeout"
	FlagMaxHeaderSize    = "max-header-size"
	FlagListenAddress    = "listen-address"
	FlagListenLimit      = "listen-limit"
	FlagKeepAlive        = "keep-alive"
	FlagReadTimeout      = "read-timeout"
	FlagWriteTimeout     = "write-timeout"
	FlagTLSListenAddress = "tls-listen-address"
	FlagTLSCertificate   = "tls-certificate"
	FlagTLSKey           = "tls-key"
	FlagTLSCa            = "tls-ca"
	FlagTLSListenLimit   = "tls-listen-limit"
	FlagTLSKeepAlive     = "tls-keep-alive"
	FlagTLSReadTimeout   = "tls-read-timeout"
	FlagTLSWriteTimeout  = "tls-write-timeout"
)

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

func BindDefaultFlags

func BindDefaultFlags(flagSet *pflag.FlagSet)

BindDefaultFlag init default flag.

Types

type Server

type Server struct {
	EnabledListeners []string
	CleanupTimeout   time.Duration
	GracefulTimeout  time.Duration
	MaxHeaderSize    int

	ListenAddress string
	ListenLimit   int
	KeepAlive     time.Duration
	ReadTimeout   time.Duration
	WriteTimeout  time.Duration

	TLSListenAddress  string
	TLSCertificate    string
	TLSCertificateKey string
	TLSCACertificate  string
	TLSListenLimit    int
	TLSKeepAlive      time.Duration
	TLSReadTimeout    time.Duration
	TLSWriteTimeout   time.Duration
	// contains filtered or unexported fields
}

Server for the frostfs rest gw API

func NewServer

func NewServer(api *operations.FrostfsRestGwAPI, cfg *ServerConfig) *Server

NewServer creates a new api frostfs rest gw server but does not configure it

func (*Server) ConfigureAPI

func (s *Server) ConfigureAPI(fn func(*operations.FrostfsRestGwAPI) http.Handler)

ConfigureAPI configures the API and handlers.

func (*Server) ConfigureServer

func (s *Server) ConfigureServer(cfgServer func(s *http.Server, scheme, addr string))

As soon as server is initialized but not run yet, this function will be called. If you need to modify a config, store server instance to stop it individually later, this is the place. This function can be called multiple times, depending on the number of serving schemes. scheme value will be set accordingly: "http", "https" or "unix".

func (*Server) ConfigureTLS

func (s *Server) ConfigureTLS(cfgTLS func(tlsConfig *tls.Config))

The TLS configuration before HTTPS server starts.

func (*Server) Fatalf

func (s *Server) Fatalf(f string, args ...interface{})

Fatalf logs message either via defined user logger or via system one if no user logger is defined. Exits with non-zero status after printing

func (*Server) GetHandler

func (s *Server) GetHandler() http.Handler

GetHandler returns a handler useful for testing

func (*Server) HTTPListener

func (s *Server) HTTPListener() (net.Listener, error)

HTTPListener returns the http listener

func (*Server) Listen

func (s *Server) Listen() error

Listen creates the listeners for the server

func (*Server) Logf

func (s *Server) Logf(f string, args ...interface{})

Logf logs message either via defined user logger or via system one if no user logger is defined.

func (*Server) Serve

func (s *Server) Serve() (err error)

Serve the api

func (*Server) SetHandler

func (s *Server) SetHandler(handler http.Handler)

SetHandler allows for setting a http handler on this server

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown server and clean up resources

func (*Server) TLSListener

func (s *Server) TLSListener() (net.Listener, error)

TLSListener returns the https listener

type ServerConfig

type ServerConfig struct {
	EnabledListeners []string
	CleanupTimeout   time.Duration
	GracefulTimeout  time.Duration
	MaxHeaderSize    int

	ListenAddress string
	ListenLimit   int
	KeepAlive     time.Duration
	ReadTimeout   time.Duration
	WriteTimeout  time.Duration

	TLSListenAddress  string
	TLSListenLimit    int
	TLSKeepAlive      time.Duration
	TLSReadTimeout    time.Duration
	TLSWriteTimeout   time.Duration
	TLSCertificate    string
	TLSCertificateKey string
	TLSCACertificate  string

	SuccessfulStartCallback func()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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