public static IEnumerator Validate(Manifest manifest, UnityAction callback, PostProcess postProcess = null) { var exit = false; foreach (var template in manifest.templates) { var templateData = new StreamReader(manifest.basePath + template, Encoding.UTF8).ReadToEnd(); if (postProcess != null) { templateData = postProcess.Execute(templateData); } yield return(new Gs2DeployRestClient( Context.Session ).Validate( new ValidateRequest() .WithTemplate(templateData), r => { if (r.Error != null) { EditorUtility.DisplayDialog("Error", r.Error.Message, "OK"); exit = true; } } )); if (exit) { yield break; } } callback.Invoke(); }
public static IEnumerator Install(Manifest manifest, UnityAction <List <Event> > updateEventCallback, UnityAction callback, PostProcess postProcess = null) { var exit = false; foreach (var template in manifest.templates) { var templateData = new StreamReader(manifest.basePath + template, Encoding.UTF8).ReadToEnd(); if (postProcess != null) { templateData = postProcess.Execute(templateData); } yield return(new Gs2DeployRestClient( Context.Session ).CreateStack( new CreateStackRequest() .WithName(ToStackName(manifest, template)) .WithTemplate(templateData), r => { if (r.Error != null) { EditorUtility.DisplayDialog("Error", r.Error.Message, "OK"); exit = true; } } )); if (exit) { yield break; } } string status = null; foreach (var template in manifest.templates) { do { yield return(new Gs2DeployRestClient( Context.Session ).GetStackStatus( new GetStackStatusRequest() .WithStackName(ToStackName(manifest, template)), r => { if (r.Error == null) { status = r.Result.status; } } )); yield return(new WaitForSeconds(5)); var end = false; yield return(new Gs2DeployRestClient( Context.Session ).DescribeEvents( new DescribeEventsRequest() .WithStackName(ToStackName(manifest, template)), r => { if (r.Error == null) { updateEventCallback.Invoke(r.Result.items); } end = true; } )); while (!end) { yield return(new WaitForSeconds(1)); } } while (!status.EndsWith("_COMPLETE")); } callback.Invoke(); }