forked from TrueCloudLab/frostfs-sdk-go
[#276] Merge repo with frostfs-api-go
Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
This commit is contained in:
parent
5361f0eceb
commit
6ce73790ea
337 changed files with 66666 additions and 283 deletions
82
api/rpc/container.go
Normal file
82
api/rpc/container.go
Normal file
|
@ -0,0 +1,82 @@
|
|||
package rpc
|
||||
|
||||
import (
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/common"
|
||||
)
|
||||
|
||||
const serviceContainer = serviceNamePrefix + "container.ContainerService"
|
||||
|
||||
const (
|
||||
rpcContainerPut = "Put"
|
||||
rpcContainerGet = "Get"
|
||||
rpcContainerDel = "Delete"
|
||||
rpcContainerList = "List"
|
||||
rpcContainerGetEACL = "GetExtendedACL"
|
||||
rpcContainerUsedSpace = "AnnounceUsedSpace"
|
||||
)
|
||||
|
||||
// PutContainer executes ContainerService.Put RPC.
|
||||
func PutContainer(
|
||||
cli *client.Client,
|
||||
req *container.PutRequest,
|
||||
opts ...client.CallOption,
|
||||
) (*container.PutResponse, error) {
|
||||
resp := new(container.PutResponse)
|
||||
|
||||
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerPut), req, resp, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// GetContainer executes ContainerService.Get RPC.
|
||||
func GetContainer(
|
||||
cli *client.Client,
|
||||
req *container.GetRequest,
|
||||
opts ...client.CallOption,
|
||||
) (*container.GetResponse, error) {
|
||||
resp := new(container.GetResponse)
|
||||
|
||||
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerGet), req, resp, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// DeleteContainer executes ContainerService.Delete RPC.
|
||||
func DeleteContainer(
|
||||
cli *client.Client,
|
||||
req *container.DeleteRequest,
|
||||
opts ...client.CallOption,
|
||||
) (*container.PutResponse, error) {
|
||||
resp := new(container.PutResponse)
|
||||
|
||||
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerDel), req, resp, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// ListContainers executes ContainerService.List RPC.
|
||||
func ListContainers(
|
||||
cli *client.Client,
|
||||
req *container.ListRequest,
|
||||
opts ...client.CallOption,
|
||||
) (*container.ListResponse, error) {
|
||||
resp := new(container.ListResponse)
|
||||
|
||||
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerList), req, resp, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue