Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3373c87
First add of aks-safeguards extension
NickKeller Jul 1, 2025
6f77661
First go at overriding args and doing some param validation
NickKeller Jul 1, 2025
e7a930e
Use correct arg type
NickKeller Jul 1, 2025
7dc0659
Override create, show, update, and delete classes to provide custom a…
NickKeller Jul 1, 2025
9e8d524
Update Python version classifiers in setup.py
NickKeller Jul 2, 2025
74f99c6
First add of aks-safeguards extension
NickKeller Jul 1, 2025
a079174
First go at overriding args and doing some param validation
NickKeller Jul 1, 2025
dcad2f9
Use correct arg type
NickKeller Jul 1, 2025
2c1e165
Override create, show, update, and delete classes to provide custom a…
NickKeller Jul 1, 2025
1bf7338
Update Python version classifiers in setup.py
NickKeller Jul 2, 2025
93a26e0
Correctly configure -g and -n arguments
NickKeller Jul 2, 2025
f34b358
pull down changes
NickKeller Jul 2, 2025
51c887c
Remove conflict cruft
NickKeller Jul 2, 2025
70953fd
Remove more conflict cruft
NickKeller Jul 2, 2025
576cce2
Fix args schema
NickKeller Jul 4, 2025
fa9b264
Run live tests
NickKeller Jul 4, 2025
8ffffda
Fix style errors and add help text
NickKeller Jul 7, 2025
1bceffd
update help
NickKeller Jul 7, 2025
31fafb0
Fix help format
NickKeller Jul 7, 2025
4aa0219
Merge branch 'main' into nikelle/azakssafeguards
NickKeller Jul 7, 2025
38a56b9
Update help command for excluded namespaces arg to specify format
NickKeller Jul 7, 2025
96d93b9
Add wait command
NickKeller Jul 7, 2025
f12afd4
Add helps in README
NickKeller Jul 7, 2025
28f81a7
Regenerate based off examples, generate correct test recording
NickKeller Jul 8, 2025
c6ceddc
Update src/aks-safeguards/azext_aks_safeguards/_help.py
NickKeller Jul 9, 2025
9f204a3
Update src/aks-safeguards/azext_aks_safeguards/aaz/latest/aks/safegua…
NickKeller Jul 9, 2025
18e6f79
Update src/aks-safeguards/azext_aks_safeguards/_help.py
NickKeller Jul 9, 2025
4d4f1d6
Modify metadata
NickKeller Jul 9, 2025
b79a8e4
Change back
NickKeller Jul 9, 2025
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
8 changes: 8 additions & 0 deletions src/aks-safeguards/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:

Release History
===============

1.0.0b1
++++++
* Initial release.
51 changes: 51 additions & 0 deletions src/aks-safeguards/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Azure CLI AksSafeguards Extension #
This is an extension to Azure CLI to manage AksSafeguards resources.

## Commands ##

### az aks safeguards create

Enable Deployment Safeguards for an AKS cluster

#### Examples

| Example | Description |
|---------|-------------|
| `az aks safeguards create --resource-group MyResourceGroup --name MyAKSCluster --level Warn` | Enable Deployment Safeguards for an AKS cluster at Warn level |
| `az aks safeguards create --resource-group MyResourceGroup --name MyAKSCluster --level Warn --excluded-namespaces [ns1,ns2]` | Enable Deployment Safeguards at Warn level for an AKS cluster with excluded namespaces |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `az aks safeguards create --resource-group MyResourceGroup --name MyAKSCluster --level Warn --excluded-namespaces [ns1,ns2]` | Enable Deployment Safeguards at Warn level for an AKS cluster with excluded namespaces |
| `az aks safeguards create --resource-group MyResourceGroup --name MyAKSCluster --level Warn --excluded-namespaces ns1 ns2` | Enable Deployment Safeguards at Warn level for an AKS cluster with excluded namespaces |

| `az aks safeguards create --managed-cluster "/subscriptions/MySubscriptionID/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerService/managedClusters/MyAKSCluster" --level Warn` | Enable Deployment Safeguards at Warn level for an AKS cluster by its resource ID |

### az aks safeguards update

Update Deployment Safeguards for an AKS cluster

#### Examples

| Example | Description |
|---------|-------------|
| `az aks safeguards update --resource-group MyResourceGroup --name MyAKSCluster --level Enforce` | Update Deployment Safeguards to Enforce level for an AKS cluster with a specific name and resource group |
| `az aks safeguards update --resource-group MyResourceGroup --name MyAKSCluster --excluded-namespaces [ns1,ns2] --level Warn` | Update Deployment Safeguards to Warn level for an AKS cluster with excluded namespaces |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `az aks safeguards update --resource-group MyResourceGroup --name MyAKSCluster --excluded-namespaces [ns1,ns2] --level Warn` | Update Deployment Safeguards to Warn level for an AKS cluster with excluded namespaces |
| `az aks safeguards update --resource-group MyResourceGroup --name MyAKSCluster --excluded-namespaces ns1 ns2 --level Warn` | Update Deployment Safeguards to Warn level for an AKS cluster with excluded namespaces |

| `az aks safeguards update --managed-cluster "/subscriptions/MySubscriptionID/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerService/managedClusters/MyAKSCluster" --level Enforce` | Update Deployment Safeguards to Enforce level for an AKS cluster by its resource ID |

### az aks safeguards show

Show Deployment Safeguards configuration for a Managed Cluster

#### Examples

