sparse-intern-71089
08/23/2022, 2:58 PMgreat-pharmacist-55508
08/23/2022, 3:07 PMgreat-pharmacist-55508
08/23/2022, 3:25 PMvar storageAccount =
new StorageAccount(
"%s%s%s".formatted("sa", APPLICATION_NAME, stackName),
StorageAccountArgs.builder()
.resourceGroupName(resourceGroup.name())
.sku(SkuArgs.builder().name(Standard_LRS).build())
.kind(StorageV2)
.build());
you'd have
var storageAccount =
new StorageAccount(
"%s%s%s".formatted("sa", APPLICATION_NAME, stackName),
StorageAccountArgs.builder()
.resourceGroupName(resourceGroup.name())
.sku(SkuArgs.builder().name(Standard_LRS))
.kind(StorageV2));
great-pharmacist-55508
08/23/2022, 3:27 PMgreat-pharmacist-55508
08/23/2022, 3:30 PMsteep-apple-98525
08/23/2022, 11:29 PMsteep-apple-98525
08/23/2022, 11:30 PMsteep-apple-98525
08/23/2022, 11:41 PM//Annotation Processor will throw error if var names in nested classes does not match the schema
@StorageAccount("sa-app-dev")
@Kind(StorageV2)
class AppNameStorageAccount extends AbsStorageAccount {
@ResourceGroup class DevResourceGroup {
var name = "app-dev-group";
}
@Sku class SkuDev {
var name = Standard_LRS
}
}
usage
new AppNameStorageAccount().outputs()
great-pharmacist-55508
08/24/2022, 6:35 AMgreat-pharmacist-55508
08/24/2022, 6:36 AMgreat-pharmacist-55508
08/24/2022, 6:40 AMgreat-pharmacist-55508
08/24/2022, 6:45 AMbuilder()
-Methods that are named after the object you want to build. The benefit of this is that you can do a static import of the method without name clashes. My example would then look like:
var storageAccount =
new StorageAccount(
"%s%s%s".formatted("sa", APPLICATION_NAME, stackName),
storageAccountArgs()
.resourceGroupName(resourceGroup.name())
.sku(skuArgs().name(Standard_LRS))
.kind(StorageV2));
It should be possible to implement these two simplifications in an optional, backwards-compatible matter.great-pharmacist-55508
08/24/2022, 7:39 AMbrave-dawn-64711
08/24/2022, 12:07 PMgreat-pharmacist-55508
08/24/2022, 12:08 PMgreat-pharmacist-55508
08/24/2022, 12:08 PMbrave-dawn-64711
08/24/2022, 12:09 PMgreat-pharmacist-55508
08/24/2022, 12:09 PMbrave-dawn-64711
08/24/2022, 12:11 PMgreat-pharmacist-55508
08/24/2022, 12:12 PMgreat-pharmacist-55508
08/24/2022, 12:25 PMgreat-pharmacist-55508
08/24/2022, 12:26 PMbrave-dawn-64711
08/24/2022, 12:27 PMgreat-pharmacist-55508
08/24/2022, 3:12 PMgreat-pharmacist-55508
08/25/2022, 7:25 AMbrave-dawn-64711
08/25/2022, 8:17 AMbrave-dawn-64711
08/25/2022, 8:18 AM