handlers

package
v0.0.0-...-ad146d1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: GPL-3.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SystemAttributePrefix = "__NEOFS__"

	ExpirationDurationAttr  = SystemAttributePrefix + "EXPIRATION_DURATION"
	ExpirationTimestampAttr = SystemAttributePrefix + "EXPIRATION_TIMESTAMP"
	ExpirationRFC3339Attr   = SystemAttributePrefix + "EXPIRATION_RFC3339"
)

Variables

This section is empty.

Functions

func IsObjectToken

func IsObjectToken(token apiserver.Bearer) (bool, error)

IsObjectToken check that provided token is for object.

Types

type BearerToken

type BearerToken struct {
	Token     string
	Signature string
	Key       string
}

type PrmAPI

type PrmAPI struct {
	Logger           *zap.Logger
	Pool             *pool.Pool
	Key              *keys.PrivateKey
	DefaultTimestamp bool
	MaxObjectSize    int64

	GateMetric             *metrics.GateMetrics
	PrometheusService      *metrics.Service
	PprofService           *metrics.Service
	ServiceShutdownTimeout time.Duration
}

PrmAPI groups parameters to init rest API.

type PrmAttributes

type PrmAttributes struct {
	DefaultTimestamp bool
	DefaultFileName  string
}

PrmAttributes groups parameters to form attributes from request headers.

type RestAPI

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

RestAPI is a REST v1 request handler.

func NewAPI

func NewAPI(prm *PrmAPI) *RestAPI

NewAPI creates a new RestAPI using specified logger, connection pool and other parameters.

func (*RestAPI) Auth

func (a *RestAPI) Auth(ctx echo.Context, params apiserver.AuthParams) error

Auth handler that forms bearer token to sign.

func (*RestAPI) DeleteContainer

func (a *RestAPI) DeleteContainer(ctx echo.Context, containerID apiserver.ContainerId, params apiserver.DeleteContainerParams) error

DeleteContainer handler that returns container info.

func (*RestAPI) DeleteObject

func (a *RestAPI) DeleteObject(ctx echo.Context, containerID apiserver.ContainerId, objectID apiserver.ObjectId, params apiserver.DeleteObjectParams) error

DeleteObject handler that removes object from NeoFS.

func (*RestAPI) FormBinaryBearer

func (a *RestAPI) FormBinaryBearer(ctx echo.Context, params apiserver.FormBinaryBearerParams) error

FormBinaryBearer handler that forms binary bearer token using headers with body and signature.

func (*RestAPI) GetBalance

func (a *RestAPI) GetBalance(ctx echo.Context, address string) error

GetBalance handler that get balance from NeoFS.

func (*RestAPI) GetByAttribute

func (a *RestAPI) GetByAttribute(ctx echo.Context, containerID apiserver.ContainerId, attrKey apiserver.AttrKey, attrVal apiserver.AttrVal, params apiserver.GetByAttributeParams) error

GetByAttribute handler that returns object (payload and attributes) by a specific attribute.

func (*RestAPI) GetContainer

func (a *RestAPI) GetContainer(ctx echo.Context, containerID apiserver.ContainerId) error

GetContainer handler that returns container info.

func (*RestAPI) GetContainerEACL

func (a *RestAPI) GetContainerEACL(ctx echo.Context, containerID apiserver.ContainerId) error

GetContainerEACL handler that returns container eacl.

func (*RestAPI) GetContainerObject

func (a *RestAPI) GetContainerObject(ctx echo.Context, containerID apiserver.ContainerId, objectID apiserver.ObjectId, params apiserver.GetContainerObjectParams) error

func (*RestAPI) GetNetworkInfo

func (a *RestAPI) GetNetworkInfo(ctx echo.Context) error

func (*RestAPI) GetObjectInfo

func (a *RestAPI) GetObjectInfo(ctx echo.Context, containerID apiserver.ContainerId, objectID apiserver.ObjectId, params apiserver.GetObjectInfoParams) error

GetObjectInfo handler that get object info.

func (*RestAPI) HeadByAttribute

func (a *RestAPI) HeadByAttribute(ctx echo.Context, containerID apiserver.ContainerId, attrKey apiserver.AttrKey, attrVal apiserver.AttrVal, params apiserver.HeadByAttributeParams) error

HeadByAttribute handler that returns object info (payload and attributes) by a specific attribute.

func (*RestAPI) HeadContainerObject

func (a *RestAPI) HeadContainerObject(ctx echo.Context, containerID apiserver.ContainerId, objectID apiserver.ObjectId, params apiserver.HeadContainerObjectParams) error

