diff --git a/pom.xml b/pom.xml
index e5a929d..e927bbb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,66 +1,64 @@
-
- 4.0.0
- com.microsoft.azure
- network-java-manage-ip-address
- 0.0.1-SNAPSHOT
- ManageIPAddress.java
-
- https://github.com/Azure/network-java-manage-ip-address
-
-
- com.microsoft.azure
- azure
- 1.0.0-beta5
-
-
-
- src
-
-
- resources
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
- 1.4.0
-
- com.microsoft.azure.management.network.samples.ManageIPAddress
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.0
-
-
- 1.7
-
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
-
-
-
- attached
-
- package
-
-
- jar-with-dependencies
-
-
-
- com.microsoft.azure.management.network.samples.ManageIPAddress.java
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+ 4.0.0
+ com.microsoft.azure
+ network-java-manage-ip-address
+ 0.0.1-SNAPSHOT
+ ManageIPAddress.java
+
+ https://github.com/Azure/network-java-manage-ip-address
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.4.0
+
+ com.microsoft.azure.management.network.samples.ManageIPAddress
+
+
+
+ maven-compiler-plugin
+ 3.0
+
+
+ 1.7
+
+
+
+ maven-assembly-plugin
+
+
+ package
+
+ attached
+
+
+
+ jar-with-dependencies
+
+
+
+ com.microsoft.azure.management.network.samples.ManageIPAddress.java
+
+
+
+
+
+
+
+
+
+
+ com.microsoft.azure
+ azure
+ 1.0.0
+
+
+ commons-net
+ commons-net
+ 3.3
+
+
+
diff --git a/src/main/java/com/microsoft/azure/management/network/samples/ManageIPAddress.java b/src/main/java/com/microsoft/azure/management/network/samples/ManageIPAddress.java
index a6e7804..8f51571 100644
--- a/src/main/java/com/microsoft/azure/management/network/samples/ManageIPAddress.java
+++ b/src/main/java/com/microsoft/azure/management/network/samples/ManageIPAddress.java
@@ -1,8 +1,7 @@
/**
- *
* Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
*/
package com.microsoft.azure.management.network.samples;
@@ -12,7 +11,7 @@
import com.microsoft.azure.management.compute.VirtualMachine;
import com.microsoft.azure.management.compute.VirtualMachineSizeTypes;
import com.microsoft.azure.management.network.NetworkInterface;
-import com.microsoft.azure.management.network.PublicIpAddress;
+import com.microsoft.azure.management.network.PublicIPAddress;
import com.microsoft.azure.management.resources.fluentcore.arm.Region;
import com.microsoft.azure.management.resources.fluentcore.utils.SdkContext;
import com.microsoft.azure.management.samples.Utils;
@@ -37,10 +36,10 @@ public final class ManageIPAddress {
* @return true if sample runs successfully
*/
public static boolean runSample(Azure azure) {
- final String publicIpAddressName1 = SdkContext.randomResourceName("pip1", 20);
- final String publicIpAddressName2 = SdkContext.randomResourceName("pip2", 20);
- final String publicIpAddressLeafDNS1 = SdkContext.randomResourceName("pip1", 20);
- final String publicIpAddressLeafDNS2 = SdkContext.randomResourceName("pip2", 20);
+ final String publicIPAddressName1 = SdkContext.randomResourceName("pip1", 20);
+ final String publicIPAddressName2 = SdkContext.randomResourceName("pip2", 20);
+ final String publicIPAddressLeafDNS1 = SdkContext.randomResourceName("pip1", 20);
+ final String publicIPAddressLeafDNS2 = SdkContext.randomResourceName("pip2", 20);
final String vmName = SdkContext.randomResourceName("vm", 8);
final String rgName = SdkContext.randomResourceName("rgNEMP", 24);
final String userName = "tirekicker";
@@ -55,16 +54,16 @@ public static boolean runSample(Azure azure) {
System.out.println("Creating a public IP address...");
- PublicIpAddress publicIpAddress = azure.publicIpAddresses().define(publicIpAddressName1)
+ PublicIPAddress publicIPAddress = azure.publicIPAddresses().define(publicIPAddressName1)
.withRegion(Region.US_EAST)
.withNewResourceGroup(rgName)
- .withLeafDomainLabel(publicIpAddressLeafDNS1)
+ .withLeafDomainLabel(publicIPAddressLeafDNS1)
.create();
System.out.println("Created a public IP address");
// Print public IP address details
- Utils.print(publicIpAddress);
+ Utils.print(publicIPAddress);
// Use the pre-created public IP for the new VM
@@ -76,8 +75,8 @@ public static boolean runSample(Azure azure) {
.withRegion(Region.US_EAST)
.withExistingResourceGroup(rgName)
.withNewPrimaryNetwork("10.0.0.0/28")
- .withPrimaryPrivateIpAddressDynamic()
- .withExistingPrimaryPublicIpAddress(publicIpAddress)
+ .withPrimaryPrivateIPAddressDynamic()
+ .withExistingPrimaryPublicIPAddress(publicIPAddress)
.withPopularWindowsImage(KnownWindowsVirtualMachineImage.WINDOWS_SERVER_2012_R2_DATACENTER)
.withAdminUsername(userName)
.withAdminPassword(password)
@@ -96,7 +95,7 @@ public static boolean runSample(Azure azure) {
System.out.println("Public IP address associated with the VM's primary NIC [After create]");
// Print the public IP address details
- Utils.print(vm.getPrimaryPublicIpAddress());
+ Utils.print(vm.getPrimaryPublicIPAddress());
//============================================================
@@ -104,10 +103,10 @@ public static boolean runSample(Azure azure) {
// Define a new public IP address
- PublicIpAddress publicIpAddress2 = azure.publicIpAddresses().define(publicIpAddressName2)
+ PublicIPAddress publicIPAddress2 = azure.publicIPAddresses().define(publicIPAddressName2)
.withRegion(Region.US_EAST)
.withNewResourceGroup(rgName)
- .withLeafDomainLabel(publicIpAddressLeafDNS2)
+ .withLeafDomainLabel(publicIPAddressLeafDNS2)
.create();
// Update VM's primary NIC to use the new public IP address
@@ -116,7 +115,7 @@ public static boolean runSample(Azure azure) {
NetworkInterface primaryNetworkInterface = vm.getPrimaryNetworkInterface();
primaryNetworkInterface.update()
- .withExistingPrimaryPublicIpAddress(publicIpAddress2)
+ .withExistingPrimaryPublicIPAddress(publicIPAddress2)
.apply();
@@ -126,7 +125,7 @@ public static boolean runSample(Azure azure) {
// Get the associated public IP address for a virtual machine
System.out.println("Public IP address associated with the VM's primary NIC [After Update]");
vm.refresh();
- Utils.print(vm.getPrimaryPublicIpAddress());
+ Utils.print(vm.getPrimaryPublicIPAddress());
//============================================================
@@ -135,9 +134,9 @@ public static boolean runSample(Azure azure) {
System.out.println("Removing public IP address associated with the VM");
vm.refresh();
primaryNetworkInterface = vm.getPrimaryNetworkInterface();
- publicIpAddress = primaryNetworkInterface.primaryIpConfiguration().getPublicIpAddress();
+ publicIPAddress = primaryNetworkInterface.primaryIPConfiguration().getPublicIPAddress();
primaryNetworkInterface.update()
- .withoutPrimaryPublicIpAddress()
+ .withoutPrimaryPublicIPAddress()
.apply();
System.out.println("Removed public IP address associated with the VM");
@@ -146,7 +145,7 @@ public static boolean runSample(Azure azure) {
//============================================================
// Delete the public ip
System.out.println("Deleting the public IP address");
- azure.publicIpAddresses().deleteById(publicIpAddress.id());
+ azure.publicIPAddresses().deleteById(publicIPAddress.id());
System.out.println("Deleted the public IP address");
return true;
} catch (Exception e) {
diff --git a/src/main/java/com/microsoft/azure/management/samples/Utils.java b/src/main/java/com/microsoft/azure/management/samples/Utils.java
index 5f666fa..0250605 100644
--- a/src/main/java/com/microsoft/azure/management/samples/Utils.java
+++ b/src/main/java/com/microsoft/azure/management/samples/Utils.java
@@ -1,6 +1,7 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
*/
package com.microsoft.azure.management.samples;
@@ -16,6 +17,7 @@
import com.microsoft.azure.management.appservice.Contact;
import com.microsoft.azure.management.appservice.HostNameBinding;
import com.microsoft.azure.management.appservice.HostNameSslState;
+import com.microsoft.azure.management.appservice.PublishingProfile;
import com.microsoft.azure.management.appservice.SslState;
import com.microsoft.azure.management.appservice.WebAppBase;
import com.microsoft.azure.management.batch.Application;
@@ -30,11 +32,11 @@
import com.microsoft.azure.management.compute.VirtualMachineExtension;
import com.microsoft.azure.management.dns.ARecordSet;
import com.microsoft.azure.management.dns.AaaaRecordSet;
-import com.microsoft.azure.management.dns.CnameRecordSet;
+import com.microsoft.azure.management.dns.CNameRecordSet;
import com.microsoft.azure.management.dns.DnsZone;
import com.microsoft.azure.management.dns.MxRecord;
-import com.microsoft.azure.management.dns.MxRecordSet;
-import com.microsoft.azure.management.dns.NsRecordSet;
+import com.microsoft.azure.management.dns.MXRecordSet;
+import com.microsoft.azure.management.dns.NSRecordSet;
import com.microsoft.azure.management.dns.PtrRecordSet;
import com.microsoft.azure.management.dns.SoaRecord;
import com.microsoft.azure.management.dns.SoaRecordSet;
@@ -49,7 +51,7 @@
import com.microsoft.azure.management.network.ApplicationGatewayBackendAddress;
import com.microsoft.azure.management.network.ApplicationGatewayBackendHttpConfiguration;
import com.microsoft.azure.management.network.ApplicationGatewayFrontend;
-import com.microsoft.azure.management.network.ApplicationGatewayIpConfiguration;
+import com.microsoft.azure.management.network.ApplicationGatewayIPConfiguration;
import com.microsoft.azure.management.network.ApplicationGatewayListener;
import com.microsoft.azure.management.network.ApplicationGatewayRequestRoutingRule;
import com.microsoft.azure.management.network.ApplicationGatewaySslCertificate;
@@ -68,13 +70,22 @@
import com.microsoft.azure.management.network.NetworkInterface;
import com.microsoft.azure.management.network.NetworkSecurityGroup;
import com.microsoft.azure.management.network.NetworkSecurityRule;
-import com.microsoft.azure.management.network.PublicIpAddress;
+import com.microsoft.azure.management.network.PublicIPAddress;
import com.microsoft.azure.management.network.Subnet;
import com.microsoft.azure.management.redis.RedisAccessKeys;
import com.microsoft.azure.management.redis.RedisCache;
import com.microsoft.azure.management.redis.RedisCachePremium;
import com.microsoft.azure.management.redis.ScheduleEntry;
import com.microsoft.azure.management.resources.fluentcore.utils.SdkContext;
+import com.microsoft.azure.management.servicebus.AccessRights;
+import com.microsoft.azure.management.servicebus.AuthorizationKeys;
+import com.microsoft.azure.management.servicebus.NamespaceAuthorizationRule;
+import com.microsoft.azure.management.servicebus.Queue;
+import com.microsoft.azure.management.servicebus.QueueAuthorizationRule;
+import com.microsoft.azure.management.servicebus.ServiceBusNamespace;
+import com.microsoft.azure.management.servicebus.Subscription;
+import com.microsoft.azure.management.servicebus.Topic;
+import com.microsoft.azure.management.servicebus.TopicAuthorizationRule;
import com.microsoft.azure.management.sql.ElasticPoolActivity;
import com.microsoft.azure.management.sql.ElasticPoolDatabaseActivity;
import com.microsoft.azure.management.sql.SqlDatabase;
@@ -88,6 +99,8 @@
import com.microsoft.azure.management.trafficmanager.TrafficManagerNestedProfileEndpoint;
import com.microsoft.azure.management.trafficmanager.TrafficManagerProfile;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.net.ftp.FTP;
+import org.apache.commons.net.ftp.FTPClient;
import java.io.BufferedReader;
import java.io.File;
@@ -202,7 +215,7 @@ public static void print(VirtualMachine resource) {
}
StringBuilder extensions = new StringBuilder().append("\n\tExtensions: ");
- for (Map.Entry extensionEntry : resource.extensions().entrySet()) {
+ for (Map.Entry extensionEntry : resource.listExtensions().entrySet()) {
VirtualMachineExtension extension = extensionEntry.getValue();
extensions.append("\n\t\tExtension: ").append(extension.id())
.append("\n\t\t\tName: ").append(extension.name())
@@ -253,7 +266,7 @@ public static void print(AvailabilitySet resource) {
* @throws IOException IO errors
* @throws CloudException Cloud errors
*/
- public static void print(Network resource) throws CloudException, IOException {
+ public static void print(Network resource) {
StringBuilder info = new StringBuilder();
info.append("Network: ").append(resource.id())
.append("Name: ").append(resource.name())
@@ -261,7 +274,7 @@ public static void print(Network resource) throws CloudException, IOException {
.append("\n\tRegion: ").append(resource.region())
.append("\n\tTags: ").append(resource.tags())
.append("\n\tAddress spaces: ").append(resource.addressSpaces())
- .append("\n\tDNS server IPs: ").append(resource.dnsServerIps());
+ .append("\n\tDNS server IPs: ").append(resource.dnsServerIPs());
// Output subnets
for (Subnet subnet : resource.subnets().values()) {
@@ -298,12 +311,12 @@ public static void print(NetworkInterface resource) {
for (String dnsServerIp : resource.dnsServers()) {
info.append("\n\t\t").append(dnsServerIp);
}
- info.append("\n\t IP forwarding enabled: ").append(resource.isIpForwardingEnabled())
+ info.append("\n\t IP forwarding enabled: ").append(resource.isIPForwardingEnabled())
.append("\n\tMAC Address:").append(resource.macAddress())
- .append("\n\tPrivate IP:").append(resource.primaryPrivateIp())
- .append("\n\tPrivate allocation method:").append(resource.primaryPrivateIpAllocationMethod())
- .append("\n\tPrimary virtual network ID: ").append(resource.primaryIpConfiguration().networkId())
- .append("\n\tPrimary subnet name:").append(resource.primaryIpConfiguration().subnetName());
+ .append("\n\tPrivate IP:").append(resource.primaryPrivateIP())
+ .append("\n\tPrivate allocation method:").append(resource.primaryPrivateIPAllocationMethod())
+ .append("\n\tPrimary virtual network ID: ").append(resource.primaryIPConfiguration().networkId())
+ .append("\n\tPrimary subnet name:").append(resource.primaryIPConfiguration().subnetName());
System.out.println(info.toString());
}
@@ -340,7 +353,7 @@ public static void print(NetworkSecurityGroup resource) {
* Print public IP address.
* @param resource a public IP address
*/
- public static void print(PublicIpAddress resource) {
+ public static void print(PublicIPAddress resource) {
System.out.println(new StringBuilder().append("Public IP Address: ").append(resource.id())
.append("Name: ").append(resource.name())
.append("\n\tResource group: ").append(resource.resourceGroupName())
@@ -464,8 +477,8 @@ public static void print(LoadBalancer resource) {
// Show public IP addresses
info.append("\n\tPublic IP address IDs: ")
- .append(resource.publicIpAddressIds().size());
- for (String pipId : resource.publicIpAddressIds()) {
+ .append(resource.publicIPAddressIds().size());
+ for (String pipId : resource.publicIPAddressIds()) {
info.append("\n\t\tPIP id: ").append(pipId);
}
@@ -510,7 +523,7 @@ public static void print(LoadBalancer resource) {
for (LoadBalancingRule rule : resource.loadBalancingRules().values()) {
info.append("\n\t\tLB rule name: ").append(rule.name())
.append("\n\t\t\tProtocol: ").append(rule.protocol())
- .append("\n\t\t\tFloating IP enabled? ").append(rule.floatingIpEnabled())
+ .append("\n\t\t\tFloating IP enabled? ").append(rule.floatingIPEnabled())
.append("\n\t\t\tIdle timeout in minutes: ").append(rule.idleTimeoutInMinutes())
.append("\n\t\t\tLoad distribution method: ").append(rule.loadDistribution().toString());
@@ -550,12 +563,12 @@ public static void print(LoadBalancer resource) {
info.append("\n\t\tFrontend name: ").append(frontend.name())
.append("\n\t\t\tInternet facing: ").append(frontend.isPublic());
if (frontend.isPublic()) {
- info.append("\n\t\t\tPublic IP Address ID: ").append(((LoadBalancerPublicFrontend) frontend).publicIpAddressId());
+ info.append("\n\t\t\tPublic IP Address ID: ").append(((LoadBalancerPublicFrontend) frontend).publicIPAddressId());
} else {
info.append("\n\t\t\tVirtual network ID: ").append(((LoadBalancerPrivateFrontend) frontend).networkId())
.append("\n\t\t\tSubnet name: ").append(((LoadBalancerPrivateFrontend) frontend).subnetName())
- .append("\n\t\t\tPrivate IP address: ").append(((LoadBalancerPrivateFrontend) frontend).privateIpAddress())
- .append("\n\t\t\tPrivate IP allocation method: ").append(((LoadBalancerPrivateFrontend) frontend).privateIpAllocationMethod());
+ .append("\n\t\t\tPrivate IP address: ").append(((LoadBalancerPrivateFrontend) frontend).privateIPAddress())
+ .append("\n\t\t\tPrivate IP allocation method: ").append(((LoadBalancerPrivateFrontend) frontend).privateIPAllocationMethod());
}
// Inbound NAT pool references
@@ -590,8 +603,8 @@ public static void print(LoadBalancer resource) {
.append("\n\t\t\tFrontend port: ").append(natRule.frontendPort())
.append("\n\t\t\tBackend port: ").append(natRule.backendPort())
.append("\n\t\t\tBackend NIC ID: ").append(natRule.backendNetworkInterfaceId())
- .append("\n\t\t\tBackend NIC IP config name: ").append(natRule.backendNicIpConfigurationName())
- .append("\n\t\t\tFloating IP? ").append(natRule.floatingIpEnabled())
+ .append("\n\t\t\tBackend NIC IP config name: ").append(natRule.backendNicIPConfigurationName())
+ .append("\n\t\t\tFloating IP? ").append(natRule.floatingIPEnabled())
.append("\n\t\t\tIdle timeout in minutes: ").append(natRule.idleTimeoutInMinutes());
}
@@ -617,8 +630,8 @@ public static void print(LoadBalancer resource) {
// Show assigned backend NICs
info.append("\n\t\t\tReferenced NICs: ")
- .append(backend.backendNicIpConfigurationNames().entrySet().size());
- for (Map.Entry entry : backend.backendNicIpConfigurationNames().entrySet()) {
+ .append(backend.backendNicIPConfigurationNames().entrySet().size());
+ for (Map.Entry entry : backend.backendNicIPConfigurationNames().entrySet()) {
info.append("\n\t\t\t\tNIC ID: ").append(entry.getKey())
.append(" - IP Config: ").append(entry.getValue());
}
@@ -861,7 +874,7 @@ public static void print(TrafficManagerProfile profile) {
*/
public static void print(DnsZone dnsZone) {
StringBuilder info = new StringBuilder();
- info.append("Dns Zone: ").append(dnsZone.id())
+ info.append("DNS Zone: ").append(dnsZone.id())
.append("\n\tName (Top level domain): ").append(dnsZone.name())
.append("\n\tResource group: ").append(dnsZone.resourceGroupName())
.append("\n\tRegion: ").append(dnsZone.regionName())
@@ -879,15 +892,15 @@ public static void print(DnsZone dnsZone) {
.append("\n\t\tRefresh time (seconds):").append(soaRecord.refreshTime())
.append("\n\t\tRetry time (seconds):").append(soaRecord.retryTime())
.append("\n\t\tNegative response cache ttl (seconds):").append(soaRecord.minimumTtl())
- .append("\n\t\tTtl (seconds):").append(soaRecordSet.timeToLive());
+ .append("\n\t\tTTL (seconds):").append(soaRecordSet.timeToLive());
PagedList aRecordSets = dnsZone.aRecordSets().list();
info.append("\n\tA Record sets:");
for (ARecordSet aRecordSet : aRecordSets) {
info.append("\n\t\tId: ").append(aRecordSet.id())
.append("\n\t\tName: ").append(aRecordSet.name())
- .append("\n\t\tTtl (seconds): ").append(aRecordSet.timeToLive())
- .append("\n\t\tIp v4 addresses: ");
+ .append("\n\t\tTTL (seconds): ").append(aRecordSet.timeToLive())
+ .append("\n\t\tIP v4 addresses: ");
for (String ipAddress : aRecordSet.ipv4Addresses()) {
info.append("\n\t\t\t").append(ipAddress);
}
@@ -898,28 +911,28 @@ public static void print(DnsZone dnsZone) {
for (AaaaRecordSet aaaaRecordSet : aaaaRecordSets) {
info.append("\n\t\tId: ").append(aaaaRecordSet.id())
.append("\n\t\tName: ").append(aaaaRecordSet.name())
- .append("\n\t\tTtl (seconds): ").append(aaaaRecordSet.timeToLive())
- .append("\n\t\tIp v6 addresses: ");
+ .append("\n\t\tTTL (seconds): ").append(aaaaRecordSet.timeToLive())
+ .append("\n\t\tIP v6 addresses: ");
for (String ipAddress : aaaaRecordSet.ipv6Addresses()) {
info.append("\n\t\t\t").append(ipAddress);
}
}
- PagedList cnameRecordSets = dnsZone.cnameRecordSets().list();
+ PagedList cnameRecordSets = dnsZone.cNameRecordSets().list();
info.append("\n\tCNAME Record sets:");
- for (CnameRecordSet cnameRecordSet : cnameRecordSets) {
+ for (CNameRecordSet cnameRecordSet : cnameRecordSets) {
info.append("\n\t\tId: ").append(cnameRecordSet.id())
.append("\n\t\tName: ").append(cnameRecordSet.name())
- .append("\n\t\tTtl (seconds): ").append(cnameRecordSet.timeToLive())
+ .append("\n\t\tTTL (seconds): ").append(cnameRecordSet.timeToLive())
.append("\n\t\tCanonical name: ").append(cnameRecordSet.canonicalName());
}
- PagedList mxRecordSets = dnsZone.mxRecordSets().list();
+ PagedList mxRecordSets = dnsZone.mxRecordSets().list();
info.append("\n\tMX Record sets:");
- for (MxRecordSet mxRecordSet : mxRecordSets) {
+ for (MXRecordSet mxRecordSet : mxRecordSets) {
info.append("\n\t\tId: ").append(mxRecordSet.id())
.append("\n\t\tName: ").append(mxRecordSet.name())
- .append("\n\t\tTtl (seconds): ").append(mxRecordSet.timeToLive())
+ .append("\n\t\tTTL (seconds): ").append(mxRecordSet.timeToLive())
.append("\n\t\tRecords: ");
for (MxRecord mxRecord : mxRecordSet.records()) {
info.append("\n\t\t\tExchange server, Preference: ")
@@ -929,12 +942,12 @@ public static void print(DnsZone dnsZone) {
}
}
- PagedList nsRecordSets = dnsZone.nsRecordSets().list();
+ PagedList nsRecordSets = dnsZone.nsRecordSets().list();
info.append("\n\tNS Record sets:");
- for (NsRecordSet nsRecordSet : nsRecordSets) {
+ for (NSRecordSet nsRecordSet : nsRecordSets) {
info.append("\n\t\tId: ").append(nsRecordSet.id())
.append("\n\t\tName: ").append(nsRecordSet.name())
- .append("\n\t\tTtl (seconds): ").append(nsRecordSet.timeToLive())
+ .append("\n\t\tTTL (seconds): ").append(nsRecordSet.timeToLive())
.append("\n\t\tName servers: ");
for (String nameServer : nsRecordSet.nameServers()) {
info.append("\n\t\t\t").append(nameServer);
@@ -946,7 +959,7 @@ public static void print(DnsZone dnsZone) {
for (PtrRecordSet ptrRecordSet : ptrRecordSets) {
info.append("\n\t\tId: ").append(ptrRecordSet.id())
.append("\n\t\tName: ").append(ptrRecordSet.name())
- .append("\n\t\tTtl (seconds): ").append(ptrRecordSet.timeToLive())
+ .append("\n\t\tTTL (seconds): ").append(ptrRecordSet.timeToLive())
.append("\n\t\tTarget domain names: ");
for (String domainNames : ptrRecordSet.targetDomainNames()) {
info.append("\n\t\t\t").append(domainNames);
@@ -958,7 +971,7 @@ public static void print(DnsZone dnsZone) {
for (SrvRecordSet srvRecordSet : srvRecordSets) {
info.append("\n\t\tId: ").append(srvRecordSet.id())
.append("\n\t\tName: ").append(srvRecordSet.name())
- .append("\n\t\tTtl (seconds): ").append(srvRecordSet.timeToLive())
+ .append("\n\t\tTTL (seconds): ").append(srvRecordSet.timeToLive())
.append("\n\t\tRecords: ");
for (SrvRecord srvRecord : srvRecordSet.records()) {
info.append("\n\t\t\tTarget, Port, Priority, Weight: ")
@@ -977,7 +990,7 @@ public static void print(DnsZone dnsZone) {
for (TxtRecordSet txtRecordSet : txtRecordSets) {
info.append("\n\t\tId: ").append(txtRecordSet.id())
.append("\n\t\tName: ").append(txtRecordSet.name())
- .append("\n\t\tTtl (seconds): ").append(txtRecordSet.timeToLive())
+ .append("\n\t\tTTL (seconds): ").append(txtRecordSet.timeToLive())
.append("\n\t\tRecords: ");
for (TxtRecord txtRecord : txtRecordSet.records()) {
if (txtRecord.value().size() > 0) {
@@ -1156,8 +1169,8 @@ public static void print(SqlFirewallRule firewallRule) {
.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());
+ .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());
}
@@ -1246,13 +1259,13 @@ public static void print(ApplicationGateway resource) {
.append("\n\tSSL policy: ").append(resource.sslPolicy())
.append("\n\tInternet-facing? ").append(resource.isPublic())
.append("\n\tInternal? ").append(resource.isPrivate())
- .append("\n\tDefault private IP address: ").append(resource.privateIpAddress())
- .append("\n\tPrivate IP address allocation method: ").append(resource.privateIpAllocationMethod());
+ .append("\n\tDefault private IP address: ").append(resource.privateIPAddress())
+ .append("\n\tPrivate IP address allocation method: ").append(resource.privateIPAllocationMethod());
// Show IP configs
- Map ipConfigs = resource.ipConfigurations();
+ Map ipConfigs = resource.ipConfigurations();
info.append("\n\tIP configurations: ").append(ipConfigs.size());
- for (ApplicationGatewayIpConfiguration ipConfig : ipConfigs.values()) {
+ for (ApplicationGatewayIPConfiguration ipConfig : ipConfigs.values()) {
info.append("\n\t\tName: ").append(ipConfig.name())
.append("\n\t\t\tNetwork id: ").append(ipConfig.networkId())
.append("\n\t\t\tSubnet name: ").append(ipConfig.subnetName());
@@ -1267,13 +1280,13 @@ public static void print(ApplicationGateway resource) {
if (frontend.isPublic()) {
// Show public frontend info
- info.append("\n\t\t\tPublic IP address ID: ").append(frontend.publicIpAddressId());
+ info.append("\n\t\t\tPublic IP address ID: ").append(frontend.publicIPAddressId());
}
if (frontend.isPrivate()) {
// Show private frontend info
- info.append("\n\t\t\tPrivate IP address: ").append(frontend.privateIpAddress())
- .append("\n\t\t\tPrivate IP allocation method: ").append(frontend.privateIpAllocationMethod())
+ info.append("\n\t\t\tPrivate IP address: ").append(frontend.privateIPAddress())
+ .append("\n\t\t\tPrivate IP allocation method: ").append(frontend.privateIPAllocationMethod())
.append("\n\t\t\tSubnet name: ").append(frontend.subnetName())
.append("\n\t\t\tVirtual network ID: ").append(frontend.networkId());
}
@@ -1284,7 +1297,7 @@ public static void print(ApplicationGateway resource) {
info.append("\n\tBackends: ").append(backends.size());
for (ApplicationGatewayBackend backend : backends.values()) {
info.append("\n\t\tName: ").append(backend.name())
- .append("\n\t\t\tAssociated NIC IP configuration IDs: ").append(backend.backendNicIpConfigurationNames().keySet());
+ .append("\n\t\t\tAssociated NIC IP configuration IDs: ").append(backend.backendNicIPConfigurationNames().keySet());
// Show addresses
List addresses = backend.addresses();
@@ -1336,7 +1349,7 @@ public static void print(ApplicationGateway resource) {
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\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())
@@ -1442,7 +1455,232 @@ public static void print(VirtualMachineCustomImage image) {
System.out.println(builder.toString());
}
+ /**
+ * Uploads a file to an Azure web app.
+ * @param profile the publishing profile for the web app.
+ * @param fileName the name of the file on server
+ * @param file the local file
+ */
+ public static void uploadFileToFtp(PublishingProfile profile, String fileName, InputStream file) {
+ FTPClient ftpClient = new FTPClient();
+ String[] ftpUrlSegments = profile.ftpUrl().split("/", 2);
+ String server = ftpUrlSegments[0];
+ String path = "./site/wwwroot/webapps";
+ try {
+ ftpClient.connect(server);
+ ftpClient.login(profile.ftpUsername(), profile.ftpPassword());
+ ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
+ ftpClient.changeWorkingDirectory(path);
+ ftpClient.storeFile(fileName, file);
+ ftpClient.disconnect();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
private Utils() {
}
+
+ /**
+ * Print service bus namespace info.
+ * @param serviceBusNamespace a service bus namespace
+ */
+ public static void print(ServiceBusNamespace serviceBusNamespace) {
+ StringBuilder builder = new StringBuilder()
+ .append("Service bus Namespace: ").append(serviceBusNamespace.id())
+ .append("\n\tName: ").append(serviceBusNamespace.name())
+ .append("\n\tRegion: ").append(serviceBusNamespace.regionName())
+ .append("\n\tResourceGroupName: ").append(serviceBusNamespace.resourceGroupName())
+ .append("\n\tCreatedAt: ").append(serviceBusNamespace.createdAt())
+ .append("\n\tUpdatedAt: ").append(serviceBusNamespace.updatedAt())
+ .append("\n\tDnsLabel: ").append(serviceBusNamespace.dnsLabel())
+ .append("\n\tFQDN: ").append(serviceBusNamespace.fqdn())
+ .append("\n\tSku: ")
+ .append("\n\t\tCapacity: ").append(serviceBusNamespace.sku().capacity())
+ .append("\n\t\tSkuName: ").append(serviceBusNamespace.sku().name())
+ .append("\n\t\tTier: ").append(serviceBusNamespace.sku().tier());
+
+ System.out.println(builder.toString());
+ }
+
+ /**
+ * Print service bus queue info.
+ * @param queue a service bus queue
+ */
+ public static void print(Queue queue) {
+ StringBuilder builder = new StringBuilder()
+ .append("Service bus Queue: ").append(queue.id())
+ .append("\n\tName: ").append(queue.name())
+ .append("\n\tResourceGroupName: ").append(queue.resourceGroupName())
+ .append("\n\tCreatedAt: ").append(queue.createdAt())
+ .append("\n\tUpdatedAt: ").append(queue.updatedAt())
+ .append("\n\tAccessedAt: ").append(queue.accessedAt())
+ .append("\n\tActiveMessageCount: ").append(queue.activeMessageCount())
+ .append("\n\tCurrentSizeInBytes: ").append(queue.currentSizeInBytes())
+ .append("\n\tDeadLetterMessageCount: ").append(queue.deadLetterMessageCount())
+ .append("\n\tDefaultMessageTtlDuration: ").append(queue.defaultMessageTtlDuration())
+ .append("\n\tDuplicateMessageDetectionHistoryDuration: ").append(queue.duplicateMessageDetectionHistoryDuration())
+ .append("\n\tIsBatchedOperationsEnabled: ").append(queue.isBatchedOperationsEnabled())
+ .append("\n\tIsDeadLetteringEnabledForExpiredMessages: ").append(queue.isDeadLetteringEnabledForExpiredMessages())
+ .append("\n\tIsDuplicateDetectionEnabled: ").append(queue.isDuplicateDetectionEnabled())
+ .append("\n\tIsExpressEnabled: ").append(queue.isExpressEnabled())
+ .append("\n\tIsPartitioningEnabled: ").append(queue.isPartitioningEnabled())
+ .append("\n\tIsSessionEnabled: ").append(queue.isSessionEnabled())
+ .append("\n\tDeleteOnIdleDurationInMinutes: ").append(queue.deleteOnIdleDurationInMinutes())
+ .append("\n\tMaxDeliveryCountBeforeDeadLetteringMessage: ").append(queue.maxDeliveryCountBeforeDeadLetteringMessage())
+ .append("\n\tMaxSizeInMB: ").append(queue.maxSizeInMB())
+ .append("\n\tMessageCount: ").append(queue.messageCount())
+ .append("\n\tScheduledMessageCount: ").append(queue.scheduledMessageCount())
+ .append("\n\tStatus: ").append(queue.status())
+ .append("\n\tTransferMessageCount: ").append(queue.transferMessageCount())
+ .append("\n\tLockDurationInSeconds: ").append(queue.lockDurationInSeconds())
+ .append("\n\tTransferDeadLetterMessageCount: ").append(queue.transferDeadLetterMessageCount());
+
+ System.out.println(builder.toString());
+
+ }
+
+ /**
+ * Print service bus queue authorization keys info.
+ * @param queueAuthorizationRule a service bus queue authorization keys
+ */
+ public static void print(QueueAuthorizationRule queueAuthorizationRule) {
+ StringBuilder builder = new StringBuilder()
+ .append("Service bus queue authorization rule: ").append(queueAuthorizationRule.id())
+ .append("\n\tName: ").append(queueAuthorizationRule.name())
+ .append("\n\tResourceGroupName: ").append(queueAuthorizationRule.resourceGroupName())
+ .append("\n\tNamespace Name: ").append(queueAuthorizationRule.namespaceName())
+ .append("\n\tQueue Name: ").append(queueAuthorizationRule.queueName());
+
+ List rights = queueAuthorizationRule.rights();
+ builder.append("\n\tNumber of access rights in queue: ").append(rights.size());
+ for (AccessRights right: rights) {
+ builder.append("\n\t\tAccessRight: ")
+ .append("\n\t\t\tName :").append(right.name());
+ }
+
+ System.out.println(builder.toString());
+ }
+
+ /**
+ * Print service bus namespace authorization keys info.
+ * @param keys a service bus namespace authorization keys
+ */
+ public static void print(AuthorizationKeys keys) {
+ StringBuilder builder = new StringBuilder()
+ .append("Authorization keys: ")
+ .append("\n\tPrimaryKey: ").append(keys.primaryKey())
+ .append("\n\tPrimaryConnectionString: ").append(keys.primaryConnectionString())
+ .append("\n\tSecondaryKey: ").append(keys.secondaryKey())
+ .append("\n\tSecondaryConnectionString: ").append(keys.secondaryConnectionString());
+
+ System.out.println(builder.toString());
+ }
+
+ /**
+ * Print service bus namespace authorization rule info.
+ * @param namespaceAuthorizationRule a service bus namespace authorization rule
+ */
+ public static void print(NamespaceAuthorizationRule namespaceAuthorizationRule) {
+ StringBuilder builder = new StringBuilder()
+ .append("Service bus queue authorization rule: ").append(namespaceAuthorizationRule.id())
+ .append("\n\tName: ").append(namespaceAuthorizationRule.name())
+ .append("\n\tResourceGroupName: ").append(namespaceAuthorizationRule.resourceGroupName())
+ .append("\n\tNamespace Name: ").append(namespaceAuthorizationRule.namespaceName());
+
+ List rights = namespaceAuthorizationRule.rights();
+ builder.append("\n\tNumber of access rights in queue: ").append(rights.size());
+ for (AccessRights right: rights) {
+ builder.append("\n\t\tAccessRight: ")
+ .append("\n\t\t\tName :").append(right.name());
+ }
+
+ System.out.println(builder.toString());
+ }
+
+ /**
+ * Print service bus topic info.
+ * @param topic a service bus topic
+ */
+ public static void print(Topic topic) {
+ StringBuilder builder = new StringBuilder()
+ .append("Service bus topic: ").append(topic.id())
+ .append("\n\tName: ").append(topic.name())
+ .append("\n\tResourceGroupName: ").append(topic.resourceGroupName())
+ .append("\n\tCreatedAt: ").append(topic.createdAt())
+ .append("\n\tUpdatedAt: ").append(topic.updatedAt())
+ .append("\n\tAccessedAt: ").append(topic.accessedAt())
+ .append("\n\tActiveMessageCount: ").append(topic.activeMessageCount())
+ .append("\n\tCurrentSizeInBytes: ").append(topic.currentSizeInBytes())
+ .append("\n\tDeadLetterMessageCount: ").append(topic.deadLetterMessageCount())
+ .append("\n\tDefaultMessageTtlDuration: ").append(topic.defaultMessageTtlDuration())
+ .append("\n\tDuplicateMessageDetectionHistoryDuration: ").append(topic.duplicateMessageDetectionHistoryDuration())
+ .append("\n\tIsBatchedOperationsEnabled: ").append(topic.isBatchedOperationsEnabled())
+ .append("\n\tIsDuplicateDetectionEnabled: ").append(topic.isDuplicateDetectionEnabled())
+ .append("\n\tIsExpressEnabled: ").append(topic.isExpressEnabled())
+ .append("\n\tIsPartitioningEnabled: ").append(topic.isPartitioningEnabled())
+ .append("\n\tDeleteOnIdleDurationInMinutes: ").append(topic.deleteOnIdleDurationInMinutes())
+ .append("\n\tMaxSizeInMB: ").append(topic.maxSizeInMB())
+ .append("\n\tScheduledMessageCount: ").append(topic.scheduledMessageCount())
+ .append("\n\tStatus: ").append(topic.status())
+ .append("\n\tTransferMessageCount: ").append(topic.transferMessageCount())
+ .append("\n\tSubscriptionCount: ").append(topic.subscriptionCount())
+ .append("\n\tTransferDeadLetterMessageCount: ").append(topic.transferDeadLetterMessageCount());
+
+ System.out.println(builder.toString());
+ }
+
+ /**
+ * Print service bus subscription info.
+ * @param serviceBusSubscription a service bus subscription
+ */
+ public static void print(Subscription serviceBusSubscription) {
+ StringBuilder builder = new StringBuilder()
+ .append("Service bus subscription: ").append(serviceBusSubscription.id())
+ .append("\n\tName: ").append(serviceBusSubscription.name())
+ .append("\n\tResourceGroupName: ").append(serviceBusSubscription.resourceGroupName())
+ .append("\n\tCreatedAt: ").append(serviceBusSubscription.createdAt())
+ .append("\n\tUpdatedAt: ").append(serviceBusSubscription.updatedAt())
+ .append("\n\tAccessedAt: ").append(serviceBusSubscription.accessedAt())
+ .append("\n\tActiveMessageCount: ").append(serviceBusSubscription.activeMessageCount())
+ .append("\n\tDeadLetterMessageCount: ").append(serviceBusSubscription.deadLetterMessageCount())
+ .append("\n\tDefaultMessageTtlDuration: ").append(serviceBusSubscription.defaultMessageTtlDuration())
+ .append("\n\tIsBatchedOperationsEnabled: ").append(serviceBusSubscription.isBatchedOperationsEnabled())
+ .append("\n\tDeleteOnIdleDurationInMinutes: ").append(serviceBusSubscription.deleteOnIdleDurationInMinutes())
+ .append("\n\tScheduledMessageCount: ").append(serviceBusSubscription.scheduledMessageCount())
+ .append("\n\tStatus: ").append(serviceBusSubscription.status())
+ .append("\n\tTransferMessageCount: ").append(serviceBusSubscription.transferMessageCount())
+ .append("\n\tIsDeadLetteringEnabledForExpiredMessages: ").append(serviceBusSubscription.isDeadLetteringEnabledForExpiredMessages())
+ .append("\n\tIsSessionEnabled: ").append(serviceBusSubscription.isSessionEnabled())
+ .append("\n\tLockDurationInSeconds: ").append(serviceBusSubscription.lockDurationInSeconds())
+ .append("\n\tMaxDeliveryCountBeforeDeadLetteringMessage: ").append(serviceBusSubscription.maxDeliveryCountBeforeDeadLetteringMessage())
+ .append("\n\tIsDeadLetteringEnabledForFilterEvaluationFailedMessages: ").append(serviceBusSubscription.isDeadLetteringEnabledForFilterEvaluationFailedMessages())
+ .append("\n\tTransferMessageCount: ").append(serviceBusSubscription.transferMessageCount())
+ .append("\n\tTransferDeadLetterMessageCount: ").append(serviceBusSubscription.transferDeadLetterMessageCount());
+
+ System.out.println(builder.toString());
+ }
+
+ /**
+ * Print topic Authorization Rule info.
+ * @param topicAuthorizationRule a topic Authorization Rule
+ */
+ public static void print(TopicAuthorizationRule topicAuthorizationRule) {
+ StringBuilder builder = new StringBuilder()
+ .append("Service bus topic authorization rule: ").append(topicAuthorizationRule.id())
+ .append("\n\tName: ").append(topicAuthorizationRule.name())
+ .append("\n\tResourceGroupName: ").append(topicAuthorizationRule.resourceGroupName())
+ .append("\n\tNamespace Name: ").append(topicAuthorizationRule.namespaceName())
+ .append("\n\tTopic Name: ").append(topicAuthorizationRule.topicName());
+
+ List rights = topicAuthorizationRule.rights();
+ builder.append("\n\tNumber of access rights in queue: ").append(rights.size());
+ for (AccessRights right: rights) {
+ builder.append("\n\t\tAccessRight: ")
+ .append("\n\t\t\tName :").append(right.name());
+ }
+
+ System.out.println(builder.toString());
+ }
}