...
Retrieves the list of folders and files available for recovery at specified Path. If Path is not specified returns a list of systems
Input fields:
Parameter | Description | Type / Validation Rules |
---|---|---|
Identity | identity object with valid token | IdentityContract |
Filter | filter object with includes:
| RecoveryFilterContract |
Path | Path of directory to load children from | string |
Output fields:
Output Value | Description | |
---|---|---|
Items | array of recovery items which include Path and can be one of two types:
| array of RecoveryItemContract |
MethodCallFailed
Code Block | ||||
---|---|---|---|---|
| ||||
[Test]
public void ExtarctAllRecoveryTree_Ok()
{
//Init SDK
_client = new InfrascaleClient();
_client.Connect();
var signInResponse = _client.SignIn(new SignInRequest { Credentials = new CredentialsContract { Login = _testAccount, Password = _testAccountPassword } });
RefreshRecoveryInfo(signInResponse.Identity);
//Extract metadata items
var request = new GetRecoveryItemsRequest
{
Identity = signInResponse.Identity,
Path = Environment.MachineName
};
var output = _client.GetRecoveryItems(request);
//Handle files tree
Tools.PrintTree(output);
//Detach client
_client.SignOut(new SignOutRequest { Identity = signInResponse.Identity });
_client.Disconnect();
}
public static void PrintTree(GetRecoveryItemsResponse response)
{
Action<RecoveryItemContract, int> handleLevel = null;
handleLevel = (treeItem, level) =>
{
var padding = Enumerable.Range(0, level).Aggregate(new StringBuilder(), (sb, i) => sb.Append(" "));
var dir = treeItem as RecoveryDirectoryContract;
if (dir != null)
{
foreach (var dirItem in dir.Children)
{
if (dirItem is RecoveryDirectoryContract)
Console.WriteLine(padding + dirItem.Path);
else
Console.WriteLine(padding + Path.GetFileName(dirItem.Path));
handleLevel(dirItem, level + 1);
}
}
};
foreach (var item in response.Items)
{
Console.WriteLine(item.Path);
handleLevel(item, 0);
}
}
public static void RefreshRecoveryInfo(IdentityContract identity)
{
_client.SubscribeCallback(new SubscribeCallbackRequest
{
Identity = identity
});
bool isCompleted = false;
Action<JobSessionContract> isCompletedFunc = contract =>
isCompleted = contract.JobType == JobTypeContract.RefreshRecoveryInfo;
_client.JobCompleted += isCompletedFunc;
_client.RunRefreshRecoveryInfoJob(new RunRefreshRecoveryInfoJobRequest { Identity = identity });
while (!isCompleted)
{
Thread.Sleep(100);
}
_client.JobCompleted -= isCompletedFunc;
}
|
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
ALEXK\C: ALEXK\D: |
Code Block | ||
---|---|---|
| ||
Sample filter to get items for the last 7 days where filename contains "123", size between 1 byte and 1 megabyte and located on disc C: var filter = new RecoveryFilterContract { DateFrom = DateTime.Today.AddDays(-7), DateTo = DateTime.Today, FileName = "123", FileSizeInKbFrom = 1, FileSizeInKbTo = 1024, PathFilter = "C:\\" } |
Operation: RunRecoveryJob
Starts recovery job
Input fields:
Parameter | Description | Type / Validation Rules |
---|---|---|
Identity | identity object with valid token | IdentityContract |
Job | job object with includes:
| RecoveryJobContract |
Output fields:
Output Value | Description | |
---|---|---|
JobSession | job details including RecoveryProgress | RecoveryJobSessionContract |
MethodCallFailed
...