use of com.microsoft.azure.toolkit.intellij.common.DraftResourceGroup in project azure-tools-for-java by Microsoft.
the class AzureMySQLConfig method getDefaultAzureMySQLConfig.
public static AzureMySQLConfig getDefaultAzureMySQLConfig() {
final String defaultNameSuffix = DateFormatUtils.format(new Date(), "yyyyMMddHHmmss");
final AzureMySQLConfig config = new AzureMySQLConfig();
final List<Subscription> selectedSubscriptions = az(AzureAccount.class).account().getSelectedSubscriptions();
Preconditions.checkArgument(CollectionUtils.isNotEmpty(selectedSubscriptions), "There are no subscriptions in your account.");
final Subscription subscription = selectedSubscriptions.get(0);
config.setSubscription(subscription);
final DraftResourceGroup resourceGroup = new DraftResourceGroup(subscription, "rs-" + defaultNameSuffix);
config.setResourceGroup(resourceGroup);
final AzureMySql azureMySql = az(AzureMySql.class).subscription(subscription.getId());
config.setServerName("mysql-" + defaultNameSuffix);
config.setAdminUsername(StringUtils.EMPTY);
// default to 5.7
config.setVersion("5.7");
config.setPassword(StringUtils.EMPTY.toCharArray());
config.setConfirmPassword(StringUtils.EMPTY.toCharArray());
// TODO(andy): remove the dependency to MySQLCreationAdvancedPanel
config.setRegion(Utils.selectFirstOptionIfCurrentInvalid("region", MySQLCreationAdvancedPanel.loadSupportedRegions(az(AzureMySql.class), subscription.getId()), Region.US_EAST));
return config;
}
use of com.microsoft.azure.toolkit.intellij.common.DraftResourceGroup in project azure-tools-for-java by Microsoft.
the class AppServiceInfoBasicPanel method initConfig.
private T initConfig() {
final String appName = String.format("app-%s-%s", this.project.getName(), DATE_FORMAT.format(new Date()));
final DraftResourceGroup group = new DraftResourceGroup(subscription, StringUtils.substring(String.format("rg-%s", appName), 0, RG_NAME_MAX_LENGTH));
group.setSubscription(subscription);
// need platform region pricing
final T result = supplier.get();
final String planName = StringUtils.substring(String.format("sp-%s", appName), 0, SP_NAME_MAX_LENGTH);
final DraftServicePlan plan = new DraftServicePlan(subscription, planName, result.getRegion(), result.getRuntime().getOperatingSystem(), result.getPricingTier());
result.setName(appName);
result.setResourceGroup(group);
result.setSubscription(subscription);
result.setResourceGroup(group);
result.setServicePlan(plan);
return result;
}
use of com.microsoft.azure.toolkit.intellij.common.DraftResourceGroup in project azure-tools-for-java by Microsoft.
the class SqlServerConfig method getDefaultConfig.
public static SqlServerConfig getDefaultConfig(Subscription subscription) {
final String defaultNameSuffix = DateFormatUtils.format(new Date(), "yyyyMMddHHmmss");
final SqlServerConfig config = new SqlServerConfig();
config.setSubscription(subscription);
DraftResourceGroup resourceGroup = new DraftResourceGroup(subscription, "rs-" + defaultNameSuffix);
config.setResourceGroup(resourceGroup);
config.setSubscription(subscription);
config.setResourceGroup(resourceGroup);
config.setRegion(Utils.selectFirstOptionIfCurrentInvalid("region", Azure.az(AzureSqlServer.class).listSupportedRegions(subscription.getId()), Region.US_EAST));
config.setServerName("sqlserver-" + defaultNameSuffix);
config.setAdminUsername(StringUtils.EMPTY);
config.setPassword(StringUtils.EMPTY.toCharArray());
config.setConfirmPassword(StringUtils.EMPTY.toCharArray());
return config;
}
Aggregations