handlers

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: GPL-3.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BearerPrefix is the prefix for authorization token.
	BearerPrefix       = "Bearer "
	BearerCookiePrefix = "Bearer="
)
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 added in v0.2.0

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 added in v0.8.0

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

RestAPI is a REST v1 request handler.

func NewAPI added in v0.8.0

func NewAPI(prm *PrmAPI) *RestAPI

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

func (*RestAPI) Auth added in v0.8.0

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

Auth handler that forms bearer token to sign.

func (*RestAPI) DeleteContainer added in v0.8.0

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

DeleteContainer handler that returns container info.

func (*RestAPI) DeleteObject added in v0.8.0

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 added in v0.8.0

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 added in v0.8.0

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

GetBalance handler that get balance from NeoFS.

func (*RestAPI) GetByAttribute added in v0.8.0

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 added in v0.8.0

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

GetContainer handler that returns container info.

func (*RestAPI) GetContainerEACL added in v0.8.0

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

GetContainerEACL handler that returns container eacl.

func (*RestAPI) GetContainerObject added in v0.8.0

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

func (*RestAPI) GetObjectInfo added in v0.8.0

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 added in v0.8.0

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 added in v0.8.0

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 added in v0.8.0

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

ListContainers handler that returns containers.

func (*RestAPI) OptionsAuth added in v0.8.0

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

OptionsAuth handler for the auth options request.

func (*RestAPI) OptionsAuthBearer added in v0.8.0

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

OptionsAuthBearer handler for the authBearer options request.

func (*RestAPI) OptionsBalance added in v0.8.0

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

OptionsBalance handler for the balance options request.

func (*RestAPI) OptionsByAttribute added in v0.8.0

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

OptionsByAttribute handler for the byAttribute options request.

func (*RestAPI) OptionsContainerObject added in v0.8.0

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

OptionsContainerObject handler for the containerObject options request.

func (*RestAPI) OptionsContainersEACL added in v0.8.0

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

OptionsContainersEACL handler for the containersEACL options request.

func (*RestAPI) OptionsContainersGetDelete added in v0.8.0

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

OptionsContainersGetDelete handler for the containersGetDelete options request.

func (*RestAPI) OptionsContainersPutList added in v0.8.0

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

OptionsContainersPutList handler for the containersPutList options request.

func (*RestAPI) OptionsObjectsGetDelete added in v0.8.0

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

OptionsObjectsGetDelete handler for the objectsGetDelete options request.

func (*RestAPI) OptionsObjectsPut added in v0.8.0

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

OptionsObjectsPut handler for the objectsPut options request.

func (*RestAPI) OptionsObjectsSearch added in v0.8.0

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

OptionsObjectsSearch handler for the objectsSearch options request.

func (*RestAPI) OptionsUploadContainerObject added in v0.8.0

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

OptionsUploadContainerObject handler for the uploadContainerObject options request.

func (*RestAPI) PutContainer added in v0.8.0

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

PutContainer handler that creates container in NeoFS.

func (*RestAPI) PutContainerEACL added in v0.8.0

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

PutContainerEACL handler that update container eacl.

func (*RestAPI) PutObject added in v0.8.0

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

PutObject handler that uploads object to NeoFS.

func (*RestAPI) RunServices added in v0.8.0

func (a *RestAPI) RunServices()

func (*RestAPI) SearchObjects added in v0.8.0

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

SearchObjects handler that searches object in NeoFS.

func (*RestAPI) StartCallback added in v0.8.0

func (a *RestAPI) StartCallback()

func (*RestAPI) UploadContainerObject added in v0.8.0

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 added in v0.2.0

type SessionToken struct {
	BearerToken
	Verb sessionv2.ContainerSessionVerb
}

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