Пример #1
0
        public BackupProgress StartBackup(BackupStorageType storageType, StorageParams storageParams, bool backupMail)
        {
            DemandPermissions();

            var backupRequest = new StartBackupRequest
                {
                    TenantId = GetCurrentTenantId(),
                    UserId = SecurityContext.CurrentAccount.ID,
                    BackupMail = backupMail,
                    StorageType = storageType
                };

            switch (storageType)
            {
                case BackupStorageType.ThridpartyDocuments:
                case BackupStorageType.Documents:
                    backupRequest.StorageBasePath = storageParams.FolderId;
                    break;
                case BackupStorageType.CustomCloud:
                    ValidateS3Settings(storageParams.AccessKeyId, storageParams.SecretAccessKey, storageParams.Bucket, storageParams.Region);
                    CoreContext.Configuration.SaveSection(new AmazonS3Settings
                        {
                            AccessKeyId = storageParams.AccessKeyId,
                            SecretAccessKey = storageParams.SecretAccessKey,
                            Bucket = storageParams.Bucket,
                            Region = storageParams.Region
                        });
                    break;
            }

            using (var service = new BackupServiceClient())
            {
                return service.StartBackup(backupRequest);
            }
        }
 public BackupProgress StartBackup(StartBackupRequest request)
 {
     return(Channel.StartBackup(request));
 }