handlers

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: GPL-3.0 Imports: 42 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 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
	// Size limit for buffering of object payloads. Must be positive.
	MaxPayloadBufferSize uint64

	GateMetric             *metrics.GateMetrics
	PrometheusService      *metrics.Service
	PprofService           *metrics.Service
	ServiceShutdownTimeout time.Duration
	WaiterOperationTimeout 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 RangeReader added in v0.11.0

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

RangeReader allows reading data from both []byte `payloadHead` and io.ReadCloser `payload` starting from position `start`, regardless of where the `start` is. Note that the first part of `payload` was read into `payloadHead`. RangeReader wraps an existing io.ReadCloser `payload` to provide a specific byte range.

func NewRangeReader added in v0.11.0

func NewRangeReader(payload io.ReadCloser, payloadHead []byte, totalLength uint64, start uint64) *RangeReader

NewRangeReader creates a new RangeReader for a given byte range.

func (*RangeReader) Close added in v0.11.0

func (r *RangeReader) Close() error

Close implements the io.Closer interface.

func (*RangeReader) Read added in v0.11.0

func (r *RangeReader) Read(p []byte) (int, error)

Read implements the io.Reader interface.

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, error)

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

GetContainerObject handler that returns object (using container ID and object ID).

func (*RestAPI) GetNetworkInfo added in v0.9.0

func (a *RestAPI) GetNetworkInfo(ctx echo.Context) 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) NewGetByAttribute added in v0.9.0

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

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

func (*RestAPI) NewGetContainerObject added in v0.9.0

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

NewGetContainerObject handler that returns object (using container ID and object ID).

func (*RestAPI) NewHeadByAttribute added in v0.9.0

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

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

func (*RestAPI) NewHeadContainerObject added in v0.9.0

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

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

func (*RestAPI) NewOptionsByAttribute added in v0.9.0

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

NewOptionsByAttribute handler for the find by attribute options request.

func (*RestAPI) NewOptionsContainerObject added in v0.9.0

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

NewOptionsContainerObject handler for the create object options request.

func (*RestAPI) NewOptionsUploadContainerObject added in v0.9.0

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

NewOptionsUploadContainerObject handler for the upload object options request.

func (*RestAPI) NewUploadContainerObject added in v0.9.0

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

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

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) OptionsNetworkInfo added in v0.9.0

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

OptionsNetworkInfo handler for the network 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) StopServices added in v0.10.1

func (a *RestAPI) StopServices()

StopServices stops all running services with configured timeout.

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 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
JackTT - Gopher 🇻🇳