Пример #1
0
        public StaticService(SolutionStack rg, string serviceName)
        {
            var sa = new Pulumi.Azure.Storage.Account(serviceName, new Pulumi.Azure.Storage.AccountArgs
            {
                ResourceGroupName      = rg.RGName,
                EnableHttpsTrafficOnly = true,
                AccountReplicationType = "LRS",
                AccountTier            = "Standard",
                AccountKind            = "StorageV2",
                StaticWebsite          = new AccountStaticWebsiteArgs
                {
                    IndexDocument = "index.html"
                }
            });

            StaticEndpoint = sa.PrimaryWebEndpoint;
        }
Пример #2
0
        public ApiService(SolutionStack stack, string serviceName, Persistence included, bool registerSwagger = true)
        {
            _name = $"{stack.Prefix}{serviceName}";

            if (included.HasFlag(Persistence.AzureSql))
            {
                var db = new Database($"{serviceName}", new DatabaseArgs
                {
                    ResourceGroupName             = stack.RGName,
                    ServerName                    = stack.SqlServerName,
                    RequestedServiceObjectiveName = "S0"
                });

                _database          = db.Name;
                DbConnectionString = stack.ConnectionStringFor(_database);
            }

            var a = new AppService(_name, new AppServiceArgs
            {
                ResourceGroupName = stack.RGName,
                AppServicePlanId  = stack.AppServicePlanId,
                Tags        = stack.StandardTags(),
                AppSettings =
                {
                    { "APPLICATIONINSIGHTS_CONNECTION_STRING", Output.Format($"InstrumentationKey={stack.AppInsightsKey}") }
                },
                ConnectionStrings = GenerateConnStrings(included)
            });

            var r = AppRegistration(a);

            ApiClientId = r.ApplicationId;
            ApiUri      = r.IdentifierUris.First();

            if (registerSwagger)
            {
                var s = SwaggerRegistration(a, r);
                _apiSwaggerClientId = s.ApplicationId;
            }
        }
Пример #3
0
 public static ApiService DefineApiService(this SolutionStack stack, string serviceName, Persistence includedPersistence, bool registerSwagger = true)
 => new(stack, serviceName, includedPersistence, registerSwagger);
Пример #4
0
 public static StaticService DefineStaticService(this SolutionStack stack, string serviceName)
 => new(stack, serviceName);