public static async Task <ContainerGroupStatus> Run(
            [ActivityTrigger] ContainerGroupInfo containerGroupInfo,
            ILogger log)
        {
            var(resourceGroupName, containerGroupName) = (containerGroupInfo.ResourceGroupName, containerGroupInfo.ContainerGroupName);

            log.LogInformation($"Checking status {resourceGroupName}/{containerGroupName}");

            var azure = await AzHelpers.GetAzure();

            IContainerGroup containerGroup =
                await azure.ContainerGroups.GetByResourceGroupAsync(resourceGroupName, containerGroupName);

            if (containerGroup == null)
            {
                throw new Exception($"Container Instance is NOT found for { containerGroupName } in { resourceGroupName }");
            }

            var containerGroupStatus = new ContainerGroupStatus()
            {
                State             = containerGroup.State,
                Id                = containerGroup.Id,
                Name              = containerGroup.Name,
                ResourceGroupName = containerGroup.ResourceGroupName,
                Containers        = containerGroup.Containers.Values.Select(c => new ContainerInstanceStatus()
                {
                    Name         = c.Name,
                    CurrentState = c.InstanceView?.CurrentState,
                    RestartCount = c.InstanceView?.RestartCount,
                }).ToArray()
            };

            return(containerGroupStatus);
        }
        public static async Task <string> Run(
            [ActivityTrigger] ContainerGroupInfo containerGroupInfo,
            ILogger log)
        {
            var(resourceGroupName, containerGroupName) = (containerGroupInfo.ResourceGroupName, containerGroupInfo.ContainerGroupName);

            log.LogInformation($"Fetching logs {resourceGroupName}/{containerGroupName}");

            var azure = await AzHelpers.GetAzure();

            var logContents =
                await azure.ContainerGroups.GetLogContentAsync(resourceGroupName, containerGroupName, containerGroupName);

            return(logContents);
        }
        public static async Task Run(
            [ActivityTrigger] ContainerGroupInfo containerGroupInfo,
            ILogger log)
        {
            var(resourceGroupName, containerGroupName) = (containerGroupInfo.ResourceGroupName, containerGroupInfo.ContainerGroupName);

            var azure = await AzHelpers.GetAzure();

            IContainerGroup containerGroup =
                await azure.ContainerGroups.GetByResourceGroupAsync(resourceGroupName, containerGroupName);

            if (containerGroup == null)
            {
                throw new Exception($"Container Instance is NOT found for {resourceGroupName}/{containerGroupName}");
            }

            await containerGroup.StopAsync();

            await Task.Delay(5000);

            log.LogInformation($"starting container: {resourceGroupName}/{containerGroupName} ....");

            await azure.ContainerGroups.StartAsync(resourceGroupName, containerGroupName);
        }