[#121] client: Make PrmContainerList fields public

Signed-off-by: Airat Arifullin a.arifullin@yadro.com
This commit is contained in:
Airat Arifullin 2023-10-23 17:25:46 +03:00
parent 665e5807bc
commit 51c3618850
2 changed files with 10 additions and 9 deletions

View file

@ -17,26 +17,26 @@ import (
// PrmContainerList groups parameters of ContainerList operation. // PrmContainerList groups parameters of ContainerList operation.
type PrmContainerList struct { type PrmContainerList struct {
prmCommonMeta XHeaders []string
ownerSet bool Account *user.ID
ownerID user.ID
} }
// SetAccount sets identifier of the FrostFS account to list the containers. // SetAccount sets identifier of the FrostFS account to list the containers.
// Required parameter. // Required parameter.
//
// Deprecated: Use PrmContainerList.Account instead.
func (x *PrmContainerList) SetAccount(id user.ID) { func (x *PrmContainerList) SetAccount(id user.ID) {
x.ownerID = id x.Account = &id
x.ownerSet = true
} }
func (x *PrmContainerList) buildRequest(c *Client) (*v2container.ListRequest, error) { func (x *PrmContainerList) buildRequest(c *Client) (*v2container.ListRequest, error) {
if !x.ownerSet { if x.Account == nil {
return nil, errorAccountNotSet return nil, errorAccountNotSet
} }
var ownerV2 refs.OwnerID var ownerV2 refs.OwnerID
x.ownerID.WriteToV2(&ownerV2) x.Account.WriteToV2(&ownerV2)
reqBody := new(v2container.ListRequestBody) reqBody := new(v2container.ListRequestBody)
reqBody.SetOwnerID(&ownerV2) reqBody.SetOwnerID(&ownerV2)

View file

@ -503,8 +503,9 @@ func (c *clientWrapper) containerList(ctx context.Context, prm PrmContainerList)
return nil, err return nil, err
} }
var cliPrm sdkClient.PrmContainerList cliPrm := sdkClient.PrmContainerList{
cliPrm.SetAccount(prm.ownerID) Account: &prm.ownerID,
}
start := time.Now() start := time.Now()
res, err := cl.ContainerList(ctx, cliPrm) res, err := cl.ContainerList(ctx, cliPrm)