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
4 changes: 4 additions & 0 deletions src/spring-cloud/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Release History
===============

2.7.0
-----
* Migrate to track2 SDK

2.6.0
-----
* Add support for 0.5 core, 512 Mi resource requests in app deployment
Expand Down
2 changes: 1 addition & 1 deletion src/spring-cloud/azext_spring_cloud/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def prepare_logs_argument(c):

with self.argument_context('spring-cloud certificate') as c:
c.argument('service', service_name_type)
c.argument('name', name_type, help='Name of certificate.')
c.argument('name', help='Name of certificate.')

with self.argument_context('spring-cloud certificate add') as c:
c.argument('vault_uri', help='The key vault uri where store the certificate')
Expand Down
15 changes: 13 additions & 2 deletions src/spring-cloud/azext_spring_cloud/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

import json
from enum import Enum
import os
import codecs
Expand All @@ -23,7 +23,7 @@

def _get_upload_local_file(runtime_version, artifact_path=None):
file_path = artifact_path
file_type = "NetCoreZip" if runtime_version == AppPlatformEnums.RuntimeVersion.net_core_31 else "Jar"
file_type = "NetCoreZip" if runtime_version == AppPlatformEnums.RuntimeVersion.NET_CORE31 else "Jar"

if file_path is None:
file_type = "Source"
Expand Down Expand Up @@ -229,3 +229,14 @@ def get_portal_uri(cli_ctx):
except Exception as e:
logger.debug("Could not get Azure Portal endpoint. Exception: %s", str(e))
return 'https://portal.azure.com'


def handle_asc_exception(ex):
try:
raise CLIError(ex.inner_exception.error.message)
except AttributeError:
if hasattr(ex, 'response'):
response_dict = json.loads(ex.response.internal_response.text)
raise CLIError(response_dict["error"]["message"])
else:
raise CLIError(ex)
41 changes: 27 additions & 14 deletions src/spring-cloud/azext_spring_cloud/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
# --------------------------------------------------------------------------------------------

# pylint: disable=line-too-long
from azext_spring_cloud._utils import handle_asc_exception

from ._client_factory import (cf_app_services,
cf_spring_cloud,
cf_spring_cloud_20201101preview,
cf_spring_cloud_20210601preview,
cf_bindings,
cf_config_servers)
from ._transformers import (transform_spring_cloud_table_output,
transform_app_table_output,
Expand All @@ -19,33 +20,37 @@

# pylint: disable=too-many-statements
def load_command_table(self, _):
with self.command_group('spring-cloud', client_factory=cf_app_services) as g:
with self.command_group('spring-cloud', client_factory=cf_app_services,
exception_handler=handle_asc_exception) as g:
g.custom_command('create', 'spring_cloud_create', supports_no_wait=True, client_factory=cf_spring_cloud)
g.custom_command('update', 'spring_cloud_update', supports_no_wait=True, client_factory=cf_spring_cloud)
g.custom_command('delete', 'spring_cloud_delete', supports_no_wait=True)
g.custom_command('list', 'spring_cloud_list', table_transformer=transform_spring_cloud_table_output)
g.custom_show_command('show', 'spring_cloud_get', table_transformer=transform_spring_cloud_table_output)

with self.command_group('spring-cloud test-endpoint', client_factory=cf_spring_cloud) as g:
with self.command_group('spring-cloud test-endpoint', client_factory=cf_spring_cloud,
exception_handler=handle_asc_exception) as g:
g.custom_command('enable ', 'enable_test_endpoint')
g.custom_show_command('disable ', 'disable_test_endpoint')
g.custom_command('renew-key', 'regenerate_keys')
g.custom_command('list', 'list_keys')

with self.command_group('spring-cloud config-server', client_factory=cf_config_servers) as g:
with self.command_group('spring-cloud config-server', client_factory=cf_config_servers,
exception_handler=handle_asc_exception) as g:
g.custom_command('set', 'config_set', supports_no_wait=True)
g.custom_command('clear', 'config_delete')
g.custom_show_command('show', 'config_get')

with self.command_group('spring-cloud config-server git', client_factory=cf_config_servers,
supports_local_cache=True) as g:
supports_local_cache=True, exception_handler=handle_asc_exception) as g:
g.custom_command('set', 'config_git_set')
g.custom_command('repo add', 'config_repo_add')
g.custom_command('repo remove', 'config_repo_delete')
g.custom_command('repo update', 'config_repo_update')
g.custom_command('repo list', 'config_repo_list')

