Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Terminology end-to-end TLS to ingress-to-app TLS #4320

Merged
merged 5 commits into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
12 changes: 9 additions & 3 deletions src/spring-cloud/azext_spring_cloud/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ def load_arguments(self, _):
help='If true, assign endpoint URL for direct access.',
options_list=['--assign-endpoint', c.deprecate(target='--is-public', redirect='--assign-endpoint', hide=True)])
c.argument('https_only', arg_type=get_three_state_flag(), help='If true, access app via https', default=False)
c.argument('enable_end_to_end_tls', arg_type=get_three_state_flag(), help='If true, enable end to end tls')
c.argument('enable_ingress_to_app_tls', arg_type=get_three_state_flag(),
help='If true, enable ingress to app tls'
options_list=['--enable-ingress-to-app-tls', c.deprecate(target='--enable-end-to-end-tls', redirect='--enable-ingress-to-app-tls', hide=True)])
c.argument('persistent_storage', type=str,
help='A json file path for the persistent storages to be mounted to the app')
c.argument('loaded_public_certificate_file', type=str, options_list=['--loaded-public-certificate-file', '-f'],
Expand Down Expand Up @@ -458,11 +460,15 @@ def prepare_logs_argument(c):

with self.argument_context('spring-cloud app custom-domain bind') as c:
c.argument('certificate', type=str, help='Certificate name in Azure Spring Cloud.')
c.argument('enable_end_to_end_tls', arg_type=get_three_state_flag(), help='If true, enable end to end tls')
c.argument('enable_ingress_to_app_tls', arg_type=get_three_state_flag(),
help='If true, enable ingress to app tls'
options_list=['--enable-ingress-to-app-tls', c.deprecate(target='--enable-end-to-end-tls', redirect='--enable-ingress-to-app-tls', hide=True)])

with self.argument_context('spring-cloud app custom-domain update') as c:
c.argument('certificate', help='Certificate name in Azure Spring Cloud.')
c.argument('enable_end_to_end_tls', arg_type=get_three_state_flag(), help='If true, enable end to end tls')
c.argument('enable_ingress_to_app_tls', arg_type=get_three_state_flag(),
help='If true, enable ingress to app tls'
options_list=['--enable-ingress-to-app-tls', c.deprecate(target='--enable-end-to-end-tls', redirect='--enable-ingress-to-app-tls', hide=True)])

with self.argument_context('spring-cloud app-insights update') as c:
c.argument('app_insights_key',
Expand Down
4 changes: 2 additions & 2 deletions src/spring-cloud/azext_spring_cloud/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def app_update(cmd, client, resource_group, service, name,
# app
assign_endpoint=None,
enable_persistent_storage=None,
enable_end_to_end_tls=None,
enable_ingress_to_app_tls=None,
https_only=None,
persistent_storage=None,
loaded_public_certificate_file=None,
Expand Down Expand Up @@ -170,7 +170,7 @@ def app_update(cmd, client, resource_group, service, name,
'enable_persistent_storage': enable_persistent_storage,
'persistent_storage': persistent_storage,
'loaded_public_certificate_file': loaded_public_certificate_file,
'enable_end_to_end_tls': enable_end_to_end_tls,
'enable_end_to_end_tls': enable_ingress_to_app_tls,
'https_only': https_only,
}

Expand Down
18 changes: 9 additions & 9 deletions src/spring-cloud/azext_spring_cloud/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1274,32 +1274,32 @@ def certificate_list_reference_app(cmd, client, resource_group, service, name):
def domain_bind(cmd, client, resource_group, service, app,
domain_name,
certificate=None,
enable_end_to_end_tls=None):
enable_ingress_to_app_tls=None):
properties = models.CustomDomainProperties()
if certificate is not None:
certificate_response = client.certificates.get(resource_group, service, certificate)
properties = models.CustomDomainProperties(
thumbprint=certificate_response.properties.thumbprint,
cert_name=certificate
)
if enable_end_to_end_tls is not None:
_update_app_e2e_tls(cmd, client, resource_group, service, app, enable_end_to_end_tls)
if enable_ingress_to_app_tls is not None:
_update_app_e2e_tls(cmd, client, resource_group, service, app, enable_ingress_to_app_tls)

custom_domain_resource = models.CustomDomainResource(properties=properties)
return client.custom_domains.begin_create_or_update(resource_group, service, app,
domain_name, custom_domain_resource)


def _update_app_e2e_tls(cmd, client, resource_group, service, app, enable_end_to_end_tls):
def _update_app_e2e_tls(cmd, client, resource_group, service, app, enable_ingress_to_app_tls):
resource = client.services.get(resource_group, service)
location = resource.location

properties = models_20220101preview.AppResourceProperties(enable_end_to_end_tls=enable_end_to_end_tls)
properties = models_20220101preview.AppResourceProperties(enable_end_to_end_tls=enable_ingress_to_app_tls)
app_resource = models_20220101preview.AppResource()
app_resource.properties = properties
app_resource.location = location

logger.warning("Set end to end tls for app '{}'".format(app))
logger.warning("Set ingress to app tls for app '{}'".format(app))
poller = client.apps.begin_update(
resource_group, service, app, app_resource)
return poller.result()
Expand All @@ -1316,16 +1316,16 @@ def domain_list(cmd, client, resource_group, service, app):
def domain_update(cmd, client, resource_group, service, app,
domain_name,
certificate=None,
enable_end_to_end_tls=None):
enable_ingress_to_app_tls=None):
properties = models.CustomDomainProperties()
if certificate is not None:
certificate_response = client.certificates.get(resource_group, service, certificate)
properties = models.CustomDomainProperties(
thumbprint=certificate_response.properties.thumbprint,
cert_name=certificate
)
if enable_end_to_end_tls is not None:
_update_app_e2e_tls(cmd, client, resource_group, service, app, enable_end_to_end_tls)
if enable_ingress_to_app_tls is not None:
_update_app_e2e_tls(cmd, client, resource_group, service, app, enable_ingress_to_app_tls)

custom_domain_resource = models.CustomDomainResource(properties=properties)
return client.custom_domains.begin_create_or_update(resource_group, service, app,
Expand Down