DescribeInstanceStatus() private method

private DescribeInstanceStatus ( ) : DescribeInstanceStatusResponse
return DescribeInstanceStatusResponse
        /// <summary>
        ///     This method waits for all instances passed in to be marked as running in AWS. I assume
        ///     we can start using them once they are running :)
        /// </summary>
        /// <param name="ec2Client"></param>
        /// <param name="instanceIds"></param>
        private void WaitForInstancesToBeRunning(AmazonEC2Client ec2Client, List<string> instanceIds)
        {
            List<IsAgentReady> agentsThatAreReady =
                instanceIds.Select(instanceId => new IsAgentReady {InstanceID = instanceId, IsReady = false}).ToList();

            while (agentsThatAreReady.Any(x => x.IsReady == false))
            {
                foreach (string instanceId in instanceIds)
                {
                    //first check this isnt already ready
                    bool already = agentsThatAreReady.Any(x => x.InstanceID == instanceId && x.IsReady);

                    if (already) continue;
                    //get its status
                    var describeInstanceStatusRequest = new DescribeInstanceStatusRequest
                    {
                        InstanceIds = new List<string>
                        {
                            instanceId
                        }
                    };
                    DescribeInstanceStatusResponse response =
                        ec2Client.DescribeInstanceStatus(describeInstanceStatusRequest);
                    if (response.InstanceStatuses.Count > 0 &&
                        response.InstanceStatuses[0].InstanceState.Name == InstanceStateName.Running)
                    {
                        IsAgentReady agent = agentsThatAreReady.First(x => x.InstanceID == instanceId);
                        agent.IsReady = true;
                    }
                }
            }
        }
 private void MakeSureAgentsCanBeUsed(AmazonEC2Client ec2Client, List<string> instanceIds)
 {
     List<IsAgentReady> agentsThatAreReady =
         instanceIds.Select(instanceId => new IsAgentReady {InstanceID = instanceId, IsReady = false}).ToList();
     while (agentsThatAreReady.Any(x => x.IsReady == false))
     {
         foreach (string instanceId in instanceIds)
         {
             bool already = agentsThatAreReady.Any(x => x.InstanceID == instanceId && x.IsReady);
             if (already) continue;
             var resquest = new DescribeInstanceStatusRequest
             {
                 InstanceIds = new List<string>
                 {
                     instanceId
                 }
             };
             DescribeInstanceStatusResponse response = ec2Client.DescribeInstanceStatus(resquest);
             if (response.InstanceStatuses.Count > 0 &&
                 response.InstanceStatuses[0].SystemStatus.Status == SummaryStatus.Ok &&
                 response.InstanceStatuses[0].Status.Status == SummaryStatus.Ok)
             {
                 IsAgentReady agent = agentsThatAreReady.First(x => x.InstanceID == instanceId);
                 agent.IsReady = true;
             }
         }
     }
 }