Skip to content

Commit e84fa69

Browse files
committed
The class is not generic anymore
1 parent 186a722 commit e84fa69

File tree

1 file changed

+15
-16
lines changed
  • src/azure-cli/azure/cli/command_modules/appservice

1 file changed

+15
-16
lines changed

src/azure-cli/azure/cli/command_modules/appservice/custom.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ def check_language_runtime(cmd, resource_group_name, name):
500500
runtime_helper.resolve(runtime, runtime_version, functions_version, is_linux)
501501
else:
502502
location = app.location
503-
runtime_helper = _FunctionAppSkuStackRuntimeHelper(cmd, location, runtime, "FC1", runtime_version)
503+
runtime_helper = _FlexFunctionAppStackRuntimeHelper(cmd, location, runtime, runtime_version)
504504
runtime_helper.resolve(runtime, runtime_version)
505505
except ValidationError as e:
506506
logger.warning(e.error_msg)
@@ -1057,7 +1057,7 @@ def validate_flex_migration_eligibility_for_linux_consumption_app(cmd, site, fle
10571057
runtime = runtime_info['app_runtime']
10581058
runtime_version = runtime_info['app_runtime_version']
10591059

1060-
runtime_helper = _FunctionAppSkuStackRuntimeHelper(cmd, normalized_site_location, runtime, "FC1")
1060+
runtime_helper = _FlexFunctionAppStackRuntimeHelper(cmd, normalized_site_location, runtime)
10611061
runtime_helper.resolve(runtime, runtime_version)
10621062

10631063
# Validating that the site does not have SSL bindings configured
@@ -2700,7 +2700,7 @@ def list_function_app_runtimes(cmd, os_type=None):
27002700

27012701

27022702
def list_flex_function_app_runtimes(cmd, location, runtime):
2703-
runtime_helper = _FunctionAppSkuStackRuntimeHelper(cmd, location, runtime, "FC1")
2703+
runtime_helper = _FlexFunctionAppStackRuntimeHelper(cmd, location, runtime)
27042704
runtimes = [r for r in runtime_helper.stacks if runtime == r.name]
27052705
if not runtimes:
27062706
raise ValidationError("Runtime '{}' not supported for function apps on the Flex Consumption plan."
@@ -3220,7 +3220,7 @@ def update_runtime_config(cmd, resource_group_name, name, runtime_version):
32203220
runtime = runtime_info['app_runtime']
32213221

32223222
location = functionapp["location"]
3223-
runtime_helper = _FunctionAppSkuStackRuntimeHelper(cmd, location, runtime, "FC1", runtime_version)
3223+
runtime_helper = _FlexFunctionAppStackRuntimeHelper(cmd, location, runtime, runtime_version)
32243224
matched_runtime = runtime_helper.resolve(runtime, runtime_version)
32253225
flex_sku = matched_runtime.sku
32263226
version = flex_sku['functionAppConfigProperties']['runtime']['version']
@@ -5592,7 +5592,7 @@ def _load_stacks_hardcoded(self):
55925592
self._stacks = stacks
55935593

55945594

5595-
class _FunctionAppSkuStackRuntimeHelper:
5595+
class _FlexFunctionAppStackRuntimeHelper:
55965596
class Runtime:
55975597
def __init__(self, name, version, app_insights=False, default=False, sku=None,
55985598
end_of_life_date=None, github_actions_properties=None):
@@ -5609,11 +5609,10 @@ def __init__(self, is_supported, supported_version):
56095609
self.is_supported = is_supported
56105610
self.supported_version = supported_version
56115611

5612-
def __init__(self, cmd, location, runtime, sku, runtime_version=None):
5612+
def __init__(self, cmd, location, runtime, runtime_version=None):
56135613
self._cmd = cmd
56145614
self._location = location
56155615
self._runtime = runtime
5616-
self._sku = sku
56175616
self._runtime_version = runtime_version
56185617
self._stacks = []
56195618

@@ -5622,11 +5621,11 @@ def stacks(self):
56225621
self._load_stacks()
56235622
return self._stacks
56245623

5625-
def get_raw_function_app_stacks(self, cmd, location, runtime, sku):
5626-
stacks_api_url = '/providers/Microsoft.Web/locations/{}/functionAppStacks?api-version=2023-01-01&removeHiddenStacks=true&removeDeprecatedStacks=true&stack={}&sku={}' # pylint: disable=line-too-long
5624+
def get_raw_function_app_stacks(self, cmd, location, runtime):
5625+
stacks_api_url = '/providers/Microsoft.Web/locations/{}/functionAppStacks?api-version=2023-01-01&removeHiddenStacks=true&removeDeprecatedStacks=true&stack={}&sku=FC1' # pylint: disable=line-too-long
56275626
if runtime == "dotnet-isolated":
56285627
runtime = "dotnet"
5629-
request_url = cmd.cli_ctx.cloud.endpoints.resource_manager + stacks_api_url.format(location, runtime, sku)
5628+
request_url = cmd.cli_ctx.cloud.endpoints.resource_manager + stacks_api_url.format(location, runtime)
56305629
response = send_raw_request(cmd.cli_ctx, "GET", request_url)
56315630
return response.json()['value']
56325631

@@ -5666,7 +5665,7 @@ def _parse_raw_stacks(self, stacks):
56665665
continue
56675666

56685667
for sku in skus:
5669-
if sku['skuCode'] != self._sku:
5668+
if sku['skuCode'] != 'FC1':
56705669
continue
56715670

56725671
github_actions_properties = {
@@ -5704,7 +5703,7 @@ def _create_runtime_from_properties(self, runtime_name, version_name, version_pr
57045703
def _load_stacks(self):
57055704
if self._stacks:
57065705
return
5707-
stacks = self.get_raw_function_app_stacks(self._cmd, self._location, self._runtime, self._sku)
5706+
stacks = self.get_raw_function_app_stacks(self._cmd, self._location, self._runtime)
57085707
self._parse_raw_stacks(stacks)
57095708

57105709
def _get_version_variants(self, version):
@@ -6429,8 +6428,8 @@ def create_functionapp(cmd, resource_group_name, name, storage_account, plan=Non
64296428
raise ArgumentUsageError('Must specify --runtime to use --runtime-version')
64306429

64316430
if flexconsumption_location:
6432-
runtime_helper = _FunctionAppSkuStackRuntimeHelper(cmd, flexconsumption_location,
6433-
runtime, "FC1", runtime_version)
6431+
runtime_helper = _FlexFunctionAppStackRuntimeHelper(cmd, flexconsumption_location,
6432+
runtime, runtime_version)
64346433
matched_runtime = runtime_helper.resolve(runtime, runtime_version)
64356434
else:
64366435
runtime_helper = _FunctionAppStackRuntimeHelper(cmd, linux=is_linux, windows=not is_linux)
@@ -7259,7 +7258,7 @@ def list_flex_function_app_all_runtimes(cmd, location, runtime=None):
72597258

72607259
def get_runtime_details_ignore_error(cmd, location, runtime):
72617260
try:
7262-
runtime_helper = _FunctionAppSkuStackRuntimeHelper(cmd, location, runtime, "FC1")
7261+
runtime_helper = _FlexFunctionAppStackRuntimeHelper(cmd, location, runtime)
72637262
return runtime_helper.stacks
72647263
except Exception: # pylint: disable=broad-except
72657264
return None
@@ -9884,7 +9883,7 @@ def _get_functionapp_runtime_version(cmd, location, name, resource_group, runtim
98849883
helper = _FunctionAppStackRuntimeHelper(cmd, linux=is_linux, windows=not is_linux)
98859884
matched_runtime = helper.resolve(runtime_string, runtime_version, functionapp_version, is_linux)
98869885
else:
9887-
runtime_helper = _FunctionAppSkuStackRuntimeHelper(cmd, location, runtime_string, "FC1", runtime_version)
9886+
runtime_helper = _FlexFunctionAppStackRuntimeHelper(cmd, location, runtime_string, runtime_version)
98889887
matched_runtime = runtime_helper.resolve(runtime_string, runtime_version)
98899888
except ValidationError as e:
98909889
if "Invalid version" in e.error_msg:

0 commit comments

Comments
 (0)