[#142] sdk/container: Add converters to and from v2

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-09-15 11:04:36 +03:00 committed by Stanislav Bogatyrev
parent 012cea1add
commit 3c7c363002
2 changed files with 22 additions and 10 deletions

View file

@ -100,7 +100,7 @@ func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, op
}
reqBody := new(v2container.PutRequestBody)
reqBody.SetContainer(&cnr.Container)
reqBody.SetContainer(cnr.ToV2())
// sign container
signWrapper := v2signature.StableMarshalerWrapper{SM: reqBody.GetContainer()}
@ -182,9 +182,7 @@ func (c Client) getContainerV2(ctx context.Context, id *container.ID, opts ...Ca
return nil, errors.Wrap(err, "can't verify response message")
}
return &container.Container{
Container: *resp.GetBody().GetContainer(),
}, nil
return container.NewContainerFromV2(resp.GetBody().GetContainer()), nil
default:
return nil, unsupportedProtocolErr
}