Skip to content

Commit

Permalink
Release 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Schulte committed Nov 17, 2017
1 parent 1dd49a3 commit 8ab4ef0
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 27 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure</artifactId>
<version>1.3.0</version>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
Expand Down
112 changes: 86 additions & 26 deletions src/main/java/com/microsoft/azure/management/samples/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import com.microsoft.azure.management.batch.BatchAccount;
import com.microsoft.azure.management.batch.BatchAccountKeys;
import com.microsoft.azure.management.compute.AvailabilitySet;
import com.microsoft.azure.management.compute.ContainerService;
import com.microsoft.azure.management.compute.ContainerServiceOrchestratorTypes;
import com.microsoft.azure.management.compute.DataDisk;
import com.microsoft.azure.management.compute.ImageDataDisk;
import com.microsoft.azure.management.compute.VirtualMachine;
Expand All @@ -38,8 +36,12 @@
import com.microsoft.azure.management.containerinstance.EnvironmentVariable;
import com.microsoft.azure.management.containerinstance.Volume;
import com.microsoft.azure.management.containerinstance.VolumeMount;
import com.microsoft.azure.management.containerregistry.AccessKeyType;
import com.microsoft.azure.management.containerregistry.Registry;
import com.microsoft.azure.management.containerregistry.implementation.RegistryListCredentials;
import com.microsoft.azure.management.containerregistry.RegistryCredentials;
import com.microsoft.azure.management.containerservice.ContainerService;
import com.microsoft.azure.management.containerservice.ContainerServiceOrchestratorTypes;
import com.microsoft.azure.management.containerservice.KubernetesCluster;
import com.microsoft.azure.management.cosmosdb.CosmosDBAccount;
import com.microsoft.azure.management.dns.ARecordSet;
import com.microsoft.azure.management.dns.AaaaRecordSet;
Expand All @@ -65,6 +67,7 @@
import com.microsoft.azure.management.graphrbac.implementation.PermissionInner;
import com.microsoft.azure.management.keyvault.AccessPolicy;
import com.microsoft.azure.management.keyvault.Vault;
import com.microsoft.azure.management.locks.ManagementLock;
import com.microsoft.azure.management.network.ApplicationGateway;
import com.microsoft.azure.management.network.ApplicationGatewayBackend;
import com.microsoft.azure.management.network.ApplicationGatewayBackendAddress;
Expand All @@ -73,6 +76,7 @@
import com.microsoft.azure.management.network.ApplicationGatewayIPConfiguration;
import com.microsoft.azure.management.network.ApplicationGatewayListener;
import com.microsoft.azure.management.network.ApplicationGatewayProbe;
import com.microsoft.azure.management.network.ApplicationGatewayRedirectConfiguration;
import com.microsoft.azure.management.network.ApplicationGatewayRequestRoutingRule;
import com.microsoft.azure.management.network.ApplicationGatewaySslCertificate;
import com.microsoft.azure.management.network.EffectiveNetworkSecurityRule;
Expand Down Expand Up @@ -355,7 +359,6 @@ public static void print(Network resource) {
.append("\n\t\tRemote network ID: ").append(peering.remoteNetworkId())
.append("\n\t\tPeering state: ").append(peering.state())
.append("\n\t\tIs traffic forwarded from remote network allowed? ").append(peering.isTrafficForwardingFromRemoteNetworkAllowed())
//TODO .append("\n\t\tIs access from remote network allowed? ").append(peering.isAccessFromRemoteNetworkAllowed())
.append("\n\t\tGateway use: ").append(peering.gatewayUse());
}
System.out.println(info.toString());
Expand Down Expand Up @@ -545,6 +548,18 @@ public static void print(RedisAccessKeys redisAccessKeys) {
System.out.println(redisKeys.toString());
}

/**
* Print management lock.
* @param lock a management lock
*/
public static void print(ManagementLock lock) {
StringBuilder info = new StringBuilder();
info.append("\nLock ID: ").append(lock.id())
.append("\nLocked resource ID: ").append(lock.lockedResourceId())
.append("\nLevel: ").append(lock.level());
System.out.println(info.toString());
}

