diff --git a/client/container_delete.go b/client/container_delete.go index 0059988..70d5f40 100644 --- a/client/container_delete.go +++ b/client/container_delete.go @@ -18,29 +18,33 @@ import ( // PrmContainerDelete groups parameters of ContainerDelete operation. type PrmContainerDelete struct { - prmCommonMeta + // FrostFS request X-Headers + XHeaders []string - idSet bool - id cid.ID + ContainerID *cid.ID - tokSet bool - tok session.Container + Session *session.Container } // SetContainer sets identifier of the FrostFS container to be removed. // Required parameter. +// +// Deprecated: Use PrmContainerDelete.Container instead. func (x *PrmContainerDelete) SetContainer(id cid.ID) { - x.id = id - x.idSet = true + x.ContainerID = &id } -func (x *PrmContainerDelete) buildRequest(c *Client) (*v2container.DeleteRequest, error) { - if !x.idSet { +func (prm *PrmContainerDelete) buildRequest(c *Client) (*v2container.DeleteRequest, error) { + if prm.ContainerID == nil { return nil, errorMissingContainer } + if len(prm.XHeaders)%2 != 0 { + return nil, errorInvalidXHeaders + } + var cidV2 refs.ContainerID - x.id.WriteToV2(&cidV2) + prm.ContainerID.WriteToV2(&cidV2) // Container contract expects signature of container ID value, // don't get confused with stable marshaled protobuf container.ID structure. @@ -61,11 +65,11 @@ func (x *PrmContainerDelete) buildRequest(c *Client) (*v2container.DeleteRequest reqBody.SetSignature(&sigv2) var meta v2session.RequestMetaHeader - writeXHeadersToMeta(x.prmCommonMeta.xHeaders, &meta) + writeXHeadersToMeta(prm.XHeaders, &meta) - if x.tokSet { + if prm.Session != nil { var tokv2 v2session.Token - x.tok.WriteToV2(&tokv2) + prm.Session.WriteToV2(&tokv2) meta.SetSessionToken(&tokv2) } @@ -82,9 +86,10 @@ func (x *PrmContainerDelete) buildRequest(c *Client) (*v2container.DeleteRequest // This may affect the execution of an operation (e.g. access control). // // Must be signed. +// +// Deprecated: Use PrmContainerDelete.Session instead. func (x *PrmContainerDelete) WithinSession(tok session.Container) { - x.tok = tok - x.tokSet = true + x.Session = &tok } // ResContainerDelete groups resulting values of ContainerDelete operation.