/// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Monitoring.Alerts.IRuleOperations. /// </param> /// <param name='parameters'> /// Required. The rule to create or update. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static AzureOperationResponse CreateOrUpdate(this IRuleOperations operations, RuleCreateOrUpdateParameters parameters) { return Task.Factory.StartNew((object s) => { return ((IRuleOperations)s).CreateOrUpdateAsync(parameters); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Monitoring.Alerts.IRuleOperations. /// </param> /// <param name='parameters'> /// The rule to create or update. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static OperationResponse CreateOrUpdate(this IRuleOperations operations, RuleCreateOrUpdateParameters parameters) { try { return operations.CreateOrUpdateAsync(parameters).Result; } catch (AggregateException ex) { if (ex.InnerExceptions.Count > 1) { throw; } else { throw ex.InnerException; } } }
/// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Monitoring.Alerts.IRuleOperations. /// </param> /// <param name='parameters'> /// The rule to create or update. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static Task<OperationResponse> CreateOrUpdateAsync(this IRuleOperations operations, RuleCreateOrUpdateParameters parameters) { return operations.CreateOrUpdateAsync(parameters, CancellationToken.None); }