Skip to content

Commit e59a3ad

Browse files
tundwedDanny Tundwe (from Dev Box)
andauthored
{edge-action} Add edge-action extension for Edge Actions (2025-09-01-preview) (#9439)
* Add edge-action extension with 2025-09-01-preview API - Generated extension structure from AAZ - Added custom deploy-from-file command for file/zip deployment - Migrated 5 test scenarios with recordings from main CLI repo - Supports both file (.js) and zip deployment types - Auto-detection of deployment type from file extension * Fix linter and style issues - Added linter_exclusions.yml for long parameter names - Added parameter help documentation for deploy-from-file command - Fixed line length in _params.py - Fixed pylint warning in custom.py (initialized encoded_content) - All tests passing (5/5) in playback mode * Update documentation to clarify Azure Front Door (AFD) Edge Actions - Updated README.md with comprehensive usage examples - Clarified service is Azure Front Door Edge Actions (not generic CDN) - Added installation instructions and command examples - Updated setup.py description to mention Azure Front Door * Add extension summary metadata - Added azext.summary following Azure CLI extension guidelines - Summary is concise (under 140 chars), specific, and uses correct branding - Verified with test_index.py validation * Add help and examples for deploy-from-file command - Added command help with short and long summaries - Added 3 examples covering JavaScript, zip, and explicit deployment type - Fixes missing_command_example linter error * Move base64 import to top of test file - Moved 'import base64' from inside test method to top-level imports - Follows Python best practices for import organization - All imports now grouped at the top of the file * Add edge-action to service name mapping --------- Co-authored-by: Danny Tundwe (from Dev Box) <[email protected]>
1 parent e6e99fa commit e59a3ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+10772
-0
lines changed

src/edge-action/HISTORY.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.. :changelog:
2+
3+
Release History
4+
===============
5+
6+
1.0.0b1
7+
++++++
8+
* Initial release.

src/edge-action/README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Azure CLI Edge Action Extension
2+
3+
Azure CLI extension for managing Azure Front Door (AFD) Edge Actions.
4+
5+
## Overview
6+
7+
Edge Actions allow you to customize how Azure Front Door handles requests and responses at the edge. This extension provides commands to create, manage, and deploy Edge Actions for Azure Front Door.
8+
9+
## Installation
10+
11+
```bash
12+
az extension add --name edge-action
13+
```
14+
15+
## Commands
16+
17+
### Edge Action Management
18+
19+
```bash
20+
# Create an edge action
21+
az edge-action create --resource-group myResourceGroup --name myEdgeAction --location global --sku name=Standard tier=Standard
22+
23+
# List edge actions
24+
az edge-action list --resource-group myResourceGroup
25+
26+
# Show edge action details
27+
az edge-action show --resource-group myResourceGroup --name myEdgeAction
28+
29+
# Update edge action
30+
az edge-action update --resource-group myResourceGroup --name myEdgeAction --tags env=prod
31+
32+
# Delete edge action
33+
az edge-action delete --resource-group myResourceGroup --name myEdgeAction
34+
```
35+
36+
### Version Management
37+
38+
```bash
39+
# Create a version
40+
az edge-action version create --resource-group myResourceGroup --edge-action-name myEdgeAction --name v1 --location global --deployment-type file
41+
42+
# Deploy code to a version
43+
az edge-action version deploy-from-file --resource-group myResourceGroup --edge-action-name myEdgeAction --version v1 --file-path ./mycode.js
44+
45+
# List versions
46+
az edge-action version list --resource-group myResourceGroup --edge-action-name myEdgeAction
47+
48+
# Delete a version
49+
az edge-action version delete --resource-group myResourceGroup --edge-action-name myEdgeAction --name v1
50+
```
51+
52+
### Execution Filters
53+
54+
```bash
55+
# Create an execution filter
56+
az edge-action execution-filter create --resource-group myResourceGroup --edge-action-name myEdgeAction --name myFilter --location global --action-version-id /subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Cdn/edgeActions/{name}/versions/{version}
57+
58+
# List execution filters
59+
az edge-action execution-filter list --resource-group myResourceGroup --edge-action-name myEdgeAction
60+
61+
# Delete an execution filter
62+
az edge-action execution-filter delete --resource-group myResourceGroup --edge-action-name myEdgeAction --name myFilter
63+
```
64+
65+
## Features
66+
67+
- Full lifecycle management of Azure Front Door Edge Actions
68+
- Version control for Edge Action code
69+
- JavaScript and zip file deployment support
70+
- Execution filter management for selective Edge Action execution
71+
- Azure Front Door route attachment support
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
from azure.cli.core import AzCommandsLoader
9+
from azext_edge_action._help import helps # pylint: disable=unused-import
10+
11+
12+
class EdgeActionCommandsLoader(AzCommandsLoader):
13+
14+
def __init__(self, cli_ctx=None):
15+
from azure.cli.core.commands import CliCommandType
16+
custom_command_type = CliCommandType(
17+
operations_tmpl='azext_edge_action.custom#{}')
18+
super().__init__(cli_ctx=cli_ctx,
19+
custom_command_type=custom_command_type)
20+
21+
def load_command_table(self, args):
22+
from azext_edge_action.commands import load_command_table
23+
from azure.cli.core.aaz import load_aaz_command_table
24+
try:
25+
from . import aaz
26+
except ImportError:
27+
aaz = None
28+
if aaz:
29+
load_aaz_command_table(
30+
loader=self,
31+
aaz_pkg_name=aaz.__name__,
32+
args=args
33+
)
34+
load_command_table(self, args)
35+
return self.command_table
36+
37+
def load_arguments(self, command):
38+
from azext_edge_action._params import load_arguments
39+
load_arguments(self, command)
40+
41+
42+
COMMAND_LOADER_CLS = EdgeActionCommandsLoader
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: disable=line-too-long
9+
# pylint: disable=too-many-lines
10+
11+
from knack.help_files import helps # pylint: disable=unused-import
12+
13+
14+
helps['edge-action version deploy-from-file'] = """
15+
type: command
16+
short-summary: Deploy edge action version code from a JavaScript or zip file.
17+
long-summary: |
18+
This command provides file-based deployment for edge action versions. It automatically detects the deployment type based on the file extension (.js for JavaScript files, .zip for zip archives) unless explicitly specified.
19+
examples:
20+
- name: Deploy a JavaScript file to an edge action version
21+
text: |
22+
az edge-action version deploy-from-file --resource-group myResourceGroup --edge-action-name myEdgeAction --version v1 --file-path ./mycode.js
23+
- name: Deploy a zip file to an edge action version
24+
text: |
25+
az edge-action version deploy-from-file --resource-group myResourceGroup --edge-action-name myEdgeAction --version v1 --file-path ./mycode.zip
26+
- name: Deploy a JavaScript file with explicit deployment type
27+
text: |
28+
az edge-action version deploy-from-file --resource-group myResourceGroup --edge-action-name myEdgeAction --version v1 --file-path ./mycode.js --deployment-type file
29+
"""
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: disable=too-many-lines
9+
# pylint: disable=too-many-statements
10+
11+
12+
def load_arguments(self, _): # pylint: disable=unused-argument
13+
with self.argument_context('edge-action version deploy-from-file') as c:
14+
c.argument('resource_group', options_list=['--resource-group', '-g'],
15+
help='Name of resource group.')
16+
c.argument('edge_action_name', help='Name of the edge action.')
17+
c.argument('version', help='Version name.')
18+
c.argument('file_path', help='Path to JavaScript (.js) or zip (.zip) file to deploy.')
19+
c.argument('deployment_type',
20+
help='Deployment type: "file" for JavaScript files, "zip" for zip archives. '
21+
'Auto-detected if not specified.')
22+
c.argument('no_wait', help='Do not wait for the long-running operation to finish.')
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command_group(
15+
"edge-action",
16+
)
17+
class __CMDGroup(AAZCommandGroup):
18+
"""Manage Edge Action
19+
"""
20+
pass
21+
22+
23+
__all__ = ["__CMDGroup"]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from .__cmd_group import *
12+
from ._add_attachment import *
13+
from ._create import *
14+
from ._delete import *
15+
from ._delete_attachment import *
16+
from ._list import *
17+
from ._show import *
18+
from ._update import *
19+
from ._wait import *

0 commit comments

Comments
 (0)