forked from TrueCloudLab/frostfs-sdk-go
[#121] pool: Make PrmContainerGet fields public
* Also refactor client PrmContainerGet usage Signed-off-by: Airat Arifullin a.arifullin@yadro.com
This commit is contained in:
parent
d376302a3b
commit
55c52c8d5d
2 changed files with 14 additions and 11 deletions
|
@ -18,22 +18,22 @@ import (
|
||||||
|
|
||||||
// PrmContainerGet groups parameters of ContainerGet operation.
|
// PrmContainerGet groups parameters of ContainerGet operation.
|
||||||
type PrmContainerGet struct {
|
type PrmContainerGet struct {
|
||||||
// FrostFS request X-Headers
|
// FrostFS request X-Headers.
|
||||||
XHeaders []string
|
XHeaders []string
|
||||||
|
|
||||||
CID *cid.ID
|
ContainerID *cid.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetContainer sets identifier of the container to be read.
|
// SetContainer sets identifier of the container to be read.
|
||||||
// Required parameter.
|
// Required parameter.
|
||||||
//
|
//
|
||||||
// Deprecated: Use PrmContainerGet.CID instead.
|
// Deprecated: Use PrmContainerGet.ContainerID instead.
|
||||||
func (prm *PrmContainerGet) SetContainer(cid cid.ID) {
|
func (prm *PrmContainerGet) SetContainer(cid cid.ID) {
|
||||||
prm.CID = &cid
|
prm.ContainerID = &cid
|
||||||
}
|
}
|
||||||
|
|
||||||
func (prm *PrmContainerGet) buildRequest(c *Client) (*v2container.GetRequest, error) {
|
func (prm *PrmContainerGet) buildRequest(c *Client) (*v2container.GetRequest, error) {
|
||||||
if prm.CID == nil {
|
if prm.ContainerID == nil {
|
||||||
return nil, errorMissingContainer
|
return nil, errorMissingContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ func (prm *PrmContainerGet) buildRequest(c *Client) (*v2container.GetRequest, er
|
||||||
}
|
}
|
||||||
|
|
||||||
var cidV2 refs.ContainerID
|
var cidV2 refs.ContainerID
|
||||||
prm.CID.WriteToV2(&cidV2)
|
prm.ContainerID.WriteToV2(&cidV2)
|
||||||
|
|
||||||
reqBody := new(v2container.GetRequestBody)
|
reqBody := new(v2container.GetRequestBody)
|
||||||
reqBody.SetContainerID(&cidV2)
|
reqBody.SetContainerID(&cidV2)
|
||||||
|
|
13
pool/pool.go
13
pool/pool.go
|
@ -438,8 +438,9 @@ func (c *clientWrapper) containerGet(ctx context.Context, prm PrmContainerGet) (
|
||||||
return container.Container{}, err
|
return container.Container{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var cliPrm sdkClient.PrmContainerGet
|
cliPrm := sdkClient.PrmContainerGet{
|
||||||
cliPrm.SetContainer(prm.cnrID)
|
ContainerID: &prm.ContainerID,
|
||||||
|
}
|
||||||
|
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
res, err := cl.ContainerGet(ctx, cliPrm)
|
res, err := cl.ContainerGet(ctx, cliPrm)
|
||||||
|
@ -1444,12 +1445,14 @@ func (x *PrmContainerPut) SetWaitParams(waitParams WaitParams) {
|
||||||
|
|
||||||
// PrmContainerGet groups parameters of GetContainer operation.
|
// PrmContainerGet groups parameters of GetContainer operation.
|
||||||
type PrmContainerGet struct {
|
type PrmContainerGet struct {
|
||||||
cnrID cid.ID
|
ContainerID cid.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetContainerID specifies identifier of the container to be read.
|
// 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.
|
// PrmContainerList groups parameters of ListContainers operation.
|
||||||
|
|
Loading…
Reference in a new issue