From 128451272f7f3bd77bea539e81ba41aaf5e36b29 Mon Sep 17 00:00:00 2001 From: Silas Strawn Date: Thu, 13 Oct 2022 23:08:33 -0700 Subject: [PATCH] Remove enterprise-edge extension (#5191) * remove enterprise-edge extension * edit CODEOWNERS --- .github/CODEOWNERS | 2 - src/enterprise-edge/HISTORY.rst | 12 --- src/enterprise-edge/README.rst | 5 - .../azext_enterprise_edge/__init__.py | 29 ----- .../azext_enterprise_edge/_help.py | 28 ----- .../azext_enterprise_edge/_params.py | 22 ---- .../azext_enterprise_edge/azext_metadata.json | 4 - .../azext_enterprise_edge/commands.py | 13 --- .../azext_enterprise_edge/custom.py | 102 ------------------ .../azext_enterprise_edge/tests/__init__.py | 5 - .../tests/latest/__init__.py | 5 - .../latest/test_enterprise-edge_scenario.py | 16 --- src/enterprise-edge/setup.cfg | 0 src/enterprise-edge/setup.py | 56 ---------- src/index.json | 88 --------------- 15 files changed, 387 deletions(-) delete mode 100644 src/enterprise-edge/HISTORY.rst delete mode 100644 src/enterprise-edge/README.rst delete mode 100644 src/enterprise-edge/azext_enterprise_edge/__init__.py delete mode 100644 src/enterprise-edge/azext_enterprise_edge/_help.py delete mode 100644 src/enterprise-edge/azext_enterprise_edge/_params.py delete mode 100644 src/enterprise-edge/azext_enterprise_edge/azext_metadata.json delete mode 100644 src/enterprise-edge/azext_enterprise_edge/commands.py delete mode 100644 src/enterprise-edge/azext_enterprise_edge/custom.py delete mode 100644 src/enterprise-edge/azext_enterprise_edge/tests/__init__.py delete mode 100644 src/enterprise-edge/azext_enterprise_edge/tests/latest/__init__.py delete mode 100644 src/enterprise-edge/azext_enterprise_edge/tests/latest/test_enterprise-edge_scenario.py delete mode 100644 src/enterprise-edge/setup.cfg delete mode 100644 src/enterprise-edge/setup.py diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c2771e391a0..96fdec88f20 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -212,8 +212,6 @@ /src/purview/ @kairu-ms @jsntcy -/src/enterprise-edge/ @StrawnSC - /src/functionapp/ @gzuber /src/elastic/ @kairu-ms @jsntcy diff --git a/src/enterprise-edge/HISTORY.rst b/src/enterprise-edge/HISTORY.rst deleted file mode 100644 index 8afa59dba2d..00000000000 --- a/src/enterprise-edge/HISTORY.rst +++ /dev/null @@ -1,12 +0,0 @@ -.. :changelog: - -Release History -=============== - -0.1.1 -++++++ -* Automatically register Microsoft.CDN resource provider upon running enable command - -0.1.0 -++++++ -* Initial release. \ No newline at end of file diff --git a/src/enterprise-edge/README.rst b/src/enterprise-edge/README.rst deleted file mode 100644 index e3f9519fd60..00000000000 --- a/src/enterprise-edge/README.rst +++ /dev/null @@ -1,5 +0,0 @@ -Microsoft Azure CLI 'enterprise-edge' Extension -========================================== - -This package is for the 'enterprise-edge' extension. -i.e. 'az staticwebapp enterprise-edge' \ No newline at end of file diff --git a/src/enterprise-edge/azext_enterprise_edge/__init__.py b/src/enterprise-edge/azext_enterprise_edge/__init__.py deleted file mode 100644 index 5640792ec88..00000000000 --- a/src/enterprise-edge/azext_enterprise_edge/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -from azure.cli.core import AzCommandsLoader - -from azext_enterprise_edge._help import helps # pylint: disable=unused-import - - -class EnterpriseEdgeCommandsLoader(AzCommandsLoader): - - def __init__(self, cli_ctx=None): - from azure.cli.core.commands import CliCommandType - enterprise_edge_custom = CliCommandType( - operations_tmpl='azext_enterprise_edge.custom#{}') - super().__init__(cli_ctx=cli_ctx, custom_command_type=enterprise_edge_custom) - - def load_command_table(self, args): - from azext_enterprise_edge.commands import load_command_table - load_command_table(self, args) - return self.command_table - - def load_arguments(self, command): - from azext_enterprise_edge._params import load_arguments - load_arguments(self, command) - - -COMMAND_LOADER_CLS = EnterpriseEdgeCommandsLoader diff --git a/src/enterprise-edge/azext_enterprise_edge/_help.py b/src/enterprise-edge/azext_enterprise_edge/_help.py deleted file mode 100644 index e0a4ba534ea..00000000000 --- a/src/enterprise-edge/azext_enterprise_edge/_help.py +++ /dev/null @@ -1,28 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -from knack.help_files import helps # pylint: disable=unused-import - - -helps['staticwebapp enterprise-edge'] = """ - type: group - short-summary: Manage the Azure Front Door CDN for static webapps. For optimal experience and availability please check our documentation https://aka.ms/swaedge -""" - -helps['staticwebapp enterprise-edge enable'] = """ - type: command - short-summary: Enable the Azure Front Door CDN for a static webapp. Enabling enterprise-grade edge requires re-registration for the Azure Front Door Microsoft.CDN resource provider. For optimal experience and availability please check our documentation https://aka.ms/swaedge -""" - -helps['staticwebapp enterprise-edge disable'] = """ - type: command - short-summary: Disable the Azure Front Door CDN for a static webapp. For optimal experience and availability please check our documentation https://aka.ms/swaedge -""" - -helps['staticwebapp enterprise-edge show'] = """ - type: command - short-summary: Show the status (Enabled, Disabled, Enabling, Disabling) of the Azure Front Door CDN for a webapp. For optimal experience and availability please check our documentation https://aka.ms/swaedge -""" diff --git a/src/enterprise-edge/azext_enterprise_edge/_params.py b/src/enterprise-edge/azext_enterprise_edge/_params.py deleted file mode 100644 index 97bf9153519..00000000000 --- a/src/enterprise-edge/azext_enterprise_edge/_params.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=line-too-long - -from knack.arguments import CLIArgumentType - -from azure.cli.core.commands.parameters import resource_group_name_type - - -def load_arguments(self, _): - staticsite_name_arg_type = CLIArgumentType(options_list=['--name', '-n'], - metavar='NAME', - help="name of the staticwebapp") - - with self.argument_context('staticwebapp enterprise-edge') as c: - c.argument("name", arg_type=staticsite_name_arg_type) - c.argument("resource_group_name", arg_type=resource_group_name_type) - - with self.argument_context('staticwebapp enterprise-edge') as c: - c.argument("no_register", help="Don't try to register the Microsoft.CDN provider. Registration can be done manually with: az provider register --wait --namespace Microsoft.CDN. For more details, please review the documentation available at https://go.microsoft.com/fwlink/?linkid=2184995 .", default=False) diff --git a/src/enterprise-edge/azext_enterprise_edge/azext_metadata.json b/src/enterprise-edge/azext_enterprise_edge/azext_metadata.json deleted file mode 100644 index 97ba30d4e5e..00000000000 --- a/src/enterprise-edge/azext_enterprise_edge/azext_metadata.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "azext.isPreview": true, - "azext.minCliCoreVersion": "2.29.0" -} \ No newline at end of file diff --git a/src/enterprise-edge/azext_enterprise_edge/commands.py b/src/enterprise-edge/azext_enterprise_edge/commands.py deleted file mode 100644 index 73801503b17..00000000000 --- a/src/enterprise-edge/azext_enterprise_edge/commands.py +++ /dev/null @@ -1,13 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -# pylint: disable=line-too-long - - -def load_command_table(self, _): - with self.command_group('staticwebapp enterprise-edge', is_preview=True) as g: - g.custom_command('enable', 'enable_staticwebapp_enterprise_edge') - g.custom_command('disable', 'disable_staticwebapp_enterprise_edge') - g.custom_show_command('show', 'show_staticwebapp_enterprise_edge_status') diff --git a/src/enterprise-edge/azext_enterprise_edge/custom.py b/src/enterprise-edge/azext_enterprise_edge/custom.py deleted file mode 100644 index 388bcbe579c..00000000000 --- a/src/enterprise-edge/azext_enterprise_edge/custom.py +++ /dev/null @@ -1,102 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 knack.util import CLIError -from knack.log import get_logger - -from azure.cli.core.util import send_raw_request -from azure.cli.core.commands.client_factory import get_subscription_id -from azure.cli.command_modules.appservice._client_factory import providers_client_factory - - -logger = get_logger(__name__) - - -class StaticWebAppFrontDoorClient: - @classmethod - def _request(cls, cmd, resource_group, name, http_method="GET", body=None): - management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager - api_version = "2021-02-01" - sub_id = get_subscription_id(cmd.cli_ctx) - url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Web/staticSites/{}?api-version={}" - request_url = url_fmt.format( - management_hostname.strip('/'), - sub_id, - resource_group, - name, - api_version) - - if body is not None: - r = send_raw_request(cmd.cli_ctx, http_method, request_url, body=json.dumps(body)) - else: - r = send_raw_request(cmd.cli_ctx, http_method, request_url) - - return r - - @classmethod - def set(cls, cmd, resource_group, name, enable, no_register=False): - params = cls.get(cmd, resource_group, name).json() - - if enable and not no_register: - cls._register_cdn_provider(cmd) - cls._validate_sku(params["sku"].get("name")) - - params["properties"]["enterpriseGradeCdnStatus"] = "enabled" if enable else "disabled" - return cls._request(cmd, resource_group, name, "PUT", params) - - @classmethod - def get(cls, cmd, resource_group, name): - return cls._request(cmd, resource_group, name) - - @classmethod - def _register_cdn_provider(cls, cmd): - from azure.mgmt.resource.resources.models import ProviderRegistrationRequest, ProviderConsentDefinition - - namespace = "Microsoft.CDN" - properties = ProviderRegistrationRequest(third_party_provider_consent=ProviderConsentDefinition( - consent_to_authorization=True)) - - client = providers_client_factory(cmd.cli_ctx) - try: - client.register(namespace, properties=properties) - except Exception as e: - msg = "Server responded with error message : {} \n"\ - "Enabling enterprise-grade edge requires reregistration for the Azure Front "\ - "Door Microsoft.CDN resource provider. We were unable to perform that reregistration on your "\ - "behalf. Please check with your admin on permissions and review the documentation available at "\ - "https://go.microsoft.com/fwlink/?linkid=2185350. "\ - "Or try running registration manually with: az provider register --wait --namespace Microsoft.CDN" - raise CLIError(msg.format(e.args)) from e - - @classmethod - def _validate_sku(cls, sku_name): - if sku_name.lower() != "standard": - raise CLIError("Invalid SKU: '{}'. Staticwebapp must have 'Standard' SKU to use " - "enterprise edge CDN".format(sku_name)) - - -def _format_show_response(cmd, name, resource_group_name): - staticsite_data = StaticWebAppFrontDoorClient.get(cmd, name=name, resource_group=resource_group_name).json() - return {"enterpriseGradeCdnStatus": staticsite_data["properties"]["enterpriseGradeCdnStatus"]} - - -def enable_staticwebapp_enterprise_edge(cmd, name, resource_group_name, no_register=False): - logger.warning("For optimal experience and availability please check our documentation https://aka.ms/swaedge") - StaticWebAppFrontDoorClient.set(cmd, name=name, resource_group=resource_group_name, enable=True, - no_register=no_register) - return _format_show_response(cmd, name, resource_group_name) - - -def disable_staticwebapp_enterprise_edge(cmd, name, resource_group_name): - logger.warning("For optimal experience and availability please check our documentation https://aka.ms/swaedge") - StaticWebAppFrontDoorClient.set(cmd, name=name, resource_group=resource_group_name, enable=False) - return _format_show_response(cmd, name, resource_group_name) - - -def show_staticwebapp_enterprise_edge_status(cmd, name, resource_group_name): - logger.warning("For optimal experience and availability please check our documentation https://aka.ms/swaedge") - return _format_show_response(cmd, name, resource_group_name) diff --git a/src/enterprise-edge/azext_enterprise_edge/tests/__init__.py b/src/enterprise-edge/azext_enterprise_edge/tests/__init__.py deleted file mode 100644 index 99c0f28cd71..00000000000 --- a/src/enterprise-edge/azext_enterprise_edge/tests/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# ----------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# ----------------------------------------------------------------------------- diff --git a/src/enterprise-edge/azext_enterprise_edge/tests/latest/__init__.py b/src/enterprise-edge/azext_enterprise_edge/tests/latest/__init__.py deleted file mode 100644 index 2dcf9bb68b3..00000000000 --- a/src/enterprise-edge/azext_enterprise_edge/tests/latest/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# ----------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# ----------------------------------------------------------------------------- \ No newline at end of file diff --git a/src/enterprise-edge/azext_enterprise_edge/tests/latest/test_enterprise-edge_scenario.py b/src/enterprise-edge/azext_enterprise_edge/tests/latest/test_enterprise-edge_scenario.py deleted file mode 100644 index 6b4e09913f3..00000000000 --- a/src/enterprise-edge/azext_enterprise_edge/tests/latest/test_enterprise-edge_scenario.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -import os -import unittest - -from azure_devtools.scenario_tests import AllowLargeResponse -from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer) - - -TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) - - -# TODO \ No newline at end of file diff --git a/src/enterprise-edge/setup.cfg b/src/enterprise-edge/setup.cfg deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/enterprise-edge/setup.py b/src/enterprise-edge/setup.py deleted file mode 100644 index e645d07ecef..00000000000 --- a/src/enterprise-edge/setup.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python - -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - - -from codecs import open -from setuptools import setup, find_packages -try: - from azure_bdist_wheel import cmdclass -except ImportError: - from distutils import log as logger - logger.warn("Wheel is not available, disabling bdist_wheel hook") - -# TODO: Confirm this is the right version number you want and it matches your -# HISTORY.rst entry. -VERSION = '0.1.1' - -# The full list of classifiers is available at -# https://pypi.python.org/pypi?%3Aaction=list_classifiers -CLASSIFIERS = [ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'Intended Audience :: System Administrators', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'License :: OSI Approved :: MIT License', -] - -DEPENDENCIES = [] - -with open('README.rst', 'r', encoding='utf-8') as f: - README = f.read() -with open('HISTORY.rst', 'r', encoding='utf-8') as f: - HISTORY = f.read() - -setup( - name='enterprise-edge', - version=VERSION, - description='Support for Static Webapp-Azure Front Door Integration (aka Static Webapp Enterprise Edge)', - # TODO: Update author and email, if applicable - author='Microsoft Corporation', - author_email='azpycli@microsoft.com', - url='https://github.com/Azure/azure-cli-extensions/tree/master/src/enterprise-edge', - long_description=README + '\n\n' + HISTORY, - license='MIT', - classifiers=CLASSIFIERS, - packages=find_packages(), - install_requires=DEPENDENCIES, - package_data={'azext_enterprise_edge': ['azext_metadata.json']}, -) diff --git a/src/index.json b/src/index.json index 98b4105277a..12d70d44120 100644 --- a/src/index.json +++ b/src/index.json @@ -22695,94 +22695,6 @@ "sha256Digest": "eda91cb50484637810d1aa9177affbe4bb2008ef1072497414ddcc4cde558fdf" } ], - "enterprise-edge": [ - { - "downloadUrl": "https://azcliprod.blob.core.windows.net/cli-extensions/enterprise_edge-0.1.0-py3-none-any.whl", - "filename": "enterprise_edge-0.1.0-py3-none-any.whl", - "metadata": { - "azext.isPreview": true, - "azext.minCliCoreVersion": "2.29.0", - "classifiers": [ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Intended Audience :: System Administrators", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "License :: OSI Approved :: MIT License" - ], - "extensions": { - "python.details": { - "contacts": [ - { - "email": "azpycli@microsoft.com", - "name": "Microsoft Corporation", - "role": "author" - } - ], - "document_names": { - "description": "DESCRIPTION.rst" - }, - "project_urls": { - "Home": "https://github.com/Azure/azure-cli-extensions/tree/master/src/enterprise-edge" - } - } - }, - "generator": "bdist_wheel (0.30.0)", - "license": "MIT", - "metadata_version": "2.0", - "name": "enterprise-edge", - "summary": "Support for Static Webapp-Azure Front Door Integration (aka Static Webapp Enterprise Edge)", - "version": "0.1.0" - }, - "sha256Digest": "e4d25af22ab109975e04ca457fcd8ebd5a9b3a5e37425a61e0cdd35e871fe1e4" - }, - { - "downloadUrl": "https://azcliprod.blob.core.windows.net/cli-extensions/enterprise_edge-0.1.1-py3-none-any.whl", - "filename": "enterprise_edge-0.1.1-py3-none-any.whl", - "metadata": { - "azext.isPreview": true, - "azext.minCliCoreVersion": "2.29.0", - "classifiers": [ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Intended Audience :: System Administrators", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "License :: OSI Approved :: MIT License" - ], - "extensions": { - "python.details": { - "contacts": [ - { - "email": "azpycli@microsoft.com", - "name": "Microsoft Corporation", - "role": "author" - } - ], - "document_names": { - "description": "DESCRIPTION.rst" - }, - "project_urls": { - "Home": "https://github.com/Azure/azure-cli-extensions/tree/master/src/enterprise-edge" - } - } - }, - "generator": "bdist_wheel (0.30.0)", - "license": "MIT", - "metadata_version": "2.0", - "name": "enterprise-edge", - "summary": "Support for Static Webapp-Azure Front Door Integration (aka Static Webapp Enterprise Edge)", - "version": "0.1.1" - }, - "sha256Digest": "dad0c130d8345740fb86b377eebf2aba68bca691102004ad526690d0727823fb" - } - ], "eventgrid": [ { "downloadUrl": "https://eventgridcliextension.blob.core.windows.net/cli/eventgrid-0.4.4-py2.py3-none-any.whl",