Skip to content

Commit ded2bbe

Browse files
Added restore-defaults
1 parent 862a714 commit ded2bbe

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

src/containerapp/azext_containerapp/_help.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2375,3 +2375,12 @@
23752375
text: |
23762376
az containerapp env ingress update -g MyResourceGroup -n MyEnvironment -w WorkloadProfileName
23772377
"""
2378+
2379+
helps['containerapp env ingress restore-defaults'] = """
2380+
type: command
2381+
short-summary: Reset the ingress settings to default values.
2382+
examples:
2383+
- name: Reset the ingress settings for the environment to its default values
2384+
text: |
2385+
az containerapp env ingress restore-defaults -g MyResourceGroup -n MyEnvironment -w WorkloadProfileName
2386+
"""

src/containerapp/azext_containerapp/commands.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,3 +295,4 @@ def load_command_table(self, args):
295295
with self.command_group('containerapp env ingress', is_preview=True) as g:
296296
g.custom_show_command('show', 'show_environment_ingress')
297297
g.custom_command('update', 'update_environment_ingress')
298+
g.custom_command('restore-defaults', 'reset_environment_ingress_to_defaults')

src/containerapp/azext_containerapp/custom.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3772,3 +3772,37 @@ def update_environment_ingress(cmd, environment, resource_group_name, workload_p
37723772

37733773
except Exception as e:
37743774
handle_raw_exception(e)
3775+
3776+
def reset_environment_ingress_to_defaults(cmd, environment, resource_group_name, workload_profile_name, no_wait=False):
3777+
"""Reset environment ingress configuration to default values.
3778+
3779+
:param cmd: Command context
3780+
:param environment: Name of the Container App environment
3781+
:param resource_group_name: Name of resource group
3782+
:param no_wait: Do not wait for the long-running operation to finish
3783+
:return: The updated ingress configuration
3784+
"""
3785+
_validate_subscription_registered(cmd, CONTAINER_APPS_RP)
3786+
3787+
# Default values for environment ingress
3788+
default_min_replicas = 2
3789+
default_max_replicas = 10
3790+
default_termination_grace_period = 8
3791+
default_request_idle_timeout = 4
3792+
default_header_count_limit = 100
3793+
3794+
logger.warning("Resetting environment ingress configuration to default values")
3795+
3796+
# Call existing update method with default values
3797+
return update_environment_ingress(
3798+
cmd=cmd,
3799+
environment=environment,
3800+
resource_group_name=resource_group_name,
3801+
workload_profile_name=workload_profile_name,
3802+
min_replicas=default_min_replicas,
3803+
max_replicas=default_max_replicas,
3804+
termination_grace_period=default_termination_grace_period,
3805+
request_idle_timeout=default_request_idle_timeout,
3806+
header_count_limit=default_header_count_limit,
3807+
no_wait=no_wait
3808+
)

0 commit comments

Comments
 (0)