Skip to content

Commit

Permalink
Merge pull request #709 from JetBrains/232-mb-708
Browse files Browse the repository at this point in the history
When publishing web/function app, not al supported regions are shown #708
  • Loading branch information
maartenba committed Aug 9, 2023
2 parents 243d030 + 3996d6c commit 8ace3b3
Show file tree
Hide file tree
Showing 6 changed files with 221 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<h4>Fixed bugs:</h4>
<ul>
<li>Azure Web App/Function App Deployments not working without solution file (<a href="https://github.com/JetBrains/azure-tools-for-intellij/issues/681">#681</a>)</li>
<li>When publishing web/function app, not al supported regions are shown (<a href="https://github.com/JetBrains/azure-tools-for-intellij/issues/708">#708</a>)</li>
</ul>
</html>
]]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<h4>Fixed bugs:</h4>
<ul>
<li>Azure Web App/Function App Deployments not working without solution file (<a href="https://github.com/JetBrains/azure-tools-for-intellij/issues/681">#681</a>)</li>
<li>When publishing web/function app, not al supported regions are shown (<a href="https://github.com/JetBrains/azure-tools-for-intellij/issues/708">#708</a>)</li>
</ul>
<p>[3.50.0-2023.1]</p>
<ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2018-2020 JetBrains s.r.o.
* Copyright (c) 2018-2023 JetBrains s.r.o.
*
* All rights reserved.
*
Expand Down Expand Up @@ -38,4 +38,202 @@ object AzureDefaults {
val location: Region = Region.US_EAST

val pricingTier: PricingTier = PricingTier.STANDARD_S1

object SupportedRegions {
// Regions where app services are supported
// https://azure.microsoft.com/en-us/explore/global-infrastructure/products-by-region/?products=app-service
val AppServices = hashSetOf(
// South Africa
"southafricanorth",
"southafricawest",

// Asia
"eastasia",
"southeastasia",

// Australia
"australiacentral",
"australiacentral2",
"australiaeast",
"australiasoutheast",

// Brazil
"brazilsouth",
"brazilsoutheast",

// Canada
"canadacentral",
"canadaeast",

// China
"chinaeast",
"chinaeast2",
"chinaeast3",
"chinanorth",
"chinanorth2",
"chinanorth3",

// Europe
"northeurope",
"westeurope",

// France
"francecentral",
"francesouth",

// Germany
//"germanynorth",
"germanywestcentral",

// India
"centralindia",
"southindia",
"westindia",
"jioindiacentral",
"jioindiawest",

// Japan
"japaneast",
"japanwest",

// Korea
"koreacentral",
"koreasouth",

// Norway
"norwayeast",
"norwaywest",

// Poland
//"polandcentral",

// Qatar
"qatarcentral",

// Sweden
"swedencentral",
"swedensouth",

// Switzerland
"switzerlandnorth",
"switzerlandwest",

// UAE
"uaecentral",
"uaenorth",

// UK
"uksouth",
"ukwest",

// USA
"centralus",
"eastus",
"eastus2",
"northcentralus",
"southcentralus",
"westcentralus",
"westus",
"westus2",
"westus3"
)

// Regions where SQL Databasde is supported
// https://azure.microsoft.com/en-us/explore/global-infrastructure/products-by-region/?products=azure-sql-database
val SqlDatabase = hashSetOf(
// South Africa
"southafricanorth",
"southafricawest",

// Asia
"eastasia",
"southeastasia",

// Australia
"australiacentral",
"australiacentral2",
"australiaeast",
"australiasoutheast",

// Brazil
"brazilsouth",
"brazilsoutheast",

// Canada
"canadacentral",
"canadaeast",

// China
"chinaeast",
"chinaeast2",
"chinaeast3",
"chinanorth",
"chinanorth2",
"chinanorth3",

// Europe
"northeurope",
"westeurope",

// France
"francecentral",
"francesouth",

// Germany
"germanynorth",
"germanywestcentral",

// India
"centralindia",
"southindia",
"westindia",
"jioindiacentral",
"jioindiawest",

// Japan
"japaneast",
"japanwest",

// Korea
"koreacentral",
"koreasouth",

// Norway
"norwayeast",
"norwaywest",

// Poland
"polandcentral",

// Qatar
"qatarcentral",

// Sweden
"swedencentral",
"swedensouth",

// Switzerland
"switzerlandnorth",
"switzerlandwest",

// UAE
"uaecentral",
"uaenorth",

// UK
"uksouth",
"ukwest",

// USA
"centralus",
"eastus",
"eastus2",
"northcentralus",
"southcentralus",
"westcentralus",
"westus",
"westus2",
"westus3"
)
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/**
* Copyright (c) 2019-2020 JetBrains s.r.o.
* <p/>
* Copyright (c) 2019-2023 JetBrains s.r.o.
*
* All rights reserved.
* <p/>
*
* MIT License
* <p/>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* <p/>
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
* the Software.
* <p/>
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
Expand Down Expand Up @@ -42,6 +42,7 @@ import com.microsoft.azuretools.core.mvp.model.database.AzureSqlDatabaseMvpModel
import com.microsoft.azuretools.core.mvp.model.database.AzureSqlServerMvpModel
import com.microsoft.azuretools.core.mvp.model.webapp.AzureWebAppMvpModel
import com.microsoft.intellij.helpers.base.AzureMvpPresenter
import com.microsoft.intellij.helpers.defaults.AzureDefaults
import com.microsoft.tooling.msservices.components.DefaultLoader
import org.jetbrains.plugins.azure.RiderAzureBundle.message

Expand Down Expand Up @@ -99,7 +100,9 @@ abstract class AppDeployViewPresenterBase<T : AppDeployMvpViewBase> : AzureMvpPr
message("run_config.publish.location.collect_error"),
{ AzureMvpModel.getInstance().listLocationsBySubscriptionId(subscriptionId)
// TODO: This is a workaround for locations that cause exceptions on create entries.
.filter { location -> Region.values().any { region -> region.name().equals(location.name(), true) } }
.filter { location ->
AzureDefaults.SupportedRegions.AppServices.contains(location.name()) ||
Region.values().any { region -> region.name().equals(location.name(), true) } }
},
{ mvpView.fillLocation(it) })
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2020 JetBrains s.r.o.
* Copyright (c) 2020-2023 JetBrains s.r.o.
*
* All rights reserved.
*
Expand Down Expand Up @@ -33,6 +33,7 @@ import com.microsoft.azure.management.resources.Subscription
import com.microsoft.azuretools.core.mvp.model.AzureMvpModel
import com.microsoft.azuretools.core.mvp.model.webapp.AzureWebAppMvpModel
import com.microsoft.intellij.helpers.base.AzureMvpPresenter
import com.microsoft.intellij.helpers.defaults.AzureDefaults
import org.jetbrains.plugins.azure.RiderAzureBundle.message

abstract class CreateAppViewPresenter<V : CreateAppMvpView> : AzureMvpPresenter<V>() {
Expand Down Expand Up @@ -77,7 +78,9 @@ abstract class CreateAppViewPresenter<V : CreateAppMvpView> : AzureMvpPresenter<
message("run_config.publish.location.collect_error"),
{ AzureMvpModel.getInstance().listLocationsBySubscriptionId(subscriptionId)
// TODO: This is a workaround for locations that cause exceptions on create entries.
.filter { location -> Region.values().any { region -> region.name().equals(location.name(), true) } }
.filter { location ->
AzureDefaults.SupportedRegions.AppServices.contains(location.name()) ||
Region.values().any { region -> region.name().equals(location.name(), true) } }
},
{ mvpView.fillLocation(it) })
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2018-2020 JetBrains s.r.o.
* Copyright (c) 2018-2023 JetBrains s.r.o.
*
* All rights reserved.
*
Expand Down Expand Up @@ -30,7 +30,7 @@ import com.microsoft.azure.management.resources.ResourceGroup
import com.microsoft.azure.management.resources.Subscription
import com.microsoft.azuretools.core.mvp.model.AzureMvpModel
import com.microsoft.intellij.helpers.base.AzureMvpPresenter
import org.jetbrains.plugins.azure.RiderAzureBundle
import com.microsoft.intellij.helpers.defaults.AzureDefaults
import org.jetbrains.plugins.azure.RiderAzureBundle.message

class CreateSqlServerViewPresenter<V : CreateSqlServerMvpView> : AzureMvpPresenter<V>() {
Expand Down Expand Up @@ -64,7 +64,9 @@ class CreateSqlServerViewPresenter<V : CreateSqlServerMvpView> : AzureMvpPresent
message("run_config.publish.location.collect_error"),
{ AzureMvpModel.getInstance().listLocationsBySubscriptionId(subscriptionId)
// TODO: This is a workaround for locations that cause exceptions on create entries.
.filter { location -> Region.values().any { region -> region.name().equals(location.name(), true) } }
.filter { location ->
AzureDefaults.SupportedRegions.AppServices.contains(location.name()) ||
Region.values().any { region -> region.name().equals(location.name(), true) } }
},
{ mvpView.fillLocation(it) })
}
Expand Down

0 comments on commit 8ace3b3

Please sign in to comment.