Search in sources :

Example 31 with Subscription

use of com.microsoft.azure.toolkit.lib.common.model.Subscription 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);
    }
}
Also used : Azure(com.microsoft.azure.toolkit.lib.Azure) VirtualFile(com.intellij.openapi.vfs.VirtualFile) FirewallRuleEntity(com.microsoft.azure.toolkit.lib.database.entity.FirewallRuleEntity) Node(com.microsoft.tooling.msservices.serviceexplorer.Node) HashMap(java.util.HashMap) StringUtils(org.apache.commons.lang3.StringUtils) SqlServerEntity(com.microsoft.azure.toolkit.lib.sqlserver.model.SqlServerEntity) AzureTask(com.microsoft.azure.toolkit.lib.common.task.AzureTask) FileEditorManager(com.intellij.openapi.fileEditor.FileEditorManager) SqlDatabaseEntity(com.microsoft.azure.toolkit.lib.sqlserver.model.SqlDatabaseEntity) Map(java.util.Map) Project(com.intellij.openapi.project.Project) Nonnull(javax.annotation.Nonnull) SqlServerModule(com.microsoft.tooling.msservices.serviceexplorer.azure.sqlserver.SqlServerModule) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription) ConnectionStringsOutputPanel(com.microsoft.azure.toolkit.intellij.database.ui.ConnectionStringsOutputPanel) ItemEvent(java.awt.event.ItemEvent) AzureToolkitRuntimeException(com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException) ActionConstants(com.microsoft.azuretools.ActionConstants) SqlServerProperty(com.microsoft.tooling.msservices.serviceexplorer.azure.sqlserver.SqlServerProperty) MySQLPropertyActionPanel(com.microsoft.azure.toolkit.intellij.database.ui.MySQLPropertyActionPanel) SqlServer(com.microsoft.azure.toolkit.lib.sqlserver.SqlServer) BaseEditor(com.microsoft.azure.toolkit.intellij.common.BaseEditor) ActionEvent(java.awt.event.ActionEvent) JdbcUrl(com.microsoft.azure.toolkit.lib.database.JdbcUrl) DatabaseTemplateUtils(com.microsoft.azure.toolkit.lib.database.utils.DatabaseTemplateUtils) DatabaseComboBox(com.microsoft.azure.toolkit.intellij.database.DatabaseComboBox) List(java.util.List) AzureSqlServer(com.microsoft.azure.toolkit.lib.sqlserver.AzureSqlServer) EventType(com.microsoft.azuretools.telemetrywrapper.EventType) AzureAccount(com.microsoft.azure.toolkit.lib.auth.AzureAccount) TelemetryConstants(com.microsoft.azuretools.telemetry.TelemetryConstants) MvpView(com.microsoft.azuretools.core.mvp.ui.base.MvpView) AzureEventBus(com.microsoft.azure.toolkit.lib.common.event.AzureEventBus) EventUtil(com.microsoft.azuretools.telemetrywrapper.EventUtil) AzureHideableTitledSeparator(com.microsoft.azure.toolkit.intellij.common.AzureHideableTitledSeparator) NotNull(org.jetbrains.annotations.NotNull) ConnectionSecurityPanel(com.microsoft.azure.toolkit.intellij.database.ui.ConnectionSecurityPanel) Utils(com.microsoft.azuretools.azurecommons.util.Utils) AzureTaskManager(com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager) javax.swing(javax.swing) SqlServerEntity(com.microsoft.azure.toolkit.lib.sqlserver.model.SqlServerEntity) FirewallRuleEntity(com.microsoft.azure.toolkit.lib.database.entity.FirewallRuleEntity) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Example 32 with Subscription

use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by Microsoft.

the class SqlServerCreationAdvancedPanel method onSubscriptionChanged.

private void onSubscriptionChanged(final ItemEvent e) {
    if (e.getStateChange() == ItemEvent.SELECTED && e.getItem() instanceof Subscription) {
        final Subscription subscription = (Subscription) e.getItem();
        this.resourceGroupComboBox.setSubscription(subscription);
        this.serverNameTextField.setSubscriptionId(subscription.getId());
        this.regionComboBox.setSubscription(subscription);
    }
}
Also used : Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Example 33 with Subscription

use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by Microsoft.

the class SqlServerCreationDialog method createUIComponents.

