예제 #1
0
        public async Task <Job> CreateJobForOrganizationAsync(string organizationId,
                                                              string repositoryId,
                                                              string name,
                                                              string description,
                                                              BackupType backupType,
                                                              SchedulePolicy schedulePolicy,
                                                              JobItemCollection selectedItems,
                                                              string proxyId,
                                                              bool runNow,
                                                              CancellationToken ct = default)
        {
            ParameterValidator.ValidateNotNull(organizationId, nameof(organizationId));

            var bodyParameters = new BodyParameters()
                                 .AddOptionalParameter("Name", name)
                                 .AddOptionalParameter("Description", description)
                                 .AddOptionalParameter("BackupType", backupType)
                                 .AddOptionalParameter("SchedulePolicy", schedulePolicy)
                                 .AddOptionalParameter("SelectedItems", selectedItems)
                                 .AddOptionalParameter("ProxyId", proxyId)
                                 .AddMandatoryParameter("RepositoryId", repositoryId)
                                 .AddOptionalParameter("RunNow", runNow);

            var url = $"organizations/{organizationId}/jobs";

            return(await _baseClient.PostAsync <Job>(url, bodyParameters, ct));
        }
        public async Task <BackupRepository> AddBackupRepositoryAsync(BackupRepostioryForCreation newRepository,
                                                                      CancellationToken ct = default)
        {
            var bodyParameters = new BodyParameters()
                                 .AddOptionalParameter("Name", newRepository.Name)
                                 .AddOptionalParameter("ProxyId", newRepository.ProxyId)
                                 .AddOptionalParameter("Path", newRepository.Path)
                                 .AddOptionalParameter("Description", newRepository.Description)
                                 .AddOptionalParameter("RetentionType", newRepository.RetentionType)
                                 .AddOptionalParameter("RetentionPeriodType", newRepository.RetentionPeriodType)
                                 .AddOptionalParameter("DailyRetentionPeriod", newRepository.DailyRetentionPeriod)
                                 .AddOptionalParameter("MonthlyRetentionPeriod", newRepository.MonthlyRetentionPeriod)
                                 .AddOptionalParameter("YearlyRetentionPeriod", newRepository.YearlyRetentionPeriod)
                                 .AddOptionalParameter("RetentionFrequencyType", newRepository.RetentionFrequencyType)
                                 .AddOptionalParameter("DailyTime", newRepository.DailyTime)
                                 .AddOptionalParameter("DailyType", newRepository.DailyType)
                                 .AddOptionalParameter("MonthlyTime", newRepository.MonthlyTime)
                                 .AddOptionalParameter("MonthlyDayNumber", newRepository.MonthlyDayNumber)
                                 .AddOptionalParameter("MonthlyDayOfWeek", newRepository.MonthlyDayOfWeek)
                                 .AddOptionalParameter("AttachUsedRepository", newRepository.AttachUsedRepository)
                                 .AddOptionalParameter("ObjectStorageId", newRepository.ObjectStorageId)
                                 .AddOptionalParameter("ObjectStorageCachePath", newRepository.ObjectStorageCachePath)
                                 .AddOptionalParameter("ObjectStorageEncryptionEnabled", newRepository.ObjectStorageEncryptionEnabled)
                                 .AddOptionalParameter("EncryptionKeyId", newRepository.EncryptionKeyId);

            var url = "backuprepositories";

            return(await _baseClient.PostAsync <BackupRepository>(url, bodyParameters, ct));
        }
예제 #3
0
        public async Task StopRestoreSessionAsync(string restoreSessionId, CancellationToken ct = default)
        {
            ParameterValidator.ValidateNotNull(restoreSessionId, nameof(restoreSessionId));

            var bodyParameters = new BodyParameters()
                                 .AddNullParameter("stop");

            var url = $"restoresessions/{restoreSessionId}/action";
            await _baseClient.PostAsync(url, bodyParameters, ct);
        }