/// <summary>
 /// Updates recommended action state.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Sql.IServerRecommendedActionOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the Resource Group.
 /// </param>
 /// <param name='serverName'>
 /// Required. The name of the Azure SQL server.
 /// </param>
 /// <param name='advisorName'>
 /// Required. The name of the Azure SQL Server advisor.
 /// </param>
 /// <param name='recommendedActionName'>
 /// Required. The name of the Azure SQL Server recommended action.
 /// </param>
 /// <param name='parameters'>
 /// Required. The required parameters for updating recommended action
 /// state.
 /// </param>
 /// <returns>
 /// Represents the response to an update recommended action request.
 /// </returns>
 public static Task<RecommendedActionUpdateResponse> UpdateAsync(this IServerRecommendedActionOperations operations, string resourceGroupName, string serverName, string advisorName, string recommendedActionName, RecommendedActionUpdateParameters parameters)
 {
     return operations.UpdateAsync(resourceGroupName, serverName, advisorName, recommendedActionName, parameters, CancellationToken.None);
 }
        public void UpdateServerRecommendedActionState()
        {
            using (UndoContext context = UndoContext.Current)
            {
                context.Start();
                var handler = new BasicDelegatingHandler();
                var sqlClient = Sql2ScenarioHelper.GetSqlClient(handler);
                RecommendedActionUpdateParameters updateParameters = new RecommendedActionUpdateParameters()
                {
                    Properties = new RecommendedActionUpdateProperties()
                    {
                        State = new RecommendedActionUpdateStateInfo()
                        {
                            CurrentValue = "Pending"
                        }
                    }
                };

                var response = sqlClient.ServerRecommendedActions.Update(ResourceGroupName, ServerName, AdvisorName, RecommendedActionName, updateParameters);
                ValidateSingleRecommendedAction(response.RecommendedAction, ServerRecommendedActionType, expectedState: "Pending");
            }
        }
 /// <summary>
 /// Updates recommended action state.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Sql.IServerRecommendedActionOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the Resource Group.
 /// </param>
 /// <param name='serverName'>
 /// Required. The name of the Azure SQL server.
 /// </param>
 /// <param name='advisorName'>
 /// Required. The name of the Azure SQL Server advisor.
 /// </param>
 /// <param name='recommendedActionName'>
 /// Required. The name of the Azure SQL Server recommended action.
 /// </param>
 /// <param name='parameters'>
 /// Required. The required parameters for updating recommended action
 /// state.
 /// </param>
 /// <returns>
 /// Represents the response to an update recommended action request.
 /// </returns>
 public static RecommendedActionUpdateResponse Update(this IServerRecommendedActionOperations operations, string resourceGroupName, string serverName, string advisorName, string recommendedActionName, RecommendedActionUpdateParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IServerRecommendedActionOperations)s).UpdateAsync(resourceGroupName, serverName, advisorName, recommendedActionName, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }