示例#1
0
        public void Write(AzureDeploymentTemplate template, string resourceGroupName)
        {
            var path = Path.Combine(_folder, resourceGroupName);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            File.WriteAllText(Path.Combine(path, "azuredeploy.json"), template.ToString());
            File.WriteAllText(Path.Combine(path, "azuredeploy.parameters.json"), template.Parameters.ToString());
        }
        private AzureDeploymentTemplate ToTemplate(string resourceGroupName, string location, List <IHaveInfrastructure> elementsWithInfrastructure)
        {
            var template = new AzureDeploymentTemplate(TemplateDeploymentVersion(resourceGroupName));

            elementsWithInfrastructure.Sort(ByConfigurationDependency);

            foreach (var elementWithInfrastructure in elementsWithInfrastructure)
            {
                var renderer = Ioc.GetRendererFor(elementWithInfrastructure);
                renderer?.Render(template, elementWithInfrastructure, _environment, resourceGroupName, location);
            }

            return(template);
        }
 protected override Task DeployInfrastructure(string resourceGroupName, string location, AzureDeploymentTemplate template)
 {
     return(_azure.Deploy(resourceGroupName, location, template, $"{resourceGroupName}.{DeploymentCount(resourceGroupName)}"));
 }
 protected abstract Task DeployInfrastructure(string resourceGroupName, string location, AzureDeploymentTemplate template);
 protected override void Render(AzureDeploymentTemplate template, IHaveInfrastructure <T> elementWithInfrastructure,
                                IAzureInfrastructureEnvironment environment, string resourceGroup, string location)
 {
     throw new NotImplementedException();
 }
示例#6
0
 protected override Task DeployInfrastructure(string resourceGroupName, string location, AzureDeploymentTemplate template)
 {
     _templateWriter.Write(template, resourceGroupName);
     return(Task.CompletedTask);
 }