Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factoring the individual DefinitionWithGroup sub-interfaces out... #742

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.microsoft.azure.management.compute.implementation.api.AvailabilitySetInner;
import com.microsoft.azure.management.compute.implementation.api.InstanceViewStatus;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.DefinitionAfterGroup;
import com.microsoft.azure.management.resources.fluentcore.arm.models.GroupableResource;
import com.microsoft.azure.management.resources.fluentcore.arm.models.Resource;
import com.microsoft.azure.management.resources.fluentcore.model.Appliable;
Expand Down Expand Up @@ -86,21 +87,17 @@ interface DefinitionBlank extends GroupableResource.DefinitionWithRegion<Definit
/**
* The stage of the availability set definition allowing to specify the resource group
*/
interface DefinitionWithGroup extends GroupableResource.DefinitionWithGroup<DefinitionAfterGroup> {
interface DefinitionWithGroup extends GroupableResource.DefinitionWithGroup<DefinitionCreatable> {
}

/**
* The stage of the availability set definition after the resource group has been specified
*/
interface DefinitionAfterGroup extends DefinitionCreatable {}

/**
* The stage of an availability set definition which contains all the minimum required inputs for
* the resource to be created (via {@link DefinitionCreatable#create()}), but also allows
* for any other optional settings to be specified.
*/
interface DefinitionCreatable extends
Creatable<AvailabilitySet>,
DefinitionAfterGroup,
Resource.DefinitionWithTags<DefinitionCreatable> {
/**
* Specifies the update domain count for the availability set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public interface AvailabilitySets extends


interface InGroup
extends ResourcesInGroup<AvailabilitySet, AvailabilitySet.DefinitionAfterGroup> {
extends ResourcesInGroup<AvailabilitySet, AvailabilitySet.DefinitionCreatable> {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.microsoft.azure.CloudException;
import com.microsoft.azure.PagedList;
import com.microsoft.azure.management.compute.AvailabilitySet;
import com.microsoft.azure.management.compute.AvailabilitySet.DefinitionCreatable;
import com.microsoft.azure.management.compute.AvailabilitySets;
import com.microsoft.azure.management.resources.ResourceGroup;

Expand Down Expand Up @@ -36,7 +37,7 @@ public PagedList<AvailabilitySet> list() throws CloudException, IOException {


@Override
public AvailabilitySet.DefinitionAfterGroup define(String name) {
public DefinitionCreatable define(String name) {
return this.availabilitySets
.define(name)
.withRegion(this.resourceGroup.location())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.Map;

import com.microsoft.azure.management.network.implementation.api.VirtualNetworkInner;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.DefinitionAfterGroup;
import com.microsoft.azure.management.resources.fluentcore.arm.models.GroupableResource;
import com.microsoft.azure.management.resources.fluentcore.arm.models.Resource;
import com.microsoft.azure.management.resources.fluentcore.model.Appliable;
Expand Down Expand Up @@ -71,15 +72,9 @@ interface DefinitionBlank
* The stage of the virtual network definition allowing to specify the resource group
*/
interface DefinitionWithGroup
extends GroupableResource.DefinitionWithGroup<DefinitionAfterGroup> {
extends GroupableResource.DefinitionWithGroup<DefinitionCreatable> {
}

/**
* The stage of the virtual network definition after with the resource group already specified
*/
interface DefinitionAfterGroup
extends DefinitionCreatable {}

/**
* The stage of the virtual network definition allowing to add subnets
*/
Expand Down Expand Up @@ -147,6 +142,7 @@ interface UpdateWithSubnet {
* (see {@link DefinitionWithAddressSpace#withAddressSpace(String)).
*/
interface DefinitionCreatable extends
DefinitionAfterGroup,
Creatable<Network>,
Resource.DefinitionWithTags<DefinitionCreatable> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public interface Networks extends
/**
* Entry point to virtual network management within a specific resource group
*/
interface InGroup extends ResourcesInGroup<Network, Network.DefinitionAfterGroup> {
interface InGroup extends ResourcesInGroup<Network, Network.DefinitionCreatable> {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package com.microsoft.azure.management.network;

import com.microsoft.azure.management.network.implementation.api.PublicIPAddressInner;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.DefinitionAfterGroup;
import com.microsoft.azure.management.resources.fluentcore.arm.models.GroupableResource;
import com.microsoft.azure.management.resources.fluentcore.arm.models.Resource;
import com.microsoft.azure.management.resources.fluentcore.model.Creatable;
Expand Down Expand Up @@ -83,16 +84,9 @@ interface DefinitionBlank
* The stage of the public IP address definition allowing to specify the resource group
*/
interface DefinitionWithGroup
extends GroupableResource.DefinitionWithGroup<DefinitionAfterGroup> {
extends GroupableResource.DefinitionWithGroup<DefinitionCreatable> {
}

/**
* The stage of the public IP address definition after the resource group has been specified
*/
interface DefinitionAfterGroup
extends DefinitionCreatable {
}

/**
* A public IP address definition allowing to set the IP allocation method (static or dynamic)
*/
Expand Down Expand Up @@ -232,6 +226,7 @@ interface UpdateWithReverseFQDN {
*/
interface DefinitionCreatable extends
Creatable<PublicIpAddress>,
DefinitionAfterGroup,
DefinitionWithLeafDomainLabel,
DefinitionWithIpAddress,
DefinitionWithReverseFQDN<DefinitionCreatable>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public interface PublicIpAddresses extends
* Entry point to public IP address management within a specific resource group
*/
interface InGroup extends
ResourcesInGroup<PublicIpAddress, PublicIpAddress.DefinitionAfterGroup>{
ResourcesInGroup<PublicIpAddress, PublicIpAddress.DefinitionCreatable>{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public PublicIpAddressesInGroupImpl(PublicIpAddresses publicIpAddresses, Resourc
}

@Override
public PublicIpAddress.DefinitionAfterGroup define(String name) {
public PublicIpAddress.DefinitionCreatable define(String name) {
return this.publicIpAddresses
.define(name)
.withRegion(this.resourceGroup.location())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* 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.arm.collection;

/**
* The point in the resource definition flow after the resource group has been specified
*/
public interface DefinitionAfterGroup {
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeleting;
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing;

public interface ResourcesInGroup<T, DefinitionT> extends
public interface ResourcesInGroup<T, DefinitionT extends DefinitionAfterGroup> extends
SupportsListing<T>,
SupportsCreating<DefinitionT>,
SupportsDeleting,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.microsoft.azure.management.storage;

import com.microsoft.azure.CloudException;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.DefinitionAfterGroup;
import com.microsoft.azure.management.resources.fluentcore.arm.models.GroupableResource;
import com.microsoft.azure.management.resources.fluentcore.model.Creatable;
import com.microsoft.azure.management.resources.fluentcore.model.Refreshable;
Expand Down Expand Up @@ -90,25 +91,24 @@ public interface StorageAccount extends
**************************************************************/

/**
* Container interface for all the definitions
* Container interface for all the definitions that need to be implemented
*/
public interface Definitions extends
DefinitionAfterGroup,
DefinitionBlank,
DefinitionWithGroup,
DefinitionAfterGroup,
DefinitionCreatable {
}

public interface DefinitionBlank extends GroupableResource.DefinitionWithRegion<DefinitionWithGroup> {
}

public interface DefinitionWithGroup extends GroupableResource.DefinitionWithGroup<DefinitionAfterGroup> {
public interface DefinitionWithGroup extends GroupableResource.DefinitionWithGroup<DefinitionCreatable> {
}

public interface DefinitionAfterGroup extends DefinitionCreatable {
}

public interface DefinitionCreatable extends Creatable<StorageAccount> {
public interface DefinitionCreatable extends
Creatable<StorageAccount>,
DefinitionAfterGroup {
DefinitionCreatable withAccountType(AccountType accountType);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public interface StorageAccounts extends
SupportsDeletingByGroup {

interface InGroup extends
ResourcesInGroup<StorageAccount, StorageAccount.DefinitionAfterGroup> {
ResourcesInGroup<StorageAccount, StorageAccount.DefinitionCreatable> {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public StorageAccountsInGroupImpl(final StorageAccounts storageAccounts, final R
}

@Override
public StorageAccount.DefinitionAfterGroup define(String name) {
public StorageAccount.DefinitionCreatable define(String name) {
return storageAccounts.define(name)
.withRegion(resourceGroup.location())
.withExistingGroup(resourceGroup.name());
Expand Down