forked from TrueCloudLab/frostfs-sdk-go
[#121] client: Make PrmBalanceGet fields public
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
71335489ae
commit
84315fab6a
2 changed files with 10 additions and 9 deletions
|
@ -17,26 +17,26 @@ import (
|
||||||
|
|
||||||
// PrmBalanceGet groups parameters of BalanceGet operation.
|
// PrmBalanceGet groups parameters of BalanceGet operation.
|
||||||
type PrmBalanceGet struct {
|
type PrmBalanceGet struct {
|
||||||
prmCommonMeta
|
XHeaders []string
|
||||||
|
|
||||||
accountSet bool
|
Account *user.ID
|
||||||
account user.ID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAccount sets identifier of the FrostFS account for which the balance is requested.
|
// SetAccount sets identifier of the FrostFS account for which the balance is requested.
|
||||||
// Required parameter.
|
// Required parameter.
|
||||||
|
//
|
||||||
|
// Deprecated: Use PrmBalanceGet.Account instead.
|
||||||
func (x *PrmBalanceGet) SetAccount(id user.ID) {
|
func (x *PrmBalanceGet) SetAccount(id user.ID) {
|
||||||
x.account = id
|
x.Account = &id
|
||||||
x.accountSet = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PrmBalanceGet) buildRequest(c *Client) (*v2accounting.BalanceRequest, error) {
|
func (x *PrmBalanceGet) buildRequest(c *Client) (*v2accounting.BalanceRequest, error) {
|
||||||
if !x.accountSet {
|
if x.Account == nil {
|
||||||
return nil, errorAccountNotSet
|
return nil, errorAccountNotSet
|
||||||
}
|
}
|
||||||
|
|
||||||
var accountV2 refs.OwnerID
|
var accountV2 refs.OwnerID
|
||||||
x.account.WriteToV2(&accountV2)
|
x.Account.WriteToV2(&accountV2)
|
||||||
|
|
||||||
var body v2accounting.BalanceRequestBody
|
var body v2accounting.BalanceRequestBody
|
||||||
body.SetOwnerID(&accountV2)
|
body.SetOwnerID(&accountV2)
|
||||||
|
|
|
@ -417,8 +417,9 @@ func (c *clientWrapper) balanceGet(ctx context.Context, prm PrmBalanceGet) (acco
|
||||||
return accounting.Decimal{}, err
|
return accounting.Decimal{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var cliPrm sdkClient.PrmBalanceGet
|
cliPrm := sdkClient.PrmBalanceGet{
|
||||||
cliPrm.SetAccount(prm.account)
|
Account: &prm.account,
|
||||||
|
}
|
||||||
|
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
res, err := cl.BalanceGet(ctx, cliPrm)
|
res, err := cl.BalanceGet(ctx, cliPrm)
|
||||||
|
|
Loading…
Reference in a new issue