Example #1
0
        public async Task Create()
        {
            Console.WriteLine("Creating global service policy template");
            Console.WriteLine("------------------------------------------");
            await SaveTemplate <PolicyTemplateCreator>(_templateFileNames.GlobalServicePolicy(), c => c.Policy != null);

            Console.WriteLine("Creating named value template");
            Console.WriteLine("------------------------------------------");
            await SaveTemplate <NamedValueTemplateCreator>(_templateFileNames.NamedValues(), c => c.NamedValues != null);

            Console.WriteLine("Creating api version sets template");
            Console.WriteLine("------------------------------------------");
            await SaveTemplate <APIVersionSetTemplateCreator>(_templateFileNames.ApiVersionSets(), c => c.ApiVersionSets != null);

            Console.WriteLine("Creating certificates template");
            Console.WriteLine("------------------------------------------");
            await SaveTemplate <CertificateTemplateCreator>(_templateFileNames.Certificates(), c => c.Certificates != null);

            Console.WriteLine("Creating users template");
            Console.WriteLine("------------------------------------------");
            await SaveTemplate <UserTemplateCreator>(_templateFileNames.Users(), c => c.Users != null);

            Console.WriteLine("Creating subscriptions template");
            Console.WriteLine("------------------------------------------");
            await SaveTemplate <SubscriptionTemplateCreator>(_templateFileNames.Subscriptions(), c => c.Subscriptions != null);

            Console.WriteLine("Creating products template");
            Console.WriteLine("------------------------------------------");
            await SaveTemplate <ProductTemplateCreator>(_templateFileNames.Products(), c => c.Products != null, _creatorConfig.Tags);

            Console.WriteLine("Creating tags template");
            Console.WriteLine("------------------------------------------");
            await SaveTemplate <TagTemplateCreator>(_templateFileNames.Tags(), c => c.Tags != null);

            Console.WriteLine("Creating loggers template");
            Console.WriteLine("------------------------------------------");
            await SaveTemplate <LoggerTemplateCreator>(_templateFileNames.Loggers(), c => c.Loggers != null);

            Console.WriteLine("Creating backend template");
            Console.WriteLine("------------------------------------------");
            await SaveTemplate <BackendTemplateCreator>(_templateFileNames.Backends(), c => c.Backends != null);

            Console.WriteLine("Creating authorization servers template");
            Console.WriteLine("------------------------------------------");
            await SaveTemplate <AuthorizationServerTemplateCreator>(_templateFileNames.AuthorizationServers(), c => c.AuthorizationServers != null);

            Console.WriteLine("Creating api templates");
            Console.WriteLine("------------------------------------------");
            await SaveApiTemplates();

            Console.WriteLine("Creating master template");
            Console.WriteLine("------------------------------------------");
            await SaveMasterTemplate();

            Console.WriteLine("Templates written to output location");
        }
        private void CreateProductResource(DeploymentDefinition creatorConfig, List <TemplateResource> resources)
        {
            if (creatorConfig.Products != null)
            {
                var dependencies = new List <string>();

                if (creatorConfig.Tags != null && creatorConfig.Products.Any(q => q.IsDependOnTags()))
                {
                    dependencies.Add(DependsOn(_nestedTemplateName.Tags()));
                }

                if (creatorConfig.Certificates != null)
                {
                    dependencies.Add(DependsOn(_nestedTemplateName.Certificates()));
                }

                CreateResource(resources, creatorConfig, _templateFileNames.Products(), _nestedTemplateName.Products(), dependencies);
            }
        }