HeadContainerObject handler that returns object info (using container ID and object ID).

func (*RestAPI) ListContainers

func (a *RestAPI) ListContainers(ctx echo.Context, params apiserver.ListContainersParams) error

ListContainers handler that returns containers.

func (*RestAPI) OptionsAuth

func (a *RestAPI) OptionsAuth(ctx echo.Context) error

OptionsAuth handler for the auth options request.

func (*RestAPI) OptionsAuthBearer

func (a *RestAPI) OptionsAuthBearer(ctx echo.Context) error

OptionsAuthBearer handler for the authBearer options request.

func (*RestAPI) OptionsBalance

func (a *RestAPI) OptionsBalance(ctx echo.Context, _ string) error

OptionsBalance handler for the balance options request.

func (*RestAPI) OptionsByAttribute

func (a *RestAPI) OptionsByAttribute(ctx echo.Context, _ apiserver.ContainerId, _ apiserver.AttrKey, _ apiserver.AttrVal) error

OptionsByAttribute handler for the byAttribute options request.

func (*RestAPI) OptionsContainerObject

func (a *RestAPI) OptionsContainerObject(ctx echo.Context, _ apiserver.ContainerId, _ apiserver.ObjectId) error

OptionsContainerObject handler for the containerObject options request.

func (*RestAPI) OptionsContainersEACL

func (a *RestAPI) OptionsContainersEACL(ctx echo.Context, _ apiserver.ContainerId) error

OptionsContainersEACL handler for the containersEACL options request.

func (*RestAPI) OptionsContainersGetDelete

func (a *RestAPI) OptionsContainersGetDelete(ctx echo.Context, _ apiserver.ContainerId) error

OptionsContainersGetDelete handler for the containersGetDelete options request.

func (*RestAPI) OptionsContainersPutList

func (a *RestAPI) OptionsContainersPutList(ctx echo.Context) error

OptionsContainersPutList handler for the containersPutList options request.

func (*RestAPI) OptionsNetworkInfo

func (a *RestAPI) OptionsNetworkInfo(ctx echo.Context) error

OptionsNetworkInfo handler for the network options request.

func (*RestAPI) OptionsObjectsGetDelete

func (a *RestAPI) OptionsObjectsGetDelete(ctx echo.Context, _ apiserver.ContainerId, _ apiserver.ObjectId) error

OptionsObjectsGetDelete handler for the objectsGetDelete options request.

func (*RestAPI) OptionsObjectsPut

func (a *RestAPI) OptionsObjectsPut(ctx echo.Context) error

OptionsObjectsPut handler for the objectsPut options request.

func (*RestAPI) OptionsObjectsSearch

func (a *RestAPI) OptionsObjectsSearch(ctx echo.Context, _ string) error

OptionsObjectsSearch handler for the objectsSearch options request.

func (*RestAPI) OptionsUploadContainerObject

func (a *RestAPI) OptionsUploadContainerObject(ctx echo.Context, _ apiserver.ContainerId) error

OptionsUploadContainerObject handler for the uploadContainerObject options request.

func (*RestAPI) PutContainer

func (a *RestAPI) PutContainer(ctx echo.Context, params apiserver.PutContainerParams) error

PutContainer handler that creates container in NeoFS.

func (*RestAPI) PutContainerEACL

func (a *RestAPI) PutContainerEACL(ctx echo.Context, containerID apiserver.ContainerId, params apiserver.PutContainerEACLParams) error

PutContainerEACL handler that update container eacl.

func (*RestAPI) PutObject

func (a *RestAPI) PutObject(ctx echo.Context, params apiserver.PutObjectParams) error

PutObject handler that uploads object to NeoFS.

func (*RestAPI) RunServices

func (a *RestAPI) RunServices()

func (*RestAPI) SearchObjects

func (a *RestAPI) SearchObjects(ctx echo.Context, containerID apiserver.ContainerId, params apiserver.SearchObjectsParams) error

SearchObjects handler that searches object in NeoFS.

func (*RestAPI) StartCallback

func (a *RestAPI) StartCallback()

func (*RestAPI) UploadContainerObject

func (a *RestAPI) UploadContainerObject(ctx echo.Context, containerID apiserver.ContainerId, _ apiserver.UploadContainerObjectParams) error

UploadContainerObject handler that upload file as object with attributes to NeoFS.

type SessionToken

type SessionToken struct {
	BearerToken
	Verb session.ContainerVerb
}

Directories

Path Synopsis
Package apiserver provides primitives to interact with the openapi HTTP API.
Package apiserver provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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