private void createUIComponents() {
    List<Subscription> selectedSubscriptions = Azure.az(AzureAccount.class).account().getSelectedSubscriptions();
    Preconditions.checkArgument(CollectionUtils.isNotEmpty(selectedSubscriptions), "There is no subscription in your account.");
    SqlServerConfig config = SqlServerConfig.getDefaultConfig(selectedSubscriptions.get(0));
    basic = new SqlServerCreationBasicPanel(config);
    advanced = new SqlServerCreationAdvancedPanel(config);
}
Also used : SqlServerConfig(com.microsoft.azure.toolkit.lib.sqlserver.SqlServerConfig) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Example 34 with Subscription

use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by Microsoft.

the class CreateRedisCacheForm method initWidgetListeners.

private void initWidgetListeners() {
    txtRedisName.getDocument().addDocumentListener(new DocumentListener() {

        @Override
        public void insertUpdate(DocumentEvent documentEvent) {
            validateEmptyFields();
        }

        @Override
        public void removeUpdate(DocumentEvent documentEvent) {
            validateEmptyFields();
        }

        @Override
        public void changedUpdate(DocumentEvent documentEvent) {
            validateEmptyFields();
        }
    });
    cbSubs.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            currentSub = (Subscription) cbSubs.getSelectedItem();
            cbLocations.setSubscription(currentSub);
            fillResourceGrps(currentSub);
            validateEmptyFields();
        }
    });
    rdoCreateNewGrp.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            txtNewResGrp.setVisible(true);
            cbUseExist.setVisible(false);
            newResGrp = true;
            validateEmptyFields();
        }
    });
    txtNewResGrp.getDocument().addDocumentListener(new DocumentListener() {

        @Override
        public void insertUpdate(DocumentEvent documentEvent) {
            validateEmptyFields();
        }

        @Override
        public void removeUpdate(DocumentEvent documentEvent) {
            validateEmptyFields();
        }

        @Override
        public void changedUpdate(DocumentEvent documentEvent) {
            validateEmptyFields();
        }
    });
    rdoUseExist.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            txtNewResGrp.setVisible(false);
            cbUseExist.setVisible(true);
            newResGrp = false;
            validateEmptyFields();
        }
    });
    cbUseExist.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            validateEmptyFields();
        }
    });
    cbLocations.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            validateEmptyFields();
        }
    });
    lblPricing.addMouseListener(new LinkListener(PRICING_LINK));
    cbPricing.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            validateEmptyFields();
        }
    });
    chkNoSSL.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            if (chkNoSSL.isSelected()) {
                noSSLPort = true;
            } else {
                noSSLPort = false;
            }
        }
    });
}
Also used : DocumentListener(javax.swing.event.DocumentListener) MouseEvent(java.awt.event.MouseEvent) ActionListener(java.awt.event.ActionListener) LinkListener(com.microsoft.intellij.helpers.LinkListener) ActionEvent(java.awt.event.ActionEvent) MouseAdapter(java.awt.event.MouseAdapter) DocumentEvent(javax.swing.event.DocumentEvent) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Example 35 with Subscription

use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by Microsoft.

the class RedisCreationDialog method onSubscriptionChanged.

private void onSubscriptionChanged(final ItemEvent e) {
    if (e.getStateChange() == ItemEvent.SELECTED) {
        final Subscription subscription = (Subscription) e.getItem();
        this.resourceGroupComboBox.setSubscription(subscription);
        this.regionComboBox.setSubscription(subscription);
    } else if (e.getStateChange() == ItemEvent.DESELECTED) {
        this.resourceGroupComboBox.setSubscription(null);
        this.regionComboBox.setSubscription(null);
    }
}
Also used : Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Aggregations

Subscription (com.microsoft.azure.toolkit.lib.common.model.Subscription)64 ResourceGroup (com.microsoft.azure.toolkit.lib.common.model.ResourceGroup)13 Region (com.microsoft.azure.toolkit.lib.common.model.Region)9 AzureManager (com.microsoft.azuretools.sdkmanage.AzureManager)9 AzureAccount (com.microsoft.azure.toolkit.lib.auth.AzureAccount)7 ArrayList (java.util.ArrayList)7 SelectionEvent (org.eclipse.swt.events.SelectionEvent)5 Project (com.intellij.openapi.project.Project)4 Azure (com.microsoft.azure.toolkit.lib.Azure)4 IAppServicePlan (com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan)4 IWebApp (com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)4 IOException (java.io.IOException)4 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)4 Point (org.eclipse.swt.graphics.Point)4 GridData (org.eclipse.swt.layout.GridData)4 Combo (org.eclipse.swt.widgets.Combo)4 PricingTier (com.microsoft.azure.toolkit.lib.appservice.model.PricingTier)3 AzureOperation (com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)3 EventType (com.microsoft.azuretools.telemetrywrapper.EventType)3 EventUtil (com.microsoft.azuretools.telemetrywrapper.EventUtil)3