Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/spring/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Release History
===============
1.1.11
---
* Add command `az spring app deployment enable-remote-debugging`.
* Add command `az spring app deployment disable-remote-debugging`.
* Add command `az spring app deployment get-remote-debugging-config`.

1.1.10
---
* Remove `Preview` tag for user-assigned identities of apps.
Expand Down
15 changes: 15 additions & 0 deletions src/spring/azext_spring/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,21 @@
short-summary: Restart instances of the app, default to production deployment.
"""

helps['spring app enable-remote-debugging'] = """
type: command
short-summary: Enable remote debugging for a deployment.
"""

helps['spring app disable-remote-debugging'] = """
type: command
short-summary: Disable remote debugging for a deployment.
"""

helps['spring app get-remote-debugging-config'] = """
type: command
short-summary: Get the remote debugging configuration of a deployment.
"""

helps['spring app deploy'] = """
type: command
short-summary: Deploy source code or pre-built binary to an app and update related configurations.
Expand Down
15 changes: 14 additions & 1 deletion src/spring/azext_spring/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
validate_vnet, validate_vnet_required_parameters, validate_node_resource_group,
validate_tracing_parameters_asc_create, validate_tracing_parameters_asc_update,
validate_app_insights_parameters, validate_instance_count, validate_java_agent_parameters,
validate_ingress_timeout, validate_jar, validate_ingress_send_timeout, validate_ingress_session_max_age)
validate_ingress_timeout, validate_remote_debugging_port, validate_jar, validate_ingress_send_timeout,
validate_ingress_session_max_age)
from ._validators_enterprise import (only_support_enterprise, validate_builder_resource, validate_builder_create,
validate_builder_update, validate_build_pool_size,
validate_git_uri, validate_acs_patterns, validate_config_file_patterns,
Expand Down Expand Up @@ -287,6 +288,18 @@ def load_arguments(self, _):
c.argument('deployment', options_list=[
'--deployment', '-d'], help='Name of an existing deployment of the app. Default to the production deployment if not specified.', validator=fulfill_deployment_param)

for scope in ['spring app disable-remote-debugging', 'spring app get-remote-debugging-config']:
with self.argument_context(scope) as c:
c.argument('deployment', options_list=[
'--deployment', '-d'], help='Name of an existing deployment of the app. Default to the production deployment if not specified.', validator=fulfill_deployment_param)

with self.argument_context('spring app enable-remote-debugging') as c:
c.argument('deployment', options_list=[
'--deployment', '-d'], help='Name of an existing deployment of the app. Default to the production deployment if not specified.', validator=fulfill_deployment_param)
c.argument('remote_debugging_port', options_list=['--port', '-p'], type=int, default=5005,
help='Remote debugging port, the value should be from 1024 to 65536, default value is 5005',
validator=validate_remote_debugging_port)

with self.argument_context('spring app unset-deployment') as c:
c.argument('name', name_type, help='Name of app.', validator=active_deployment_exist)

Expand Down
6 changes: 6 additions & 0 deletions src/spring/azext_spring/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ def validate_ingress_timeout(namespace):
raise InvalidArgumentValueError("Invalid value: Ingress read timeout must be in the range [1,1800].")


def validate_remote_debugging_port(namespace):
if namespace.remote_debugging_port is not None and (namespace.remote_debugging_port < 1024 or
namespace.remote_debugging_port > 65535):
raise InvalidArgumentValueError("Invalid value: remote debugging port must be in the range [1024,65535].")


def validate_ingress_send_timeout(namespace):
if namespace.ingress_send_timeout is not None and (namespace.ingress_read_timeout < 1 or
namespace.ingress_read_timeout > 1800):
Expand Down
3 changes: 3 additions & 0 deletions src/spring/azext_spring/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ def load_command_table(self, _):
g.custom_command('append-persistent-storage', 'app_append_persistent_storage')
g.custom_command('append-loaded-public-certificate', 'app_append_loaded_public_certificate')
g.custom_command('connect', 'app_connect')
g.custom_command('enable-remote-debugging', 'deployment_enable_remote_debugging', supports_no_wait=True)
g.custom_command('disable-remote-debugging', 'deployment_disable_remote_debugging', supports_no_wait=True)
g.custom_command('get-remote-debugging-config', 'deployment_get_remote_debugging')

with self.command_group('spring app identity', custom_command_type=app_managed_identity_command,
exception_handler=handle_asc_exception) as g:
Expand Down
18 changes: 18 additions & 0 deletions src/spring/azext_spring/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from .vendored_sdks.appplatform.v2022_01_01_preview import models as models_20220101preview
from .vendored_sdks.appplatform.v2022_05_01_preview import models as models_20220501preview
from .vendored_sdks.appplatform.v2020_07_01.models import _app_platform_management_client_enums as AppPlatformEnums
from .vendored_sdks.appplatform.v2022_09_01_preview import models as models_20220901preview
from .vendored_sdks.appplatform.v2020_11_01_preview import (
AppPlatformManagementClient as AppPlatformManagementClient_20201101preview
)
Expand Down Expand Up @@ -315,6 +316,23 @@ def app_stop(cmd, client,
resource_group, service, name, deployment.name)


def deployment_enable_remote_debugging(cmd, client, resource_group, service, name, remote_debugging_port=None, deployment=None, no_wait=False):
logger.warning("Enable remote debugging for the app '{}', deployment '{}'".format(name, deployment.name))
remote_debugging_payload = models_20220901preview.RemoteDebuggingPayload(port=remote_debugging_port)
return sdk_no_wait(no_wait, client.deployments.begin_enable_remote_debugging,
resource_group, service, name, deployment.name, remote_debugging_payload)


def deployment_disable_remote_debugging(cmd, client, resource_group, service, name, deployment=None, no_wait=False):
logger.warning("Disable remote debugging for the app '{}', deployment '{}'".format(name, deployment.name))
return sdk_no_wait(no_wait, client.deployments.begin_disable_remote_debugging,
resource_group, service, name, deployment.name)


def deployment_get_remote_debugging(cmd, client, resource_group, service, name, deployment=None):
return client.deployments.get_remote_debugging_config(resource_group, service, name, deployment.name)


def app_restart(cmd, client,
resource_group,
service,
Expand Down
Loading