| Example | Description |
|---------|-------------|
| `az aks safeguards show --resource-group MyResourceGroup --name MyAKSCluster` | Show Deployment Safeguards for an AKS cluster with a specific name and resource group |
| `az aks safeguards show --managed-cluster "/subscriptions/MySubscriptionID/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerService/managedClusters/MyAKSCluster"` | Show Deployment Safeguards for an AKS cluster by its resource ID |

### az aks safeguards delete

Delete Deployment Safeguards configuration for a Managed Cluster

#### Examples

| Example | Description |
|---------|-------------|
| `az aks safeguards delete --resource-group MyResourceGroup --name MyAKSCluster` | Delete Deployment Safeguards for an AKS cluster with a specific name and resource group |
| `az aks safeguards delete --managed-cluster "/subscriptions/MySubscriptionID/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerService/managedClusters/MyAKSCluster"` | Delete Deployment Safeguards for an AKS cluster by its resource ID |

42 changes: 42 additions & 0 deletions src/aks-safeguards/azext_aks_safeguards/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
from azext_aks_safeguards._help import helps # pylint: disable=unused-import


class AksSafeguardsCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
custom_command_type = CliCommandType(
operations_tmpl='azext_aks_safeguards.custom#{}')
super().__init__(cli_ctx=cli_ctx,
custom_command_type=custom_command_type)

def load_command_table(self, args):
from azext_aks_safeguards.commands import load_command_table
from azure.cli.core.aaz import load_aaz_command_table
try:
from . import aaz
except ImportError:
aaz = None
if aaz:
load_aaz_command_table(
loader=self,
aaz_pkg_name=aaz.__name__,
args=args
)
load_command_table(self, args)
return self.command_table

def load_arguments(self, command):
from azext_aks_safeguards._params import load_arguments
load_arguments(self, command)


COMMAND_LOADER_CLS = AksSafeguardsCommandsLoader
56 changes: 56 additions & 0 deletions src/aks-safeguards/azext_aks_safeguards/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: disable=line-too-long
# pylint: disable=too-many-lines

from knack.help_files import helps # pylint: disable=unused-import


helps['aks safeguards create'] = """
type: command
short-summary: Enable Deployment Safeguards for an AKS cluster
examples:
- name: Enable Deployment Safeguards for an AKS cluster at Warn level
text: az aks safeguards create --resource-group MyResourceGroup --name MyAKSCluster --level Warn
- name: Enable Deployment Safeguards at Warn level for an AKS cluster with excluded namespaces
text: az aks safeguards create --resource-group MyResourceGroup --name MyAKSCluster --level Warn --excluded-namespaces ns1 ns2
- name: Enable Deployment Safeguards at Warn level for an AKS cluster by its resource ID
text: az aks safeguards create --managed-cluster "/subscriptions/MySubscriptionID/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerService/managedClusters/MyAKSCluster" --level Warn
"""

helps['aks safeguards update'] = """
type: command
short-summary: Update Deployment Safeguards for an AKS cluster
examples:
- name: Update Deployment Safeguards to Enforce level for an AKS cluster with a specific name and resource group
text: az aks safeguards update --resource-group MyResourceGroup --name MyAKSCluster --level Enforce
- name: Update Deployment Safeguards to Warn level for an AKS cluster with excluded namespaces
text: az aks safeguards update --resource-group MyResourceGroup --name MyAKSCluster --excluded-namespaces ns1 ns2 --level Warn
- name: Update Deployment Safeguards to Enforce level for an AKS cluster by its resource ID
text: az aks safeguards update --managed-cluster "/subscriptions/MySubscriptionID/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerService/managedClusters/MyAKSCluster" --level Enforce
"""

helps['aks safeguards show'] = """
type: command
short-summary: Show Deployment Safeguards configuration for a Managed Cluster
examples:
- name: Show Deployment Safeguards for an AKS cluster with a specific name and resource group
text: az aks safeguards show --resource-group MyResourceGroup --name MyAKSCluster
- name: Show Deployment Safeguards for an AKS cluster by its resource ID
text: az aks safeguards show --managed-cluster "/subscriptions/MySubscriptionID/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerService/managedClusters/MyAKSCluster"
"""

helps['aks safeguards delete'] = """
type: command
short-summary: Delete Deployment Safeguards configuration for a Managed Cluster
examples:
- name: Delete Deployment Safeguards for an AKS cluster with a specific name and resource group
text: az aks safeguards delete --resource-group MyResourceGroup --name MyAKSCluster
- name: Delete Deployment Safeguards for an AKS cluster by its resource ID
text: az aks safeguards delete --managed-cluster "/subscriptions/MySubscriptionID/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerService/managedClusters/MyAKSCluster"
"""
13 changes: 13 additions & 0 deletions src/aks-safeguards/azext_aks_safeguards/_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: disable=too-many-lines
# pylint: disable=too-many-statements


def load_arguments(self, _): # pylint: disable=unused-argument
pass
6 changes: 6 additions & 0 deletions src/aks-safeguards/azext_aks_safeguards/aaz/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------
10 changes: 10 additions & 0 deletions src/aks-safeguards/azext_aks_safeguards/aaz/latest/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"aks",
)
class __CMDGroup(AAZCommandGroup):
"""Azure Kubernetes Service
"""
pass


__all__ = ["__CMDGroup"]
11 changes: 11 additions & 0 deletions src/aks-safeguards/azext_aks_safeguards/aaz/latest/aks/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"aks safeguards",
)
class __CMDGroup(AAZCommandGroup):
"""Manage Deployment Safeguards
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
from ._create import *
from ._delete import *
from ._list import *
from ._show import *
from ._update import *
from ._wait import *
Loading
Loading