Skip to content
This repository was archived by the owner on Jun 17, 2024. It is now read-only.

Commit 7c2b5bc

Browse files
author
Dan Schulte
committed
Release 1.4.0
1 parent a1b5ec1 commit 7c2b5bc

File tree

2 files changed

+87
-27
lines changed

2 files changed

+87
-27
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
<dependency>
5454
<groupId>com.microsoft.azure</groupId>
5555
<artifactId>azure</artifactId>
56-
<version>1.3.0</version>
56+
<version>1.4.0</version>
5757
</dependency>
5858
<dependency>
5959
<groupId>commons-net</groupId>

src/main/java/com/microsoft/azure/management/samples/Utils.java

+86-26
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
import com.microsoft.azure.management.batch.BatchAccount;
2626
import com.microsoft.azure.management.batch.BatchAccountKeys;
2727
import com.microsoft.azure.management.compute.AvailabilitySet;
28-
import com.microsoft.azure.management.compute.ContainerService;
29-
import com.microsoft.azure.management.compute.ContainerServiceOrchestratorTypes;
3028
import com.microsoft.azure.management.compute.DataDisk;
3129
import com.microsoft.azure.management.compute.ImageDataDisk;
3230
import com.microsoft.azure.management.compute.VirtualMachine;
@@ -38,8 +36,12 @@
3836
import com.microsoft.azure.management.containerinstance.EnvironmentVariable;
3937
import com.microsoft.azure.management.containerinstance.Volume;
4038
import com.microsoft.azure.management.containerinstance.VolumeMount;
39+
import com.microsoft.azure.management.containerregistry.AccessKeyType;
4140
import com.microsoft.azure.management.containerregistry.Registry;
42-
import com.microsoft.azure.management.containerregistry.implementation.RegistryListCredentials;
41+
import com.microsoft.azure.management.containerregistry.RegistryCredentials;
42+
import com.microsoft.azure.management.containerservice.ContainerService;
43+
import com.microsoft.azure.management.containerservice.ContainerServiceOrchestratorTypes;
44+
import com.microsoft.azure.management.containerservice.KubernetesCluster;
4345
import com.microsoft.azure.management.cosmosdb.CosmosDBAccount;
4446
import com.microsoft.azure.management.dns.ARecordSet;
4547
import com.microsoft.azure.management.dns.AaaaRecordSet;
@@ -65,6 +67,7 @@
6567
import com.microsoft.azure.management.graphrbac.implementation.PermissionInner;
6668
import com.microsoft.azure.management.keyvault.AccessPolicy;
6769
import com.microsoft.azure.management.keyvault.Vault;
70+
import com.microsoft.azure.management.locks.ManagementLock;
6871
import com.microsoft.azure.management.network.ApplicationGateway;
6972
import com.microsoft.azure.management.network.ApplicationGatewayBackend;
7073
import com.microsoft.azure.management.network.ApplicationGatewayBackendAddress;
@@ -73,6 +76,7 @@
7376
import com.microsoft.azure.management.network.ApplicationGatewayIPConfiguration;
7477
import com.microsoft.azure.management.network.ApplicationGatewayListener;
7578
import com.microsoft.azure.management.network.ApplicationGatewayProbe;
79+
import com.microsoft.azure.management.network.ApplicationGatewayRedirectConfiguration;
7680
import com.microsoft.azure.management.network.ApplicationGatewayRequestRoutingRule;
7781
import com.microsoft.azure.management.network.ApplicationGatewaySslCertificate;
7882
import com.microsoft.azure.management.network.EffectiveNetworkSecurityRule;
@@ -355,7 +359,6 @@ public static void print(Network resource) {
355359
.append("\n\t\tRemote network ID: ").append(peering.remoteNetworkId())
356360
.append("\n\t\tPeering state: ").append(peering.state())
357361
.append("\n\t\tIs traffic forwarded from remote network allowed? ").append(peering.isTrafficForwardingFromRemoteNetworkAllowed())
358-
//TODO .append("\n\t\tIs access from remote network allowed? ").append(peering.isAccessFromRemoteNetworkAllowed())
359362
.append("\n\t\tGateway use: ").append(peering.gatewayUse());
360363
}
361364
System.out.println(info.toString());
@@ -545,6 +548,18 @@ public static void print(RedisAccessKeys redisAccessKeys) {
545548
System.out.println(redisKeys.toString());
546549
}
547550

