Skip to content

Commit

Permalink
Further updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rudiv committed Apr 16, 2024
1 parent 8e1b41c commit 4dbdd0a
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 15 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,21 @@ builder.AddRoleAssignment(kv, id, KeyVaultRoles.SecretsUser);
- [x] (0.1.0 - current) Microsoft.KeyVault/vaults*
- [x] (0.1.0 - current) Microsoft.KeyVault/vaults/secrets*
- [x] (0.1.0 - current) Microsoft.Authorization/roleAssignments
- [] (0.2.0) Microsoft.Storage/storageAccounts
- [] (0.2.0) Microsoft.Storage/storageAccounts/blobServices
- [] (0.2.0) Microsoft.Storage/storageAccounts/blobServices/containers
- [] (0.2.X) Microsoft.Storage/storageAccounts/queueServices
- [] (0.2.X) Microsoft.Storage/storageAccounts/queueServices/queues
- [] (0.2.X) Microsoft.Storage/storageAccounts/tableServices
- [] (0.2.X) Microsoft.Storage/storageAccounts/tableServices/tables
- [] (0.2.0) Microsoft.DocumentDB/databaseAccounts (NoSQL only)
- [] (0.2.0) Microsoft.DocumentDB/databaseAccounts/sqlDatabases
- [] (0.2.0) Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers
- [] (0.2.0) Microsoft.DocumentDB/databaseAccounts/sqlRoleAssignments
- [] (0.2.X) Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions
- [] (0.2.X) Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/storedProcedures
- [] (0.2.X) Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers
- [] (0.2.X) Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/userDefinedFunctions
- [ ] (0.2.0) Microsoft.Storage/storageAccounts
- [ ] (0.2.0) Microsoft.Storage/storageAccounts/blobServices
- [ ] (0.2.0) Microsoft.Storage/storageAccounts/blobServices/containers
- [ ] (0.2.X) Microsoft.Storage/storageAccounts/queueServices
- [ ] (0.2.X) Microsoft.Storage/storageAccounts/queueServices/queues
- [ ] (0.2.X) Microsoft.Storage/storageAccounts/tableServices
- [ ] (0.2.X) Microsoft.Storage/storageAccounts/tableServices/tables
- [ ] (0.2.0) Microsoft.DocumentDB/databaseAccounts (NoSQL only)
- [ ] (0.2.0) Microsoft.DocumentDB/databaseAccounts/sqlDatabases
- [ ] (0.2.0) Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers
- [ ] (0.2.0) Microsoft.DocumentDB/databaseAccounts/sqlRoleAssignments
- [ ] (0.2.X) Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions
- [ ] (0.2.X) Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/storedProcedures
- [ ] (0.2.X) Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers
- [ ] (0.2.X) Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/userDefinedFunctions

* Denotes that support for these resources is implemented via Azure.Provisioning.

Expand Down
49 changes: 49 additions & 0 deletions src/Achieve.Aspire.AzureProvisioning/Bicep/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,53 @@ This will generate the following Bicep:
resource test 'Test/test@2023-01-01' = {
test: 'Value of TestValue property'
}
```

For more advanced property types such as objects and arrays, there are associated methods to assist with the generation
of something like the following:

```
resource test 'Test/test@2023-01-01' = {
test: 'Value of TestValue property'
arr: [
'Value 1',
'Value 2'
]
properties: {
something: 'test'
}
}
```

To support indentation of the resulting Bicep, you need to maintain the "level" at which you're at (below for example 1, 2).

```csharp
var arrArray = new BicepResourcePropertyArray("arr", 1);
arrArray.AddValue(new BicepStringValue("Value 1"));
arrArray.AddValue(new BicepStringValue("Value 2"));
Body.Add(arrArray);

var propBag = new BicepResourcePropertyBag(BicepResourceProperties.Properties, 1);
propBag.AddProperty(new BicepResourceProperty("something", new BicepStringValue("test")));
Body.Add(propBag);
```

You can of course nest these:

```csharp
var propBag = new BicepResourcePropertyBag(BicepResourceProperties.Properties, 1);
var newBag = new BicepResourcePropertyBag("new", 2);
newBag.AddProperty(new BicepResourceProperty("something", new BicepStringValue("test")));
propBag.AddProperty(newBag);
Body.Add(propBag);
```

Which outputs:

```
properties: {
new: {
something: 'test'
}
}
```

0 comments on commit 4dbdd0a

Please sign in to comment.