Search in sources :

Example 81 with Subscription

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

the class AppServiceInfoAdvancedPanel method onSubscriptionChanged.

private void onSubscriptionChanged(final ItemEvent e) {
    // TODO: @wangmi try subscription mechanism? e.g. this.selectorGroup.subscribe(this.selectSubscription)
    if (e.getStateChange() == ItemEvent.SELECTED || e.getStateChange() == ItemEvent.DESELECTED) {
        final Subscription subscription = (Subscription) e.getItem();
        this.selectorGroup.setSubscription(subscription);
        this.textName.setSubscription(subscription);
        this.selectorRegion.setSubscription(subscription);
        this.selectorServicePlan.setSubscription(subscription);
    }
}
Also used : Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Example 82 with Subscription

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

the class AbstractSpringCloudAppInfoPanel method onSubscriptionChanged.

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

Example 83 with Subscription

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

the class SpringCloudDeploymentConfigurationPanel method setData.

public synchronized void setData(SpringCloudAppConfig appConfig) {
    final SpringCloudCluster cluster = Azure.az(AzureSpringCloud.class).cluster(appConfig.getClusterName());
    if (Objects.nonNull(cluster) && !cluster.app(appConfig.getAppName()).exists()) {
        this.selectorApp.addLocalItem(cluster.app(appConfig));
    }
    final SpringCloudDeploymentConfig deploymentConfig = appConfig.getDeployment();
    final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.project);
    Optional.ofNullable(deploymentConfig.getArtifact()).map(a -> ((WrappedAzureArtifact) a)).ifPresent((a -> this.selectorArtifact.setArtifact(a.getArtifact())));
    Optional.ofNullable(appConfig.getSubscriptionId()).ifPresent((id -> this.selectorSubscription.setValue(new ItemReference<>(id, Subscription::getId))));
    Optional.ofNullable(appConfig.getClusterName()).ifPresent((id -> this.selectorCluster.setValue(new ItemReference<>(id, SpringCloudCluster::name))));
    Optional.ofNullable(appConfig.getAppName()).ifPresent((id -> this.selectorApp.setValue(new ItemReference<>(id, SpringCloudApp::name))));
}
Also used : SpringCloudCluster(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudCluster) FileNameUtils(org.apache.commons.compress.utils.FileNameUtils) Azure(com.microsoft.azure.toolkit.lib.Azure) Setter(lombok.Setter) Arrays(java.util.Arrays) AzureFormInput(com.microsoft.azure.toolkit.lib.common.form.AzureFormInput) SpringCloudDeploymentConfig(com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudDeploymentConfig) DataContext(com.intellij.openapi.actionSystem.DataContext) Getter(lombok.Getter) SpringCloudAppComboBox(com.microsoft.azure.toolkit.intellij.springcloud.component.SpringCloudAppComboBox) SpringCloudAppConfig(com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudAppConfig) StringUtils(org.apache.commons.lang3.StringUtils) SpringCloudClusterComboBox(com.microsoft.azure.toolkit.intellij.springcloud.component.SpringCloudClusterComboBox) Project(com.intellij.openapi.project.Project) AzureArtifactManager(com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager) AzureArtifactComboBox(com.microsoft.azure.toolkit.intellij.common.AzureArtifactComboBox) AzureFormPanel(com.microsoft.azure.toolkit.intellij.common.AzureFormPanel) DataManager(com.intellij.ide.DataManager) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription) ItemEvent(java.awt.event.ItemEvent) AzureArtifact(com.microsoft.azure.toolkit.intellij.common.AzureArtifact) SpringCloudApp(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudApp) BeforeRunTaskUtils(com.microsoft.intellij.util.BeforeRunTaskUtils) AzureSpringCloud(com.microsoft.azure.toolkit.lib.springcloud.AzureSpringCloud) Objects(java.util.Objects) List(java.util.List) ItemReference(com.microsoft.azure.toolkit.intellij.common.AzureComboBox.ItemReference) Optional(java.util.Optional) ConfigurationSettingsEditorWrapper(com.intellij.execution.impl.ConfigurationSettingsEditorWrapper) SubscriptionComboBox(com.microsoft.azure.toolkit.intellij.common.component.SubscriptionComboBox) javax.swing(javax.swing) SpringCloudCluster(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudCluster) SpringCloudDeploymentConfig(com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudDeploymentConfig) AzureArtifactManager(com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager) AzureSpringCloud(com.microsoft.azure.toolkit.lib.springcloud.AzureSpringCloud)

Example 84 with Subscription

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

the class PublicIPAddressComboBox method resetResourceDraft.

