forked from TrueCloudLab/frostfs-rest-gw
[#33] Add route to get NeoFS balance
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
aaf7433c7b
commit
6e01a0ead7
9 changed files with 530 additions and 0 deletions
|
@ -53,6 +53,9 @@ func NewNeofsRestGwAPI(spec *loads.Document) *NeofsRestGwAPI {
|
|||
DeleteObjectHandler: DeleteObjectHandlerFunc(func(params DeleteObjectParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation DeleteObject has not yet been implemented")
|
||||
}),
|
||||
GetBalanceHandler: GetBalanceHandlerFunc(func(params GetBalanceParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation GetBalance has not yet been implemented")
|
||||
}),
|
||||
GetContainerHandler: GetContainerHandlerFunc(func(params GetContainerParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation GetContainer has not yet been implemented")
|
||||
}),
|
||||
|
@ -133,6 +136,8 @@ type NeofsRestGwAPI struct {
|
|||
DeleteContainerHandler DeleteContainerHandler
|
||||
// DeleteObjectHandler sets the operation handler for the delete object operation
|
||||
DeleteObjectHandler DeleteObjectHandler
|
||||
// GetBalanceHandler sets the operation handler for the get balance operation
|
||||
GetBalanceHandler GetBalanceHandler
|
||||
// GetContainerHandler sets the operation handler for the get container operation
|
||||
GetContainerHandler GetContainerHandler
|
||||
// GetContainerEACLHandler sets the operation handler for the get container e ACL operation
|
||||
|
@ -239,6 +244,9 @@ func (o *NeofsRestGwAPI) Validate() error {
|
|||
if o.DeleteObjectHandler == nil {
|
||||
unregistered = append(unregistered, "DeleteObjectHandler")
|
||||
}
|
||||
if o.GetBalanceHandler == nil {
|
||||
unregistered = append(unregistered, "GetBalanceHandler")
|
||||
}
|
||||
if o.GetContainerHandler == nil {
|
||||
unregistered = append(unregistered, "GetContainerHandler")
|
||||
}
|
||||
|
@ -377,6 +385,10 @@ func (o *NeofsRestGwAPI) initHandlerCache() {
|
|||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/accounting/balance/{address}"] = NewGetBalance(o.context, o.GetBalanceHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/containers/{containerId}"] = NewGetContainer(o.context, o.GetContainerHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue