Exemplo 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);
        }
        public async Task <AwsConfigProvider> CreateAsync(AppConfigProviderSpec specification)
        {
            var application = await _applicationService.Get(specification.ApplicationName);

            var environment = await _environmentService.Get(application.Id, specification.EnvironmentName);

            var configurationProfile = await _configurationProfileService.Get(application.Id, specification.ConfigurationName);

            return(AwsConfigProviders.GetOrAdd(specification, settings => new AwsConfigProvider(specification.ClientId, _client,
                                                                                                application, environment, configurationProfile, _logger)));
        }