diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/KnownLinuxVirtualMachineImage.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/KnownLinuxVirtualMachineImage.java similarity index 96% rename from azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/KnownLinuxVirtualMachineImage.java rename to azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/KnownLinuxVirtualMachineImage.java index 9eb50e441e6c..ffb27b98dd79 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/KnownLinuxVirtualMachineImage.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/KnownLinuxVirtualMachineImage.java @@ -1,4 +1,4 @@ -package com.microsoft.azure.management.compute.implementation; +package com.microsoft.azure.management.compute; import com.microsoft.azure.management.compute.implementation.api.ImageReference; diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/KnownWindowsVirtualMachineImage.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/KnownWindowsVirtualMachineImage.java similarity index 96% rename from azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/KnownWindowsVirtualMachineImage.java rename to azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/KnownWindowsVirtualMachineImage.java index 67b4c5255854..4486fc1ed248 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/KnownWindowsVirtualMachineImage.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/KnownWindowsVirtualMachineImage.java @@ -1,4 +1,4 @@ -package com.microsoft.azure.management.compute.implementation; +package com.microsoft.azure.management.compute; import com.microsoft.azure.management.compute.implementation.api.ImageReference; diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachine.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachine.java index aa83b8d963b5..63b7304c4241 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachine.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachine.java @@ -2,8 +2,6 @@ import com.microsoft.azure.CloudException; import com.microsoft.azure.PagedList; -import com.microsoft.azure.management.compute.implementation.KnownLinuxVirtualMachineImage; -import com.microsoft.azure.management.compute.implementation.KnownWindowsVirtualMachineImage; import com.microsoft.azure.management.compute.implementation.api.VirtualMachineInner; import com.microsoft.azure.management.compute.implementation.api.OperatingSystemTypes; import com.microsoft.azure.management.compute.implementation.api.CachingTypes; diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetImpl.java index 3f475f65d74f..91c2ec1feacc 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetImpl.java @@ -112,20 +112,9 @@ public AvailabilitySetImpl withFaultDomainCount(int faultDomainCount) { return this; } - @Override - public AvailabilitySetImpl create() throws Exception { - super.creatablesCreate(); - return this; - } - - @Override - public AvailabilitySetImpl update() throws Exception { - return this; - } - @Override public AvailabilitySetImpl apply() throws Exception { - return create(); + return this.create(); } @Override diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImageImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImageImpl.java index 0b66a4abbcfe..8ac632896a84 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImageImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImageImpl.java @@ -18,7 +18,6 @@ class VirtualMachineImageImpl extends IndexableWrapperImpl implements VirtualMachineImage { - private final VirtualMachineImagesInner client; private final Region location; private ImageReference imageReference; @@ -30,7 +29,6 @@ class VirtualMachineImageImpl this.imageReference.withOffer(offer); this.imageReference.withSku(sku); this.imageReference.withVersion(version); - this.client = client; } VirtualMachineImageImpl(Region location, String publisher, String offer, String sku, String version, VirtualMachineImageInner innerModel, VirtualMachineImagesInner client) { @@ -41,7 +39,6 @@ class VirtualMachineImageImpl this.imageReference.withOffer(offer); this.imageReference.withSku(sku); this.imageReference.withVersion(version); - this.client = client; } @Override diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImpl.java index 3a38dc5cf030..1fca97dc92f0 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImpl.java @@ -7,6 +7,8 @@ import com.microsoft.azure.management.compute.AvailabilitySet; import com.microsoft.azure.management.compute.AvailabilitySets; import com.microsoft.azure.management.compute.DataDisk; +import com.microsoft.azure.management.compute.KnownLinuxVirtualMachineImage; +import com.microsoft.azure.management.compute.KnownWindowsVirtualMachineImage; import com.microsoft.azure.management.compute.PowerState; import com.microsoft.azure.management.compute.VirtualMachine; import com.microsoft.azure.management.compute.VirtualMachineSize; @@ -154,18 +156,7 @@ public VirtualMachine refresh() throws Exception { } @Override - public VirtualMachine create() throws Exception { - super.creatablesCreate(); - return this; - } - - @Override - public VirtualMachineImpl update() throws Exception { - return this; - } - - @Override - public VirtualMachine apply() throws Exception { + public VirtualMachineImpl apply() throws Exception { return this.create(); } @@ -1047,10 +1038,6 @@ private boolean dataDisksRequiresImplicitStorageAccountCreation() { return false; } - private boolean isStoredImage(OSDisk osDisk) { - return osDisk.image() != null; - } - private boolean isOSDiskAttached(OSDisk osDisk) { return osDisk.createOption() == DiskCreateOptionTypes.ATTACH; } diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachinesImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachinesImpl.java index 821d4666122b..766138bab171 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachinesImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachinesImpl.java @@ -35,11 +35,7 @@ import java.util.List; /** -<<<<<<< HEAD * The implementation for {@link VirtualMachines}. -======= - * The type representing Azure virtual machines. ->>>>>>> eca873299bef401bbca4c7084dc790063446e986 */ class VirtualMachinesImpl implements VirtualMachines { diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkImpl.java index ad18d1c3da66..dbcf1322a64c 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkImpl.java @@ -62,17 +62,6 @@ public NetworkImpl refresh() throws Exception { return this; } - @Override - public NetworkImpl create() throws Exception { - super.creatablesCreate(); - return this; - } - - @Override - public NetworkImpl update() throws Exception { - return this; - } - @Override public NetworkImpl apply() throws Exception { return this.create(); 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 fffddc417f89..c5779d68b828 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 @@ -82,17 +82,6 @@ public NetworkInterface refresh() throws Exception { return this; } - @Override - public NetworkInterfaceImpl create() throws Exception { - this.creatablesCreate(); - return this; - } - - @Override - public NetworkInterfaceImpl update() throws Exception { - return this; - } - @Override public NetworkInterfaceImpl apply() throws Exception { return this.create(); 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 9902f4b0d665..154306abbe76 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 @@ -70,17 +70,6 @@ public NetworkSecurityGroupImpl refresh() throws Exception { return this; } - @Override - public NetworkSecurityGroupImpl create() throws Exception { - super.creatablesCreate(); - return this; - } - - @Override - public NetworkSecurityGroupImpl update() throws Exception { - return this; - } - @Override public NetworkSecurityGroupImpl apply() throws Exception { return this.create(); 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 9f219af29ccb..6e8cfc51f81f 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 @@ -42,11 +42,6 @@ public PublicIpAddressImpl apply() throws Exception { return this.create(); } - @Override - public PublicIpAddressImpl update() throws Exception { - return this; - } - @Override public PublicIpAddress refresh() throws Exception { ServiceResponse response = @@ -56,12 +51,6 @@ public PublicIpAddress refresh() throws Exception { return this; } - @Override - public PublicIpAddressImpl create() throws Exception { - super.creatablesCreate(); - return this; - } - // Setters (fluent) @Override diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperations.java index e145f7405925..99c565b03754 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperations.java @@ -15,20 +15,4 @@ public interface DeploymentOperations extends SupportsListing, SupportsGettingByName { - - /** - * Filter the deployment operations by a specific resource group. - * - * @param resourceGroup the resource group to filter by - * @return the entry point to deployment operation management API in the resource group - */ - InGroup resourceGroup(ResourceGroup resourceGroup); - - /** - * Entry point to deployment operation management API in a specific resource group. - */ - interface InGroup extends - SupportsListing, - SupportsGettingByName { - } } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupExportTemplateOptions.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupExportTemplateOptions.java index 59d9ef70a089..b91cbd0145ae 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupExportTemplateOptions.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupExportTemplateOptions.java @@ -35,4 +35,4 @@ public enum ResourceGroupExportTemplateOptions { public String toString() { return this.value; } -} +} \ No newline at end of file diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/implementation/AzureConfigurableImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/implementation/AzureConfigurableImpl.java index f4cfb178c173..31966a22e625 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/implementation/AzureConfigurableImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/implementation/AzureConfigurableImpl.java @@ -27,18 +27,21 @@ protected AzureConfigurableImpl() { this.restClientBuilder = AzureEnvironment.AZURE.newRestClientBuilder(); } + @SuppressWarnings("unchecked") @Override public T withLogLevel(HttpLoggingInterceptor.Level level) { this.restClientBuilder = this.restClientBuilder.withLogLevel(level); return (T) this; } + @SuppressWarnings("unchecked") @Override public T withInterceptor(Interceptor interceptor) { this.restClientBuilder = this.restClientBuilder.withInterceptor(interceptor); return (T) this; } + @SuppressWarnings("unchecked") @Override public T withUserAgent(String userAgent) { this.restClientBuilder = this.restClientBuilder.withUserAgent(userAgent); diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/implementation/GroupableResourceImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/implementation/GroupableResourceImpl.java index 6dfc3d09fd37..cbef6c7b43aa 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/implementation/GroupableResourceImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/implementation/GroupableResourceImpl.java @@ -12,7 +12,7 @@ import com.microsoft.azure.management.resources.fluentcore.arm.models.GroupableResource; /** - * The implemenation for {@link GroupableResource}. + * The implementation for {@link GroupableResource}. * (Internal use only) * * @param The fluent model type diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/implementation/ResourceImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/implementation/ResourceImpl.java index 7843867eae35..a2a4ea72000d 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/implementation/ResourceImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/implementation/ResourceImpl.java @@ -8,7 +8,7 @@ import com.microsoft.azure.management.resources.fluentcore.arm.Region; import com.microsoft.azure.management.resources.fluentcore.arm.models.Resource; -import com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableImpl; +import com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableUpdatableImpl; import java.util.Collections; import java.util.HashMap; @@ -29,7 +29,7 @@ public abstract class ResourceImpl< InnerModelT extends com.microsoft.azure.Resource, FluentModelImplT extends ResourceImpl> extends - CreatableImpl + CreatableUpdatableImpl implements Resource { diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/implementation/CreatableImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/implementation/CreatableImpl.java index e747a7e3a12a..3386870db264 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/implementation/CreatableImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/implementation/CreatableImpl.java @@ -14,8 +14,9 @@ * * @param the fluent model type representing the creatable resource * @param the model inner type that the fluent model type wraps + * @param the fluent model implementation type */ -public abstract class CreatableImpl +public abstract class CreatableImpl extends IndexableRefreshableWrapperImpl implements CreatableTaskGroup.RootResourceCreator { /** @@ -28,22 +29,6 @@ protected CreatableImpl(String name, InnerModelT innerObject) { creatableTaskGroup = new CreatableTaskGroup(name, (Creatable) this, this); } - /** - * create this resource and creatable resources it depends on. - *

- * dependency resources will be created only if this is the root group otherwise - * it creates the main resource. - * - * @throws Exception the exception - */ - protected void creatablesCreate() throws Exception { - if (creatableTaskGroup.isRoot()) { - creatableTaskGroup.execute(); - } else { - createResource(); - } - } - /** * add a creatable resource dependency for this resource. * @@ -63,6 +48,21 @@ protected Resource createdResource(String key) { return this.creatableTaskGroup.taskResult(key); } + /** + * Default implementation of create(). + * @return the created resource + * @throws Exception when anything goes wrong + */ + @SuppressWarnings("unchecked") + public FluentModelImplT create() throws Exception { + if (creatableTaskGroup.isRoot()) { + creatableTaskGroup.execute(); + } else { + createResource(); + } + return (FluentModelImplT) this; + } + /** * Creates this resource. * diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/implementation/CreatableUpdatableImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/implementation/CreatableUpdatableImpl.java new file mode 100644 index 000000000000..64e8c797c7f5 --- /dev/null +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/implementation/CreatableUpdatableImpl.java @@ -0,0 +1,38 @@ +/** + * 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.resources.fluentcore.model.implementation; + +import com.microsoft.azure.management.resources.fluentcore.model.Appliable; + +/** + * The base class for all updatable resource. + * + * @param the fluent model type representing the resource + * @param the model inner type that the fluent model type wraps + * @param the implementation type of the fluent model + */ +public abstract class CreatableUpdatableImpl + extends CreatableImpl { + + protected CreatableUpdatableImpl(String name, InnerModelT innerObject) { + super(name, innerObject); + } + + /** + * Begins an update for a new resource. + *

+ * This is the beginning of the builder pattern used to update top level resources + * in Azure. The final method completing the definition and starting the actual resource creation + * process in Azure is {@link Appliable#apply()}. + * + * @return the stage of new resource update + */ + @SuppressWarnings("unchecked") + public FluentModelImplT update() { + return (FluentModelImplT) this; + } +} diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/DeploymentImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/DeploymentImpl.java index 46bba3a7f35b..8bff5a280ba3 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/DeploymentImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/DeploymentImpl.java @@ -17,7 +17,7 @@ import com.microsoft.azure.management.resources.fluentcore.arm.Region; import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils; import com.microsoft.azure.management.resources.fluentcore.model.Creatable; -import com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableImpl; +import com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableUpdatableImpl; import com.microsoft.azure.management.resources.implementation.api.Dependency; import com.microsoft.azure.management.resources.implementation.api.DeploymentExportResultInner; import com.microsoft.azure.management.resources.implementation.api.DeploymentExtendedInner; @@ -40,7 +40,7 @@ * The implementation of Deployment and its parent interfaces. */ final class DeploymentImpl extends - CreatableImpl + CreatableUpdatableImpl implements Deployment, Deployment.DefinitionBlank, @@ -273,7 +273,7 @@ public Deployment beginCreate() throws Exception { // FLUENT: implement } @Override - public Deployment create() throws Exception { // FLUENT: implementation of ResourceGroup.DefinitionCreatable.Creatable + public DeploymentImpl create() throws Exception { // FLUENT: implementation of ResourceGroup.DefinitionCreatable.Creatable if (this.creatableResourceGroup != null) { this.creatableResourceGroup.create(); } @@ -299,12 +299,7 @@ protected void createResource() throws Exception { } @Override - public Update update() throws Exception { - return this; - } - - @Override - public Deployment apply() throws Exception { + public DeploymentImpl apply() throws Exception { if (this.templateLink() != null && this.template() != null) { this.withTemplate(null); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/DeploymentOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/DeploymentOperationsImpl.java index adaf086372f9..d8b36526bf50 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/DeploymentOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/DeploymentOperationsImpl.java @@ -11,7 +11,6 @@ import com.microsoft.azure.management.resources.Deployment; import com.microsoft.azure.management.resources.DeploymentOperation; import com.microsoft.azure.management.resources.DeploymentOperations; -import com.microsoft.azure.management.resources.ResourceGroup; import com.microsoft.azure.management.resources.ResourceGroups; import com.microsoft.azure.management.resources.fluentcore.utils.PagedListConverter; import com.microsoft.azure.management.resources.implementation.api.DeploymentOperationInner; @@ -26,7 +25,6 @@ final class DeploymentOperationsImpl implements DeploymentOperations { private final DeploymentOperationsInner client; private final Deployment deployment; - private final ResourceGroups resourceGroups; private final PagedListConverter converter; DeploymentOperationsImpl(final DeploymentOperationsInner client, @@ -34,7 +32,6 @@ final class DeploymentOperationsImpl final ResourceGroups resourceGroups) { this.client = client; this.deployment = deployment; - this.resourceGroups = resourceGroups; converter = new PagedListConverter() { @Override public DeploymentOperation typeConvert(DeploymentOperationInner deploymentInner) { @@ -43,11 +40,6 @@ public DeploymentOperation typeConvert(DeploymentOperationInner deploymentInner) }; } - @Override - public InGroup resourceGroup(ResourceGroup resourceGroup) { - return new DeploymentOperationsInGroupImpl(this, resourceGroup); - } - @Override public PagedList list() throws CloudException, IOException { return converter.convert(client.list(deployment.resourceGroupName(), deployment.name()).getBody()); diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/DeploymentOperationsInGroupImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/DeploymentOperationsInGroupImpl.java deleted file mode 100644 index 4f9ef71f6bdf..000000000000 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/DeploymentOperationsInGroupImpl.java +++ /dev/null @@ -1,42 +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.resources.implementation; - -import com.microsoft.azure.CloudException; -import com.microsoft.azure.PagedList; -import com.microsoft.azure.management.resources.DeploymentOperation; -import com.microsoft.azure.management.resources.DeploymentOperations; -import com.microsoft.azure.management.resources.ResourceGroup; - -import java.io.IOException; - -/** - * An instance of this class provides access to deployment operations in a - * resource group. - */ -class DeploymentOperationsInGroupImpl - implements DeploymentOperations.InGroup { - private final DeploymentOperations deploymentOperations; - private final ResourceGroup resourceGroup; - - DeploymentOperationsInGroupImpl(final DeploymentOperations deploymentOperations, final ResourceGroup resourceGroup) { - this.deploymentOperations = deploymentOperations; - this.resourceGroup = resourceGroup; - } - - @Override - public PagedList list() throws CloudException, IOException { - return deploymentOperations.list(); - } - - @Override - public DeploymentOperation get(String operationId) throws IOException, CloudException { - return deploymentOperations.get(operationId); - - } -} - diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/GenericResourceImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/GenericResourceImpl.java index e5ef8dbc7bd2..c953175755d0 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/GenericResourceImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/GenericResourceImpl.java @@ -31,7 +31,6 @@ final class GenericResourceImpl GenericResource.UpdateWithApiVersion, GenericResource.Update { private final ResourcesInner client; - private final ResourceManagementClientImpl serviceClient; private String resourceProviderNamespace; private String parentResourceId; private String resourceType; @@ -43,7 +42,6 @@ final class GenericResourceImpl final ResourceManagementClientImpl serviceClient) { super(key, innerModel, new ResourceGroupsImpl(serviceClient)); this.client = client; - this.serviceClient = serviceClient; } @Override @@ -122,7 +120,7 @@ public GenericResourceImpl withApiVersion(String apiVersion) { } @Override - public GenericResource create() throws Exception { + public GenericResourceImpl create() throws Exception { createResource(); return this; } @@ -142,12 +140,7 @@ protected void createResource() throws Exception { } @Override - public UpdateWithApiVersion update() throws Exception { - return this; - } - - @Override - public GenericResource apply() throws Exception { + public GenericResourceImpl apply() throws Exception { return create(); } } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupImpl.java index 434f0c6bf9b4..288e16939786 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupImpl.java @@ -12,7 +12,7 @@ import com.microsoft.azure.management.resources.ResourceGroupExportResult; import com.microsoft.azure.management.resources.ResourceGroupExportTemplateOptions; import com.microsoft.azure.management.resources.fluentcore.arm.Region; -import com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableImpl; +import com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableUpdatableImpl; import com.microsoft.azure.management.resources.implementation.api.ExportTemplateRequestInner; import com.microsoft.azure.management.resources.implementation.api.ResourceGroupExportResultInner; import com.microsoft.azure.management.resources.implementation.api.ResourceGroupInner; @@ -28,8 +28,8 @@ /** * An instance of this class provides access to a resource group in Azure. */ -public class ResourceGroupImpl extends - CreatableImpl +class ResourceGroupImpl extends + CreatableUpdatableImpl implements ResourceGroup, ResourceGroup.DefinitionBlank, @@ -122,12 +122,6 @@ public ResourceGroupImpl apply() throws Exception { return this.create(); } - @Override - public ResourceGroupImpl create() throws Exception { // FLUENT: implementation of ResourceGroup.DefinitionCreatable.Creatable - super.creatablesCreate(); - return this; - } - @Override public ResourceGroupImpl refresh() throws Exception { // FLUENT: implementation of ResourceGroup.Refreshable this.setInner(client.get(this.key).getBody()); @@ -139,11 +133,6 @@ public T connectToResource(ResourceConnector.Build return adapterBuilder.create(this.serviceClient.restClient(), this.serviceClient.subscriptionId(), this); } - @Override - public Update update() throws Exception { - return this; - } - @Override protected void createResource() throws Exception { ResourceGroupInner params = new ResourceGroupInner(); diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupsImpl.java index 3e6efba78ea7..2f1d4d9f70ee 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupsImpl.java @@ -20,7 +20,7 @@ /** * The implementation for ResourceGroups and its parent interfaces. */ -public final class ResourceGroupsImpl +final class ResourceGroupsImpl implements ResourceGroups { private final ResourceGroupsInner client; private final ResourceManagementClientImpl serviceClient; @@ -30,7 +30,7 @@ public final class ResourceGroupsImpl * * @param serviceClient the inner resource management client */ - public ResourceGroupsImpl(final ResourceManagementClientImpl serviceClient) { + ResourceGroupsImpl(final ResourceManagementClientImpl serviceClient) { this.serviceClient = serviceClient; this.client = serviceClient.resourceGroups(); } diff --git a/azure-mgmt-resources/src/test/java/com/microsoft/azure/management/resources/GroupPagedListTests.java b/azure-mgmt-resources/src/test/java/com/microsoft/azure/management/resources/GroupPagedListTests.java index f9a43c401d89..38d3140f9b8b 100644 --- a/azure-mgmt-resources/src/test/java/com/microsoft/azure/management/resources/GroupPagedListTests.java +++ b/azure-mgmt-resources/src/test/java/com/microsoft/azure/management/resources/GroupPagedListTests.java @@ -103,10 +103,6 @@ public List listNextGroup(String s) throws RestException, IOException { return groupItems; } }; - - for (String item : groupedResourceList) { - } - } private static ResourceGroup resourceGroup(final String name) { diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/StorageAccountImpl.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/StorageAccountImpl.java index 471ebfbb740d..cf47d6b4e73c 100644 --- a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/StorageAccountImpl.java +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/StorageAccountImpl.java @@ -156,12 +156,6 @@ public StorageAccountImpl refresh() throws Exception { return this; } - @Override - public StorageAccountImpl create() throws Exception { - super.creatablesCreate(); - return this; - } - @Override public StorageAccountImpl withSku(SkuName skuName) { if (isInCreateMode()) { @@ -213,9 +207,9 @@ protected void createResource() throws Exception { } @Override - public StorageAccountImpl update() throws Exception { + public StorageAccountImpl update() { updateParameters = new StorageAccountUpdateParametersInner(); - return this; + return super.update(); } @Override diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/StorageAccountKeys.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/StorageAccountKeys.java deleted file mode 100644 index 40cfc6a22354..000000000000 --- a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/StorageAccountKeys.java +++ /dev/null @@ -1,39 +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.storage.implementation; - -/** - * An instance of this class contains information about the access keys of a storage account. - */ -public class StorageAccountKeys { - private String primaryKey; - private String secondaryKey; - - /** - * Creates an instance of StorageAccountKeys with a primary key and a secondary key. - * @param primaryKey the primary access key - * @param secondaryKey the secondary access key - */ - public StorageAccountKeys(String primaryKey, String secondaryKey) { - this.primaryKey = primaryKey; - this.secondaryKey = secondaryKey; - } - - /** - * @return the primary access key. - */ - public String primaryKey() { - return primaryKey; - } - - /** - * @return the secondary access key. - */ - public String secondary() { - return secondaryKey; - } -} diff --git a/azure/src/test/java/com/microsoft/azure/AzureTests.java b/azure/src/test/java/com/microsoft/azure/AzureTests.java index d078082a75f0..23f5c3322a08 100644 --- a/azure/src/test/java/com/microsoft/azure/AzureTests.java +++ b/azure/src/test/java/com/microsoft/azure/AzureTests.java @@ -57,8 +57,13 @@ public void setup() throws Exception { azure = azureAuthed.withSubscription(SUBSCRIPTION_ID); // Authenticate based on file - this.azure2 = Azure.authenticate(new File("my.azureauth")) - .withDefaultSubscription(); + File authFile = new File("my.azureauth"); + if (authFile.exists()) { + this.azure2 = Azure.authenticate(new File("my.azureauth")) + .withDefaultSubscription(); + } else { + this.azure2 = azure; + } } /** diff --git a/azure/src/test/java/com/microsoft/azure/TestVirtualMachine.java b/azure/src/test/java/com/microsoft/azure/TestVirtualMachine.java index af1ef7ffdf53..1bba7748e00c 100644 --- a/azure/src/test/java/com/microsoft/azure/TestVirtualMachine.java +++ b/azure/src/test/java/com/microsoft/azure/TestVirtualMachine.java @@ -1,8 +1,8 @@ package com.microsoft.azure; +import com.microsoft.azure.management.compute.KnownWindowsVirtualMachineImage; import com.microsoft.azure.management.compute.VirtualMachine; import com.microsoft.azure.management.compute.VirtualMachines; -import com.microsoft.azure.management.compute.implementation.KnownWindowsVirtualMachineImage; import com.microsoft.azure.management.resources.fluentcore.arm.Region; public class TestVirtualMachine extends TestTemplate { diff --git a/azure/src/test/java/com/microsoft/azure/TestVirtualMachineDataDisk.java b/azure/src/test/java/com/microsoft/azure/TestVirtualMachineDataDisk.java index 32f663365d69..c313c8f3724b 100644 --- a/azure/src/test/java/com/microsoft/azure/TestVirtualMachineDataDisk.java +++ b/azure/src/test/java/com/microsoft/azure/TestVirtualMachineDataDisk.java @@ -1,9 +1,9 @@ package com.microsoft.azure; import com.microsoft.azure.management.compute.DataDisk; +import com.microsoft.azure.management.compute.KnownWindowsVirtualMachineImage; import com.microsoft.azure.management.compute.VirtualMachine; import com.microsoft.azure.management.compute.VirtualMachines; -import com.microsoft.azure.management.compute.implementation.KnownWindowsVirtualMachineImage; import com.microsoft.azure.management.compute.implementation.api.CachingTypes; import com.microsoft.azure.management.compute.implementation.api.VirtualMachineSizeTypes; import com.microsoft.azure.management.resources.fluentcore.arm.Region; diff --git a/azure/src/test/java/com/microsoft/azure/TestVirtualMachineNics.java b/azure/src/test/java/com/microsoft/azure/TestVirtualMachineNics.java index b5c8561cb10c..4729fb3077c2 100644 --- a/azure/src/test/java/com/microsoft/azure/TestVirtualMachineNics.java +++ b/azure/src/test/java/com/microsoft/azure/TestVirtualMachineNics.java @@ -1,8 +1,8 @@ package com.microsoft.azure; +import com.microsoft.azure.management.compute.KnownWindowsVirtualMachineImage; import com.microsoft.azure.management.compute.VirtualMachine; import com.microsoft.azure.management.compute.VirtualMachines; -import com.microsoft.azure.management.compute.implementation.KnownWindowsVirtualMachineImage; import com.microsoft.azure.management.compute.implementation.api.VirtualMachineSizeTypes; import com.microsoft.azure.management.network.Network; import com.microsoft.azure.management.network.NetworkInterface;