From aaa9e00ddeb6149bb5305dbe2006ce1a246acd00 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Sep 2016 11:03:56 -0700 Subject: [PATCH 01/21] allowing to specify only NAT pools or NAT rule in the define flow, not mixing --- .../management/network/LoadBalancer.java | 40 +++++++++++++++---- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancer.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancer.java index 6fd254a211914..fa10dfa88c70a 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancer.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancer.java @@ -81,7 +81,10 @@ interface Definition extends DefinitionStages.WithProbe, DefinitionStages.WithProbeOrLoadBalancingRule, DefinitionStages.WithLoadBalancingRule, - DefinitionStages.WithLoadBalancingRuleOrCreate { + DefinitionStages.WithLoadBalancingRuleOrCreate, + DefinitionStages.WithCreateAndInboundNatPool, + DefinitionStages.WithCreateAndInboundNatRule, + DefinitionStages.WithCreateAndNatChoice { } /** @@ -338,7 +341,7 @@ interface WithLoadBalancingRule { /** * The stage of a load balancer definition allowing to create a load balancing rule or create the load balancer. */ - interface WithLoadBalancingRuleOrCreate extends WithLoadBalancingRule, WithCreate { + interface WithLoadBalancingRuleOrCreate extends WithLoadBalancingRule, WithCreateAndNatChoice { } /** @@ -348,9 +351,32 @@ interface WithLoadBalancingRuleOrCreate extends WithLoadBalancingRule, WithCreat */ interface WithCreate extends Creatable, - Resource.DefinitionWithTags, - DefinitionStages.WithInboundNatRule, - DefinitionStages.WithInboundNatPool { + Resource.DefinitionWithTags { + } + + /** + * The stage of a load balancer definition allowing to create the load balancer or start configuring optional inbound NAT rules or pools. + */ + interface WithCreateAndNatChoice extends + WithCreate, + WithInboundNatRule, + WithInboundNatPool { + } + + /** + * The stage of a load balancer definition allowing to create the load balancer or add an inbound NAT pool. + */ + interface WithCreateAndInboundNatPool extends + WithCreate, + WithInboundNatPool { + } + + /** + * The stage of a load balancer definition allowing to create the load balancer or add an inbound NAT rule. + */ + interface WithCreateAndInboundNatRule extends + WithCreate, + WithInboundNatRule { } /** @@ -364,7 +390,7 @@ interface WithInboundNatRule { * @param name the name of the inbound NAT rule * @return the first stage of the new inbound NAT rule definition */ - InboundNatRule.DefinitionStages.Blank defineInboundNatRule(String name); + InboundNatRule.DefinitionStages.Blank defineInboundNatRule(String name); } /** @@ -378,7 +404,7 @@ interface WithInboundNatPool { * @param name the name of the inbound NAT pool * @return the first stage of the new inbound NAT pool definition */ - InboundNatPool.DefinitionStages.Blank defineInboundNatPool(String name); + InboundNatPool.DefinitionStages.Blank defineInboundNatPool(String name); } } From 54f9a24f076b5b831ca721d9901657a9bc461fc6 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Sep 2016 11:09:25 -0700 Subject: [PATCH 02/21] impl correction --- .../management/network/implementation/InboundNatPoolImpl.java | 2 +- .../management/network/implementation/InboundNatRuleImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/InboundNatPoolImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/InboundNatPoolImpl.java index 585e0b03ceb3b..7a4a66dca6c7d 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/InboundNatPoolImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/InboundNatPoolImpl.java @@ -20,7 +20,7 @@ class InboundNatPoolImpl extends ChildResourceImpl implements InboundNatPool, - InboundNatPool.Definition, + InboundNatPool.Definition, InboundNatPool.UpdateDefinition, InboundNatPool.Update { diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/InboundNatRuleImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/InboundNatRuleImpl.java index 6050bc9f1138f..862d3915e4d2e 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/InboundNatRuleImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/InboundNatRuleImpl.java @@ -20,7 +20,7 @@ class InboundNatRuleImpl extends ChildResourceImpl implements InboundNatRule, - InboundNatRule.Definition, + InboundNatRule.Definition, InboundNatRule.UpdateDefinition, InboundNatRule.Update { From 053b4e8f9a87a86fb2631beb3062ce8110263153 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Sep 2016 11:50:43 -0700 Subject: [PATCH 03/21] adding .virtualMachineId() to NIC --- .../azure/management/network/NetworkInterface.java | 5 +++++ .../network/implementation/NetworkInterfaceImpl.java | 9 +++++++++ .../java/com/microsoft/azure/TestNetworkInterface.java | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterface.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterface.java index 88f30cfec376c..d046ed18b41eb 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterface.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterface.java @@ -138,6 +138,11 @@ public interface NetworkInterface extends */ NetworkSecurityGroup networkSecurityGroup() throws CloudException, IOException; + /** + * @return the resource ID of the associated virtual machine, or null if none. + */ + String virtualMachineId(); + // Setters (fluent) /** diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java index fe4cdb84f90f2..899421bd322f0 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java @@ -240,6 +240,15 @@ public NetworkInterfaceImpl withInternalDnsNameLabel(String dnsNameLabel) { // Getters + @Override + public String virtualMachineId() { + if(this.inner().virtualMachine() != null) { + return this.inner().virtualMachine().id(); + } else { + return null; + } + } + @Override public boolean isIpForwardingEnabled() { return Utils.toPrimitiveBoolean(this.inner().enableIPForwarding()); diff --git a/azure/src/test/java/com/microsoft/azure/TestNetworkInterface.java b/azure/src/test/java/com/microsoft/azure/TestNetworkInterface.java index a5e022f643246..f289d149cb716 100644 --- a/azure/src/test/java/com/microsoft/azure/TestNetworkInterface.java +++ b/azure/src/test/java/com/microsoft/azure/TestNetworkInterface.java @@ -53,6 +53,7 @@ public void print(NetworkInterface resource) { .append("\n\tInternal DNS name label: ").append(resource.internalDnsNameLabel()) .append("\n\tInternal FQDN: ").append(resource.internalFqdn()) .append("\n\tInternal domain name suffix: ").append(resource.internalDomainNameSuffix()) + .append("\n\tVirtual machine ID: ").append(resource.virtualMachineId()) .append("\n\tApplied DNS servers: ").append(resource.appliedDnsServers().toString()) .append("\n\tDNS server IPs: "); @@ -61,7 +62,7 @@ public void print(NetworkInterface resource) { info.append("\n\t\t").append(dnsServerIp); } - info.append("\n\t IP forwarding enabled: ").append(resource.isIpForwardingEnabled()) + info.append("\n\tIP 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()) From 737f14a7e62dd26a202dd3985d9f75a1edd0179f Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Sep 2016 11:54:47 -0700 Subject: [PATCH 04/21] renaming NIC#networkSecurityGroup() to getNetworkSecurityGroup() because it is a call to Azure, not a direct property of the NIC --- .../microsoft/azure/management/network/NetworkInterface.java | 2 +- .../management/network/implementation/NetworkInterfaceImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterface.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterface.java index d046ed18b41eb..a5a50497e8d1c 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterface.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterface.java @@ -136,7 +136,7 @@ public interface NetworkInterface extends * @throws CloudException exceptions thrown from the cloud. * @throws IOException exceptions thrown from serialization/deserialization. */ - NetworkSecurityGroup networkSecurityGroup() throws CloudException, IOException; + NetworkSecurityGroup getNetworkSecurityGroup() throws CloudException, IOException; /** * @return the resource ID of the associated virtual machine, or null if none. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java index 899421bd322f0..3b99552963f2b 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java @@ -329,7 +329,7 @@ public String networkSecurityGroupId() { } @Override - public NetworkSecurityGroup networkSecurityGroup() throws CloudException, IOException { + public NetworkSecurityGroup getNetworkSecurityGroup() throws CloudException, IOException { if (this.networkSecurityGroup == null && this.networkSecurityGroupId() != null) { String id = this.networkSecurityGroupId(); this.networkSecurityGroup = super.myManager From dd62054e48d6d1ecd456d035a7388905b31be2e4 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Sep 2016 13:08:19 -0700 Subject: [PATCH 05/21] exposing ability to list associated VM IDs from an LB backend --- .../azure/management/network/Backend.java | 6 ++++ .../network/implementation/BackendImpl.java | 29 +++++++++++++++++++ .../com/microsoft/azure/TestLoadBalancer.java | 13 +++++++-- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Backend.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Backend.java index e78c82fb2c74a..f97d203631fc6 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Backend.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Backend.java @@ -6,6 +6,7 @@ package com.microsoft.azure.management.network; import java.util.Map; +import java.util.Set; import com.microsoft.azure.management.network.implementation.BackendAddressPoolInner; import com.microsoft.azure.management.network.model.HasLoadBalancingRules; @@ -28,6 +29,11 @@ public interface Backend extends */ Map backendNicIpConfigurationNames(); + /** + * @return a list of the resource IDs of the virtual machines associated with this backend + */ + Set getVirtualMachineIds(); + /** * Grouping of backend definition stages. */ diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/BackendImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/BackendImpl.java index bc4c5148e763f..701c781d0ddbe 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/BackendImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/BackendImpl.java @@ -5,14 +5,19 @@ */ package com.microsoft.azure.management.network.implementation; +import java.io.IOException; import java.util.Collections; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import java.util.TreeMap; +import com.microsoft.azure.CloudException; import com.microsoft.azure.SubResource; import com.microsoft.azure.management.network.Backend; import com.microsoft.azure.management.network.LoadBalancer; import com.microsoft.azure.management.network.LoadBalancingRule; +import com.microsoft.azure.management.network.NetworkInterface; import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils; import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.ChildResourceImpl; @@ -70,6 +75,30 @@ public String name() { return this.inner().name(); } + @Override + public Set getVirtualMachineIds() { + Set vmIds = new HashSet<>(); + Map nicConfigs = this.backendNicIpConfigurationNames(); + if (nicConfigs != null) { + for (String nicId : nicConfigs.keySet()) { + try { + NetworkInterface nic = this.parent().manager().networkInterfaces().getById(nicId); + if (nic == null || nic.virtualMachineId() == null) { + continue; + } else { + vmIds.add(nic.virtualMachineId()); + } + } catch (CloudException | IllegalArgumentException | IOException e) { + continue; + } + } + } + + return vmIds; + } + + // Verbs + @Override public LoadBalancerImpl attach() { this.parent().withBackend(this); diff --git a/azure/src/test/java/com/microsoft/azure/TestLoadBalancer.java b/azure/src/test/java/com/microsoft/azure/TestLoadBalancer.java index 6c8f9c9c1aec6..f0b001105bd56 100644 --- a/azure/src/test/java/com/microsoft/azure/TestLoadBalancer.java +++ b/azure/src/test/java/com/microsoft/azure/TestLoadBalancer.java @@ -8,6 +8,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; +import java.util.Set; import org.junit.Assert; @@ -48,7 +49,7 @@ public class TestLoadBalancer { static final String[] PIP_NAMES = {"pipa" + TEST_ID, "pipb" + TEST_ID}; static final String[] VM_IDS = { "/subscriptions/9657ab5d-4a4a-4fd2-ae7a-4cd9fbd030ef/resourceGroups/marcinslbtest/providers/Microsoft.Compute/virtualMachines/marcinslbtest1", - "/subscriptions/9657ab5d-4a4a-4fd2-ae7a-4cd9fbd030ef/resourceGroups/marcinslbtest/providers/Microsoft.Compute/virtualMachines/marcinslbtest2" + "/subscriptions/9657ab5d-4a4a-4fd2-ae7a-4cd9fbd030ef/resourceGroups/marcinslbtest/providers/Microsoft.Compute/virtualMachines/marcinslbtest3" }; /** @@ -460,7 +461,7 @@ public LoadBalancer createResource(LoadBalancers resources) throws Exception { // Frontend (default) .withExistingSubnet(network, "subnet1") // Backend (default) - //TODO .withExistingVirtualMachines(existingVMs) + .withExistingVirtualMachines(existingVMs) .defineBackend("foo") .attach() // Probe (default) @@ -780,6 +781,14 @@ static void printLB(LoadBalancer resource) { .append(" - IP Config: ").append(entry.getValue()); } + // Show assigned virtual machines + Set vmIds = backend.getVirtualMachineIds(); + info.append("\n\t\t\tReferenced virtual machine ids: ") + .append(vmIds.size()); + for (String vmId : vmIds) { + info.append("\n\t\t\t\tVM ID: ").append(vmId); + } + // Show assigned load balancing rules info.append("\n\t\t\tReferenced load balancing rules: ") .append(backend.loadBalancingRules().keySet().toArray(new String[0])); From d5525c549bd90721099c1179653ea1e8a275b1d2 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Sep 2016 13:36:02 -0700 Subject: [PATCH 06/21] checkstyle... --- .../management/network/implementation/NetworkInterfaceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java index 3b99552963f2b..30024fcbcc6ef 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java @@ -242,7 +242,7 @@ public NetworkInterfaceImpl withInternalDnsNameLabel(String dnsNameLabel) { @Override public String virtualMachineId() { - if(this.inner().virtualMachine() != null) { + if (this.inner().virtualMachine() != null) { return this.inner().virtualMachine().id(); } else { return null; From 4f7829ce34b3cb2701bc4ceb132c7229d69ea12a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 13 Sep 2016 15:23:41 -0700 Subject: [PATCH 07/21] enabling public IPs to be updated during LB update --- .../management/network/LoadBalancer.java | 45 +++++++++++++++++-- .../com/microsoft/azure/TestLoadBalancer.java | 22 ++++----- 2 files changed, 51 insertions(+), 16 deletions(-) diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancer.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancer.java index fa10dfa88c70a..248b4a05e0ec7 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancer.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancer.java @@ -239,8 +239,7 @@ interface WithVirtualMachine { } /** - * The stage of a load balancer definition allowing to add a public ip address as one of the load - * balancer's public frontends. + * The stage of a load balancer definition allowing to add a public IP address as the default public frontend. * @param the next stage of the definition */ interface WithPublicIpAddress { @@ -552,7 +551,7 @@ interface WithLoadBalancingRule { /** * The stage of a load balancer update allowing to define, remove or edit Internet-facing frontends. */ - interface WithInternetFrontend { + interface WithInternetFrontend extends WithPublicIpAddress { /** * Begins the update of a load balancer frontend. *

@@ -577,6 +576,46 @@ interface WithInternetFrontend { PublicFrontend.Update updateInternetFrontend(String name); } + /** + * The stage of a load balancer update allowing to add a public IP address as the default public frontend. + */ + interface WithPublicIpAddress { + /** + * Assigns the provided public IP address to the default public frontend to the load balancer. + *

+ * This will create a new default frontend for the load balancer under the name "default", if one does not already exist. + * @param publicIpAddress an existing public IP address + * @return the next stage of the update + */ + Update withExistingPublicIpAddress(PublicIpAddress publicIpAddress); + + /** + * Creates a new public IP address as the default public frontend of the load balancer, + * using an automatically generated name and leaf DNS label + * derived from the load balancer's name, in the same resource group and region. + *

+ * This will create a new default frontend for the load balancer under the name "default", if one does not already exist. + * @return the next stage of the update + */ + Update withNewPublicIpAddress(); + + /** + * Adds a new public IP address as the default public frontend of the load balancer, + * using the specified DNS leaf label, an automatically generated frontend name derived from the DNS label, + * in the same resource group and region as the load balancer. + * @param dnsLeafLabel a DNS leaf label + * @return the next stage of the update + */ + Update withNewPublicIpAddress(String dnsLeafLabel); + + /** + * Adds a new public IP address to the default front end of the load balancer. + * @param creatablePublicIpAddress the creatable stage of a public IP address definition + * @return the next stage of the update + */ + Update withNewPublicIpAddress(Creatable creatablePublicIpAddress); + } + /** * The stage of a load balancer update allowing to define one or more private frontends. */ diff --git a/azure/src/test/java/com/microsoft/azure/TestLoadBalancer.java b/azure/src/test/java/com/microsoft/azure/TestLoadBalancer.java index f0b001105bd56..0ebb8e1cc75e3 100644 --- a/azure/src/test/java/com/microsoft/azure/TestLoadBalancer.java +++ b/azure/src/test/java/com/microsoft/azure/TestLoadBalancer.java @@ -169,7 +169,6 @@ public LoadBalancer createResource(LoadBalancers resources) throws Exception { @Override public LoadBalancer updateResource(LoadBalancer resource) throws Exception { resource = resource.update() - //TODO .withExistingPublicIpAddress(pip) .withoutFrontend("default") .withoutBackend("default") .withoutLoadBalancingRule("rule1") @@ -216,13 +215,11 @@ public LoadBalancer createResource(LoadBalancers resources) throws Exception { .withExistingResourceGroup(TestLoadBalancer.GROUP_NAME) // Frontends - .withExistingPublicIpAddress(existingPips.get(0)) .definePublicFrontend("frontend1") - .withExistingPublicIpAddress(existingPips.get(1)) + .withExistingPublicIpAddress(existingPips.get(0)) .attach() // Backends - .withExistingVirtualMachines(existingVMs) .defineBackend("backend1") .attach() @@ -260,13 +257,11 @@ public LoadBalancer createResource(LoadBalancers resources) throws Exception { // Verify frontends Assert.assertTrue(lb.frontends().containsKey("frontend1")); - Assert.assertTrue(lb.frontends().containsKey("default")); - Assert.assertTrue(lb.frontends().size() == 2); + Assert.assertTrue(lb.frontends().size() == 1); // Verify backends - Assert.assertTrue(lb.backends().containsKey("default")); Assert.assertTrue(lb.backends().containsKey("backend1")); - Assert.assertTrue(lb.backends().size() == 2); + Assert.assertTrue(lb.backends().size() == 1); // Verify probes Assert.assertTrue(lb.httpProbes().containsKey("httpProbe1")); @@ -296,8 +291,11 @@ public LoadBalancer createResource(LoadBalancers resources) throws Exception { @Override public LoadBalancer updateResource(LoadBalancer resource) throws Exception { + List existingPips = ensurePIPs(pips); resource = resource.update() - //TODO .withExistingPublicIpAddress(pip) + .updateInternetFrontend("frontend1") + .withExistingPublicIpAddress(existingPips.get(1)) + .parent() .withoutFrontend("default") .withoutBackend("default") .withoutLoadBalancingRule("rule1") @@ -370,9 +368,7 @@ public LoadBalancer updateResource(LoadBalancer resource) throws Exception { List existingPips = ensurePIPs(pips); PublicIpAddress pip = existingPips.get(1); resource = resource.update() - .updateInternetFrontend("default") - .withExistingPublicIpAddress(pip) - .parent() + .withExistingPublicIpAddress(pip) .updateTcpProbe("default") .withPort(22) .parent() @@ -791,7 +787,7 @@ static void printLB(LoadBalancer resource) { // Show assigned load balancing rules info.append("\n\t\t\tReferenced load balancing rules: ") - .append(backend.loadBalancingRules().keySet().toArray(new String[0])); + .append(new ArrayList(backend.loadBalancingRules().keySet())); } System.out.println(info.toString()); From 9b801ef6bc585c252ed5072f00f17911b9a6b6e0 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 13 Sep 2016 15:54:58 -0700 Subject: [PATCH 08/21] support for PublicIpAddress#version() --- .../azure/management/network/PublicIpAddress.java | 9 ++++++--- .../network/implementation/PublicIpAddressImpl.java | 6 ++++++ .../java/com/microsoft/azure/TestPublicIpAddress.java | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java index cbb5b12a46412..89c11612bd3d4 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java @@ -23,9 +23,12 @@ public interface PublicIpAddress extends Wrapper, Updatable { - /*********************************************************** - * Getters - ***********************************************************/ + // Getters + + /** + * @return the IP version of the public IP address + */ + IPVersion version(); /** * @return the assigned IP address diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/PublicIpAddressImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/PublicIpAddressImpl.java index 12925b6316636..8e9afd77e6c52 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/PublicIpAddressImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/PublicIpAddressImpl.java @@ -6,6 +6,7 @@ package com.microsoft.azure.management.network.implementation; import com.microsoft.azure.management.network.IPAllocationMethod; +import com.microsoft.azure.management.network.IPVersion; import com.microsoft.azure.management.network.PublicIPAddressDnsSettings; import com.microsoft.azure.management.network.PublicIpAddress; import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.GroupableResourceImpl; @@ -104,6 +105,11 @@ public IPAllocationMethod ipAllocationMethod() { return this.inner().publicIPAllocationMethod(); } + @Override + public IPVersion version() { + return this.inner().publicIPAddressVersion(); + } + @Override public String fqdn() { return this.inner().dnsSettings().fqdn(); diff --git a/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java b/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java index d4e3f0818b6f9..d6d454cd763de 100644 --- a/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java +++ b/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java @@ -59,6 +59,7 @@ public void print(PublicIpAddress resource) { .append("\n\tReverse FQDN: ").append(resource.reverseFqdn()) .append("\n\tIdle timeout (minutes): ").append(resource.idleTimeoutInMinutes()) .append("\n\tIP allocation method: ").append(resource.ipAllocationMethod().toString()) + .append("\n\tIP version: ").append(resource.version().toString()) .toString()); } } From bbe0f0645a4b2b2eddb0a46d892ae292fd65db21 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 14 Sep 2016 09:10:52 -0700 Subject: [PATCH 09/21] PIP test tweak --- .../test/java/com/microsoft/azure/TestPublicIpAddress.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java b/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java index d6d454cd763de..cfa7ec675cd05 100644 --- a/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java +++ b/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java @@ -47,7 +47,11 @@ public PublicIpAddress updateResource(PublicIpAddress resource) throws Exception } @Override - public void print(PublicIpAddress resource) { + public void print(PublicIpAddress pip) { + TestPublicIpAddress.printPIP(pip); + } + + public static void printPIP(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()) From 8ec142efb3ed2f1a55f73c210bf2bc167ae4e26e Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 15 Sep 2016 13:37:28 -0700 Subject: [PATCH 10/21] fix for https://github.com/Azure/azure-sdk-for-java/issues/1079 --- .../network/implementation/PublicIpAddressImpl.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/PublicIpAddressImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/PublicIpAddressImpl.java index db0b9ca49916d..ae81be780f711 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/PublicIpAddressImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/PublicIpAddressImpl.java @@ -114,12 +114,20 @@ public IPVersion version() { @Override public String fqdn() { - return this.inner().dnsSettings().fqdn(); + if (this.inner().dnsSettings() != null) { + return this.inner().dnsSettings().fqdn(); + } else { + return null; + } } @Override public String reverseFqdn() { - return this.inner().dnsSettings().reverseFqdn(); + if (this.inner().dnsSettings() != null) { + return this.inner().dnsSettings().reverseFqdn(); + } else { + return null; + } } @Override From 9144fa407b326759cac0029c9168367f8bc73c78 Mon Sep 17 00:00:00 2001 From: Jianghao Lu Date: Thu, 15 Sep 2016 16:26:32 -0700 Subject: [PATCH 11/21] A bit of clean up in graph --- .../implementation/GraphRbacManager.java | 36 +++++++++++++++++++ .../implementation/ServicePrincipalImpl.java | 7 ++-- .../graphrbac/implementation/UserImpl.java | 7 ++-- .../GraphRbacManagementTestBase.java | 12 ++----- .../management/graphrbac/GroupsTests.java | 35 ------------------ .../management/graphrbac/UsersTests.java | 7 ++-- 6 files changed, 51 insertions(+), 53 deletions(-) delete mode 100644 azure-mgmt-graph-rbac/src/main/test/java/com/microsoft/azure/management/graphrbac/GroupsTests.java diff --git a/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/GraphRbacManager.java b/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/GraphRbacManager.java index 570cf9456c414..a4442db6c613a 100644 --- a/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/GraphRbacManager.java +++ b/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/GraphRbacManager.java @@ -8,6 +8,7 @@ import com.microsoft.azure.RequestIdHeaderInterceptor; import com.microsoft.azure.RestClient; +import com.microsoft.azure.credentials.AzureTokenCredentials; import com.microsoft.azure.management.graphrbac.ServicePrincipals; import com.microsoft.azure.management.graphrbac.Users; import com.microsoft.azure.management.resources.fluentcore.arm.AzureConfigurable; @@ -18,6 +19,7 @@ * Entry point to Azure resource management. */ public final class GraphRbacManager { + private String tenantId; // The sdk clients private final GraphRbacManagementClientImpl graphRbacManagementClient; // The collections @@ -39,6 +41,20 @@ public static GraphRbacManager authenticate(ServiceClientCredentials credentials .build(), tenantId); } + /** + * Creates an instance of GraphRbacManager that exposes resource management API entry points. + * + * @param credentials the credentials to use + * @return the GraphRbacManager instance + */ + public static GraphRbacManager authenticate(AzureTokenCredentials credentials) { + return new GraphRbacManager(new RestClient.Builder() + .withBaseUrl("https://graph.windows.net") + .withInterceptor(new RequestIdHeaderInterceptor()) + .withCredentials(credentials) + .build(), credentials.getDomain()); + } + /** * Creates an instance of GraphRbacManager that exposes resource management API entry points. * @@ -71,6 +87,14 @@ public interface Configurable extends AzureConfigurable { * @return the interface exposing resource management API entry points that work across subscriptions */ GraphRbacManager authenticate(ServiceClientCredentials credentials, String tenantId); + + /** + * Creates an instance of GraphRbacManager that exposes resource management API entry points. + * + * @param credentials the credentials to use + * @return the interface exposing resource management API entry points that work across subscriptions + */ + GraphRbacManager authenticate(AzureTokenCredentials credentials); } /** @@ -86,10 +110,22 @@ protected ConfigurableImpl() { public GraphRbacManager authenticate(ServiceClientCredentials credentials, String tenantId) { return GraphRbacManager.authenticate(buildRestClient(credentials), tenantId); } + + public GraphRbacManager authenticate(AzureTokenCredentials credentials) { + return GraphRbacManager.authenticate(buildRestClient(credentials), credentials.getDomain()); + } } private GraphRbacManager(RestClient restClient, String tenantId) { this.graphRbacManagementClient = new GraphRbacManagementClientImpl(restClient).withTenantID(tenantId); + this.tenantId = tenantId; + } + + /** + * @return the tenant ID the graph client is associated with + */ + public String tenantId() { + return tenantId; } /** diff --git a/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/ServicePrincipalImpl.java b/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/ServicePrincipalImpl.java index 0dbe0d5258fd6..ed4c40a229cf6 100644 --- a/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/ServicePrincipalImpl.java +++ b/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/ServicePrincipalImpl.java @@ -69,16 +69,17 @@ public ServicePrincipalImpl withAccountEnabled(boolean enabled) { @Override public ServicePrincipal refresh() { - return null; + setInner(client.list(String.format("servicePrincipalNames/any(c:c eq '%s')", name())).get(0)); + return this; } @Override public Observable createResourceAsync() { - return null; + throw new UnsupportedOperationException("Will be implemented in a next release"); } @Override public Observable applyAsync() { - return null; + throw new UnsupportedOperationException("Will be implemented in a next release"); } } diff --git a/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/UserImpl.java b/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/UserImpl.java index 9779e5c7fd706..42f03d039a2e9 100644 --- a/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/UserImpl.java +++ b/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/UserImpl.java @@ -102,16 +102,17 @@ public UserImpl withPassword(String password, boolean forceChangePasswordNextLog @Override public User refresh() { - return null; + setInner(client.get(name())); + return this; } @Override public Observable createResourceAsync() { - return null; + throw new UnsupportedOperationException("Will be implemented in a next release"); } @Override public Observable applyAsync() { - return null; + throw new UnsupportedOperationException("Will be implemented in a next release"); } } diff --git a/azure-mgmt-graph-rbac/src/main/test/java/com/microsoft/azure/management/graphrbac/GraphRbacManagementTestBase.java b/azure-mgmt-graph-rbac/src/main/test/java/com/microsoft/azure/management/graphrbac/GraphRbacManagementTestBase.java index dcf676ac78300..f418fbfd612ff 100644 --- a/azure-mgmt-graph-rbac/src/main/test/java/com/microsoft/azure/management/graphrbac/GraphRbacManagementTestBase.java +++ b/azure-mgmt-graph-rbac/src/main/test/java/com/microsoft/azure/management/graphrbac/GraphRbacManagementTestBase.java @@ -18,25 +18,17 @@ public abstract class GraphRbacManagementTestBase { protected static GraphRbacManager graphRbacManager; protected static void createClients() { -// ApplicationTokenCredentials credentials = new ApplicationTokenCredentials( -// System.getenv("client-id"), -// System.getenv("domain"), -// System.getenv("secret"), -// "https://graph.windows.net", -// null); UserTokenCredentials credentials = new UserTokenCredentials( - "1950a258-227b-4e31-a9cf-717495945fc2", + System.getenv("client-id"), System.getenv("domain"), System.getenv("username"), System.getenv("password"), - "https://graph.windows.net", - "https://graph.windows.net", AzureEnvironment.AZURE ); graphRbacManager = GraphRbacManager .configure() .withLogLevel(HttpLoggingInterceptor.Level.BODY) - .authenticate(credentials, "myorganization"); + .authenticate(credentials); } } diff --git a/azure-mgmt-graph-rbac/src/main/test/java/com/microsoft/azure/management/graphrbac/GroupsTests.java b/azure-mgmt-graph-rbac/src/main/test/java/com/microsoft/azure/management/graphrbac/GroupsTests.java deleted file mode 100644 index 37d0f0df6792b..0000000000000 --- a/azure-mgmt-graph-rbac/src/main/test/java/com/microsoft/azure/management/graphrbac/GroupsTests.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - */ - -package com.microsoft.azure.management.graphrbac; - -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.util.List; - -public class GroupsTests extends GraphRbacManagementTestBase { - private static final String RG_NAME = "javacsmrg350"; - private static final String APP_NAME = "app-javacsm350"; - - @BeforeClass - public static void setup() throws Exception { - createClients(); - } - - @AfterClass - public static void cleanup() throws Exception { - } - - @Test - public void getServicePrincipal() throws Exception { - List servicePrincipals = graphRbacManager.servicePrincipals().list(); - Assert.assertNotNull(servicePrincipals); - } - -} diff --git a/azure-mgmt-graph-rbac/src/main/test/java/com/microsoft/azure/management/graphrbac/UsersTests.java b/azure-mgmt-graph-rbac/src/main/test/java/com/microsoft/azure/management/graphrbac/UsersTests.java index 19eb9a0eb3f09..ddc4efb01a079 100644 --- a/azure-mgmt-graph-rbac/src/main/test/java/com/microsoft/azure/management/graphrbac/UsersTests.java +++ b/azure-mgmt-graph-rbac/src/main/test/java/com/microsoft/azure/management/graphrbac/UsersTests.java @@ -31,11 +31,14 @@ public void canCRUDUser() throws Exception { //LIST List userList = graphRbacManager.users().list(); Assert.assertNotNull(userList); - User user = graphRbacManager.users().define("jeffrolfnlu@hotmail.com") + User user = graphRbacManager.users().define("azuresdk@outlook.com") .withDisplayName("Test User 309") .withPassword("Pa$$w0rd") - .withMailNickname("") + .withMailNickname(null) .create(); + Assert.assertNotNull(user); + Assert.assertEquals("Test User 309", user.displayName()); + Assert.assertEquals("azuresdk@outlook.com", user.mail()); } } From 05bedf4c0154ac32e8a101d358c1529ea8f022b5 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 15 Sep 2016 16:45:41 -0700 Subject: [PATCH 12/21] ability to directly get the load balancer frontend associated with a public ip address, if any --- .../management/network/PublicIpAddress.java | 10 +++++++ .../implementation/PublicIpAddressImpl.java | 29 ++++++++++++++++++- .../microsoft/azure/TestPublicIpAddress.java | 17 ++++++++--- 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java index c8132dcc157ee..b955f6057996f 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java @@ -62,6 +62,16 @@ public interface PublicIpAddress extends */ int idleTimeoutInMinutes(); + /** + * @return the load balancer frontend that this public IP address is assigned to + */ + Frontend getAssignedLoadBalancerFrontend(); + + /** + * @return true if this public IP address is assigned to a load balancer frontend + */ + boolean hasAssignedLoadBalancerFrontend(); + /************************************************************** * Fluent interfaces for builder pattern **************************************************************/ diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/PublicIpAddressImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/PublicIpAddressImpl.java index 1cb797ffd96a7..67346a8e21708 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/PublicIpAddressImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/PublicIpAddressImpl.java @@ -8,8 +8,11 @@ import com.microsoft.azure.management.apigeneration.LangDefinition; import com.microsoft.azure.management.network.IPAllocationMethod; import com.microsoft.azure.management.network.IPVersion; +import com.microsoft.azure.management.network.LoadBalancer; +import com.microsoft.azure.management.network.PublicFrontend; import com.microsoft.azure.management.network.PublicIPAddressDnsSettings; import com.microsoft.azure.management.network.PublicIpAddress; +import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils; import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.GroupableResourceImpl; import rx.Observable; @@ -160,4 +163,28 @@ public Observable createResourceAsync() { return this.client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) .map(innerToFluentMap(this)); } -} \ No newline at end of file + + @Override + public PublicFrontend getAssignedLoadBalancerFrontend() { + if (this.hasAssignedLoadBalancerFrontend()) { + final String refId = this.inner().ipConfiguration().id(); + final String loadBalancerId = ResourceUtils.parentResourcePathFromResourceId(refId); + final LoadBalancer lb = this.myManager.loadBalancers().getById(loadBalancerId); + final String frontendName = ResourceUtils.nameFromResourceId(refId); + return (PublicFrontend) lb.frontends().get(frontendName); + } else { + return null; + } + } + + @Override + public boolean hasAssignedLoadBalancerFrontend() { + if (this.inner().ipConfiguration() == null) { + return false; + } else { + final String refId = this.inner().ipConfiguration().id(); + final String resourceType = ResourceUtils.resourceTypeFromResourceId(refId); + return resourceType.equalsIgnoreCase("frontendIPConfigurations"); + } + } +} diff --git a/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java b/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java index cfa7ec675cd05..10343ee2c03b9 100644 --- a/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java +++ b/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java @@ -52,8 +52,8 @@ public void print(PublicIpAddress pip) { } public static void printPIP(PublicIpAddress resource) { - System.out.println(new StringBuilder().append("Public IP Address: ").append(resource.id()) - .append("Name: ").append(resource.name()) + StringBuilder info = new StringBuilder().append("Public IP Address: ").append(resource.id()) + .append("\n\tName: ").append(resource.name()) .append("\n\tResource group: ").append(resource.resourceGroupName()) .append("\n\tRegion: ").append(resource.region()) .append("\n\tTags: ").append(resource.tags()) @@ -63,7 +63,16 @@ public static void printPIP(PublicIpAddress resource) { .append("\n\tReverse FQDN: ").append(resource.reverseFqdn()) .append("\n\tIdle timeout (minutes): ").append(resource.idleTimeoutInMinutes()) .append("\n\tIP allocation method: ").append(resource.ipAllocationMethod().toString()) - .append("\n\tIP version: ").append(resource.version().toString()) - .toString()); + .append("\n\tIP version: ").append(resource.version().toString()); + + // Show the associated load balancer frontend if any + info.append("\n\tAssociated load balancer frontend name: "); + if (resource.hasAssignedLoadBalancerFrontend()) { + info.append(resource.getAssignedLoadBalancerFrontend().name()); + } else { + info.append("(None)"); + } + + System.out.println(info.toString()); } } From 52ea2b3b0916c1dd6abb369307f663d2b26c3aed Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 15 Sep 2016 17:09:12 -0700 Subject: [PATCH 13/21] making .parent() publicly available on child objects --- .../management/compute/VirtualMachineDataDisk.java | 2 +- .../compute/implementation/DataDiskImpl.java | 2 +- .../azure/management/keyvault/AccessPolicy.java | 2 +- .../keyvault/implementation/AccessPolicyImpl.java | 3 ++- .../microsoft/azure/management/network/Backend.java | 2 +- .../microsoft/azure/management/network/Frontend.java | 2 +- .../azure/management/network/InboundNatPool.java | 2 +- .../azure/management/network/InboundNatRule.java | 2 +- .../azure/management/network/LoadBalancingRule.java | 2 +- .../azure/management/network/NetworkSecurityRule.java | 2 +- .../azure/management/network/NicIpConfiguration.java | 2 +- .../com/microsoft/azure/management/network/Probe.java | 2 +- .../azure/management/network/PublicIpAddress.java | 4 ++-- .../com/microsoft/azure/management/network/Subnet.java | 2 +- .../management/network/implementation/BackendImpl.java | 2 +- .../network/implementation/FrontendImpl.java | 2 +- .../network/implementation/InboundNatPoolImpl.java | 2 +- .../network/implementation/InboundNatRuleImpl.java | 2 +- .../network/implementation/LoadBalancingRuleImpl.java | 2 +- .../implementation/NetworkSecurityRuleImpl.java | 2 +- .../network/implementation/NicIpConfigurationImpl.java | 2 +- .../management/network/implementation/ProbeImpl.java | 2 +- .../management/network/implementation/SubnetImpl.java | 2 +- .../resources/fluentcore/arm/models/ChildResource.java | 10 ++++++++-- .../arm/models/implementation/ChildResourceImpl.java | 5 +++-- .../java/com/microsoft/azure/TestLoadBalancer.java | 1 + .../java/com/microsoft/azure/TestPublicIpAddress.java | 9 +++++++-- 27 files changed, 44 insertions(+), 30 deletions(-) diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineDataDisk.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineDataDisk.java index 8c463c5aceb16..23a1e8f499d46 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineDataDisk.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineDataDisk.java @@ -12,7 +12,7 @@ @LangDefinition(ContainerName = "~/") public interface VirtualMachineDataDisk extends Wrapper, - ChildResource { + ChildResource { // getters diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/DataDiskImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/DataDiskImpl.java index 9827edff9f261..15e9c9b3ef5ba 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/DataDiskImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/DataDiskImpl.java @@ -19,7 +19,7 @@ */ @LangDefinition class DataDiskImpl - extends ChildResourceImpl + extends ChildResourceImpl implements VirtualMachineDataDisk, VirtualMachineDataDisk.Definition, diff --git a/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/AccessPolicy.java b/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/AccessPolicy.java index 7e09d5331f9f0..17f2f9eacf81e 100644 --- a/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/AccessPolicy.java +++ b/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/AccessPolicy.java @@ -21,7 +21,7 @@ * An immutable client-side representation of a key vault access policy. */ public interface AccessPolicy extends - ChildResource, + ChildResource, Wrapper { /** * @return The Azure Active Directory tenant ID that should be used for diff --git a/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/implementation/AccessPolicyImpl.java b/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/implementation/AccessPolicyImpl.java index 62a6397fe7f9b..8d65a20890178 100644 --- a/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/implementation/AccessPolicyImpl.java +++ b/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/implementation/AccessPolicyImpl.java @@ -28,7 +28,8 @@ class AccessPolicyImpl extends ChildResourceImpl< AccessPolicyEntry, - VaultImpl> + VaultImpl, + Vault> implements AccessPolicy, AccessPolicy.Definition, diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Backend.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Backend.java index f97d203631fc6..8bd6a96260624 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Backend.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Backend.java @@ -20,7 +20,7 @@ */ public interface Backend extends Wrapper, - ChildResource, + ChildResource, HasLoadBalancingRules { /** diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Frontend.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Frontend.java index b93364419c542..e0d80227c08d8 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Frontend.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Frontend.java @@ -17,7 +17,7 @@ */ public interface Frontend extends Wrapper, - ChildResource, + ChildResource, HasLoadBalancingRules { /** diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/InboundNatPool.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/InboundNatPool.java index e13ccb20c6aa7..6da91cc07785a 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/InboundNatPool.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/InboundNatPool.java @@ -22,7 +22,7 @@ public interface InboundNatPool extends HasBackendPort, HasProtocol, Wrapper, - ChildResource { + ChildResource { /** * @return the starting frontend port number diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/InboundNatRule.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/InboundNatRule.java index cc5c3ad636e13..a09317219832a 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/InboundNatRule.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/InboundNatRule.java @@ -24,7 +24,7 @@ public interface InboundNatRule extends HasProtocol, HasFloatingIp, Wrapper, - ChildResource { + ChildResource { /** * @return the name of the IP configuration within the network interface associated with this NAT rule diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancingRule.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancingRule.java index 2fc8acbe2d3ca..26d58a62daaf1 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancingRule.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancingRule.java @@ -20,7 +20,7 @@ */ public interface LoadBalancingRule extends Wrapper, - ChildResource, + ChildResource, HasBackendPort, HasFrontend, HasFloatingIp, diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityRule.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityRule.java index 086a7926d3ce2..778e718003051 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityRule.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityRule.java @@ -19,7 +19,7 @@ @LangDefinition() public interface NetworkSecurityRule extends Wrapper, - ChildResource { + ChildResource { /** * @return the direction of the network traffic that the network security rule applies to. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NicIpConfiguration.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NicIpConfiguration.java index 3f9fd39d8a740..6b3d44b9e9876 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NicIpConfiguration.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NicIpConfiguration.java @@ -15,7 +15,7 @@ @LangDefinition() public interface NicIpConfiguration extends Wrapper, - ChildResource, + ChildResource, HasPrivateIpAddress { // Getters diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Probe.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Probe.java index 5415524587a4a..dd926afb48f24 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Probe.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Probe.java @@ -16,7 +16,7 @@ */ public interface Probe extends Wrapper, - ChildResource, + ChildResource, HasLoadBalancingRules, HasProtocol { diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java index b955f6057996f..4443a6ef33a4d 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java @@ -63,9 +63,9 @@ public interface PublicIpAddress extends int idleTimeoutInMinutes(); /** - * @return the load balancer frontend that this public IP address is assigned to + * @return the load balancer public frontend that this public IP address is assigned to */ - Frontend getAssignedLoadBalancerFrontend(); + PublicFrontend getAssignedLoadBalancerFrontend(); /** * @return true if this public IP address is assigned to a load balancer frontend diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Subnet.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Subnet.java index 1706f48ebac88..3d3fe90ff3632 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Subnet.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Subnet.java @@ -18,7 +18,7 @@ @LangDefinition() public interface Subnet extends Wrapper, - ChildResource { + ChildResource { /** * @return the address space prefix, in CIDR notation, assigned to this subnet diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/BackendImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/BackendImpl.java index da2ad93ba31b9..d2d133377f6e5 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/BackendImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/BackendImpl.java @@ -24,7 +24,7 @@ * Implementation for {@link Backend}. */ class BackendImpl - extends ChildResourceImpl + extends ChildResourceImpl implements Backend, Backend.Definition, diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/FrontendImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/FrontendImpl.java index 8ba2ff449610e..c034669e2a2fe 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/FrontendImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/FrontendImpl.java @@ -27,7 +27,7 @@ * Implementation for {@link PublicFrontend}. */ class FrontendImpl - extends ChildResourceImpl + extends ChildResourceImpl implements Frontend, PrivateFrontend, diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/InboundNatPoolImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/InboundNatPoolImpl.java index 7a4a66dca6c7d..79ff88ebe00d0 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/InboundNatPoolImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/InboundNatPoolImpl.java @@ -17,7 +17,7 @@ * Implementation for {@link InboundNatRule}. */ class InboundNatPoolImpl - extends ChildResourceImpl + extends ChildResourceImpl implements InboundNatPool, InboundNatPool.Definition, diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/InboundNatRuleImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/InboundNatRuleImpl.java index 862d3915e4d2e..580411c0336da 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/InboundNatRuleImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/InboundNatRuleImpl.java @@ -17,7 +17,7 @@ * Implementation for {@link InboundNatRule}. */ class InboundNatRuleImpl - extends ChildResourceImpl + extends ChildResourceImpl implements InboundNatRule, InboundNatRule.Definition, diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/LoadBalancingRuleImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/LoadBalancingRuleImpl.java index dbed9686939d8..e297d44dece12 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/LoadBalancingRuleImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/LoadBalancingRuleImpl.java @@ -20,7 +20,7 @@ * Implementation for {@link LoadBalancingRule}. */ class LoadBalancingRuleImpl - extends ChildResourceImpl + extends ChildResourceImpl implements LoadBalancingRule, LoadBalancingRule.Definition, diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkSecurityRuleImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkSecurityRuleImpl.java index 4e2ba57137066..2767cd8cacf8a 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkSecurityRuleImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkSecurityRuleImpl.java @@ -18,7 +18,7 @@ */ @LangDefinition class NetworkSecurityRuleImpl - extends ChildResourceImpl + extends ChildResourceImpl implements NetworkSecurityRule, NetworkSecurityRule.Definition, diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java index 16ffde7d23195..8f9b825122352 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java @@ -22,7 +22,7 @@ @LangDefinition() class NicIpConfigurationImpl extends - ChildResourceImpl + ChildResourceImpl implements NicIpConfiguration, NicIpConfiguration.Definition, diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/ProbeImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/ProbeImpl.java index 2542ae7bff832..c794ad3da2b19 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/ProbeImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/ProbeImpl.java @@ -22,7 +22,7 @@ * Implementation for {@link TcpProbe} and its create and update interfaces. */ class ProbeImpl - extends ChildResourceImpl + extends ChildResourceImpl implements TcpProbe, TcpProbe.Definition, diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/SubnetImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/SubnetImpl.java index 8f93d1292a419..f76ef954fa015 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/SubnetImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/SubnetImpl.java @@ -17,7 +17,7 @@ */ @LangDefinition class SubnetImpl - extends ChildResourceImpl + extends ChildResourceImpl implements Subnet, Subnet.Definition, diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/ChildResource.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/ChildResource.java index 4086d7f8e136d..36c0cba217784 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/ChildResource.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/ChildResource.java @@ -10,11 +10,17 @@ /** * Base interface used by child resources. + * @param parent interface */ @LangDefinition() -public interface ChildResource extends Indexable { +public interface ChildResource extends Indexable { /** - * @return the name of the child resource + * @return the name of this child object */ String name(); + + /** + * @return the parent of this child object + */ + ParentT parent(); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/implementation/ChildResourceImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/implementation/ChildResourceImpl.java index c0b59ebeed4f9..87b3619ba1788 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/implementation/ChildResourceImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/implementation/ChildResourceImpl.java @@ -13,10 +13,11 @@ * (Internal use only) * @param Azure inner child class type * @param parent implementation + * @param parent interface */ -public abstract class ChildResourceImpl +public abstract class ChildResourceImpl extends IndexableWrapperImpl - implements ChildResource { + implements ChildResource { private final ParentImplT parent; diff --git a/azure/src/test/java/com/microsoft/azure/TestLoadBalancer.java b/azure/src/test/java/com/microsoft/azure/TestLoadBalancer.java index 0ebb8e1cc75e3..d7b5715651f59 100644 --- a/azure/src/test/java/com/microsoft/azure/TestLoadBalancer.java +++ b/azure/src/test/java/com/microsoft/azure/TestLoadBalancer.java @@ -258,6 +258,7 @@ public LoadBalancer createResource(LoadBalancers resources) throws Exception { // Verify frontends Assert.assertTrue(lb.frontends().containsKey("frontend1")); Assert.assertTrue(lb.frontends().size() == 1); + TestPublicIpAddress.printPIP(existingPips.get(0).refresh()); // Verify backends Assert.assertTrue(lb.backends().containsKey("backend1")); diff --git a/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java b/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java index 10343ee2c03b9..9cc3802d0d9ce 100644 --- a/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java +++ b/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java @@ -7,6 +7,8 @@ import org.junit.Assert; +import com.microsoft.azure.management.network.LoadBalancer; +import com.microsoft.azure.management.network.PublicFrontend; import com.microsoft.azure.management.network.PublicIpAddress; import com.microsoft.azure.management.network.PublicIpAddresses; import com.microsoft.azure.management.resources.fluentcore.arm.Region; @@ -66,9 +68,12 @@ public static void printPIP(PublicIpAddress resource) { .append("\n\tIP version: ").append(resource.version().toString()); // Show the associated load balancer frontend if any - info.append("\n\tAssociated load balancer frontend name: "); + info.append("\n\tLoad balancer association: "); if (resource.hasAssignedLoadBalancerFrontend()) { - info.append(resource.getAssignedLoadBalancerFrontend().name()); + final PublicFrontend frontend = resource.getAssignedLoadBalancerFrontend(); + final LoadBalancer lb = frontend.parent(); + info.append("\n\t\tLoad balancer ID: ").append(lb.id()) + .append("\n\t\tFrontend name: ").append(frontend.name()); } else { info.append("(None)"); } From aed1b0b6d65a06ae3d971ce3e103585a5cf8e9e3 Mon Sep 17 00:00:00 2001 From: Jianghao Lu Date: Thu, 15 Sep 2016 17:14:10 -0700 Subject: [PATCH 14/21] Address feedback --- .../graphrbac/implementation/ServicePrincipalImpl.java | 4 ++-- .../azure/management/graphrbac/implementation/UserImpl.java | 4 ++-- .../com/microsoft/azure/management/graphrbac/UsersTests.java | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/ServicePrincipalImpl.java b/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/ServicePrincipalImpl.java index ed4c40a229cf6..6fbcacecc3839 100644 --- a/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/ServicePrincipalImpl.java +++ b/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/ServicePrincipalImpl.java @@ -75,11 +75,11 @@ public ServicePrincipal refresh() { @Override public Observable createResourceAsync() { - throw new UnsupportedOperationException("Will be implemented in a next release"); + throw new UnsupportedOperationException("not implemented yet"); } @Override public Observable applyAsync() { - throw new UnsupportedOperationException("Will be implemented in a next release"); + throw new UnsupportedOperationException("not implemented yet"); } } diff --git a/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/UserImpl.java b/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/UserImpl.java index 42f03d039a2e9..1514858b8dad5 100644 --- a/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/UserImpl.java +++ b/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/UserImpl.java @@ -108,11 +108,11 @@ public User refresh() { @Override public Observable createResourceAsync() { - throw new UnsupportedOperationException("Will be implemented in a next release"); + throw new UnsupportedOperationException("not implemented yet"); } @Override public Observable applyAsync() { - throw new UnsupportedOperationException("Will be implemented in a next release"); + throw new UnsupportedOperationException("not implemented yet"); } } diff --git a/azure-mgmt-graph-rbac/src/main/test/java/com/microsoft/azure/management/graphrbac/UsersTests.java b/azure-mgmt-graph-rbac/src/main/test/java/com/microsoft/azure/management/graphrbac/UsersTests.java index ddc4efb01a079..6dbb3691e3d8c 100644 --- a/azure-mgmt-graph-rbac/src/main/test/java/com/microsoft/azure/management/graphrbac/UsersTests.java +++ b/azure-mgmt-graph-rbac/src/main/test/java/com/microsoft/azure/management/graphrbac/UsersTests.java @@ -31,14 +31,13 @@ public void canCRUDUser() throws Exception { //LIST List userList = graphRbacManager.users().list(); Assert.assertNotNull(userList); - User user = graphRbacManager.users().define("azuresdk@outlook.com") + User user = graphRbacManager.users().define("newuser") .withDisplayName("Test User 309") .withPassword("Pa$$w0rd") .withMailNickname(null) .create(); Assert.assertNotNull(user); Assert.assertEquals("Test User 309", user.displayName()); - Assert.assertEquals("azuresdk@outlook.com", user.mail()); } } From 210d02f423366620f1a50dc84336a7821c3601d2 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 15 Sep 2016 17:58:30 -0700 Subject: [PATCH 15/21] ability to get to the associated NIC IP config (if any) from a public IP address --- .../management/network/PublicIpAddress.java | 16 +++++--- .../implementation/PublicIpAddressImpl.java | 39 +++++++++++++++---- .../java/com/microsoft/azure/AzureTests.java | 2 +- .../com/microsoft/azure/TestLoadBalancer.java | 3 ++ .../microsoft/azure/TestPublicIpAddress.java | 17 +++++++- .../azure/TestVirtualMachineSsh.java | 24 +++++++++--- 6 files changed, 81 insertions(+), 20 deletions(-) diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java index 4443a6ef33a4d..076313f066b7c 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java @@ -68,13 +68,19 @@ public interface PublicIpAddress extends PublicFrontend getAssignedLoadBalancerFrontend(); /** - * @return true if this public IP address is assigned to a load balancer frontend + * @return true if this public IP address is assigned to a load balancer */ - boolean hasAssignedLoadBalancerFrontend(); + boolean hasAssignedLoadBalancer(); - /************************************************************** - * Fluent interfaces for builder pattern - **************************************************************/ + /** + * @return the network interface IP configuration that this public IP address is assigned to + */ + NicIpConfiguration getAssignedNetworkInterfaceIpConfiguration(); + + /** + * @return true if this public IP address is assigned to a network interface + */ + boolean hasAssignedNetworkInterface(); /** * Container interface for all the definitions. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/PublicIpAddressImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/PublicIpAddressImpl.java index 67346a8e21708..17588ee11c255 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/PublicIpAddressImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/PublicIpAddressImpl.java @@ -9,6 +9,8 @@ import com.microsoft.azure.management.network.IPAllocationMethod; import com.microsoft.azure.management.network.IPVersion; import com.microsoft.azure.management.network.LoadBalancer; +import com.microsoft.azure.management.network.NetworkInterface; +import com.microsoft.azure.management.network.NicIpConfiguration; import com.microsoft.azure.management.network.PublicFrontend; import com.microsoft.azure.management.network.PublicIPAddressDnsSettings; import com.microsoft.azure.management.network.PublicIpAddress; @@ -164,9 +166,25 @@ public Observable createResourceAsync() { .map(innerToFluentMap(this)); } + private boolean equalsResourceType(String resourceType) { + IPConfigurationInner ipConfig = this.inner().ipConfiguration(); + if (ipConfig == null || resourceType == null) { + return false; + } else { + final String refId = this.inner().ipConfiguration().id(); + final String resourceType2 = ResourceUtils.resourceTypeFromResourceId(refId); + return resourceType.equalsIgnoreCase(resourceType2); + } + } + + @Override + public boolean hasAssignedLoadBalancer() { + return equalsResourceType("frontendIPConfigurations"); + } + @Override public PublicFrontend getAssignedLoadBalancerFrontend() { - if (this.hasAssignedLoadBalancerFrontend()) { + if (this.hasAssignedLoadBalancer()) { final String refId = this.inner().ipConfiguration().id(); final String loadBalancerId = ResourceUtils.parentResourcePathFromResourceId(refId); final LoadBalancer lb = this.myManager.loadBalancers().getById(loadBalancerId); @@ -178,13 +196,20 @@ public PublicFrontend getAssignedLoadBalancerFrontend() { } @Override - public boolean hasAssignedLoadBalancerFrontend() { - if (this.inner().ipConfiguration() == null) { - return false; - } else { + public boolean hasAssignedNetworkInterface() { + return equalsResourceType("ipConfigurations"); + } + + @Override + public NicIpConfiguration getAssignedNetworkInterfaceIpConfiguration() { + if (this.hasAssignedNetworkInterface()) { final String refId = this.inner().ipConfiguration().id(); - final String resourceType = ResourceUtils.resourceTypeFromResourceId(refId); - return resourceType.equalsIgnoreCase("frontendIPConfigurations"); + final String parentId = ResourceUtils.parentResourcePathFromResourceId(refId); + final NetworkInterface nic = this.myManager.networkInterfaces().getById(parentId); + final String childName = ResourceUtils.nameFromResourceId(refId); + return nic.ipConfigurations().get(childName); + } else { + return null; } } } diff --git a/azure/src/test/java/com/microsoft/azure/AzureTests.java b/azure/src/test/java/com/microsoft/azure/AzureTests.java index ab85a9f609e01..a4d04150da287 100644 --- a/azure/src/test/java/com/microsoft/azure/AzureTests.java +++ b/azure/src/test/java/com/microsoft/azure/AzureTests.java @@ -257,7 +257,7 @@ public void testLoadBalancersInternalMinimum() throws Exception { } @Test public void testVirtualMachineSSh() throws Exception { - new TestVirtualMachineSsh() + new TestVirtualMachineSsh(azure.publicIpAddresses()) .runTest(azure.virtualMachines(), azure.resourceGroups()); } diff --git a/azure/src/test/java/com/microsoft/azure/TestLoadBalancer.java b/azure/src/test/java/com/microsoft/azure/TestLoadBalancer.java index d7b5715651f59..c671fe684bca5 100644 --- a/azure/src/test/java/com/microsoft/azure/TestLoadBalancer.java +++ b/azure/src/test/java/com/microsoft/azure/TestLoadBalancer.java @@ -258,6 +258,9 @@ public LoadBalancer createResource(LoadBalancers resources) throws Exception { // Verify frontends Assert.assertTrue(lb.frontends().containsKey("frontend1")); Assert.assertTrue(lb.frontends().size() == 1); + + existingPips.get(0).refresh(); + Assert.assertTrue(existingPips.get(0).getAssignedLoadBalancerFrontend().name().equalsIgnoreCase("frontend1")); TestPublicIpAddress.printPIP(existingPips.get(0).refresh()); // Verify backends diff --git a/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java b/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java index 9cc3802d0d9ce..bd14edd3a4718 100644 --- a/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java +++ b/azure/src/test/java/com/microsoft/azure/TestPublicIpAddress.java @@ -8,6 +8,8 @@ import org.junit.Assert; import com.microsoft.azure.management.network.LoadBalancer; +import com.microsoft.azure.management.network.NetworkInterface; +import com.microsoft.azure.management.network.NicIpConfiguration; import com.microsoft.azure.management.network.PublicFrontend; import com.microsoft.azure.management.network.PublicIpAddress; import com.microsoft.azure.management.network.PublicIpAddresses; @@ -67,9 +69,9 @@ public static void printPIP(PublicIpAddress resource) { .append("\n\tIP allocation method: ").append(resource.ipAllocationMethod().toString()) .append("\n\tIP version: ").append(resource.version().toString()); - // Show the associated load balancer frontend if any + // Show the associated load balancer if any info.append("\n\tLoad balancer association: "); - if (resource.hasAssignedLoadBalancerFrontend()) { + if (resource.hasAssignedLoadBalancer()) { final PublicFrontend frontend = resource.getAssignedLoadBalancerFrontend(); final LoadBalancer lb = frontend.parent(); info.append("\n\t\tLoad balancer ID: ").append(lb.id()) @@ -78,6 +80,17 @@ public static void printPIP(PublicIpAddress resource) { info.append("(None)"); } + // Show the associated NIC if any + info.append("\n\tNetwork interface association: "); + if (resource.hasAssignedNetworkInterface()) { + final NicIpConfiguration nicIp = resource.getAssignedNetworkInterfaceIpConfiguration(); + final NetworkInterface nic = nicIp.parent(); + info.append("\n\t\tNetwork interface ID: ").append(nic.id()) + .append("\n\t\tIP config name: ").append(nicIp.name()); + } else { + info.append("(None)"); + } + System.out.println(info.toString()); } } diff --git a/azure/src/test/java/com/microsoft/azure/TestVirtualMachineSsh.java b/azure/src/test/java/com/microsoft/azure/TestVirtualMachineSsh.java index a9897d3b60bdc..135bfb98aef27 100644 --- a/azure/src/test/java/com/microsoft/azure/TestVirtualMachineSsh.java +++ b/azure/src/test/java/com/microsoft/azure/TestVirtualMachineSsh.java @@ -11,24 +11,35 @@ import com.microsoft.azure.management.compute.KnownLinuxVirtualMachineImage; import com.microsoft.azure.management.compute.VirtualMachine; import com.microsoft.azure.management.compute.VirtualMachines; +import com.microsoft.azure.management.network.PublicIpAddress; +import com.microsoft.azure.management.network.PublicIpAddresses; import com.microsoft.azure.management.compute.VirtualMachineSizeTypes; import com.microsoft.azure.management.resources.fluentcore.arm.Region; import org.junit.Assert; public class TestVirtualMachineSsh extends TestTemplate { - public TestVirtualMachineSsh() { + final PublicIpAddresses pips; + public TestVirtualMachineSsh(PublicIpAddresses pips) { + this.pips = pips; } @Override public VirtualMachine createResource(VirtualMachines virtualMachines) throws Exception { final String vmName = "vm" + this.testId; - final String sshKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCfSPC2K7LZcFKEO+/t3dzmQYtrJFZNxOsbVgOVKietqHyvmYGHEC0J2wPdAqQ/63g/hhAEFRoyehM+rbeDri4txB3YFfnOK58jqdkyXzupWqXzOrlKY4Wz9SKjjN765+dqUITjKRIaAip1Ri137szRg71WnrmdP3SphTRlCx1Bk2nXqWPsclbRDCiZeF8QOTi4JqbmJyK5+0UqhqYRduun8ylAwKKQJ1NJt85sYIHn9f1Rfr6Tq2zS0wZ7DHbZL+zB5rSlAr8QyUdg/GQD+cmSs6LvPJKL78d6hMGk84ARtFo4A79ovwX/Fj01znDQkU6nJildfkaolH2rWFG/qttD azjava@javalib.com"; final String publicIpDnsLabel = vmName; + final String sshKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCfSPC2K7LZcFKEO+/t3dzmQYtrJFZNxOsbVgOVKietqHyvmYGHEC0J2wPdAqQ/63g/hhAEFRoyehM+rbeDri4txB3YFfnOK58jqdkyXzupWqXzOrlKY4Wz9SKjjN765+dqUITjKRIaAip1Ri137szRg71WnrmdP3SphTRlCx1Bk2nXqWPsclbRDCiZeF8QOTi4JqbmJyK5+0UqhqYRduun8ylAwKKQJ1NJt85sYIHn9f1Rfr6Tq2zS0wZ7DHbZL+zB5rSlAr8QyUdg/GQD+cmSs6LvPJKL78d6hMGk84ARtFo4A79ovwX/Fj01znDQkU6nJildfkaolH2rWFG/qttD azjava@javalib.com"; + final String publicIpDnsLabel = vmName; + PublicIpAddress pip = pips.define(publicIpDnsLabel) + .withRegion(Region.US_EAST) + .withNewResourceGroup() + .withLeafDomainLabel(publicIpDnsLabel) + .create(); + VirtualMachine vm = virtualMachines.define(vmName) - .withRegion(Region.US_EAST) - .withNewResourceGroup() + .withRegion(pip.regionName()) + .withExistingResourceGroup(pip.resourceGroupName()) .withNewPrimaryNetwork("10.0.0.0/28") .withPrimaryPrivateIpAddressDynamic() - .withNewPrimaryPublicIpAddress(publicIpDnsLabel) + .withExistingPrimaryPublicIpAddress(pip) .withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_14_04_LTS) .withRootUserName("testuser") .withSsh(sshKey) @@ -36,6 +47,9 @@ public VirtualMachine createResource(VirtualMachines virtualMachines) throws Exc .withSize(VirtualMachineSizeTypes.STANDARD_D3_V2) .create(); + pip.refresh(); + Assert.assertTrue(pip.hasAssignedNetworkInterface()); + JSch jsch= new JSch(); Session session = null; try { From cb13f8a533336b0475036f091ef879fe9707dbff Mon Sep 17 00:00:00 2001 From: Jianghao Lu Date: Thu, 15 Sep 2016 17:58:25 -0700 Subject: [PATCH 16/21] Regen Redis from updated swagger --- .../azure/management/redis/DayOfWeek.java | 76 ++- .../management/redis/RedisAccessKeys.java | 68 --- .../redis/RedisPatchSchedulesRequest.java | 47 -- ...duleEntryInner.java => ScheduleEntry.java} | 19 +- .../ExportRDBParametersInner.java | 2 +- .../implementation/PatchSchedulesInner.java | 88 ++- ...ltInner.java => RedisAccessKeysInner.java} | 12 +- .../RedisCreateParametersInner.java} | 112 ++-- .../redis/implementation/RedisInner.java | 517 ++++++++++++++---- ...nner.java => RedisPatchScheduleInner.java} | 23 +- .../implementation/RedisResourceInner.java | 168 ++---- .../RedisResourceWithAccessKeyInner.java | 368 ------------- ...r.java => RedisUpdateParametersInner.java} | 144 +++-- 13 files changed, 701 insertions(+), 943 deletions(-) delete mode 100644 azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/RedisAccessKeys.java delete mode 100644 azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/RedisPatchSchedulesRequest.java rename azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/{implementation/ScheduleEntryInner.java => ScheduleEntry.java} (77%) rename azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/{RedisListKeysResultInner.java => RedisAccessKeysInner.java} (79%) rename azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/{RedisProperties.java => implementation/RedisCreateParametersInner.java} (71%) rename azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/{RedisPatchSchedulesResponseInner.java => RedisPatchScheduleInner.java} (75%) delete mode 100644 azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisResourceWithAccessKeyInner.java rename azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/{RedisCreateOrUpdateParametersInner.java => RedisUpdateParametersInner.java} (68%) diff --git a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/DayOfWeek.java b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/DayOfWeek.java index c5ec4ad5a1890..54586a3913509 100644 --- a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/DayOfWeek.java +++ b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/DayOfWeek.java @@ -8,67 +8,61 @@ package com.microsoft.azure.management.redis; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; /** * Defines values for DayOfWeek. */ -public final class DayOfWeek { - /** Static value Monday for DayOfWeek. */ - public static final DayOfWeek MONDAY = new DayOfWeek("Monday"); +public enum DayOfWeek { + /** Enum value Monday. */ + MONDAY("Monday"), - /** Static value Tuesday for DayOfWeek. */ - public static final DayOfWeek TUESDAY = new DayOfWeek("Tuesday"); + /** Enum value Tuesday. */ + TUESDAY("Tuesday"), - /** Static value Wednesday for DayOfWeek. */ - public static final DayOfWeek WEDNESDAY = new DayOfWeek("Wednesday"); + /** Enum value Wednesday. */ + WEDNESDAY("Wednesday"), - /** Static value Thursday for DayOfWeek. */ - public static final DayOfWeek THURSDAY = new DayOfWeek("Thursday"); + /** Enum value Thursday. */ + THURSDAY("Thursday"), - /** Static value Friday for DayOfWeek. */ - public static final DayOfWeek FRIDAY = new DayOfWeek("Friday"); + /** Enum value Friday. */ + FRIDAY("Friday"), - /** Static value Saturday for DayOfWeek. */ - public static final DayOfWeek SATURDAY = new DayOfWeek("Saturday"); + /** Enum value Saturday. */ + SATURDAY("Saturday"), - /** Static value Sunday for DayOfWeek. */ - public static final DayOfWeek SUNDAY = new DayOfWeek("Sunday"); + /** Enum value Sunday. */ + SUNDAY("Sunday"); + /** The actual serialized value for a DayOfWeek instance. */ private String value; + DayOfWeek(String value) { + this.value = value; + } + /** - * Creates a custom value for DayOfWeek. - * @param value the custom value + * Parses a serialized value to a DayOfWeek instance. + * + * @param value the serialized value to parse. + * @return the parsed DayOfWeek object, or null if unable to parse. */ - public DayOfWeek(String value) { - this.value = value; + @JsonCreator + public static DayOfWeek fromString(String value) { + DayOfWeek[] items = DayOfWeek.values(); + for (DayOfWeek item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; } @JsonValue @Override public String toString() { - return value; - } - - @Override - public int hashCode() { - return value.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof DayOfWeek)) { - return false; - } - if (obj == this) { - return true; - } - DayOfWeek rhs = (DayOfWeek) obj; - if (value == null) { - return rhs.value == null; - } else { - return value.equals(rhs.value); - } + return this.value; } } diff --git a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/RedisAccessKeys.java b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/RedisAccessKeys.java deleted file mode 100644 index 906242791ef9a..0000000000000 --- a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/RedisAccessKeys.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - */ - -package com.microsoft.azure.management.redis; - - -/** - * Redis cache access keys. - */ -public class RedisAccessKeys { - /** - * The current primary key that clients can use to authenticate with redis - * cache. - */ - private String primaryKey; - - /** - * The current secondary key that clients can use to authenticate with - * redis cache. - */ - private String secondaryKey; - - /** - * Get the primaryKey value. - * - * @return the primaryKey value - */ - public String primaryKey() { - return this.primaryKey; - } - - /** - * Set the primaryKey value. - * - * @param primaryKey the primaryKey value to set - * @return the RedisAccessKeys object itself. - */ - public RedisAccessKeys withPrimaryKey(String primaryKey) { - this.primaryKey = primaryKey; - return this; - } - - /** - * Get the secondaryKey value. - * - * @return the secondaryKey value - */ - public String secondaryKey() { - return this.secondaryKey; - } - - /** - * Set the secondaryKey value. - * - * @param secondaryKey the secondaryKey value to set - * @return the RedisAccessKeys object itself. - */ - public RedisAccessKeys withSecondaryKey(String secondaryKey) { - this.secondaryKey = secondaryKey; - return this; - } - -} diff --git a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/RedisPatchSchedulesRequest.java b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/RedisPatchSchedulesRequest.java deleted file mode 100644 index f57645eb3a736..0000000000000 --- a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/RedisPatchSchedulesRequest.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - */ - -package com.microsoft.azure.management.redis; - -import java.util.List; -import com.microsoft.azure.management.redis.implementation.ScheduleEntryInner; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.microsoft.rest.serializer.JsonFlatten; - -/** - * Parameters to set patch schedules for redis cache. - */ -@JsonFlatten -public class RedisPatchSchedulesRequest { - /** - * List of patch schedules for redis cache. - */ - @JsonProperty(value = "properties.scheduleEntries", required = true) - private List scheduleEntries; - - /** - * Get the scheduleEntries value. - * - * @return the scheduleEntries value - */ - public List scheduleEntries() { - return this.scheduleEntries; - } - - /** - * Set the scheduleEntries value. - * - * @param scheduleEntries the scheduleEntries value to set - * @return the RedisPatchSchedulesRequest object itself. - */ - public RedisPatchSchedulesRequest withScheduleEntries(List scheduleEntries) { - this.scheduleEntries = scheduleEntries; - return this; - } - -} diff --git a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/ScheduleEntryInner.java b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/ScheduleEntry.java similarity index 77% rename from azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/ScheduleEntryInner.java rename to azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/ScheduleEntry.java index 7bf3c3f52cb41..363d8ed9db345 100644 --- a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/ScheduleEntryInner.java +++ b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/ScheduleEntry.java @@ -6,16 +6,15 @@ * Code generated by Microsoft (R) AutoRest Code Generator. */ -package com.microsoft.azure.management.redis.implementation; +package com.microsoft.azure.management.redis; -import com.microsoft.azure.management.redis.DayOfWeek; import org.joda.time.Period; import com.fasterxml.jackson.annotation.JsonProperty; /** - * The ScheduleEntryInner model. + * The ScheduleEntry model. */ -public class ScheduleEntryInner { +public class ScheduleEntry { /** * Day of week when cache can be patched. Possible values include: * 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', @@ -48,9 +47,9 @@ public DayOfWeek dayOfWeek() { * Set the dayOfWeek value. * * @param dayOfWeek the dayOfWeek value to set - * @return the ScheduleEntryInner object itself. + * @return the ScheduleEntry object itself. */ - public ScheduleEntryInner withDayOfWeek(DayOfWeek dayOfWeek) { + public ScheduleEntry withDayOfWeek(DayOfWeek dayOfWeek) { this.dayOfWeek = dayOfWeek; return this; } @@ -68,9 +67,9 @@ public int startHourUtc() { * Set the startHourUtc value. * * @param startHourUtc the startHourUtc value to set - * @return the ScheduleEntryInner object itself. + * @return the ScheduleEntry object itself. */ - public ScheduleEntryInner withStartHourUtc(int startHourUtc) { + public ScheduleEntry withStartHourUtc(int startHourUtc) { this.startHourUtc = startHourUtc; return this; } @@ -88,9 +87,9 @@ public Period maintenanceWindow() { * Set the maintenanceWindow value. * * @param maintenanceWindow the maintenanceWindow value to set - * @return the ScheduleEntryInner object itself. + * @return the ScheduleEntry object itself. */ - public ScheduleEntryInner withMaintenanceWindow(Period maintenanceWindow) { + public ScheduleEntry withMaintenanceWindow(Period maintenanceWindow) { this.maintenanceWindow = maintenanceWindow; return this; } diff --git a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/ExportRDBParametersInner.java b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/ExportRDBParametersInner.java index 06edd0ec055af..4463172ad33bb 100644 --- a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/ExportRDBParametersInner.java +++ b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/ExportRDBParametersInner.java @@ -20,7 +20,7 @@ public class ExportRDBParametersInner { private String format; /** - * Prifix to use for exported files. + * Prefix to use for exported files. */ @JsonProperty(required = true) private String prefix; diff --git a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/PatchSchedulesInner.java b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/PatchSchedulesInner.java index a9c2ee749926c..d6540330fef03 100644 --- a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/PatchSchedulesInner.java +++ b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/PatchSchedulesInner.java @@ -12,13 +12,11 @@ import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.azure.CloudException; -import com.microsoft.azure.management.redis.RedisPatchSchedulesRequest; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.Validator; import java.io.IOException; -import java.util.List; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; @@ -60,7 +58,7 @@ public PatchSchedulesInner(Retrofit retrofit, RedisManagementClientImpl client) interface PatchSchedulesService { @Headers("Content-Type: application/json; charset=utf-8") @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/default") - Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RedisPatchSchedulesRequest parameters, @Header("User-Agent") String userAgent); + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body RedisPatchScheduleInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/default", method = "DELETE", hasBody = true) @@ -77,11 +75,11 @@ interface PatchSchedulesService { * * @param resourceGroupName The name of the resource group. * @param name The name of the redis cache. - * @param scheduleEntries List of patch schedules for redis cache. - * @return the RedisPatchSchedulesResponseInner object if successful. + * @param parameters Parameters to set patch schedules for redis cache. + * @return the RedisPatchScheduleInner object if successful. */ - public RedisPatchSchedulesResponseInner createOrUpdate(String resourceGroupName, String name, List scheduleEntries) { - return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, scheduleEntries).toBlocking().single().getBody(); + public RedisPatchScheduleInner createOrUpdate(String resourceGroupName, String name, RedisPatchScheduleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().getBody(); } /** @@ -89,12 +87,12 @@ public RedisPatchSchedulesResponseInner createOrUpdate(String resourceGroupName, * * @param resourceGroupName The name of the resource group. * @param name The name of the redis cache. - * @param scheduleEntries List of patch schedules for redis cache. + * @param parameters Parameters to set patch schedules for redis cache. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */ - public ServiceCall createOrUpdateAsync(String resourceGroupName, String name, List scheduleEntries, final ServiceCallback serviceCallback) { - return ServiceCall.create(createOrUpdateWithServiceResponseAsync(resourceGroupName, name, scheduleEntries), serviceCallback); + public ServiceCall createOrUpdateAsync(String resourceGroupName, String name, RedisPatchScheduleInner parameters, final ServiceCallback serviceCallback) { + return ServiceCall.create(createOrUpdateWithServiceResponseAsync(resourceGroupName, name, parameters), serviceCallback); } /** @@ -102,13 +100,13 @@ public ServiceCall createOrUpdateAsync(String * * @param resourceGroupName The name of the resource group. * @param name The name of the redis cache. - * @param scheduleEntries List of patch schedules for redis cache. - * @return the observable to the RedisPatchSchedulesResponseInner object + * @param parameters Parameters to set patch schedules for redis cache. + * @return the observable to the RedisPatchScheduleInner object */ - public Observable createOrUpdateAsync(String resourceGroupName, String name, List scheduleEntries) { - return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, scheduleEntries).map(new Func1, RedisPatchSchedulesResponseInner>() { + public Observable createOrUpdateAsync(String resourceGroupName, String name, RedisPatchScheduleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1, RedisPatchScheduleInner>() { @Override - public RedisPatchSchedulesResponseInner call(ServiceResponse response) { + public RedisPatchScheduleInner call(ServiceResponse response) { return response.getBody(); } }); @@ -119,10 +117,10 @@ public RedisPatchSchedulesResponseInner call(ServiceResponse> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String name, List scheduleEntries) { + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String name, RedisPatchScheduleInner parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -132,21 +130,19 @@ public Observable> createOrUpd if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - if (scheduleEntries == null) { - throw new IllegalArgumentException("Parameter scheduleEntries is required and cannot be null."); - } - Validator.validate(scheduleEntries); - RedisPatchSchedulesRequest parameters = new RedisPatchSchedulesRequest(); - parameters.withScheduleEntries(scheduleEntries); - return service.createOrUpdate(resourceGroupName, name, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, name, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = createOrUpdateDelegate(response); + ServiceResponse clientResponse = createOrUpdateDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -155,9 +151,9 @@ public Observable> call(Respon }); } - private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.mapperAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -245,9 +241,9 @@ private ServiceResponse deleteDelegate(Response response) th * * @param resourceGroupName The name of the resource group. * @param name The name of the redis cache. - * @return the RedisPatchSchedulesResponseInner object if successful. + * @return the RedisPatchScheduleInner object if successful. */ - public RedisPatchSchedulesResponseInner get(String resourceGroupName, String name) { + public RedisPatchScheduleInner get(String resourceGroupName, String name) { return getWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().getBody(); } @@ -259,7 +255,7 @@ public RedisPatchSchedulesResponseInner get(String resourceGroupName, String nam * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */ - public ServiceCall getAsync(String resourceGroupName, String name, final ServiceCallback serviceCallback) { + public ServiceCall getAsync(String resourceGroupName, String name, final ServiceCallback serviceCallback) { return ServiceCall.create(getWithServiceResponseAsync(resourceGroupName, name), serviceCallback); } @@ -268,12 +264,12 @@ public ServiceCall getAsync(String resourceGro * * @param resourceGroupName The name of the resource group. * @param name The name of the redis cache. - * @return the observable to the RedisPatchSchedulesResponseInner object + * @return the observable to the RedisPatchScheduleInner object */ - public Observable getAsync(String resourceGroupName, String name) { - return getWithServiceResponseAsync(resourceGroupName, name).map(new Func1, RedisPatchSchedulesResponseInner>() { + public Observable getAsync(String resourceGroupName, String name) { + return getWithServiceResponseAsync(resourceGroupName, name).map(new Func1, RedisPatchScheduleInner>() { @Override - public RedisPatchSchedulesResponseInner call(ServiceResponse response) { + public RedisPatchScheduleInner call(ServiceResponse response) { return response.getBody(); } }); @@ -284,9 +280,9 @@ public RedisPatchSchedulesResponseInner call(ServiceResponse> getWithServiceResponseAsync(String resourceGroupName, String name) { + public Observable> getWithServiceResponseAsync(String resourceGroupName, String name) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -300,11 +296,11 @@ public Observable> getWithServ throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.get(resourceGroupName, name, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = getDelegate(response); + ServiceResponse clientResponse = getDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -313,9 +309,9 @@ public Observable> call(Respon }); } - private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.mapperAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisListKeysResultInner.java b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisAccessKeysInner.java similarity index 79% rename from azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisListKeysResultInner.java rename to azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisAccessKeysInner.java index 0b2c75b7f473a..ba502319b59b5 100644 --- a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisListKeysResultInner.java +++ b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisAccessKeysInner.java @@ -10,9 +10,9 @@ /** - * The response of redis list keys operation. + * Redis cache access keys. */ -public class RedisListKeysResultInner { +public class RedisAccessKeysInner { /** * The current primary key that clients can use to authenticate with redis * cache. @@ -38,9 +38,9 @@ public String primaryKey() { * Set the primaryKey value. * * @param primaryKey the primaryKey value to set - * @return the RedisListKeysResultInner object itself. + * @return the RedisAccessKeysInner object itself. */ - public RedisListKeysResultInner withPrimaryKey(String primaryKey) { + public RedisAccessKeysInner withPrimaryKey(String primaryKey) { this.primaryKey = primaryKey; return this; } @@ -58,9 +58,9 @@ public String secondaryKey() { * Set the secondaryKey value. * * @param secondaryKey the secondaryKey value to set - * @return the RedisListKeysResultInner object itself. + * @return the RedisAccessKeysInner object itself. */ - public RedisListKeysResultInner withSecondaryKey(String secondaryKey) { + public RedisAccessKeysInner withSecondaryKey(String secondaryKey) { this.secondaryKey = secondaryKey; return this; } diff --git a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/RedisProperties.java b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisCreateParametersInner.java similarity index 71% rename from azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/RedisProperties.java rename to azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisCreateParametersInner.java index f151cf72f1675..a14b1a910692a 100644 --- a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/RedisProperties.java +++ b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisCreateParametersInner.java @@ -6,48 +6,44 @@ * Code generated by Microsoft (R) AutoRest Code Generator. */ -package com.microsoft.azure.management.redis; +package com.microsoft.azure.management.redis.implementation; import java.util.Map; +import com.microsoft.azure.management.redis.Sku; import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; /** - * Properties supplied to CreateOrUpdate redis operation. + * Parameters supplied to the Create Redis operation. */ -public class RedisProperties { - /** - * RedisVersion parameter has been deprecated. As such, it is no longer - * necessary to provide this parameter and any value specified is ignored. - */ - private String redisVersion; - - /** - * What sku of redis cache to deploy. - */ - @JsonProperty(required = true) - private Sku sku; - +@JsonFlatten +public class RedisCreateParametersInner extends Resource { /** * All Redis Settings. Few possible keys: * rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value * etc. */ + @JsonProperty(value = "properties.redisConfiguration") private Map redisConfiguration; /** * If the value is true, then the non-ssl redis server port (6379) will be * enabled. */ + @JsonProperty(value = "properties.enableNonSslPort") private Boolean enableNonSslPort; /** * tenantSettings. */ + @JsonProperty(value = "properties.tenantSettings") private Map tenantSettings; /** * The number of shards to be created on a Premium Cluster Cache. */ + @JsonProperty(value = "properties.shardCount") private Integer shardCount; /** @@ -55,53 +51,21 @@ public class RedisProperties { * redis cache in. Example format: * /subscriptions/{subid}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. */ + @JsonProperty(value = "properties.subnetId") private String subnetId; /** * Required when deploying a redis cache inside an existing Azure Virtual * Network. */ + @JsonProperty(value = "properties.staticIP") private String staticIP; /** - * Get the redisVersion value. - * - * @return the redisVersion value - */ - public String redisVersion() { - return this.redisVersion; - } - - /** - * Set the redisVersion value. - * - * @param redisVersion the redisVersion value to set - * @return the RedisProperties object itself. - */ - public RedisProperties withRedisVersion(String redisVersion) { - this.redisVersion = redisVersion; - return this; - } - - /** - * Get the sku value. - * - * @return the sku value - */ - public Sku sku() { - return this.sku; - } - - /** - * Set the sku value. - * - * @param sku the sku value to set - * @return the RedisProperties object itself. + * What sku of redis cache to deploy. */ - public RedisProperties withSku(Sku sku) { - this.sku = sku; - return this; - } + @JsonProperty(value = "properties.sku", required = true) + private Sku sku; /** * Get the redisConfiguration value. @@ -116,9 +80,9 @@ public Map redisConfiguration() { * Set the redisConfiguration value. * * @param redisConfiguration the redisConfiguration value to set - * @return the RedisProperties object itself. + * @return the RedisCreateParametersInner object itself. */ - public RedisProperties withRedisConfiguration(Map redisConfiguration) { + public RedisCreateParametersInner withRedisConfiguration(Map redisConfiguration) { this.redisConfiguration = redisConfiguration; return this; } @@ -136,9 +100,9 @@ public Boolean enableNonSslPort() { * Set the enableNonSslPort value. * * @param enableNonSslPort the enableNonSslPort value to set - * @return the RedisProperties object itself. + * @return the RedisCreateParametersInner object itself. */ - public RedisProperties withEnableNonSslPort(Boolean enableNonSslPort) { + public RedisCreateParametersInner withEnableNonSslPort(Boolean enableNonSslPort) { this.enableNonSslPort = enableNonSslPort; return this; } @@ -156,9 +120,9 @@ public Map tenantSettings() { * Set the tenantSettings value. * * @param tenantSettings the tenantSettings value to set - * @return the RedisProperties object itself. + * @return the RedisCreateParametersInner object itself. */ - public RedisProperties withTenantSettings(Map tenantSettings) { + public RedisCreateParametersInner withTenantSettings(Map tenantSettings) { this.tenantSettings = tenantSettings; return this; } @@ -176,9 +140,9 @@ public Integer shardCount() { * Set the shardCount value. * * @param shardCount the shardCount value to set - * @return the RedisProperties object itself. + * @return the RedisCreateParametersInner object itself. */ - public RedisProperties withShardCount(Integer shardCount) { + public RedisCreateParametersInner withShardCount(Integer shardCount) { this.shardCount = shardCount; return this; } @@ -196,9 +160,9 @@ public String subnetId() { * Set the subnetId value. * * @param subnetId the subnetId value to set - * @return the RedisProperties object itself. + * @return the RedisCreateParametersInner object itself. */ - public RedisProperties withSubnetId(String subnetId) { + public RedisCreateParametersInner withSubnetId(String subnetId) { this.subnetId = subnetId; return this; } @@ -216,11 +180,31 @@ public String staticIP() { * Set the staticIP value. * * @param staticIP the staticIP value to set - * @return the RedisProperties object itself. + * @return the RedisCreateParametersInner object itself. */ - public RedisProperties withStaticIP(String staticIP) { + public RedisCreateParametersInner withStaticIP(String staticIP) { this.staticIP = staticIP; return this; } + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the RedisCreateParametersInner object itself. + */ + public RedisCreateParametersInner withSku(Sku sku) { + this.sku = sku; + return this; + } + } diff --git a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisInner.java b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisInner.java index e55d69c5f485b..4eb5289e465bb 100644 --- a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisInner.java +++ b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisInner.java @@ -30,6 +30,7 @@ import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.http.HTTP; +import retrofit2.http.PATCH; import retrofit2.http.Path; import retrofit2.http.POST; import retrofit2.http.PUT; @@ -66,12 +67,28 @@ public RedisInner(Retrofit retrofit, RedisManagementClientImpl client) { interface RedisService { @Headers("Content-Type: application/json; charset=utf-8") @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}") - Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body RedisCreateOrUpdateParametersInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body RedisCreateParametersInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}") + Observable> beginCreate(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body RedisCreateParametersInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body RedisUpdateParametersInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body RedisUpdateParametersInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}", method = "DELETE", hasBody = true) Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers("Content-Type: application/json; charset=utf-8") @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}") Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -98,19 +115,19 @@ interface RedisService { @Headers("Content-Type: application/json; charset=utf-8") @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/import") - Observable> importMethod(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body ImportRDBParametersInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> importData(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body ImportRDBParametersInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/import") - Observable> beginImport(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body ImportRDBParametersInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> beginImportData(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body ImportRDBParametersInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/export") - Observable> export(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body ExportRDBParametersInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> exportData(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body ExportRDBParametersInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/export") - Observable> beginExport(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body ExportRDBParametersInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> beginExportData(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body ExportRDBParametersInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("{nextLink}") @@ -123,56 +140,216 @@ interface RedisService { } /** - * Create a redis cache, or replace (overwrite/recreate, with potential downtime) an existing cache. + * Create or replace (overwrite/recreate, with potential downtime) an existing redis cache. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the redis cache. + * @param parameters Parameters supplied to the Create redis operation. + * @return the RedisResourceInner object if successful. + */ + public RedisResourceInner create(String resourceGroupName, String name, RedisCreateParametersInner parameters) { + return createWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().last().getBody(); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) an existing redis cache. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the redis cache. + * @param parameters Parameters supplied to the Create redis operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall createAsync(String resourceGroupName, String name, RedisCreateParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceCall.create(createWithServiceResponseAsync(resourceGroupName, name, parameters), serviceCallback); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) an existing redis cache. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the redis cache. + * @param parameters Parameters supplied to the Create redis operation. + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String name, RedisCreateParametersInner parameters) { + return createWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1, RedisResourceInner>() { + @Override + public RedisResourceInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) an existing redis cache. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the redis cache. + * @param parameters Parameters supplied to the Create redis operation. + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String name, RedisCreateParametersInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.create(resourceGroupName, name, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) an existing redis cache. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the redis cache. + * @param parameters Parameters supplied to the Create redis operation. + * @return the RedisResourceInner object if successful. + */ + public RedisResourceInner beginCreate(String resourceGroupName, String name, RedisCreateParametersInner parameters) { + return beginCreateWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().getBody(); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) an existing redis cache. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the redis cache. + * @param parameters Parameters supplied to the Create redis operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall beginCreateAsync(String resourceGroupName, String name, RedisCreateParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginCreateWithServiceResponseAsync(resourceGroupName, name, parameters), serviceCallback); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) an existing redis cache. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the redis cache. + * @param parameters Parameters supplied to the Create redis operation. + * @return the observable to the RedisResourceInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String name, RedisCreateParametersInner parameters) { + return beginCreateWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1, RedisResourceInner>() { + @Override + public RedisResourceInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) an existing redis cache. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the redis cache. + * @param parameters Parameters supplied to the Create redis operation. + * @return the observable to the RedisResourceInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String name, RedisCreateParametersInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreate(resourceGroupName, name, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(201, new TypeToken() { }.getType()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Update an existing Redis cache. * * @param resourceGroupName The name of the resource group. * @param name The name of the redis cache. - * @param parameters Parameters supplied to the CreateOrUpdate redis operation. - * @return the RedisResourceWithAccessKeyInner object if successful. + * @param parameters Parameters supplied to the Update redis operation. + * @return the RedisResourceInner object if successful. */ - public RedisResourceWithAccessKeyInner createOrUpdate(String resourceGroupName, String name, RedisCreateOrUpdateParametersInner parameters) { - return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().getBody(); + public RedisResourceInner update(String resourceGroupName, String name, RedisUpdateParametersInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().last().getBody(); } /** - * Create a redis cache, or replace (overwrite/recreate, with potential downtime) an existing cache. + * Update an existing Redis cache. * * @param resourceGroupName The name of the resource group. * @param name The name of the redis cache. - * @param parameters Parameters supplied to the CreateOrUpdate redis operation. + * @param parameters Parameters supplied to the Update redis operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */ - public ServiceCall createOrUpdateAsync(String resourceGroupName, String name, RedisCreateOrUpdateParametersInner parameters, final ServiceCallback serviceCallback) { - return ServiceCall.create(createOrUpdateWithServiceResponseAsync(resourceGroupName, name, parameters), serviceCallback); + public ServiceCall updateAsync(String resourceGroupName, String name, RedisUpdateParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceCall.create(updateWithServiceResponseAsync(resourceGroupName, name, parameters), serviceCallback); } /** - * Create a redis cache, or replace (overwrite/recreate, with potential downtime) an existing cache. + * Update an existing Redis cache. * * @param resourceGroupName The name of the resource group. * @param name The name of the redis cache. - * @param parameters Parameters supplied to the CreateOrUpdate redis operation. - * @return the observable to the RedisResourceWithAccessKeyInner object + * @param parameters Parameters supplied to the Update redis operation. + * @return the observable for the request */ - public Observable createOrUpdateAsync(String resourceGroupName, String name, RedisCreateOrUpdateParametersInner parameters) { - return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1, RedisResourceWithAccessKeyInner>() { + public Observable updateAsync(String resourceGroupName, String name, RedisUpdateParametersInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1, RedisResourceInner>() { @Override - public RedisResourceWithAccessKeyInner call(ServiceResponse response) { + public RedisResourceInner call(ServiceResponse response) { return response.getBody(); } }); } /** - * Create a redis cache, or replace (overwrite/recreate, with potential downtime) an existing cache. + * Update an existing Redis cache. * * @param resourceGroupName The name of the resource group. * @param name The name of the redis cache. - * @param parameters Parameters supplied to the CreateOrUpdate redis operation. - * @return the observable to the RedisResourceWithAccessKeyInner object + * @param parameters Parameters supplied to the Update redis operation. + * @return the observable for the request */ - public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String name, RedisCreateOrUpdateParametersInner parameters) { + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String name, RedisUpdateParametersInner parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -189,12 +366,83 @@ public Observable> createOrUpda throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Validator.validate(parameters); - return service.createOrUpdate(resourceGroupName, name, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Observable> observable = service.update(resourceGroupName, name, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update an existing Redis cache. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the redis cache. + * @param parameters Parameters supplied to the Update redis operation. + * @return the RedisResourceInner object if successful. + */ + public RedisResourceInner beginUpdate(String resourceGroupName, String name, RedisUpdateParametersInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().getBody(); + } + + /** + * Update an existing Redis cache. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the redis cache. + * @param parameters Parameters supplied to the Update redis operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall beginUpdateAsync(String resourceGroupName, String name, RedisUpdateParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginUpdateWithServiceResponseAsync(resourceGroupName, name, parameters), serviceCallback); + } + + /** + * Update an existing Redis cache. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the redis cache. + * @param parameters Parameters supplied to the Update redis operation. + * @return the observable to the RedisResourceInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String name, RedisUpdateParametersInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1, RedisResourceInner>() { + @Override + public RedisResourceInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Update an existing Redis cache. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the redis cache. + * @param parameters Parameters supplied to the Update redis operation. + * @return the observable to the RedisResourceInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String name, RedisUpdateParametersInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginUpdate(resourceGroupName, name, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = createOrUpdateDelegate(response); + ServiceResponse clientResponse = beginUpdateDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -203,10 +451,9 @@ public Observable> call(Respons }); } - private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.mapperAdapter()) - .register(201, new TypeToken() { }.getType()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -218,7 +465,7 @@ private ServiceResponse createOrUpdateDelegate( * @param name The name of the redis cache. */ public void delete(String resourceGroupName, String name) { - deleteWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().getBody(); + deleteWithServiceResponseAsync(resourceGroupName, name).toBlocking().last().getBody(); } /** @@ -238,7 +485,7 @@ public ServiceCall deleteAsync(String resourceGroupName, String name, fina * * @param resourceGroupName The name of the resource group. * @param name The name of the redis cache. - * @return the {@link ServiceResponse} object if successful. + * @return the observable for the request */ public Observable deleteAsync(String resourceGroupName, String name) { return deleteWithServiceResponseAsync(resourceGroupName, name).map(new Func1, Void>() { @@ -254,7 +501,7 @@ public Void call(ServiceResponse response) { * * @param resourceGroupName The name of the resource group. * @param name The name of the redis cache. - * @return the {@link ServiceResponse} object if successful. + * @return the observable for the request */ public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String name) { if (resourceGroupName == null) { @@ -269,12 +516,74 @@ public Observable> deleteWithServiceResponseAsync(String r if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - return service.delete(resourceGroupName, name, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + Observable> observable = service.delete(resourceGroupName, name, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a redis cache. This operation takes a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the redis cache. + */ + public void beginDelete(String resourceGroupName, String name) { + beginDeleteWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().getBody(); + } + + /** + * Deletes a redis cache. This operation takes a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the redis cache. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall beginDeleteAsync(String resourceGroupName, String name, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginDeleteWithServiceResponseAsync(resourceGroupName, name), serviceCallback); + } + + /** + * Deletes a redis cache. This operation takes a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the redis cache. + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String name) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Deletes a redis cache. This operation takes a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the redis cache. + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String name) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, name, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = deleteDelegate(response); + ServiceResponse clientResponse = beginDeleteDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -283,7 +592,7 @@ public Observable> call(Response response) { }); } - private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(204, new TypeToken() { }.getType()) @@ -583,9 +892,9 @@ private ServiceResponse> listDelegate(Response listKeysAsync(String resourceGroupName, String name, final ServiceCallback serviceCallback) { + public ServiceCall listKeysAsync(String resourceGroupName, String name, final ServiceCallback serviceCallback) { return ServiceCall.create(listKeysWithServiceResponseAsync(resourceGroupName, name), serviceCallback); } @@ -606,12 +915,12 @@ public ServiceCall listKeysAsync(String resourceGroupN * * @param resourceGroupName The name of the resource group. * @param name The name of the redis cache. - * @return the observable to the RedisListKeysResultInner object + * @return the observable to the RedisAccessKeysInner object */ - public Observable listKeysAsync(String resourceGroupName, String name) { - return listKeysWithServiceResponseAsync(resourceGroupName, name).map(new Func1, RedisListKeysResultInner>() { + public Observable listKeysAsync(String resourceGroupName, String name) { + return listKeysWithServiceResponseAsync(resourceGroupName, name).map(new Func1, RedisAccessKeysInner>() { @Override - public RedisListKeysResultInner call(ServiceResponse response) { + public RedisAccessKeysInner call(ServiceResponse response) { return response.getBody(); } }); @@ -622,9 +931,9 @@ public RedisListKeysResultInner call(ServiceResponse r * * @param resourceGroupName The name of the resource group. * @param name The name of the redis cache. - * @return the observable to the RedisListKeysResultInner object + * @return the observable to the RedisAccessKeysInner object */ - public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String name) { + public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String name) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -638,11 +947,11 @@ public Observable> listKeysWithService throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listKeys(resourceGroupName, name, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = listKeysDelegate(response); + ServiceResponse clientResponse = listKeysDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -651,9 +960,9 @@ public Observable> call(Response listKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.mapperAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse listKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -664,9 +973,9 @@ private ServiceResponse listKeysDelegate(Response regenerateKeyAsync(String resourceGroupName, String name, RedisKeyType keyType, final ServiceCallback serviceCallback) { + public ServiceCall regenerateKeyAsync(String resourceGroupName, String name, RedisKeyType keyType, final ServiceCallback serviceCallback) { return ServiceCall.create(regenerateKeyWithServiceResponseAsync(resourceGroupName, name, keyType), serviceCallback); } @@ -689,12 +998,12 @@ public ServiceCall regenerateKeyAsync(String resourceG * @param resourceGroupName The name of the resource group. * @param name The name of the redis cache. * @param keyType Which redis access key to reset. Possible values include: 'Primary', 'Secondary' - * @return the observable to the RedisListKeysResultInner object + * @return the observable to the RedisAccessKeysInner object */ - public Observable regenerateKeyAsync(String resourceGroupName, String name, RedisKeyType keyType) { - return regenerateKeyWithServiceResponseAsync(resourceGroupName, name, keyType).map(new Func1, RedisListKeysResultInner>() { + public Observable regenerateKeyAsync(String resourceGroupName, String name, RedisKeyType keyType) { + return regenerateKeyWithServiceResponseAsync(resourceGroupName, name, keyType).map(new Func1, RedisAccessKeysInner>() { @Override - public RedisListKeysResultInner call(ServiceResponse response) { + public RedisAccessKeysInner call(ServiceResponse response) { return response.getBody(); } }); @@ -706,9 +1015,9 @@ public RedisListKeysResultInner call(ServiceResponse r * @param resourceGroupName The name of the resource group. * @param name The name of the redis cache. * @param keyType Which redis access key to reset. Possible values include: 'Primary', 'Secondary' - * @return the observable to the RedisListKeysResultInner object + * @return the observable to the RedisAccessKeysInner object */ - public Observable> regenerateKeyWithServiceResponseAsync(String resourceGroupName, String name, RedisKeyType keyType) { + public Observable> regenerateKeyWithServiceResponseAsync(String resourceGroupName, String name, RedisKeyType keyType) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -727,11 +1036,11 @@ public Observable> regenerateKeyWithSe RedisRegenerateKeyParameters parameters = new RedisRegenerateKeyParameters(); parameters.withKeyType(keyType); return service.regenerateKey(resourceGroupName, name, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = regenerateKeyDelegate(response); + ServiceResponse clientResponse = regenerateKeyDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -740,9 +1049,9 @@ public Observable> call(Response regenerateKeyDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.mapperAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse regenerateKeyDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -841,8 +1150,8 @@ private ServiceResponse forceRebootDelegate(Response respons * @param name The name of the redis cache. * @param parameters Parameters for redis import operation. */ - public void importMethod(String resourceGroupName, String name, ImportRDBParametersInner parameters) { - importMethodWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().last().getBody(); + public void importData(String resourceGroupName, String name, ImportRDBParametersInner parameters) { + importDataWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().last().getBody(); } /** @@ -854,8 +1163,8 @@ public void importMethod(String resourceGroupName, String name, ImportRDBParamet * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */ - public ServiceCall importMethodAsync(String resourceGroupName, String name, ImportRDBParametersInner parameters, final ServiceCallback serviceCallback) { - return ServiceCall.create(importMethodWithServiceResponseAsync(resourceGroupName, name, parameters), serviceCallback); + public ServiceCall importDataAsync(String resourceGroupName, String name, ImportRDBParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceCall.create(importDataWithServiceResponseAsync(resourceGroupName, name, parameters), serviceCallback); } /** @@ -866,8 +1175,8 @@ public ServiceCall importMethodAsync(String resourceGroupName, String name * @param parameters Parameters for redis import operation. * @return the observable for the request */ - public Observable importMethodAsync(String resourceGroupName, String name, ImportRDBParametersInner parameters) { - return importMethodWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1, Void>() { + public Observable importDataAsync(String resourceGroupName, String name, ImportRDBParametersInner parameters) { + return importDataWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1, Void>() { @Override public Void call(ServiceResponse response) { return response.getBody(); @@ -883,7 +1192,7 @@ public Void call(ServiceResponse response) { * @param parameters Parameters for redis import operation. * @return the observable for the request */ - public Observable> importMethodWithServiceResponseAsync(String resourceGroupName, String name, ImportRDBParametersInner parameters) { + public Observable> importDataWithServiceResponseAsync(String resourceGroupName, String name, ImportRDBParametersInner parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -900,7 +1209,7 @@ public Observable> importMethodWithServiceResponseAsync(St throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Validator.validate(parameters); - Observable> observable = service.importMethod(resourceGroupName, name, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + Observable> observable = service.importData(resourceGroupName, name, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } @@ -911,8 +1220,8 @@ public Observable> importMethodWithServiceResponseAsync(St * @param name The name of the redis cache. * @param parameters Parameters for redis import operation. */ - public void beginImport(String resourceGroupName, String name, ImportRDBParametersInner parameters) { - beginImportWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().getBody(); + public void beginImportData(String resourceGroupName, String name, ImportRDBParametersInner parameters) { + beginImportDataWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().getBody(); } /** @@ -924,8 +1233,8 @@ public void beginImport(String resourceGroupName, String name, ImportRDBParamete * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */ - public ServiceCall beginImportAsync(String resourceGroupName, String name, ImportRDBParametersInner parameters, final ServiceCallback serviceCallback) { - return ServiceCall.create(beginImportWithServiceResponseAsync(resourceGroupName, name, parameters), serviceCallback); + public ServiceCall beginImportDataAsync(String resourceGroupName, String name, ImportRDBParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginImportDataWithServiceResponseAsync(resourceGroupName, name, parameters), serviceCallback); } /** @@ -936,8 +1245,8 @@ public ServiceCall beginImportAsync(String resourceGroupName, String name, * @param parameters Parameters for redis import operation. * @return the {@link ServiceResponse} object if successful. */ - public Observable beginImportAsync(String resourceGroupName, String name, ImportRDBParametersInner parameters) { - return beginImportWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1, Void>() { + public Observable beginImportDataAsync(String resourceGroupName, String name, ImportRDBParametersInner parameters) { + return beginImportDataWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1, Void>() { @Override public Void call(ServiceResponse response) { return response.getBody(); @@ -953,7 +1262,7 @@ public Void call(ServiceResponse response) { * @param parameters Parameters for redis import operation. * @return the {@link ServiceResponse} object if successful. */ - public Observable> beginImportWithServiceResponseAsync(String resourceGroupName, String name, ImportRDBParametersInner parameters) { + public Observable> beginImportDataWithServiceResponseAsync(String resourceGroupName, String name, ImportRDBParametersInner parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -970,12 +1279,12 @@ public Observable> beginImportWithServiceResponseAsync(Str throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Validator.validate(parameters); - return service.beginImport(resourceGroupName, name, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + return service.beginImportData(resourceGroupName, name, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = beginImportDelegate(response); + ServiceResponse clientResponse = beginImportDataDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -984,7 +1293,7 @@ public Observable> call(Response response) { }); } - private ServiceResponse beginImportDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse beginImportDataDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .build(response); @@ -997,8 +1306,8 @@ private ServiceResponse beginImportDelegate(Response respons * @param name The name of the redis cache. * @param parameters Parameters for redis export operation. */ - public void export(String resourceGroupName, String name, ExportRDBParametersInner parameters) { - exportWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().last().getBody(); + public void exportData(String resourceGroupName, String name, ExportRDBParametersInner parameters) { + exportDataWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().last().getBody(); } /** @@ -1010,8 +1319,8 @@ public void export(String resourceGroupName, String name, ExportRDBParametersInn * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */ - public ServiceCall exportAsync(String resourceGroupName, String name, ExportRDBParametersInner parameters, final ServiceCallback serviceCallback) { - return ServiceCall.create(exportWithServiceResponseAsync(resourceGroupName, name, parameters), serviceCallback); + public ServiceCall exportDataAsync(String resourceGroupName, String name, ExportRDBParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceCall.create(exportDataWithServiceResponseAsync(resourceGroupName, name, parameters), serviceCallback); } /** @@ -1022,8 +1331,8 @@ public ServiceCall exportAsync(String resourceGroupName, String name, Expo * @param parameters Parameters for redis export operation. * @return the observable for the request */ - public Observable exportAsync(String resourceGroupName, String name, ExportRDBParametersInner parameters) { - return exportWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1, Void>() { + public Observable exportDataAsync(String resourceGroupName, String name, ExportRDBParametersInner parameters) { + return exportDataWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1, Void>() { @Override public Void call(ServiceResponse response) { return response.getBody(); @@ -1039,7 +1348,7 @@ public Void call(ServiceResponse response) { * @param parameters Parameters for redis export operation. * @return the observable for the request */ - public Observable> exportWithServiceResponseAsync(String resourceGroupName, String name, ExportRDBParametersInner parameters) { + public Observable> exportDataWithServiceResponseAsync(String resourceGroupName, String name, ExportRDBParametersInner parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -1056,7 +1365,7 @@ public Observable> exportWithServiceResponseAsync(String r throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Validator.validate(parameters); - Observable> observable = service.export(resourceGroupName, name, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + Observable> observable = service.exportData(resourceGroupName, name, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } @@ -1067,8 +1376,8 @@ public Observable> exportWithServiceResponseAsync(String r * @param name The name of the redis cache. * @param parameters Parameters for redis export operation. */ - public void beginExport(String resourceGroupName, String name, ExportRDBParametersInner parameters) { - beginExportWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().getBody(); + public void beginExportData(String resourceGroupName, String name, ExportRDBParametersInner parameters) { + beginExportDataWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().getBody(); } /** @@ -1080,8 +1389,8 @@ public void beginExport(String resourceGroupName, String name, ExportRDBParamete * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */ - public ServiceCall beginExportAsync(String resourceGroupName, String name, ExportRDBParametersInner parameters, final ServiceCallback serviceCallback) { - return ServiceCall.create(beginExportWithServiceResponseAsync(resourceGroupName, name, parameters), serviceCallback); + public ServiceCall beginExportDataAsync(String resourceGroupName, String name, ExportRDBParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginExportDataWithServiceResponseAsync(resourceGroupName, name, parameters), serviceCallback); } /** @@ -1092,8 +1401,8 @@ public ServiceCall beginExportAsync(String resourceGroupName, String name, * @param parameters Parameters for redis export operation. * @return the {@link ServiceResponse} object if successful. */ - public Observable beginExportAsync(String resourceGroupName, String name, ExportRDBParametersInner parameters) { - return beginExportWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1, Void>() { + public Observable beginExportDataAsync(String resourceGroupName, String name, ExportRDBParametersInner parameters) { + return beginExportDataWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1, Void>() { @Override public Void call(ServiceResponse response) { return response.getBody(); @@ -1109,7 +1418,7 @@ public Void call(ServiceResponse response) { * @param parameters Parameters for redis export operation. * @return the {@link ServiceResponse} object if successful. */ - public Observable> beginExportWithServiceResponseAsync(String resourceGroupName, String name, ExportRDBParametersInner parameters) { + public Observable> beginExportDataWithServiceResponseAsync(String resourceGroupName, String name, ExportRDBParametersInner parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -1126,12 +1435,12 @@ public Observable> beginExportWithServiceResponseAsync(Str throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Validator.validate(parameters); - return service.beginExport(resourceGroupName, name, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + return service.beginExportData(resourceGroupName, name, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = beginExportDelegate(response); + ServiceResponse clientResponse = beginExportDataDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1140,7 +1449,7 @@ public Observable> call(Response response) { }); } - private ServiceResponse beginExportDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse beginExportDataDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .build(response); diff --git a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisPatchSchedulesResponseInner.java b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisPatchScheduleInner.java similarity index 75% rename from azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisPatchSchedulesResponseInner.java rename to azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisPatchScheduleInner.java index 64bca8dc2c2dd..271369acdf062 100644 --- a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisPatchSchedulesResponseInner.java +++ b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisPatchScheduleInner.java @@ -9,6 +9,7 @@ package com.microsoft.azure.management.redis.implementation; import java.util.List; +import com.microsoft.azure.management.redis.ScheduleEntry; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; @@ -16,7 +17,7 @@ * Response to put/get patch schedules for redis cache. */ @JsonFlatten -public class RedisPatchSchedulesResponseInner { +public class RedisPatchScheduleInner { /** * Resource Id. */ @@ -38,13 +39,14 @@ public class RedisPatchSchedulesResponseInner { /** * Resource location. */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) private String location; /** * List of patch schedules for redis cache. */ @JsonProperty(value = "properties.scheduleEntries", required = true) - private List scheduleEntries; + private List scheduleEntries; /** * Get the id value. @@ -82,23 +84,12 @@ public String location() { return this.location; } - /** - * Set the location value. - * - * @param location the location value to set - * @return the RedisPatchSchedulesResponseInner object itself. - */ - public RedisPatchSchedulesResponseInner withLocation(String location) { - this.location = location; - return this; - } - /** * Get the scheduleEntries value. * * @return the scheduleEntries value */ - public List scheduleEntries() { + public List scheduleEntries() { return this.scheduleEntries; } @@ -106,9 +97,9 @@ public List scheduleEntries() { * Set the scheduleEntries value. * * @param scheduleEntries the scheduleEntries value to set - * @return the RedisPatchSchedulesResponseInner object itself. + * @return the RedisPatchScheduleInner object itself. */ - public RedisPatchSchedulesResponseInner withScheduleEntries(List scheduleEntries) { + public RedisPatchScheduleInner withScheduleEntries(List scheduleEntries) { this.scheduleEntries = scheduleEntries; return this; } diff --git a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisResourceInner.java b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisResourceInner.java index cc52f50e2b5bb..f987470e1af0b 100644 --- a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisResourceInner.java +++ b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisResourceInner.java @@ -8,8 +8,8 @@ package com.microsoft.azure.management.redis.implementation; -import com.microsoft.azure.management.redis.Sku; import java.util.Map; +import com.microsoft.azure.management.redis.Sku; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.Resource; @@ -20,17 +20,34 @@ @JsonFlatten public class RedisResourceInner extends Resource { /** - * RedisVersion parameter has been deprecated. As such, it is no longer - * necessary to provide this parameter and any value specified is ignored. + * Redis Version. */ - @JsonProperty(value = "properties.redisVersion") + @JsonProperty(value = "properties.redisVersion", access = JsonProperty.Access.WRITE_ONLY) private String redisVersion; /** - * What sku of redis cache to deploy. + * Redis instance provisioning status. */ - @JsonProperty(value = "properties.sku", required = true) - private Sku sku; + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Redis host name. + */ + @JsonProperty(value = "properties.hostName", access = JsonProperty.Access.WRITE_ONLY) + private String hostName; + + /** + * Redis non-ssl port. + */ + @JsonProperty(value = "properties.port", access = JsonProperty.Access.WRITE_ONLY) + private Integer port; + + /** + * Redis ssl port. + */ + @JsonProperty(value = "properties.sslPort", access = JsonProperty.Access.WRITE_ONLY) + private Integer sslPort; /** * All Redis Settings. Few possible keys: @@ -75,28 +92,10 @@ public class RedisResourceInner extends Resource { private String staticIP; /** - * Redis instance provisioning status. - */ - @JsonProperty(value = "properties.provisioningState") - private String provisioningState; - - /** - * Redis host name. - */ - @JsonProperty(value = "properties.hostName") - private String hostName; - - /** - * Redis non-ssl port. - */ - @JsonProperty(value = "properties.port") - private Integer port; - - /** - * Redis ssl port. + * What sku of redis cache to deploy. */ - @JsonProperty(value = "properties.sslPort") - private Integer sslPort; + @JsonProperty(value = "properties.sku", required = true) + private Sku sku; /** * Get the redisVersion value. @@ -108,34 +107,39 @@ public String redisVersion() { } /** - * Set the redisVersion value. + * Get the provisioningState value. * - * @param redisVersion the redisVersion value to set - * @return the RedisResourceInner object itself. + * @return the provisioningState value */ - public RedisResourceInner withRedisVersion(String redisVersion) { - this.redisVersion = redisVersion; - return this; + public String provisioningState() { + return this.provisioningState; } /** - * Get the sku value. + * Get the hostName value. * - * @return the sku value + * @return the hostName value */ - public Sku sku() { - return this.sku; + public String hostName() { + return this.hostName; } /** - * Set the sku value. + * Get the port value. * - * @param sku the sku value to set - * @return the RedisResourceInner object itself. + * @return the port value */ - public RedisResourceInner withSku(Sku sku) { - this.sku = sku; - return this; + public Integer port() { + return this.port; + } + + /** + * Get the sslPort value. + * + * @return the sslPort value + */ + public Integer sslPort() { + return this.sslPort; } /** @@ -259,82 +263,22 @@ public RedisResourceInner withStaticIP(String staticIP) { } /** - * Get the provisioningState value. - * - * @return the provisioningState value - */ - public String provisioningState() { - return this.provisioningState; - } - - /** - * Set the provisioningState value. - * - * @param provisioningState the provisioningState value to set - * @return the RedisResourceInner object itself. - */ - public RedisResourceInner withProvisioningState(String provisioningState) { - this.provisioningState = provisioningState; - return this; - } - - /** - * Get the hostName value. - * - * @return the hostName value - */ - public String hostName() { - return this.hostName; - } - - /** - * Set the hostName value. - * - * @param hostName the hostName value to set - * @return the RedisResourceInner object itself. - */ - public RedisResourceInner withHostName(String hostName) { - this.hostName = hostName; - return this; - } - - /** - * Get the port value. - * - * @return the port value - */ - public Integer port() { - return this.port; - } - - /** - * Set the port value. - * - * @param port the port value to set - * @return the RedisResourceInner object itself. - */ - public RedisResourceInner withPort(Integer port) { - this.port = port; - return this; - } - - /** - * Get the sslPort value. + * Get the sku value. * - * @return the sslPort value + * @return the sku value */ - public Integer sslPort() { - return this.sslPort; + public Sku sku() { + return this.sku; } /** - * Set the sslPort value. + * Set the sku value. * - * @param sslPort the sslPort value to set + * @param sku the sku value to set * @return the RedisResourceInner object itself. */ - public RedisResourceInner withSslPort(Integer sslPort) { - this.sslPort = sslPort; + public RedisResourceInner withSku(Sku sku) { + this.sku = sku; return this; } diff --git a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisResourceWithAccessKeyInner.java b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisResourceWithAccessKeyInner.java deleted file mode 100644 index cb4722befac30..0000000000000 --- a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisResourceWithAccessKeyInner.java +++ /dev/null @@ -1,368 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - */ - -package com.microsoft.azure.management.redis.implementation; - -import com.microsoft.azure.management.redis.Sku; -import java.util.Map; -import com.microsoft.azure.management.redis.RedisAccessKeys; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.microsoft.rest.serializer.JsonFlatten; -import com.microsoft.azure.Resource; - -/** - * A redis item in CreateOrUpdate Operation response. - */ -@JsonFlatten -public class RedisResourceWithAccessKeyInner extends Resource { - /** - * RedisVersion parameter has been deprecated. As such, it is no longer - * necessary to provide this parameter and any value specified is ignored. - */ - @JsonProperty(value = "properties.redisVersion") - private String redisVersion; - - /** - * What sku of redis cache to deploy. - */ - @JsonProperty(value = "properties.sku", required = true) - private Sku sku; - - /** - * All Redis Settings. Few possible keys: - * rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value - * etc. - */ - @JsonProperty(value = "properties.redisConfiguration") - private Map redisConfiguration; - - /** - * If the value is true, then the non-ssl redis server port (6379) will be - * enabled. - */ - @JsonProperty(value = "properties.enableNonSslPort") - private Boolean enableNonSslPort; - - /** - * tenantSettings. - */ - @JsonProperty(value = "properties.tenantSettings") - private Map tenantSettings; - - /** - * The number of shards to be created on a Premium Cluster Cache. - */ - @JsonProperty(value = "properties.shardCount") - private Integer shardCount; - - /** - * The full resource ID of a subnet in a virtual network to deploy the - * redis cache in. Example format: - * /subscriptions/{subid}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. - */ - @JsonProperty(value = "properties.subnetId") - private String subnetId; - - /** - * Required when deploying a redis cache inside an existing Azure Virtual - * Network. - */ - @JsonProperty(value = "properties.staticIP") - private String staticIP; - - /** - * Redis instance provisioning status. - */ - @JsonProperty(value = "properties.provisioningState") - private String provisioningState; - - /** - * Redis host name. - */ - @JsonProperty(value = "properties.hostName") - private String hostName; - - /** - * Redis non-ssl port. - */ - @JsonProperty(value = "properties.port") - private Integer port; - - /** - * Redis ssl port. - */ - @JsonProperty(value = "properties.sslPort") - private Integer sslPort; - - /** - * Redis cache access keys. - */ - @JsonProperty(value = "properties.accessKeys") - private RedisAccessKeys accessKeys; - - /** - * Get the redisVersion value. - * - * @return the redisVersion value - */ - public String redisVersion() { - return this.redisVersion; - } - - /** - * Set the redisVersion value. - * - * @param redisVersion the redisVersion value to set - * @return the RedisResourceWithAccessKeyInner object itself. - */ - public RedisResourceWithAccessKeyInner withRedisVersion(String redisVersion) { - this.redisVersion = redisVersion; - return this; - } - - /** - * Get the sku value. - * - * @return the sku value - */ - public Sku sku() { - return this.sku; - } - - /** - * Set the sku value. - * - * @param sku the sku value to set - * @return the RedisResourceWithAccessKeyInner object itself. - */ - public RedisResourceWithAccessKeyInner withSku(Sku sku) { - this.sku = sku; - return this; - } - - /** - * Get the redisConfiguration value. - * - * @return the redisConfiguration value - */ - public Map redisConfiguration() { - return this.redisConfiguration; - } - - /** - * Set the redisConfiguration value. - * - * @param redisConfiguration the redisConfiguration value to set - * @return the RedisResourceWithAccessKeyInner object itself. - */ - public RedisResourceWithAccessKeyInner withRedisConfiguration(Map redisConfiguration) { - this.redisConfiguration = redisConfiguration; - return this; - } - - /** - * Get the enableNonSslPort value. - * - * @return the enableNonSslPort value - */ - public Boolean enableNonSslPort() { - return this.enableNonSslPort; - } - - /** - * Set the enableNonSslPort value. - * - * @param enableNonSslPort the enableNonSslPort value to set - * @return the RedisResourceWithAccessKeyInner object itself. - */ - public RedisResourceWithAccessKeyInner withEnableNonSslPort(Boolean enableNonSslPort) { - this.enableNonSslPort = enableNonSslPort; - return this; - } - - /** - * Get the tenantSettings value. - * - * @return the tenantSettings value - */ - public Map tenantSettings() { - return this.tenantSettings; - } - - /** - * Set the tenantSettings value. - * - * @param tenantSettings the tenantSettings value to set - * @return the RedisResourceWithAccessKeyInner object itself. - */ - public RedisResourceWithAccessKeyInner withTenantSettings(Map tenantSettings) { - this.tenantSettings = tenantSettings; - return this; - } - - /** - * Get the shardCount value. - * - * @return the shardCount value - */ - public Integer shardCount() { - return this.shardCount; - } - - /** - * Set the shardCount value. - * - * @param shardCount the shardCount value to set - * @return the RedisResourceWithAccessKeyInner object itself. - */ - public RedisResourceWithAccessKeyInner withShardCount(Integer shardCount) { - this.shardCount = shardCount; - return this; - } - - /** - * Get the subnetId value. - * - * @return the subnetId value - */ - public String subnetId() { - return this.subnetId; - } - - /** - * Set the subnetId value. - * - * @param subnetId the subnetId value to set - * @return the RedisResourceWithAccessKeyInner object itself. - */ - public RedisResourceWithAccessKeyInner withSubnetId(String subnetId) { - this.subnetId = subnetId; - return this; - } - - /** - * Get the staticIP value. - * - * @return the staticIP value - */ - public String staticIP() { - return this.staticIP; - } - - /** - * Set the staticIP value. - * - * @param staticIP the staticIP value to set - * @return the RedisResourceWithAccessKeyInner object itself. - */ - public RedisResourceWithAccessKeyInner withStaticIP(String staticIP) { - this.staticIP = staticIP; - return this; - } - - /** - * Get the provisioningState value. - * - * @return the provisioningState value - */ - public String provisioningState() { - return this.provisioningState; - } - - /** - * Set the provisioningState value. - * - * @param provisioningState the provisioningState value to set - * @return the RedisResourceWithAccessKeyInner object itself. - */ - public RedisResourceWithAccessKeyInner withProvisioningState(String provisioningState) { - this.provisioningState = provisioningState; - return this; - } - - /** - * Get the hostName value. - * - * @return the hostName value - */ - public String hostName() { - return this.hostName; - } - - /** - * Set the hostName value. - * - * @param hostName the hostName value to set - * @return the RedisResourceWithAccessKeyInner object itself. - */ - public RedisResourceWithAccessKeyInner withHostName(String hostName) { - this.hostName = hostName; - return this; - } - - /** - * Get the port value. - * - * @return the port value - */ - public Integer port() { - return this.port; - } - - /** - * Set the port value. - * - * @param port the port value to set - * @return the RedisResourceWithAccessKeyInner object itself. - */ - public RedisResourceWithAccessKeyInner withPort(Integer port) { - this.port = port; - return this; - } - - /** - * Get the sslPort value. - * - * @return the sslPort value - */ - public Integer sslPort() { - return this.sslPort; - } - - /** - * Set the sslPort value. - * - * @param sslPort the sslPort value to set - * @return the RedisResourceWithAccessKeyInner object itself. - */ - public RedisResourceWithAccessKeyInner withSslPort(Integer sslPort) { - this.sslPort = sslPort; - return this; - } - - /** - * Get the accessKeys value. - * - * @return the accessKeys value - */ - public RedisAccessKeys accessKeys() { - return this.accessKeys; - } - - /** - * Set the accessKeys value. - * - * @param accessKeys the accessKeys value to set - * @return the RedisResourceWithAccessKeyInner object itself. - */ - public RedisResourceWithAccessKeyInner withAccessKeys(RedisAccessKeys accessKeys) { - this.accessKeys = accessKeys; - return this; - } - -} diff --git a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisCreateOrUpdateParametersInner.java b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisUpdateParametersInner.java similarity index 68% rename from azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisCreateOrUpdateParametersInner.java rename to azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisUpdateParametersInner.java index a014a5b67b5e7..2c01bebc8eeaa 100644 --- a/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisCreateOrUpdateParametersInner.java +++ b/azure-mgmt-redis/src/main/java/com/microsoft/azure/management/redis/implementation/RedisUpdateParametersInner.java @@ -8,30 +8,16 @@ package com.microsoft.azure.management.redis.implementation; -import com.microsoft.azure.management.redis.Sku; import java.util.Map; +import com.microsoft.azure.management.redis.Sku; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; -import com.microsoft.azure.Resource; /** - * Parameters supplied to the CreateOrUpdate Redis operation. + * Parameters supplied to the Update Redis operation. */ @JsonFlatten -public class RedisCreateOrUpdateParametersInner extends Resource { - /** - * RedisVersion parameter has been deprecated. As such, it is no longer - * necessary to provide this parameter and any value specified is ignored. - */ - @JsonProperty(value = "properties.redisVersion") - private String redisVersion; - - /** - * What sku of redis cache to deploy. - */ - @JsonProperty(value = "properties.sku", required = true) - private Sku sku; - +public class RedisUpdateParametersInner { /** * All Redis Settings. Few possible keys: * rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value @@ -75,44 +61,22 @@ public class RedisCreateOrUpdateParametersInner extends Resource { private String staticIP; /** - * Get the redisVersion value. - * - * @return the redisVersion value - */ - public String redisVersion() { - return this.redisVersion; - } - - /** - * Set the redisVersion value. - * - * @param redisVersion the redisVersion value to set - * @return the RedisCreateOrUpdateParametersInner object itself. + * What sku of redis cache to deploy. */ - public RedisCreateOrUpdateParametersInner withRedisVersion(String redisVersion) { - this.redisVersion = redisVersion; - return this; - } + @JsonProperty(value = "properties.sku") + private Sku sku; /** - * Get the sku value. - * - * @return the sku value + * Resource location. */ - public Sku sku() { - return this.sku; - } + @JsonProperty(value = "properties.location") + private String location; /** - * Set the sku value. - * - * @param sku the sku value to set - * @return the RedisCreateOrUpdateParametersInner object itself. + * Resource tags. */ - public RedisCreateOrUpdateParametersInner withSku(Sku sku) { - this.sku = sku; - return this; - } + @JsonProperty(value = "properties.tags") + private Map tags; /** * Get the redisConfiguration value. @@ -127,9 +91,9 @@ public Map redisConfiguration() { * Set the redisConfiguration value. * * @param redisConfiguration the redisConfiguration value to set - * @return the RedisCreateOrUpdateParametersInner object itself. + * @return the RedisUpdateParametersInner object itself. */ - public RedisCreateOrUpdateParametersInner withRedisConfiguration(Map redisConfiguration) { + public RedisUpdateParametersInner withRedisConfiguration(Map redisConfiguration) { this.redisConfiguration = redisConfiguration; return this; } @@ -147,9 +111,9 @@ public Boolean enableNonSslPort() { * Set the enableNonSslPort value. * * @param enableNonSslPort the enableNonSslPort value to set - * @return the RedisCreateOrUpdateParametersInner object itself. + * @return the RedisUpdateParametersInner object itself. */ - public RedisCreateOrUpdateParametersInner withEnableNonSslPort(Boolean enableNonSslPort) { + public RedisUpdateParametersInner withEnableNonSslPort(Boolean enableNonSslPort) { this.enableNonSslPort = enableNonSslPort; return this; } @@ -167,9 +131,9 @@ public Map tenantSettings() { * Set the tenantSettings value. * * @param tenantSettings the tenantSettings value to set - * @return the RedisCreateOrUpdateParametersInner object itself. + * @return the RedisUpdateParametersInner object itself. */ - public RedisCreateOrUpdateParametersInner withTenantSettings(Map tenantSettings) { + public RedisUpdateParametersInner withTenantSettings(Map tenantSettings) { this.tenantSettings = tenantSettings; return this; } @@ -187,9 +151,9 @@ public Integer shardCount() { * Set the shardCount value. * * @param shardCount the shardCount value to set - * @return the RedisCreateOrUpdateParametersInner object itself. + * @return the RedisUpdateParametersInner object itself. */ - public RedisCreateOrUpdateParametersInner withShardCount(Integer shardCount) { + public RedisUpdateParametersInner withShardCount(Integer shardCount) { this.shardCount = shardCount; return this; } @@ -207,9 +171,9 @@ public String subnetId() { * Set the subnetId value. * * @param subnetId the subnetId value to set - * @return the RedisCreateOrUpdateParametersInner object itself. + * @return the RedisUpdateParametersInner object itself. */ - public RedisCreateOrUpdateParametersInner withSubnetId(String subnetId) { + public RedisUpdateParametersInner withSubnetId(String subnetId) { this.subnetId = subnetId; return this; } @@ -227,11 +191,71 @@ public String staticIP() { * Set the staticIP value. * * @param staticIP the staticIP value to set - * @return the RedisCreateOrUpdateParametersInner object itself. + * @return the RedisUpdateParametersInner object itself. */ - public RedisCreateOrUpdateParametersInner withStaticIP(String staticIP) { + public RedisUpdateParametersInner withStaticIP(String staticIP) { this.staticIP = staticIP; return this; } + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the RedisUpdateParametersInner object itself. + */ + public RedisUpdateParametersInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the RedisUpdateParametersInner object itself. + */ + public RedisUpdateParametersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the RedisUpdateParametersInner object itself. + */ + public RedisUpdateParametersInner withTags(Map tags) { + this.tags = tags; + return this; + } + } From 465d6a1061eb851959bf8cad173a759d2c8fb565 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 15 Sep 2016 18:10:44 -0700 Subject: [PATCH 17/21] renaming `NicIpConfiguration#publicIpAddress()` as `getPublicIpAddress()` because this is a separate method call to Azure, not a property of the NIC IP config. --- .../azure/management/network/NicIpConfiguration.java | 6 +----- .../network/implementation/NetworkInterfaceImpl.java | 2 +- .../network/implementation/NicIpConfigurationImpl.java | 5 ++--- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NicIpConfiguration.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NicIpConfiguration.java index 6b3d44b9e9876..e4c640fc64b55 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NicIpConfiguration.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NicIpConfiguration.java @@ -27,13 +27,9 @@ public interface NicIpConfiguration extends String publicIpAddressId(); /** - * Gets the public IP address associated with this IP configuration. - *

- * This method makes a rest API call to fetch the public IP. - * * @return the public IP associated with this IP configuration or null if there is no public IP associated */ - PublicIpAddress publicIpAddress(); + PublicIpAddress getPublicIpAddress(); /** * @return the resource id of the virtual network subnet associated with this IP configuration. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java index 00b63b273f1b6..703c1dc91f32e 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java @@ -287,7 +287,7 @@ public List dnsServers() { @Override public PublicIpAddress primaryPublicIpAddress() { if (this.primaryPublicIp == null) { - this.primaryPublicIp = this.primaryIpConfiguration().publicIpAddress(); + this.primaryPublicIp = this.primaryIpConfiguration().getPublicIpAddress(); } return primaryPublicIp; } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java index 8f9b825122352..647c3b94e0829 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java @@ -90,14 +90,13 @@ public String publicIpAddressId() { } @Override - public PublicIpAddress publicIpAddress() { + public PublicIpAddress getPublicIpAddress() { String id = publicIpAddressId(); if (id == null) { return null; } - return this.networkManager.publicIpAddresses().getByGroup( - ResourceUtils.groupFromResourceId(id), ResourceUtils.nameFromResourceId(id)); + return this.networkManager.publicIpAddresses().getById(id); } @Override From 1e3c84bba85b2df1815cfedc7e35a16a649a1e14 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 15 Sep 2016 18:56:29 -0700 Subject: [PATCH 18/21] support for privateIpAddressVersion() on NIC IP configuration (new Networking feature) --- .../network/NicIpConfiguration.java | 23 +++++++++++++++++++ .../NicIpConfigurationImpl.java | 12 ++++++++++ .../microsoft/azure/TestNetworkInterface.java | 3 ++- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NicIpConfiguration.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NicIpConfiguration.java index e4c640fc64b55..8bb51cca2570b 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NicIpConfiguration.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NicIpConfiguration.java @@ -45,6 +45,11 @@ public interface NicIpConfiguration extends */ Network network(); + /** + * @return private IP address version + */ + IPVersion privateIpAddressVersion(); + // Setters (fluent) /** @@ -130,6 +135,12 @@ interface WithNetwork { * @param the return type of the final {@link Attachable#attach()} */ interface WithPrivateIp extends HasPrivateIpAddress.DefinitionStages.WithPrivateIpAddress> { + /** + * Specifies the IP version for the private IP address. + * @param ipVersion an IP version + * @return the next stage of the definition + */ + WithAttach withPrivateIpVersion(IPVersion ipVersion); } /** @@ -290,6 +301,12 @@ interface WithNetwork { * @param the return type of the final {@link Attachable#attach()} */ interface WithPrivateIp extends HasPrivateIpAddress.UpdateDefinitionStages.WithPrivateIpAddress> { + /** + * Specifies the IP version for the private IP address. + * @param ipVersion an IP version + * @return the next stage of the definition + */ + WithAttach withPrivateIpVersion(IPVersion ipVersion); } /** @@ -403,6 +420,12 @@ interface WithSubnet { * The stage of the network interface IP configuration update allowing to specify private IP. */ interface WithPrivateIp extends HasPrivateIpAddress.UpdateStages.WithPrivateIpAddress { + /** + * Specifies the IP version for the private IP address. + * @param ipVersion an IP version + * @return the next stage of the update + */ + Update withPrivateIpVersion(IPVersion ipVersion); } /** diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java index 647c3b94e0829..552cbf94cc541 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java @@ -3,6 +3,7 @@ import com.microsoft.azure.SubResource; import com.microsoft.azure.management.apigeneration.LangDefinition; import com.microsoft.azure.management.network.IPAllocationMethod; +import com.microsoft.azure.management.network.IPVersion; import com.microsoft.azure.management.network.LoadBalancer; import com.microsoft.azure.management.network.Network; import com.microsoft.azure.management.network.NetworkInterface; @@ -81,6 +82,11 @@ public String name() { return inner().name(); } + @Override + public IPVersion privateIpAddressVersion() { + return this.inner().privateIPAddressVersion(); + } + @Override public String publicIpAddressId() { if (this.inner().publicIPAddress() == null) { @@ -336,4 +342,10 @@ private SubResource publicIpToAssociate() { } return null; } + + @Override + public NicIpConfigurationImpl withPrivateIpVersion(IPVersion ipVersion) { + this.inner().withPrivateIPAddressVersion(ipVersion); + return this; + } } diff --git a/azure/src/test/java/com/microsoft/azure/TestNetworkInterface.java b/azure/src/test/java/com/microsoft/azure/TestNetworkInterface.java index f289d149cb716..0ae873a569186 100644 --- a/azure/src/test/java/com/microsoft/azure/TestNetworkInterface.java +++ b/azure/src/test/java/com/microsoft/azure/TestNetworkInterface.java @@ -73,7 +73,8 @@ public void print(NetworkInterface resource) { for (NicIpConfiguration ipConfig : resource.ipConfigurations().values()) { info.append("\n\t\tName: ").append(ipConfig.name()) .append("\n\t\tPrivate IP: ").append(ipConfig.privateIpAddress()) - .append("\n\t\tPrivate IP allocation method: ").append(ipConfig.privateIpAllocationMethod()) + .append("\n\t\tPrivate IP allocation method: ").append(ipConfig.privateIpAllocationMethod().toString()) + .append("\n\t\tPrivate IP version: ").append(ipConfig.privateIpAddressVersion().toString()) .append("\n\t\tPIP id: ").append(ipConfig.publicIpAddressId()) .append("\n\t\tSubnet ID: ").append(ipConfig.subnetId()); } From f03f1bc782d7ec127192a17b0ae7784006012b04 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 15 Sep 2016 19:03:28 -0700 Subject: [PATCH 19/21] renaming NicIpConfiguration#network() to getNetwork() because it's a method call to Azure, not a direct property of the NIC IP config --- .../azure/management/network/NicIpConfiguration.java | 6 +----- .../network/implementation/NetworkInterfaceImpl.java | 2 +- .../network/implementation/NicIpConfigurationImpl.java | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NicIpConfiguration.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NicIpConfiguration.java index 8bb51cca2570b..2bc722b22f857 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NicIpConfiguration.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NicIpConfiguration.java @@ -37,13 +37,9 @@ public interface NicIpConfiguration extends String subnetId(); /** - * Gets the virtual network associated with this IP configuration. - *

- * This method makes a rest API call to fetch the public IP. - * * @return the virtual network associated with this this IP configuration. */ - Network network(); + Network getNetwork(); /** * @return private IP address version diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java index 703c1dc91f32e..f96daad74c7c0 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java @@ -300,7 +300,7 @@ public String primarySubnetId() { @Override public Network primaryNetwork() { if (this.primaryNetwork == null) { - this.primaryNetwork = this.primaryIpConfiguration().network(); + this.primaryNetwork = this.primaryIpConfiguration().getNetwork(); } return this.primaryNetwork; } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java index 552cbf94cc541..dfee7acc92326 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java @@ -111,7 +111,7 @@ public String subnetId() { } @Override - public Network network() { + public Network getNetwork() { String id = subnetId(); return this.networkManager.networks().getByGroup(ResourceUtils.groupFromResourceId(id), ResourceUtils.extractFromResourceId(id, "virtualNetworks")); From 5d2e6ab74f25d3988af595bdce31543707facf4d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 15 Sep 2016 20:16:11 -0700 Subject: [PATCH 20/21] support for NetworkSecurityGroup#listAssociatedSubnets() --- .../network/NetworkSecurityGroup.java | 5 ++++ .../NetworkSecurityGroupImpl.java | 27 +++++++++++++++++++ .../java/com/microsoft/azure/TestNSG.java | 27 ++++++++++++++++--- .../java/com/microsoft/azure/TestNetwork.java | 11 +++++++- 4 files changed, 66 insertions(+), 4 deletions(-) diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroup.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroup.java index 5f4cc42c0643c..936b9b996633d 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroup.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroup.java @@ -47,6 +47,11 @@ public interface NetworkSecurityGroup extends */ List networkInterfaceIds(); + /** + * @return virtual networks associated with this security group, + * indexed by the names of the specific subnets referencing this security group + */ + List listAssociatedSubnets(); // Fluent interfaces for creating NSGs diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkSecurityGroupImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkSecurityGroupImpl.java index c12a3656792de..14833e8d68c6e 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkSecurityGroupImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkSecurityGroupImpl.java @@ -6,13 +6,17 @@ package com.microsoft.azure.management.network.implementation; import com.microsoft.azure.management.apigeneration.LangDefinition; +import com.microsoft.azure.management.network.Network; import com.microsoft.azure.management.network.NetworkSecurityGroup; import com.microsoft.azure.management.network.NetworkSecurityRule; +import com.microsoft.azure.management.network.Subnet; +import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils; import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.GroupableParentResourceImpl; import rx.Observable; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -92,6 +96,29 @@ public Observable applyUpdateAsync() { return createResourceAsync(); } + @Override + public List listAssociatedSubnets() { + final List subnetRefs = this.inner().subnets(); + final Map networks = new HashMap<>(); + final List subnets = new ArrayList<>(); + + if (subnetRefs != null) { + for (SubnetInner subnetRef : subnetRefs) { + String networkId = ResourceUtils.parentResourcePathFromResourceId(subnetRef.id()); + Network network = networks.get(networkId); + if (network == null) { + network = this.myManager.networks().getById(networkId); + networks.put(networkId, network); + } + + String subnetName = ResourceUtils.nameFromResourceId(subnetRef.id()); + subnets.add(network.subnets().get(subnetName)); + } + } + + return subnets; + } + // Setters (fluent) @Override diff --git a/azure/src/test/java/com/microsoft/azure/TestNSG.java b/azure/src/test/java/com/microsoft/azure/TestNSG.java index d29c555db7846..427f53434c812 100644 --- a/azure/src/test/java/com/microsoft/azure/TestNSG.java +++ b/azure/src/test/java/com/microsoft/azure/TestNSG.java @@ -11,8 +11,12 @@ import com.microsoft.azure.management.network.NetworkSecurityGroups; import com.microsoft.azure.management.network.NetworkSecurityRule; import com.microsoft.azure.management.network.SecurityRuleProtocol; +import com.microsoft.azure.management.network.Subnet; import com.microsoft.azure.management.resources.fluentcore.arm.Region; import okhttp3.logging.HttpLoggingInterceptor; + +import java.util.List; + import org.junit.Assert; import org.junit.Test; import rx.Subscriber; @@ -102,7 +106,7 @@ public NetworkSecurityGroup updateResource(NetworkSecurityGroup resource) throws return resource; } - private StringBuilder printRule(NetworkSecurityRule rule, StringBuilder info) { + private static StringBuilder printRule(NetworkSecurityRule rule, StringBuilder info) { info.append("\n\t\tRule: ").append(rule.name()) .append("\n\t\t\tAccess: ").append(rule.access()) .append("\n\t\t\tDirection: ").append(rule.direction()) @@ -116,8 +120,7 @@ private StringBuilder printRule(NetworkSecurityRule rule, StringBuilder info) { return info; } - @Override - public void print(NetworkSecurityGroup resource) { + public static void printNSG(NetworkSecurityGroup resource) { StringBuilder info = new StringBuilder(); info.append("NSG: ").append(resource.id()) .append("Name: ").append(resource.name()) @@ -137,11 +140,29 @@ public void print(NetworkSecurityGroup resource) { info = printRule(rule, info); } + // Output associated NIC IDs info.append("\n\tNICs: ").append(resource.networkInterfaceIds()); + // Output associated subnets + info.append("\n\tAssociated subnets: "); + List subnets = resource.listAssociatedSubnets(); + if (subnets == null || subnets.size() == 0) { + info.append("(None)"); + } else { + for (Subnet subnet : subnets) { + info.append("\n\t\tNetwork ID: ").append(subnet.parent().id()) + .append("\n\t\tSubnet name: ").append(subnet.name()); + } + } + System.out.println(info.toString()); } + @Override + public void print(NetworkSecurityGroup resource) { + printNSG(resource); + } + @Test public void run() throws Exception { ApplicationTokenCredentials credentials = new ApplicationTokenCredentials( diff --git a/azure/src/test/java/com/microsoft/azure/TestNetwork.java b/azure/src/test/java/com/microsoft/azure/TestNetwork.java index 09245becc922b..d04cdbc130e10 100644 --- a/azure/src/test/java/com/microsoft/azure/TestNetwork.java +++ b/azure/src/test/java/com/microsoft/azure/TestNetwork.java @@ -5,6 +5,8 @@ */ package com.microsoft.azure; +import java.util.List; + import org.junit.Assert; import com.microsoft.azure.management.network.Network; @@ -37,7 +39,7 @@ public Network createResource(Networks networks) throws Exception { .create(); // Create a network - return networks.define(newName) + final Network network = networks.define(newName) .withRegion(region) .withNewResourceGroup(groupName) .withAddressSpace("10.0.0.0/28") @@ -47,6 +49,13 @@ public Network createResource(Networks networks) throws Exception { .withExistingNetworkSecurityGroup(nsg) .attach() .create(); + + List subnets = nsg.refresh().listAssociatedSubnets(); + Assert.assertTrue(subnets.size() == 1); + Subnet subnet = subnets.get(0); + Assert.assertTrue(subnet.name().equalsIgnoreCase("subnetB")); + Assert.assertTrue(subnet.parent().name().equalsIgnoreCase(newName)); + return network; } @Override From fe116edf73201648062d4c028e474983f30fc836 Mon Sep 17 00:00:00 2001 From: Anudeep Sharma Date: Thu, 15 Sep 2016 16:29:00 -0700 Subject: [PATCH 21/21] Added annotations for Batch --- azure-mgmt-batch/pom.xml | 23 +++++++++++++++++++ .../azure/management/batch/BatchAccount.java | 11 +++++++++ .../management/batch/BatchAccountKeys.java | 5 +++- .../azure/management/batch/BatchAccounts.java | 2 ++ .../implementation/BatchAccountImpl.java | 2 ++ .../implementation/BatchAccountsImpl.java | 2 ++ .../batch/implementation/BatchManager.java | 2 +- 7 files changed, 45 insertions(+), 2 deletions(-) diff --git a/azure-mgmt-batch/pom.xml b/azure-mgmt-batch/pom.xml index b85dcd5018f22..0ccc35671bad4 100644 --- a/azure-mgmt-batch/pom.xml +++ b/azure-mgmt-batch/pom.xml @@ -72,6 +72,11 @@ azure-mgmt-storage 1.0.0-SNAPSHOT + + com.microsoft.azure + api-annotations + 0.0.1-SNAPSHOT + @@ -116,6 +121,24 @@ + + org.apache.maven.plugins + maven-compiler-plugin + 3.0 + + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + true + true + + true + true + + + + diff --git a/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccount.java b/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccount.java index 98e7848fdb3e8..028b6278e3d1a 100644 --- a/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccount.java +++ b/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccount.java @@ -6,6 +6,9 @@ package com.microsoft.azure.management.batch; +import com.microsoft.azure.management.apigeneration.LangDefinition; +import com.microsoft.azure.management.apigeneration.LangMethodDefinition; +import com.microsoft.azure.management.apigeneration.LangMethodDefinition.LangMethodType; import com.microsoft.azure.management.batch.implementation.AccountResourceInner; import com.microsoft.azure.management.resources.fluentcore.arm.models.GroupableResource; import com.microsoft.azure.management.resources.fluentcore.arm.models.Resource; @@ -19,6 +22,7 @@ /** * An immutable client-side representation of an Azure batch account. */ +@LangDefinition(ContainerName = "~/") public interface BatchAccount extends GroupableResource, Refreshable, @@ -60,11 +64,13 @@ public interface BatchAccount extends /** * @return the access keys for this batch account */ + @LangMethodDefinition(AsType = LangMethodType.Method) BatchAccountKeys keys(); /** * @return the access keys for this batch account */ + @LangMethodDefinition(AsType = LangMethodType.Method) BatchAccountKeys refreshKeys(); /** @@ -73,6 +79,7 @@ public interface BatchAccount extends * @param keyType either primary or secondary key to be regenerated * @return the access keys for this batch account */ + @LangMethodDefinition(AsType = LangMethodType.Method) BatchAccountKeys regenerateKeys(AccountKeyType keyType); /** @@ -87,6 +94,7 @@ public interface BatchAccount extends /** * Container interface for all the definitions that need to be implemented. */ + @LangDefinition(ContainerName = "~/BatchAccount.Definition") interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, @@ -96,6 +104,7 @@ interface Definition extends /** * Grouping of all the storage account definition stages. */ + @LangDefinition(ContainerName = "~/BatchAccount.Definition", ContainerFileName = "IDefinition", IsContainerOnly = true) interface DefinitionStages { /** * The first stage of the batch account definition. @@ -147,6 +156,7 @@ interface WithCreate extends /** * The template for a storage account update operation, containing all the settings that can be modified. */ + @LangDefinition(ContainerName = "~/BatchAccount.Update") interface Update extends Appliable, Resource.UpdateWithTags, @@ -156,6 +166,7 @@ interface Update extends /** * Grouping of all the storage account update stages. */ + @LangDefinition(ContainerName = "~/BatchAccount.Update", ContainerFileName = "IUpdate", IsContainerOnly = true) interface UpdateStages { /** * The stage of the batch account update definition allowing to specify storage account. diff --git a/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccountKeys.java b/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccountKeys.java index 395d3365360b7..22d765f49afb9 100644 --- a/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccountKeys.java +++ b/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccountKeys.java @@ -1,8 +1,11 @@ package com.microsoft.azure.management.batch; +import com.microsoft.azure.management.apigeneration.LangDefinition; + /** - * Created by ans on 9/13/2016. + * This class represents the access keys for the batch account. */ +@LangDefinition public class BatchAccountKeys { /** * The primary key associated with the account. diff --git a/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccounts.java b/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccounts.java index 128e536515738..f6dd57abcb450 100644 --- a/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccounts.java +++ b/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccounts.java @@ -1,5 +1,6 @@ package com.microsoft.azure.management.batch; +import com.microsoft.azure.management.apigeneration.LangDefinition; import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsDeletingByGroup; import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingByGroup; import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; @@ -12,6 +13,7 @@ /** * Entry point to batch account management API. */ +@LangDefinition(ContainerName = "~/") public interface BatchAccounts extends SupportsCreating, SupportsListing, diff --git a/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchAccountImpl.java b/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchAccountImpl.java index 8dd6da9db9edd..da0b1b5f64994 100644 --- a/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchAccountImpl.java +++ b/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchAccountImpl.java @@ -1,5 +1,6 @@ package com.microsoft.azure.management.batch.implementation; +import com.microsoft.azure.management.apigeneration.LangDefinition; import com.microsoft.azure.management.batch.AccountKeyType; import com.microsoft.azure.management.batch.AccountProvisioningState; import com.microsoft.azure.management.batch.AutoStorageBaseProperties; @@ -16,6 +17,7 @@ /** * Implementation for BatchAccount and its parent interfaces. */ +@LangDefinition public class BatchAccountImpl extends GroupableResourceImpl< diff --git a/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchAccountsImpl.java b/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchAccountsImpl.java index 335c20ada689c..29f91e147749c 100644 --- a/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchAccountsImpl.java +++ b/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchAccountsImpl.java @@ -1,6 +1,7 @@ package com.microsoft.azure.management.batch.implementation; import com.microsoft.azure.PagedList; +import com.microsoft.azure.management.apigeneration.LangDefinition; import com.microsoft.azure.management.batch.BatchAccount; import com.microsoft.azure.management.batch.BatchAccounts; import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils; @@ -10,6 +11,7 @@ /** * Implementation for BatchAccounts and its parent interfaces. */ +@LangDefinition public class BatchAccountsImpl extends GroupableResourcesImpl implements BatchAccounts { diff --git a/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchManager.java b/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchManager.java index 47d4344ee006d..cae261798119d 100644 --- a/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchManager.java +++ b/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchManager.java @@ -10,7 +10,7 @@ import com.microsoft.rest.credentials.ServiceClientCredentials; /** - * Entry point to Azure batch account resource management. + * Entry point to Azure Batch Account resource management. */ public class BatchManager extends Manager {