[#121] client: Make PrmContainerList fields public #181
3 changed files with 10 additions and 27 deletions
|
@ -24,24 +24,6 @@ func (x statusRes) Status() apistatus.Status {
|
|||
return x.st
|
||||
}
|
||||
|
||||
// groups meta parameters shared between all Client operations.
|
||||
type prmCommonMeta struct {
|
||||
// FrostFS request X-Headers
|
||||
xHeaders []string
|
||||
}
|
||||
|
||||
// WithXHeaders specifies list of extended headers (string key-value pairs)
|
||||
// to be attached to the request. Must have an even length.
|
||||
//
|
||||
// Slice must not be mutated until the operation completes.
|
||||
func (x *prmCommonMeta) WithXHeaders(hs ...string) {
|
||||
if len(hs)%2 != 0 {
|
||||
panic("slice of X-Headers with odd length")
|
||||
}
|
||||
|
||||
x.xHeaders = hs
|
||||
}
|
||||
|
||||
func writeXHeadersToMeta(xHeaders []string, h *v2session.RequestMetaHeader) {
|
||||
if len(xHeaders) == 0 {
|
||||
return
|
||||
|
|
|
@ -17,26 +17,26 @@ import (
|
|||
|
||||
// PrmContainerList groups parameters of ContainerList operation.
|
||||
type PrmContainerList struct {
|
||||
prmCommonMeta
|
||||
XHeaders []string
|
||||
|
||||
ownerSet bool
|
||||
ownerID user.ID
|
||||
Account *user.ID
|
||||
}
|
||||
|
||||
// SetAccount sets identifier of the FrostFS account to list the containers.
|
||||
// Required parameter.
|
||||
//
|
||||
// Deprecated: Use PrmContainerList.Account instead.
|
||||
func (x *PrmContainerList) SetAccount(id user.ID) {
|
||||
x.ownerID = id
|
||||
x.ownerSet = true
|
||||
x.Account = &id
|
||||
}
|
||||
|
||||
func (x *PrmContainerList) buildRequest(c *Client) (*v2container.ListRequest, error) {
|
||||
if !x.ownerSet {
|
||||
if x.Account == nil {
|
||||
return nil, errorAccountNotSet
|
||||
}
|
||||
|
||||
var ownerV2 refs.OwnerID
|
||||
x.ownerID.WriteToV2(&ownerV2)
|
||||
x.Account.WriteToV2(&ownerV2)
|
||||
|
||||
reqBody := new(v2container.ListRequestBody)
|
||||
reqBody.SetOwnerID(&ownerV2)
|
||||
|
|
|
@ -503,8 +503,9 @@ func (c *clientWrapper) containerList(ctx context.Context, prm PrmContainerList)
|
|||
return nil, err
|
||||
}
|
||||
|
||||
var cliPrm sdkClient.PrmContainerList
|
||||
cliPrm.SetAccount(prm.ownerID)
|
||||
cliPrm := sdkClient.PrmContainerList{
|
||||
Account: &prm.ownerID,
|
||||
}
|
||||
|
||||
start := time.Now()
|
||||
res, err := cl.ContainerList(ctx, cliPrm)
|
||||
|
|
Loading…
Add table
Reference in a new issue