Skip to content

Commit

Permalink
restructure project
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Kruining committed Nov 25, 2024
1 parent 7f129d3 commit 0a83191
Show file tree
Hide file tree
Showing 31 changed files with 140 additions and 153 deletions.
4 changes: 2 additions & 2 deletions example/containerApps/environment/containers.bicep
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Context } from '../../../src/types.bicep'
import { with_name } from '../../../src/common/context.bicep'
import { with_managed_identity } from '../../../src/common/identity.bicep'
import { container_registry } from '../../../src/recommended/container-registry.bicep'
import { container_registry } from '../../../src/recommended/container-registry/container-registry.bicep'
import {
container_app
container
Expand All @@ -10,7 +10,7 @@ import {
with_auto_scaling
with_environment
with_app_logs
} from '../../../src/recommended/container-app.bicep'
} from '../../../src/recommended/app/container-app.bicep'

targetScope = 'resourceGroup'

Expand Down
2 changes: 1 addition & 1 deletion example/containerApps/environment/main.bicep
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Context } from '../../../src/types.bicep'
import { create_context } from '../../../src/common/context.bicep'
import { resource_group } from '../../../src/recommended/resource-group.bicep'
import { resource_group } from '../../../src/recommended/resources/resource-group.bicep'

targetScope = 'subscription'

Expand Down
2 changes: 1 addition & 1 deletion example/containerApps/environment/monitoring.bicep
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Context } from '../../../src/types.bicep'
import { log_analytics } from '../../../src/recommended/log-analytics.bicep'
import { log_analytics } from '../../../src/recommended/operational-insights/log-analytics.bicep'

targetScope = 'resourceGroup'

Expand Down
3 changes: 2 additions & 1 deletion example/containerApps/shared/main.bicep
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { create_context } from '../../../src/common/context.bicep'
import { resource_group } from '../../../src/recommended/resource-group.bicep'
import { resource_group } from '../../../src/recommended/resources/resource-group.bicep'

targetScope = 'subscription'

param deployedAt string

var context = create_context({
name: 'appName'
project: 'project'
nameConventionTemplate: '$type-$env-$loc-$name'
environment: 'shared'
location: 'westeurope'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { create_resource } from '../internal/resource.bicep'
import { Context, Options } from '../types.bicep'
import { create_resource } from '../../internal/resource.bicep'
import { Context, Options } from '../../types.bicep'

@export()
func app_configuration(context Context, sku Sku, options Options) object =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { create_resource } from '../internal/resource.bicep'
import { Context, Options, Tags } from '../types.bicep'
import { create_resource } from '../../internal/resource.bicep'
import { Context, Options, Tags } from '../../types.bicep'

import { container_app_environment } from 'container-app/environment.bicep'

@export()
func container_app(context Context, containers Container[], options Options) object =>
func container_app(context Context, containers Container[], options Options) ContainerApp =>
create_resource(
context,
'containerApp',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { create_resource } from '../../internal/resource.bicep'
import { Context, Options, Tags } from '../../types.bicep'
import { create_resource } from '../../../internal/resource.bicep'
import { Context, Options, Tags } from '../../../types.bicep'

@export()
func container_app_environment(context Context, options Options) object =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Context, Options } from '../types.bicep'
import { create_resource } from '../internal/resource.bicep'
import { Context, Options } from '../../types.bicep'
import { create_resource } from '../../internal/resource.bicep'

@export()
func container_registry(context Context, sku Sku, options Options) object =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { create_resource } from '../internal/resource.bicep'
import { Context, Options } from '../types.bicep'
import { create_resource } from '../../internal/resource.bicep'
import { Context, Options } from '../../types.bicep'

@description('key vault')
@export()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { create_resource } from '../internal/resource.bicep'
import { Context, Options } from '../types.bicep'
import { create_resource } from '../../internal/resource.bicep'
import { Context, Options } from '../../types.bicep'

@export()
func log_analytics(context Context, sku Sku, options Options) object =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Context, Options } from '../types.bicep'
import { create_resource } from '../internal/resource.bicep'
import { Context, Options } from '../../types.bicep'
import { create_resource } from '../../internal/resource.bicep'

@export()
func resource_group(context Context, options Options) object => create_resource(context, 'resourceGroup', options)
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { create_resource } from '../internal/resource.bicep'
import { Context, Options } from '../types.bicep'
import { create_resource } from '../../internal/resource.bicep'
import { Context, Options } from '../../types.bicep'

@export()
func storage_account(context Context, sku Sku, kind Kind, options Options) object =>
Expand Down
4 changes: 2 additions & 2 deletions src/base/app-service.bicep → src/base/web/app-service.bicep
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { create_resource } from '../internal/resource.bicep'
import { Context, Options } from '../types.bicep'
import { create_resource } from '../../internal/resource.bicep'
import { Context, Options } from '../../types.bicep'

@export()
func app_service(context Context, options Options) object => create_resource(context, 'appService', options)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { create_resource } from '../internal/resource.bicep'
import { Context, Options } from '../types.bicep'
import { create_resource } from '../../internal/resource.bicep'
import { Context, Options } from '../../types.bicep'

@export()
func static_web_app(context Context, options Options) object => create_resource(context, 'staticWebApp', options)
Expand Down
8 changes: 0 additions & 8 deletions src/recommended/app-configuration.bicep

This file was deleted.

8 changes: 8 additions & 0 deletions src/recommended/app-configuration/app-configuration.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as base from '../../base/app-configuration/app-configuration.bicep'
import { Context, Options } from '../../types.bicep'

@export()
func app_configuration(context Context, options Options) object => base.app_configuration(context, 'Standard', options)

@export()
func with_free_sku() object => base.with_sku('Free')
57 changes: 0 additions & 57 deletions src/recommended/app-service.bicep

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Context, Options } from '../types.bicep'
import { create_name, to_location_abbreviation, to_resource_abbreviation } from '../internal/name.bicep'
import * as base from '../base/container-app.bicep'
import { container_app_environment as base_container_app_environment } from '../base/container-app/environment.bicep'
import * as base from '../../base/app/container-app.bicep'
import { Context, Options } from '../../types.bicep'
import { create_name, to_location_abbreviation, to_resource_abbreviation } from '../../internal/name.bicep'
import { container_app_environment as base_container_app_environment } from '../../base/app/container-app/environment.bicep'

