[#1] Move files to top level directory
Signed-off-by: Ivan Pchelintsev <i.pchelintsev@yadro.com>
This commit is contained in:
parent
013d8a8436
commit
11eff4e23e
76 changed files with 0 additions and 0 deletions
89
src/FrostFS.SDK.ClientV2/Services/Container.cs
Normal file
89
src/FrostFS.SDK.ClientV2/Services/Container.cs
Normal file
|
@ -0,0 +1,89 @@
|
|||
using FrostFS.Container;
|
||||
using FrostFS.Refs;
|
||||
using FrostFS.SDK.ClientV2.Mappers.GRPC;
|
||||
|
||||
namespace FrostFS.SDK.ClientV2;
|
||||
|
||||
public partial class Client
|
||||
{
|
||||
public async Task<GetResponse> GetContainerAsync(ContainerID cid)
|
||||
{
|
||||
var request = new GetRequest
|
||||
{
|
||||
Body = new GetRequest.Types.Body
|
||||
{
|
||||
ContainerId = cid
|
||||
},
|
||||
};
|
||||
request.AddMetaHeader();
|
||||
request.Sign(_key);
|
||||
return await _containerServiceClient.GetAsync(request);
|
||||
}
|
||||
|
||||
public async Task<ListResponse> ListContainersAsync()
|
||||
{
|
||||
var request = new ListRequest
|
||||
{
|
||||
Body = new ListRequest.Types.Body
|
||||
{
|
||||
OwnerId = _owner.ToGrpcMessage()
|
||||
}
|
||||
};
|
||||
request.AddMetaHeader();
|
||||
request.Sign(_key);
|
||||
return await _containerServiceClient.ListAsync(request);
|
||||
}
|
||||
|
||||
public async Task<PutResponse> CreateContainerAsync(Container.Container container)
|
||||
{
|
||||
container.OwnerId = _owner.ToGrpcMessage();
|
||||
container.Version = Version.ToGrpcMessage();
|
||||
var request = new PutRequest
|
||||
{
|
||||
Body = new PutRequest.Types.Body
|
||||
{
|
||||
Container = container,
|
||||
Signature = _key.SignRFC6979(container),
|
||||
}
|
||||
};
|
||||
request.AddMetaHeader();
|
||||
request.Sign(_key);
|
||||
return await _containerServiceClient.PutAsync(request);
|
||||
}
|
||||
|
||||
public async Task<DeleteResponse> DeleteContainerAsync(ContainerID cid)
|
||||
{
|
||||
var request = new DeleteRequest
|
||||
{
|
||||
Body = new DeleteRequest.Types.Body
|
||||
{
|
||||
ContainerId = cid,
|
||||
Signature = _key.SignRFC6979(cid.Value)
|
||||
}
|
||||
};
|
||||
request.AddMetaHeader();
|
||||
request.Sign(_key);
|
||||
return await _containerServiceClient.DeleteAsync(request);
|
||||
}
|
||||
|
||||
// private void PrepareContainerSessionToken(RequestMetaHeader meta, SessionToken sessionToken, ContainerID? cid,
|
||||
// ContainerSessionContext.Types.Verb verb)
|
||||
// {
|
||||
// if (meta.SessionToken is not null) return;
|
||||
// meta.SessionToken = sessionToken;
|
||||
// var ctx = new ContainerSessionContext
|
||||
// {
|
||||
// Verb = verb
|
||||
// };
|
||||
// if (cid is null)
|
||||
// {
|
||||
// ctx.Wildcard = true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ctx.ContainerId = cid;
|
||||
// }
|
||||
// meta.SessionToken.Body.Container = ctx;
|
||||
// meta.SessionToken.Signature = _key.SignMessagePart(meta.SessionToken.Body);
|
||||
// }
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue