/// <summary> /// Waits for the cluster to not exist (null) or go into an error state or be in one of the listed states. /// </summary> /// <param name="client"> /// The client instance this is extending. /// </param> /// <param name="notifyHandler"> /// A notification handler used to notify when the state changes. /// </param> /// <param name="dnsName"> /// The dnsName of the cluster. /// </param> /// <param name="location"> /// The location of the cluster. /// </param> /// <param name="timeout"> /// The amount of time to wait for the condition to be satisfied. /// </param> /// <param name="interval"> /// A time frame to wait between polls. /// </param> /// <param name="context"> /// A Cancelation Token that can be used to cancel the request. /// </param> /// <param name="states"> /// The set of states that would cause this funciton to terminate. /// </param> /// <returns> /// An awaitable task. /// </returns> public static async Task WaitForClusterInConditionOrError(this IHDInsightManagementPocoClient client, Action <ClusterDetails> notifyHandler, string dnsName, string location, TimeSpan timeout, TimeSpan interval, IAbstractionContext context, params ClusterState[] states) { await client.WaitForCondition(() => client.ListContainer(dnsName, location), c => client.PollSignal(c, states), notifyHandler, interval, timeout, context.CancellationToken); }
/// <summary> /// Waits for the cluster to not exist (null). /// </summary> /// <param name="client">The client instance this is extending.</param> /// <param name="dnsName">The dnsName of the cluster.</param> /// <param name="timeout">The amount of time to wait for the condition to be satisfied.</param> /// <param name="pollInterval">The poll interval.</param> /// <param name="cancellationToken">A Cancelation Token that can be used to cancel the request.</param> /// <returns> /// An awaitable task. /// </returns> public static async Task WaitForClusterNull(this IHDInsightManagementPocoClient client, string dnsName, TimeSpan timeout, TimeSpan pollInterval, CancellationToken cancellationToken) { await client.WaitForCondition(() => client.ListContainer(dnsName), c => c == null?PollResult.Stop : PollResult.Continue, null, pollInterval, timeout, cancellationToken); }
/// <summary> /// Waits for the cluster to exist (!null). /// </summary> /// <param name="client"> /// The client instance this is extending. /// </param> /// <param name="dnsName"> /// The dnsName of the cluster. /// </param> /// <param name="location"> /// The location of the cluster. /// </param> /// <param name="timeout"> /// The amount of time to wait for the condition to be satisfied. /// </param> /// <param name="cancellationToken"> /// A Cancelation Token that can be used to cancel the request. /// </param> /// <returns> /// An awaitable task. /// </returns> public static async Task WaitForClusterNotNull(this IHDInsightManagementPocoClient client, string dnsName, string location, TimeSpan timeout, CancellationToken cancellationToken) { await client.WaitForCondition(() => client.ListContainer(dnsName, location), c => c != null?PollResult.Stop : PollResult.Continue, null, TimeSpan.FromMilliseconds(100), timeout, cancellationToken); }
public Task <ClusterDetails> ListContainer(string dnsName) { return(underlying.ListContainer(dnsName)); }