Click or drag to resize

IInfrascaleSdkGetOnlineBackupSettings Method

Get Online Backup settings from the settings storage.

Namespace:  SOS.SDK.Contracts
Assembly:  SOS.SDK (in SOS.SDK.dll) Version: 7.6.1.5742
Syntax
C#
GetOnlineBackupSettingsResponse GetOnlineBackupSettings(
	GetOnlineBackupSettingsRequest request
)

Parameters

request
Type: SOS.SDK.Contracts.DataContracts.RequestsGetOnlineBackupSettingsRequest
Container with request parameters.

Return Value

Type: GetOnlineBackupSettingsResponse
Container with actual Online Backup settings for requested IdentityContract.
Exceptions
ExceptionCondition
NotSignedIn
MethodCallFailed
Examples
Example 1
using System;
using System.Diagnostics;
using System.Security.Principal;
using SOS.SDK.Contracts.DataContracts;
using SOS.SDK.Contracts.DataContracts.Jobs;
using SOS.SDK.Contracts.DataContracts.Jobs.Backup;
using SOS.SDK.Contracts.DataContracts.Requests;
using SOS.SDK.Tools.Creators;
using SOS.SDK.Tools.Runners;

namespace SOS.SDK.Test.Examples.OnlineBackup
{
    public class RunOnlineBackupExamples
    {
        private string _testAccount = @"sdk.test@sosonlinebackup.com";
        private string _testAccountPassword = @"qweqwe";
        private InfrascaleClient _client;
        private IdentityContract _identity;

        public void SignIn()
        {
            if (_client == null)
            {
                _client = new InfrascaleClient();
                _client.Connect();
                _identity = null;
            }

            if (_identity == null)
            {
                var signInResponse = _client.SignIn(new SignInRequest
                {
                    Credentials = new CredentialsContract { Login = _testAccount, Password = _testAccountPassword }
                });

                _identity = signInResponse.Identity;

                _client.SubscribeCallback(new SubscribeCallbackRequest {Identity = _identity});
            }
        }

        public void GetOnlineBackupSettings()
        {
            SignIn();

            // Get Online Backup settings, stored for authenticated user.
            var response = _client.GetOnlineBackupSettings(new GetOnlineBackupSettingsRequest { Identity = _identity });

            var fileSet = response.Settings.ProtectFileset;

            Console.WriteLine("Included Directories:");

            foreach (var filesetDirContract in fileSet.IncludedDirs)
            {
                Console.WriteLine(filesetDirContract.DirectoryPath);
            }

            Console.WriteLine("Included Files:");

            foreach (var filesetFileContract in fileSet.IncludedFiles)
            {
                Console.WriteLine(filesetFileContract.FilePath);
            }

            Console.WriteLine("Excluded Directories:");

            foreach (var filesetExcludeItemContract in fileSet.Excludes)
            {
                Console.WriteLine(filesetExcludeItemContract);
            }

            Console.WriteLine("Registerd Network Shares:");

            foreach (var settingsNetShare in response.Settings.NetShares)
            {
                Console.WriteLine("Login: {0}; HavePassword: {1}; RemoteName: {2};", settingsNetShare.Credentials.Login,
                    string.IsNullOrEmpty(settingsNetShare.Credentials.Password), settingsNetShare.RemoteName);
            }

            SignOut();
        }
    }
}
See Also