/**
* Print load balancer.
*
Expand Down Expand Up @@ -874,11 +889,11 @@ public static void print(WebAppBase resource) {
}
}
builder = builder.append("\n\tApp settings: ");
for (AppSetting setting : resource.appSettings().values()) {
for (AppSetting setting : resource.getAppSettings().values()) {
builder = builder.append("\n\t\t" + setting.key() + ": " + setting.value() + (setting.sticky() ? " - slot setting" : ""));
}
builder = builder.append("\n\tConnection strings: ");
for (ConnectionString conn : resource.connectionStrings().values()) {
for (ConnectionString conn : resource.getConnectionStrings().values()) {
builder = builder.append("\n\t\t" + conn.name() + ": " + conn.value() + " - " + conn.type() + (conn.sticky() ? " - slot setting" : ""));
}
System.out.println(builder.toString());
Expand Down Expand Up @@ -1100,13 +1115,13 @@ public static void print(DnsZone dnsZone) {
public static void print(Registry azureRegistry) {
StringBuilder info = new StringBuilder();

RegistryListCredentials acrCredentials = azureRegistry.listCredentials();
RegistryCredentials acrCredentials = azureRegistry.getCredentials();
info.append("Azure Container Registry: ").append(azureRegistry.id())
.append("\n\tName: ").append(azureRegistry.name())
.append("\n\tServer Url: ").append(azureRegistry.loginServerUrl())
.append("\n\tUser: ").append(acrCredentials.username())
.append("\n\tFirst Password: ").append(acrCredentials.passwords().get(0).value())
.append("\n\tSecond Password: ").append(acrCredentials.passwords().get(1).value());
.append("\n\tFirst Password: ").append(acrCredentials.accessKeys().get(AccessKeyType.PRIMARY))
.append("\n\tSecond Password: ").append(acrCredentials.accessKeys().get(AccessKeyType.SECONDARY));
System.out.println(info.toString());
}

Expand All @@ -1122,12 +1137,12 @@ public static void print(ContainerService containerService) {
.append("\n\tWith orchestration: ").append(containerService.orchestratorType().toString())
.append("\n\tMaster FQDN: ").append(containerService.masterFqdn())
.append("\n\tMaster node count: ").append(containerService.masterNodeCount())
.append("\n\tMaster leaf domain label: ").append(containerService.masterLeafDomainLabel())
.append("\n\t\tWith Agent pool name: ").append(containerService.agentPoolName())
.append("\n\t\tAgent pool count: ").append(containerService.agentPoolCount())
.append("\n\t\tAgent pool count: ").append(containerService.agentPoolVMSize().toString())
.append("\n\t\tAgent pool FQDN: ").append(containerService.agentPoolFqdn())
.append("\n\t\tAgent pool leaf domain label: ").append(containerService.agentPoolLeafDomainLabel())
.append("\n\tMaster domain label prefix: ").append(containerService.masterDnsPrefix())
.append("\n\t\tWith Agent pool name: ").append(new ArrayList<>(containerService.agentPools().keySet()).get(0))
.append("\n\t\tAgent pool count: ").append(new ArrayList<>(containerService.agentPools().values()).get(0).count())
.append("\n\t\tAgent pool VM size: ").append(new ArrayList<>(containerService.agentPools().values()).get(0).vmSize().toString())
.append("\n\t\tAgent pool FQDN: ").append(new ArrayList<>(containerService.agentPools().values()).get(0).fqdn())
.append("\n\t\tAgent pool domain label prefix: ").append(new ArrayList<>(containerService.agentPools().values()).get(0).dnsPrefix())
.append("\n\tLinux user name: ").append(containerService.linuxRootUsername())
.append("\n\tSSH key: ").append(containerService.sshKey());
if (containerService.orchestratorType() == ContainerServiceOrchestratorTypes.KUBERNETES) {
Expand All @@ -1137,6 +1152,30 @@ public static void print(ContainerService containerService) {
System.out.println(info.toString());
}

/**
* Print an Azure Container Service (AKS).
* @param kubernetesCluster a managed container service
*/
public static void print(KubernetesCluster kubernetesCluster) {
StringBuilder info = new StringBuilder();

info.append("Azure Container Service: ").append(kubernetesCluster.id())
.append("\n\tName: ").append(kubernetesCluster.name())
.append("\n\tFQDN: ").append(kubernetesCluster.fqdn())
.append("\n\tDNS prefix label: ").append(kubernetesCluster.dnsPrefix())
.append("\n\t\tWith Agent pool name: ").append(new ArrayList<>(kubernetesCluster.agentPools().keySet()).get(0))
.append("\n\t\tAgent pool count: ").append(new ArrayList<>(kubernetesCluster.agentPools().values()).get(0).count())
.append("\n\t\tAgent pool VM size: ").append(new ArrayList<>(kubernetesCluster.agentPools().values()).get(0).vmSize().toString())
.append("\n\tLinux user name: ").append(kubernetesCluster.linuxRootUsername())
.append("\n\tSSH key: ").append(kubernetesCluster.sshKey())
.append("\n\tService principal client ID: ").append(kubernetesCluster.servicePrincipalClientId());
if (kubernetesCluster.keyVaultSecretReference() != null) {
info.append("\n\tKeyVault reference: ").append(kubernetesCluster.keyVaultSecretReference().vaultID());
}

System.out.println(info.toString());
}