@export()
func container_app(context Context, containers base.Container[], options Options) object =>
func container_app(context Context, containers base.Container[], options Options) base.ContainerApp =>
base.container_app(context, containers, options)

@export()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Context, Options } from '../types.bicep'
import * as base from '../base/container-registry.bicep'
import { Context, Options } from '../../types.bicep'
import * as base from '../../base/container-registry/container-registry.bicep'

@export()
func container_registry(context Context, options Options) object =>
Expand Down
20 changes: 0 additions & 20 deletions src/recommended/key-vault.bicep

This file was deleted.

20 changes: 20 additions & 0 deletions src/recommended/key-vault/key-vault.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import * as base from '../../base/key-vault/key-vault.bicep'
import { Context, Options } from '../../types.bicep'

@description('Key vault')
@export()
func key_vault(context Context, options Options) object => base.key_vault(context, 'standard', options)

// Sku
@export()
func with_premium_sku() object => {
properties: {
sku: {
family: 'premium'
}
}
}

// Soft delete
@export()
func with_soft_delete(context Context, enable bool) object => base.with_soft_delete(enable)
5 changes: 0 additions & 5 deletions src/recommended/log-analytics.bicep

This file was deleted.

5 changes: 5 additions & 0 deletions src/recommended/operational-insights/log-analytics.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Context, Options } from '../../types.bicep'
import * as base from '../../base/operational-insights/log-analytics.bicep'

@export()
func log_analytics(context Context, options Options) object => base.log_analytics(context, 'PerGB2018', options)
5 changes: 0 additions & 5 deletions src/recommended/resource-group.bicep

This file was deleted.

5 changes: 5 additions & 0 deletions src/recommended/resources/resource-group.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Context, Options } from '../../types.bicep'
import * as base from '../../base/resources/resource-group.bicep'

@export()
func resource_group(context Context, options Options) object => base.resource_group(context, options)
File renamed without changes.
22 changes: 0 additions & 22 deletions src/recommended/static-web-app.bicep

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as base from '../base/storage-account.bicep'
import { Context, Options } from '../types.bicep'
import * as base from '../../base/storage/storage-account.bicep'
import { Context, Options } from '../../types.bicep'

@export()
func storage_account(context Context, options Options) object =>
Expand All @@ -16,7 +16,7 @@ func storage_account(context Context, options Options) object =>
)

@export()
func withPublicAccess() object => base.with_allow_public_access(true)
func with_public_access() object => base.with_allow_public_access(true)

@export()
func with_access_tier(accessTier base.AccessTier) object => base.with_access_tier(accessTier)
46 changes: 46 additions & 0 deletions src/recommended/web/app-service.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import * as base from '../../base/web/app-service.bicep'
import { Context, Options } from '../../types.bicep'

@export()
func app_service(context Context, appServicePlan string, vnetName string, appInsights string, options Options) object =>
base.app_service(
context,
union(
[
base.with_site_config(appServicePlan, vnetName, true, true, '1.2', 'Deny', false)
base.with_app_settings([
{
name: 'ASPNETCORE_ENVIRONMENT'
value: context.environment
}
{
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
value: appInsights
}
{
name: 'ApplicationInsightsAgent_EXTENSION_VERSION'
value: '~2'
}
])
base.with_ip_restrictions([
{
name: 'Allow backend subnet ${context.environment}'
vnetSubnetResourceId: vnetName
priority: 110
action: 'Allow'
}
])
],
options
)
)

@export()
func with_always_on(alwaysOn bool) object => base.with_always_on(alwaysOn)

@export()
func with_app_settings(appSettings base.AppSetting[]) object => base.with_app_settings(appSettings)

@export()
func with_connection_strings(connectionStrings base.ConnStringInfo[]) object =>
base.with_connection_strings(connectionStrings)
Loading

0 comments on commit 0a83191

Please sign in to comment.