551+
/**
552+
* Print management lock.
553+
* @param lock a management lock
554+
*/
555+
public static void print(ManagementLock lock) {
556+
StringBuilder info = new StringBuilder();
557+
info.append("\nLock ID: ").append(lock.id())
558+
.append("\nLocked resource ID: ").append(lock.lockedResourceId())
559+
.append("\nLevel: ").append(lock.level());
560+
System.out.println(info.toString());
561+
}
562+
548563
/**
549564
* Print load balancer.
550565
*
@@ -874,11 +889,11 @@ public static void print(WebAppBase resource) {
874889
}
875890
}
876891
builder = builder.append("\n\tApp settings: ");
877-
for (AppSetting setting : resource.appSettings().values()) {
892+
for (AppSetting setting : resource.getAppSettings().values()) {
878893
builder = builder.append("\n\t\t" + setting.key() + ": " + setting.value() + (setting.sticky() ? " - slot setting" : ""));
879894
}
880895
builder = builder.append("\n\tConnection strings: ");
881-
for (ConnectionString conn : resource.connectionStrings().values()) {
896+
for (ConnectionString conn : resource.getConnectionStrings().values()) {
882897
builder = builder.append("\n\t\t" + conn.name() + ": " + conn.value() + " - " + conn.type() + (conn.sticky() ? " - slot setting" : ""));
883898
}
884899
System.out.println(builder.toString());
@@ -1100,13 +1115,13 @@ public static void print(DnsZone dnsZone) {
11001115
public static void print(Registry azureRegistry) {
11011116
StringBuilder info = new StringBuilder();
11021117

1103-
RegistryListCredentials acrCredentials = azureRegistry.listCredentials();
1118+
RegistryCredentials acrCredentials = azureRegistry.getCredentials();
11041119
info.append("Azure Container Registry: ").append(azureRegistry.id())
11051120
.append("\n\tName: ").append(azureRegistry.name())
11061121
.append("\n\tServer Url: ").append(azureRegistry.loginServerUrl())
11071122
.append("\n\tUser: ").append(acrCredentials.username())
1108-
.append("\n\tFirst Password: ").append(acrCredentials.passwords().get(0).value())
1109-
.append("\n\tSecond Password: ").append(acrCredentials.passwords().get(1).value());
1123+
.append("\n\tFirst Password: ").append(acrCredentials.accessKeys().get(AccessKeyType.PRIMARY))
1124+
.append("\n\tSecond Password: ").append(acrCredentials.accessKeys().get(AccessKeyType.SECONDARY));
11101125
System.out.println(info.toString());
11111126
}
11121127

@@ -1122,12 +1137,12 @@ public static void print(ContainerService containerService) {
11221137
.append("\n\tWith orchestration: ").append(containerService.orchestratorType().toString())
11231138
.append("\n\tMaster FQDN: ").append(containerService.masterFqdn())
11241139
.append("\n\tMaster node count: ").append(containerService.masterNodeCount())
1125-
.append("\n\tMaster leaf domain label: ").append(containerService.masterLeafDomainLabel())
1126-
.append("\n\t\tWith Agent pool name: ").append(containerService.agentPoolName())
1127-
.append("\n\t\tAgent pool count: ").append(containerService.agentPoolCount())
1128-
.append("\n\t\tAgent pool count: ").append(containerService.agentPoolVMSize().toString())
1129-
.append("\n\t\tAgent pool FQDN: ").append(containerService.agentPoolFqdn())
1130-
.append("\n\t\tAgent pool leaf domain label: ").append(containerService.agentPoolLeafDomainLabel())
1140+
.append("\n\tMaster domain label prefix: ").append(containerService.masterDnsPrefix())
1141+
.append("\n\t\tWith Agent pool name: ").append(new ArrayList<>(containerService.agentPools().keySet()).get(0))
1142+
.append("\n\t\tAgent pool count: ").append(new ArrayList<>(containerService.agentPools().values()).get(0).count())
1143+
.append("\n\t\tAgent pool VM size: ").append(new ArrayList<>(containerService.agentPools().values()).get(0).vmSize().toString())
1144+
.append("\n\t\tAgent pool FQDN: ").append(new ArrayList<>(containerService.agentPools().values()).get(0).fqdn())
1145+
.append("\n\t\tAgent pool domain label prefix: ").append(new ArrayList<>(containerService.agentPools().values()).get(0).dnsPrefix())
11311146
.append("\n\tLinux user name: ").append(containerService.linuxRootUsername())
11321147
.append("\n\tSSH key: ").append(containerService.sshKey());
11331148
if (containerService.orchestratorType() == ContainerServiceOrchestratorTypes.KUBERNETES) {
@@ -1137,6 +1152,30 @@ public static void print(ContainerService containerService) {
11371152
System.out.println(info.toString());
11381153
}
11391154

1155+
/**
1156+
* Print an Azure Container Service (AKS).
1157+
* @param kubernetesCluster a managed container service
1158+
*/
1159+
public static void print(KubernetesCluster kubernetesCluster) {
1160+
StringBuilder info = new StringBuilder();
1161+
1162+
info.append("Azure Container Service: ").append(kubernetesCluster.id())
1163+
.append("\n\tName: ").append(kubernetesCluster.name())
1164+
.append("\n\tFQDN: ").append(kubernetesCluster.fqdn())
1165+
.append("\n\tDNS prefix label: ").append(kubernetesCluster.dnsPrefix())
1166+
.append("\n\t\tWith Agent pool name: ").append(new ArrayList<>(kubernetesCluster.agentPools().keySet()).get(0))
1167+
.append("\n\t\tAgent pool count: ").append(new ArrayList<>(kubernetesCluster.agentPools().values()).get(0).count())
1168+
.append("\n\t\tAgent pool VM size: ").append(new ArrayList<>(kubernetesCluster.agentPools().values()).get(0).vmSize().toString())
1169+
.append("\n\tLinux user name: ").append(kubernetesCluster.linuxRootUsername())
1170+
.append("\n\tSSH key: ").append(kubernetesCluster.sshKey())
1171+
.append("\n\tService principal client ID: ").append(kubernetesCluster.servicePrincipalClientId());
1172+
if (kubernetesCluster.keyVaultSecretReference() != null) {
1173+
info.append("\n\tKeyVault reference: ").append(kubernetesCluster.keyVaultSecretReference().vaultID());
1174+
}
1175+
1176+
System.out.println(info.toString());
1177+
}
1178+
11401179
/**
11411180
* Print an Azure Search Service.
11421181
* @param searchService an Azure Search Service
@@ -1514,12 +1553,17 @@ public static void print(ApplicationGateway resource) {
15141553
.append("\n\t\t\tCookie based affinity: ").append(httpConfig.cookieBasedAffinity())
15151554
.append("\n\t\t\tPort: ").append(httpConfig.port())
15161555
.append("\n\t\t\tRequest timeout in seconds: ").append(httpConfig.requestTimeout())
1517-
.append("\n\t\t\tProtocol: ").append(httpConfig.protocol());
1518-
1556+
.append("\n\t\t\tProtocol: ").append(httpConfig.protocol())
1557+
.append("\n\t\tHost header: ").append(httpConfig.hostHeader())
1558+
.append("\n\t\tHost header comes from backend? ").append(httpConfig.isHostHeaderFromBackend())
1559+
.append("\n\t\tConnection draining timeout in seconds: ").append(httpConfig.connectionDrainingTimeoutInSeconds())
1560+
.append("\n\t\tAffinity cookie name: ").append(httpConfig.affinityCookieName())
1561+
.append("\n\t\tPath: ").append(httpConfig.path());
15191562
ApplicationGatewayProbe probe = httpConfig.probe();
15201563
if (probe != null) {
15211564
info.append("\n\t\tProbe: " + probe.name());
15221565
}
1566+
info.append("\n\t\tIs probe enabled? ").append(httpConfig.isProbeEnabled());
15231567
}
15241568

15251569
// Show SSL certificates
@@ -1530,6 +1574,19 @@ public static void print(ApplicationGateway resource) {
15301574
.append("\n\t\t\tCert data: ").append(cert.publicData());
15311575
}
15321576

1577+
// Show redirect configurations
1578+
Map<String, ApplicationGatewayRedirectConfiguration> redirects = resource.redirectConfigurations();
1579+
info.append("\n\tRedirect configurations: ").append(redirects.size());
1580+
for (ApplicationGatewayRedirectConfiguration redirect : redirects.values()) {
1581+
info.append("\n\t\tName: ").append(redirect.name())
1582+
.append("\n\t\tTarget URL: ").append(redirect.type())
1583+
.append("\n\t\tTarget URL: ").append(redirect.targetUrl())
1584+
.append("\n\t\tTarget listener: ").append(redirect.targetListener() != null ? redirect.targetListener().name() : null)
1585+
.append("\n\t\tIs path included? ").append(redirect.isPathIncluded())
1586+
.append("\n\t\tIs query string included? ").append(redirect.isQueryStringIncluded())
1587+
.append("\n\t\tReferencing request routing rules: ").append(redirect.requestRoutingRules().values());
1588+
}
1589+
15331590
// Show HTTP listeners
15341591
Map<String, ApplicationGatewayListener> listeners = resource.listeners();
15351592
info.append("\n\tHTTP listeners: ").append(listeners.size());
@@ -1555,22 +1612,25 @@ public static void print(ApplicationGateway resource) {
15551612
.append("\n\t\tInterval in seconds: ").append(probe.timeBetweenProbesInSeconds())
15561613
.append("\n\t\tRetries: ").append(probe.retriesBeforeUnhealthy())
15571614
.append("\n\t\tTimeout: ").append(probe.timeoutInSeconds())
1558-
.append("\n\t\tHost: ").append(probe.host());
1615+
.append("\n\t\tHost: ").append(probe.host())
1616+
.append("\n\t\tHealthy HTTP response status code ranges: ").append(probe.healthyHttpResponseStatusCodeRanges())
1617+
.append("\n\t\tHealthy HTTP response body contents: ").append(probe.healthyHttpResponseBodyContents());
15591618
}
15601619

15611620
// Show request routing rules
15621621
Map<String, ApplicationGatewayRequestRoutingRule> rules = resource.requestRoutingRules();
15631622
info.append("\n\tRequest routing rules: ").append(rules.size());
15641623
for (ApplicationGatewayRequestRoutingRule rule : rules.values()) {
15651624
info.append("\n\t\tName: ").append(rule.name())
1566-
.append("\n\t\t\tType: ").append(rule.ruleType())
1567-
.append("\n\t\t\tPublic IP address ID: ").append(rule.publicIPAddressId())
1568-
.append("\n\t\t\tHost name: ").append(rule.hostName())
1569-
.append("\n\t\t\tServer name indication required? ").append(rule.requiresServerNameIndication())
1570-
.append("\n\t\t\tFrontend port: ").append(rule.frontendPort())
1571-
.append("\n\t\t\tFrontend protocol: ").append(rule.frontendProtocol().toString())
1572-
.append("\n\t\t\tBackend port: ").append(rule.backendPort())
1573-
.append("\n\t\t\tCookie based affinity enabled? ").append(rule.cookieBasedAffinity());
1625+
.append("\n\t\tType: ").append(rule.ruleType())
1626+
.append("\n\t\tPublic IP address ID: ").append(rule.publicIPAddressId())
1627+
.append("\n\t\tHost name: ").append(rule.hostName())
1628+
.append("\n\t\tServer name indication required? ").append(rule.requiresServerNameIndication())
1629+
.append("\n\t\tFrontend port: ").append(rule.frontendPort())
1630+
.append("\n\t\tFrontend protocol: ").append(rule.frontendProtocol().toString())
1631+
.append("\n\t\tBackend port: ").append(rule.backendPort())
1632+
.append("\n\t\tCookie based affinity enabled? ").append(rule.cookieBasedAffinity())
1633+
.append("\n\t\tRedirect configuration: ").append(rule.redirectConfiguration() != null ? rule.redirectConfiguration().name() : "(none)");
15741634

15751635
// Show backend addresses
15761636
Collection<ApplicationGatewayBackendAddress> addresses = rule.backendAddresses();

0 commit comments

Comments
 (0)