/**
* Print an Azure Search Service.
* @param searchService an Azure Search Service
Expand Down Expand Up @@ -1514,12 +1553,17 @@ public static void print(ApplicationGateway resource) {
.append("\n\t\t\tCookie based affinity: ").append(httpConfig.cookieBasedAffinity())
.append("\n\t\t\tPort: ").append(httpConfig.port())
.append("\n\t\t\tRequest timeout in seconds: ").append(httpConfig.requestTimeout())
.append("\n\t\t\tProtocol: ").append(httpConfig.protocol());

.append("\n\t\t\tProtocol: ").append(httpConfig.protocol())
.append("\n\t\tHost header: ").append(httpConfig.hostHeader())
.append("\n\t\tHost header comes from backend? ").append(httpConfig.isHostHeaderFromBackend())
.append("\n\t\tConnection draining timeout in seconds: ").append(httpConfig.connectionDrainingTimeoutInSeconds())
.append("\n\t\tAffinity cookie name: ").append(httpConfig.affinityCookieName())
.append("\n\t\tPath: ").append(httpConfig.path());
ApplicationGatewayProbe probe = httpConfig.probe();
if (probe != null) {
info.append("\n\t\tProbe: " + probe.name());
}
info.append("\n\t\tIs probe enabled? ").append(httpConfig.isProbeEnabled());
}

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

// Show redirect configurations
Map<String, ApplicationGatewayRedirectConfiguration> redirects = resource.redirectConfigurations();
info.append("\n\tRedirect configurations: ").append(redirects.size());
for (ApplicationGatewayRedirectConfiguration redirect : redirects.values()) {
info.append("\n\t\tName: ").append(redirect.name())
.append("\n\t\tTarget URL: ").append(redirect.type())
.append("\n\t\tTarget URL: ").append(redirect.targetUrl())
.append("\n\t\tTarget listener: ").append(redirect.targetListener() != null ? redirect.targetListener().name() : null)
.append("\n\t\tIs path included? ").append(redirect.isPathIncluded())
.append("\n\t\tIs query string included? ").append(redirect.isQueryStringIncluded())
.append("\n\t\tReferencing request routing rules: ").append(redirect.requestRoutingRules().values());
}

// Show HTTP listeners
Map<String, ApplicationGatewayListener> listeners = resource.listeners();
info.append("\n\tHTTP listeners: ").append(listeners.size());
Expand All @@ -1555,22 +1612,25 @@ public static void print(ApplicationGateway resource) {
.append("\n\t\tInterval in seconds: ").append(probe.timeBetweenProbesInSeconds())
.append("\n\t\tRetries: ").append(probe.retriesBeforeUnhealthy())
.append("\n\t\tTimeout: ").append(probe.timeoutInSeconds())
.append("\n\t\tHost: ").append(probe.host());
.append("\n\t\tHost: ").append(probe.host())
.append("\n\t\tHealthy HTTP response status code ranges: ").append(probe.healthyHttpResponseStatusCodeRanges())
.append("\n\t\tHealthy HTTP response body contents: ").append(probe.healthyHttpResponseBodyContents());
}

// Show request routing rules
Map<String, ApplicationGatewayRequestRoutingRule> rules = resource.requestRoutingRules();
info.append("\n\tRequest routing rules: ").append(rules.size());
for (ApplicationGatewayRequestRoutingRule rule : rules.values()) {
info.append("\n\t\tName: ").append(rule.name())
.append("\n\t\t\tType: ").append(rule.ruleType())
.append("\n\t\t\tPublic IP address ID: ").append(rule.publicIPAddressId())
.append("\n\t\t\tHost name: ").append(rule.hostName())
.append("\n\t\t\tServer name indication required? ").append(rule.requiresServerNameIndication())
.append("\n\t\t\tFrontend port: ").append(rule.frontendPort())
.append("\n\t\t\tFrontend protocol: ").append(rule.frontendProtocol().toString())
.append("\n\t\t\tBackend port: ").append(rule.backendPort())
.append("\n\t\t\tCookie based affinity enabled? ").append(rule.cookieBasedAffinity());
.append("\n\t\tType: ").append(rule.ruleType())
.append("\n\t\tPublic IP address ID: ").append(rule.publicIPAddressId())
.append("\n\t\tHost name: ").append(rule.hostName())
.append("\n\t\tServer name indication required? ").append(rule.requiresServerNameIndication())
.append("\n\t\tFrontend port: ").append(rule.frontendPort())
.append("\n\t\tFrontend protocol: ").append(rule.frontendProtocol().toString())
.append("\n\t\tBackend port: ").append(rule.backendPort())
.append("\n\t\tCookie based affinity enabled? ").append(rule.cookieBasedAffinity())
.append("\n\t\tRedirect configuration: ").append(rule.redirectConfiguration() != null ? rule.redirectConfiguration().name() : "(none)");

// Show backend addresses
Collection<ApplicationGatewayBackendAddress> addresses = rule.backendAddresses();
Expand Down

0 comments on commit 8ab4ef0

Please sign in to comment.