get container

This commit is contained in:
Dmitrii Stepanov 2024-06-13 11:32:48 +03:00
parent 57ba7f9148
commit ae9b826c45
7 changed files with 141 additions and 0 deletions

25
Container/Get.cs Normal file
View file

@ -0,0 +1,25 @@
using System;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
namespace FrostFS.Powershell.Container
{
[Cmdlet(VerbsCommon.Get, "FrostFSNodeContainer")]
[OutputType(typeof(FrostFS.SDK.ModelsV2.Container))]
public class GetContainerCmdlet : PSCmdlet
{
[Parameter(Mandatory = true)]
public FrostFS.Powershell.Connection.Connection Connection { get; set; }
[Parameter(Mandatory = true)]
public string ID { get; set; }
protected override void ProcessRecord()
{
var hash = FrostFS.SDK.Cryptography.Base58.Decode(ID);
var containerID = new FrostFS.SDK.ModelsV2.ContainerId(FrostFS.SDK.Cryptography.Base58.Encode(hash));
var container = Connection.Client.GetContainerAsync(containerID).GetAwaiter().GetResult();
WriteObject(container);
}
}
}