using FrostFS.Container; using FrostFS.Refs; using FrostFS.SDK.ClientV2.Mappers.GRPC; namespace FrostFS.SDK.ClientV2; public partial class Client { public async Task 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 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 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 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); // } }