private async Task InstallWorkloadsOnScaleUnit()
        {
            await EnsureClientInitialized();

            await ReliableRun.Execute(async() =>
            {
                AOSClient hubAosClient = await AOSClient.Construct(Config.HubScaleUnit().ResourceId(), Config.HubScaleUnit().Endpoint());

                List <WorkloadInstance> workloadInstances = await new WorkloadInstanceManager(hubAosClient).CreateWorkloadInstances();

                foreach (var workloadInstance in workloadInstances)
                {
                    if (await WorkloadInstanceManager.IsWorkloadInstanceInReadyState(scaleUnitAosClient, workloadInstance))
                    {
                        continue;
                    }

                    if (!await WorkloadInstanceManager.IsWorkloadInstanceInInstallingState(scaleUnitAosClient, workloadInstance))
                    {
                        Console.WriteLine($"Installing the {workloadInstance.VersionedWorkload.Workload.Name} workload");
                        List <WorkloadInstance> workloadInstanceToInstallList = new List <WorkloadInstance>()
                        {
                            workloadInstance
                        };
                        await scaleUnitAosClient.WriteWorkloadInstances(workloadInstanceToInstallList);
                    }

                    if (AxDeployment.IsApplicationVersionMoreRecentThan("10.8.581.0"))
                    {
                        await WaitForWorkloadInstallation(workloadInstance);
                    }
                }
            }, "Install workload on scale unit");
        }
 private async Task EnsureClientInitialized()
 {
     if (hubAosClient is null)
     {
         hubAosClient = await AOSClient.Construct(scaleUnit);
     }
 }
 private async Task EnsureClientInitialized()
 {
     if (scaleUnitAosClient is null)
     {
         scaleUnitAosClient = await AOSClient.Construct(scaleUnit.ResourceId(), scaleUnit.Endpoint());
     }
 }
 private async Task EnsureClientInitialized()
 {
     if (hubAosClient is null)
     {
         hubAosClient = await AOSClient.Construct(Config.HubAosResourceId(), Config.HubAosEndpoint());
     }
 }