use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by microsoft.
the class Node method openResourcesInPortal.
@AzureOperation(name = "common.open_portal", params = { "nameFromResourceId(resourceId)" }, type = AzureOperation.Type.ACTION)
public void openResourcesInPortal(String subscriptionId, String resourceId) {
final AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
// not signed in
if (azureManager == null) {
return;
}
final String portalUrl = azureManager.getPortalUrl();
Subscription subscription = Azure.az(AzureAccount.class).account().getSubscription(subscriptionId);
final String url = portalUrl + REST_SEGMENT_JOB_MANAGEMENT_TENANTID + subscription.getTenantId() + REST_SEGMENT_JOB_MANAGEMENT_RESOURCE + resourceId;
DefaultLoader.getIdeHelper().openLinkInBrowser(url);
}
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);
}
}
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);
}
}
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;
}
}
});
}
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