.define(accountName) .withRegion(this.vmssImpl.regionName()) .withNewResourceGroup(this.vmssImpl.creatableGroup); } else { storageAccountCreatable = this.vmssImpl.storageManager.storageAccounts() .define(accountName) .withRegion(this.vmssImpl.regionName()) .withExistingResourceGroup(this.vmssImpl.resourceGroupName());
StorageAccount.DefinitionStages.WithGroup withGroupAccount = azure.storageAccounts().define(newStorageAccount.getName()).withRegion(newStorageAccount.getLocation()); if (newStorageAccount.isNewResourceGroup()) { newAccount = withGroupAccount.withNewResourceGroup(newStorageAccount.getResourceGroupName()); } else { newAccount = withGroupAccount.withExistingResourceGroup(newStorageAccount.getResourceGroupName());
azureClient.storageAccounts().define(targetStorageAccount) .withRegion(location) .withExistingResourceGroup(resourceGroupName) .withSku(SkuName.fromString(targetStorageAccountType)) .create();
.define(accountName) .withRegion(this.vmssImpl.regionName()) .withNewResourceGroup(this.vmssImpl.creatableGroup); } else { storageAccountCreatable = this.vmssImpl.storageManager.storageAccounts() .define(accountName) .withRegion(this.vmssImpl.regionName()) .withExistingResourceGroup(this.vmssImpl.resourceGroupName());
.define(accountName) .withRegion(this.regionName()) .withNewResourceGroup(this.creatableGroup); } else { storageAccountCreatable = this.storageManager.storageAccounts() .define(accountName) .withRegion(this.regionName()) .withExistingResourceGroup(this.resourceGroupName());
.define(accountName) .withRegion(this.regionName()) .withNewResourceGroup(this.creatableGroup); } else { storageAccountCreatable = this.storageManager.storageAccounts() .define(accountName) .withRegion(this.regionName()) .withExistingResourceGroup(this.resourceGroupName());
.define(accountName) .withRegion(this.vmImpl.regionName()) .withNewResourceGroup(this.vmImpl.creatableGroup); } else { storageAccountCreatable = this.vmImpl.storageManager.storageAccounts() .define(accountName) .withRegion(this.vmImpl.regionName()) .withExistingResourceGroup(this.vmImpl.resourceGroupName());
.define(accountName) .withRegion(this.vmImpl.regionName()) .withNewResourceGroup(this.vmImpl.creatableGroup); } else { storageAccountCreatable = this.vmImpl.storageManager.storageAccounts() .define(accountName) .withRegion(this.vmImpl.regionName()) .withExistingResourceGroup(this.vmImpl.resourceGroupName());
@Override public void beforeGroupCreateOrUpdate() { // [1]. StorageProfile: If implicit storage account creation is required then add Creatable<StorageAccount>. // if (creatableStorageAccountKey == null && existingStorageAccountToAssociate == null) { if (osDiskRequiresImplicitStorageAccountCreation() || dataDisksRequiresImplicitStorageAccountCreation()) { Creatable<StorageAccount> storageAccountCreatable = null; if (this.creatableGroup != null) { storageAccountCreatable = this.storageManager.storageAccounts() .define(this.namer.randomName("stg", 24).replace("-", "")) .withRegion(this.regionName()) .withNewResourceGroup(this.creatableGroup); } else { storageAccountCreatable = this.storageManager.storageAccounts() .define(this.namer.randomName("stg", 24).replace("-", "")) .withRegion(this.regionName()) .withExistingResourceGroup(this.resourceGroupName()); } this.creatableStorageAccountKey = this.addDependency(storageAccountCreatable); } } // [2]. BootDiagnosticsProfile: If any implicit resource creation is required then add Creatable<?>. // this.bootDiagnosticsHandler.prepare(); }
public static StorageAccount createStorageAccount(String subscriptionId, String name, String region, boolean newResourceGroup, String resourceGroup, Kind kind, AccessTier accessTier, boolean enableEncription, String skuName) throws Exception { AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager(); Azure azure = azureManager.getAzure(subscriptionId); StorageAccount.DefinitionStages.WithGroup newStorageAccountBlank = azure.storageAccounts().define(name).withRegion(region); StorageAccount.DefinitionStages.WithCreate newStorageAccountWithGroup; if (newResourceGroup) { newStorageAccountWithGroup = newStorageAccountBlank.withNewResourceGroup(resourceGroup); } else { newStorageAccountWithGroup = newStorageAccountBlank.withExistingResourceGroup(resourceGroup); } switch (kind) { case STORAGE: newStorageAccountWithGroup = newStorageAccountWithGroup.withGeneralPurposeAccountKind(); break; case STORAGE_V2: newStorageAccountWithGroup = newStorageAccountWithGroup.withGeneralPurposeAccountKindV2(); break; case BLOB_STORAGE: newStorageAccountWithGroup = newStorageAccountWithGroup.withBlobStorageAccountKind().withAccessTier(accessTier); break; default: throw new Exception("Unknown Storage Account Kind:" + kind.toString()); } if (enableEncription) { newStorageAccountWithGroup = newStorageAccountWithGroup.withBlobEncryption(); } return newStorageAccountWithGroup.withSku(StorageAccountSkuType.fromSkuName(SkuName.fromString(skuName))).create(); }
@Override public void beforeGroupCreateOrUpdate() { // [1]. StorageProfile: If implicit storage account creation is required then add Creatable<StorageAccount>. // if (creatableStorageAccountKey == null && existingStorageAccountToAssociate == null) { if (osDiskRequiresImplicitStorageAccountCreation() || dataDisksRequiresImplicitStorageAccountCreation()) { Creatable<StorageAccount> storageAccountCreatable = null; if (this.creatableGroup != null) { storageAccountCreatable = this.storageManager.storageAccounts() .define(this.namer.randomName("stg", 24).replace("-", "")) .withRegion(this.regionName()) .withNewResourceGroup(this.creatableGroup); } else { storageAccountCreatable = this.storageManager.storageAccounts() .define(this.namer.randomName("stg", 24).replace("-", "")) .withRegion(this.regionName()) .withExistingResourceGroup(this.resourceGroupName()); } this.creatableStorageAccountKey = this.addDependency(storageAccountCreatable); } } // [2]. BootDiagnosticsProfile: If any implicit resource creation is required then add Creatable<?>. // this.bootDiagnosticsHandler.prepare(); }
@Override public ContainerGroupImpl withNewAzureFileShareVolume(String volumeName, String shareName) { if (this.newFileShares == null || this.creatableStorageAccountKey == null) { StorageAccount.DefinitionStages.WithGroup definitionWithGroup = this.storageManager .storageAccounts() .define(SdkContext.randomResourceName("fs", 24)) .withRegion(this.regionName()); Creatable<StorageAccount> creatable; if (this.creatableGroup != null) { creatable = definitionWithGroup.withNewResourceGroup(this.creatableGroup); } else { creatable = definitionWithGroup.withExistingResourceGroup(this.resourceGroupName()); } this.creatableStorageAccountKey = this.addDependency(creatable); this.newFileShares = new HashMap<>(); } this.newFileShares.put(volumeName, shareName); return this; }
@Override public ContainerGroupImpl withNewAzureFileShareVolume(String volumeName, String shareName) { if (this.newFileShares == null || this.creatableStorageAccountKey == null) { StorageAccount.DefinitionStages.WithGroup definitionWithGroup = this.storageManager .storageAccounts() .define(SdkContext.randomResourceName("fs", 24)) .withRegion(this.regionName()); Creatable<StorageAccount> creatable; if (this.creatableGroup != null) { creatable = definitionWithGroup.withNewResourceGroup(this.creatableGroup); } else { creatable = definitionWithGroup.withExistingResourceGroup(this.resourceGroupName()); } this.creatableStorageAccountKey = this.addDependency(creatable); this.newFileShares = new HashMap<>(); } this.newFileShares.put(volumeName, shareName); return this; }
@Override public FunctionAppImpl withNewStorageAccount(String name, SkuName sku) { StorageAccount.DefinitionStages.WithGroup storageDefine = manager().storageManager().storageAccounts() .define(name) .withRegion(regionName()); if (super.creatableGroup != null && isInCreateMode()) { storageAccountCreatable = storageDefine.withNewResourceGroup(super.creatableGroup) .withGeneralPurposeAccountKind() .withSku(sku); } else { storageAccountCreatable = storageDefine.withExistingResourceGroup(resourceGroupName()) .withGeneralPurposeAccountKind() .withSku(sku); } this.addDependency(storageAccountCreatable); return this; }
@Override public VirtualMachineScaleSetImpl withNewStorageAccount(String name) { StorageAccount.DefinitionStages.WithGroup definitionWithGroup = this.storageManager .storageAccounts() .define(name) .withRegion(this.regionName()); Creatable<StorageAccount> definitionAfterGroup; if (this.creatableGroup != null) { definitionAfterGroup = definitionWithGroup.withNewResourceGroup(this.creatableGroup); } else { definitionAfterGroup = definitionWithGroup.withExistingResourceGroup(this.resourceGroupName()); } return withNewStorageAccount(definitionAfterGroup); }
@Override public VirtualMachineScaleSetImpl withNewStorageAccount(String name) { StorageAccount.DefinitionStages.WithGroup definitionWithGroup = this.storageManager .storageAccounts() .define(name) .withRegion(this.regionName()); Creatable<StorageAccount> definitionAfterGroup; if (this.creatableGroup != null) { definitionAfterGroup = definitionWithGroup.withNewResourceGroup(this.creatableGroup); } else { definitionAfterGroup = definitionWithGroup.withExistingResourceGroup(this.resourceGroupName()); } return withNewStorageAccount(definitionAfterGroup); }
@Override public RegistryImpl withNewStorageAccount(String storageAccountName) { this.storageAccountId = null; StorageAccount.DefinitionStages.WithGroup definitionWithGroup = this.storageManager .storageAccounts() .define(storageAccountName) .withRegion(this.regionName()); Creatable<StorageAccount> definitionAfterGroup; if (this.creatableGroup != null) { definitionAfterGroup = definitionWithGroup.withNewResourceGroup(this.creatableGroup); } else { definitionAfterGroup = definitionWithGroup.withExistingResourceGroup(this.resourceGroupName()); } return withNewStorageAccount(definitionAfterGroup); }
@Override public VirtualMachineImpl withNewStorageAccount(String name) { StorageAccount.DefinitionStages.WithGroup definitionWithGroup = this.storageManager .storageAccounts() .define(name) .withRegion(this.regionName()); Creatable<StorageAccount> definitionAfterGroup; if (this.creatableGroup != null) { definitionAfterGroup = definitionWithGroup.withNewResourceGroup(this.creatableGroup); } else { definitionAfterGroup = definitionWithGroup.withExistingResourceGroup(this.resourceGroupName()); } return withNewStorageAccount(definitionAfterGroup); }
@Override public BatchAccountImpl withNewStorageAccount(String storageAccountName) { StorageAccount.DefinitionStages.WithGroup definitionWithGroup = this.storageManager .storageAccounts() .define(storageAccountName) .withRegion(this.regionName()); Creatable<StorageAccount> definitionAfterGroup; if (this.creatableGroup != null) { definitionAfterGroup = definitionWithGroup.withNewResourceGroup(this.creatableGroup); } else { definitionAfterGroup = definitionWithGroup.withExistingResourceGroup(this.resourceGroupName()); } return withNewStorageAccount(definitionAfterGroup); }
@Override public VirtualMachineImpl withNewStorageAccount(String name) { StorageAccount.DefinitionStages.WithGroup definitionWithGroup = this.storageManager .storageAccounts() .define(name) .withRegion(this.regionName()); Creatable<StorageAccount> definitionAfterGroup; if (this.creatableGroup != null) { definitionAfterGroup = definitionWithGroup.withNewResourceGroup(this.creatableGroup); } else { definitionAfterGroup = definitionWithGroup.withExistingResourceGroup(this.resourceGroupName()); } return withNewStorageAccount(definitionAfterGroup); }