[#121] pool: Make PrmContainerGet fields public
All checks were successful
DCO / DCO (pull_request) Successful in 46s
Tests and linters / Lint (pull_request) Successful in 1m33s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m13s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m25s

* Also refactor client PrmContainerGet usage

Signed-off-by: Airat Arifullin a.arifullin@yadro.com
This commit is contained in:
Airat Arifullin 2023-08-02 18:56:41 +03:00
parent d376302a3b
commit 55c52c8d5d
2 changed files with 14 additions and 11 deletions

View file

@ -18,22 +18,22 @@ import (
// PrmContainerGet groups parameters of ContainerGet operation.
type PrmContainerGet struct {
// FrostFS request X-Headers
// FrostFS request X-Headers.
XHeaders []string
CID *cid.ID
ContainerID *cid.ID
}
// SetContainer sets identifier of the container to be read.
// Required parameter.
//
// Deprecated: Use PrmContainerGet.CID instead.
// Deprecated: Use PrmContainerGet.ContainerID instead.
func (prm *PrmContainerGet) SetContainer(cid cid.ID) {
prm.CID = &cid
prm.ContainerID = &cid
}
func (prm *PrmContainerGet) buildRequest(c *Client) (*v2container.GetRequest, error) {
if prm.CID == nil {
if prm.ContainerID == nil {
return nil, errorMissingContainer
}
@ -42,7 +42,7 @@ func (prm *PrmContainerGet) buildRequest(c *Client) (*v2container.GetRequest, er
}
var cidV2 refs.ContainerID
prm.CID.WriteToV2(&cidV2)
prm.ContainerID.WriteToV2(&cidV2)
reqBody := new(v2container.GetRequestBody)
reqBody.SetContainerID(&cidV2)

View file

@ -438,8 +438,9 @@ func (c *clientWrapper) containerGet(ctx context.Context, prm PrmContainerGet) (
return container.Container{}, err
}
var cliPrm sdkClient.PrmContainerGet
cliPrm.SetContainer(prm.cnrID)
cliPrm := sdkClient.PrmContainerGet{
ContainerID: &prm.ContainerID,
}
start := time.Now()
res, err := cl.ContainerGet(ctx, cliPrm)
@ -1444,12 +1445,14 @@ func (x *PrmContainerPut) SetWaitParams(waitParams WaitParams) {
// PrmContainerGet groups parameters of GetContainer operation.
type PrmContainerGet struct {
cnrID cid.ID
ContainerID cid.ID
}
// SetContainerID specifies identifier of the container to be read.
func (x *PrmContainerGet) SetContainerID(cnrID cid.ID) {
x.cnrID = cnrID
//
// Deprecated: Use PrmContainerGet.ContainerID instead.
func (prm *PrmContainerGet) SetContainerID(cnrID cid.ID) {
prm.ContainerID = cnrID
}
// PrmContainerList groups parameters of ListContainers operation.