with self.command_group('spring-cloud app', client_factory=cf_spring_cloud_20210601preview) as g:
with self.command_group('spring-cloud app', client_factory=cf_spring_cloud_20210601preview,
exception_handler=handle_asc_exception) as g:
g.custom_command('create', 'app_create')
g.custom_command('update', 'app_update')
g.custom_command('deploy', 'app_deploy', supports_no_wait=True)
Expand All @@ -65,24 +70,28 @@ def load_command_table(self, _):
g.custom_command('restart', 'app_restart', supports_no_wait=True)
g.custom_command('logs', 'app_tail_log')

with self.command_group('spring-cloud app identity', client_factory=cf_spring_cloud) as g:
with self.command_group('spring-cloud app identity', client_factory=cf_spring_cloud,
exception_handler=handle_asc_exception) as g:
g.custom_command('assign', 'app_identity_assign')
g.custom_command('remove', 'app_identity_remove')
g.custom_show_command('show', 'app_identity_show')

with self.command_group('spring-cloud app log', client_factory=cf_spring_cloud,
deprecate_info=g.deprecate(redirect='az spring-cloud app logs', hide=True)) as g:
deprecate_info=g.deprecate(redirect='az spring-cloud app logs', hide=True),
exception_handler=handle_asc_exception) as g:
g.custom_command('tail', 'app_tail_log')

with self.command_group('spring-cloud app deployment', client_factory=cf_spring_cloud_20210601preview) as g:
with self.command_group('spring-cloud app deployment', client_factory=cf_spring_cloud_20210601preview,
exception_handler=handle_asc_exception) as g:
g.custom_command('create', 'deployment_create', supports_no_wait=True)
g.custom_command('list', 'deployment_list',
table_transformer=transform_spring_cloud_deployment_output)
g.custom_show_command(
'show', 'deployment_get', table_transformer=transform_spring_cloud_deployment_output)
g.custom_command('delete', 'deployment_delete')

with self.command_group('spring-cloud app binding', client_factory=cf_spring_cloud) as g:
with self.command_group('spring-cloud app binding', client_factory=cf_spring_cloud,
exception_handler=handle_asc_exception) as g:
g.custom_command('list', 'binding_list')
g.custom_show_command('show', 'binding_get')
g.custom_command('cosmos add', 'binding_cosmos_add')
Expand All @@ -93,22 +102,26 @@ def load_command_table(self, _):
g.custom_command('redis update', 'binding_redis_update')
g.custom_show_command('remove', 'binding_remove')

with self.command_group('spring-cloud certificate', client_factory=cf_spring_cloud) as g:
with self.command_group('spring-cloud certificate', client_factory=cf_spring_cloud,
exception_handler=handle_asc_exception) as g:
g.custom_command('add', 'certificate_add')
g.custom_show_command('show', 'certificate_show', table_transformer=transform_spring_cloud_certificate_output)
g.custom_command('list', 'certificate_list', table_transformer=transform_spring_cloud_certificate_output)
g.custom_command('remove', 'certificate_remove')

with self.command_group('spring-cloud app custom-domain', client_factory=cf_spring_cloud) as g:
with self.command_group('spring-cloud app custom-domain', client_factory=cf_spring_cloud,
exception_handler=handle_asc_exception) as g:
g.custom_command('bind', 'domain_bind')
g.custom_show_command('show', 'domain_show', table_transformer=transform_spring_cloud_custom_domain_output)
g.custom_command('list', 'domain_list', table_transformer=transform_spring_cloud_custom_domain_output)
g.custom_command('update', 'domain_update')
g.custom_command('unbind', 'domain_unbind')

with self.command_group('spring-cloud app-insights', is_preview=True, client_factory=cf_spring_cloud_20201101preview) as g:
with self.command_group('spring-cloud app-insights', is_preview=True,
client_factory=cf_spring_cloud_20201101preview,
exception_handler=handle_asc_exception) as g:
g.custom_command('update', 'app_insights_update')
g.custom_show_command('show', 'app_insights_show')

with self.command_group('spring-cloud'):
with self.command_group('spring-cloud', exception_handler=handle_asc_exception):
pass
Loading