From 22978303f8b7e4123a54a87966caa2d7aceb25a1 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Fri, 18 Aug 2023 17:54:51 +0300 Subject: [PATCH] [#121] clientt: Make PrmContainerSetEACL fields public Signed-off-by: Airat Arifullin --- client/container_set_eacl.go | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/client/container_set_eacl.go b/client/container_set_eacl.go index 1917373..0ea89aa 100644 --- a/client/container_set_eacl.go +++ b/client/container_set_eacl.go @@ -18,20 +18,20 @@ import ( // PrmContainerSetEACL groups parameters of ContainerSetEACL operation. type PrmContainerSetEACL struct { - prmCommonMeta + // FrostFS request X-Headers. + XHeaders []string - tableSet bool - table eacl.Table + Table *eacl.Table - sessionSet bool - session session.Container + Session *session.Container } // SetTable sets eACL table structure to be set for the container. // Required parameter. +// +// Deprecated: Use PrmContainerSetEACL.Table instead. func (x *PrmContainerSetEACL) SetTable(table eacl.Table) { - x.table = table - x.tableSet = true + x.Table = &table } // WithinSession specifies session within which extended ACL of the container @@ -45,17 +45,22 @@ func (x *PrmContainerSetEACL) SetTable(table eacl.Table) { // for which extended ACL is going to be set // - session operation MUST be session.VerbContainerSetEACL (ForVerb) // - token MUST be signed using private key of the owner of the container to be saved +// +// Deprecated: Use PrmContainerSetEACL.Session instead. func (x *PrmContainerSetEACL) WithinSession(s session.Container) { - x.session = s - x.sessionSet = true + x.Session = &s } func (x *PrmContainerSetEACL) buildRequest(c *Client) (*v2container.SetExtendedACLRequest, error) { - if !x.tableSet { + if x.Table == nil { return nil, errorEACLTableNotSet } - eaclV2 := x.table.ToV2() + if len(x.XHeaders)%2 != 0 { + return nil, errorInvalidXHeaders + } + + eaclV2 := x.Table.ToV2() var sig frostfscrypto.Signature @@ -72,11 +77,11 @@ func (x *PrmContainerSetEACL) buildRequest(c *Client) (*v2container.SetExtendedA reqBody.SetSignature(&sigv2) var meta v2session.RequestMetaHeader - writeXHeadersToMeta(x.prmCommonMeta.xHeaders, &meta) + writeXHeadersToMeta(x.XHeaders, &meta) - if x.sessionSet { + if x.Session != nil { var tokv2 v2session.Token - x.session.WriteToV2(&tokv2) + x.Session.WriteToV2(&tokv2) meta.SetSessionToken(&tokv2) }