Search in sources :

Example 1 with SqlServer

use of com.microsoft.azure.toolkit.lib.sqlserver.SqlServer 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);
    }
}
Also used : AzureSqlServer(com.microsoft.azure.toolkit.lib.sqlserver.AzureSqlServer) SqlServerEntity(com.microsoft.azure.toolkit.lib.sqlserver.model.SqlServerEntity) AzureToolkitRuntimeException(com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException) FirewallRuleEntity(com.microsoft.azure.toolkit.lib.database.entity.FirewallRuleEntity) SqlServer(com.microsoft.azure.toolkit.lib.sqlserver.SqlServer) AzureSqlServer(com.microsoft.azure.toolkit.lib.sqlserver.AzureSqlServer) AzureToolkitRuntimeException(com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException)

Example 2 with SqlServer

use of com.microsoft.azure.toolkit.lib.sqlserver.SqlServer in project azure-tools-for-java by Microsoft.

the class ConnectToSQLAction method actionPerformed.

@Override
public void actionPerformed(NodeActionEvent e) {
    final ConnectorDialog dialog = new ConnectorDialog(project);
    final SqlServer server = this.node.getServer();
    final Database database = new Database(server.id(), null);
    final DatabaseResource resource = new DatabaseResource(database, DatabaseResource.Definition.SQL_SERVER);
    dialog.setResource(resource);
    dialog.show();
}
Also used : ConnectorDialog(com.microsoft.azure.toolkit.intellij.connector.ConnectorDialog) SqlServer(com.microsoft.azure.toolkit.lib.sqlserver.SqlServer)

Aggregations

SqlServer (com.microsoft.azure.toolkit.lib.sqlserver.SqlServer)2 ConnectorDialog (com.microsoft.azure.toolkit.intellij.connector.ConnectorDialog)1 AzureToolkitRuntimeException (com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException)1 FirewallRuleEntity (com.microsoft.azure.toolkit.lib.database.entity.FirewallRuleEntity)1 AzureSqlServer (com.microsoft.azure.toolkit.lib.sqlserver.AzureSqlServer)1 SqlServerEntity (com.microsoft.azure.toolkit.lib.sqlserver.model.SqlServerEntity)1