/// <summary>
        /// Modifies the backup client on the specified server.
        /// </summary>
        /// <param name="client">The <see cref="ComputeApiClient"/> object</param>
        /// <param name="serverId">The server id</param>
        /// <param name="backupClient">The backup client to modify</param>
        /// <param name="storagePolicy">The storage policy to modify</param>
        /// <param name="schedulePolicy">The schedule policy to modify</param>
        /// <param name="alertingType">The alerting type to modify</param>
        /// <returns>The status of the request</returns>
        public static async Task <Status> ModifyBackupClientAsync(
            this IComputeApiClient client,
            string serverId,
            BackupClientDetailsType backupClient,
            BackupStoragePolicy storagePolicy,
            BackupSchedulePolicy schedulePolicy,
            AlertingType alertingType)
        {
            if (backupClient == null)
            {
                throw new ArgumentNullException("backupClient", "argument cannot be null!");
            }
            if (storagePolicy == null)
            {
                throw new ArgumentNullException("storagePolicy", "argument cannot be null!");
            }
            if (schedulePolicy == null)
            {
                throw new ArgumentNullException("schedulePolicy", "argument cannot be null!");
            }

            return
                (await
                 client.WebApi.ApiPostAsync <ModifyBackupClient, Status>(
                     ApiUris.ModifyBackupClient(client.Account.OrganizationId, serverId, backupClient.id),
                     new ModifyBackupClient
            {
                schedulePolicyName = schedulePolicy.name,
                storagePolicyName = storagePolicy.name,
                alerting = alertingType
            }));
        }
 public static async Task <Status> ModifyBackupClient(
     this IComputeApiClient client,
     string serverId,
     BackupClientDetailsType backupClient,
     BackupStoragePolicy storagePolicy,
     BackupSchedulePolicy schedulePolicy,
     AlertingType alertingType)
 {
     return(await client.Backup.ModifyBackupClient(serverId, backupClient, storagePolicy, schedulePolicy, alertingType));
 }
 public static async Task <Status> AddBackupClient(
     this IComputeApiClient client,
     string serverId,
     BackupClientType clientType,
     BackupStoragePolicy storagePolicy,
     BackupSchedulePolicy schedulePolicy,
     AlertingType alertingType)
 {
     return(await client.Backup.AddBackupClient(serverId, clientType, storagePolicy, schedulePolicy, alertingType));
 }
示例#4
0
 /// <summary>
 /// The modify backup client.
 /// </summary>
 /// <param name="serverId">
 /// The server id.
 /// </param>
 /// <param name="backupClient">
 /// The backup client.
 /// </param>
 /// <param name="storagePolicy">
 /// The storage policy.
 /// </param>
 /// <param name="schedulePolicy">
 /// The schedule policy.
 /// </param>
 /// <param name="alertingType">
 /// The alerting type.
 /// </param>
 /// <returns>
 /// The <see cref="Task"/>.
 /// </returns>
 public async Task <Status> ModifyBackupClient(
     string serverId,
     BackupClientDetailsType backupClient,
     BackupStoragePolicy storagePolicy,
     BackupSchedulePolicy schedulePolicy,
     AlertingType alertingType)
 {
     return
         (await
          _apiClient.PostAsync <ModifyBackupClient, Status>(
              ApiUris.ModifyBackupClient(_apiClient.OrganizationId, serverId, backupClient.id),
              new ModifyBackupClient
     {
         schedulePolicyName = schedulePolicy.name,
         storagePolicyName = storagePolicy.name,
         alerting = alertingType
     }));
 }
示例#5
0
 /// <summary>
 /// The add backup client.
 /// </summary>
 /// <param name="serverId">
 /// The server id.
 /// </param>
 /// <param name="clientType">
 /// The client type.
 /// </param>
 /// <param name="storagePolicy">
 /// The storage policy.
 /// </param>
 /// <param name="schedulePolicy">
 /// The schedule policy.
 /// </param>
 /// <param name="alertingType">
 /// The alerting type.
 /// </param>
 /// <returns>
 /// The <see cref="Task"/>.
 /// </returns>
 public async Task <Status> AddBackupClient(
     string serverId,
     BackupClientType clientType,
     BackupStoragePolicy storagePolicy,
     BackupSchedulePolicy schedulePolicy,
     AlertingType alertingType)
 {
     return
         (await
          _apiClient.PostAsync <NewBackupClient, Status>(
              ApiUris.AddBackupClient(_apiClient.OrganizationId, serverId),
              new NewBackupClient
     {
         schedulePolicyName = schedulePolicy.name,
         storagePolicyName = storagePolicy.name,
         type = clientType.type,
         alerting = alertingType
     }));
 }
