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);
}
}
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);
}
}
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))));
}
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);
}
}
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);
}
}
Aggregations