private void resetResourceDraft() {
    final PublicIpAddress value = getValue();
    if (value != null && !StringUtils.equals(value.status(), IAzureBaseResource.Status.DRAFT)) {
        draftPublicIpAddress = DraftPublicIpAddress.getDefaultPublicIpAddressDraft();
        draftPublicIpAddress.setRegion(region);
        draftPublicIpAddress.setResourceGroup(Optional.ofNullable(resourceGroup).map(ResourceGroup::getName).orElse(null));
        draftPublicIpAddress.setSubscriptionId(Optional.ofNullable(subscription).map(Subscription::getId).orElse(null));
        setValue(draftPublicIpAddress);
    }
}
Also used : PublicIpAddress(com.microsoft.azure.toolkit.lib.compute.ip.PublicIpAddress) AzurePublicIpAddress(com.microsoft.azure.toolkit.lib.compute.ip.AzurePublicIpAddress) DraftPublicIpAddress(com.microsoft.azure.toolkit.lib.compute.ip.DraftPublicIpAddress) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription) ResourceGroup(com.microsoft.azure.toolkit.lib.common.model.ResourceGroup)

Example 85 with Subscription

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

the class MySQLPropertyView method showProperty.

@Override
public void showProperty(MySQLProperty property) {
    final MySqlServer server = property.getServer();
    final String sid = server.entity().getSubscriptionId();
    if (!server.exists()) {
        this.closeEditor();
        return;
    }
    final Subscription subscription = az(AzureAccount.class).account().getSubscription(sid);
    if (subscription != null) {
        overview.getSubscriptionTextField().setText(subscription.getName());
        databaseComboBox.setServer(server);
        databaseComboBox.refreshItems();
    }
    overview.getResourceGroupTextField().setText(server.entity().getResourceGroupName());
    overview.getStatusTextField().setText(server.entity().getState());
    overview.getLocationTextField().setText(server.entity().getRegion().getLabel());
    overview.getSubscriptionIDTextField().setText(sid);
    overview.getServerNameTextField().setText(server.entity().getFullyQualifiedDomainName());
    overview.getServerNameTextField().setCaretPosition(0);
    overview.getServerAdminLoginNameTextField().setText(server.entity().getAdministratorLoginName() + "@" + server.name());
    overview.getServerAdminLoginNameTextField().setCaretPosition(0);
    overview.getMysqlVersionTextField().setText(server.entity().getVersion());
    final String skuTier = server.entity().getSkuTier();
    final int skuCapacity = server.entity().getVCore();
    final int storageGB = server.entity().getStorageInMB() / 1024;
    final String performanceConfigurations = skuTier + ", " + skuCapacity + " vCore(s), " + storageGB + " GB";
    overview.getPerformanceConfigurationsTextField().setText(performanceConfigurations);
    overview.getSslEnforceStatusTextField().setText(server.entity().getSslEnforceStatus());
    if (StringUtils.equalsIgnoreCase("READY", server.entity().getState())) {
        connectionSecuritySeparator.expand();
        connectionSecuritySeparator.setEnabled(true);
        connectionStringsSeparator.expand();
        connectionStringsSeparator.setEnabled(true);
        originalAllowAccessToAzureServices = server.firewallRules().isAzureAccessRuleEnabled();
        connectionSecurity.getAllowAccessFromAzureServicesCheckBox().setSelected(originalAllowAccessToAzureServices);
        originalAllowAccessToLocal = server.firewallRules().isLocalMachineAccessRuleEnabled();
        connectionSecurity.getAllowAccessFromLocalMachineCheckBox().setSelected(originalAllowAccessToLocal);
    } else {
        connectionSecuritySeparator.collapse();
        connectionSecuritySeparator.setEnabled(false);
        connectionStringsSeparator.collapse();
        connectionStringsSeparator.setEnabled(false);
    }
}
Also used : MySqlServer(com.microsoft.azure.toolkit.lib.mysql.MySqlServer) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Aggregations

Subscription (com.microsoft.azure.toolkit.lib.common.model.Subscription)139 ResourceGroup (com.microsoft.azure.toolkit.lib.common.model.ResourceGroup)26 Region (com.microsoft.azure.toolkit.lib.common.model.Region)18 AzureManager (com.microsoft.azuretools.sdkmanage.AzureManager)18 AzureAccount (com.microsoft.azure.toolkit.lib.auth.AzureAccount)17 ArrayList (java.util.ArrayList)14 IOException (java.io.IOException)11 SelectionEvent (org.eclipse.swt.events.SelectionEvent)10 Project (com.intellij.openapi.project.Project)8 Azure (com.microsoft.azure.toolkit.lib.Azure)8 IAppServicePlan (com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan)8 IWebApp (com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)8 AzureOperation (com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)8 HashMap (java.util.HashMap)8 List (java.util.List)8 StringUtils (org.apache.commons.lang3.StringUtils)8 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)8 Point (org.eclipse.swt.graphics.Point)8 GridData (org.eclipse.swt.layout.GridData)8 Combo (org.eclipse.swt.widgets.Combo)8