Skip to content

Commit

Permalink
Merge pull request #1205 from jianghaolu/web
Browse files Browse the repository at this point in the history
Adapt previous web app models to new infrastructure
  • Loading branch information
jianghaolu authored Oct 19, 2016
2 parents be112f9 + 0e413ad commit 932f059
Show file tree
Hide file tree
Showing 23 changed files with 2,488 additions and 1 deletion.
1 change: 0 additions & 1 deletion azure-mgmt-website/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-mgmt-resources</artifactId>
<version>1.0.0-beta4-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
/**
* 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.website;

import com.microsoft.azure.management.resources.fluentcore.arm.models.GroupableResource;
import com.microsoft.azure.management.resources.fluentcore.arm.models.HasName;
import com.microsoft.azure.management.resources.fluentcore.model.Creatable;
import com.microsoft.azure.management.resources.fluentcore.model.Refreshable;
import com.microsoft.azure.management.resources.fluentcore.model.Updatable;
import com.microsoft.azure.management.resources.fluentcore.model.Wrapper;
import com.microsoft.azure.management.website.implementation.AppServicePlanInner;

/**
* An immutable client-side representation of an Azure Web App.
*/
public interface AppServicePlan extends
GroupableResource,
HasName,
Refreshable<AppServicePlan>,
Updatable<AppServicePlan.Update>,
Wrapper<AppServicePlanInner> {

/**
* @return target worker tier assigned to the App Service Plan.
*/
String workerTierName();

/**
* @return app Service Plan Status. Possible values include: 'Ready', 'Pending'.
*/
StatusOptions status();

/**
* @return app Service Plan Subscription.
*/
String subscription();

/**
* @return app Service Plan administration site.
*/
String adminSiteName();

/**
* @return specification for the hosting environment (App Service Environment) to
* use for the App Service Plan.
*/
HostingEnvironmentProfile hostingEnvironmentProfile();

/**
* @return maximum number of instances that can be assigned to this App Service
* Plan.
*/
int maximumNumberOfWorkers();

/**
* @return geographical location for the App Service Plan.
*/
String geoRegion();

/**
* @return if True apps assigned to this App Service Plan can be scaled
* independently
* If False apps assigned to this App Service Plan will scale
* to all instances of the plan.
*/
boolean perSiteScaling();

/**
* @return number of web apps assigned to this App Service Plan.
*/
int numberOfSites();

/**
* @return resource group of the server farm.
*/
String resourceGroup();

/**
* @return the sku property.
*/
SkuDescription sku();

/**************************************************************
* Fluent interfaces to provision a App service plan
**************************************************************/

/**
* Container interface for all the definitions that need to be implemented.
*/
interface Definition extends
DefinitionStages.Blank,
DefinitionStages.WithGroup,
DefinitionStages.WithPricingTier,
DefinitionStages.WithCreate {
}

/**
* Grouping of all the site definition stages.
*/
interface DefinitionStages {
/**
* The first stage of the app service plan definition.
*/
interface Blank extends DefinitionWithRegion<WithGroup> {
}

/**
* An app service plan definition allowing resource group to be set.
*/
interface WithGroup extends GroupableResource.DefinitionStages.WithGroup<WithPricingTier> {
}

/**
* An app service plan definition allowing pricing tier to be set.
*/
interface WithPricingTier {
WithCreate withPricingTier(AppServicePricingTier pricingTier);
}

/**
* An app service plan definition with sufficient inputs to create a new
* website in the cloud, but exposing additional optional inputs to
* specify.
*/
interface WithCreate extends Creatable<AppServicePlan> {
}
}

/**
* Grouping of all the site update stages.
*/
interface UpdateStages {

}

/**
* The template for a site update operation, containing all the settings that can be modified.
*/
interface Update {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* 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.website;

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;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsListingByGroup;
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating;
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeleting;

/**
* Entry point for storage accounts management API.
*/
public interface AppServicePlans extends
SupportsCreating<AppServicePlan.DefinitionStages.Blank>,
SupportsDeleting,
SupportsListingByGroup<AppServicePlan>,
SupportsGettingByGroup<AppServicePlan>,
SupportsGettingById<AppServicePlan>,
SupportsDeletingByGroup {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/**
* 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.website;

import com.fasterxml.jackson.annotation.JsonValue;

/**
* Defines App service pricing tiers.
*/
public enum AppServicePricingTier {
/** Free app service plan. */
FREE_F1("Free", "F1"),

/** App service plan with shared infrastructure. */
SHARED_D1("Shared", "D1"),

/** Basic pricing tier with a small size. */
BASIC_B1("Basic", "B1"),

/** Basic pricing tier with a medium size. */
BASIC_B2("Basic", "B2"),

/** Basic pricing tier with a large size. */
BASIC_B3("Basic", "B3"),

/** Standard pricing tier with a small size. */
STANDARD_S1("Standard", "S1"),

/** Standard pricing tier with a medium size. */
STANDARD_S2("Standard", "S2"),

/** Standard pricing tier with a large size. */
STANDARD_S3("Standard", "S3"),

/** Premium pricing tier with a small size. */
PREMIUM_P1("Premium", "P1"),

/** Premium pricing tier with a medium size. */
PREMIUM_P2("Premium", "P2"),

/** Premium pricing tier with a large size. */
PREMIUM_P3("Premium", "P3");

/** The actual serialized value for a SiteAvailabilityState instance. */
private SkuDescription skuDescription;

AppServicePricingTier(String tier, String size) {
this.skuDescription = new SkuDescription()
.withName(size)
.withTier(tier)
.withSize(size);
}

/**
* Parses a serialized value to an AppServicePricingTier instance.
*
* @param skuDescription the serialized value to parse.
* @return the parsed AppServicePricingTier object, or null if unable to parse.
*/
public static AppServicePricingTier fromSkuDescription(SkuDescription skuDescription) {
AppServicePricingTier[] items = AppServicePricingTier.values();
for (AppServicePricingTier item : items) {
if (item.skuDescription.tier().equalsIgnoreCase(skuDescription.tier())
&& item.skuDescription.size().equalsIgnoreCase(skuDescription.size())) {
return item;
}
}
return null;
}

/**
* @return the underneath sku description
*/
@JsonValue
public SkuDescription toSkuDescription() {
return this.skuDescription;
}

@Override
public String toString() {
return this.skuDescription.tier() + "_" + this.skuDescription.size();
}
}
Loading

0 comments on commit 932f059

Please sign in to comment.