[#121] client: Make PrmContainerGet fields public

Signed-off-by: Airat Arifullin a.arifullin@yadro.com
This commit is contained in:
Airat Arifullin 2023-08-02 18:23:32 +03:00
parent 363f153eaf
commit d376302a3b

View file

@ -18,26 +18,31 @@ import (
// PrmContainerGet groups parameters of ContainerGet operation. // PrmContainerGet groups parameters of ContainerGet operation.
type PrmContainerGet struct { type PrmContainerGet struct {
prmCommonMeta // FrostFS request X-Headers
XHeaders []string
idSet bool CID *cid.ID
id cid.ID
} }
// SetContainer sets identifier of the container to be read. // SetContainer sets identifier of the container to be read.
// Required parameter. // Required parameter.
func (x *PrmContainerGet) SetContainer(id cid.ID) { //
x.id = id // Deprecated: Use PrmContainerGet.CID instead.
x.idSet = true func (prm *PrmContainerGet) SetContainer(cid cid.ID) {
prm.CID = &cid
} }
func (x *PrmContainerGet) buildRequest(c *Client) (*v2container.GetRequest, error) { func (prm *PrmContainerGet) buildRequest(c *Client) (*v2container.GetRequest, error) {
if !x.idSet { if prm.CID == nil {
return nil, errorMissingContainer return nil, errorMissingContainer
} }
if len(prm.XHeaders)%2 != 0 {
return nil, errorInvalidXHeaders
}
var cidV2 refs.ContainerID var cidV2 refs.ContainerID
x.id.WriteToV2(&cidV2) prm.CID.WriteToV2(&cidV2)
reqBody := new(v2container.GetRequestBody) reqBody := new(v2container.GetRequestBody)
reqBody.SetContainerID(&cidV2) reqBody.SetContainerID(&cidV2)