little-cartoon-10569
07/26/2021, 5:23 AMApply(v => v.ToString())
. None of the other languages have that. Is it neccessary? If it is, why?green-stone-37839
07/26/2021, 6:12 PMworried-city-86458
07/26/2021, 6:59 PMpublic static class OutputExtensions
{
public static Output<T> As<T>(this Output<object> output) => output.Apply(x => (T)x);
public static Output<Resource> AsResource<T>(this Output<T> output) where T : Resource => output.Apply(x => (Resource)x);
public static Output<T> WhenRun<T>(this Output<T> output, Func<T, Task> func) =>
!Deployment.Instance.IsDryRun ? output.Apply(async value => { await func(value); return value; }) : output;
}
Then that line becomes:
var kubeConfig = cluster.RequireOutput("KubeConfig").As<string>();