Skip to content

Commit

Permalink
Merge pull request #905 from martinsawicki/martin-internals
Browse files Browse the repository at this point in the history
Replacing references to Foo.*.WithCreate with Creatable<Foo>
  • Loading branch information
anuchandy authored Jun 26, 2016
2 parents 1708eef + 88da124 commit 12014ce
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ interface WithNetwork extends WithPrimaryNetworkInterface {
* @param creatable a creatable definition for a new virtual network
* @return the next stage of the virtual machine definition
*/
WithPrivateIp withNewPrimaryNetwork(Network.DefinitionStages.WithCreate creatable);
WithPrivateIp withNewPrimaryNetwork(Creatable<Network> creatable);

/**
* Creates a new virtual network to associate with the virtual machine's primary network interface.
Expand Down Expand Up @@ -394,7 +394,7 @@ interface WithPublicIpAddress {
* @param creatable a creatable definition for a new public IP
* @return the next stage of the virtual machine definition
*/
WithOS withNewPrimaryPublicIpAddress(PublicIpAddress.DefinitionStages.WithCreate creatable);
WithOS withNewPrimaryPublicIpAddress(Creatable<PublicIpAddress> creatable);

/**
* Creates a new public IP address in the same region and group as the resource, with the specified DNS label
Expand Down Expand Up @@ -434,7 +434,7 @@ interface WithPrimaryNetworkInterface {
* @param creatable a creatable definition for a new network interface
* @return The next stage of the virtual machine definition
*/
WithOS withNewPrimaryNetworkInterface(NetworkInterface.DefinitionStages.WithCreate creatable);
WithOS withNewPrimaryNetworkInterface(Creatable<NetworkInterface> creatable);

/**
* Associate an existing network interface as the virtual machine with as it's primary network interface.
Expand Down Expand Up @@ -745,7 +745,7 @@ interface WithAvailabilitySet {
WithCreate withNewAvailabilitySet(String name);

/**
* Specifies definition of a not-yet-created {@link AvailabilitySet.DefinitionStages.WithCreate} availability set
* Specifies definition of a not-yet-created availability set definition
* to associate the virtual machine with.
* <p>
* Adding virtual machines running your application to an availability set ensures that during
Expand All @@ -754,7 +754,7 @@ interface WithAvailabilitySet {
* @param creatable the availability set in creatable stage
* @return the stage representing creatable VM definition
*/
WithCreate withNewAvailabilitySet(AvailabilitySet.DefinitionStages.WithCreate creatable);
WithCreate withNewAvailabilitySet(Creatable<AvailabilitySet> creatable);

/**
* Specifies an existing {@link AvailabilitySet} availability set to to associate the virtual machine with.
Expand Down Expand Up @@ -793,7 +793,7 @@ interface WithStorageAccount {
* @param creatable the storage account in creatable stage
* @return the stage representing creatable VM definition
*/
WithCreate withNewStorageAccount(StorageAccount.DefinitionStages.WithCreate creatable);
WithCreate withNewStorageAccount(Creatable<StorageAccount> creatable);

/**
* Specifies an existing {@link StorageAccount} storage account to put the VM's OS and data disk VHD in.
Expand Down Expand Up @@ -822,7 +822,7 @@ interface WithSecondaryNetworkInterface {
* @param creatable a creatable definition for a new network interface
* @return the stage representing creatable VM definition
*/
WithCreate withNewSecondaryNetworkInterface(NetworkInterface.DefinitionStages.WithCreate creatable);
WithCreate withNewSecondaryNetworkInterface(Creatable<NetworkInterface> creatable);

/**
* Associate an existing network interface with the virtual machine.
Expand Down Expand Up @@ -939,7 +939,7 @@ interface WithSecondaryNetworkInterface {
* @param creatable a creatable definition for a new network interface
* @return the stage representing creatable VM definition
*/
Update withNewSecondaryNetworkInterface(NetworkInterface.DefinitionStages.WithCreate creatable);
Update withNewSecondaryNetworkInterface(Creatable<NetworkInterface> creatable);

/**
* Associate an existing network interface with the virtual machine.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import com.microsoft.azure.management.network.implementation.NetworkManager;
import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils;
import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.GroupableResourceImpl;
import com.microsoft.azure.management.resources.fluentcore.model.Creatable;
import com.microsoft.azure.management.resources.fluentcore.utils.PagedListConverter;
import com.microsoft.azure.management.resources.fluentcore.utils.ResourceNamer;
import com.microsoft.azure.management.resources.fluentcore.utils.Utils;
Expand Down Expand Up @@ -231,7 +232,7 @@ public VirtualMachineInstanceView refreshInstanceView() throws CloudException, I

// Fluent methods for defining virtual network association for the new primary network interface
@Override
public VirtualMachineImpl withNewPrimaryNetwork(Network.DefinitionStages.WithCreate creatable) {
public VirtualMachineImpl withNewPrimaryNetwork(Creatable<Network> creatable) {
this.nicDefinitionWithPrivateIp = this.preparePrimaryNetworkInterface(this.namer.randomName("nic", 20))
.withNewPrimaryNetwork(creatable);
return this;
Expand Down Expand Up @@ -277,16 +278,16 @@ public VirtualMachineImpl withPrimaryPrivateIpAddressStatic(String staticPrivate
// Fluent methods for defining public IP association for the new primary network interface

@Override
public VirtualMachineImpl withNewPrimaryPublicIpAddress(PublicIpAddress.DefinitionStages.WithCreate creatable) {
NetworkInterface.DefinitionStages.WithCreate nicCreatable = this.nicDefinitionWithCreate
public VirtualMachineImpl withNewPrimaryPublicIpAddress(Creatable<PublicIpAddress> creatable) {
Creatable<NetworkInterface> nicCreatable = this.nicDefinitionWithCreate
.withNewPrimaryPublicIpAddress(creatable);
this.addCreatableDependency(nicCreatable);
return this;
}

@Override
public VirtualMachineImpl withNewPrimaryPublicIpAddress(String leafDnsLabel) {
NetworkInterface.DefinitionStages.WithCreate nicCreatable = this.nicDefinitionWithCreate
Creatable<NetworkInterface> nicCreatable = this.nicDefinitionWithCreate
.withNewPrimaryPublicIpAddress(leafDnsLabel);
this.creatablePrimaryNetworkInterfaceKey = nicCreatable.key();
this.addCreatableDependency(nicCreatable);
Expand All @@ -295,7 +296,7 @@ public VirtualMachineImpl withNewPrimaryPublicIpAddress(String leafDnsLabel) {

@Override
public VirtualMachineImpl withExistingPrimaryPublicIpAddress(PublicIpAddress publicIpAddress) {
NetworkInterface.DefinitionStages.WithCreate nicCreatable = this.nicDefinitionWithCreate
Creatable<NetworkInterface> nicCreatable = this.nicDefinitionWithCreate
.withExistingPrimaryPublicIpAddress(publicIpAddress);
this.creatablePrimaryNetworkInterfaceKey = nicCreatable.key();
this.addCreatableDependency(nicCreatable);
Expand All @@ -304,7 +305,7 @@ public VirtualMachineImpl withExistingPrimaryPublicIpAddress(PublicIpAddress pub

@Override
public VirtualMachineImpl withoutPrimaryPublicIpAddress() {
NetworkInterface.DefinitionStages.WithCreate nicCreatable = this.nicDefinitionWithCreate;
Creatable<NetworkInterface> nicCreatable = this.nicDefinitionWithCreate;
this.creatablePrimaryNetworkInterfaceKey = nicCreatable.key();
this.addCreatableDependency(nicCreatable);
return this;
Expand All @@ -313,14 +314,14 @@ public VirtualMachineImpl withoutPrimaryPublicIpAddress() {
// Virtual machine primary network interface specific fluent methods
//
@Override
public VirtualMachineImpl withNewPrimaryNetworkInterface(NetworkInterface.DefinitionStages.WithCreate creatable) {
public VirtualMachineImpl withNewPrimaryNetworkInterface(Creatable<NetworkInterface> creatable) {
this.creatablePrimaryNetworkInterfaceKey = creatable.key();
this.addCreatableDependency(creatable);
return this;
}

public VirtualMachineImpl withNewPrimaryNetworkInterface(String name, String publicDnsNameLabel) {
NetworkInterface.DefinitionStages.WithCreate definitionCreatable = prepareNetworkInterface(name)
Creatable<NetworkInterface> definitionCreatable = prepareNetworkInterface(name)
.withNewPrimaryPublicIpAddress(publicDnsNameLabel);
return withNewPrimaryNetworkInterface(definitionCreatable);
}
Expand Down Expand Up @@ -563,7 +564,7 @@ public VirtualMachineImpl withExistingDataDisk(String storageAccountName, String
//

@Override
public VirtualMachineImpl withNewStorageAccount(StorageAccount.DefinitionStages.WithCreate creatable) {
public VirtualMachineImpl withNewStorageAccount(Creatable<StorageAccount> creatable) {
// This method's effect is NOT additive.
if (this.creatableStorageAccountKey == null) {
this.creatableStorageAccountKey = creatable.key();
Expand All @@ -578,7 +579,7 @@ public VirtualMachineImpl withNewStorageAccount(String name) {
.storageAccounts()
.define(name)
.withRegion(this.regionName());
StorageAccount.DefinitionStages.WithCreate definitionAfterGroup;
Creatable<StorageAccount> definitionAfterGroup;
if (this.newGroup != null) {
definitionAfterGroup = definitionWithGroup.withNewGroup(this.newGroup);
} else {
Expand All @@ -597,7 +598,7 @@ public VirtualMachineImpl withExistingStorageAccount(StorageAccount storageAccou
//

@Override
public VirtualMachineImpl withNewAvailabilitySet(AvailabilitySet.DefinitionStages.WithCreate creatable) {
public VirtualMachineImpl withNewAvailabilitySet(Creatable<AvailabilitySet> creatable) {
// This method's effect is NOT additive.
if (this.creatableAvailabilitySetKey == null) {
this.creatableAvailabilitySetKey = creatable.key();
Expand All @@ -621,7 +622,7 @@ public VirtualMachineImpl withExistingAvailabilitySet(AvailabilitySet availabili
}

@Override
public VirtualMachineImpl withNewSecondaryNetworkInterface(NetworkInterface.DefinitionStages.WithCreate creatable) {
public VirtualMachineImpl withNewSecondaryNetworkInterface(Creatable<NetworkInterface> creatable) {
this.creatableSecondaryNetworkInterfaceKeys.add(creatable.key());
this.addCreatableDependency(creatable);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ interface WithPrimaryNetwork {
* @param creatable a creatable definition for a new virtual network
* @return the next stage of the network interface definition
*/
WithPrimaryPrivateIp withNewPrimaryNetwork(Network.DefinitionStages.WithCreate creatable);
WithPrimaryPrivateIp withNewPrimaryNetwork(Creatable<Network> creatable);

/**
* Creates a new virtual network to associate with the network interface's primary IP configuration.
Expand Down Expand Up @@ -256,7 +256,7 @@ interface WithPrimaryPublicIpAddress {
* @param creatable a creatable definition for a new public IP
* @return the next stage of the network interface definition
*/
WithCreate withNewPrimaryPublicIpAddress(PublicIpAddress.DefinitionStages.WithCreate creatable);
WithCreate withNewPrimaryPublicIpAddress(Creatable<PublicIpAddress> creatable);

/**
* Creates a new public IP address in the same region and group as the resource and associate it
Expand Down Expand Up @@ -298,7 +298,7 @@ interface WithNetworkSecurityGroup {
* @param creatable a creatable definition for a new network security group
* @return the next stage of the network interface definition
*/
WithCreate withNewNetworkSecurityGroup(NetworkSecurityGroup.DefinitionStages.WithCreate creatable);
WithCreate withNewNetworkSecurityGroup(Creatable<NetworkSecurityGroup> creatable);

/**
* Associates an existing network security group with the network interface.
Expand Down Expand Up @@ -417,7 +417,7 @@ interface WithPrimaryPublicIpAddress {
* @param creatable a creatable definition for a new public IP
* @return the next stage of the network interface update
*/
Update withNewPrimaryPublicIpAddress(PublicIpAddress.DefinitionStages.WithCreate creatable);
Update withNewPrimaryPublicIpAddress(Creatable<PublicIpAddress> creatable);

/**
* Creates a new public IP address in the same region and group as the resource and associate it
Expand Down Expand Up @@ -469,7 +469,7 @@ interface WithNetworkSecurityGroup {
* @param creatable a creatable definition for a new network security group
* @return the next stage of the network interface update
*/
Update withNewNetworkSecurityGroup(NetworkSecurityGroup.DefinitionStages.WithCreate creatable);
Update withNewNetworkSecurityGroup(Creatable<NetworkSecurityGroup> creatable);

/**
* Associates an existing network security group with the network interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.microsoft.azure.management.network.implementation.api.NetworkInterfaceIPConfiguration;
import com.microsoft.azure.management.resources.fluentcore.arm.models.ChildResource;
import com.microsoft.azure.management.resources.fluentcore.model.Attachable;
import com.microsoft.azure.management.resources.fluentcore.model.Creatable;
import com.microsoft.azure.management.resources.fluentcore.model.Settable;
import com.microsoft.azure.management.resources.fluentcore.model.Wrapper;

Expand Down Expand Up @@ -105,7 +106,7 @@ interface WithNetwork<ParentT> {
* @param creatable a creatable definition for a new virtual network
* @return the next stage of the network interface IP configuration definition
*/
WithPrivateIp<ParentT> withNewNetwork(Network.DefinitionStages.WithCreate creatable);
WithPrivateIp<ParentT> withNewNetwork(Creatable<Network> creatable);

/**
* Creates a new virtual network to associate with the network interface IP configuration.
Expand Down Expand Up @@ -196,7 +197,7 @@ interface WithPublicIpAddress<ParentT> {
* @param creatable a creatable definition for a new public IP
* @return the next stage of the network interface IP configuration definition
*/
WithAttach<ParentT> withNewPublicIpAddress(PublicIpAddress.DefinitionStages.WithCreate creatable);
WithAttach<ParentT> withNewPublicIpAddress(Creatable<PublicIpAddress> creatable);

/**
* Creates a new public IP address in the same region and group as the resource and associate it
Expand Down Expand Up @@ -280,7 +281,7 @@ interface WithNetwork<ParentT> {
* @param creatable a creatable definition for a new virtual network
* @return the next stage of the network interface IP configuration definition
*/
WithPrivateIp<ParentT> withNewNetwork(Network.DefinitionStages.WithCreate creatable);
WithPrivateIp<ParentT> withNewNetwork(Creatable<Network> creatable);

/**
* Creates a new virtual network to associate with the network interface IP configuration.
Expand Down Expand Up @@ -371,7 +372,7 @@ interface WithPublicIpAddress<ParentT> {
* @param creatable a creatable definition for a new public IP
* @return the next stage of the network interface IP configuration definition
*/
WithAttach<ParentT> withNewPublicIpAddress(PublicIpAddress.DefinitionStages.WithCreate creatable);
WithAttach<ParentT> withNewPublicIpAddress(Creatable<PublicIpAddress> creatable);

/**
* Creates a new public IP address in the same region and group as the resource and associate it
Expand Down Expand Up @@ -482,7 +483,7 @@ interface WithPublicIpAddress {
* @param creatable a creatable definition for a new public IP
* @return the next stage of the network interface IP configuration update
*/
Update withNewPublicIpAddress(PublicIpAddress.DefinitionStages.WithCreate creatable);
Update withNewPublicIpAddress(Creatable<PublicIpAddress> creatable);

/**
* Creates a new public IP address in the same region and group as the resource and associate it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public ServiceCall applyAsync(ServiceCallback<NetworkInterface> callback) {
**************************************************/

@Override
public NetworkInterfaceImpl withNewPrimaryNetwork(Network.DefinitionStages.WithCreate creatable) {
public NetworkInterfaceImpl withNewPrimaryNetwork(Creatable<Network> creatable) {
this.primaryIpConfiguration().withNewNetwork(creatable);
return this;
}
Expand All @@ -128,7 +128,7 @@ public NetworkInterfaceImpl withExistingPrimaryNetwork(Network network) {
}

@Override
public NetworkInterfaceImpl withNewPrimaryPublicIpAddress(PublicIpAddress.DefinitionStages.WithCreate creatable) {
public NetworkInterfaceImpl withNewPrimaryPublicIpAddress(Creatable<PublicIpAddress> creatable) {
this.primaryIpConfiguration().withNewPublicIpAddress(creatable);
return this;
}
Expand Down Expand Up @@ -170,7 +170,7 @@ public NetworkInterfaceImpl withPrimaryPrivateIpAddressStatic(String staticPriva
}

@Override
public NetworkInterfaceImpl withNewNetworkSecurityGroup(NetworkSecurityGroup.DefinitionStages.WithCreate creatable) {
public NetworkInterfaceImpl withNewNetworkSecurityGroup(Creatable<NetworkSecurityGroup> creatable) {
if (this.creatableNetworkSecurityGroupKey == null) {
this.creatableNetworkSecurityGroupKey = creatable.key();
this.addCreatableDependency(creatable);
Expand Down Expand Up @@ -469,7 +469,7 @@ Resource createdDependencyResource(String key) {
return super.createdResource(key);
}

ResourceGroup.DefinitionCreatable newGroup() {
Creatable<ResourceGroup> newGroup() {
return this.newGroup;
}
}
Loading

0 comments on commit 12014ce

Please sign in to comment.