forked from TrueCloudLab/frostfs-node
[#590] cli: fix SDK PrmContainerGet usage for GetContainerPrm
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
c3c0574e3c
commit
6186329aec
6 changed files with 48 additions and 25 deletions
|
@ -103,13 +103,15 @@ func PutContainer(ctx context.Context, prm PutContainerPrm) (res PutContainerRes
|
|||
|
||||
// GetContainerPrm groups parameters of GetContainer operation.
|
||||
type GetContainerPrm struct {
|
||||
commonPrm
|
||||
cliPrm client.PrmContainerGet
|
||||
Client *client.Client
|
||||
ClientParams client.PrmContainerGet
|
||||
}
|
||||
|
||||
// SetContainer sets identifier of the container to be read.
|
||||
//
|
||||
// Deprecated: Use GetContainerPrm.ClientParams.ContainerID instead.
|
||||
func (x *GetContainerPrm) SetContainer(id cid.ID) {
|
||||
*x.cliPrm.ContainerID = id
|
||||
x.ClientParams.ContainerID = &id
|
||||
}
|
||||
|
||||
// GetContainerRes groups the resulting values of GetContainer operation.
|
||||
|
@ -126,7 +128,7 @@ func (x GetContainerRes) Container() containerSDK.Container {
|
|||
//
|
||||
// Returns any error which prevented the operation from completing correctly in error return.
|
||||
func GetContainer(ctx context.Context, prm GetContainerPrm) (res GetContainerRes, err error) {
|
||||
res.cliRes, err = prm.cli.ContainerGet(ctx, prm.cliPrm)
|
||||
res.cliRes, err = prm.Client.ContainerGet(ctx, prm.ClientParams)
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -134,9 +136,12 @@ func GetContainer(ctx context.Context, prm GetContainerPrm) (res GetContainerRes
|
|||
// IsACLExtendable checks if ACL of the container referenced by the given identifier
|
||||
// can be extended. Client connection MUST BE correctly established in advance.
|
||||
func IsACLExtendable(ctx context.Context, c *client.Client, cnr cid.ID) (bool, error) {
|
||||
var prm GetContainerPrm
|
||||
prm.SetClient(c)
|
||||
prm.SetContainer(cnr)
|
||||
prm := GetContainerPrm{
|
||||
Client: c,
|
||||
ClientParams: client.PrmContainerGet{
|
||||
ContainerID: &cnr,
|
||||
},
|
||||
}
|
||||
|
||||
res, err := GetContainer(ctx, prm)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue