Ejemplo n.º 1
0
        GetDeploymentSetup(DeploymentTarget deploymentTarget)
        {
            var app = await _applicationService.Get(deploymentTarget.ApplicationName);

            if (app == null)
            {
                throw new Exception($"Can't find application [{deploymentTarget.ApplicationName}]. Check the correctness of the manifest.");
            }

            var env = await _environmentService.Get(app.Id, deploymentTarget.EnvironmentName);

            if (env == null)
            {
                throw new Exception($"Can't find environment [{deploymentTarget.EnvironmentName}] for application [{deploymentTarget.ApplicationName}]. Check the correctness of the manifest.");
            }

            var deploymentStrategies = await _client.ListDeploymentStrategiesAsync(new ListDeploymentStrategiesRequest());

            var deploymentStrategy =
                deploymentStrategies.Items.FirstOrDefault(x => x.Name == deploymentTarget.DeploymentStrategy);

            if (deploymentStrategy == null)
            {
                throw new Exception($"Can't find deployment strategy [{deploymentTarget.DeploymentStrategy}]. Check the correctness of the manifest.");
            }

            return(app, env, deploymentStrategy);
        }
Ejemplo n.º 2
0
        public async Task <DeploymentStrategy> AskDeploymentStrategy()
        {
            var deploymentStrategies = await _client.ListDeploymentStrategiesAsync(new ListDeploymentStrategiesRequest());

            Console.Write($"Deployment strategy (available, {string.Join(";", deploymentStrategies.Items.Select(x => $"[{x.Name}]"))}): ");
            var promptedStrategy   = Console.ReadLine();
            var deploymentStrategy =
                deploymentStrategies.Items.FirstOrDefault(x => x.Name == promptedStrategy);

            if (deploymentStrategy == null)
            {
                throw new Exception($"Can't find deployment strategy [{promptedStrategy}]");
            }

            return(deploymentStrategy);
        }