Skip to content

Commit

Permalink
Address review comment: simplify chain definition by defining withPar…
Browse files Browse the repository at this point in the history
…entResource interface
  • Loading branch information
anuchandy committed Aug 2, 2016
1 parent 5739786 commit 654f089
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ interface Definition extends
DefinitionStages.WithGroup,
DefinitionStages.WithResourceType,
DefinitionStages.WithProviderNamespace,
DefinitionStages.WithOrWithoutParentResource,
DefinitionStages.WithParentResource,
DefinitionStages.WithPlan,
DefinitionStages.WithApiVersion,
DefinitionStages.WithCreate {
Expand Down Expand Up @@ -106,20 +106,7 @@ interface WithProviderNamespace {
* @param resourceProviderNamespace the namespace of the resource provider
* @return the next stage of the generic resource definition
*/
WithOrWithoutParentResource withProviderNamespace(String resourceProviderNamespace);
}

/**
* A generic resource definition allowing parent resource to be specified.
*/
interface WithOrWithoutParentResource extends WithPlan {
/**
* Specifies the parent resource.
*
* @param parentResourceId the parent resource id
* @return the next stage of the generic resource definition
*/
WithPlan withParentResource(String parentResourceId); // ParentResource is optional so user can navigate to WithPlan with or without it.
WithPlan withProviderNamespace(String resourceProviderNamespace);
}

/**
Expand Down Expand Up @@ -158,12 +145,26 @@ interface WithApiVersion {
WithCreate withApiVersion(String apiVersion);
}

/**
* A generic resource definition allowing parent resource to be specified.
*/
interface WithParentResource {
/**
* Specifies the parent resource.
*
* @param parentResourceId the parent resource id
* @return the next stage of the generic resource definition
*/
WithCreate withParentResource(String parentResourceId);
}

/**
* A deployment definition with sufficient inputs to create a new
* resource in the cloud, but exposing additional optional inputs to
* specify.
*/
interface WithCreate extends
WithParentResource,
Creatable<GenericResource>,
Resource.DefinitionWithTags<WithCreate> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public void canCreateUpdateMoveResource() throws Exception {
.withExistingResourceGroup(rgName)
.withResourceType("sites")
.withProviderNamespace("Microsoft.Web")
.withParentResource("")
.withoutPlan()
.withApiVersion("2015-08-01")
.withParentResource("")
.withProperties(new ObjectMapper().readTree("{\"SiteMode\":\"Limited\",\"ComputeMode\":\"Shared\"}"))
.create();
//List
Expand Down

0 comments on commit 654f089

Please sign in to comment.