/// <summary> /// The process record method. /// </summary> protected override void ProcessRecord() { ResponseType response = null; base.ProcessRecord(); try { var monitoringType = new ChangeServerMonitoringPlanType { id = Server.id, servicePlan = ServicePlan }; response = Connection.ApiClient.ServerManagement.Monitoring.ChangeServerMonitoringPlan(monitoringType).Result; } catch (AggregateException ae) { ae.Handle( e => { if (e is ComputeApiException) { WriteError(new ErrorRecord(e, "-2", ErrorCategory.InvalidOperation, Connection)); } else { // if (e is HttpRequestException) ThrowTerminatingError(new ErrorRecord(e, "-1", ErrorCategory.ConnectionError, Connection)); } return(true); }); } WriteObject(response); }
/// <summary> /// Changes the service plan. /// </summary> /// <param name="changeServerMonitoringPlan">The monitoring settings.</param> /// <returns>The status response</returns> public async Task <ResponseType> ChangeServerMonitoringPlan(ChangeServerMonitoringPlanType changeServerMonitoringPlan) { return(await _apiClient.PostAsync <ChangeServerMonitoringPlanType, ResponseType>( ApiUris.ChangeServerMonitoringPlan(_apiClient.OrganizationId), changeServerMonitoringPlan)); }