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));
 }
예제 #2
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
     }));
 }
        /// <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
            }));
        }
예제 #4
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
            }));
        }