com.microsoft.azure.management.sql.SqlFirewallRule Java Examples
The following examples show how to use
com.microsoft.azure.management.sql.SqlFirewallRule.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SQLDatabaseInventoryCollector.java From pacbot with Apache License 2.0 | 5 votes |
private void firewallRule(SqlServer sqlServer, SQLDatabaseVH sqlDatabaseVH) { List<Map<String, String>> firewallRuleList = new ArrayList<>(); Map<String, String> firewallMap; for (SqlFirewallRule sqlFirewallRule : sqlServer.firewallRules().list()) { firewallMap = new HashMap<>(); firewallMap.put("name", sqlFirewallRule.name()); firewallMap.put("startIPAddress", sqlFirewallRule.startIPAddress()); firewallMap.put("endIPAddress", sqlFirewallRule.endIPAddress()); firewallRuleList.add(firewallMap); } for (SqlVirtualNetworkRule sqlVirtualNetworkRule : sqlServer.virtualNetworkRules().list()) { firewallMap = new HashMap<>(); firewallMap.put("virtualNetworkRuleName", sqlVirtualNetworkRule.name() != null ? sqlVirtualNetworkRule.name() : ""); firewallMap.put("virtualNetworkSubnetId", sqlVirtualNetworkRule.subnetId() != null ? sqlVirtualNetworkRule.subnetId() : ""); firewallMap.put("virtualNetworkResourceGroupName", sqlVirtualNetworkRule.resourceGroupName() != null ? sqlVirtualNetworkRule.resourceGroupName() : ""); firewallMap.put("virtualNetworkState", sqlVirtualNetworkRule.state() != null ? sqlVirtualNetworkRule.state() : ""); firewallRuleList.add(firewallMap); } sqlDatabaseVH.setFirewallRuleDetails(firewallRuleList); }
Example #2
Source File: SQLServerInventoryCollector.java From pacbot with Apache License 2.0 | 5 votes |
private void firewallRule(SqlServer sqlServer, SQLServerVH sqlServerVH) { List<Map<String, String>> firewallRuleList = new ArrayList<>(); Map<String, String> firewallMap; for (SqlFirewallRule sqlFirewallRule : sqlServer.firewallRules().list()) { firewallMap = new HashMap<>(); firewallMap.put("name", sqlFirewallRule.name()); firewallMap.put("startIPAddress", sqlFirewallRule.startIPAddress()); firewallMap.put("endIPAddress", sqlFirewallRule.endIPAddress()); firewallRuleList.add(firewallMap); } for (SqlVirtualNetworkRule sqlVirtualNetworkRule : sqlServer.virtualNetworkRules().list()) { firewallMap = new HashMap<>(); firewallMap.put("virtualNetworkRuleName", sqlVirtualNetworkRule.name() != null ? sqlVirtualNetworkRule.name() : ""); firewallMap.put("virtualNetworkSubnetId", sqlVirtualNetworkRule.subnetId() != null ? sqlVirtualNetworkRule.subnetId() : ""); firewallMap.put("virtualNetworkResourceGroupName", sqlVirtualNetworkRule.resourceGroupName() != null ? sqlVirtualNetworkRule.resourceGroupName() : ""); firewallMap.put("virtualNetworkState", sqlVirtualNetworkRule.state() != null ? sqlVirtualNetworkRule.state() : ""); firewallRuleList.add(firewallMap); } sqlServerVH.setFirewallRuleDetails(firewallRuleList); }
Example #3
Source File: SqlFirewallRuleOperationsImpl.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public SqlFirewallRule get(String name) { if (this.sqlServer == null) { return null; } return this.getBySqlServer(this.sqlServer, name); }
Example #4
Source File: SqlFirewallRuleOperationsImpl.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public Observable<SqlFirewallRule> getAsync(String name) { if (this.sqlServer == null) { return null; } return this.getBySqlServerAsync(this.sqlServer, name); }
Example #5
Source File: SqlFirewallRuleOperationsImpl.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public SqlFirewallRule getById(String id) { Objects.requireNonNull(id); return this.getBySqlServer(ResourceUtils.groupFromResourceId(id), ResourceUtils.nameFromResourceId(ResourceUtils.parentRelativePathFromResourceId(id)), ResourceUtils.nameFromResourceId(id)); }
Example #6
Source File: SqlFirewallRuleOperationsImpl.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public Observable<SqlFirewallRule> getByIdAsync(String id) { Objects.requireNonNull(id); return this.getBySqlServerAsync(ResourceUtils.groupFromResourceId(id), ResourceUtils.nameFromResourceId(ResourceUtils.parentRelativePathFromResourceId(id)), ResourceUtils.nameFromResourceId(id)); }
Example #7
Source File: SqlFirewallRuleOperationsImpl.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public List<SqlFirewallRule> listBySqlServer(SqlServer sqlServer) { Objects.requireNonNull(sqlServer); List<SqlFirewallRule> firewallRuleSet = new ArrayList<>(); for (FirewallRuleInner inner : sqlServer.manager().inner().firewallRules().listByServer(sqlServer.resourceGroupName(), sqlServer.name())) { firewallRuleSet.add(new SqlFirewallRuleImpl(inner.name(), (SqlServerImpl) sqlServer, inner, sqlServer.manager())); } return Collections.unmodifiableList(firewallRuleSet); }
Example #8
Source File: SqlFirewallRuleOperationsImpl.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public List<SqlFirewallRule> list() { if (this.sqlServer == null) { return null; } return this.listBySqlServer(this.sqlServer); }
Example #9
Source File: SqlFirewallRuleOperationsImpl.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public Observable<SqlFirewallRule> listAsync() { if (sqlServer == null) { return null; } return this.listBySqlServerAsync(this.sqlServer.resourceGroupName(), this.sqlServer.name()); }
Example #10
Source File: SqlServerImpl.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public SqlFirewallRule enableAccessFromAzureServices() { SqlFirewallRule firewallRule = this.manager().sqlServers().firewallRules() .getBySqlServer(this.resourceGroupName(), this.name(), "AllowAllWindowsAzureIps"); if (firewallRule == null) { firewallRule = this.manager().sqlServers().firewallRules() .define("AllowAllWindowsAzureIps") .withExistingSqlServer(this.resourceGroupName(), this.name()) .withIPAddress("0.0.0.0") .create(); } return firewallRule; }
Example #11
Source File: SqlServerImpl.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public void removeAccessFromAzureServices() { SqlFirewallRule firewallRule = this.manager().sqlServers().firewallRules() .getBySqlServer(this.resourceGroupName(), this.name(), "AllowAllWindowsAzureIps"); if (firewallRule != null) { this.manager().sqlServers().firewallRules() .deleteBySqlServer(this.resourceGroupName(), this.name(), "AllowAllWindowsAzureIps"); } }
Example #12
Source File: Utils.java From azure-libraries-for-java with MIT License | 5 votes |
/** * Prints information for the passed firewall rule. * @param firewallRule firewall rule to be printed. */ public static void print(SqlFirewallRule firewallRule) { StringBuilder builder = new StringBuilder().append("Sql firewall rule: ").append(firewallRule.id()) .append("Name: ").append(firewallRule.name()) .append("\n\tResource group: ").append(firewallRule.resourceGroupName()) .append("\n\tRegion: ").append(firewallRule.region()) .append("\n\tSqlServer Name: ").append(firewallRule.sqlServerName()) .append("\n\tStart IP Address of the firewall rule: ").append(firewallRule.startIPAddress()) .append("\n\tEnd IP Address of the firewall rule: ").append(firewallRule.endIPAddress()); System.out.println(builder.toString()); }
Example #13
Source File: AzureSQLServerScanner.java From clouditor with Apache License 2.0 | 4 votes |
@Override protected Asset transform(SqlServer server) throws ScanException { var asset = super.transform(server); enrich( asset, "securityAlertPolicy", server, x -> x.serverSecurityAlertPolicies().get(), SqlServerSecurityAlertPolicy::id, SqlServerSecurityAlertPolicy::name); enrich( asset, "encryptionProtectors", server, x -> x.encryptionProtectors().get(), SqlEncryptionProtector::id, SqlEncryptionProtector::serverKeyName); enrich( asset, "activeDirectoryAdmin", server, x -> server.getActiveDirectoryAdministrator(), SqlActiveDirectoryAdministrator::id, SqlActiveDirectoryAdministrator::signInName); enrichList( asset, "firewallRules", server, x -> x.firewallRules().list(), SqlFirewallRule::id, SqlFirewallRule::name); enrich( asset, "auditingPolicy", server, x -> this.api .azure() .sqlServers() .manager() .inner() .serverBlobAuditingPolicies() .get(server.resourceGroupName(), server.name()), ServerBlobAuditingPolicyInner::id, ServerBlobAuditingPolicyInner::name); return asset; }
Example #14
Source File: SqlFirewallRuleOperationsImpl.java From azure-libraries-for-java with MIT License | 4 votes |
@Override public SqlFirewallRule getBySqlServer(String resourceGroupName, String sqlServerName, String name) { FirewallRuleInner inner = this.sqlServerManager.inner().firewallRules().get(resourceGroupName, sqlServerName, name); return (inner != null) ? new SqlFirewallRuleImpl(resourceGroupName, sqlServerName, inner.name(), inner, sqlServerManager) : null; }
Example #15
Source File: SqlFirewallRuleOperationsImpl.java From azure-libraries-for-java with MIT License | 4 votes |
@Override public SqlFirewallRule getBySqlServer(SqlServer sqlServer, String name) { Objects.requireNonNull(sqlServer); FirewallRuleInner inner = this.sqlServerManager.inner().firewallRules().get(sqlServer.resourceGroupName(), sqlServer.name(), name); return (inner != null) ? new SqlFirewallRuleImpl(inner.name(), (SqlServerImpl) sqlServer, inner, sqlServer.manager()) : null; }