From d376302a3bb4a6875b53879ac033e899d76924c8 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 2 Aug 2023 18:23:32 +0300 Subject: [PATCH] [#121] client: Make PrmContainerGet fields public Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- client/container_get.go | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/client/container_get.go b/client/container_get.go index 9e98523..0e2d028 100644 --- a/client/container_get.go +++ b/client/container_get.go @@ -18,26 +18,31 @@ import ( // PrmContainerGet groups parameters of ContainerGet operation. type PrmContainerGet struct { - prmCommonMeta + // FrostFS request X-Headers + XHeaders []string - idSet bool - id cid.ID + CID *cid.ID } // SetContainer sets identifier of the container to be read. // Required parameter. -func (x *PrmContainerGet) SetContainer(id cid.ID) { - x.id = id - x.idSet = true +// +// Deprecated: Use PrmContainerGet.CID instead. +func (prm *PrmContainerGet) SetContainer(cid cid.ID) { + prm.CID = &cid } -func (x *PrmContainerGet) buildRequest(c *Client) (*v2container.GetRequest, error) { - if !x.idSet { +func (prm *PrmContainerGet) buildRequest(c *Client) (*v2container.GetRequest, error) { + if prm.CID == nil { return nil, errorMissingContainer } + if len(prm.XHeaders)%2 != 0 { + return nil, errorInvalidXHeaders + } + var cidV2 refs.ContainerID - x.id.WriteToV2(&cidV2) + prm.CID.WriteToV2(&cidV2) reqBody := new(v2container.GetRequestBody) reqBody.SetContainerID(&cidV2)