示例#6
0
        /// <summary>
        /// The modify backup client.
        /// </summary>
        /// <param name="serverId">
        /// The server id.
        /// </param>
        /// <param name="backupClient">
        /// The backup client.
        /// </param>
        /// <param name="storagePolicy">
        /// The storage policy.
        /// </param>
        /// <param name="schedulePolicy">
        /// The schedule policy.
        /// </param>
        /// <param name="alertingType">
        /// The alerting type.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public async Task <Status> ModifyBackupClient(
            string serverId,
            BackupClientDetailsType backupClient,
            BackupStoragePolicy storagePolicy,
            BackupSchedulePolicy schedulePolicy,
            AlertingType alertingType)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(serverId), "Server cannot be null or empty");
            Contract.Requires(backupClient != null, "Backup client cannot be null");

            return
                (await
                 _apiClient.PostAsync <ModifyBackupClient, Status>(
                     ApiUris.ModifyBackupClient(_apiClient.OrganizationId, serverId, backupClient.id),
                     new ModifyBackupClient
            {
                schedulePolicyName = schedulePolicy.name,
                storagePolicyName = storagePolicy.name,
                alerting = alertingType
            }));
        }
        /// <summary>
        /// Adds a backup client to a specified server.
        /// </summary>
        /// <param name="client">The <see cref="ComputeApiClient"/> object</param>
        /// <param name="serverId">The server id</param>
        /// <param name="clientType">The backup client type to add</param>
        /// <param name="storagePolicy">The backup storage policy</param>
        /// <param name="schedulePolicy">The backup schedule policy</param>
        /// <param name="alertingType">The alerting type</param>
        /// <returns>The status of the request</returns>
        public static async Task <Status> AddBackupClientAsync(
            this IComputeApiClient client,
            string serverId,
            BackupClientType clientType,
            BackupStoragePolicy storagePolicy,
            BackupSchedulePolicy schedulePolicy,
            AlertingType alertingType)
        {
            if (string.IsNullOrWhiteSpace(serverId))
            {
                throw new ArgumentException("argument cannot be null, empty or composed of whitespaces only!", "serverId");
            }
            if (clientType == null)
            {
                throw new ArgumentNullException("clientType", "argument cannot be null!");
            }
            if (storagePolicy == null)
            {
                throw new ArgumentNullException("storagePolicy", "argument cannot be null!");
            }
            if (schedulePolicy == null)
            {
                throw new ArgumentNullException("schedulePolicy", "argument cannot be null!");
            }

            return
                (await
                 client.WebApi.ApiPostAsync <NewBackupClient, Status>(
                     ApiUris.AddBackupClient(client.Account.OrganizationId, serverId),
                     new NewBackupClient
            {
                schedulePolicyName = schedulePolicy.name,
                storagePolicyName = storagePolicy.name,
                type = clientType.type,
                alerting = alertingType
            }));
        }
示例#8
0
        /// <summary>
        /// The add backup client.
        /// </summary>
        /// <param name="serverId">
        /// The server id.
        /// </param>
        /// <param name="clientType">
        /// The client type.
        /// </param>
        /// <param name="storagePolicy">
        /// The storage policy.
        /// </param>
        /// <param name="schedulePolicy">
        /// The schedule policy.
        /// </param>
        /// <param name="alertingType">
        /// The alerting type.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public async Task <Status> AddBackupClient(
            string serverId,
            BackupClientType clientType,
            BackupStoragePolicy storagePolicy,
            BackupSchedulePolicy schedulePolicy,
            AlertingType alertingType)
        {
            Contract.Requires(!string.IsNullOrEmpty(serverId), "Server id cannot be null or empty");
            Contract.Requires(clientType != null, "Client type cannot be null");
            Contract.Requires(storagePolicy != null, "Storage policy cannot be null");
            Contract.Requires(schedulePolicy != null, "Schedule policy cannot be null");

            return
                (await
                 _apiClient.PostAsync <NewBackupClient, Status>(
                     ApiUris.AddBackupClient(_apiClient.OrganizationId, serverId),
                     new NewBackupClient
            {
                schedulePolicyName = schedulePolicy.name,
                storagePolicyName = storagePolicy.name,
                type = clientType.type,
                alerting = alertingType
            }));
        }