use of com.microsoft.azure.toolkit.lib.database.entity.FirewallRuleEntity in project azure-tools-for-java by Microsoft.
the class SqlServerPropertyView method showProperty.
// @Override
public void showProperty(SqlServerProperty property) {
SqlServerEntity entity = property.getServer().entity();
Subscription subscription = Azure.az(AzureAccount.class).account().getSubscription(entity.getSubscriptionId());
if (subscription != null) {
overview.getSubscriptionTextField().setText(subscription.getName());
}
databaseComboBox.setServer(property.getServer());
overview.getResourceGroupTextField().setText(entity.getResourceGroupName());
overview.getStatusTextField().setText(entity.getState());
overview.getLocationTextField().setText(entity.getRegion().getLabel());
overview.getSubscriptionIDTextField().setText(entity.getSubscriptionId());
overview.getServerNameTextField().setText(entity.getFullyQualifiedDomainName());
overview.getServerNameTextField().setCaretPosition(0);
overview.getServerAdminLoginNameTextField().setText(entity.getAdministratorLoginName() + "@" + entity.getName());
overview.getServerAdminLoginNameTextField().setCaretPosition(0);
overview.getVersionTextField().setText(entity.getVersion());
if ("Ready".equals(entity.getState())) {
List<FirewallRuleEntity> firewallRules = property.getFirewallRules();
originalAllowAccessToAzureServices = firewallRules.stream().anyMatch(e -> FirewallRuleEntity.ACCESS_FROM_AZURE_SERVICES_FIREWALL_RULE_NAME.equalsIgnoreCase(e.getName()));
connectionSecurity.getAllowAccessFromAzureServicesCheckBox().setSelected(originalAllowAccessToAzureServices);
originalAllowAccessToLocal = firewallRules.stream().anyMatch(e -> StringUtils.equalsIgnoreCase(FirewallRuleEntity.getAccessFromLocalFirewallRuleName(), e.getName()));
connectionSecurity.getAllowAccessFromLocalMachineCheckBox().setSelected(originalAllowAccessToLocal);
} else {
connectionSecuritySeparator.collapse();
connectionSecuritySeparator.setEnabled(false);
connectionStringsSeparator.collapse();
connectionStringsSeparator.setEnabled(false);
}
}
use of com.microsoft.azure.toolkit.lib.database.entity.FirewallRuleEntity in project azure-tools-for-java by Microsoft.
the class SqlServerPropertyView method refreshProperty.
private void refreshProperty(String sid, String resourceGroup, String name) {
// find server
try {
SqlServer server = Azure.az(AzureSqlServer.class).sqlServer(sid, resourceGroup, name);
this.property.setServer(server);
} catch (Exception ex) {
String error = "find Azure Database for MySQL server information";
String action = "confirm your network is available and your server actually exists.";
throw new AzureToolkitRuntimeException(error, action);
}
SqlServerEntity entity = property.getServer().entity();
if ("Ready".equals(entity.getState())) {
// find firewalls
List<FirewallRuleEntity> firewallRules = Azure.az(AzureSqlServer.class).sqlServer(entity.getId()).firewallRules();
this.property.setFirewallRules(firewallRules);
}
}
Aggregations