From 216c6b15f4818f3538e84c17456e1daa1c1c6c22 Mon Sep 17 00:00:00 2001 From: Kshitija Murudi Date: Sun, 20 Sep 2026 20:41:16 -0700 Subject: [PATCH 1/8] Replace Agent Mesh with Agent Fabric Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/agentfabric/HISTORY.rst | 9 + src/agentfabric/README.md | 81 + src/agentfabric/azext_agentfabric/__init__.py | 42 + src/agentfabric/azext_agentfabric/_help.py | 11 + src/agentfabric/azext_agentfabric/_params.py | 13 + .../azext_agentfabric/aaz/__init__.py | 6 + .../azext_agentfabric/aaz/latest/__init__.py | 15 + .../aaz/latest/agentfabric/__cmd_group.py | 23 + .../aaz/latest/agentfabric/__init__.py | 17 + .../aaz/latest/agentfabric/_create.py | 309 ++++ .../aaz/latest/agentfabric/_delete.py | 166 ++ .../aaz/latest/agentfabric/_list.py | 373 +++++ .../aaz/latest/agentfabric/_show.py | 223 +++ .../aaz/latest/agentfabric/_update.py | 270 ++++ .../aaz/latest/agentfabric/_wait.py | 219 +++ .../latest/agentfabric/member/__cmd_group.py | 23 + .../aaz/latest/agentfabric/member/__init__.py | 17 + .../aaz/latest/agentfabric/member/_create.py | 516 +++++++ .../aaz/latest/agentfabric/member/_delete.py | 179 +++ .../aaz/latest/agentfabric/member/_list.py | 300 ++++ .../aaz/latest/agentfabric/member/_show.py | 301 ++++ .../aaz/latest/agentfabric/member/_update.py | 348 +++++ .../aaz/latest/agentfabric/member/_wait.py | 297 ++++ .../agentfabric/policy_group/__cmd_group.py | 23 + .../agentfabric/policy_group/__init__.py | 17 + .../agentfabric/policy_group/_create.py | 1332 +++++++++++++++++ .../agentfabric/policy_group/_delete.py | 166 ++ .../latest/agentfabric/policy_group/_list.py | 953 ++++++++++++ .../latest/agentfabric/policy_group/_show.py | 513 +++++++ .../agentfabric/policy_group/_update.py | 560 +++++++ .../latest/agentfabric/policy_group/_wait.py | 509 +++++++ .../azext_agentfabric/azext_metadata.json | 4 + src/agentfabric/azext_agentfabric/commands.py | 15 + src/agentfabric/azext_agentfabric/custom.py | 14 + .../azext_agentfabric/tests/__init__.py | 6 + .../tests/latest/__init__.py | 6 + .../tests/latest/test_agentfabric.py | 209 +++ src/agentfabric/linter_exclusions.yml | 5 + src/agentfabric/setup.cfg | 1 + src/agentfabric/setup.py | 51 + src/service_name.json | 5 + 41 files changed, 8147 insertions(+) create mode 100644 src/agentfabric/HISTORY.rst create mode 100644 src/agentfabric/README.md create mode 100644 src/agentfabric/azext_agentfabric/__init__.py create mode 100644 src/agentfabric/azext_agentfabric/_help.py create mode 100644 src/agentfabric/azext_agentfabric/_params.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/__init__.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/__init__.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/__cmd_group.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/__init__.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_create.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_delete.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_list.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_show.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_update.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_wait.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/__cmd_group.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/__init__.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_create.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_delete.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_list.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_show.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_update.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_wait.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/__cmd_group.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/__init__.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_create.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_delete.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_list.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_show.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_update.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_wait.py create mode 100644 src/agentfabric/azext_agentfabric/azext_metadata.json create mode 100644 src/agentfabric/azext_agentfabric/commands.py create mode 100644 src/agentfabric/azext_agentfabric/custom.py create mode 100644 src/agentfabric/azext_agentfabric/tests/__init__.py create mode 100644 src/agentfabric/azext_agentfabric/tests/latest/__init__.py create mode 100644 src/agentfabric/azext_agentfabric/tests/latest/test_agentfabric.py create mode 100644 src/agentfabric/linter_exclusions.yml create mode 100644 src/agentfabric/setup.cfg create mode 100644 src/agentfabric/setup.py diff --git a/src/agentfabric/HISTORY.rst b/src/agentfabric/HISTORY.rst new file mode 100644 index 00000000000..6e680cb998e --- /dev/null +++ b/src/agentfabric/HISTORY.rst @@ -0,0 +1,9 @@ +.. :changelog: + +Release History +=============== + +1.0.0b1 +++++++ +* Initial preview release for Azure Agent Fabric using API version ``2026-07-21-preview``. +* Add Agent Fabric, member, and Policy Group create, show, list, update, delete, and wait commands. \ No newline at end of file diff --git a/src/agentfabric/README.md b/src/agentfabric/README.md new file mode 100644 index 00000000000..2fe8c988336 --- /dev/null +++ b/src/agentfabric/README.md @@ -0,0 +1,81 @@ +# Azure CLI Agent Fabric Extension + +This extension manages Azure Agent Fabric resources, their child members, and +independent Policy Group peer resources. It uses the `Microsoft.NetworkSecurity` +resource provider API version `2026-07-21-preview`. + +## Resource hierarchy + +```text +Microsoft.NetworkSecurity +├── agentFabrics/{fabricName} (independent top-level resource) +│ └── members/{memberName} (child of an Agent Fabric) +└── policyGroups/{policyGroupName} (independent top-level peer resource) +``` + +## Install + +```bash +az extension add --name agentfabric +``` + +## Agent Fabrics + +Root CRUD commands manage Agent Fabric resources. + +```bash +az agentfabric create \ + --resource-group myResourceGroup \ + --name myFabric \ + --location eastus \ + --trust-domain contoso.agentfabric + +az agentfabric update \ + --resource-group myResourceGroup \ + --name myFabric \ + --tags environment=production + +az agentfabric list --resource-group myResourceGroup +``` + +## Members + +Members are children of an Agent Fabric, so member commands require the parent +Fabric name through `--fabric-name`. + +```bash +az agentfabric member create \ + --resource-group myResourceGroup \ + --fabric-name myFabric \ + --member-name myMember \ + --location eastus \ + --workload "{aci:{resource-id:/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance/containerGroups/myContainerGroup}}" + +az agentfabric member show \ + --resource-group myResourceGroup \ + --fabric-name myFabric \ + --member-name myMember +``` + +## Policy Groups + +Policy Groups are independent resource-group-scoped +`Microsoft.NetworkSecurity` peer resources. They are not children of an Agent +Fabric, and their commands do not accept `--fabric-name`. + +```bash +az agentfabric policy-group create \ + --resource-group myResourceGroup \ + --name myPolicyGroup \ + --location eastus \ + --display-name "My policy group" \ + --priority 100 + +az agentfabric policy-group show \ + --ids /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.NetworkSecurity/policyGroups/myPolicyGroup +``` + +Policy Group ARM IDs end with `/policyGroups/{name}`. + +Long-running create, update, and delete operations support `--no-wait`. Use the +corresponding `wait` command to wait for provisioning to reach a target state. diff --git a/src/agentfabric/azext_agentfabric/__init__.py b/src/agentfabric/azext_agentfabric/__init__.py new file mode 100644 index 00000000000..1ad60bb6af8 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/__init__.py @@ -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_agentfabric._help import helps # pylint: disable=unused-import + + +class AgentfabricCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + custom_command_type = CliCommandType( + operations_tmpl='azext_agentfabric.custom#{}') + super().__init__(cli_ctx=cli_ctx, + custom_command_type=custom_command_type) + + def load_command_table(self, args): + from azext_agentfabric.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_agentfabric._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = AgentfabricCommandsLoader diff --git a/src/agentfabric/azext_agentfabric/_help.py b/src/agentfabric/azext_agentfabric/_help.py new file mode 100644 index 00000000000..126d5d00714 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/_help.py @@ -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: disable=line-too-long +# pylint: disable=too-many-lines + +from knack.help_files import helps # pylint: disable=unused-import diff --git a/src/agentfabric/azext_agentfabric/_params.py b/src/agentfabric/azext_agentfabric/_params.py new file mode 100644 index 00000000000..cfcec717c9c --- /dev/null +++ b/src/agentfabric/azext_agentfabric/_params.py @@ -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 diff --git a/src/agentfabric/azext_agentfabric/aaz/__init__.py b/src/agentfabric/azext_agentfabric/aaz/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/__init__.py @@ -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 +# -------------------------------------------------------------------------------------------- diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/__init__.py b/src/agentfabric/azext_agentfabric/aaz/latest/__init__.py new file mode 100644 index 00000000000..995a61cf962 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/__init__.py @@ -0,0 +1,15 @@ +# 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. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +<<<<<<<< HEAD:src/aimanager/azext_aimanager/vendored_sdks/v2026_09_02_preview/_version.py +VERSION = "1.0.0b2" +======== +# pylint: skip-file +# flake8: noqa + +>>>>>>>> 3cc7bff40 (Replace Agent Mesh with Agent Fabric):src/agentfabric/azext_agentfabric/aaz/latest/__init__.py diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/__cmd_group.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/__cmd_group.py new file mode 100644 index 00000000000..2abbc35cde6 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/__cmd_group.py @@ -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( + "agentfabric", +) +class __CMDGroup(AAZCommandGroup): + """Manage Agent Fabric and related Microsoft.NetworkSecurity resources. Root commands manage Agent Fabric resources. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/__init__.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/__init__.py @@ -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 * diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_create.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_create.py new file mode 100644 index 00000000000..3a7326e01bb --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_create.py @@ -0,0 +1,309 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric create", +) +class Create(AAZCommand): + """Create an Agent Fabric resource. + + :example: AgentFabrics_CreateOrUpdate + az agentfabric create --resource-group rgnetworksecurity --name testAIFabric --default-policy-groups "[/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgnetworksecurity/providers/Microsoft.NetworkSecurity/policyGroups/testPolicyGroup]" --trust-domain contoso.agentfabric --tags "{}" --location eastus + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the AgentFabric", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.default_policy_groups = AAZListArg( + options=["--default-policy-groups"], + arg_group="Properties", + help="The default policy groups to apply to all members of this fabric.", + ) + _args_schema.trust_domain = AAZStrArg( + options=["--trust-domain"], + arg_group="Properties", + help="The trust domain that scopes this fabric's member identities. It is the leading component of each member's identity, which takes the form `//`. Set at creation and immutable thereafter; when omitted, the shared default trust domain `microsoft.agentfabric` is used.", + fmt=AAZStrArgFormat( + pattern="^[a-z0-9]([a-z0-9.-]*[a-z0-9])?$", + max_length=253, + ), + ) + + default_policy_groups = cls._args_schema.default_policy_groups + default_policy_groups.Element = AAZResourceIdArg() + + # define Arg Group "Resource" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Resource", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Resource", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.AgentFabricsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class AgentFabricsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("defaultPolicyGroups", AAZListType, ".default_policy_groups") + properties.set_prop("trustDomain", AAZStrType, ".trust_domain") + + default_policy_groups = _builder.get(".properties.defaultPolicyGroups") + if default_policy_groups is not None: + default_policy_groups.set_elements(AAZStrType, ".") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType() + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.default_policy_groups = AAZListType( + serialized_name="defaultPolicyGroups", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.trust_domain = AAZStrType( + serialized_name="trustDomain", + ) + + default_policy_groups = cls._schema_on_200_201.properties.default_policy_groups + default_policy_groups.Element = AAZStrType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_delete.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_delete.py new file mode 100644 index 00000000000..f7aa1fe6c11 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_delete.py @@ -0,0 +1,166 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete an Agent Fabric resource. + + :example: AgentFabrics_Delete + az agentfabric delete --resource-group rgnetworksecurity --name testAIFabric + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.AgentFabricsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class AgentFabricsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + def on_204(self, session): + pass + + def on_200_201(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_list.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_list.py new file mode 100644 index 00000000000..282d8b8fd62 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_list.py @@ -0,0 +1,373 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric list", +) +class List(AAZCommand): + """List Agent Fabric resources. + + :example: AgentFabrics_ListBySubscription + az agentfabric list + + :example: AgentFabrics_ListByResourceGroup + az agentfabric list --resource-group rgnetworksecurity + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networksecurity/agentfabrics", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + if condition_0: + self.AgentFabricsListBySubscription(ctx=self.ctx)() + if condition_1: + self.AgentFabricsListByResourceGroup(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class AgentFabricsListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkSecurity/agentFabrics", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.default_policy_groups = AAZListType( + serialized_name="defaultPolicyGroups", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.trust_domain = AAZStrType( + serialized_name="trustDomain", + ) + + default_policy_groups = cls._schema_on_200.value.Element.properties.default_policy_groups + default_policy_groups.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class AgentFabricsListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.default_policy_groups = AAZListType( + serialized_name="defaultPolicyGroups", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.trust_domain = AAZStrType( + serialized_name="trustDomain", + ) + + default_policy_groups = cls._schema_on_200.value.Element.properties.default_policy_groups + default_policy_groups.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_show.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_show.py new file mode 100644 index 00000000000..294c0ebeda6 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_show.py @@ -0,0 +1,223 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric show", +) +class Show(AAZCommand): + """Show an Agent Fabric resource. + + :example: AgentFabrics_Get + az agentfabric show --resource-group rgnetworksecurity --name testAIFabric + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AgentFabricsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class AgentFabricsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.default_policy_groups = AAZListType( + serialized_name="defaultPolicyGroups", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.trust_domain = AAZStrType( + serialized_name="trustDomain", + ) + + default_policy_groups = cls._schema_on_200.properties.default_policy_groups + default_policy_groups.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_update.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_update.py new file mode 100644 index 00000000000..abd7b5a41a8 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_update.py @@ -0,0 +1,270 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric update", +) +class Update(AAZCommand): + """Update an Agent Fabric resource. + + :example: AgentFabrics_Update + az agentfabric update --resource-group rgnetworksecurity --name testAIFabric --tags "{env:production}" + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Properties", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.AgentFabricsUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class AgentFabricsUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("tags", AAZDictType, ".tags") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.default_policy_groups = AAZListType( + serialized_name="defaultPolicyGroups", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.trust_domain = AAZStrType( + serialized_name="trustDomain", + ) + + default_policy_groups = cls._schema_on_200.properties.default_policy_groups + default_policy_groups.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + +__all__ = ["Update"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_wait.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_wait.py new file mode 100644 index 00000000000..4fce0f83dc9 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_wait.py @@ -0,0 +1,219 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AgentFabricsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class AgentFabricsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.default_policy_groups = AAZListType( + serialized_name="defaultPolicyGroups", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.trust_domain = AAZStrType( + serialized_name="trustDomain", + ) + + default_policy_groups = cls._schema_on_200.properties.default_policy_groups + default_policy_groups.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/__cmd_group.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/__cmd_group.py new file mode 100644 index 00000000000..bc7e73f981a --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/__cmd_group.py @@ -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( + "agentfabric member", +) +class __CMDGroup(AAZCommandGroup): + """Manage members that are children of an Agent Fabric. The parent Fabric name is required. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/__init__.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/__init__.py @@ -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 * diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_create.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_create.py new file mode 100644 index 00000000000..c6b68612c49 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_create.py @@ -0,0 +1,516 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric member create", +) +class Create(AAZCommand): + """Create a member resource as a child of an Agent Fabric. The parent Fabric name is required. + + :example: Members_CreateOrUpdate + az agentfabric member create --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name testMember --location eastus --workload "{aci:{resource-id:/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgnetworksecurity/providers/Microsoft.ContainerInstance/containerGroups/testContainerGroup}}" + + :example: Members_CreateOrUpdate_AgentFabricSandbox + az agentfabric member create --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name sandboxMember --location eastus --workload "{agent-fabric-sandbox:{image:{uri:'contoso.azurecr.io/agents/sandbox:1.0.0',digest:'sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae',pull-policy:IfNotPresent},resources:{cpu:2,memory:4Gi,disk:20Gi},agent-identity:{tenant-id:72f988bf-86f1-41af-91ab-2d7cd011db47,agent-id:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee},endpoints:[{name:http,port:8080}],domain:sandbox-member.testaifabric.contoso.com}}" + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="The name of the AgentFabric", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.member_name = AAZStrArg( + options=["--member-name"], + help="The name of the Member", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.workload = AAZObjectArg( + options=["--workload"], + arg_group="Properties", + help="The workload configuration of the member. Set at creation and immutable thereafter; to change the workload, delete and recreate the member.", + ) + + workload = cls._args_schema.workload + workload.aci = AAZObjectArg( + options=["aci"], + ) + workload.agent_fabric_sandbox = AAZObjectArg( + options=["agent-fabric-sandbox"], + ) + + aci = cls._args_schema.workload.aci + aci.resource_id = AAZResourceIdArg( + options=["resource-id"], + help="The Azure Resource Manager resource ID of the Azure Container Instances (ACI) container group backing this member's sandbox.", + required=True, + ) + + agent_fabric_sandbox = cls._args_schema.workload.agent_fabric_sandbox + agent_fabric_sandbox.agent_identity = AAZObjectArg( + options=["agent-identity"], + help="The Entra agent identity associated with the workload.", + ) + agent_fabric_sandbox.domain = AAZStrArg( + options=["domain"], + help="The resolvable DNS name assigned to the workload.", + required=True, + ) + agent_fabric_sandbox.endpoints = AAZListArg( + options=["endpoints"], + help="The network endpoints exposed by the workload.", + ) + agent_fabric_sandbox.image = AAZObjectArg( + options=["image"], + help="The container image to run for the workload.", + required=True, + ) + agent_fabric_sandbox.resources = AAZObjectArg( + options=["resources"], + help="The compute resources allocated to the workload.", + required=True, + ) + + agent_identity = cls._args_schema.workload.agent_fabric_sandbox.agent_identity + agent_identity.agent_id = AAZStrArg( + options=["agent-id"], + help="The Entra agent ID representing the workload's identity.", + required=True, + ) + agent_identity.tenant_id = AAZStrArg( + options=["tenant-id"], + help="The Azure tenant ID that owns the agent identity.", + required=True, + ) + + endpoints = cls._args_schema.workload.agent_fabric_sandbox.endpoints + endpoints.Element = AAZObjectArg() + + _element = cls._args_schema.workload.agent_fabric_sandbox.endpoints.Element + _element.name = AAZStrArg( + options=["name"], + help="The name of the endpoint.", + required=True, + ) + _element.port = AAZIntArg( + options=["port"], + help="The port the endpoint listens on.", + required=True, + ) + + image = cls._args_schema.workload.agent_fabric_sandbox.image + image.digest = AAZStrArg( + options=["digest"], + help="The image content digest used to pin an exact image version.", + ) + image.pull_policy = AAZStrArg( + options=["pull-policy"], + help="The policy controlling when the image is pulled.", + enum={"Always": "Always", "IfNotPresent": "IfNotPresent"}, + ) + image.uri = AAZStrArg( + options=["uri"], + help="The image reference URI (e.g., registry/repository:tag).", + required=True, + ) + + resources = cls._args_schema.workload.agent_fabric_sandbox.resources + resources.cpu = AAZStrArg( + options=["cpu"], + help="The amount of CPU to allocate to the workload.", + required=True, + ) + resources.disk = AAZStrArg( + options=["disk"], + help="The amount of disk to allocate to the workload.", + ) + resources.memory = AAZStrArg( + options=["memory"], + help="The amount of memory to allocate to the workload.", + required=True, + ) + + # define Arg Group "Resource" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Resource", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Resource", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.MembersCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class MembersCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/members/{memberName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "memberName", self.ctx.args.member_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("workload", AAZObjectType, ".workload") + + workload = _builder.get(".properties.workload") + if workload is not None: + workload.set_const("type", "ACI", AAZStrType, ".aci", typ_kwargs={"flags": {"required": True}}) + workload.set_const("type", "AgentFabricSandbox", AAZStrType, ".agent_fabric_sandbox", typ_kwargs={"flags": {"required": True}}) + workload.discriminate_by("type", "ACI") + workload.discriminate_by("type", "AgentFabricSandbox") + + disc_aci = _builder.get(".properties.workload{type:ACI}") + if disc_aci is not None: + disc_aci.set_prop("resourceId", AAZStrType, ".aci.resource_id", typ_kwargs={"flags": {"required": True}}) + + disc_agent_fabric_sandbox = _builder.get(".properties.workload{type:AgentFabricSandbox}") + if disc_agent_fabric_sandbox is not None: + disc_agent_fabric_sandbox.set_prop("agentIdentity", AAZObjectType, ".agent_fabric_sandbox.agent_identity") + disc_agent_fabric_sandbox.set_prop("domain", AAZStrType, ".agent_fabric_sandbox.domain", typ_kwargs={"flags": {"required": True}}) + disc_agent_fabric_sandbox.set_prop("endpoints", AAZListType, ".agent_fabric_sandbox.endpoints") + disc_agent_fabric_sandbox.set_prop("image", AAZObjectType, ".agent_fabric_sandbox.image", typ_kwargs={"flags": {"required": True}}) + disc_agent_fabric_sandbox.set_prop("resources", AAZObjectType, ".agent_fabric_sandbox.resources", typ_kwargs={"flags": {"required": True}}) + + agent_identity = _builder.get(".properties.workload{type:AgentFabricSandbox}.agentIdentity") + if agent_identity is not None: + agent_identity.set_prop("agentId", AAZStrType, ".agent_id", typ_kwargs={"flags": {"required": True}}) + agent_identity.set_prop("tenantId", AAZStrType, ".tenant_id", typ_kwargs={"flags": {"required": True}}) + + endpoints = _builder.get(".properties.workload{type:AgentFabricSandbox}.endpoints") + if endpoints is not None: + endpoints.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.workload{type:AgentFabricSandbox}.endpoints[]") + if _elements is not None: + _elements.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("port", AAZIntType, ".port", typ_kwargs={"flags": {"required": True}}) + + image = _builder.get(".properties.workload{type:AgentFabricSandbox}.image") + if image is not None: + image.set_prop("digest", AAZStrType, ".digest") + image.set_prop("pullPolicy", AAZStrType, ".pull_policy") + image.set_prop("uri", AAZStrType, ".uri", typ_kwargs={"flags": {"required": True}}) + + resources = _builder.get(".properties.workload{type:AgentFabricSandbox}.resources") + if resources is not None: + resources.set_prop("cpu", AAZStrType, ".cpu", typ_kwargs={"flags": {"required": True}}) + resources.set_prop("disk", AAZStrType, ".disk") + resources.set_prop("memory", AAZStrType, ".memory", typ_kwargs={"flags": {"required": True}}) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType() + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.spiffe_id = AAZStrType( + serialized_name="spiffeId", + flags={"read_only": True}, + ) + properties.workload = AAZObjectType() + + workload = cls._schema_on_200_201.properties.workload + workload.type = AAZStrType( + flags={"required": True}, + ) + workload.workload_id = AAZStrType( + serialized_name="workloadId", + flags={"read_only": True}, + ) + + disc_aci = cls._schema_on_200_201.properties.workload.discriminate_by("type", "ACI") + disc_aci.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"required": True}, + ) + + disc_agent_fabric_sandbox = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox") + disc_agent_fabric_sandbox.agent_identity = AAZObjectType( + serialized_name="agentIdentity", + ) + disc_agent_fabric_sandbox.domain = AAZStrType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.endpoints = AAZListType() + disc_agent_fabric_sandbox.image = AAZObjectType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.resources = AAZObjectType( + flags={"required": True}, + ) + + agent_identity = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox").agent_identity + agent_identity.agent_id = AAZStrType( + serialized_name="agentId", + flags={"required": True}, + ) + agent_identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"required": True}, + ) + + endpoints = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints.Element + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.port = AAZIntType( + flags={"required": True}, + ) + + image = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox").image + image.digest = AAZStrType() + image.pull_policy = AAZStrType( + serialized_name="pullPolicy", + ) + image.uri = AAZStrType( + flags={"required": True}, + ) + + resources = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox").resources + resources.cpu = AAZStrType( + flags={"required": True}, + ) + resources.disk = AAZStrType() + resources.memory = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_delete.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_delete.py new file mode 100644 index 00000000000..21d09dcce01 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_delete.py @@ -0,0 +1,179 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric member delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete a member resource that is a child of an Agent Fabric. The parent Fabric name is required. + + :example: Members_Delete + az agentfabric member delete --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name testMember + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.member_name = AAZStrArg( + options=["--member-name"], + help="The name of the Member", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.MembersDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class MembersDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/members/{memberName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "memberName", self.ctx.args.member_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + def on_204(self, session): + pass + + def on_200_201(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_list.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_list.py new file mode 100644 index 00000000000..45ca8a9d05d --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_list.py @@ -0,0 +1,300 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric member list", +) +class List(AAZCommand): + """List member resources that are children of an Agent Fabric. The parent Fabric name is required. + + :example: Members_ListByParent + az agentfabric member list --resource-group rgnetworksecurity --fabric-name testAIFabric + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="The name of the AgentFabric", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MembersListByParent(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class MembersListByParent(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/members", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.spiffe_id = AAZStrType( + serialized_name="spiffeId", + flags={"read_only": True}, + ) + properties.workload = AAZObjectType() + + workload = cls._schema_on_200.value.Element.properties.workload + workload.type = AAZStrType( + flags={"required": True}, + ) + workload.workload_id = AAZStrType( + serialized_name="workloadId", + flags={"read_only": True}, + ) + + disc_aci = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "ACI") + disc_aci.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"required": True}, + ) + + disc_agent_fabric_sandbox = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox") + disc_agent_fabric_sandbox.agent_identity = AAZObjectType( + serialized_name="agentIdentity", + ) + disc_agent_fabric_sandbox.domain = AAZStrType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.endpoints = AAZListType() + disc_agent_fabric_sandbox.image = AAZObjectType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.resources = AAZObjectType( + flags={"required": True}, + ) + + agent_identity = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox").agent_identity + agent_identity.agent_id = AAZStrType( + serialized_name="agentId", + flags={"required": True}, + ) + agent_identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"required": True}, + ) + + endpoints = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints.Element + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.port = AAZIntType( + flags={"required": True}, + ) + + image = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox").image + image.digest = AAZStrType() + image.pull_policy = AAZStrType( + serialized_name="pullPolicy", + ) + image.uri = AAZStrType( + flags={"required": True}, + ) + + resources = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox").resources + resources.cpu = AAZStrType( + flags={"required": True}, + ) + resources.disk = AAZStrType() + resources.memory = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_show.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_show.py new file mode 100644 index 00000000000..2ffc848ada2 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_show.py @@ -0,0 +1,301 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric member show", +) +class Show(AAZCommand): + """Show a member resource that is a child of an Agent Fabric. The parent Fabric name is required. + + :example: Members_Get + az agentfabric member show --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name testMember + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.member_name = AAZStrArg( + options=["--member-name"], + help="The name of the Member", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MembersGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class MembersGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/members/{memberName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "memberName", self.ctx.args.member_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.spiffe_id = AAZStrType( + serialized_name="spiffeId", + flags={"read_only": True}, + ) + properties.workload = AAZObjectType() + + workload = cls._schema_on_200.properties.workload + workload.type = AAZStrType( + flags={"required": True}, + ) + workload.workload_id = AAZStrType( + serialized_name="workloadId", + flags={"read_only": True}, + ) + + disc_aci = cls._schema_on_200.properties.workload.discriminate_by("type", "ACI") + disc_aci.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"required": True}, + ) + + disc_agent_fabric_sandbox = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox") + disc_agent_fabric_sandbox.agent_identity = AAZObjectType( + serialized_name="agentIdentity", + ) + disc_agent_fabric_sandbox.domain = AAZStrType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.endpoints = AAZListType() + disc_agent_fabric_sandbox.image = AAZObjectType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.resources = AAZObjectType( + flags={"required": True}, + ) + + agent_identity = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").agent_identity + agent_identity.agent_id = AAZStrType( + serialized_name="agentId", + flags={"required": True}, + ) + agent_identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"required": True}, + ) + + endpoints = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints.Element + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.port = AAZIntType( + flags={"required": True}, + ) + + image = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").image + image.digest = AAZStrType() + image.pull_policy = AAZStrType( + serialized_name="pullPolicy", + ) + image.uri = AAZStrType( + flags={"required": True}, + ) + + resources = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").resources + resources.cpu = AAZStrType( + flags={"required": True}, + ) + resources.disk = AAZStrType() + resources.memory = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_update.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_update.py new file mode 100644 index 00000000000..51760007627 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_update.py @@ -0,0 +1,348 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric member update", +) +class Update(AAZCommand): + """Update a member resource that is a child of an Agent Fabric. The parent Fabric name is required. + + :example: Members_Update + az agentfabric member update --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name testMember --tags "{environment:production}" + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.member_name = AAZStrArg( + options=["--member-name"], + help="The name of the Member", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Properties", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.MembersUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class MembersUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/members/{memberName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "memberName", self.ctx.args.member_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("tags", AAZDictType, ".tags") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.spiffe_id = AAZStrType( + serialized_name="spiffeId", + flags={"read_only": True}, + ) + properties.workload = AAZObjectType() + + workload = cls._schema_on_200.properties.workload + workload.type = AAZStrType( + flags={"required": True}, + ) + workload.workload_id = AAZStrType( + serialized_name="workloadId", + flags={"read_only": True}, + ) + + disc_aci = cls._schema_on_200.properties.workload.discriminate_by("type", "ACI") + disc_aci.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"required": True}, + ) + + disc_agent_fabric_sandbox = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox") + disc_agent_fabric_sandbox.agent_identity = AAZObjectType( + serialized_name="agentIdentity", + ) + disc_agent_fabric_sandbox.domain = AAZStrType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.endpoints = AAZListType() + disc_agent_fabric_sandbox.image = AAZObjectType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.resources = AAZObjectType( + flags={"required": True}, + ) + + agent_identity = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").agent_identity + agent_identity.agent_id = AAZStrType( + serialized_name="agentId", + flags={"required": True}, + ) + agent_identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"required": True}, + ) + + endpoints = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints.Element + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.port = AAZIntType( + flags={"required": True}, + ) + + image = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").image + image.digest = AAZStrType() + image.pull_policy = AAZStrType( + serialized_name="pullPolicy", + ) + image.uri = AAZStrType( + flags={"required": True}, + ) + + resources = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").resources + resources.cpu = AAZStrType( + flags={"required": True}, + ) + resources.disk = AAZStrType() + resources.memory = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + +__all__ = ["Update"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_wait.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_wait.py new file mode 100644 index 00000000000..f48d23b60e7 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_wait.py @@ -0,0 +1,297 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric member wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.member_name = AAZStrArg( + options=["--member-name"], + help="The name of the Member", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MembersGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class MembersGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/members/{memberName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "memberName", self.ctx.args.member_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.spiffe_id = AAZStrType( + serialized_name="spiffeId", + flags={"read_only": True}, + ) + properties.workload = AAZObjectType() + + workload = cls._schema_on_200.properties.workload + workload.type = AAZStrType( + flags={"required": True}, + ) + workload.workload_id = AAZStrType( + serialized_name="workloadId", + flags={"read_only": True}, + ) + + disc_aci = cls._schema_on_200.properties.workload.discriminate_by("type", "ACI") + disc_aci.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"required": True}, + ) + + disc_agent_fabric_sandbox = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox") + disc_agent_fabric_sandbox.agent_identity = AAZObjectType( + serialized_name="agentIdentity", + ) + disc_agent_fabric_sandbox.domain = AAZStrType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.endpoints = AAZListType() + disc_agent_fabric_sandbox.image = AAZObjectType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.resources = AAZObjectType( + flags={"required": True}, + ) + + agent_identity = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").agent_identity + agent_identity.agent_id = AAZStrType( + serialized_name="agentId", + flags={"required": True}, + ) + agent_identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"required": True}, + ) + + endpoints = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints.Element + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.port = AAZIntType( + flags={"required": True}, + ) + + image = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").image + image.digest = AAZStrType() + image.pull_policy = AAZStrType( + serialized_name="pullPolicy", + ) + image.uri = AAZStrType( + flags={"required": True}, + ) + + resources = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").resources + resources.cpu = AAZStrType( + flags={"required": True}, + ) + resources.disk = AAZStrType() + resources.memory = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/__cmd_group.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/__cmd_group.py new file mode 100644 index 00000000000..b7398d921a9 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/__cmd_group.py @@ -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( + "agentfabric policy-group", +) +class __CMDGroup(AAZCommandGroup): + """Manage independent resource-group-scoped Microsoft.NetworkSecurity Policy Group peer resources. Policy Groups are not children of an Agent Fabric. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/__init__.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/__init__.py @@ -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 * diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_create.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_create.py new file mode 100644 index 00000000000..78d6c837899 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_create.py @@ -0,0 +1,1332 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric policy-group create", +) +class Create(AAZCommand): + """Create an independent resource-group-scoped Microsoft.NetworkSecurity Policy Group resource. Policy Groups are not children of an Agent Fabric. + + :example: PolicyGroups_CreateOrUpdate + az agentfabric policy-group create --resource-group rgnetworksecurity --name testPolicyGroup --location eastus --tags "{env:test}" --display-name "Test Policy Group" --description "A policy group for testing" --priority 100 --network-security-policies "[{fqdn-filtering:{name:allowOutbound,priority:10,direction:Outbound,ports:[443,80],source:{workload-id-patterns:{patterns:[workload1,workload2]}},destination:{fqdns:{fqdns:[example.com,contoso.com]}}}}]" + + :example: PolicyGroups_CreateOrUpdate_ContentInspection + az agentfabric policy-group create --resource-group rgnetworksecurity --name contentInspectionGroup --location eastus --tags "{env:test}" --display-name "Content Inspection Policy Group" --description "A policy group demonstrating content inspection policies" --priority 100 --network-security-policies "[{content-inspection:{source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},prompt-injection-protection:{sensitivity:High,prompt-locations:['$.messages[*].content','$.input'],response-locations:['$.choices[*].message.content'],on-detection:BlockAndAlert}}}]" + + :example: PolicyGroups_CreateOrUpdate_Mcp + az agentfabric policy-group create --resource-group rgnetworksecurity --name mcpPolicyGroup --location eastus --tags "{env:test}" --display-name "MCP Policy Group" --description "A policy group demonstrating MCP server policies" --priority 100 --network-security-policies "[{mcp:{default-action:Deny,source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},destination:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/mcp/sa/*']}},rules:[{action:Allow,tools:[search,fetch]},{action:Deny,tools:[deleteFile]}]}},{mcp:{default-action:Allow,source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},destination:{fqdns:{fqdns:[mcp.contoso.com]}},rules:[{action:Deny,tools:[executeShell,writeFile]}]}},{mcp:{default-action:Deny,source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},destination:{address-prefixes:{prefixes:[10.0.0.0/24]}},rules:[{action:Allow,tools:[listResources,readResource]}]}}]" + + :example: PolicyGroups_CreateOrUpdate_TlsInspection + az agentfabric policy-group create --resource-group rgnetworksecurity --name tlsInspectionPolicyGroup --location eastus --tags "{env:test}" --display-name "TLS Inspection Policy Group" --description "A policy group demonstrating TLS inspection policies" --priority 100 --network-security-policies "[{tls-inspection:{source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},certificate:{azure-managed-ca:{}}}}]" + + :example: PolicyGroups_CreateOrUpdate_UrlFiltering + az agentfabric policy-group create --resource-group rgnetworksecurity --name urlFilteringPolicyGroup --location eastus --tags "{env:test}" --display-name "URL Filtering Policy Group" --description "A policy group demonstrating URL filtering" --priority 100 --network-security-policies "[{url-filtering:{default-action:Deny,source:{address-prefixes:{prefixes:[10.0.0.0/24]}},destination:{fqdns:{fqdns:[api.contoso.com]}},rules:[{name:allowProductApi,priority:10,hostname:api.contoso.com,method:GET,paths:['/v1/products','/v1/products/*'],action:Allow},{name:denyAdmin,priority:20,paths:['/admin/*'],action:Deny}]}}]" + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the PolicyGroup", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="The description of the policy group.", + ) + _args_schema.display_name = AAZStrArg( + options=["--display-name"], + arg_group="Properties", + help="The display name of the policy group.", + ) + _args_schema.network_security_policies = AAZListArg( + options=["--network-security-policies"], + arg_group="Properties", + help="The list of network security policies.", + ) + _args_schema.priority = AAZIntArg( + options=["--priority"], + arg_group="Properties", + help="The priority of the policy group.", + ) + + network_security_policies = cls._args_schema.network_security_policies + network_security_policies.Element = AAZObjectArg() + + _element = cls._args_schema.network_security_policies.Element + _element.content_inspection = AAZObjectArg( + options=["content-inspection"], + ) + _element.fqdn_filtering = AAZObjectArg( + options=["fqdn-filtering"], + ) + _element.mcp = AAZObjectArg( + options=["mcp"], + ) + _element.tls_inspection = AAZObjectArg( + options=["tls-inspection"], + ) + _element.url_filtering = AAZObjectArg( + options=["url-filtering"], + ) + + content_inspection = cls._args_schema.network_security_policies.Element.content_inspection + content_inspection.prompt_injection_protection = AAZObjectArg( + options=["prompt-injection-protection"], + help="The prompt injection protection configuration.", + ) + content_inspection.source = AAZObjectArg( + options=["source"], + help="The source details for the policy.", + required=True, + ) + + prompt_injection_protection = cls._args_schema.network_security_policies.Element.content_inspection.prompt_injection_protection + prompt_injection_protection.on_detection = AAZStrArg( + options=["on-detection"], + help="The action to take when prompt injection is detected.", + required=True, + enum={"Alert": "Alert", "BlockAndAlert": "BlockAndAlert", "Sanitize": "Sanitize"}, + ) + prompt_injection_protection.prompt_locations = AAZListArg( + options=["prompt-locations"], + help="The JSONPath expressions selecting the parts of the request body to scan for prompt injection.", + ) + prompt_injection_protection.response_locations = AAZListArg( + options=["response-locations"], + help="The JSONPath expressions selecting the parts of the response body to scan for prompt injection.", + ) + prompt_injection_protection.sensitivity = AAZStrArg( + options=["sensitivity"], + help="The sensitivity level of prompt injection detection.", + enum={"High": "High", "Low": "Low", "Medium": "Medium"}, + ) + + prompt_locations = cls._args_schema.network_security_policies.Element.content_inspection.prompt_injection_protection.prompt_locations + prompt_locations.Element = AAZStrArg() + + response_locations = cls._args_schema.network_security_policies.Element.content_inspection.prompt_injection_protection.response_locations + response_locations.Element = AAZStrArg() + + source = cls._args_schema.network_security_policies.Element.content_inspection.source + source.address_prefixes = AAZObjectArg( + options=["address-prefixes"], + ) + source.workload_id_patterns = AAZObjectArg( + options=["workload-id-patterns"], + ) + + address_prefixes = cls._args_schema.network_security_policies.Element.content_inspection.source.address_prefixes + address_prefixes.prefixes = AAZListArg( + options=["prefixes"], + help="The IP address prefixes, in CIDR notation, that identify the source(s).", + required=True, + ) + + prefixes = cls._args_schema.network_security_policies.Element.content_inspection.source.address_prefixes.prefixes + prefixes.Element = AAZStrArg() + + workload_id_patterns = cls._args_schema.network_security_policies.Element.content_inspection.source.workload_id_patterns + workload_id_patterns.patterns = AAZListArg( + options=["patterns"], + help="The workload ID patterns that identify the source(s).", + required=True, + ) + + patterns = cls._args_schema.network_security_policies.Element.content_inspection.source.workload_id_patterns.patterns + patterns.Element = AAZStrArg() + + fqdn_filtering = cls._args_schema.network_security_policies.Element.fqdn_filtering + fqdn_filtering.destination = AAZObjectArg( + options=["destination"], + help="The destination details for the policy.", + ) + fqdn_filtering.direction = AAZStrArg( + options=["direction"], + help="The direction of traffic for the policy.", + enum={"Both": "Both", "Inbound": "Inbound", "Outbound": "Outbound"}, + ) + fqdn_filtering.name = AAZStrArg( + options=["name"], + help="The name of the policy.", + ) + fqdn_filtering.ports = AAZListArg( + options=["ports"], + help="The ports for the policy.", + ) + fqdn_filtering.priority = AAZIntArg( + options=["priority"], + help="The priority of the policy.", + ) + fqdn_filtering.source = AAZObjectArg( + options=["source"], + help="The source details for the policy.", + required=True, + ) + + destination = cls._args_schema.network_security_policies.Element.fqdn_filtering.destination + destination.fqdns = AAZObjectArg( + options=["fqdns"], + ) + + fqdns = cls._args_schema.network_security_policies.Element.fqdn_filtering.destination.fqdns + fqdns.fqdns = AAZListArg( + options=["fqdns"], + help="The fully qualified domain names that identify the destination(s).", + required=True, + ) + + fqdns = cls._args_schema.network_security_policies.Element.fqdn_filtering.destination.fqdns.fqdns + fqdns.Element = AAZStrArg() + + ports = cls._args_schema.network_security_policies.Element.fqdn_filtering.ports + ports.Element = AAZIntArg() + + source = cls._args_schema.network_security_policies.Element.fqdn_filtering.source + source.address_prefixes = AAZObjectArg( + options=["address-prefixes"], + ) + source.workload_id_patterns = AAZObjectArg( + options=["workload-id-patterns"], + ) + + address_prefixes = cls._args_schema.network_security_policies.Element.fqdn_filtering.source.address_prefixes + address_prefixes.prefixes = AAZListArg( + options=["prefixes"], + help="The IP address prefixes, in CIDR notation, that identify the source(s).", + required=True, + ) + + prefixes = cls._args_schema.network_security_policies.Element.fqdn_filtering.source.address_prefixes.prefixes + prefixes.Element = AAZStrArg() + + workload_id_patterns = cls._args_schema.network_security_policies.Element.fqdn_filtering.source.workload_id_patterns + workload_id_patterns.patterns = AAZListArg( + options=["patterns"], + help="The workload ID patterns that identify the source(s).", + required=True, + ) + + patterns = cls._args_schema.network_security_policies.Element.fqdn_filtering.source.workload_id_patterns.patterns + patterns.Element = AAZStrArg() + + mcp = cls._args_schema.network_security_policies.Element.mcp + mcp.default_action = AAZStrArg( + options=["default-action"], + help="The default action to take when no rule in the policy matches.", + required=True, + enum={"Allow": "Allow", "Deny": "Deny"}, + ) + mcp.destination = AAZObjectArg( + options=["destination"], + help="The MCP server(s) that this policy applies to.", + required=True, + ) + mcp.rules = AAZListArg( + options=["rules"], + help="The list of MCP rules.", + required=True, + ) + mcp.source = AAZObjectArg( + options=["source"], + help="The source(s) that this policy applies to.", + required=True, + ) + + destination = cls._args_schema.network_security_policies.Element.mcp.destination + destination.address_prefixes = AAZObjectArg( + options=["address-prefixes"], + ) + destination.fqdns = AAZObjectArg( + options=["fqdns"], + ) + destination.workload_id_patterns = AAZObjectArg( + options=["workload-id-patterns"], + ) + + address_prefixes = cls._args_schema.network_security_policies.Element.mcp.destination.address_prefixes + address_prefixes.prefixes = AAZListArg( + options=["prefixes"], + help="The IP address prefixes, in CIDR notation, that identify the destination(s).", + required=True, + ) + + prefixes = cls._args_schema.network_security_policies.Element.mcp.destination.address_prefixes.prefixes + prefixes.Element = AAZStrArg() + + fqdns = cls._args_schema.network_security_policies.Element.mcp.destination.fqdns + fqdns.fqdns = AAZListArg( + options=["fqdns"], + help="The fully qualified domain names that identify the destination(s).", + required=True, + ) + + fqdns = cls._args_schema.network_security_policies.Element.mcp.destination.fqdns.fqdns + fqdns.Element = AAZStrArg() + + workload_id_patterns = cls._args_schema.network_security_policies.Element.mcp.destination.workload_id_patterns + workload_id_patterns.patterns = AAZListArg( + options=["patterns"], + help="The workload ID patterns that identify the destination(s).", + required=True, + ) + + patterns = cls._args_schema.network_security_policies.Element.mcp.destination.workload_id_patterns.patterns + patterns.Element = AAZStrArg() + + rules = cls._args_schema.network_security_policies.Element.mcp.rules + rules.Element = AAZObjectArg() + + _element = cls._args_schema.network_security_policies.Element.mcp.rules.Element + _element.action = AAZStrArg( + options=["action"], + help="The action to take for the specified MCP tools.", + required=True, + enum={"Allow": "Allow", "Deny": "Deny"}, + ) + _element.tools = AAZListArg( + options=["tools"], + help="The MCP tool names that the rule applies to.", + required=True, + ) + + tools = cls._args_schema.network_security_policies.Element.mcp.rules.Element.tools + tools.Element = AAZStrArg() + + source = cls._args_schema.network_security_policies.Element.mcp.source + source.address_prefixes = AAZObjectArg( + options=["address-prefixes"], + ) + source.workload_id_patterns = AAZObjectArg( + options=["workload-id-patterns"], + ) + + address_prefixes = cls._args_schema.network_security_policies.Element.mcp.source.address_prefixes + address_prefixes.prefixes = AAZListArg( + options=["prefixes"], + help="The IP address prefixes, in CIDR notation, that identify the source(s).", + required=True, + ) + + prefixes = cls._args_schema.network_security_policies.Element.mcp.source.address_prefixes.prefixes + prefixes.Element = AAZStrArg() + + workload_id_patterns = cls._args_schema.network_security_policies.Element.mcp.source.workload_id_patterns + workload_id_patterns.patterns = AAZListArg( + options=["patterns"], + help="The workload ID patterns that identify the source(s).", + required=True, + ) + + patterns = cls._args_schema.network_security_policies.Element.mcp.source.workload_id_patterns.patterns + patterns.Element = AAZStrArg() + + tls_inspection = cls._args_schema.network_security_policies.Element.tls_inspection + tls_inspection.certificate = AAZObjectArg( + options=["certificate"], + help="The certificate configuration used for TLS inspection.", + required=True, + ) + tls_inspection.source = AAZObjectArg( + options=["source"], + help="The source details for the policy.", + required=True, + ) + + certificate = cls._args_schema.network_security_policies.Element.tls_inspection.certificate + certificate.azure_managed_ca = AAZObjectArg( + options=["azure-managed-ca"], + blank={}, + ) + + source = cls._args_schema.network_security_policies.Element.tls_inspection.source + source.workload_id_patterns = AAZObjectArg( + options=["workload-id-patterns"], + ) + + workload_id_patterns = cls._args_schema.network_security_policies.Element.tls_inspection.source.workload_id_patterns + workload_id_patterns.patterns = AAZListArg( + options=["patterns"], + help="The workload ID patterns that identify the source(s).", + required=True, + ) + + patterns = cls._args_schema.network_security_policies.Element.tls_inspection.source.workload_id_patterns.patterns + patterns.Element = AAZStrArg() + + url_filtering = cls._args_schema.network_security_policies.Element.url_filtering + url_filtering.default_action = AAZStrArg( + options=["default-action"], + help="The default action to take when no rule in the policy matches.", + required=True, + enum={"Allow": "Allow", "Deny": "Deny"}, + ) + url_filtering.destination = AAZObjectArg( + options=["destination"], + help="The destination details for the policy.", + ) + url_filtering.rules = AAZListArg( + options=["rules"], + help="The list of URL filtering rules.", + required=True, + ) + url_filtering.source = AAZObjectArg( + options=["source"], + help="The source details for the policy.", + required=True, + ) + + destination = cls._args_schema.network_security_policies.Element.url_filtering.destination + destination.address_prefixes = AAZObjectArg( + options=["address-prefixes"], + ) + destination.fqdns = AAZObjectArg( + options=["fqdns"], + ) + destination.workload_id_patterns = AAZObjectArg( + options=["workload-id-patterns"], + ) + + address_prefixes = cls._args_schema.network_security_policies.Element.url_filtering.destination.address_prefixes + address_prefixes.prefixes = AAZListArg( + options=["prefixes"], + help="The IP address prefixes, in CIDR notation, that identify the destination(s).", + required=True, + ) + + prefixes = cls._args_schema.network_security_policies.Element.url_filtering.destination.address_prefixes.prefixes + prefixes.Element = AAZStrArg() + + fqdns = cls._args_schema.network_security_policies.Element.url_filtering.destination.fqdns + fqdns.fqdns = AAZListArg( + options=["fqdns"], + help="The fully qualified domain names that identify the destination(s).", + required=True, + ) + + fqdns = cls._args_schema.network_security_policies.Element.url_filtering.destination.fqdns.fqdns + fqdns.Element = AAZStrArg() + + workload_id_patterns = cls._args_schema.network_security_policies.Element.url_filtering.destination.workload_id_patterns + workload_id_patterns.patterns = AAZListArg( + options=["patterns"], + help="The workload ID patterns that identify the destination(s).", + required=True, + ) + + patterns = cls._args_schema.network_security_policies.Element.url_filtering.destination.workload_id_patterns.patterns + patterns.Element = AAZStrArg() + + rules = cls._args_schema.network_security_policies.Element.url_filtering.rules + rules.Element = AAZObjectArg() + + _element = cls._args_schema.network_security_policies.Element.url_filtering.rules.Element + _element.action = AAZStrArg( + options=["action"], + help="The action to take when the rule matches.", + required=True, + enum={"Allow": "Allow", "Deny": "Deny"}, + ) + _element.hostname = AAZStrArg( + options=["hostname"], + help="The hostname matched by the rule. If omitted, the rule matches any hostname.", + ) + _element.method = AAZStrArg( + options=["method"], + help="The HTTP method matched by the rule. If omitted, the rule matches any method.", + enum={"DELETE": "DELETE", "GET": "GET", "HEAD": "HEAD", "OPTIONS": "OPTIONS", "PATCH": "PATCH", "POST": "POST", "PUT": "PUT"}, + ) + _element.name = AAZStrArg( + options=["name"], + help="The name of the rule.", + required=True, + ) + _element.paths = AAZListArg( + options=["paths"], + help="The URL paths matched by the rule. If omitted, the rule matches any path.", + ) + _element.priority = AAZIntArg( + options=["priority"], + help="The priority of the rule. Rules are evaluated in ascending priority order.", + required=True, + ) + + paths = cls._args_schema.network_security_policies.Element.url_filtering.rules.Element.paths + paths.Element = AAZStrArg() + + source = cls._args_schema.network_security_policies.Element.url_filtering.source + source.address_prefixes = AAZObjectArg( + options=["address-prefixes"], + ) + source.workload_id_patterns = AAZObjectArg( + options=["workload-id-patterns"], + ) + + address_prefixes = cls._args_schema.network_security_policies.Element.url_filtering.source.address_prefixes + address_prefixes.prefixes = AAZListArg( + options=["prefixes"], + help="The IP address prefixes, in CIDR notation, that identify the source(s).", + required=True, + ) + + prefixes = cls._args_schema.network_security_policies.Element.url_filtering.source.address_prefixes.prefixes + prefixes.Element = AAZStrArg() + + workload_id_patterns = cls._args_schema.network_security_policies.Element.url_filtering.source.workload_id_patterns + workload_id_patterns.patterns = AAZListArg( + options=["patterns"], + help="The workload ID patterns that identify the source(s).", + required=True, + ) + + patterns = cls._args_schema.network_security_policies.Element.url_filtering.source.workload_id_patterns.patterns + patterns.Element = AAZStrArg() + + # define Arg Group "Resource" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Resource", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Resource", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.PolicyGroupsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class PolicyGroupsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "policyGroupName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("displayName", AAZStrType, ".display_name") + properties.set_prop("networkSecurityPolicies", AAZListType, ".network_security_policies") + properties.set_prop("priority", AAZIntType, ".priority") + + network_security_policies = _builder.get(".properties.networkSecurityPolicies") + if network_security_policies is not None: + network_security_policies.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.networkSecurityPolicies[]") + if _elements is not None: + _elements.set_const("type", "ContentInspection", AAZStrType, ".content_inspection", typ_kwargs={"flags": {"required": True}}) + _elements.set_const("type", "FqdnFiltering", AAZStrType, ".fqdn_filtering", typ_kwargs={"flags": {"required": True}}) + _elements.set_const("type", "Mcp", AAZStrType, ".mcp", typ_kwargs={"flags": {"required": True}}) + _elements.set_const("type", "TlsInspection", AAZStrType, ".tls_inspection", typ_kwargs={"flags": {"required": True}}) + _elements.set_const("type", "UrlFiltering", AAZStrType, ".url_filtering", typ_kwargs={"flags": {"required": True}}) + _elements.discriminate_by("type", "ContentInspection") + _elements.discriminate_by("type", "FqdnFiltering") + _elements.discriminate_by("type", "Mcp") + _elements.discriminate_by("type", "TlsInspection") + _elements.discriminate_by("type", "UrlFiltering") + + disc_content_inspection = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}") + if disc_content_inspection is not None: + disc_content_inspection.set_prop("promptInjectionProtection", AAZObjectType, ".content_inspection.prompt_injection_protection") + disc_content_inspection.set_prop("source", AAZObjectType, ".content_inspection.source", typ_kwargs={"flags": {"required": True}}) + + prompt_injection_protection = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.promptInjectionProtection") + if prompt_injection_protection is not None: + prompt_injection_protection.set_prop("onDetection", AAZStrType, ".on_detection", typ_kwargs={"flags": {"required": True}}) + prompt_injection_protection.set_prop("promptLocations", AAZListType, ".prompt_locations") + prompt_injection_protection.set_prop("responseLocations", AAZListType, ".response_locations") + prompt_injection_protection.set_prop("sensitivity", AAZStrType, ".sensitivity") + + prompt_locations = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.promptInjectionProtection.promptLocations") + if prompt_locations is not None: + prompt_locations.set_elements(AAZStrType, ".") + + response_locations = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.promptInjectionProtection.responseLocations") + if response_locations is not None: + response_locations.set_elements(AAZStrType, ".") + + source = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.source") + if source is not None: + source.set_const("type", "AddressPrefixes", AAZStrType, ".address_prefixes", typ_kwargs={"flags": {"required": True}}) + source.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) + source.discriminate_by("type", "AddressPrefixes") + source.discriminate_by("type", "WorkloadIdPatterns") + + disc_address_prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.source{type:AddressPrefixes}") + if disc_address_prefixes is not None: + disc_address_prefixes.set_prop("prefixes", AAZListType, ".address_prefixes.prefixes", typ_kwargs={"flags": {"required": True}}) + + prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.source{type:AddressPrefixes}.prefixes") + if prefixes is not None: + prefixes.set_elements(AAZStrType, ".") + + disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.source{type:WorkloadIdPatterns}") + if disc_workload_id_patterns is not None: + disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) + + patterns = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.source{type:WorkloadIdPatterns}.patterns") + if patterns is not None: + patterns.set_elements(AAZStrType, ".") + + disc_fqdn_filtering = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}") + if disc_fqdn_filtering is not None: + disc_fqdn_filtering.set_prop("destination", AAZObjectType, ".fqdn_filtering.destination") + disc_fqdn_filtering.set_prop("direction", AAZStrType, ".fqdn_filtering.direction") + disc_fqdn_filtering.set_prop("name", AAZStrType, ".fqdn_filtering.name") + disc_fqdn_filtering.set_prop("ports", AAZListType, ".fqdn_filtering.ports") + disc_fqdn_filtering.set_prop("priority", AAZIntType, ".fqdn_filtering.priority") + disc_fqdn_filtering.set_prop("source", AAZObjectType, ".fqdn_filtering.source", typ_kwargs={"flags": {"required": True}}) + + destination = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.destination") + if destination is not None: + destination.set_const("type", "Fqdns", AAZStrType, ".fqdns", typ_kwargs={"flags": {"required": True}}) + destination.discriminate_by("type", "Fqdns") + + disc_fqdns = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.destination{type:Fqdns}") + if disc_fqdns is not None: + disc_fqdns.set_prop("fqdns", AAZListType, ".fqdns.fqdns", typ_kwargs={"flags": {"required": True}}) + + fqdns = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.destination{type:Fqdns}.fqdns") + if fqdns is not None: + fqdns.set_elements(AAZStrType, ".") + + ports = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.ports") + if ports is not None: + ports.set_elements(AAZIntType, ".") + + source = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.source") + if source is not None: + source.set_const("type", "AddressPrefixes", AAZStrType, ".address_prefixes", typ_kwargs={"flags": {"required": True}}) + source.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) + source.discriminate_by("type", "AddressPrefixes") + source.discriminate_by("type", "WorkloadIdPatterns") + + disc_address_prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.source{type:AddressPrefixes}") + if disc_address_prefixes is not None: + disc_address_prefixes.set_prop("prefixes", AAZListType, ".address_prefixes.prefixes", typ_kwargs={"flags": {"required": True}}) + + prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.source{type:AddressPrefixes}.prefixes") + if prefixes is not None: + prefixes.set_elements(AAZStrType, ".") + + disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.source{type:WorkloadIdPatterns}") + if disc_workload_id_patterns is not None: + disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) + + patterns = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.source{type:WorkloadIdPatterns}.patterns") + if patterns is not None: + patterns.set_elements(AAZStrType, ".") + + disc_mcp = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}") + if disc_mcp is not None: + disc_mcp.set_prop("defaultAction", AAZStrType, ".mcp.default_action", typ_kwargs={"flags": {"required": True}}) + disc_mcp.set_prop("destination", AAZObjectType, ".mcp.destination", typ_kwargs={"flags": {"required": True}}) + disc_mcp.set_prop("rules", AAZListType, ".mcp.rules", typ_kwargs={"flags": {"required": True}}) + disc_mcp.set_prop("source", AAZObjectType, ".mcp.source", typ_kwargs={"flags": {"required": True}}) + + destination = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination") + if destination is not None: + destination.set_const("type", "AddressPrefixes", AAZStrType, ".address_prefixes", typ_kwargs={"flags": {"required": True}}) + destination.set_const("type", "Fqdns", AAZStrType, ".fqdns", typ_kwargs={"flags": {"required": True}}) + destination.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) + destination.discriminate_by("type", "AddressPrefixes") + destination.discriminate_by("type", "Fqdns") + destination.discriminate_by("type", "WorkloadIdPatterns") + + disc_address_prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination{type:AddressPrefixes}") + if disc_address_prefixes is not None: + disc_address_prefixes.set_prop("prefixes", AAZListType, ".address_prefixes.prefixes", typ_kwargs={"flags": {"required": True}}) + + prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination{type:AddressPrefixes}.prefixes") + if prefixes is not None: + prefixes.set_elements(AAZStrType, ".") + + disc_fqdns = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination{type:Fqdns}") + if disc_fqdns is not None: + disc_fqdns.set_prop("fqdns", AAZListType, ".fqdns.fqdns", typ_kwargs={"flags": {"required": True}}) + + fqdns = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination{type:Fqdns}.fqdns") + if fqdns is not None: + fqdns.set_elements(AAZStrType, ".") + + disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination{type:WorkloadIdPatterns}") + if disc_workload_id_patterns is not None: + disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) + + patterns = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination{type:WorkloadIdPatterns}.patterns") + if patterns is not None: + patterns.set_elements(AAZStrType, ".") + + rules = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.rules") + if rules is not None: + rules.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.rules[]") + if _elements is not None: + _elements.set_prop("action", AAZStrType, ".action", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("tools", AAZListType, ".tools", typ_kwargs={"flags": {"required": True}}) + + tools = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.rules[].tools") + if tools is not None: + tools.set_elements(AAZStrType, ".") + + source = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.source") + if source is not None: + source.set_const("type", "AddressPrefixes", AAZStrType, ".address_prefixes", typ_kwargs={"flags": {"required": True}}) + source.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) + source.discriminate_by("type", "AddressPrefixes") + source.discriminate_by("type", "WorkloadIdPatterns") + + disc_address_prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.source{type:AddressPrefixes}") + if disc_address_prefixes is not None: + disc_address_prefixes.set_prop("prefixes", AAZListType, ".address_prefixes.prefixes", typ_kwargs={"flags": {"required": True}}) + + prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.source{type:AddressPrefixes}.prefixes") + if prefixes is not None: + prefixes.set_elements(AAZStrType, ".") + + disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.source{type:WorkloadIdPatterns}") + if disc_workload_id_patterns is not None: + disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) + + patterns = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.source{type:WorkloadIdPatterns}.patterns") + if patterns is not None: + patterns.set_elements(AAZStrType, ".") + + disc_tls_inspection = _builder.get(".properties.networkSecurityPolicies[]{type:TlsInspection}") + if disc_tls_inspection is not None: + disc_tls_inspection.set_prop("certificate", AAZObjectType, ".tls_inspection.certificate", typ_kwargs={"flags": {"required": True}}) + disc_tls_inspection.set_prop("source", AAZObjectType, ".tls_inspection.source", typ_kwargs={"flags": {"required": True}}) + + certificate = _builder.get(".properties.networkSecurityPolicies[]{type:TlsInspection}.certificate") + if certificate is not None: + certificate.set_const("mode", "AzureManagedCA", AAZStrType, ".azure_managed_ca", typ_kwargs={"flags": {"required": True}}) + certificate.discriminate_by("mode", "AzureManagedCA") + + source = _builder.get(".properties.networkSecurityPolicies[]{type:TlsInspection}.source") + if source is not None: + source.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) + source.discriminate_by("type", "WorkloadIdPatterns") + + disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:TlsInspection}.source{type:WorkloadIdPatterns}") + if disc_workload_id_patterns is not None: + disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) + + patterns = _builder.get(".properties.networkSecurityPolicies[]{type:TlsInspection}.source{type:WorkloadIdPatterns}.patterns") + if patterns is not None: + patterns.set_elements(AAZStrType, ".") + + disc_url_filtering = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}") + if disc_url_filtering is not None: + disc_url_filtering.set_prop("defaultAction", AAZStrType, ".url_filtering.default_action", typ_kwargs={"flags": {"required": True}}) + disc_url_filtering.set_prop("destination", AAZObjectType, ".url_filtering.destination") + disc_url_filtering.set_prop("rules", AAZListType, ".url_filtering.rules", typ_kwargs={"flags": {"required": True}}) + disc_url_filtering.set_prop("source", AAZObjectType, ".url_filtering.source", typ_kwargs={"flags": {"required": True}}) + + destination = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination") + if destination is not None: + destination.set_const("type", "AddressPrefixes", AAZStrType, ".address_prefixes", typ_kwargs={"flags": {"required": True}}) + destination.set_const("type", "Fqdns", AAZStrType, ".fqdns", typ_kwargs={"flags": {"required": True}}) + destination.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) + destination.discriminate_by("type", "AddressPrefixes") + destination.discriminate_by("type", "Fqdns") + destination.discriminate_by("type", "WorkloadIdPatterns") + + disc_address_prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination{type:AddressPrefixes}") + if disc_address_prefixes is not None: + disc_address_prefixes.set_prop("prefixes", AAZListType, ".address_prefixes.prefixes", typ_kwargs={"flags": {"required": True}}) + + prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination{type:AddressPrefixes}.prefixes") + if prefixes is not None: + prefixes.set_elements(AAZStrType, ".") + + disc_fqdns = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination{type:Fqdns}") + if disc_fqdns is not None: + disc_fqdns.set_prop("fqdns", AAZListType, ".fqdns.fqdns", typ_kwargs={"flags": {"required": True}}) + + fqdns = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination{type:Fqdns}.fqdns") + if fqdns is not None: + fqdns.set_elements(AAZStrType, ".") + + disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination{type:WorkloadIdPatterns}") + if disc_workload_id_patterns is not None: + disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) + + patterns = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination{type:WorkloadIdPatterns}.patterns") + if patterns is not None: + patterns.set_elements(AAZStrType, ".") + + rules = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.rules") + if rules is not None: + rules.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.rules[]") + if _elements is not None: + _elements.set_prop("action", AAZStrType, ".action", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("hostname", AAZStrType, ".hostname") + _elements.set_prop("method", AAZStrType, ".method") + _elements.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("paths", AAZListType, ".paths") + _elements.set_prop("priority", AAZIntType, ".priority", typ_kwargs={"flags": {"required": True}}) + + paths = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.rules[].paths") + if paths is not None: + paths.set_elements(AAZStrType, ".") + + source = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.source") + if source is not None: + source.set_const("type", "AddressPrefixes", AAZStrType, ".address_prefixes", typ_kwargs={"flags": {"required": True}}) + source.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) + source.discriminate_by("type", "AddressPrefixes") + source.discriminate_by("type", "WorkloadIdPatterns") + + disc_address_prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.source{type:AddressPrefixes}") + if disc_address_prefixes is not None: + disc_address_prefixes.set_prop("prefixes", AAZListType, ".address_prefixes.prefixes", typ_kwargs={"flags": {"required": True}}) + + prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.source{type:AddressPrefixes}.prefixes") + if prefixes is not None: + prefixes.set_elements(AAZStrType, ".") + + disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.source{type:WorkloadIdPatterns}") + if disc_workload_id_patterns is not None: + disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) + + patterns = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.source{type:WorkloadIdPatterns}.patterns") + if patterns is not None: + patterns.set_elements(AAZStrType, ".") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType() + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.description = AAZStrType() + properties.display_name = AAZStrType( + serialized_name="displayName", + ) + properties.network_security_policies = AAZListType( + serialized_name="networkSecurityPolicies", + ) + properties.priority = AAZIntType() + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + network_security_policies = cls._schema_on_200_201.properties.network_security_policies + network_security_policies.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.network_security_policies.Element + _element.type = AAZStrType( + flags={"required": True}, + ) + + disc_content_inspection = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection") + disc_content_inspection.prompt_injection_protection = AAZObjectType( + serialized_name="promptInjectionProtection", + ) + disc_content_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + prompt_injection_protection = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection + prompt_injection_protection.on_detection = AAZStrType( + serialized_name="onDetection", + flags={"required": True}, + ) + prompt_injection_protection.prompt_locations = AAZListType( + serialized_name="promptLocations", + ) + prompt_injection_protection.response_locations = AAZListType( + serialized_name="responseLocations", + ) + prompt_injection_protection.sensitivity = AAZStrType() + + prompt_locations = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.prompt_locations + prompt_locations.Element = AAZStrType() + + response_locations = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.response_locations + response_locations.Element = AAZStrType() + + source = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_fqdn_filtering = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering") + disc_fqdn_filtering.destination = AAZObjectType() + disc_fqdn_filtering.direction = AAZStrType() + disc_fqdn_filtering.name = AAZStrType() + disc_fqdn_filtering.ports = AAZListType() + disc_fqdn_filtering.priority = AAZIntType() + disc_fqdn_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_fqdns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + ports = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").ports + ports.Element = AAZIntType() + + source = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_mcp = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp") + disc_mcp.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_mcp.destination = AAZObjectType( + flags={"required": True}, + ) + disc_mcp.rules = AAZListType( + flags={"required": True}, + ) + disc_mcp.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.tools = AAZListType( + flags={"required": True}, + ) + + tools = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element.tools + tools.Element = AAZStrType() + + source = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_tls_inspection = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection") + disc_tls_inspection.certificate = AAZObjectType( + flags={"required": True}, + ) + disc_tls_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + certificate = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").certificate + certificate.mode = AAZStrType( + flags={"required": True}, + ) + + source = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_url_filtering = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering") + disc_url_filtering.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_url_filtering.destination = AAZObjectType() + disc_url_filtering.rules = AAZListType( + flags={"required": True}, + ) + disc_url_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.hostname = AAZStrType() + _element.method = AAZStrType() + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.paths = AAZListType() + _element.priority = AAZIntType( + flags={"required": True}, + ) + + paths = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element.paths + paths.Element = AAZStrType() + + source = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_delete.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_delete.py new file mode 100644 index 00000000000..7afec806e6b --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_delete.py @@ -0,0 +1,166 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric policy-group delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete an independent resource-group-scoped Microsoft.NetworkSecurity Policy Group resource. Policy Groups are not children of an Agent Fabric. + + :example: PolicyGroups_Delete + az agentfabric policy-group delete --resource-group rgnetworksecurity --name testPolicyGroup + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the PolicyGroup", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.PolicyGroupsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class PolicyGroupsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "policyGroupName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + def on_204(self, session): + pass + + def on_200_201(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_list.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_list.py new file mode 100644 index 00000000000..e62d3f8d00c --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_list.py @@ -0,0 +1,953 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric policy-group list", +) +class List(AAZCommand): + """List independent resource-group-scoped Microsoft.NetworkSecurity Policy Group resources. Policy Groups are not children of an Agent Fabric. + + :example: PolicyGroups_ListBySubscription + az agentfabric policy-group list + + :example: PolicyGroups_ListByResourceGroup + az agentfabric policy-group list --resource-group rgnetworksecurity + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networksecurity/policygroups", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + if condition_0: + self.PolicyGroupsListBySubscription(ctx=self.ctx)() + if condition_1: + self.PolicyGroupsListByResourceGroup(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class PolicyGroupsListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkSecurity/policyGroups", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.description = AAZStrType() + properties.display_name = AAZStrType( + serialized_name="displayName", + ) + properties.network_security_policies = AAZListType( + serialized_name="networkSecurityPolicies", + ) + properties.priority = AAZIntType() + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + network_security_policies = cls._schema_on_200.value.Element.properties.network_security_policies + network_security_policies.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.network_security_policies.Element + _element.type = AAZStrType( + flags={"required": True}, + ) + + disc_content_inspection = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection") + disc_content_inspection.prompt_injection_protection = AAZObjectType( + serialized_name="promptInjectionProtection", + ) + disc_content_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + prompt_injection_protection = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection + prompt_injection_protection.on_detection = AAZStrType( + serialized_name="onDetection", + flags={"required": True}, + ) + prompt_injection_protection.prompt_locations = AAZListType( + serialized_name="promptLocations", + ) + prompt_injection_protection.response_locations = AAZListType( + serialized_name="responseLocations", + ) + prompt_injection_protection.sensitivity = AAZStrType() + + prompt_locations = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.prompt_locations + prompt_locations.Element = AAZStrType() + + response_locations = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.response_locations + response_locations.Element = AAZStrType() + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_fqdn_filtering = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering") + disc_fqdn_filtering.destination = AAZObjectType() + disc_fqdn_filtering.direction = AAZStrType() + disc_fqdn_filtering.name = AAZStrType() + disc_fqdn_filtering.ports = AAZListType() + disc_fqdn_filtering.priority = AAZIntType() + disc_fqdn_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + ports = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").ports + ports.Element = AAZIntType() + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_mcp = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp") + disc_mcp.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_mcp.destination = AAZObjectType( + flags={"required": True}, + ) + disc_mcp.rules = AAZListType( + flags={"required": True}, + ) + disc_mcp.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.tools = AAZListType( + flags={"required": True}, + ) + + tools = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element.tools + tools.Element = AAZStrType() + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_tls_inspection = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection") + disc_tls_inspection.certificate = AAZObjectType( + flags={"required": True}, + ) + disc_tls_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + certificate = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").certificate + certificate.mode = AAZStrType( + flags={"required": True}, + ) + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_url_filtering = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering") + disc_url_filtering.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_url_filtering.destination = AAZObjectType() + disc_url_filtering.rules = AAZListType( + flags={"required": True}, + ) + disc_url_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.hostname = AAZStrType() + _element.method = AAZStrType() + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.paths = AAZListType() + _element.priority = AAZIntType( + flags={"required": True}, + ) + + paths = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element.paths + paths.Element = AAZStrType() + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class PolicyGroupsListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/policyGroups", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.description = AAZStrType() + properties.display_name = AAZStrType( + serialized_name="displayName", + ) + properties.network_security_policies = AAZListType( + serialized_name="networkSecurityPolicies", + ) + properties.priority = AAZIntType() + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + network_security_policies = cls._schema_on_200.value.Element.properties.network_security_policies + network_security_policies.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.network_security_policies.Element + _element.type = AAZStrType( + flags={"required": True}, + ) + + disc_content_inspection = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection") + disc_content_inspection.prompt_injection_protection = AAZObjectType( + serialized_name="promptInjectionProtection", + ) + disc_content_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + prompt_injection_protection = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection + prompt_injection_protection.on_detection = AAZStrType( + serialized_name="onDetection", + flags={"required": True}, + ) + prompt_injection_protection.prompt_locations = AAZListType( + serialized_name="promptLocations", + ) + prompt_injection_protection.response_locations = AAZListType( + serialized_name="responseLocations", + ) + prompt_injection_protection.sensitivity = AAZStrType() + + prompt_locations = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.prompt_locations + prompt_locations.Element = AAZStrType() + + response_locations = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.response_locations + response_locations.Element = AAZStrType() + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_fqdn_filtering = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering") + disc_fqdn_filtering.destination = AAZObjectType() + disc_fqdn_filtering.direction = AAZStrType() + disc_fqdn_filtering.name = AAZStrType() + disc_fqdn_filtering.ports = AAZListType() + disc_fqdn_filtering.priority = AAZIntType() + disc_fqdn_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + ports = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").ports + ports.Element = AAZIntType() + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_mcp = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp") + disc_mcp.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_mcp.destination = AAZObjectType( + flags={"required": True}, + ) + disc_mcp.rules = AAZListType( + flags={"required": True}, + ) + disc_mcp.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.tools = AAZListType( + flags={"required": True}, + ) + + tools = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element.tools + tools.Element = AAZStrType() + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_tls_inspection = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection") + disc_tls_inspection.certificate = AAZObjectType( + flags={"required": True}, + ) + disc_tls_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + certificate = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").certificate + certificate.mode = AAZStrType( + flags={"required": True}, + ) + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_url_filtering = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering") + disc_url_filtering.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_url_filtering.destination = AAZObjectType() + disc_url_filtering.rules = AAZListType( + flags={"required": True}, + ) + disc_url_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.hostname = AAZStrType() + _element.method = AAZStrType() + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.paths = AAZListType() + _element.priority = AAZIntType( + flags={"required": True}, + ) + + paths = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element.paths + paths.Element = AAZStrType() + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_show.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_show.py new file mode 100644 index 00000000000..1c93b534821 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_show.py @@ -0,0 +1,513 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric policy-group show", +) +class Show(AAZCommand): + """Show an independent resource-group-scoped Microsoft.NetworkSecurity Policy Group resource. Policy Groups are not children of an Agent Fabric. + + :example: PolicyGroups_Get + az agentfabric policy-group show --resource-group rgnetworksecurity --name testPolicyGroup + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the PolicyGroup", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PolicyGroupsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class PolicyGroupsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "policyGroupName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.description = AAZStrType() + properties.display_name = AAZStrType( + serialized_name="displayName", + ) + properties.network_security_policies = AAZListType( + serialized_name="networkSecurityPolicies", + ) + properties.priority = AAZIntType() + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + network_security_policies = cls._schema_on_200.properties.network_security_policies + network_security_policies.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_policies.Element + _element.type = AAZStrType( + flags={"required": True}, + ) + + disc_content_inspection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection") + disc_content_inspection.prompt_injection_protection = AAZObjectType( + serialized_name="promptInjectionProtection", + ) + disc_content_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + prompt_injection_protection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection + prompt_injection_protection.on_detection = AAZStrType( + serialized_name="onDetection", + flags={"required": True}, + ) + prompt_injection_protection.prompt_locations = AAZListType( + serialized_name="promptLocations", + ) + prompt_injection_protection.response_locations = AAZListType( + serialized_name="responseLocations", + ) + prompt_injection_protection.sensitivity = AAZStrType() + + prompt_locations = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.prompt_locations + prompt_locations.Element = AAZStrType() + + response_locations = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.response_locations + response_locations.Element = AAZStrType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_fqdn_filtering = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering") + disc_fqdn_filtering.destination = AAZObjectType() + disc_fqdn_filtering.direction = AAZStrType() + disc_fqdn_filtering.name = AAZStrType() + disc_fqdn_filtering.ports = AAZListType() + disc_fqdn_filtering.priority = AAZIntType() + disc_fqdn_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + ports = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").ports + ports.Element = AAZIntType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_mcp = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp") + disc_mcp.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_mcp.destination = AAZObjectType( + flags={"required": True}, + ) + disc_mcp.rules = AAZListType( + flags={"required": True}, + ) + disc_mcp.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.tools = AAZListType( + flags={"required": True}, + ) + + tools = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element.tools + tools.Element = AAZStrType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_tls_inspection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection") + disc_tls_inspection.certificate = AAZObjectType( + flags={"required": True}, + ) + disc_tls_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + certificate = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").certificate + certificate.mode = AAZStrType( + flags={"required": True}, + ) + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_url_filtering = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering") + disc_url_filtering.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_url_filtering.destination = AAZObjectType() + disc_url_filtering.rules = AAZListType( + flags={"required": True}, + ) + disc_url_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.hostname = AAZStrType() + _element.method = AAZStrType() + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.paths = AAZListType() + _element.priority = AAZIntType( + flags={"required": True}, + ) + + paths = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element.paths + paths.Element = AAZStrType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_update.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_update.py new file mode 100644 index 00000000000..185d406be5b --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_update.py @@ -0,0 +1,560 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric policy-group update", +) +class Update(AAZCommand): + """Update an independent resource-group-scoped Microsoft.NetworkSecurity Policy Group resource. Policy Groups are not children of an Agent Fabric. + + :example: PolicyGroups_Update + az agentfabric policy-group update --resource-group rgnetworksecurity --name testPolicyGroup --tags "{env:production}" + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the PolicyGroup", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Properties", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.PolicyGroupsUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class PolicyGroupsUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "policyGroupName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("tags", AAZDictType, ".tags") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.description = AAZStrType() + properties.display_name = AAZStrType( + serialized_name="displayName", + ) + properties.network_security_policies = AAZListType( + serialized_name="networkSecurityPolicies", + ) + properties.priority = AAZIntType() + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + network_security_policies = cls._schema_on_200.properties.network_security_policies + network_security_policies.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_policies.Element + _element.type = AAZStrType( + flags={"required": True}, + ) + + disc_content_inspection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection") + disc_content_inspection.prompt_injection_protection = AAZObjectType( + serialized_name="promptInjectionProtection", + ) + disc_content_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + prompt_injection_protection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection + prompt_injection_protection.on_detection = AAZStrType( + serialized_name="onDetection", + flags={"required": True}, + ) + prompt_injection_protection.prompt_locations = AAZListType( + serialized_name="promptLocations", + ) + prompt_injection_protection.response_locations = AAZListType( + serialized_name="responseLocations", + ) + prompt_injection_protection.sensitivity = AAZStrType() + + prompt_locations = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.prompt_locations + prompt_locations.Element = AAZStrType() + + response_locations = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.response_locations + response_locations.Element = AAZStrType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_fqdn_filtering = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering") + disc_fqdn_filtering.destination = AAZObjectType() + disc_fqdn_filtering.direction = AAZStrType() + disc_fqdn_filtering.name = AAZStrType() + disc_fqdn_filtering.ports = AAZListType() + disc_fqdn_filtering.priority = AAZIntType() + disc_fqdn_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + ports = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").ports + ports.Element = AAZIntType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_mcp = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp") + disc_mcp.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_mcp.destination = AAZObjectType( + flags={"required": True}, + ) + disc_mcp.rules = AAZListType( + flags={"required": True}, + ) + disc_mcp.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.tools = AAZListType( + flags={"required": True}, + ) + + tools = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element.tools + tools.Element = AAZStrType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_tls_inspection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection") + disc_tls_inspection.certificate = AAZObjectType( + flags={"required": True}, + ) + disc_tls_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + certificate = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").certificate + certificate.mode = AAZStrType( + flags={"required": True}, + ) + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_url_filtering = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering") + disc_url_filtering.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_url_filtering.destination = AAZObjectType() + disc_url_filtering.rules = AAZListType( + flags={"required": True}, + ) + disc_url_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.hostname = AAZStrType() + _element.method = AAZStrType() + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.paths = AAZListType() + _element.priority = AAZIntType( + flags={"required": True}, + ) + + paths = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element.paths + paths.Element = AAZStrType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + +__all__ = ["Update"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_wait.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_wait.py new file mode 100644 index 00000000000..10970b8c85a --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_wait.py @@ -0,0 +1,509 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric policy-group wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the PolicyGroup", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PolicyGroupsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class PolicyGroupsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "policyGroupName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.description = AAZStrType() + properties.display_name = AAZStrType( + serialized_name="displayName", + ) + properties.network_security_policies = AAZListType( + serialized_name="networkSecurityPolicies", + ) + properties.priority = AAZIntType() + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + network_security_policies = cls._schema_on_200.properties.network_security_policies + network_security_policies.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_policies.Element + _element.type = AAZStrType( + flags={"required": True}, + ) + + disc_content_inspection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection") + disc_content_inspection.prompt_injection_protection = AAZObjectType( + serialized_name="promptInjectionProtection", + ) + disc_content_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + prompt_injection_protection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection + prompt_injection_protection.on_detection = AAZStrType( + serialized_name="onDetection", + flags={"required": True}, + ) + prompt_injection_protection.prompt_locations = AAZListType( + serialized_name="promptLocations", + ) + prompt_injection_protection.response_locations = AAZListType( + serialized_name="responseLocations", + ) + prompt_injection_protection.sensitivity = AAZStrType() + + prompt_locations = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.prompt_locations + prompt_locations.Element = AAZStrType() + + response_locations = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.response_locations + response_locations.Element = AAZStrType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_fqdn_filtering = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering") + disc_fqdn_filtering.destination = AAZObjectType() + disc_fqdn_filtering.direction = AAZStrType() + disc_fqdn_filtering.name = AAZStrType() + disc_fqdn_filtering.ports = AAZListType() + disc_fqdn_filtering.priority = AAZIntType() + disc_fqdn_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + ports = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").ports + ports.Element = AAZIntType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_mcp = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp") + disc_mcp.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_mcp.destination = AAZObjectType( + flags={"required": True}, + ) + disc_mcp.rules = AAZListType( + flags={"required": True}, + ) + disc_mcp.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.tools = AAZListType( + flags={"required": True}, + ) + + tools = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element.tools + tools.Element = AAZStrType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_tls_inspection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection") + disc_tls_inspection.certificate = AAZObjectType( + flags={"required": True}, + ) + disc_tls_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + certificate = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").certificate + certificate.mode = AAZStrType( + flags={"required": True}, + ) + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_url_filtering = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering") + disc_url_filtering.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_url_filtering.destination = AAZObjectType() + disc_url_filtering.rules = AAZListType( + flags={"required": True}, + ) + disc_url_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.hostname = AAZStrType() + _element.method = AAZStrType() + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.paths = AAZListType() + _element.priority = AAZIntType( + flags={"required": True}, + ) + + paths = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element.paths + paths.Element = AAZStrType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/agentfabric/azext_agentfabric/azext_metadata.json b/src/agentfabric/azext_agentfabric/azext_metadata.json new file mode 100644 index 00000000000..71889bb136b --- /dev/null +++ b/src/agentfabric/azext_agentfabric/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isPreview": true, + "azext.minCliCoreVersion": "2.75.0" +} \ No newline at end of file diff --git a/src/agentfabric/azext_agentfabric/commands.py b/src/agentfabric/azext_agentfabric/commands.py new file mode 100644 index 00000000000..b0d842e4993 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/commands.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# 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 + +# from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): # pylint: disable=unused-argument + pass diff --git a/src/agentfabric/azext_agentfabric/custom.py b/src/agentfabric/azext_agentfabric/custom.py new file mode 100644 index 00000000000..86df1e48ef5 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/custom.py @@ -0,0 +1,14 @@ +# -------------------------------------------------------------------------------------------- +# 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 + +from knack.log import get_logger + + +logger = get_logger(__name__) diff --git a/src/agentfabric/azext_agentfabric/tests/__init__.py b/src/agentfabric/azext_agentfabric/tests/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/tests/__init__.py @@ -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 +# -------------------------------------------------------------------------------------------- diff --git a/src/agentfabric/azext_agentfabric/tests/latest/__init__.py b/src/agentfabric/azext_agentfabric/tests/latest/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/tests/latest/__init__.py @@ -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 +# -------------------------------------------------------------------------------------------- diff --git a/src/agentfabric/azext_agentfabric/tests/latest/test_agentfabric.py b/src/agentfabric/azext_agentfabric/tests/latest/test_agentfabric.py new file mode 100644 index 00000000000..d6b51ba482e --- /dev/null +++ b/src/agentfabric/azext_agentfabric/tests/latest/test_agentfabric.py @@ -0,0 +1,209 @@ +# -------------------------------------------------------------------------------------------- +# 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 +# -------------------------------------------------------------------------------------------- + +import importlib +import shlex +import unittest +from unittest.mock import MagicMock + +from azure.cli.testsdk import ScenarioTest + + +COMMANDS = ( + ("agentfabric create", "azext_agentfabric.aaz.latest.agentfabric._create", "Create"), + ("agentfabric show", "azext_agentfabric.aaz.latest.agentfabric._show", "Show"), + ("agentfabric list", "azext_agentfabric.aaz.latest.agentfabric._list", "List"), + ("agentfabric update", "azext_agentfabric.aaz.latest.agentfabric._update", "Update"), + ("agentfabric delete", "azext_agentfabric.aaz.latest.agentfabric._delete", "Delete"), + ( + "agentfabric member create", + "azext_agentfabric.aaz.latest.agentfabric.member._create", + "Create", + ), + ( + "agentfabric member show", + "azext_agentfabric.aaz.latest.agentfabric.member._show", + "Show", + ), + ( + "agentfabric member list", + "azext_agentfabric.aaz.latest.agentfabric.member._list", + "List", + ), + ( + "agentfabric member update", + "azext_agentfabric.aaz.latest.agentfabric.member._update", + "Update", + ), + ( + "agentfabric member delete", + "azext_agentfabric.aaz.latest.agentfabric.member._delete", + "Delete", + ), + ( + "agentfabric policy-group create", + "azext_agentfabric.aaz.latest.agentfabric.policy_group._create", + "Create", + ), + ( + "agentfabric policy-group show", + "azext_agentfabric.aaz.latest.agentfabric.policy_group._show", + "Show", + ), + ( + "agentfabric policy-group list", + "azext_agentfabric.aaz.latest.agentfabric.policy_group._list", + "List", + ), + ( + "agentfabric policy-group update", + "azext_agentfabric.aaz.latest.agentfabric.policy_group._update", + "Update", + ), + ( + "agentfabric policy-group delete", + "azext_agentfabric.aaz.latest.agentfabric.policy_group._delete", + "Delete", + ), +) + +HELP_ONLY_COMMANDS = ( + "agentfabric wait", + "agentfabric member wait", + "agentfabric policy-group wait", +) + +REQUEST_SHAPES = ( + ( + "azext_agentfabric.aaz.latest.agentfabric._create", + "Create", + "AgentFabricsCreateOrUpdate", + "PUT", + "/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", + ), + ( + "azext_agentfabric.aaz.latest.agentfabric._update", + "Update", + "AgentFabricsUpdate", + "PATCH", + "/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", + ), + ( + "azext_agentfabric.aaz.latest.agentfabric._delete", + "Delete", + "AgentFabricsDelete", + "DELETE", + "/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", + ), + ( + "azext_agentfabric.aaz.latest.agentfabric.member._create", + "Create", + "MembersCreateOrUpdate", + "PUT", + "/agentFabrics/{agentFabricName}/members/{memberName}", + ), + ( + "azext_agentfabric.aaz.latest.agentfabric.member._update", + "Update", + "MembersUpdate", + "PATCH", + "/agentFabrics/{agentFabricName}/members/{memberName}", + ), + ( + "azext_agentfabric.aaz.latest.agentfabric.member._delete", + "Delete", + "MembersDelete", + "DELETE", + "/agentFabrics/{agentFabricName}/members/{memberName}", + ), + ( + "azext_agentfabric.aaz.latest.agentfabric.policy_group._create", + "Create", + "PolicyGroupsCreateOrUpdate", + "PUT", + "/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", + ), + ( + "azext_agentfabric.aaz.latest.agentfabric.policy_group._update", + "Update", + "PolicyGroupsUpdate", + "PATCH", + "/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", + ), + ( + "azext_agentfabric.aaz.latest.agentfabric.policy_group._delete", + "Delete", + "PolicyGroupsDelete", + "DELETE", + "/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", + ), +) + + +def _examples(command_class): + doc = command_class.__doc__ or "" + return [ + line.strip() + for line in doc.splitlines() + if line.strip().startswith("az agentfabric ") + ] + + +class AgentfabricScenario(ScenarioTest): + + def test_agentfabric_command_help(self): + commands = ( + "agentfabric", + "agentfabric member", + "agentfabric policy-group", + *(command for command, _, _ in COMMANDS), + *HELP_ONLY_COMMANDS, + ) + for command in commands: + try: + self.cmd(f"az {command} --help") + except SystemExit as ex: + self.assertEqual(ex.code, 0, f"{command} help failed") + + def test_agentfabric_examples_parse(self): + for command, module_name, class_name in COMMANDS: + command_class = getattr(importlib.import_module(module_name), class_name) + examples = _examples(command_class) + self.assertTrue(examples, command) + for example in examples: + tokens = shlex.split(example) + self.assertEqual(tokens[:2], ["az", "agentfabric"], example) + escaped_example = example.replace("{", "{{").replace("}", "}}") + try: + self.cmd(f"{escaped_example} --help") + except SystemExit as ex: + self.assertEqual(ex.code, 0, f"Example failed to parse: {example}") + + +class AgentfabricGeneratedCommandTest(unittest.TestCase): + + def test_all_commands_have_generated_examples(self): + for command, module_name, class_name in COMMANDS: + command_class = getattr(importlib.import_module(module_name), class_name) + self.assertIn(":example:", command_class.__doc__, command) + self.assertTrue( + any(example.startswith(f"az {command}") for example in _examples(command_class)), + command, + ) + + def test_lro_request_shapes_and_resource_urls(self): + for module_name, class_name, operation_name, method, url_suffix in REQUEST_SHAPES: + command_class = getattr(importlib.import_module(module_name), class_name) + operation_class = getattr(command_class, operation_name) + operation = operation_class(ctx=MagicMock()) + operation.client.format_url.side_effect = lambda url, **_: url + self.assertEqual(operation.method, method) + self.assertEqual( + operation.query_parameters, + {"api-version": "2026-07-21-preview"}, + ) + self.assertTrue(operation.url.endswith(url_suffix), operation.url) diff --git a/src/agentfabric/linter_exclusions.yml b/src/agentfabric/linter_exclusions.yml new file mode 100644 index 00000000000..5f69784db9e --- /dev/null +++ b/src/agentfabric/linter_exclusions.yml @@ -0,0 +1,5 @@ +agentfabric policy-group create: + parameters: + network_security_policies: + rule_exclusions: + - option_length_too_long diff --git a/src/agentfabric/setup.cfg b/src/agentfabric/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/agentfabric/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/agentfabric/setup.py b/src/agentfabric/setup.py new file mode 100644 index 00000000000..0d7b199be59 --- /dev/null +++ b/src/agentfabric/setup.py @@ -0,0 +1,51 @@ +# -------------------------------------------------------------------------------------------- +# 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 codecs import open +from setuptools import setup, find_packages + + +# HISTORY.rst entry. +VERSION = '1.0.0b1' + +# 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.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', + 'License :: OSI Approved :: MIT License', +] + +DEPENDENCIES = [] + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='agentfabric', + version=VERSION, + description='Manage Azure Agent Fabric resources.', + long_description=README + '\n\n' + HISTORY, + license='MIT', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions/tree/main/src/agentfabric', + classifiers=CLASSIFIERS, + packages=find_packages(exclude=["tests"]), + package_data={'azext_agentfabric': ['azext_metadata.json']}, + install_requires=DEPENDENCIES +) diff --git a/src/service_name.json b/src/service_name.json index 690baff2766..006623a8062 100644 --- a/src/service_name.json +++ b/src/service_name.json @@ -24,6 +24,11 @@ "AzureServiceName": "Azure Front Door", "URL": "https://learn.microsoft.com/azure/frontdoor" }, + { + "Command": "az agentfabric", + "AzureServiceName": "Azure Agent Fabric", + "URL": "" + }, { "Command": "az ai-examples", "AzureServiceName": "AI Examples", From 02c98d0a0d48a1c03b74197fd5bfde0aa0804ec9 Mon Sep 17 00:00:00 2001 From: Kshitija Murudi Date: Sun, 20 Sep 2026 21:10:14 -0700 Subject: [PATCH 2/8] Keep Agent Mesh source alongside Agent Fabric Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/agentmesh/HISTORY.rst | 9 + src/agentmesh/README.md | 70 + src/agentmesh/azext_agentmesh/__init__.py | 42 + src/agentmesh/azext_agentmesh/_help.py | 11 + src/agentmesh/azext_agentmesh/_params.py | 13 + src/agentmesh/azext_agentmesh/aaz/__init__.py | 6 + .../azext_agentmesh/aaz/latest/__init__.py | 9 + .../aaz/latest/agentmesh/__cmd_group.py | 23 + .../aaz/latest/agentmesh/__init__.py | 11 + .../latest/agentmesh/fabric/__cmd_group.py | 23 + .../aaz/latest/agentmesh/fabric/__init__.py | 17 + .../aaz/latest/agentmesh/fabric/_create.py | 309 ++++ .../aaz/latest/agentmesh/fabric/_delete.py | 166 ++ .../aaz/latest/agentmesh/fabric/_list.py | 373 +++++ .../aaz/latest/agentmesh/fabric/_show.py | 223 +++ .../aaz/latest/agentmesh/fabric/_update.py | 270 ++++ .../aaz/latest/agentmesh/fabric/_wait.py | 219 +++ .../agentmesh/fabric/member/__cmd_group.py | 23 + .../agentmesh/fabric/member/__init__.py | 17 + .../latest/agentmesh/fabric/member/_create.py | 516 +++++++ .../latest/agentmesh/fabric/member/_delete.py | 179 +++ .../latest/agentmesh/fabric/member/_list.py | 300 ++++ .../latest/agentmesh/fabric/member/_show.py | 301 ++++ .../latest/agentmesh/fabric/member/_update.py | 348 +++++ .../latest/agentmesh/fabric/member/_wait.py | 297 ++++ .../agentmesh/policy_group/__cmd_group.py | 23 + .../latest/agentmesh/policy_group/__init__.py | 17 + .../latest/agentmesh/policy_group/_create.py | 1332 +++++++++++++++++ .../latest/agentmesh/policy_group/_delete.py | 166 ++ .../latest/agentmesh/policy_group/_list.py | 953 ++++++++++++ .../latest/agentmesh/policy_group/_show.py | 513 +++++++ .../latest/agentmesh/policy_group/_update.py | 560 +++++++ .../latest/agentmesh/policy_group/_wait.py | 509 +++++++ .../azext_agentmesh/azext_metadata.json | 4 + src/agentmesh/azext_agentmesh/commands.py | 15 + src/agentmesh/azext_agentmesh/custom.py | 14 + .../azext_agentmesh/tests/__init__.py | 6 + .../azext_agentmesh/tests/latest/__init__.py | 6 + .../test_agentmesh_command_help.yaml | 44 + .../tests/latest/test_agentmesh.py | 172 +++ src/agentmesh/linter_exclusions.yml | 5 + src/agentmesh/setup.cfg | 1 + src/agentmesh/setup.py | 51 + src/service_name.json | 5 + 44 files changed, 8171 insertions(+) create mode 100644 src/agentmesh/HISTORY.rst create mode 100644 src/agentmesh/README.md create mode 100644 src/agentmesh/azext_agentmesh/__init__.py create mode 100644 src/agentmesh/azext_agentmesh/_help.py create mode 100644 src/agentmesh/azext_agentmesh/_params.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/__init__.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/__init__.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/__cmd_group.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/__init__.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/__cmd_group.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/__init__.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_create.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_delete.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_list.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_show.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_update.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_wait.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/__cmd_group.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/__init__.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_create.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_delete.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_list.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_show.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_update.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_wait.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/__cmd_group.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/__init__.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_create.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_delete.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_list.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_show.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_update.py create mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_wait.py create mode 100644 src/agentmesh/azext_agentmesh/azext_metadata.json create mode 100644 src/agentmesh/azext_agentmesh/commands.py create mode 100644 src/agentmesh/azext_agentmesh/custom.py create mode 100644 src/agentmesh/azext_agentmesh/tests/__init__.py create mode 100644 src/agentmesh/azext_agentmesh/tests/latest/__init__.py create mode 100644 src/agentmesh/azext_agentmesh/tests/latest/recordings/test_agentmesh_command_help.yaml create mode 100644 src/agentmesh/azext_agentmesh/tests/latest/test_agentmesh.py create mode 100644 src/agentmesh/linter_exclusions.yml create mode 100644 src/agentmesh/setup.cfg create mode 100644 src/agentmesh/setup.py diff --git a/src/agentmesh/HISTORY.rst b/src/agentmesh/HISTORY.rst new file mode 100644 index 00000000000..10c3d4b501d --- /dev/null +++ b/src/agentmesh/HISTORY.rst @@ -0,0 +1,9 @@ +.. :changelog: + +Release History +=============== + +1.0.0b1 +++++++ +* Initial preview release for Azure Agent Mesh using API version ``2026-07-21-preview``. +* Add fabric, fabric member, and policy group create, show, list, update, and delete commands. \ No newline at end of file diff --git a/src/agentmesh/README.md b/src/agentmesh/README.md new file mode 100644 index 00000000000..789c5f145b4 --- /dev/null +++ b/src/agentmesh/README.md @@ -0,0 +1,70 @@ +# Azure CLI Agent Mesh Extension + +This extension manages Azure Agent Mesh fabrics, fabric members, and policy groups. +It uses the `Microsoft.NetworkSecurity` resource provider API version +`2026-07-21-preview`. + +## Install + +```bash +az extension add --name agentmesh +``` + +## Commands + +Each resource supports `create`, `show`, `list`, `update`, and `delete`. + +```bash +az agentmesh fabric --help +az agentmesh fabric member --help +az agentmesh policy-group --help +``` + +### Fabrics + +```bash +az agentmesh fabric create \ + --resource-group myResourceGroup \ + --name myFabric \ + --location eastus \ + --trust-domain contoso.agentfabric + +az agentmesh fabric update \ + --resource-group myResourceGroup \ + --name myFabric \ + --tags environment=production + +az agentmesh fabric list --resource-group myResourceGroup +``` + +### Fabric members + +```bash +az agentmesh fabric member create \ + --resource-group myResourceGroup \ + --fabric-name myFabric \ + --member-name myMember \ + --location eastus \ + --workload "{aci:{resource-id:/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance/containerGroups/myContainerGroup}}" + +az agentmesh fabric member show \ + --resource-group myResourceGroup \ + --fabric-name myFabric \ + --member-name myMember +``` + +### Policy groups + +```bash +az agentmesh policy-group create \ + --resource-group myResourceGroup \ + --name myPolicyGroup \ + --location eastus \ + --display-name "My policy group" \ + --priority 100 + +az agentmesh policy-group list --resource-group myResourceGroup +``` + +Long-running create, update, and delete operations support `--no-wait`. Use the +corresponding `wait` command to wait for provisioning to reach a target state. \ No newline at end of file diff --git a/src/agentmesh/azext_agentmesh/__init__.py b/src/agentmesh/azext_agentmesh/__init__.py new file mode 100644 index 00000000000..d5b149feef9 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/__init__.py @@ -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_agentmesh._help import helps # pylint: disable=unused-import + + +class AgentmeshCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + custom_command_type = CliCommandType( + operations_tmpl='azext_agentmesh.custom#{}') + super().__init__(cli_ctx=cli_ctx, + custom_command_type=custom_command_type) + + def load_command_table(self, args): + from azext_agentmesh.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_agentmesh._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = AgentmeshCommandsLoader diff --git a/src/agentmesh/azext_agentmesh/_help.py b/src/agentmesh/azext_agentmesh/_help.py new file mode 100644 index 00000000000..126d5d00714 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/_help.py @@ -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: disable=line-too-long +# pylint: disable=too-many-lines + +from knack.help_files import helps # pylint: disable=unused-import diff --git a/src/agentmesh/azext_agentmesh/_params.py b/src/agentmesh/azext_agentmesh/_params.py new file mode 100644 index 00000000000..cfcec717c9c --- /dev/null +++ b/src/agentmesh/azext_agentmesh/_params.py @@ -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 diff --git a/src/agentmesh/azext_agentmesh/aaz/__init__.py b/src/agentmesh/azext_agentmesh/aaz/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/__init__.py @@ -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 +# -------------------------------------------------------------------------------------------- diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/__init__.py b/src/agentmesh/azext_agentmesh/aaz/latest/__init__.py new file mode 100644 index 00000000000..7e832c711e8 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/__init__.py @@ -0,0 +1,9 @@ +# -------------------------------------------------------------------------------------------- +# 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 diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/__cmd_group.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/__cmd_group.py new file mode 100644 index 00000000000..c67bf0e3291 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/__cmd_group.py @@ -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( + "agentmesh", +) +class __CMDGroup(AAZCommandGroup): + """Manage Azure Agent Mesh resources. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/__init__.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/__init__.py new file mode 100644 index 00000000000..5a9d61963d6 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/__init__.py @@ -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 * diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/__cmd_group.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/__cmd_group.py new file mode 100644 index 00000000000..b8eeff1ab7c --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/__cmd_group.py @@ -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( + "agentmesh fabric", +) +class __CMDGroup(AAZCommandGroup): + """Manage Agent Mesh fabrics. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/__init__.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/__init__.py @@ -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 * diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_create.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_create.py new file mode 100644 index 00000000000..07a06870287 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_create.py @@ -0,0 +1,309 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentmesh fabric create", +) +class Create(AAZCommand): + """Create an Agent Mesh fabric + + :example: AgentFabrics_CreateOrUpdate + az agentmesh fabric create --resource-group rgnetworksecurity --name testAIFabric --default-policy-groups "[/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgnetworksecurity/providers/Microsoft.NetworkSecurity/policyGroups/testPolicyGroup]" --trust-domain contoso.agentfabric --tags "{}" --location eastus + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the AgentFabric", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.default_policy_groups = AAZListArg( + options=["--default-policy-groups"], + arg_group="Properties", + help="The default policy groups to apply to all members of this fabric.", + ) + _args_schema.trust_domain = AAZStrArg( + options=["--trust-domain"], + arg_group="Properties", + help="The trust domain that scopes this fabric's member identities. It is the leading component of each member's identity, which takes the form `//`. Set at creation and immutable thereafter; when omitted, the shared default trust domain `microsoft.agentfabric` is used.", + fmt=AAZStrArgFormat( + pattern="^[a-z0-9]([a-z0-9.-]*[a-z0-9])?$", + max_length=253, + ), + ) + + default_policy_groups = cls._args_schema.default_policy_groups + default_policy_groups.Element = AAZResourceIdArg() + + # define Arg Group "Resource" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Resource", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Resource", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.AgentFabricsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class AgentFabricsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("defaultPolicyGroups", AAZListType, ".default_policy_groups") + properties.set_prop("trustDomain", AAZStrType, ".trust_domain") + + default_policy_groups = _builder.get(".properties.defaultPolicyGroups") + if default_policy_groups is not None: + default_policy_groups.set_elements(AAZStrType, ".") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType() + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.default_policy_groups = AAZListType( + serialized_name="defaultPolicyGroups", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.trust_domain = AAZStrType( + serialized_name="trustDomain", + ) + + default_policy_groups = cls._schema_on_200_201.properties.default_policy_groups + default_policy_groups.Element = AAZStrType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_delete.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_delete.py new file mode 100644 index 00000000000..51ca27320c6 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_delete.py @@ -0,0 +1,166 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentmesh fabric delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete an Agent Mesh fabric + + :example: AgentFabrics_Delete + az agentmesh fabric delete --resource-group rgnetworksecurity --name testAIFabric + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.AgentFabricsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class AgentFabricsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + def on_204(self, session): + pass + + def on_200_201(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_list.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_list.py new file mode 100644 index 00000000000..9f58b5b21d2 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_list.py @@ -0,0 +1,373 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentmesh fabric list", +) +class List(AAZCommand): + """List Agent Mesh fabrics + + :example: AgentFabrics_ListBySubscription + az agentmesh fabric list + + :example: AgentFabrics_ListByResourceGroup + az agentmesh fabric list --resource-group rgnetworksecurity + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networksecurity/agentfabrics", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + if condition_0: + self.AgentFabricsListBySubscription(ctx=self.ctx)() + if condition_1: + self.AgentFabricsListByResourceGroup(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class AgentFabricsListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkSecurity/agentFabrics", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.default_policy_groups = AAZListType( + serialized_name="defaultPolicyGroups", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.trust_domain = AAZStrType( + serialized_name="trustDomain", + ) + + default_policy_groups = cls._schema_on_200.value.Element.properties.default_policy_groups + default_policy_groups.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class AgentFabricsListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.default_policy_groups = AAZListType( + serialized_name="defaultPolicyGroups", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.trust_domain = AAZStrType( + serialized_name="trustDomain", + ) + + default_policy_groups = cls._schema_on_200.value.Element.properties.default_policy_groups + default_policy_groups.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_show.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_show.py new file mode 100644 index 00000000000..0956cef9aa7 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_show.py @@ -0,0 +1,223 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentmesh fabric show", +) +class Show(AAZCommand): + """Get an Agent Mesh fabric + + :example: AgentFabrics_Get + az agentmesh fabric show --resource-group rgnetworksecurity --name testAIFabric + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AgentFabricsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class AgentFabricsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.default_policy_groups = AAZListType( + serialized_name="defaultPolicyGroups", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.trust_domain = AAZStrType( + serialized_name="trustDomain", + ) + + default_policy_groups = cls._schema_on_200.properties.default_policy_groups + default_policy_groups.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_update.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_update.py new file mode 100644 index 00000000000..cfc6bde9e83 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_update.py @@ -0,0 +1,270 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentmesh fabric update", +) +class Update(AAZCommand): + """Update an Agent Mesh fabric's tags + + :example: AgentFabrics_Update + az agentmesh fabric update --resource-group rgnetworksecurity --name testAIFabric --tags "{env:production}" + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Properties", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.AgentFabricsUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class AgentFabricsUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("tags", AAZDictType, ".tags") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.default_policy_groups = AAZListType( + serialized_name="defaultPolicyGroups", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.trust_domain = AAZStrType( + serialized_name="trustDomain", + ) + + default_policy_groups = cls._schema_on_200.properties.default_policy_groups + default_policy_groups.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + +__all__ = ["Update"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_wait.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_wait.py new file mode 100644 index 00000000000..3e21749e3e0 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_wait.py @@ -0,0 +1,219 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentmesh fabric wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AgentFabricsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class AgentFabricsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.default_policy_groups = AAZListType( + serialized_name="defaultPolicyGroups", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.trust_domain = AAZStrType( + serialized_name="trustDomain", + ) + + default_policy_groups = cls._schema_on_200.properties.default_policy_groups + default_policy_groups.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/__cmd_group.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/__cmd_group.py new file mode 100644 index 00000000000..605104362fc --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/__cmd_group.py @@ -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( + "agentmesh fabric member", +) +class __CMDGroup(AAZCommandGroup): + """Manage members of an Agent Mesh fabric. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/__init__.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/__init__.py @@ -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 * diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_create.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_create.py new file mode 100644 index 00000000000..132225126a9 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_create.py @@ -0,0 +1,516 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentmesh fabric member create", +) +class Create(AAZCommand): + """Create a member in an Agent Mesh fabric + + :example: Members_CreateOrUpdate + az agentmesh fabric member create --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name testMember --location eastus --workload "{aci:{resource-id:/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgnetworksecurity/providers/Microsoft.ContainerInstance/containerGroups/testContainerGroup}}" + + :example: Members_CreateOrUpdate_AgentFabricSandbox + az agentmesh fabric member create --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name sandboxMember --location eastus --workload "{agent-fabric-sandbox:{image:{uri:'contoso.azurecr.io/agents/sandbox:1.0.0',digest:'sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae',pull-policy:IfNotPresent},resources:{cpu:2,memory:4Gi,disk:20Gi},agent-identity:{tenant-id:72f988bf-86f1-41af-91ab-2d7cd011db47,agent-id:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee},endpoints:[{name:http,port:8080}],domain:sandbox-member.testaifabric.contoso.com}}" + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="The name of the AgentFabric", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.member_name = AAZStrArg( + options=["--member-name"], + help="The name of the Member", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.workload = AAZObjectArg( + options=["--workload"], + arg_group="Properties", + help="The workload configuration of the member. Set at creation and immutable thereafter; to change the workload, delete and recreate the member.", + ) + + workload = cls._args_schema.workload + workload.aci = AAZObjectArg( + options=["aci"], + ) + workload.agent_fabric_sandbox = AAZObjectArg( + options=["agent-fabric-sandbox"], + ) + + aci = cls._args_schema.workload.aci + aci.resource_id = AAZResourceIdArg( + options=["resource-id"], + help="The Azure Resource Manager resource ID of the Azure Container Instances (ACI) container group backing this member's sandbox.", + required=True, + ) + + agent_fabric_sandbox = cls._args_schema.workload.agent_fabric_sandbox + agent_fabric_sandbox.agent_identity = AAZObjectArg( + options=["agent-identity"], + help="The Entra agent identity associated with the workload.", + ) + agent_fabric_sandbox.domain = AAZStrArg( + options=["domain"], + help="The resolvable DNS name assigned to the workload.", + required=True, + ) + agent_fabric_sandbox.endpoints = AAZListArg( + options=["endpoints"], + help="The network endpoints exposed by the workload.", + ) + agent_fabric_sandbox.image = AAZObjectArg( + options=["image"], + help="The container image to run for the workload.", + required=True, + ) + agent_fabric_sandbox.resources = AAZObjectArg( + options=["resources"], + help="The compute resources allocated to the workload.", + required=True, + ) + + agent_identity = cls._args_schema.workload.agent_fabric_sandbox.agent_identity + agent_identity.agent_id = AAZStrArg( + options=["agent-id"], + help="The Entra agent ID representing the workload's identity.", + required=True, + ) + agent_identity.tenant_id = AAZStrArg( + options=["tenant-id"], + help="The Azure tenant ID that owns the agent identity.", + required=True, + ) + + endpoints = cls._args_schema.workload.agent_fabric_sandbox.endpoints + endpoints.Element = AAZObjectArg() + + _element = cls._args_schema.workload.agent_fabric_sandbox.endpoints.Element + _element.name = AAZStrArg( + options=["name"], + help="The name of the endpoint.", + required=True, + ) + _element.port = AAZIntArg( + options=["port"], + help="The port the endpoint listens on.", + required=True, + ) + + image = cls._args_schema.workload.agent_fabric_sandbox.image + image.digest = AAZStrArg( + options=["digest"], + help="The image content digest used to pin an exact image version.", + ) + image.pull_policy = AAZStrArg( + options=["pull-policy"], + help="The policy controlling when the image is pulled.", + enum={"Always": "Always", "IfNotPresent": "IfNotPresent"}, + ) + image.uri = AAZStrArg( + options=["uri"], + help="The image reference URI (e.g., registry/repository:tag).", + required=True, + ) + + resources = cls._args_schema.workload.agent_fabric_sandbox.resources + resources.cpu = AAZStrArg( + options=["cpu"], + help="The amount of CPU to allocate to the workload.", + required=True, + ) + resources.disk = AAZStrArg( + options=["disk"], + help="The amount of disk to allocate to the workload.", + ) + resources.memory = AAZStrArg( + options=["memory"], + help="The amount of memory to allocate to the workload.", + required=True, + ) + + # define Arg Group "Resource" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Resource", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Resource", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.MembersCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class MembersCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/members/{memberName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "memberName", self.ctx.args.member_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("workload", AAZObjectType, ".workload") + + workload = _builder.get(".properties.workload") + if workload is not None: + workload.set_const("type", "ACI", AAZStrType, ".aci", typ_kwargs={"flags": {"required": True}}) + workload.set_const("type", "AgentFabricSandbox", AAZStrType, ".agent_fabric_sandbox", typ_kwargs={"flags": {"required": True}}) + workload.discriminate_by("type", "ACI") + workload.discriminate_by("type", "AgentFabricSandbox") + + disc_aci = _builder.get(".properties.workload{type:ACI}") + if disc_aci is not None: + disc_aci.set_prop("resourceId", AAZStrType, ".aci.resource_id", typ_kwargs={"flags": {"required": True}}) + + disc_agent_fabric_sandbox = _builder.get(".properties.workload{type:AgentFabricSandbox}") + if disc_agent_fabric_sandbox is not None: + disc_agent_fabric_sandbox.set_prop("agentIdentity", AAZObjectType, ".agent_fabric_sandbox.agent_identity") + disc_agent_fabric_sandbox.set_prop("domain", AAZStrType, ".agent_fabric_sandbox.domain", typ_kwargs={"flags": {"required": True}}) + disc_agent_fabric_sandbox.set_prop("endpoints", AAZListType, ".agent_fabric_sandbox.endpoints") + disc_agent_fabric_sandbox.set_prop("image", AAZObjectType, ".agent_fabric_sandbox.image", typ_kwargs={"flags": {"required": True}}) + disc_agent_fabric_sandbox.set_prop("resources", AAZObjectType, ".agent_fabric_sandbox.resources", typ_kwargs={"flags": {"required": True}}) + + agent_identity = _builder.get(".properties.workload{type:AgentFabricSandbox}.agentIdentity") + if agent_identity is not None: + agent_identity.set_prop("agentId", AAZStrType, ".agent_id", typ_kwargs={"flags": {"required": True}}) + agent_identity.set_prop("tenantId", AAZStrType, ".tenant_id", typ_kwargs={"flags": {"required": True}}) + + endpoints = _builder.get(".properties.workload{type:AgentFabricSandbox}.endpoints") + if endpoints is not None: + endpoints.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.workload{type:AgentFabricSandbox}.endpoints[]") + if _elements is not None: + _elements.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("port", AAZIntType, ".port", typ_kwargs={"flags": {"required": True}}) + + image = _builder.get(".properties.workload{type:AgentFabricSandbox}.image") + if image is not None: + image.set_prop("digest", AAZStrType, ".digest") + image.set_prop("pullPolicy", AAZStrType, ".pull_policy") + image.set_prop("uri", AAZStrType, ".uri", typ_kwargs={"flags": {"required": True}}) + + resources = _builder.get(".properties.workload{type:AgentFabricSandbox}.resources") + if resources is not None: + resources.set_prop("cpu", AAZStrType, ".cpu", typ_kwargs={"flags": {"required": True}}) + resources.set_prop("disk", AAZStrType, ".disk") + resources.set_prop("memory", AAZStrType, ".memory", typ_kwargs={"flags": {"required": True}}) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType() + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.spiffe_id = AAZStrType( + serialized_name="spiffeId", + flags={"read_only": True}, + ) + properties.workload = AAZObjectType() + + workload = cls._schema_on_200_201.properties.workload + workload.type = AAZStrType( + flags={"required": True}, + ) + workload.workload_id = AAZStrType( + serialized_name="workloadId", + flags={"read_only": True}, + ) + + disc_aci = cls._schema_on_200_201.properties.workload.discriminate_by("type", "ACI") + disc_aci.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"required": True}, + ) + + disc_agent_fabric_sandbox = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox") + disc_agent_fabric_sandbox.agent_identity = AAZObjectType( + serialized_name="agentIdentity", + ) + disc_agent_fabric_sandbox.domain = AAZStrType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.endpoints = AAZListType() + disc_agent_fabric_sandbox.image = AAZObjectType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.resources = AAZObjectType( + flags={"required": True}, + ) + + agent_identity = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox").agent_identity + agent_identity.agent_id = AAZStrType( + serialized_name="agentId", + flags={"required": True}, + ) + agent_identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"required": True}, + ) + + endpoints = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints.Element + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.port = AAZIntType( + flags={"required": True}, + ) + + image = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox").image + image.digest = AAZStrType() + image.pull_policy = AAZStrType( + serialized_name="pullPolicy", + ) + image.uri = AAZStrType( + flags={"required": True}, + ) + + resources = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox").resources + resources.cpu = AAZStrType( + flags={"required": True}, + ) + resources.disk = AAZStrType() + resources.memory = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_delete.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_delete.py new file mode 100644 index 00000000000..49302597e98 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_delete.py @@ -0,0 +1,179 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentmesh fabric member delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete a member from an Agent Mesh fabric + + :example: Members_Delete + az agentmesh fabric member delete --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name testMember + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.member_name = AAZStrArg( + options=["--member-name"], + help="The name of the Member", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.MembersDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class MembersDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/members/{memberName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "memberName", self.ctx.args.member_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + def on_204(self, session): + pass + + def on_200_201(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_list.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_list.py new file mode 100644 index 00000000000..7839c3a8345 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_list.py @@ -0,0 +1,300 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentmesh fabric member list", +) +class List(AAZCommand): + """List members in an Agent Mesh fabric + + :example: Members_ListByParent + az agentmesh fabric member list --resource-group rgnetworksecurity --fabric-name testAIFabric + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="The name of the AgentFabric", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MembersListByParent(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class MembersListByParent(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/members", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.spiffe_id = AAZStrType( + serialized_name="spiffeId", + flags={"read_only": True}, + ) + properties.workload = AAZObjectType() + + workload = cls._schema_on_200.value.Element.properties.workload + workload.type = AAZStrType( + flags={"required": True}, + ) + workload.workload_id = AAZStrType( + serialized_name="workloadId", + flags={"read_only": True}, + ) + + disc_aci = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "ACI") + disc_aci.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"required": True}, + ) + + disc_agent_fabric_sandbox = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox") + disc_agent_fabric_sandbox.agent_identity = AAZObjectType( + serialized_name="agentIdentity", + ) + disc_agent_fabric_sandbox.domain = AAZStrType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.endpoints = AAZListType() + disc_agent_fabric_sandbox.image = AAZObjectType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.resources = AAZObjectType( + flags={"required": True}, + ) + + agent_identity = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox").agent_identity + agent_identity.agent_id = AAZStrType( + serialized_name="agentId", + flags={"required": True}, + ) + agent_identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"required": True}, + ) + + endpoints = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints.Element + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.port = AAZIntType( + flags={"required": True}, + ) + + image = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox").image + image.digest = AAZStrType() + image.pull_policy = AAZStrType( + serialized_name="pullPolicy", + ) + image.uri = AAZStrType( + flags={"required": True}, + ) + + resources = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox").resources + resources.cpu = AAZStrType( + flags={"required": True}, + ) + resources.disk = AAZStrType() + resources.memory = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_show.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_show.py new file mode 100644 index 00000000000..b8be0d21474 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_show.py @@ -0,0 +1,301 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentmesh fabric member show", +) +class Show(AAZCommand): + """Get a member in an Agent Mesh fabric + + :example: Members_Get + az agentmesh fabric member show --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name testMember + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.member_name = AAZStrArg( + options=["--member-name"], + help="The name of the Member", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MembersGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class MembersGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/members/{memberName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "memberName", self.ctx.args.member_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.spiffe_id = AAZStrType( + serialized_name="spiffeId", + flags={"read_only": True}, + ) + properties.workload = AAZObjectType() + + workload = cls._schema_on_200.properties.workload + workload.type = AAZStrType( + flags={"required": True}, + ) + workload.workload_id = AAZStrType( + serialized_name="workloadId", + flags={"read_only": True}, + ) + + disc_aci = cls._schema_on_200.properties.workload.discriminate_by("type", "ACI") + disc_aci.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"required": True}, + ) + + disc_agent_fabric_sandbox = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox") + disc_agent_fabric_sandbox.agent_identity = AAZObjectType( + serialized_name="agentIdentity", + ) + disc_agent_fabric_sandbox.domain = AAZStrType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.endpoints = AAZListType() + disc_agent_fabric_sandbox.image = AAZObjectType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.resources = AAZObjectType( + flags={"required": True}, + ) + + agent_identity = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").agent_identity + agent_identity.agent_id = AAZStrType( + serialized_name="agentId", + flags={"required": True}, + ) + agent_identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"required": True}, + ) + + endpoints = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints.Element + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.port = AAZIntType( + flags={"required": True}, + ) + + image = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").image + image.digest = AAZStrType() + image.pull_policy = AAZStrType( + serialized_name="pullPolicy", + ) + image.uri = AAZStrType( + flags={"required": True}, + ) + + resources = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").resources + resources.cpu = AAZStrType( + flags={"required": True}, + ) + resources.disk = AAZStrType() + resources.memory = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_update.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_update.py new file mode 100644 index 00000000000..ca7deac0548 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_update.py @@ -0,0 +1,348 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentmesh fabric member update", +) +class Update(AAZCommand): + """Update an Agent Mesh fabric member's tags + + :example: Members_Update + az agentmesh fabric member update --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name testMember --tags "{environment:production}" + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.member_name = AAZStrArg( + options=["--member-name"], + help="The name of the Member", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Properties", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.MembersUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class MembersUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/members/{memberName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "memberName", self.ctx.args.member_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("tags", AAZDictType, ".tags") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.spiffe_id = AAZStrType( + serialized_name="spiffeId", + flags={"read_only": True}, + ) + properties.workload = AAZObjectType() + + workload = cls._schema_on_200.properties.workload + workload.type = AAZStrType( + flags={"required": True}, + ) + workload.workload_id = AAZStrType( + serialized_name="workloadId", + flags={"read_only": True}, + ) + + disc_aci = cls._schema_on_200.properties.workload.discriminate_by("type", "ACI") + disc_aci.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"required": True}, + ) + + disc_agent_fabric_sandbox = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox") + disc_agent_fabric_sandbox.agent_identity = AAZObjectType( + serialized_name="agentIdentity", + ) + disc_agent_fabric_sandbox.domain = AAZStrType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.endpoints = AAZListType() + disc_agent_fabric_sandbox.image = AAZObjectType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.resources = AAZObjectType( + flags={"required": True}, + ) + + agent_identity = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").agent_identity + agent_identity.agent_id = AAZStrType( + serialized_name="agentId", + flags={"required": True}, + ) + agent_identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"required": True}, + ) + + endpoints = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints.Element + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.port = AAZIntType( + flags={"required": True}, + ) + + image = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").image + image.digest = AAZStrType() + image.pull_policy = AAZStrType( + serialized_name="pullPolicy", + ) + image.uri = AAZStrType( + flags={"required": True}, + ) + + resources = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").resources + resources.cpu = AAZStrType( + flags={"required": True}, + ) + resources.disk = AAZStrType() + resources.memory = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + +__all__ = ["Update"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_wait.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_wait.py new file mode 100644 index 00000000000..21cb09dd8a0 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_wait.py @@ -0,0 +1,297 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentmesh fabric member wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.member_name = AAZStrArg( + options=["--member-name"], + help="The name of the Member", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MembersGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class MembersGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/members/{memberName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "memberName", self.ctx.args.member_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.spiffe_id = AAZStrType( + serialized_name="spiffeId", + flags={"read_only": True}, + ) + properties.workload = AAZObjectType() + + workload = cls._schema_on_200.properties.workload + workload.type = AAZStrType( + flags={"required": True}, + ) + workload.workload_id = AAZStrType( + serialized_name="workloadId", + flags={"read_only": True}, + ) + + disc_aci = cls._schema_on_200.properties.workload.discriminate_by("type", "ACI") + disc_aci.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"required": True}, + ) + + disc_agent_fabric_sandbox = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox") + disc_agent_fabric_sandbox.agent_identity = AAZObjectType( + serialized_name="agentIdentity", + ) + disc_agent_fabric_sandbox.domain = AAZStrType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.endpoints = AAZListType() + disc_agent_fabric_sandbox.image = AAZObjectType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox.resources = AAZObjectType( + flags={"required": True}, + ) + + agent_identity = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").agent_identity + agent_identity.agent_id = AAZStrType( + serialized_name="agentId", + flags={"required": True}, + ) + agent_identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"required": True}, + ) + + endpoints = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints.Element + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.port = AAZIntType( + flags={"required": True}, + ) + + image = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").image + image.digest = AAZStrType() + image.pull_policy = AAZStrType( + serialized_name="pullPolicy", + ) + image.uri = AAZStrType( + flags={"required": True}, + ) + + resources = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").resources + resources.cpu = AAZStrType( + flags={"required": True}, + ) + resources.disk = AAZStrType() + resources.memory = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/__cmd_group.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/__cmd_group.py new file mode 100644 index 00000000000..81a3e9225f8 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/__cmd_group.py @@ -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( + "agentmesh policy-group", +) +class __CMDGroup(AAZCommandGroup): + """Manage Agent Mesh policy groups. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/__init__.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/__init__.py @@ -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 * diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_create.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_create.py new file mode 100644 index 00000000000..0a5eb2bfbdb --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_create.py @@ -0,0 +1,1332 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentmesh policy-group create", +) +class Create(AAZCommand): + """Create an Agent Mesh policy group + + :example: PolicyGroups_CreateOrUpdate + az agentmesh policy-group create --resource-group rgnetworksecurity --name testPolicyGroup --location eastus --tags "{env:test}" --display-name "Test Policy Group" --description "A policy group for testing" --priority 100 --network-security-policies "[{fqdn-filtering:{name:allowOutbound,priority:10,direction:Outbound,ports:[443,80],source:{workload-id-patterns:{patterns:[workload1,workload2]}},destination:{fqdns:{fqdns:[example.com,contoso.com]}}}}]" + + :example: PolicyGroups_CreateOrUpdate_ContentInspection + az agentmesh policy-group create --resource-group rgnetworksecurity --name contentInspectionGroup --location eastus --tags "{env:test}" --display-name "Content Inspection Policy Group" --description "A policy group demonstrating content inspection policies" --priority 100 --network-security-policies "[{content-inspection:{source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},prompt-injection-protection:{sensitivity:High,prompt-locations:['$.messages[*].content','$.input'],response-locations:['$.choices[*].message.content'],on-detection:BlockAndAlert}}}]" + + :example: PolicyGroups_CreateOrUpdate_Mcp + az agentmesh policy-group create --resource-group rgnetworksecurity --name mcpPolicyGroup --location eastus --tags "{env:test}" --display-name "MCP Policy Group" --description "A policy group demonstrating MCP server policies" --priority 100 --network-security-policies "[{mcp:{default-action:Deny,source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},destination:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/mcp/sa/*']}},rules:[{action:Allow,tools:[search,fetch]},{action:Deny,tools:[deleteFile]}]}},{mcp:{default-action:Allow,source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},destination:{fqdns:{fqdns:[mcp.contoso.com]}},rules:[{action:Deny,tools:[executeShell,writeFile]}]}},{mcp:{default-action:Deny,source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},destination:{address-prefixes:{prefixes:[10.0.0.0/24]}},rules:[{action:Allow,tools:[listResources,readResource]}]}}]" + + :example: PolicyGroups_CreateOrUpdate_TlsInspection + az agentmesh policy-group create --resource-group rgnetworksecurity --name tlsInspectionPolicyGroup --location eastus --tags "{env:test}" --display-name "TLS Inspection Policy Group" --description "A policy group demonstrating TLS inspection policies" --priority 100 --network-security-policies "[{tls-inspection:{source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},certificate:{azure-managed-ca:{}}}}]" + + :example: PolicyGroups_CreateOrUpdate_UrlFiltering + az agentmesh policy-group create --resource-group rgnetworksecurity --name urlFilteringPolicyGroup --location eastus --tags "{env:test}" --display-name "URL Filtering Policy Group" --description "A policy group demonstrating URL filtering" --priority 100 --network-security-policies "[{url-filtering:{default-action:Deny,source:{address-prefixes:{prefixes:[10.0.0.0/24]}},destination:{fqdns:{fqdns:[api.contoso.com]}},rules:[{name:allowProductApi,priority:10,hostname:api.contoso.com,method:GET,paths:['/v1/products','/v1/products/*'],action:Allow},{name:denyAdmin,priority:20,paths:['/admin/*'],action:Deny}]}}]" + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the PolicyGroup", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="The description of the policy group.", + ) + _args_schema.display_name = AAZStrArg( + options=["--display-name"], + arg_group="Properties", + help="The display name of the policy group.", + ) + _args_schema.network_security_policies = AAZListArg( + options=["--network-security-policies"], + arg_group="Properties", + help="The list of network security policies.", + ) + _args_schema.priority = AAZIntArg( + options=["--priority"], + arg_group="Properties", + help="The priority of the policy group.", + ) + + network_security_policies = cls._args_schema.network_security_policies + network_security_policies.Element = AAZObjectArg() + + _element = cls._args_schema.network_security_policies.Element + _element.content_inspection = AAZObjectArg( + options=["content-inspection"], + ) + _element.fqdn_filtering = AAZObjectArg( + options=["fqdn-filtering"], + ) + _element.mcp = AAZObjectArg( + options=["mcp"], + ) + _element.tls_inspection = AAZObjectArg( + options=["tls-inspection"], + ) + _element.url_filtering = AAZObjectArg( + options=["url-filtering"], + ) + + content_inspection = cls._args_schema.network_security_policies.Element.content_inspection + content_inspection.prompt_injection_protection = AAZObjectArg( + options=["prompt-injection-protection"], + help="The prompt injection protection configuration.", + ) + content_inspection.source = AAZObjectArg( + options=["source"], + help="The source details for the policy.", + required=True, + ) + + prompt_injection_protection = cls._args_schema.network_security_policies.Element.content_inspection.prompt_injection_protection + prompt_injection_protection.on_detection = AAZStrArg( + options=["on-detection"], + help="The action to take when prompt injection is detected.", + required=True, + enum={"Alert": "Alert", "BlockAndAlert": "BlockAndAlert", "Sanitize": "Sanitize"}, + ) + prompt_injection_protection.prompt_locations = AAZListArg( + options=["prompt-locations"], + help="The JSONPath expressions selecting the parts of the request body to scan for prompt injection.", + ) + prompt_injection_protection.response_locations = AAZListArg( + options=["response-locations"], + help="The JSONPath expressions selecting the parts of the response body to scan for prompt injection.", + ) + prompt_injection_protection.sensitivity = AAZStrArg( + options=["sensitivity"], + help="The sensitivity level of prompt injection detection.", + enum={"High": "High", "Low": "Low", "Medium": "Medium"}, + ) + + prompt_locations = cls._args_schema.network_security_policies.Element.content_inspection.prompt_injection_protection.prompt_locations + prompt_locations.Element = AAZStrArg() + + response_locations = cls._args_schema.network_security_policies.Element.content_inspection.prompt_injection_protection.response_locations + response_locations.Element = AAZStrArg() + + source = cls._args_schema.network_security_policies.Element.content_inspection.source + source.address_prefixes = AAZObjectArg( + options=["address-prefixes"], + ) + source.workload_id_patterns = AAZObjectArg( + options=["workload-id-patterns"], + ) + + address_prefixes = cls._args_schema.network_security_policies.Element.content_inspection.source.address_prefixes + address_prefixes.prefixes = AAZListArg( + options=["prefixes"], + help="The IP address prefixes, in CIDR notation, that identify the source(s).", + required=True, + ) + + prefixes = cls._args_schema.network_security_policies.Element.content_inspection.source.address_prefixes.prefixes + prefixes.Element = AAZStrArg() + + workload_id_patterns = cls._args_schema.network_security_policies.Element.content_inspection.source.workload_id_patterns + workload_id_patterns.patterns = AAZListArg( + options=["patterns"], + help="The workload ID patterns that identify the source(s).", + required=True, + ) + + patterns = cls._args_schema.network_security_policies.Element.content_inspection.source.workload_id_patterns.patterns + patterns.Element = AAZStrArg() + + fqdn_filtering = cls._args_schema.network_security_policies.Element.fqdn_filtering + fqdn_filtering.destination = AAZObjectArg( + options=["destination"], + help="The destination details for the policy.", + ) + fqdn_filtering.direction = AAZStrArg( + options=["direction"], + help="The direction of traffic for the policy.", + enum={"Both": "Both", "Inbound": "Inbound", "Outbound": "Outbound"}, + ) + fqdn_filtering.name = AAZStrArg( + options=["name"], + help="The name of the policy.", + ) + fqdn_filtering.ports = AAZListArg( + options=["ports"], + help="The ports for the policy.", + ) + fqdn_filtering.priority = AAZIntArg( + options=["priority"], + help="The priority of the policy.", + ) + fqdn_filtering.source = AAZObjectArg( + options=["source"], + help="The source details for the policy.", + required=True, + ) + + destination = cls._args_schema.network_security_policies.Element.fqdn_filtering.destination + destination.fqdns = AAZObjectArg( + options=["fqdns"], + ) + + fqdns = cls._args_schema.network_security_policies.Element.fqdn_filtering.destination.fqdns + fqdns.fqdns = AAZListArg( + options=["fqdns"], + help="The fully qualified domain names that identify the destination(s).", + required=True, + ) + + fqdns = cls._args_schema.network_security_policies.Element.fqdn_filtering.destination.fqdns.fqdns + fqdns.Element = AAZStrArg() + + ports = cls._args_schema.network_security_policies.Element.fqdn_filtering.ports + ports.Element = AAZIntArg() + + source = cls._args_schema.network_security_policies.Element.fqdn_filtering.source + source.address_prefixes = AAZObjectArg( + options=["address-prefixes"], + ) + source.workload_id_patterns = AAZObjectArg( + options=["workload-id-patterns"], + ) + + address_prefixes = cls._args_schema.network_security_policies.Element.fqdn_filtering.source.address_prefixes + address_prefixes.prefixes = AAZListArg( + options=["prefixes"], + help="The IP address prefixes, in CIDR notation, that identify the source(s).", + required=True, + ) + + prefixes = cls._args_schema.network_security_policies.Element.fqdn_filtering.source.address_prefixes.prefixes + prefixes.Element = AAZStrArg() + + workload_id_patterns = cls._args_schema.network_security_policies.Element.fqdn_filtering.source.workload_id_patterns + workload_id_patterns.patterns = AAZListArg( + options=["patterns"], + help="The workload ID patterns that identify the source(s).", + required=True, + ) + + patterns = cls._args_schema.network_security_policies.Element.fqdn_filtering.source.workload_id_patterns.patterns + patterns.Element = AAZStrArg() + + mcp = cls._args_schema.network_security_policies.Element.mcp + mcp.default_action = AAZStrArg( + options=["default-action"], + help="The default action to take when no rule in the policy matches.", + required=True, + enum={"Allow": "Allow", "Deny": "Deny"}, + ) + mcp.destination = AAZObjectArg( + options=["destination"], + help="The MCP server(s) that this policy applies to.", + required=True, + ) + mcp.rules = AAZListArg( + options=["rules"], + help="The list of MCP rules.", + required=True, + ) + mcp.source = AAZObjectArg( + options=["source"], + help="The source(s) that this policy applies to.", + required=True, + ) + + destination = cls._args_schema.network_security_policies.Element.mcp.destination + destination.address_prefixes = AAZObjectArg( + options=["address-prefixes"], + ) + destination.fqdns = AAZObjectArg( + options=["fqdns"], + ) + destination.workload_id_patterns = AAZObjectArg( + options=["workload-id-patterns"], + ) + + address_prefixes = cls._args_schema.network_security_policies.Element.mcp.destination.address_prefixes + address_prefixes.prefixes = AAZListArg( + options=["prefixes"], + help="The IP address prefixes, in CIDR notation, that identify the destination(s).", + required=True, + ) + + prefixes = cls._args_schema.network_security_policies.Element.mcp.destination.address_prefixes.prefixes + prefixes.Element = AAZStrArg() + + fqdns = cls._args_schema.network_security_policies.Element.mcp.destination.fqdns + fqdns.fqdns = AAZListArg( + options=["fqdns"], + help="The fully qualified domain names that identify the destination(s).", + required=True, + ) + + fqdns = cls._args_schema.network_security_policies.Element.mcp.destination.fqdns.fqdns + fqdns.Element = AAZStrArg() + + workload_id_patterns = cls._args_schema.network_security_policies.Element.mcp.destination.workload_id_patterns + workload_id_patterns.patterns = AAZListArg( + options=["patterns"], + help="The workload ID patterns that identify the destination(s).", + required=True, + ) + + patterns = cls._args_schema.network_security_policies.Element.mcp.destination.workload_id_patterns.patterns + patterns.Element = AAZStrArg() + + rules = cls._args_schema.network_security_policies.Element.mcp.rules + rules.Element = AAZObjectArg() + + _element = cls._args_schema.network_security_policies.Element.mcp.rules.Element + _element.action = AAZStrArg( + options=["action"], + help="The action to take for the specified MCP tools.", + required=True, + enum={"Allow": "Allow", "Deny": "Deny"}, + ) + _element.tools = AAZListArg( + options=["tools"], + help="The MCP tool names that the rule applies to.", + required=True, + ) + + tools = cls._args_schema.network_security_policies.Element.mcp.rules.Element.tools + tools.Element = AAZStrArg() + + source = cls._args_schema.network_security_policies.Element.mcp.source + source.address_prefixes = AAZObjectArg( + options=["address-prefixes"], + ) + source.workload_id_patterns = AAZObjectArg( + options=["workload-id-patterns"], + ) + + address_prefixes = cls._args_schema.network_security_policies.Element.mcp.source.address_prefixes + address_prefixes.prefixes = AAZListArg( + options=["prefixes"], + help="The IP address prefixes, in CIDR notation, that identify the source(s).", + required=True, + ) + + prefixes = cls._args_schema.network_security_policies.Element.mcp.source.address_prefixes.prefixes + prefixes.Element = AAZStrArg() + + workload_id_patterns = cls._args_schema.network_security_policies.Element.mcp.source.workload_id_patterns + workload_id_patterns.patterns = AAZListArg( + options=["patterns"], + help="The workload ID patterns that identify the source(s).", + required=True, + ) + + patterns = cls._args_schema.network_security_policies.Element.mcp.source.workload_id_patterns.patterns + patterns.Element = AAZStrArg() + + tls_inspection = cls._args_schema.network_security_policies.Element.tls_inspection + tls_inspection.certificate = AAZObjectArg( + options=["certificate"], + help="The certificate configuration used for TLS inspection.", + required=True, + ) + tls_inspection.source = AAZObjectArg( + options=["source"], + help="The source details for the policy.", + required=True, + ) + + certificate = cls._args_schema.network_security_policies.Element.tls_inspection.certificate + certificate.azure_managed_ca = AAZObjectArg( + options=["azure-managed-ca"], + blank={}, + ) + + source = cls._args_schema.network_security_policies.Element.tls_inspection.source + source.workload_id_patterns = AAZObjectArg( + options=["workload-id-patterns"], + ) + + workload_id_patterns = cls._args_schema.network_security_policies.Element.tls_inspection.source.workload_id_patterns + workload_id_patterns.patterns = AAZListArg( + options=["patterns"], + help="The workload ID patterns that identify the source(s).", + required=True, + ) + + patterns = cls._args_schema.network_security_policies.Element.tls_inspection.source.workload_id_patterns.patterns + patterns.Element = AAZStrArg() + + url_filtering = cls._args_schema.network_security_policies.Element.url_filtering + url_filtering.default_action = AAZStrArg( + options=["default-action"], + help="The default action to take when no rule in the policy matches.", + required=True, + enum={"Allow": "Allow", "Deny": "Deny"}, + ) + url_filtering.destination = AAZObjectArg( + options=["destination"], + help="The destination details for the policy.", + ) + url_filtering.rules = AAZListArg( + options=["rules"], + help="The list of URL filtering rules.", + required=True, + ) + url_filtering.source = AAZObjectArg( + options=["source"], + help="The source details for the policy.", + required=True, + ) + + destination = cls._args_schema.network_security_policies.Element.url_filtering.destination + destination.address_prefixes = AAZObjectArg( + options=["address-prefixes"], + ) + destination.fqdns = AAZObjectArg( + options=["fqdns"], + ) + destination.workload_id_patterns = AAZObjectArg( + options=["workload-id-patterns"], + ) + + address_prefixes = cls._args_schema.network_security_policies.Element.url_filtering.destination.address_prefixes + address_prefixes.prefixes = AAZListArg( + options=["prefixes"], + help="The IP address prefixes, in CIDR notation, that identify the destination(s).", + required=True, + ) + + prefixes = cls._args_schema.network_security_policies.Element.url_filtering.destination.address_prefixes.prefixes + prefixes.Element = AAZStrArg() + + fqdns = cls._args_schema.network_security_policies.Element.url_filtering.destination.fqdns + fqdns.fqdns = AAZListArg( + options=["fqdns"], + help="The fully qualified domain names that identify the destination(s).", + required=True, + ) + + fqdns = cls._args_schema.network_security_policies.Element.url_filtering.destination.fqdns.fqdns + fqdns.Element = AAZStrArg() + + workload_id_patterns = cls._args_schema.network_security_policies.Element.url_filtering.destination.workload_id_patterns + workload_id_patterns.patterns = AAZListArg( + options=["patterns"], + help="The workload ID patterns that identify the destination(s).", + required=True, + ) + + patterns = cls._args_schema.network_security_policies.Element.url_filtering.destination.workload_id_patterns.patterns + patterns.Element = AAZStrArg() + + rules = cls._args_schema.network_security_policies.Element.url_filtering.rules + rules.Element = AAZObjectArg() + + _element = cls._args_schema.network_security_policies.Element.url_filtering.rules.Element + _element.action = AAZStrArg( + options=["action"], + help="The action to take when the rule matches.", + required=True, + enum={"Allow": "Allow", "Deny": "Deny"}, + ) + _element.hostname = AAZStrArg( + options=["hostname"], + help="The hostname matched by the rule. If omitted, the rule matches any hostname.", + ) + _element.method = AAZStrArg( + options=["method"], + help="The HTTP method matched by the rule. If omitted, the rule matches any method.", + enum={"DELETE": "DELETE", "GET": "GET", "HEAD": "HEAD", "OPTIONS": "OPTIONS", "PATCH": "PATCH", "POST": "POST", "PUT": "PUT"}, + ) + _element.name = AAZStrArg( + options=["name"], + help="The name of the rule.", + required=True, + ) + _element.paths = AAZListArg( + options=["paths"], + help="The URL paths matched by the rule. If omitted, the rule matches any path.", + ) + _element.priority = AAZIntArg( + options=["priority"], + help="The priority of the rule. Rules are evaluated in ascending priority order.", + required=True, + ) + + paths = cls._args_schema.network_security_policies.Element.url_filtering.rules.Element.paths + paths.Element = AAZStrArg() + + source = cls._args_schema.network_security_policies.Element.url_filtering.source + source.address_prefixes = AAZObjectArg( + options=["address-prefixes"], + ) + source.workload_id_patterns = AAZObjectArg( + options=["workload-id-patterns"], + ) + + address_prefixes = cls._args_schema.network_security_policies.Element.url_filtering.source.address_prefixes + address_prefixes.prefixes = AAZListArg( + options=["prefixes"], + help="The IP address prefixes, in CIDR notation, that identify the source(s).", + required=True, + ) + + prefixes = cls._args_schema.network_security_policies.Element.url_filtering.source.address_prefixes.prefixes + prefixes.Element = AAZStrArg() + + workload_id_patterns = cls._args_schema.network_security_policies.Element.url_filtering.source.workload_id_patterns + workload_id_patterns.patterns = AAZListArg( + options=["patterns"], + help="The workload ID patterns that identify the source(s).", + required=True, + ) + + patterns = cls._args_schema.network_security_policies.Element.url_filtering.source.workload_id_patterns.patterns + patterns.Element = AAZStrArg() + + # define Arg Group "Resource" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Resource", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Resource", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.PolicyGroupsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class PolicyGroupsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "policyGroupName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("displayName", AAZStrType, ".display_name") + properties.set_prop("networkSecurityPolicies", AAZListType, ".network_security_policies") + properties.set_prop("priority", AAZIntType, ".priority") + + network_security_policies = _builder.get(".properties.networkSecurityPolicies") + if network_security_policies is not None: + network_security_policies.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.networkSecurityPolicies[]") + if _elements is not None: + _elements.set_const("type", "ContentInspection", AAZStrType, ".content_inspection", typ_kwargs={"flags": {"required": True}}) + _elements.set_const("type", "FqdnFiltering", AAZStrType, ".fqdn_filtering", typ_kwargs={"flags": {"required": True}}) + _elements.set_const("type", "Mcp", AAZStrType, ".mcp", typ_kwargs={"flags": {"required": True}}) + _elements.set_const("type", "TlsInspection", AAZStrType, ".tls_inspection", typ_kwargs={"flags": {"required": True}}) + _elements.set_const("type", "UrlFiltering", AAZStrType, ".url_filtering", typ_kwargs={"flags": {"required": True}}) + _elements.discriminate_by("type", "ContentInspection") + _elements.discriminate_by("type", "FqdnFiltering") + _elements.discriminate_by("type", "Mcp") + _elements.discriminate_by("type", "TlsInspection") + _elements.discriminate_by("type", "UrlFiltering") + + disc_content_inspection = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}") + if disc_content_inspection is not None: + disc_content_inspection.set_prop("promptInjectionProtection", AAZObjectType, ".content_inspection.prompt_injection_protection") + disc_content_inspection.set_prop("source", AAZObjectType, ".content_inspection.source", typ_kwargs={"flags": {"required": True}}) + + prompt_injection_protection = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.promptInjectionProtection") + if prompt_injection_protection is not None: + prompt_injection_protection.set_prop("onDetection", AAZStrType, ".on_detection", typ_kwargs={"flags": {"required": True}}) + prompt_injection_protection.set_prop("promptLocations", AAZListType, ".prompt_locations") + prompt_injection_protection.set_prop("responseLocations", AAZListType, ".response_locations") + prompt_injection_protection.set_prop("sensitivity", AAZStrType, ".sensitivity") + + prompt_locations = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.promptInjectionProtection.promptLocations") + if prompt_locations is not None: + prompt_locations.set_elements(AAZStrType, ".") + + response_locations = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.promptInjectionProtection.responseLocations") + if response_locations is not None: + response_locations.set_elements(AAZStrType, ".") + + source = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.source") + if source is not None: + source.set_const("type", "AddressPrefixes", AAZStrType, ".address_prefixes", typ_kwargs={"flags": {"required": True}}) + source.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) + source.discriminate_by("type", "AddressPrefixes") + source.discriminate_by("type", "WorkloadIdPatterns") + + disc_address_prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.source{type:AddressPrefixes}") + if disc_address_prefixes is not None: + disc_address_prefixes.set_prop("prefixes", AAZListType, ".address_prefixes.prefixes", typ_kwargs={"flags": {"required": True}}) + + prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.source{type:AddressPrefixes}.prefixes") + if prefixes is not None: + prefixes.set_elements(AAZStrType, ".") + + disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.source{type:WorkloadIdPatterns}") + if disc_workload_id_patterns is not None: + disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) + + patterns = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.source{type:WorkloadIdPatterns}.patterns") + if patterns is not None: + patterns.set_elements(AAZStrType, ".") + + disc_fqdn_filtering = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}") + if disc_fqdn_filtering is not None: + disc_fqdn_filtering.set_prop("destination", AAZObjectType, ".fqdn_filtering.destination") + disc_fqdn_filtering.set_prop("direction", AAZStrType, ".fqdn_filtering.direction") + disc_fqdn_filtering.set_prop("name", AAZStrType, ".fqdn_filtering.name") + disc_fqdn_filtering.set_prop("ports", AAZListType, ".fqdn_filtering.ports") + disc_fqdn_filtering.set_prop("priority", AAZIntType, ".fqdn_filtering.priority") + disc_fqdn_filtering.set_prop("source", AAZObjectType, ".fqdn_filtering.source", typ_kwargs={"flags": {"required": True}}) + + destination = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.destination") + if destination is not None: + destination.set_const("type", "Fqdns", AAZStrType, ".fqdns", typ_kwargs={"flags": {"required": True}}) + destination.discriminate_by("type", "Fqdns") + + disc_fqdns = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.destination{type:Fqdns}") + if disc_fqdns is not None: + disc_fqdns.set_prop("fqdns", AAZListType, ".fqdns.fqdns", typ_kwargs={"flags": {"required": True}}) + + fqdns = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.destination{type:Fqdns}.fqdns") + if fqdns is not None: + fqdns.set_elements(AAZStrType, ".") + + ports = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.ports") + if ports is not None: + ports.set_elements(AAZIntType, ".") + + source = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.source") + if source is not None: + source.set_const("type", "AddressPrefixes", AAZStrType, ".address_prefixes", typ_kwargs={"flags": {"required": True}}) + source.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) + source.discriminate_by("type", "AddressPrefixes") + source.discriminate_by("type", "WorkloadIdPatterns") + + disc_address_prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.source{type:AddressPrefixes}") + if disc_address_prefixes is not None: + disc_address_prefixes.set_prop("prefixes", AAZListType, ".address_prefixes.prefixes", typ_kwargs={"flags": {"required": True}}) + + prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.source{type:AddressPrefixes}.prefixes") + if prefixes is not None: + prefixes.set_elements(AAZStrType, ".") + + disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.source{type:WorkloadIdPatterns}") + if disc_workload_id_patterns is not None: + disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) + + patterns = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.source{type:WorkloadIdPatterns}.patterns") + if patterns is not None: + patterns.set_elements(AAZStrType, ".") + + disc_mcp = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}") + if disc_mcp is not None: + disc_mcp.set_prop("defaultAction", AAZStrType, ".mcp.default_action", typ_kwargs={"flags": {"required": True}}) + disc_mcp.set_prop("destination", AAZObjectType, ".mcp.destination", typ_kwargs={"flags": {"required": True}}) + disc_mcp.set_prop("rules", AAZListType, ".mcp.rules", typ_kwargs={"flags": {"required": True}}) + disc_mcp.set_prop("source", AAZObjectType, ".mcp.source", typ_kwargs={"flags": {"required": True}}) + + destination = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination") + if destination is not None: + destination.set_const("type", "AddressPrefixes", AAZStrType, ".address_prefixes", typ_kwargs={"flags": {"required": True}}) + destination.set_const("type", "Fqdns", AAZStrType, ".fqdns", typ_kwargs={"flags": {"required": True}}) + destination.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) + destination.discriminate_by("type", "AddressPrefixes") + destination.discriminate_by("type", "Fqdns") + destination.discriminate_by("type", "WorkloadIdPatterns") + + disc_address_prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination{type:AddressPrefixes}") + if disc_address_prefixes is not None: + disc_address_prefixes.set_prop("prefixes", AAZListType, ".address_prefixes.prefixes", typ_kwargs={"flags": {"required": True}}) + + prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination{type:AddressPrefixes}.prefixes") + if prefixes is not None: + prefixes.set_elements(AAZStrType, ".") + + disc_fqdns = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination{type:Fqdns}") + if disc_fqdns is not None: + disc_fqdns.set_prop("fqdns", AAZListType, ".fqdns.fqdns", typ_kwargs={"flags": {"required": True}}) + + fqdns = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination{type:Fqdns}.fqdns") + if fqdns is not None: + fqdns.set_elements(AAZStrType, ".") + + disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination{type:WorkloadIdPatterns}") + if disc_workload_id_patterns is not None: + disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) + + patterns = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination{type:WorkloadIdPatterns}.patterns") + if patterns is not None: + patterns.set_elements(AAZStrType, ".") + + rules = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.rules") + if rules is not None: + rules.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.rules[]") + if _elements is not None: + _elements.set_prop("action", AAZStrType, ".action", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("tools", AAZListType, ".tools", typ_kwargs={"flags": {"required": True}}) + + tools = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.rules[].tools") + if tools is not None: + tools.set_elements(AAZStrType, ".") + + source = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.source") + if source is not None: + source.set_const("type", "AddressPrefixes", AAZStrType, ".address_prefixes", typ_kwargs={"flags": {"required": True}}) + source.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) + source.discriminate_by("type", "AddressPrefixes") + source.discriminate_by("type", "WorkloadIdPatterns") + + disc_address_prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.source{type:AddressPrefixes}") + if disc_address_prefixes is not None: + disc_address_prefixes.set_prop("prefixes", AAZListType, ".address_prefixes.prefixes", typ_kwargs={"flags": {"required": True}}) + + prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.source{type:AddressPrefixes}.prefixes") + if prefixes is not None: + prefixes.set_elements(AAZStrType, ".") + + disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.source{type:WorkloadIdPatterns}") + if disc_workload_id_patterns is not None: + disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) + + patterns = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.source{type:WorkloadIdPatterns}.patterns") + if patterns is not None: + patterns.set_elements(AAZStrType, ".") + + disc_tls_inspection = _builder.get(".properties.networkSecurityPolicies[]{type:TlsInspection}") + if disc_tls_inspection is not None: + disc_tls_inspection.set_prop("certificate", AAZObjectType, ".tls_inspection.certificate", typ_kwargs={"flags": {"required": True}}) + disc_tls_inspection.set_prop("source", AAZObjectType, ".tls_inspection.source", typ_kwargs={"flags": {"required": True}}) + + certificate = _builder.get(".properties.networkSecurityPolicies[]{type:TlsInspection}.certificate") + if certificate is not None: + certificate.set_const("mode", "AzureManagedCA", AAZStrType, ".azure_managed_ca", typ_kwargs={"flags": {"required": True}}) + certificate.discriminate_by("mode", "AzureManagedCA") + + source = _builder.get(".properties.networkSecurityPolicies[]{type:TlsInspection}.source") + if source is not None: + source.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) + source.discriminate_by("type", "WorkloadIdPatterns") + + disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:TlsInspection}.source{type:WorkloadIdPatterns}") + if disc_workload_id_patterns is not None: + disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) + + patterns = _builder.get(".properties.networkSecurityPolicies[]{type:TlsInspection}.source{type:WorkloadIdPatterns}.patterns") + if patterns is not None: + patterns.set_elements(AAZStrType, ".") + + disc_url_filtering = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}") + if disc_url_filtering is not None: + disc_url_filtering.set_prop("defaultAction", AAZStrType, ".url_filtering.default_action", typ_kwargs={"flags": {"required": True}}) + disc_url_filtering.set_prop("destination", AAZObjectType, ".url_filtering.destination") + disc_url_filtering.set_prop("rules", AAZListType, ".url_filtering.rules", typ_kwargs={"flags": {"required": True}}) + disc_url_filtering.set_prop("source", AAZObjectType, ".url_filtering.source", typ_kwargs={"flags": {"required": True}}) + + destination = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination") + if destination is not None: + destination.set_const("type", "AddressPrefixes", AAZStrType, ".address_prefixes", typ_kwargs={"flags": {"required": True}}) + destination.set_const("type", "Fqdns", AAZStrType, ".fqdns", typ_kwargs={"flags": {"required": True}}) + destination.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) + destination.discriminate_by("type", "AddressPrefixes") + destination.discriminate_by("type", "Fqdns") + destination.discriminate_by("type", "WorkloadIdPatterns") + + disc_address_prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination{type:AddressPrefixes}") + if disc_address_prefixes is not None: + disc_address_prefixes.set_prop("prefixes", AAZListType, ".address_prefixes.prefixes", typ_kwargs={"flags": {"required": True}}) + + prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination{type:AddressPrefixes}.prefixes") + if prefixes is not None: + prefixes.set_elements(AAZStrType, ".") + + disc_fqdns = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination{type:Fqdns}") + if disc_fqdns is not None: + disc_fqdns.set_prop("fqdns", AAZListType, ".fqdns.fqdns", typ_kwargs={"flags": {"required": True}}) + + fqdns = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination{type:Fqdns}.fqdns") + if fqdns is not None: + fqdns.set_elements(AAZStrType, ".") + + disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination{type:WorkloadIdPatterns}") + if disc_workload_id_patterns is not None: + disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) + + patterns = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination{type:WorkloadIdPatterns}.patterns") + if patterns is not None: + patterns.set_elements(AAZStrType, ".") + + rules = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.rules") + if rules is not None: + rules.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.rules[]") + if _elements is not None: + _elements.set_prop("action", AAZStrType, ".action", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("hostname", AAZStrType, ".hostname") + _elements.set_prop("method", AAZStrType, ".method") + _elements.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("paths", AAZListType, ".paths") + _elements.set_prop("priority", AAZIntType, ".priority", typ_kwargs={"flags": {"required": True}}) + + paths = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.rules[].paths") + if paths is not None: + paths.set_elements(AAZStrType, ".") + + source = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.source") + if source is not None: + source.set_const("type", "AddressPrefixes", AAZStrType, ".address_prefixes", typ_kwargs={"flags": {"required": True}}) + source.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) + source.discriminate_by("type", "AddressPrefixes") + source.discriminate_by("type", "WorkloadIdPatterns") + + disc_address_prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.source{type:AddressPrefixes}") + if disc_address_prefixes is not None: + disc_address_prefixes.set_prop("prefixes", AAZListType, ".address_prefixes.prefixes", typ_kwargs={"flags": {"required": True}}) + + prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.source{type:AddressPrefixes}.prefixes") + if prefixes is not None: + prefixes.set_elements(AAZStrType, ".") + + disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.source{type:WorkloadIdPatterns}") + if disc_workload_id_patterns is not None: + disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) + + patterns = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.source{type:WorkloadIdPatterns}.patterns") + if patterns is not None: + patterns.set_elements(AAZStrType, ".") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType() + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.description = AAZStrType() + properties.display_name = AAZStrType( + serialized_name="displayName", + ) + properties.network_security_policies = AAZListType( + serialized_name="networkSecurityPolicies", + ) + properties.priority = AAZIntType() + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + network_security_policies = cls._schema_on_200_201.properties.network_security_policies + network_security_policies.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.network_security_policies.Element + _element.type = AAZStrType( + flags={"required": True}, + ) + + disc_content_inspection = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection") + disc_content_inspection.prompt_injection_protection = AAZObjectType( + serialized_name="promptInjectionProtection", + ) + disc_content_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + prompt_injection_protection = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection + prompt_injection_protection.on_detection = AAZStrType( + serialized_name="onDetection", + flags={"required": True}, + ) + prompt_injection_protection.prompt_locations = AAZListType( + serialized_name="promptLocations", + ) + prompt_injection_protection.response_locations = AAZListType( + serialized_name="responseLocations", + ) + prompt_injection_protection.sensitivity = AAZStrType() + + prompt_locations = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.prompt_locations + prompt_locations.Element = AAZStrType() + + response_locations = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.response_locations + response_locations.Element = AAZStrType() + + source = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_fqdn_filtering = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering") + disc_fqdn_filtering.destination = AAZObjectType() + disc_fqdn_filtering.direction = AAZStrType() + disc_fqdn_filtering.name = AAZStrType() + disc_fqdn_filtering.ports = AAZListType() + disc_fqdn_filtering.priority = AAZIntType() + disc_fqdn_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_fqdns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + ports = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").ports + ports.Element = AAZIntType() + + source = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_mcp = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp") + disc_mcp.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_mcp.destination = AAZObjectType( + flags={"required": True}, + ) + disc_mcp.rules = AAZListType( + flags={"required": True}, + ) + disc_mcp.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.tools = AAZListType( + flags={"required": True}, + ) + + tools = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element.tools + tools.Element = AAZStrType() + + source = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_tls_inspection = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection") + disc_tls_inspection.certificate = AAZObjectType( + flags={"required": True}, + ) + disc_tls_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + certificate = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").certificate + certificate.mode = AAZStrType( + flags={"required": True}, + ) + + source = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_url_filtering = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering") + disc_url_filtering.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_url_filtering.destination = AAZObjectType() + disc_url_filtering.rules = AAZListType( + flags={"required": True}, + ) + disc_url_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.hostname = AAZStrType() + _element.method = AAZStrType() + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.paths = AAZListType() + _element.priority = AAZIntType( + flags={"required": True}, + ) + + paths = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element.paths + paths.Element = AAZStrType() + + source = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_delete.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_delete.py new file mode 100644 index 00000000000..9eb7b495e5f --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_delete.py @@ -0,0 +1,166 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentmesh policy-group delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete an Agent Mesh policy group + + :example: PolicyGroups_Delete + az agentmesh policy-group delete --resource-group rgnetworksecurity --name testPolicyGroup + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the PolicyGroup", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.PolicyGroupsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class PolicyGroupsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "policyGroupName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + def on_204(self, session): + pass + + def on_200_201(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_list.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_list.py new file mode 100644 index 00000000000..a8ade384dd0 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_list.py @@ -0,0 +1,953 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentmesh policy-group list", +) +class List(AAZCommand): + """List Agent Mesh policy groups + + :example: PolicyGroups_ListBySubscription + az agentmesh policy-group list + + :example: PolicyGroups_ListByResourceGroup + az agentmesh policy-group list --resource-group rgnetworksecurity + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networksecurity/policygroups", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + if condition_0: + self.PolicyGroupsListBySubscription(ctx=self.ctx)() + if condition_1: + self.PolicyGroupsListByResourceGroup(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class PolicyGroupsListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkSecurity/policyGroups", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.description = AAZStrType() + properties.display_name = AAZStrType( + serialized_name="displayName", + ) + properties.network_security_policies = AAZListType( + serialized_name="networkSecurityPolicies", + ) + properties.priority = AAZIntType() + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + network_security_policies = cls._schema_on_200.value.Element.properties.network_security_policies + network_security_policies.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.network_security_policies.Element + _element.type = AAZStrType( + flags={"required": True}, + ) + + disc_content_inspection = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection") + disc_content_inspection.prompt_injection_protection = AAZObjectType( + serialized_name="promptInjectionProtection", + ) + disc_content_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + prompt_injection_protection = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection + prompt_injection_protection.on_detection = AAZStrType( + serialized_name="onDetection", + flags={"required": True}, + ) + prompt_injection_protection.prompt_locations = AAZListType( + serialized_name="promptLocations", + ) + prompt_injection_protection.response_locations = AAZListType( + serialized_name="responseLocations", + ) + prompt_injection_protection.sensitivity = AAZStrType() + + prompt_locations = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.prompt_locations + prompt_locations.Element = AAZStrType() + + response_locations = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.response_locations + response_locations.Element = AAZStrType() + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_fqdn_filtering = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering") + disc_fqdn_filtering.destination = AAZObjectType() + disc_fqdn_filtering.direction = AAZStrType() + disc_fqdn_filtering.name = AAZStrType() + disc_fqdn_filtering.ports = AAZListType() + disc_fqdn_filtering.priority = AAZIntType() + disc_fqdn_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + ports = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").ports + ports.Element = AAZIntType() + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_mcp = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp") + disc_mcp.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_mcp.destination = AAZObjectType( + flags={"required": True}, + ) + disc_mcp.rules = AAZListType( + flags={"required": True}, + ) + disc_mcp.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.tools = AAZListType( + flags={"required": True}, + ) + + tools = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element.tools + tools.Element = AAZStrType() + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_tls_inspection = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection") + disc_tls_inspection.certificate = AAZObjectType( + flags={"required": True}, + ) + disc_tls_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + certificate = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").certificate + certificate.mode = AAZStrType( + flags={"required": True}, + ) + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_url_filtering = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering") + disc_url_filtering.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_url_filtering.destination = AAZObjectType() + disc_url_filtering.rules = AAZListType( + flags={"required": True}, + ) + disc_url_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.hostname = AAZStrType() + _element.method = AAZStrType() + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.paths = AAZListType() + _element.priority = AAZIntType( + flags={"required": True}, + ) + + paths = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element.paths + paths.Element = AAZStrType() + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class PolicyGroupsListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/policyGroups", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.description = AAZStrType() + properties.display_name = AAZStrType( + serialized_name="displayName", + ) + properties.network_security_policies = AAZListType( + serialized_name="networkSecurityPolicies", + ) + properties.priority = AAZIntType() + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + network_security_policies = cls._schema_on_200.value.Element.properties.network_security_policies + network_security_policies.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.network_security_policies.Element + _element.type = AAZStrType( + flags={"required": True}, + ) + + disc_content_inspection = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection") + disc_content_inspection.prompt_injection_protection = AAZObjectType( + serialized_name="promptInjectionProtection", + ) + disc_content_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + prompt_injection_protection = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection + prompt_injection_protection.on_detection = AAZStrType( + serialized_name="onDetection", + flags={"required": True}, + ) + prompt_injection_protection.prompt_locations = AAZListType( + serialized_name="promptLocations", + ) + prompt_injection_protection.response_locations = AAZListType( + serialized_name="responseLocations", + ) + prompt_injection_protection.sensitivity = AAZStrType() + + prompt_locations = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.prompt_locations + prompt_locations.Element = AAZStrType() + + response_locations = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.response_locations + response_locations.Element = AAZStrType() + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_fqdn_filtering = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering") + disc_fqdn_filtering.destination = AAZObjectType() + disc_fqdn_filtering.direction = AAZStrType() + disc_fqdn_filtering.name = AAZStrType() + disc_fqdn_filtering.ports = AAZListType() + disc_fqdn_filtering.priority = AAZIntType() + disc_fqdn_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + ports = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").ports + ports.Element = AAZIntType() + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_mcp = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp") + disc_mcp.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_mcp.destination = AAZObjectType( + flags={"required": True}, + ) + disc_mcp.rules = AAZListType( + flags={"required": True}, + ) + disc_mcp.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.tools = AAZListType( + flags={"required": True}, + ) + + tools = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element.tools + tools.Element = AAZStrType() + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_tls_inspection = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection") + disc_tls_inspection.certificate = AAZObjectType( + flags={"required": True}, + ) + disc_tls_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + certificate = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").certificate + certificate.mode = AAZStrType( + flags={"required": True}, + ) + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_url_filtering = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering") + disc_url_filtering.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_url_filtering.destination = AAZObjectType() + disc_url_filtering.rules = AAZListType( + flags={"required": True}, + ) + disc_url_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.hostname = AAZStrType() + _element.method = AAZStrType() + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.paths = AAZListType() + _element.priority = AAZIntType( + flags={"required": True}, + ) + + paths = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element.paths + paths.Element = AAZStrType() + + source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_show.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_show.py new file mode 100644 index 00000000000..6321cd317e9 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_show.py @@ -0,0 +1,513 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentmesh policy-group show", +) +class Show(AAZCommand): + """Get an Agent Mesh policy group + + :example: PolicyGroups_Get + az agentmesh policy-group show --resource-group rgnetworksecurity --name testPolicyGroup + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the PolicyGroup", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PolicyGroupsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class PolicyGroupsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "policyGroupName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.description = AAZStrType() + properties.display_name = AAZStrType( + serialized_name="displayName", + ) + properties.network_security_policies = AAZListType( + serialized_name="networkSecurityPolicies", + ) + properties.priority = AAZIntType() + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + network_security_policies = cls._schema_on_200.properties.network_security_policies + network_security_policies.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_policies.Element + _element.type = AAZStrType( + flags={"required": True}, + ) + + disc_content_inspection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection") + disc_content_inspection.prompt_injection_protection = AAZObjectType( + serialized_name="promptInjectionProtection", + ) + disc_content_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + prompt_injection_protection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection + prompt_injection_protection.on_detection = AAZStrType( + serialized_name="onDetection", + flags={"required": True}, + ) + prompt_injection_protection.prompt_locations = AAZListType( + serialized_name="promptLocations", + ) + prompt_injection_protection.response_locations = AAZListType( + serialized_name="responseLocations", + ) + prompt_injection_protection.sensitivity = AAZStrType() + + prompt_locations = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.prompt_locations + prompt_locations.Element = AAZStrType() + + response_locations = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.response_locations + response_locations.Element = AAZStrType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_fqdn_filtering = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering") + disc_fqdn_filtering.destination = AAZObjectType() + disc_fqdn_filtering.direction = AAZStrType() + disc_fqdn_filtering.name = AAZStrType() + disc_fqdn_filtering.ports = AAZListType() + disc_fqdn_filtering.priority = AAZIntType() + disc_fqdn_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + ports = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").ports + ports.Element = AAZIntType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_mcp = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp") + disc_mcp.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_mcp.destination = AAZObjectType( + flags={"required": True}, + ) + disc_mcp.rules = AAZListType( + flags={"required": True}, + ) + disc_mcp.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.tools = AAZListType( + flags={"required": True}, + ) + + tools = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element.tools + tools.Element = AAZStrType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_tls_inspection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection") + disc_tls_inspection.certificate = AAZObjectType( + flags={"required": True}, + ) + disc_tls_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + certificate = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").certificate + certificate.mode = AAZStrType( + flags={"required": True}, + ) + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_url_filtering = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering") + disc_url_filtering.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_url_filtering.destination = AAZObjectType() + disc_url_filtering.rules = AAZListType( + flags={"required": True}, + ) + disc_url_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.hostname = AAZStrType() + _element.method = AAZStrType() + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.paths = AAZListType() + _element.priority = AAZIntType( + flags={"required": True}, + ) + + paths = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element.paths + paths.Element = AAZStrType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_update.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_update.py new file mode 100644 index 00000000000..1a2ff9bc593 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_update.py @@ -0,0 +1,560 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentmesh policy-group update", +) +class Update(AAZCommand): + """Update an Agent Mesh policy group's tags + + :example: PolicyGroups_Update + az agentmesh policy-group update --resource-group rgnetworksecurity --name testPolicyGroup --tags "{env:production}" + """ + + _aaz_info = { + "version": "2026-07-21-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the PolicyGroup", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Properties", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.PolicyGroupsUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class PolicyGroupsUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "policyGroupName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("tags", AAZDictType, ".tags") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.description = AAZStrType() + properties.display_name = AAZStrType( + serialized_name="displayName", + ) + properties.network_security_policies = AAZListType( + serialized_name="networkSecurityPolicies", + ) + properties.priority = AAZIntType() + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + network_security_policies = cls._schema_on_200.properties.network_security_policies + network_security_policies.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_policies.Element + _element.type = AAZStrType( + flags={"required": True}, + ) + + disc_content_inspection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection") + disc_content_inspection.prompt_injection_protection = AAZObjectType( + serialized_name="promptInjectionProtection", + ) + disc_content_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + prompt_injection_protection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection + prompt_injection_protection.on_detection = AAZStrType( + serialized_name="onDetection", + flags={"required": True}, + ) + prompt_injection_protection.prompt_locations = AAZListType( + serialized_name="promptLocations", + ) + prompt_injection_protection.response_locations = AAZListType( + serialized_name="responseLocations", + ) + prompt_injection_protection.sensitivity = AAZStrType() + + prompt_locations = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.prompt_locations + prompt_locations.Element = AAZStrType() + + response_locations = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.response_locations + response_locations.Element = AAZStrType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_fqdn_filtering = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering") + disc_fqdn_filtering.destination = AAZObjectType() + disc_fqdn_filtering.direction = AAZStrType() + disc_fqdn_filtering.name = AAZStrType() + disc_fqdn_filtering.ports = AAZListType() + disc_fqdn_filtering.priority = AAZIntType() + disc_fqdn_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + ports = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").ports + ports.Element = AAZIntType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_mcp = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp") + disc_mcp.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_mcp.destination = AAZObjectType( + flags={"required": True}, + ) + disc_mcp.rules = AAZListType( + flags={"required": True}, + ) + disc_mcp.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.tools = AAZListType( + flags={"required": True}, + ) + + tools = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element.tools + tools.Element = AAZStrType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_tls_inspection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection") + disc_tls_inspection.certificate = AAZObjectType( + flags={"required": True}, + ) + disc_tls_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + certificate = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").certificate + certificate.mode = AAZStrType( + flags={"required": True}, + ) + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_url_filtering = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering") + disc_url_filtering.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_url_filtering.destination = AAZObjectType() + disc_url_filtering.rules = AAZListType( + flags={"required": True}, + ) + disc_url_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.hostname = AAZStrType() + _element.method = AAZStrType() + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.paths = AAZListType() + _element.priority = AAZIntType( + flags={"required": True}, + ) + + paths = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element.paths + paths.Element = AAZStrType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + +__all__ = ["Update"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_wait.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_wait.py new file mode 100644 index 00000000000..b816d17a0c5 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_wait.py @@ -0,0 +1,509 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentmesh policy-group wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the PolicyGroup", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PolicyGroupsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class PolicyGroupsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "policyGroupName", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-07-21-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.description = AAZStrType() + properties.display_name = AAZStrType( + serialized_name="displayName", + ) + properties.network_security_policies = AAZListType( + serialized_name="networkSecurityPolicies", + ) + properties.priority = AAZIntType() + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + network_security_policies = cls._schema_on_200.properties.network_security_policies + network_security_policies.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_policies.Element + _element.type = AAZStrType( + flags={"required": True}, + ) + + disc_content_inspection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection") + disc_content_inspection.prompt_injection_protection = AAZObjectType( + serialized_name="promptInjectionProtection", + ) + disc_content_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + prompt_injection_protection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection + prompt_injection_protection.on_detection = AAZStrType( + serialized_name="onDetection", + flags={"required": True}, + ) + prompt_injection_protection.prompt_locations = AAZListType( + serialized_name="promptLocations", + ) + prompt_injection_protection.response_locations = AAZListType( + serialized_name="responseLocations", + ) + prompt_injection_protection.sensitivity = AAZStrType() + + prompt_locations = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.prompt_locations + prompt_locations.Element = AAZStrType() + + response_locations = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.response_locations + response_locations.Element = AAZStrType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_fqdn_filtering = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering") + disc_fqdn_filtering.destination = AAZObjectType() + disc_fqdn_filtering.direction = AAZStrType() + disc_fqdn_filtering.name = AAZStrType() + disc_fqdn_filtering.ports = AAZListType() + disc_fqdn_filtering.priority = AAZIntType() + disc_fqdn_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + ports = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").ports + ports.Element = AAZIntType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_mcp = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp") + disc_mcp.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_mcp.destination = AAZObjectType( + flags={"required": True}, + ) + disc_mcp.rules = AAZListType( + flags={"required": True}, + ) + disc_mcp.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.tools = AAZListType( + flags={"required": True}, + ) + + tools = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element.tools + tools.Element = AAZStrType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_tls_inspection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection") + disc_tls_inspection.certificate = AAZObjectType( + flags={"required": True}, + ) + disc_tls_inspection.source = AAZObjectType( + flags={"required": True}, + ) + + certificate = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").certificate + certificate.mode = AAZStrType( + flags={"required": True}, + ) + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + disc_url_filtering = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering") + disc_url_filtering.default_action = AAZStrType( + serialized_name="defaultAction", + flags={"required": True}, + ) + disc_url_filtering.destination = AAZObjectType() + disc_url_filtering.rules = AAZListType( + flags={"required": True}, + ) + disc_url_filtering.source = AAZObjectType( + flags={"required": True}, + ) + + destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination + destination.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns") + disc_fqdns.fqdns = AAZListType( + flags={"required": True}, + ) + + fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns").fqdns + fqdns.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + rules = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules + rules.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element + _element.action = AAZStrType( + flags={"required": True}, + ) + _element.hostname = AAZStrType() + _element.method = AAZStrType() + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.paths = AAZListType() + _element.priority = AAZIntType( + flags={"required": True}, + ) + + paths = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element.paths + paths.Element = AAZStrType() + + source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source + source.type = AAZStrType( + flags={"required": True}, + ) + + disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes") + disc_address_prefixes.prefixes = AAZListType( + flags={"required": True}, + ) + + prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes + prefixes.Element = AAZStrType() + + disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns") + disc_workload_id_patterns.patterns = AAZListType( + flags={"required": True}, + ) + + patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns + patterns.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/agentmesh/azext_agentmesh/azext_metadata.json b/src/agentmesh/azext_agentmesh/azext_metadata.json new file mode 100644 index 00000000000..71889bb136b --- /dev/null +++ b/src/agentmesh/azext_agentmesh/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isPreview": true, + "azext.minCliCoreVersion": "2.75.0" +} \ No newline at end of file diff --git a/src/agentmesh/azext_agentmesh/commands.py b/src/agentmesh/azext_agentmesh/commands.py new file mode 100644 index 00000000000..b0d842e4993 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/commands.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# 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 + +# from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): # pylint: disable=unused-argument + pass diff --git a/src/agentmesh/azext_agentmesh/custom.py b/src/agentmesh/azext_agentmesh/custom.py new file mode 100644 index 00000000000..86df1e48ef5 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/custom.py @@ -0,0 +1,14 @@ +# -------------------------------------------------------------------------------------------- +# 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 + +from knack.log import get_logger + + +logger = get_logger(__name__) diff --git a/src/agentmesh/azext_agentmesh/tests/__init__.py b/src/agentmesh/azext_agentmesh/tests/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/tests/__init__.py @@ -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 +# -------------------------------------------------------------------------------------------- diff --git a/src/agentmesh/azext_agentmesh/tests/latest/__init__.py b/src/agentmesh/azext_agentmesh/tests/latest/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/tests/latest/__init__.py @@ -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 +# -------------------------------------------------------------------------------------------- diff --git a/src/agentmesh/azext_agentmesh/tests/latest/recordings/test_agentmesh_command_help.yaml b/src/agentmesh/azext_agentmesh/tests/latest/recordings/test_agentmesh_command_help.yaml new file mode 100644 index 00000000000..591dc7c3b1a --- /dev/null +++ b/src/agentmesh/azext_agentmesh/tests/latest/recordings/test_agentmesh_command_help.yaml @@ -0,0 +1,44 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.33.0 + method: GET + uri: https://aka.ms/azExtCmdTree + response: + body: + string: '' + headers: + cache-control: + - max-age=0, no-cache, no-store + connection: + - keep-alive + content-length: + - '0' + date: + - Tue, 15 Sep 2026 22:07:43 GMT + expires: + - Tue, 15 Sep 2026 22:07:43 GMT + location: + - https://azurecliextensionsync.blob.core.windows.net/cmd-index/extensionCommandTree.json + pragma: + - no-cache + request-context: + - appId=cid-v1:d94c0f68-64bf-4036-8409-a0e761bb7ee1 + server: + - Kestrel + strict-transport-security: + - max-age=31536000 ; includeSubDomains + x-response-cache-status: + - 'True' + status: + code: 301 + message: Moved Permanently +version: 1 diff --git a/src/agentmesh/azext_agentmesh/tests/latest/test_agentmesh.py b/src/agentmesh/azext_agentmesh/tests/latest/test_agentmesh.py new file mode 100644 index 00000000000..8a9a42c3bc0 --- /dev/null +++ b/src/agentmesh/azext_agentmesh/tests/latest/test_agentmesh.py @@ -0,0 +1,172 @@ +# -------------------------------------------------------------------------------------------- +# 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 +# -------------------------------------------------------------------------------------------- + +import importlib +import unittest +from unittest.mock import MagicMock + +from azure.cli.testsdk import ScenarioTest + + +COMMANDS = ( + ("agentmesh fabric create", "azext_agentmesh.aaz.latest.agentmesh.fabric._create", "Create"), + ("agentmesh fabric show", "azext_agentmesh.aaz.latest.agentmesh.fabric._show", "Show"), + ("agentmesh fabric list", "azext_agentmesh.aaz.latest.agentmesh.fabric._list", "List"), + ("agentmesh fabric update", "azext_agentmesh.aaz.latest.agentmesh.fabric._update", "Update"), + ("agentmesh fabric delete", "azext_agentmesh.aaz.latest.agentmesh.fabric._delete", "Delete"), + ( + "agentmesh fabric member create", + "azext_agentmesh.aaz.latest.agentmesh.fabric.member._create", + "Create", + ), + ( + "agentmesh fabric member show", + "azext_agentmesh.aaz.latest.agentmesh.fabric.member._show", + "Show", + ), + ( + "agentmesh fabric member list", + "azext_agentmesh.aaz.latest.agentmesh.fabric.member._list", + "List", + ), + ( + "agentmesh fabric member update", + "azext_agentmesh.aaz.latest.agentmesh.fabric.member._update", + "Update", + ), + ( + "agentmesh fabric member delete", + "azext_agentmesh.aaz.latest.agentmesh.fabric.member._delete", + "Delete", + ), + ( + "agentmesh policy-group create", + "azext_agentmesh.aaz.latest.agentmesh.policy_group._create", + "Create", + ), + ( + "agentmesh policy-group show", + "azext_agentmesh.aaz.latest.agentmesh.policy_group._show", + "Show", + ), + ( + "agentmesh policy-group list", + "azext_agentmesh.aaz.latest.agentmesh.policy_group._list", + "List", + ), + ( + "agentmesh policy-group update", + "azext_agentmesh.aaz.latest.agentmesh.policy_group._update", + "Update", + ), + ( + "agentmesh policy-group delete", + "azext_agentmesh.aaz.latest.agentmesh.policy_group._delete", + "Delete", + ), +) + +HELP_ONLY_COMMANDS = ( + "agentmesh fabric wait", + "agentmesh fabric member wait", + "agentmesh policy-group wait", +) + +REQUEST_SHAPES = ( + ( + "azext_agentmesh.aaz.latest.agentmesh.fabric._create", + "Create", + "AgentFabricsCreateOrUpdate", + "PUT", + ), + ( + "azext_agentmesh.aaz.latest.agentmesh.fabric._update", + "Update", + "AgentFabricsUpdate", + "PATCH", + ), + ( + "azext_agentmesh.aaz.latest.agentmesh.fabric._delete", + "Delete", + "AgentFabricsDelete", + "DELETE", + ), + ( + "azext_agentmesh.aaz.latest.agentmesh.fabric.member._create", + "Create", + "MembersCreateOrUpdate", + "PUT", + ), + ( + "azext_agentmesh.aaz.latest.agentmesh.fabric.member._update", + "Update", + "MembersUpdate", + "PATCH", + ), + ( + "azext_agentmesh.aaz.latest.agentmesh.fabric.member._delete", + "Delete", + "MembersDelete", + "DELETE", + ), + ( + "azext_agentmesh.aaz.latest.agentmesh.policy_group._create", + "Create", + "PolicyGroupsCreateOrUpdate", + "PUT", + ), + ( + "azext_agentmesh.aaz.latest.agentmesh.policy_group._update", + "Update", + "PolicyGroupsUpdate", + "PATCH", + ), + ( + "azext_agentmesh.aaz.latest.agentmesh.policy_group._delete", + "Delete", + "PolicyGroupsDelete", + "DELETE", + ), +) + + +class AgentmeshScenario(ScenarioTest): + + def test_agentmesh_command_help(self): + commands = ( + "agentmesh", + "agentmesh fabric", + "agentmesh fabric member", + "agentmesh policy-group", + *(command for command, _, _ in COMMANDS), + *HELP_ONLY_COMMANDS, + ) + for command in commands: + try: + self.cmd(f"az {command} --help") + except SystemExit as ex: + self.assertEqual(ex.code, 0, f"{command} help failed") + + +class AgentmeshGeneratedCommandTest(unittest.TestCase): + + def test_all_commands_have_generated_examples(self): + for command, module_name, class_name in COMMANDS: + command_class = getattr(importlib.import_module(module_name), class_name) + self.assertIn(":example:", command_class.__doc__, command) + self.assertIn(f"az {command}", command_class.__doc__, command) + + def test_lro_request_shapes(self): + for module_name, class_name, operation_name, method in REQUEST_SHAPES: + command_class = getattr(importlib.import_module(module_name), class_name) + operation_class = getattr(command_class, operation_name) + operation = operation_class(ctx=MagicMock()) + self.assertEqual(operation.method, method) + self.assertEqual( + operation.query_parameters, + {"api-version": "2026-07-21-preview"}, + ) diff --git a/src/agentmesh/linter_exclusions.yml b/src/agentmesh/linter_exclusions.yml new file mode 100644 index 00000000000..245f8957d2b --- /dev/null +++ b/src/agentmesh/linter_exclusions.yml @@ -0,0 +1,5 @@ +agentmesh policy-group create: + parameters: + network_security_policies: + rule_exclusions: + - option_length_too_long diff --git a/src/agentmesh/setup.cfg b/src/agentmesh/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/agentmesh/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/agentmesh/setup.py b/src/agentmesh/setup.py new file mode 100644 index 00000000000..48c1f55ba8d --- /dev/null +++ b/src/agentmesh/setup.py @@ -0,0 +1,51 @@ +# -------------------------------------------------------------------------------------------- +# 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 codecs import open +from setuptools import setup, find_packages + + +# HISTORY.rst entry. +VERSION = '1.0.0b1' + +# 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.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', + 'License :: OSI Approved :: MIT License', +] + +DEPENDENCIES = [] + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='agentmesh', + version=VERSION, + description='Microsoft Azure Command-Line Tools Agent Mesh Extension.', + long_description=README + '\n\n' + HISTORY, + license='MIT', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions/tree/main/src/agentmesh', + classifiers=CLASSIFIERS, + packages=find_packages(exclude=["tests"]), + package_data={'azext_agentmesh': ['azext_metadata.json']}, + install_requires=DEPENDENCIES +) diff --git a/src/service_name.json b/src/service_name.json index 006623a8062..c17b3e3fa44 100644 --- a/src/service_name.json +++ b/src/service_name.json @@ -29,6 +29,11 @@ "AzureServiceName": "Azure Agent Fabric", "URL": "" }, + { + "Command": "az agentmesh", + "AzureServiceName": "Azure Agent Mesh", + "URL": "" + }, { "Command": "az ai-examples", "AzureServiceName": "AI Examples", From ee3f9c367c6c2f00637b2d1a1270f42bb1f3e5e8 Mon Sep 17 00:00:00 2001 From: Kshitija Murudi Date: Tue, 22 Sep 2026 10:03:10 -0700 Subject: [PATCH 3/8] Resolve Agent Fabric rebase on current main Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../azext_agentfabric/aaz/latest/__init__.py | 13 +- src/agentmesh/HISTORY.rst | 9 - src/agentmesh/README.md | 70 - src/agentmesh/azext_agentmesh/__init__.py | 42 - src/agentmesh/azext_agentmesh/_help.py | 11 - src/agentmesh/azext_agentmesh/_params.py | 13 - src/agentmesh/azext_agentmesh/aaz/__init__.py | 6 - .../azext_agentmesh/aaz/latest/__init__.py | 9 - .../aaz/latest/agentmesh/__cmd_group.py | 23 - .../aaz/latest/agentmesh/__init__.py | 11 - .../latest/agentmesh/fabric/__cmd_group.py | 23 - .../aaz/latest/agentmesh/fabric/__init__.py | 17 - .../aaz/latest/agentmesh/fabric/_create.py | 309 ---- .../aaz/latest/agentmesh/fabric/_delete.py | 166 -- .../aaz/latest/agentmesh/fabric/_list.py | 373 ----- .../aaz/latest/agentmesh/fabric/_show.py | 223 --- .../aaz/latest/agentmesh/fabric/_update.py | 270 ---- .../aaz/latest/agentmesh/fabric/_wait.py | 219 --- .../agentmesh/fabric/member/__cmd_group.py | 23 - .../agentmesh/fabric/member/__init__.py | 17 - .../latest/agentmesh/fabric/member/_create.py | 516 ------- .../latest/agentmesh/fabric/member/_delete.py | 179 --- .../latest/agentmesh/fabric/member/_list.py | 300 ---- .../latest/agentmesh/fabric/member/_show.py | 301 ---- .../latest/agentmesh/fabric/member/_update.py | 348 ----- .../latest/agentmesh/fabric/member/_wait.py | 297 ---- .../agentmesh/policy_group/__cmd_group.py | 23 - .../latest/agentmesh/policy_group/__init__.py | 17 - .../latest/agentmesh/policy_group/_create.py | 1332 ----------------- .../latest/agentmesh/policy_group/_delete.py | 166 -- .../latest/agentmesh/policy_group/_list.py | 953 ------------ .../latest/agentmesh/policy_group/_show.py | 513 ------- .../latest/agentmesh/policy_group/_update.py | 560 ------- .../latest/agentmesh/policy_group/_wait.py | 509 ------- .../azext_agentmesh/azext_metadata.json | 4 - src/agentmesh/azext_agentmesh/commands.py | 15 - src/agentmesh/azext_agentmesh/custom.py | 14 - .../azext_agentmesh/tests/__init__.py | 6 - .../azext_agentmesh/tests/latest/__init__.py | 6 - .../test_agentmesh_command_help.yaml | 44 - .../tests/latest/test_agentmesh.py | 172 --- src/agentmesh/linter_exclusions.yml | 5 - src/agentmesh/setup.cfg | 1 - src/agentmesh/setup.py | 51 - src/service_name.json | 5 - 45 files changed, 4 insertions(+), 8180 deletions(-) delete mode 100644 src/agentmesh/HISTORY.rst delete mode 100644 src/agentmesh/README.md delete mode 100644 src/agentmesh/azext_agentmesh/__init__.py delete mode 100644 src/agentmesh/azext_agentmesh/_help.py delete mode 100644 src/agentmesh/azext_agentmesh/_params.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/__init__.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/__init__.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/__cmd_group.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/__init__.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/__cmd_group.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/__init__.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_create.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_delete.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_list.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_show.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_update.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_wait.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/__cmd_group.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/__init__.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_create.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_delete.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_list.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_show.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_update.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_wait.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/__cmd_group.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/__init__.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_create.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_delete.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_list.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_show.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_update.py delete mode 100644 src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_wait.py delete mode 100644 src/agentmesh/azext_agentmesh/azext_metadata.json delete mode 100644 src/agentmesh/azext_agentmesh/commands.py delete mode 100644 src/agentmesh/azext_agentmesh/custom.py delete mode 100644 src/agentmesh/azext_agentmesh/tests/__init__.py delete mode 100644 src/agentmesh/azext_agentmesh/tests/latest/__init__.py delete mode 100644 src/agentmesh/azext_agentmesh/tests/latest/recordings/test_agentmesh_command_help.yaml delete mode 100644 src/agentmesh/azext_agentmesh/tests/latest/test_agentmesh.py delete mode 100644 src/agentmesh/linter_exclusions.yml delete mode 100644 src/agentmesh/setup.cfg delete mode 100644 src/agentmesh/setup.py diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/__init__.py b/src/agentfabric/azext_agentfabric/aaz/latest/__init__.py index 995a61cf962..f6acc11aa4e 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/__init__.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/__init__.py @@ -1,15 +1,10 @@ -# 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. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- -<<<<<<<< HEAD:src/aimanager/azext_aimanager/vendored_sdks/v2026_09_02_preview/_version.py -VERSION = "1.0.0b2" -======== # pylint: skip-file # flake8: noqa ->>>>>>>> 3cc7bff40 (Replace Agent Mesh with Agent Fabric):src/agentfabric/azext_agentfabric/aaz/latest/__init__.py diff --git a/src/agentmesh/HISTORY.rst b/src/agentmesh/HISTORY.rst deleted file mode 100644 index 10c3d4b501d..00000000000 --- a/src/agentmesh/HISTORY.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. :changelog: - -Release History -=============== - -1.0.0b1 -++++++ -* Initial preview release for Azure Agent Mesh using API version ``2026-07-21-preview``. -* Add fabric, fabric member, and policy group create, show, list, update, and delete commands. \ No newline at end of file diff --git a/src/agentmesh/README.md b/src/agentmesh/README.md deleted file mode 100644 index 789c5f145b4..00000000000 --- a/src/agentmesh/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# Azure CLI Agent Mesh Extension - -This extension manages Azure Agent Mesh fabrics, fabric members, and policy groups. -It uses the `Microsoft.NetworkSecurity` resource provider API version -`2026-07-21-preview`. - -## Install - -```bash -az extension add --name agentmesh -``` - -## Commands - -Each resource supports `create`, `show`, `list`, `update`, and `delete`. - -```bash -az agentmesh fabric --help -az agentmesh fabric member --help -az agentmesh policy-group --help -``` - -### Fabrics - -```bash -az agentmesh fabric create \ - --resource-group myResourceGroup \ - --name myFabric \ - --location eastus \ - --trust-domain contoso.agentfabric - -az agentmesh fabric update \ - --resource-group myResourceGroup \ - --name myFabric \ - --tags environment=production - -az agentmesh fabric list --resource-group myResourceGroup -``` - -### Fabric members - -```bash -az agentmesh fabric member create \ - --resource-group myResourceGroup \ - --fabric-name myFabric \ - --member-name myMember \ - --location eastus \ - --workload "{aci:{resource-id:/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance/containerGroups/myContainerGroup}}" - -az agentmesh fabric member show \ - --resource-group myResourceGroup \ - --fabric-name myFabric \ - --member-name myMember -``` - -### Policy groups - -```bash -az agentmesh policy-group create \ - --resource-group myResourceGroup \ - --name myPolicyGroup \ - --location eastus \ - --display-name "My policy group" \ - --priority 100 - -az agentmesh policy-group list --resource-group myResourceGroup -``` - -Long-running create, update, and delete operations support `--no-wait`. Use the -corresponding `wait` command to wait for provisioning to reach a target state. \ No newline at end of file diff --git a/src/agentmesh/azext_agentmesh/__init__.py b/src/agentmesh/azext_agentmesh/__init__.py deleted file mode 100644 index d5b149feef9..00000000000 --- a/src/agentmesh/azext_agentmesh/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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_agentmesh._help import helps # pylint: disable=unused-import - - -class AgentmeshCommandsLoader(AzCommandsLoader): - - def __init__(self, cli_ctx=None): - from azure.cli.core.commands import CliCommandType - custom_command_type = CliCommandType( - operations_tmpl='azext_agentmesh.custom#{}') - super().__init__(cli_ctx=cli_ctx, - custom_command_type=custom_command_type) - - def load_command_table(self, args): - from azext_agentmesh.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_agentmesh._params import load_arguments - load_arguments(self, command) - - -COMMAND_LOADER_CLS = AgentmeshCommandsLoader diff --git a/src/agentmesh/azext_agentmesh/_help.py b/src/agentmesh/azext_agentmesh/_help.py deleted file mode 100644 index 126d5d00714..00000000000 --- a/src/agentmesh/azext_agentmesh/_help.py +++ /dev/null @@ -1,11 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 diff --git a/src/agentmesh/azext_agentmesh/_params.py b/src/agentmesh/azext_agentmesh/_params.py deleted file mode 100644 index cfcec717c9c..00000000000 --- a/src/agentmesh/azext_agentmesh/_params.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. -# -# 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 diff --git a/src/agentmesh/azext_agentmesh/aaz/__init__.py b/src/agentmesh/azext_agentmesh/aaz/__init__.py deleted file mode 100644 index 5757aea3175..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 -# -------------------------------------------------------------------------------------------- diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/__init__.py b/src/agentmesh/azext_agentmesh/aaz/latest/__init__.py deleted file mode 100644 index 7e832c711e8..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/__cmd_group.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/__cmd_group.py deleted file mode 100644 index c67bf0e3291..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh", -) -class __CMDGroup(AAZCommandGroup): - """Manage Azure Agent Mesh resources. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/__init__.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/__init__.py deleted file mode 100644 index 5a9d61963d6..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/__cmd_group.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/__cmd_group.py deleted file mode 100644 index b8eeff1ab7c..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh fabric", -) -class __CMDGroup(AAZCommandGroup): - """Manage Agent Mesh fabrics. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/__init__.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/__init__.py deleted file mode 100644 index db73033039b..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_create.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_create.py deleted file mode 100644 index 07a06870287..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_create.py +++ /dev/null @@ -1,309 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh fabric create", -) -class Create(AAZCommand): - """Create an Agent Mesh fabric - - :example: AgentFabrics_CreateOrUpdate - az agentmesh fabric create --resource-group rgnetworksecurity --name testAIFabric --default-policy-groups "[/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgnetworksecurity/providers/Microsoft.NetworkSecurity/policyGroups/testPolicyGroup]" --trust-domain contoso.agentfabric --tags "{}" --location eastus - """ - - _aaz_info = { - "version": "2026-07-21-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, self._output) - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The name of the AgentFabric", - required=True, - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.default_policy_groups = AAZListArg( - options=["--default-policy-groups"], - arg_group="Properties", - help="The default policy groups to apply to all members of this fabric.", - ) - _args_schema.trust_domain = AAZStrArg( - options=["--trust-domain"], - arg_group="Properties", - help="The trust domain that scopes this fabric's member identities. It is the leading component of each member's identity, which takes the form `//`. Set at creation and immutable thereafter; when omitted, the shared default trust domain `microsoft.agentfabric` is used.", - fmt=AAZStrArgFormat( - pattern="^[a-z0-9]([a-z0-9.-]*[a-z0-9])?$", - max_length=253, - ), - ) - - default_policy_groups = cls._args_schema.default_policy_groups - default_policy_groups.Element = AAZResourceIdArg() - - # define Arg Group "Resource" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Resource", - help="The geo-location where the resource lives", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Resource", - help="Resource tags.", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.AgentFabricsCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class AgentFabricsCreateOrUpdate(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "agentFabricName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Content-Type", "application/json", - ), - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - @property - def content(self): - _content_value, _builder = self.new_content_builder( - self.ctx.args, - typ=AAZObjectType, - typ_kwargs={"flags": {"required": True, "client_flatten": True}} - ) - _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("defaultPolicyGroups", AAZListType, ".default_policy_groups") - properties.set_prop("trustDomain", AAZStrType, ".trust_domain") - - default_policy_groups = _builder.get(".properties.defaultPolicyGroups") - if default_policy_groups is not None: - default_policy_groups.set_elements(AAZStrType, ".") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - - _schema_on_200_201 = cls._schema_on_200_201 - _schema_on_200_201.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200_201.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.properties = AAZObjectType() - _schema_on_200_201.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _schema_on_200_201.tags = AAZDictType() - _schema_on_200_201.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200_201.properties - properties.default_policy_groups = AAZListType( - serialized_name="defaultPolicyGroups", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.trust_domain = AAZStrType( - serialized_name="trustDomain", - ) - - default_policy_groups = cls._schema_on_200_201.properties.default_policy_groups - default_policy_groups.Element = AAZStrType() - - system_data = cls._schema_on_200_201.system_data - system_data.created_at = AAZStrType( - serialized_name="createdAt", - ) - system_data.created_by = AAZStrType( - serialized_name="createdBy", - ) - system_data.created_by_type = AAZStrType( - serialized_name="createdByType", - ) - system_data.last_modified_at = AAZStrType( - serialized_name="lastModifiedAt", - ) - system_data.last_modified_by = AAZStrType( - serialized_name="lastModifiedBy", - ) - system_data.last_modified_by_type = AAZStrType( - serialized_name="lastModifiedByType", - ) - - tags = cls._schema_on_200_201.tags - tags.Element = AAZStrType() - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - -__all__ = ["Create"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_delete.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_delete.py deleted file mode 100644 index 51ca27320c6..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_delete.py +++ /dev/null @@ -1,166 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh fabric delete", - confirmation="Are you sure you want to perform this operation?", -) -class Delete(AAZCommand): - """Delete an Agent Mesh fabric - - :example: AgentFabrics_Delete - az agentmesh fabric delete --resource-group rgnetworksecurity --name testAIFabric - """ - - _aaz_info = { - "version": "2026-07-21-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The name of the AgentFabric", - required=True, - id_part="name", - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.AgentFabricsDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class AgentFabricsDelete(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "agentFabricName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - def on_204(self, session): - pass - - def on_200_201(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_list.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_list.py deleted file mode 100644 index 9f58b5b21d2..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_list.py +++ /dev/null @@ -1,373 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh fabric list", -) -class List(AAZCommand): - """List Agent Mesh fabrics - - :example: AgentFabrics_ListBySubscription - az agentmesh fabric list - - :example: AgentFabrics_ListByResourceGroup - az agentmesh fabric list --resource-group rgnetworksecurity - """ - - _aaz_info = { - "version": "2026-07-21-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networksecurity/agentfabrics", "2026-07-21-preview"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics", "2026-07-21-preview"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, self._output) - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.AgentFabricsListBySubscription(ctx=self.ctx)() - if condition_1: - self.AgentFabricsListByResourceGroup(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class AgentFabricsListBySubscription(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [200]: - return self.on_200(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkSecurity/agentFabrics", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - def on_200(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200 - ) - - _schema_on_200 = None - - @classmethod - def _build_schema_on_200(cls): - if cls._schema_on_200 is not None: - return cls._schema_on_200 - - cls._schema_on_200 = AAZObjectType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType() - _element.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.default_policy_groups = AAZListType( - serialized_name="defaultPolicyGroups", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.trust_domain = AAZStrType( - serialized_name="trustDomain", - ) - - default_policy_groups = cls._schema_on_200.value.Element.properties.default_policy_groups - default_policy_groups.Element = AAZStrType() - - system_data = cls._schema_on_200.value.Element.system_data - system_data.created_at = AAZStrType( - serialized_name="createdAt", - ) - system_data.created_by = AAZStrType( - serialized_name="createdBy", - ) - system_data.created_by_type = AAZStrType( - serialized_name="createdByType", - ) - system_data.last_modified_at = AAZStrType( - serialized_name="lastModifiedAt", - ) - system_data.last_modified_by = AAZStrType( - serialized_name="lastModifiedBy", - ) - system_data.last_modified_by_type = AAZStrType( - serialized_name="lastModifiedByType", - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class AgentFabricsListByResourceGroup(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [200]: - return self.on_200(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - def on_200(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200 - ) - - _schema_on_200 = None - - @classmethod - def _build_schema_on_200(cls): - if cls._schema_on_200 is not None: - return cls._schema_on_200 - - cls._schema_on_200 = AAZObjectType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType() - _element.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.default_policy_groups = AAZListType( - serialized_name="defaultPolicyGroups", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.trust_domain = AAZStrType( - serialized_name="trustDomain", - ) - - default_policy_groups = cls._schema_on_200.value.Element.properties.default_policy_groups - default_policy_groups.Element = AAZStrType() - - system_data = cls._schema_on_200.value.Element.system_data - system_data.created_at = AAZStrType( - serialized_name="createdAt", - ) - system_data.created_by = AAZStrType( - serialized_name="createdBy", - ) - system_data.created_by_type = AAZStrType( - serialized_name="createdByType", - ) - system_data.last_modified_at = AAZStrType( - serialized_name="lastModifiedAt", - ) - system_data.last_modified_by = AAZStrType( - serialized_name="lastModifiedBy", - ) - system_data.last_modified_by_type = AAZStrType( - serialized_name="lastModifiedByType", - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - -__all__ = ["List"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_show.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_show.py deleted file mode 100644 index 0956cef9aa7..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_show.py +++ /dev/null @@ -1,223 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh fabric show", -) -class Show(AAZCommand): - """Get an Agent Mesh fabric - - :example: AgentFabrics_Get - az agentmesh fabric show --resource-group rgnetworksecurity --name testAIFabric - """ - - _aaz_info = { - "version": "2026-07-21-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return self._output() - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The name of the AgentFabric", - required=True, - id_part="name", - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.AgentFabricsGet(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class AgentFabricsGet(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [200]: - return self.on_200(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "agentFabricName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - def on_200(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200 - ) - - _schema_on_200 = None - - @classmethod - def _build_schema_on_200(cls): - if cls._schema_on_200 is not None: - return cls._schema_on_200 - - cls._schema_on_200 = AAZObjectType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType() - _schema_on_200.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.default_policy_groups = AAZListType( - serialized_name="defaultPolicyGroups", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.trust_domain = AAZStrType( - serialized_name="trustDomain", - ) - - default_policy_groups = cls._schema_on_200.properties.default_policy_groups - default_policy_groups.Element = AAZStrType() - - system_data = cls._schema_on_200.system_data - system_data.created_at = AAZStrType( - serialized_name="createdAt", - ) - system_data.created_by = AAZStrType( - serialized_name="createdBy", - ) - system_data.created_by_type = AAZStrType( - serialized_name="createdByType", - ) - system_data.last_modified_at = AAZStrType( - serialized_name="lastModifiedAt", - ) - system_data.last_modified_by = AAZStrType( - serialized_name="lastModifiedBy", - ) - system_data.last_modified_by_type = AAZStrType( - serialized_name="lastModifiedByType", - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_update.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_update.py deleted file mode 100644 index cfc6bde9e83..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_update.py +++ /dev/null @@ -1,270 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh fabric update", -) -class Update(AAZCommand): - """Update an Agent Mesh fabric's tags - - :example: AgentFabrics_Update - az agentmesh fabric update --resource-group rgnetworksecurity --name testAIFabric --tags "{env:production}" - """ - - _aaz_info = { - "version": "2026-07-21-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, self._output) - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The name of the AgentFabric", - required=True, - id_part="name", - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Properties", - help="Resource tags.", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.AgentFabricsUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class AgentFabricsUpdate(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", - **self.url_parameters - ) - - @property - def method(self): - return "PATCH" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "agentFabricName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Content-Type", "application/json", - ), - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - @property - def content(self): - _content_value, _builder = self.new_content_builder( - self.ctx.args, - typ=AAZObjectType, - typ_kwargs={"flags": {"required": True, "client_flatten": True}} - ) - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200 - ) - - _schema_on_200 = None - - @classmethod - def _build_schema_on_200(cls): - if cls._schema_on_200 is not None: - return cls._schema_on_200 - - cls._schema_on_200 = AAZObjectType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType() - _schema_on_200.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.default_policy_groups = AAZListType( - serialized_name="defaultPolicyGroups", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.trust_domain = AAZStrType( - serialized_name="trustDomain", - ) - - default_policy_groups = cls._schema_on_200.properties.default_policy_groups - default_policy_groups.Element = AAZStrType() - - system_data = cls._schema_on_200.system_data - system_data.created_at = AAZStrType( - serialized_name="createdAt", - ) - system_data.created_by = AAZStrType( - serialized_name="createdBy", - ) - system_data.created_by_type = AAZStrType( - serialized_name="createdByType", - ) - system_data.last_modified_at = AAZStrType( - serialized_name="lastModifiedAt", - ) - system_data.last_modified_by = AAZStrType( - serialized_name="lastModifiedBy", - ) - system_data.last_modified_by_type = AAZStrType( - serialized_name="lastModifiedByType", - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _UpdateHelper: - """Helper class for Update""" - - -__all__ = ["Update"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_wait.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_wait.py deleted file mode 100644 index 3e21749e3e0..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/_wait.py +++ /dev/null @@ -1,219 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh fabric wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return self._output() - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The name of the AgentFabric", - required=True, - id_part="name", - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.AgentFabricsGet(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) - return result - - class AgentFabricsGet(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [200]: - return self.on_200(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "agentFabricName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - def on_200(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200 - ) - - _schema_on_200 = None - - @classmethod - def _build_schema_on_200(cls): - if cls._schema_on_200 is not None: - return cls._schema_on_200 - - cls._schema_on_200 = AAZObjectType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType() - _schema_on_200.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.default_policy_groups = AAZListType( - serialized_name="defaultPolicyGroups", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.trust_domain = AAZStrType( - serialized_name="trustDomain", - ) - - default_policy_groups = cls._schema_on_200.properties.default_policy_groups - default_policy_groups.Element = AAZStrType() - - system_data = cls._schema_on_200.system_data - system_data.created_at = AAZStrType( - serialized_name="createdAt", - ) - system_data.created_by = AAZStrType( - serialized_name="createdBy", - ) - system_data.created_by_type = AAZStrType( - serialized_name="createdByType", - ) - system_data.last_modified_at = AAZStrType( - serialized_name="lastModifiedAt", - ) - system_data.last_modified_by = AAZStrType( - serialized_name="lastModifiedBy", - ) - system_data.last_modified_by_type = AAZStrType( - serialized_name="lastModifiedByType", - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - -__all__ = ["Wait"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/__cmd_group.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/__cmd_group.py deleted file mode 100644 index 605104362fc..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh fabric member", -) -class __CMDGroup(AAZCommandGroup): - """Manage members of an Agent Mesh fabric. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/__init__.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/__init__.py deleted file mode 100644 index db73033039b..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_create.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_create.py deleted file mode 100644 index 132225126a9..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_create.py +++ /dev/null @@ -1,516 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh fabric member create", -) -class Create(AAZCommand): - """Create a member in an Agent Mesh fabric - - :example: Members_CreateOrUpdate - az agentmesh fabric member create --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name testMember --location eastus --workload "{aci:{resource-id:/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgnetworksecurity/providers/Microsoft.ContainerInstance/containerGroups/testContainerGroup}}" - - :example: Members_CreateOrUpdate_AgentFabricSandbox - az agentmesh fabric member create --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name sandboxMember --location eastus --workload "{agent-fabric-sandbox:{image:{uri:'contoso.azurecr.io/agents/sandbox:1.0.0',digest:'sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae',pull-policy:IfNotPresent},resources:{cpu:2,memory:4Gi,disk:20Gi},agent-identity:{tenant-id:72f988bf-86f1-41af-91ab-2d7cd011db47,agent-id:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee},endpoints:[{name:http,port:8080}],domain:sandbox-member.testaifabric.contoso.com}}" - """ - - _aaz_info = { - "version": "2026-07-21-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, self._output) - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.fabric_name = AAZStrArg( - options=["--fabric-name"], - help="The name of the AgentFabric", - required=True, - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.member_name = AAZStrArg( - options=["--member-name"], - help="The name of the Member", - required=True, - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.workload = AAZObjectArg( - options=["--workload"], - arg_group="Properties", - help="The workload configuration of the member. Set at creation and immutable thereafter; to change the workload, delete and recreate the member.", - ) - - workload = cls._args_schema.workload - workload.aci = AAZObjectArg( - options=["aci"], - ) - workload.agent_fabric_sandbox = AAZObjectArg( - options=["agent-fabric-sandbox"], - ) - - aci = cls._args_schema.workload.aci - aci.resource_id = AAZResourceIdArg( - options=["resource-id"], - help="The Azure Resource Manager resource ID of the Azure Container Instances (ACI) container group backing this member's sandbox.", - required=True, - ) - - agent_fabric_sandbox = cls._args_schema.workload.agent_fabric_sandbox - agent_fabric_sandbox.agent_identity = AAZObjectArg( - options=["agent-identity"], - help="The Entra agent identity associated with the workload.", - ) - agent_fabric_sandbox.domain = AAZStrArg( - options=["domain"], - help="The resolvable DNS name assigned to the workload.", - required=True, - ) - agent_fabric_sandbox.endpoints = AAZListArg( - options=["endpoints"], - help="The network endpoints exposed by the workload.", - ) - agent_fabric_sandbox.image = AAZObjectArg( - options=["image"], - help="The container image to run for the workload.", - required=True, - ) - agent_fabric_sandbox.resources = AAZObjectArg( - options=["resources"], - help="The compute resources allocated to the workload.", - required=True, - ) - - agent_identity = cls._args_schema.workload.agent_fabric_sandbox.agent_identity - agent_identity.agent_id = AAZStrArg( - options=["agent-id"], - help="The Entra agent ID representing the workload's identity.", - required=True, - ) - agent_identity.tenant_id = AAZStrArg( - options=["tenant-id"], - help="The Azure tenant ID that owns the agent identity.", - required=True, - ) - - endpoints = cls._args_schema.workload.agent_fabric_sandbox.endpoints - endpoints.Element = AAZObjectArg() - - _element = cls._args_schema.workload.agent_fabric_sandbox.endpoints.Element - _element.name = AAZStrArg( - options=["name"], - help="The name of the endpoint.", - required=True, - ) - _element.port = AAZIntArg( - options=["port"], - help="The port the endpoint listens on.", - required=True, - ) - - image = cls._args_schema.workload.agent_fabric_sandbox.image - image.digest = AAZStrArg( - options=["digest"], - help="The image content digest used to pin an exact image version.", - ) - image.pull_policy = AAZStrArg( - options=["pull-policy"], - help="The policy controlling when the image is pulled.", - enum={"Always": "Always", "IfNotPresent": "IfNotPresent"}, - ) - image.uri = AAZStrArg( - options=["uri"], - help="The image reference URI (e.g., registry/repository:tag).", - required=True, - ) - - resources = cls._args_schema.workload.agent_fabric_sandbox.resources - resources.cpu = AAZStrArg( - options=["cpu"], - help="The amount of CPU to allocate to the workload.", - required=True, - ) - resources.disk = AAZStrArg( - options=["disk"], - help="The amount of disk to allocate to the workload.", - ) - resources.memory = AAZStrArg( - options=["memory"], - help="The amount of memory to allocate to the workload.", - required=True, - ) - - # define Arg Group "Resource" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Resource", - help="The geo-location where the resource lives", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Resource", - help="Resource tags.", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.MembersCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class MembersCreateOrUpdate(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/members/{memberName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "agentFabricName", self.ctx.args.fabric_name, - required=True, - ), - **self.serialize_url_param( - "memberName", self.ctx.args.member_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Content-Type", "application/json", - ), - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - @property - def content(self): - _content_value, _builder = self.new_content_builder( - self.ctx.args, - typ=AAZObjectType, - typ_kwargs={"flags": {"required": True, "client_flatten": True}} - ) - _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("workload", AAZObjectType, ".workload") - - workload = _builder.get(".properties.workload") - if workload is not None: - workload.set_const("type", "ACI", AAZStrType, ".aci", typ_kwargs={"flags": {"required": True}}) - workload.set_const("type", "AgentFabricSandbox", AAZStrType, ".agent_fabric_sandbox", typ_kwargs={"flags": {"required": True}}) - workload.discriminate_by("type", "ACI") - workload.discriminate_by("type", "AgentFabricSandbox") - - disc_aci = _builder.get(".properties.workload{type:ACI}") - if disc_aci is not None: - disc_aci.set_prop("resourceId", AAZStrType, ".aci.resource_id", typ_kwargs={"flags": {"required": True}}) - - disc_agent_fabric_sandbox = _builder.get(".properties.workload{type:AgentFabricSandbox}") - if disc_agent_fabric_sandbox is not None: - disc_agent_fabric_sandbox.set_prop("agentIdentity", AAZObjectType, ".agent_fabric_sandbox.agent_identity") - disc_agent_fabric_sandbox.set_prop("domain", AAZStrType, ".agent_fabric_sandbox.domain", typ_kwargs={"flags": {"required": True}}) - disc_agent_fabric_sandbox.set_prop("endpoints", AAZListType, ".agent_fabric_sandbox.endpoints") - disc_agent_fabric_sandbox.set_prop("image", AAZObjectType, ".agent_fabric_sandbox.image", typ_kwargs={"flags": {"required": True}}) - disc_agent_fabric_sandbox.set_prop("resources", AAZObjectType, ".agent_fabric_sandbox.resources", typ_kwargs={"flags": {"required": True}}) - - agent_identity = _builder.get(".properties.workload{type:AgentFabricSandbox}.agentIdentity") - if agent_identity is not None: - agent_identity.set_prop("agentId", AAZStrType, ".agent_id", typ_kwargs={"flags": {"required": True}}) - agent_identity.set_prop("tenantId", AAZStrType, ".tenant_id", typ_kwargs={"flags": {"required": True}}) - - endpoints = _builder.get(".properties.workload{type:AgentFabricSandbox}.endpoints") - if endpoints is not None: - endpoints.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.workload{type:AgentFabricSandbox}.endpoints[]") - if _elements is not None: - _elements.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) - _elements.set_prop("port", AAZIntType, ".port", typ_kwargs={"flags": {"required": True}}) - - image = _builder.get(".properties.workload{type:AgentFabricSandbox}.image") - if image is not None: - image.set_prop("digest", AAZStrType, ".digest") - image.set_prop("pullPolicy", AAZStrType, ".pull_policy") - image.set_prop("uri", AAZStrType, ".uri", typ_kwargs={"flags": {"required": True}}) - - resources = _builder.get(".properties.workload{type:AgentFabricSandbox}.resources") - if resources is not None: - resources.set_prop("cpu", AAZStrType, ".cpu", typ_kwargs={"flags": {"required": True}}) - resources.set_prop("disk", AAZStrType, ".disk") - resources.set_prop("memory", AAZStrType, ".memory", typ_kwargs={"flags": {"required": True}}) - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - - _schema_on_200_201 = cls._schema_on_200_201 - _schema_on_200_201.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200_201.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.properties = AAZObjectType() - _schema_on_200_201.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _schema_on_200_201.tags = AAZDictType() - _schema_on_200_201.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200_201.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.spiffe_id = AAZStrType( - serialized_name="spiffeId", - flags={"read_only": True}, - ) - properties.workload = AAZObjectType() - - workload = cls._schema_on_200_201.properties.workload - workload.type = AAZStrType( - flags={"required": True}, - ) - workload.workload_id = AAZStrType( - serialized_name="workloadId", - flags={"read_only": True}, - ) - - disc_aci = cls._schema_on_200_201.properties.workload.discriminate_by("type", "ACI") - disc_aci.resource_id = AAZStrType( - serialized_name="resourceId", - flags={"required": True}, - ) - - disc_agent_fabric_sandbox = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox") - disc_agent_fabric_sandbox.agent_identity = AAZObjectType( - serialized_name="agentIdentity", - ) - disc_agent_fabric_sandbox.domain = AAZStrType( - flags={"required": True}, - ) - disc_agent_fabric_sandbox.endpoints = AAZListType() - disc_agent_fabric_sandbox.image = AAZObjectType( - flags={"required": True}, - ) - disc_agent_fabric_sandbox.resources = AAZObjectType( - flags={"required": True}, - ) - - agent_identity = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox").agent_identity - agent_identity.agent_id = AAZStrType( - serialized_name="agentId", - flags={"required": True}, - ) - agent_identity.tenant_id = AAZStrType( - serialized_name="tenantId", - flags={"required": True}, - ) - - endpoints = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints - endpoints.Element = AAZObjectType() - - _element = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints.Element - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.port = AAZIntType( - flags={"required": True}, - ) - - image = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox").image - image.digest = AAZStrType() - image.pull_policy = AAZStrType( - serialized_name="pullPolicy", - ) - image.uri = AAZStrType( - flags={"required": True}, - ) - - resources = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox").resources - resources.cpu = AAZStrType( - flags={"required": True}, - ) - resources.disk = AAZStrType() - resources.memory = AAZStrType( - flags={"required": True}, - ) - - system_data = cls._schema_on_200_201.system_data - system_data.created_at = AAZStrType( - serialized_name="createdAt", - ) - system_data.created_by = AAZStrType( - serialized_name="createdBy", - ) - system_data.created_by_type = AAZStrType( - serialized_name="createdByType", - ) - system_data.last_modified_at = AAZStrType( - serialized_name="lastModifiedAt", - ) - system_data.last_modified_by = AAZStrType( - serialized_name="lastModifiedBy", - ) - system_data.last_modified_by_type = AAZStrType( - serialized_name="lastModifiedByType", - ) - - tags = cls._schema_on_200_201.tags - tags.Element = AAZStrType() - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - -__all__ = ["Create"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_delete.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_delete.py deleted file mode 100644 index 49302597e98..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_delete.py +++ /dev/null @@ -1,179 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh fabric member delete", - confirmation="Are you sure you want to perform this operation?", -) -class Delete(AAZCommand): - """Delete a member from an Agent Mesh fabric - - :example: Members_Delete - az agentmesh fabric member delete --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name testMember - """ - - _aaz_info = { - "version": "2026-07-21-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.fabric_name = AAZStrArg( - options=["--fabric-name"], - help="The name of the AgentFabric", - required=True, - id_part="name", - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.member_name = AAZStrArg( - options=["--member-name"], - help="The name of the Member", - required=True, - id_part="child_name_1", - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.MembersDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class MembersDelete(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/members/{memberName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "agentFabricName", self.ctx.args.fabric_name, - required=True, - ), - **self.serialize_url_param( - "memberName", self.ctx.args.member_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - def on_204(self, session): - pass - - def on_200_201(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_list.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_list.py deleted file mode 100644 index 7839c3a8345..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_list.py +++ /dev/null @@ -1,300 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh fabric member list", -) -class List(AAZCommand): - """List members in an Agent Mesh fabric - - :example: Members_ListByParent - az agentmesh fabric member list --resource-group rgnetworksecurity --fabric-name testAIFabric - """ - - _aaz_info = { - "version": "2026-07-21-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members", "2026-07-21-preview"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, self._output) - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.fabric_name = AAZStrArg( - options=["--fabric-name"], - help="The name of the AgentFabric", - required=True, - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.MembersListByParent(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class MembersListByParent(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [200]: - return self.on_200(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/members", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "agentFabricName", self.ctx.args.fabric_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - def on_200(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200 - ) - - _schema_on_200 = None - - @classmethod - def _build_schema_on_200(cls): - if cls._schema_on_200 is not None: - return cls._schema_on_200 - - cls._schema_on_200 = AAZObjectType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType() - _element.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.spiffe_id = AAZStrType( - serialized_name="spiffeId", - flags={"read_only": True}, - ) - properties.workload = AAZObjectType() - - workload = cls._schema_on_200.value.Element.properties.workload - workload.type = AAZStrType( - flags={"required": True}, - ) - workload.workload_id = AAZStrType( - serialized_name="workloadId", - flags={"read_only": True}, - ) - - disc_aci = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "ACI") - disc_aci.resource_id = AAZStrType( - serialized_name="resourceId", - flags={"required": True}, - ) - - disc_agent_fabric_sandbox = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox") - disc_agent_fabric_sandbox.agent_identity = AAZObjectType( - serialized_name="agentIdentity", - ) - disc_agent_fabric_sandbox.domain = AAZStrType( - flags={"required": True}, - ) - disc_agent_fabric_sandbox.endpoints = AAZListType() - disc_agent_fabric_sandbox.image = AAZObjectType( - flags={"required": True}, - ) - disc_agent_fabric_sandbox.resources = AAZObjectType( - flags={"required": True}, - ) - - agent_identity = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox").agent_identity - agent_identity.agent_id = AAZStrType( - serialized_name="agentId", - flags={"required": True}, - ) - agent_identity.tenant_id = AAZStrType( - serialized_name="tenantId", - flags={"required": True}, - ) - - endpoints = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints - endpoints.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints.Element - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.port = AAZIntType( - flags={"required": True}, - ) - - image = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox").image - image.digest = AAZStrType() - image.pull_policy = AAZStrType( - serialized_name="pullPolicy", - ) - image.uri = AAZStrType( - flags={"required": True}, - ) - - resources = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox").resources - resources.cpu = AAZStrType( - flags={"required": True}, - ) - resources.disk = AAZStrType() - resources.memory = AAZStrType( - flags={"required": True}, - ) - - system_data = cls._schema_on_200.value.Element.system_data - system_data.created_at = AAZStrType( - serialized_name="createdAt", - ) - system_data.created_by = AAZStrType( - serialized_name="createdBy", - ) - system_data.created_by_type = AAZStrType( - serialized_name="createdByType", - ) - system_data.last_modified_at = AAZStrType( - serialized_name="lastModifiedAt", - ) - system_data.last_modified_by = AAZStrType( - serialized_name="lastModifiedBy", - ) - system_data.last_modified_by_type = AAZStrType( - serialized_name="lastModifiedByType", - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - -__all__ = ["List"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_show.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_show.py deleted file mode 100644 index b8be0d21474..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_show.py +++ /dev/null @@ -1,301 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh fabric member show", -) -class Show(AAZCommand): - """Get a member in an Agent Mesh fabric - - :example: Members_Get - az agentmesh fabric member show --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name testMember - """ - - _aaz_info = { - "version": "2026-07-21-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return self._output() - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.fabric_name = AAZStrArg( - options=["--fabric-name"], - help="The name of the AgentFabric", - required=True, - id_part="name", - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.member_name = AAZStrArg( - options=["--member-name"], - help="The name of the Member", - required=True, - id_part="child_name_1", - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.MembersGet(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class MembersGet(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [200]: - return self.on_200(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/members/{memberName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "agentFabricName", self.ctx.args.fabric_name, - required=True, - ), - **self.serialize_url_param( - "memberName", self.ctx.args.member_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - def on_200(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200 - ) - - _schema_on_200 = None - - @classmethod - def _build_schema_on_200(cls): - if cls._schema_on_200 is not None: - return cls._schema_on_200 - - cls._schema_on_200 = AAZObjectType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType() - _schema_on_200.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.spiffe_id = AAZStrType( - serialized_name="spiffeId", - flags={"read_only": True}, - ) - properties.workload = AAZObjectType() - - workload = cls._schema_on_200.properties.workload - workload.type = AAZStrType( - flags={"required": True}, - ) - workload.workload_id = AAZStrType( - serialized_name="workloadId", - flags={"read_only": True}, - ) - - disc_aci = cls._schema_on_200.properties.workload.discriminate_by("type", "ACI") - disc_aci.resource_id = AAZStrType( - serialized_name="resourceId", - flags={"required": True}, - ) - - disc_agent_fabric_sandbox = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox") - disc_agent_fabric_sandbox.agent_identity = AAZObjectType( - serialized_name="agentIdentity", - ) - disc_agent_fabric_sandbox.domain = AAZStrType( - flags={"required": True}, - ) - disc_agent_fabric_sandbox.endpoints = AAZListType() - disc_agent_fabric_sandbox.image = AAZObjectType( - flags={"required": True}, - ) - disc_agent_fabric_sandbox.resources = AAZObjectType( - flags={"required": True}, - ) - - agent_identity = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").agent_identity - agent_identity.agent_id = AAZStrType( - serialized_name="agentId", - flags={"required": True}, - ) - agent_identity.tenant_id = AAZStrType( - serialized_name="tenantId", - flags={"required": True}, - ) - - endpoints = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints - endpoints.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints.Element - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.port = AAZIntType( - flags={"required": True}, - ) - - image = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").image - image.digest = AAZStrType() - image.pull_policy = AAZStrType( - serialized_name="pullPolicy", - ) - image.uri = AAZStrType( - flags={"required": True}, - ) - - resources = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").resources - resources.cpu = AAZStrType( - flags={"required": True}, - ) - resources.disk = AAZStrType() - resources.memory = AAZStrType( - flags={"required": True}, - ) - - system_data = cls._schema_on_200.system_data - system_data.created_at = AAZStrType( - serialized_name="createdAt", - ) - system_data.created_by = AAZStrType( - serialized_name="createdBy", - ) - system_data.created_by_type = AAZStrType( - serialized_name="createdByType", - ) - system_data.last_modified_at = AAZStrType( - serialized_name="lastModifiedAt", - ) - system_data.last_modified_by = AAZStrType( - serialized_name="lastModifiedBy", - ) - system_data.last_modified_by_type = AAZStrType( - serialized_name="lastModifiedByType", - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_update.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_update.py deleted file mode 100644 index ca7deac0548..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_update.py +++ /dev/null @@ -1,348 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh fabric member update", -) -class Update(AAZCommand): - """Update an Agent Mesh fabric member's tags - - :example: Members_Update - az agentmesh fabric member update --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name testMember --tags "{environment:production}" - """ - - _aaz_info = { - "version": "2026-07-21-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, self._output) - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.fabric_name = AAZStrArg( - options=["--fabric-name"], - help="The name of the AgentFabric", - required=True, - id_part="name", - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.member_name = AAZStrArg( - options=["--member-name"], - help="The name of the Member", - required=True, - id_part="child_name_1", - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Properties", - help="Resource tags.", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.MembersUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class MembersUpdate(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/members/{memberName}", - **self.url_parameters - ) - - @property - def method(self): - return "PATCH" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "agentFabricName", self.ctx.args.fabric_name, - required=True, - ), - **self.serialize_url_param( - "memberName", self.ctx.args.member_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Content-Type", "application/json", - ), - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - @property - def content(self): - _content_value, _builder = self.new_content_builder( - self.ctx.args, - typ=AAZObjectType, - typ_kwargs={"flags": {"required": True, "client_flatten": True}} - ) - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200 - ) - - _schema_on_200 = None - - @classmethod - def _build_schema_on_200(cls): - if cls._schema_on_200 is not None: - return cls._schema_on_200 - - cls._schema_on_200 = AAZObjectType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType() - _schema_on_200.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.spiffe_id = AAZStrType( - serialized_name="spiffeId", - flags={"read_only": True}, - ) - properties.workload = AAZObjectType() - - workload = cls._schema_on_200.properties.workload - workload.type = AAZStrType( - flags={"required": True}, - ) - workload.workload_id = AAZStrType( - serialized_name="workloadId", - flags={"read_only": True}, - ) - - disc_aci = cls._schema_on_200.properties.workload.discriminate_by("type", "ACI") - disc_aci.resource_id = AAZStrType( - serialized_name="resourceId", - flags={"required": True}, - ) - - disc_agent_fabric_sandbox = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox") - disc_agent_fabric_sandbox.agent_identity = AAZObjectType( - serialized_name="agentIdentity", - ) - disc_agent_fabric_sandbox.domain = AAZStrType( - flags={"required": True}, - ) - disc_agent_fabric_sandbox.endpoints = AAZListType() - disc_agent_fabric_sandbox.image = AAZObjectType( - flags={"required": True}, - ) - disc_agent_fabric_sandbox.resources = AAZObjectType( - flags={"required": True}, - ) - - agent_identity = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").agent_identity - agent_identity.agent_id = AAZStrType( - serialized_name="agentId", - flags={"required": True}, - ) - agent_identity.tenant_id = AAZStrType( - serialized_name="tenantId", - flags={"required": True}, - ) - - endpoints = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints - endpoints.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints.Element - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.port = AAZIntType( - flags={"required": True}, - ) - - image = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").image - image.digest = AAZStrType() - image.pull_policy = AAZStrType( - serialized_name="pullPolicy", - ) - image.uri = AAZStrType( - flags={"required": True}, - ) - - resources = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").resources - resources.cpu = AAZStrType( - flags={"required": True}, - ) - resources.disk = AAZStrType() - resources.memory = AAZStrType( - flags={"required": True}, - ) - - system_data = cls._schema_on_200.system_data - system_data.created_at = AAZStrType( - serialized_name="createdAt", - ) - system_data.created_by = AAZStrType( - serialized_name="createdBy", - ) - system_data.created_by_type = AAZStrType( - serialized_name="createdByType", - ) - system_data.last_modified_at = AAZStrType( - serialized_name="lastModifiedAt", - ) - system_data.last_modified_by = AAZStrType( - serialized_name="lastModifiedBy", - ) - system_data.last_modified_by_type = AAZStrType( - serialized_name="lastModifiedByType", - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _UpdateHelper: - """Helper class for Update""" - - -__all__ = ["Update"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_wait.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_wait.py deleted file mode 100644 index 21cb09dd8a0..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/fabric/member/_wait.py +++ /dev/null @@ -1,297 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh fabric member wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return self._output() - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.fabric_name = AAZStrArg( - options=["--fabric-name"], - help="The name of the AgentFabric", - required=True, - id_part="name", - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.member_name = AAZStrArg( - options=["--member-name"], - help="The name of the Member", - required=True, - id_part="child_name_1", - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.MembersGet(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) - return result - - class MembersGet(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [200]: - return self.on_200(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/members/{memberName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "agentFabricName", self.ctx.args.fabric_name, - required=True, - ), - **self.serialize_url_param( - "memberName", self.ctx.args.member_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - def on_200(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200 - ) - - _schema_on_200 = None - - @classmethod - def _build_schema_on_200(cls): - if cls._schema_on_200 is not None: - return cls._schema_on_200 - - cls._schema_on_200 = AAZObjectType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType() - _schema_on_200.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.spiffe_id = AAZStrType( - serialized_name="spiffeId", - flags={"read_only": True}, - ) - properties.workload = AAZObjectType() - - workload = cls._schema_on_200.properties.workload - workload.type = AAZStrType( - flags={"required": True}, - ) - workload.workload_id = AAZStrType( - serialized_name="workloadId", - flags={"read_only": True}, - ) - - disc_aci = cls._schema_on_200.properties.workload.discriminate_by("type", "ACI") - disc_aci.resource_id = AAZStrType( - serialized_name="resourceId", - flags={"required": True}, - ) - - disc_agent_fabric_sandbox = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox") - disc_agent_fabric_sandbox.agent_identity = AAZObjectType( - serialized_name="agentIdentity", - ) - disc_agent_fabric_sandbox.domain = AAZStrType( - flags={"required": True}, - ) - disc_agent_fabric_sandbox.endpoints = AAZListType() - disc_agent_fabric_sandbox.image = AAZObjectType( - flags={"required": True}, - ) - disc_agent_fabric_sandbox.resources = AAZObjectType( - flags={"required": True}, - ) - - agent_identity = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").agent_identity - agent_identity.agent_id = AAZStrType( - serialized_name="agentId", - flags={"required": True}, - ) - agent_identity.tenant_id = AAZStrType( - serialized_name="tenantId", - flags={"required": True}, - ) - - endpoints = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints - endpoints.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").endpoints.Element - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.port = AAZIntType( - flags={"required": True}, - ) - - image = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").image - image.digest = AAZStrType() - image.pull_policy = AAZStrType( - serialized_name="pullPolicy", - ) - image.uri = AAZStrType( - flags={"required": True}, - ) - - resources = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox").resources - resources.cpu = AAZStrType( - flags={"required": True}, - ) - resources.disk = AAZStrType() - resources.memory = AAZStrType( - flags={"required": True}, - ) - - system_data = cls._schema_on_200.system_data - system_data.created_at = AAZStrType( - serialized_name="createdAt", - ) - system_data.created_by = AAZStrType( - serialized_name="createdBy", - ) - system_data.created_by_type = AAZStrType( - serialized_name="createdByType", - ) - system_data.last_modified_at = AAZStrType( - serialized_name="lastModifiedAt", - ) - system_data.last_modified_by = AAZStrType( - serialized_name="lastModifiedBy", - ) - system_data.last_modified_by_type = AAZStrType( - serialized_name="lastModifiedByType", - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - -__all__ = ["Wait"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/__cmd_group.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/__cmd_group.py deleted file mode 100644 index 81a3e9225f8..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh policy-group", -) -class __CMDGroup(AAZCommandGroup): - """Manage Agent Mesh policy groups. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/__init__.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/__init__.py deleted file mode 100644 index db73033039b..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_create.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_create.py deleted file mode 100644 index 0a5eb2bfbdb..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_create.py +++ /dev/null @@ -1,1332 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh policy-group create", -) -class Create(AAZCommand): - """Create an Agent Mesh policy group - - :example: PolicyGroups_CreateOrUpdate - az agentmesh policy-group create --resource-group rgnetworksecurity --name testPolicyGroup --location eastus --tags "{env:test}" --display-name "Test Policy Group" --description "A policy group for testing" --priority 100 --network-security-policies "[{fqdn-filtering:{name:allowOutbound,priority:10,direction:Outbound,ports:[443,80],source:{workload-id-patterns:{patterns:[workload1,workload2]}},destination:{fqdns:{fqdns:[example.com,contoso.com]}}}}]" - - :example: PolicyGroups_CreateOrUpdate_ContentInspection - az agentmesh policy-group create --resource-group rgnetworksecurity --name contentInspectionGroup --location eastus --tags "{env:test}" --display-name "Content Inspection Policy Group" --description "A policy group demonstrating content inspection policies" --priority 100 --network-security-policies "[{content-inspection:{source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},prompt-injection-protection:{sensitivity:High,prompt-locations:['$.messages[*].content','$.input'],response-locations:['$.choices[*].message.content'],on-detection:BlockAndAlert}}}]" - - :example: PolicyGroups_CreateOrUpdate_Mcp - az agentmesh policy-group create --resource-group rgnetworksecurity --name mcpPolicyGroup --location eastus --tags "{env:test}" --display-name "MCP Policy Group" --description "A policy group demonstrating MCP server policies" --priority 100 --network-security-policies "[{mcp:{default-action:Deny,source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},destination:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/mcp/sa/*']}},rules:[{action:Allow,tools:[search,fetch]},{action:Deny,tools:[deleteFile]}]}},{mcp:{default-action:Allow,source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},destination:{fqdns:{fqdns:[mcp.contoso.com]}},rules:[{action:Deny,tools:[executeShell,writeFile]}]}},{mcp:{default-action:Deny,source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},destination:{address-prefixes:{prefixes:[10.0.0.0/24]}},rules:[{action:Allow,tools:[listResources,readResource]}]}}]" - - :example: PolicyGroups_CreateOrUpdate_TlsInspection - az agentmesh policy-group create --resource-group rgnetworksecurity --name tlsInspectionPolicyGroup --location eastus --tags "{env:test}" --display-name "TLS Inspection Policy Group" --description "A policy group demonstrating TLS inspection policies" --priority 100 --network-security-policies "[{tls-inspection:{source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},certificate:{azure-managed-ca:{}}}}]" - - :example: PolicyGroups_CreateOrUpdate_UrlFiltering - az agentmesh policy-group create --resource-group rgnetworksecurity --name urlFilteringPolicyGroup --location eastus --tags "{env:test}" --display-name "URL Filtering Policy Group" --description "A policy group demonstrating URL filtering" --priority 100 --network-security-policies "[{url-filtering:{default-action:Deny,source:{address-prefixes:{prefixes:[10.0.0.0/24]}},destination:{fqdns:{fqdns:[api.contoso.com]}},rules:[{name:allowProductApi,priority:10,hostname:api.contoso.com,method:GET,paths:['/v1/products','/v1/products/*'],action:Allow},{name:denyAdmin,priority:20,paths:['/admin/*'],action:Deny}]}}]" - """ - - _aaz_info = { - "version": "2026-07-21-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, self._output) - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The name of the PolicyGroup", - required=True, - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.description = AAZStrArg( - options=["--description"], - arg_group="Properties", - help="The description of the policy group.", - ) - _args_schema.display_name = AAZStrArg( - options=["--display-name"], - arg_group="Properties", - help="The display name of the policy group.", - ) - _args_schema.network_security_policies = AAZListArg( - options=["--network-security-policies"], - arg_group="Properties", - help="The list of network security policies.", - ) - _args_schema.priority = AAZIntArg( - options=["--priority"], - arg_group="Properties", - help="The priority of the policy group.", - ) - - network_security_policies = cls._args_schema.network_security_policies - network_security_policies.Element = AAZObjectArg() - - _element = cls._args_schema.network_security_policies.Element - _element.content_inspection = AAZObjectArg( - options=["content-inspection"], - ) - _element.fqdn_filtering = AAZObjectArg( - options=["fqdn-filtering"], - ) - _element.mcp = AAZObjectArg( - options=["mcp"], - ) - _element.tls_inspection = AAZObjectArg( - options=["tls-inspection"], - ) - _element.url_filtering = AAZObjectArg( - options=["url-filtering"], - ) - - content_inspection = cls._args_schema.network_security_policies.Element.content_inspection - content_inspection.prompt_injection_protection = AAZObjectArg( - options=["prompt-injection-protection"], - help="The prompt injection protection configuration.", - ) - content_inspection.source = AAZObjectArg( - options=["source"], - help="The source details for the policy.", - required=True, - ) - - prompt_injection_protection = cls._args_schema.network_security_policies.Element.content_inspection.prompt_injection_protection - prompt_injection_protection.on_detection = AAZStrArg( - options=["on-detection"], - help="The action to take when prompt injection is detected.", - required=True, - enum={"Alert": "Alert", "BlockAndAlert": "BlockAndAlert", "Sanitize": "Sanitize"}, - ) - prompt_injection_protection.prompt_locations = AAZListArg( - options=["prompt-locations"], - help="The JSONPath expressions selecting the parts of the request body to scan for prompt injection.", - ) - prompt_injection_protection.response_locations = AAZListArg( - options=["response-locations"], - help="The JSONPath expressions selecting the parts of the response body to scan for prompt injection.", - ) - prompt_injection_protection.sensitivity = AAZStrArg( - options=["sensitivity"], - help="The sensitivity level of prompt injection detection.", - enum={"High": "High", "Low": "Low", "Medium": "Medium"}, - ) - - prompt_locations = cls._args_schema.network_security_policies.Element.content_inspection.prompt_injection_protection.prompt_locations - prompt_locations.Element = AAZStrArg() - - response_locations = cls._args_schema.network_security_policies.Element.content_inspection.prompt_injection_protection.response_locations - response_locations.Element = AAZStrArg() - - source = cls._args_schema.network_security_policies.Element.content_inspection.source - source.address_prefixes = AAZObjectArg( - options=["address-prefixes"], - ) - source.workload_id_patterns = AAZObjectArg( - options=["workload-id-patterns"], - ) - - address_prefixes = cls._args_schema.network_security_policies.Element.content_inspection.source.address_prefixes - address_prefixes.prefixes = AAZListArg( - options=["prefixes"], - help="The IP address prefixes, in CIDR notation, that identify the source(s).", - required=True, - ) - - prefixes = cls._args_schema.network_security_policies.Element.content_inspection.source.address_prefixes.prefixes - prefixes.Element = AAZStrArg() - - workload_id_patterns = cls._args_schema.network_security_policies.Element.content_inspection.source.workload_id_patterns - workload_id_patterns.patterns = AAZListArg( - options=["patterns"], - help="The workload ID patterns that identify the source(s).", - required=True, - ) - - patterns = cls._args_schema.network_security_policies.Element.content_inspection.source.workload_id_patterns.patterns - patterns.Element = AAZStrArg() - - fqdn_filtering = cls._args_schema.network_security_policies.Element.fqdn_filtering - fqdn_filtering.destination = AAZObjectArg( - options=["destination"], - help="The destination details for the policy.", - ) - fqdn_filtering.direction = AAZStrArg( - options=["direction"], - help="The direction of traffic for the policy.", - enum={"Both": "Both", "Inbound": "Inbound", "Outbound": "Outbound"}, - ) - fqdn_filtering.name = AAZStrArg( - options=["name"], - help="The name of the policy.", - ) - fqdn_filtering.ports = AAZListArg( - options=["ports"], - help="The ports for the policy.", - ) - fqdn_filtering.priority = AAZIntArg( - options=["priority"], - help="The priority of the policy.", - ) - fqdn_filtering.source = AAZObjectArg( - options=["source"], - help="The source details for the policy.", - required=True, - ) - - destination = cls._args_schema.network_security_policies.Element.fqdn_filtering.destination - destination.fqdns = AAZObjectArg( - options=["fqdns"], - ) - - fqdns = cls._args_schema.network_security_policies.Element.fqdn_filtering.destination.fqdns - fqdns.fqdns = AAZListArg( - options=["fqdns"], - help="The fully qualified domain names that identify the destination(s).", - required=True, - ) - - fqdns = cls._args_schema.network_security_policies.Element.fqdn_filtering.destination.fqdns.fqdns - fqdns.Element = AAZStrArg() - - ports = cls._args_schema.network_security_policies.Element.fqdn_filtering.ports - ports.Element = AAZIntArg() - - source = cls._args_schema.network_security_policies.Element.fqdn_filtering.source - source.address_prefixes = AAZObjectArg( - options=["address-prefixes"], - ) - source.workload_id_patterns = AAZObjectArg( - options=["workload-id-patterns"], - ) - - address_prefixes = cls._args_schema.network_security_policies.Element.fqdn_filtering.source.address_prefixes - address_prefixes.prefixes = AAZListArg( - options=["prefixes"], - help="The IP address prefixes, in CIDR notation, that identify the source(s).", - required=True, - ) - - prefixes = cls._args_schema.network_security_policies.Element.fqdn_filtering.source.address_prefixes.prefixes - prefixes.Element = AAZStrArg() - - workload_id_patterns = cls._args_schema.network_security_policies.Element.fqdn_filtering.source.workload_id_patterns - workload_id_patterns.patterns = AAZListArg( - options=["patterns"], - help="The workload ID patterns that identify the source(s).", - required=True, - ) - - patterns = cls._args_schema.network_security_policies.Element.fqdn_filtering.source.workload_id_patterns.patterns - patterns.Element = AAZStrArg() - - mcp = cls._args_schema.network_security_policies.Element.mcp - mcp.default_action = AAZStrArg( - options=["default-action"], - help="The default action to take when no rule in the policy matches.", - required=True, - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - mcp.destination = AAZObjectArg( - options=["destination"], - help="The MCP server(s) that this policy applies to.", - required=True, - ) - mcp.rules = AAZListArg( - options=["rules"], - help="The list of MCP rules.", - required=True, - ) - mcp.source = AAZObjectArg( - options=["source"], - help="The source(s) that this policy applies to.", - required=True, - ) - - destination = cls._args_schema.network_security_policies.Element.mcp.destination - destination.address_prefixes = AAZObjectArg( - options=["address-prefixes"], - ) - destination.fqdns = AAZObjectArg( - options=["fqdns"], - ) - destination.workload_id_patterns = AAZObjectArg( - options=["workload-id-patterns"], - ) - - address_prefixes = cls._args_schema.network_security_policies.Element.mcp.destination.address_prefixes - address_prefixes.prefixes = AAZListArg( - options=["prefixes"], - help="The IP address prefixes, in CIDR notation, that identify the destination(s).", - required=True, - ) - - prefixes = cls._args_schema.network_security_policies.Element.mcp.destination.address_prefixes.prefixes - prefixes.Element = AAZStrArg() - - fqdns = cls._args_schema.network_security_policies.Element.mcp.destination.fqdns - fqdns.fqdns = AAZListArg( - options=["fqdns"], - help="The fully qualified domain names that identify the destination(s).", - required=True, - ) - - fqdns = cls._args_schema.network_security_policies.Element.mcp.destination.fqdns.fqdns - fqdns.Element = AAZStrArg() - - workload_id_patterns = cls._args_schema.network_security_policies.Element.mcp.destination.workload_id_patterns - workload_id_patterns.patterns = AAZListArg( - options=["patterns"], - help="The workload ID patterns that identify the destination(s).", - required=True, - ) - - patterns = cls._args_schema.network_security_policies.Element.mcp.destination.workload_id_patterns.patterns - patterns.Element = AAZStrArg() - - rules = cls._args_schema.network_security_policies.Element.mcp.rules - rules.Element = AAZObjectArg() - - _element = cls._args_schema.network_security_policies.Element.mcp.rules.Element - _element.action = AAZStrArg( - options=["action"], - help="The action to take for the specified MCP tools.", - required=True, - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - _element.tools = AAZListArg( - options=["tools"], - help="The MCP tool names that the rule applies to.", - required=True, - ) - - tools = cls._args_schema.network_security_policies.Element.mcp.rules.Element.tools - tools.Element = AAZStrArg() - - source = cls._args_schema.network_security_policies.Element.mcp.source - source.address_prefixes = AAZObjectArg( - options=["address-prefixes"], - ) - source.workload_id_patterns = AAZObjectArg( - options=["workload-id-patterns"], - ) - - address_prefixes = cls._args_schema.network_security_policies.Element.mcp.source.address_prefixes - address_prefixes.prefixes = AAZListArg( - options=["prefixes"], - help="The IP address prefixes, in CIDR notation, that identify the source(s).", - required=True, - ) - - prefixes = cls._args_schema.network_security_policies.Element.mcp.source.address_prefixes.prefixes - prefixes.Element = AAZStrArg() - - workload_id_patterns = cls._args_schema.network_security_policies.Element.mcp.source.workload_id_patterns - workload_id_patterns.patterns = AAZListArg( - options=["patterns"], - help="The workload ID patterns that identify the source(s).", - required=True, - ) - - patterns = cls._args_schema.network_security_policies.Element.mcp.source.workload_id_patterns.patterns - patterns.Element = AAZStrArg() - - tls_inspection = cls._args_schema.network_security_policies.Element.tls_inspection - tls_inspection.certificate = AAZObjectArg( - options=["certificate"], - help="The certificate configuration used for TLS inspection.", - required=True, - ) - tls_inspection.source = AAZObjectArg( - options=["source"], - help="The source details for the policy.", - required=True, - ) - - certificate = cls._args_schema.network_security_policies.Element.tls_inspection.certificate - certificate.azure_managed_ca = AAZObjectArg( - options=["azure-managed-ca"], - blank={}, - ) - - source = cls._args_schema.network_security_policies.Element.tls_inspection.source - source.workload_id_patterns = AAZObjectArg( - options=["workload-id-patterns"], - ) - - workload_id_patterns = cls._args_schema.network_security_policies.Element.tls_inspection.source.workload_id_patterns - workload_id_patterns.patterns = AAZListArg( - options=["patterns"], - help="The workload ID patterns that identify the source(s).", - required=True, - ) - - patterns = cls._args_schema.network_security_policies.Element.tls_inspection.source.workload_id_patterns.patterns - patterns.Element = AAZStrArg() - - url_filtering = cls._args_schema.network_security_policies.Element.url_filtering - url_filtering.default_action = AAZStrArg( - options=["default-action"], - help="The default action to take when no rule in the policy matches.", - required=True, - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - url_filtering.destination = AAZObjectArg( - options=["destination"], - help="The destination details for the policy.", - ) - url_filtering.rules = AAZListArg( - options=["rules"], - help="The list of URL filtering rules.", - required=True, - ) - url_filtering.source = AAZObjectArg( - options=["source"], - help="The source details for the policy.", - required=True, - ) - - destination = cls._args_schema.network_security_policies.Element.url_filtering.destination - destination.address_prefixes = AAZObjectArg( - options=["address-prefixes"], - ) - destination.fqdns = AAZObjectArg( - options=["fqdns"], - ) - destination.workload_id_patterns = AAZObjectArg( - options=["workload-id-patterns"], - ) - - address_prefixes = cls._args_schema.network_security_policies.Element.url_filtering.destination.address_prefixes - address_prefixes.prefixes = AAZListArg( - options=["prefixes"], - help="The IP address prefixes, in CIDR notation, that identify the destination(s).", - required=True, - ) - - prefixes = cls._args_schema.network_security_policies.Element.url_filtering.destination.address_prefixes.prefixes - prefixes.Element = AAZStrArg() - - fqdns = cls._args_schema.network_security_policies.Element.url_filtering.destination.fqdns - fqdns.fqdns = AAZListArg( - options=["fqdns"], - help="The fully qualified domain names that identify the destination(s).", - required=True, - ) - - fqdns = cls._args_schema.network_security_policies.Element.url_filtering.destination.fqdns.fqdns - fqdns.Element = AAZStrArg() - - workload_id_patterns = cls._args_schema.network_security_policies.Element.url_filtering.destination.workload_id_patterns - workload_id_patterns.patterns = AAZListArg( - options=["patterns"], - help="The workload ID patterns that identify the destination(s).", - required=True, - ) - - patterns = cls._args_schema.network_security_policies.Element.url_filtering.destination.workload_id_patterns.patterns - patterns.Element = AAZStrArg() - - rules = cls._args_schema.network_security_policies.Element.url_filtering.rules - rules.Element = AAZObjectArg() - - _element = cls._args_schema.network_security_policies.Element.url_filtering.rules.Element - _element.action = AAZStrArg( - options=["action"], - help="The action to take when the rule matches.", - required=True, - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - _element.hostname = AAZStrArg( - options=["hostname"], - help="The hostname matched by the rule. If omitted, the rule matches any hostname.", - ) - _element.method = AAZStrArg( - options=["method"], - help="The HTTP method matched by the rule. If omitted, the rule matches any method.", - enum={"DELETE": "DELETE", "GET": "GET", "HEAD": "HEAD", "OPTIONS": "OPTIONS", "PATCH": "PATCH", "POST": "POST", "PUT": "PUT"}, - ) - _element.name = AAZStrArg( - options=["name"], - help="The name of the rule.", - required=True, - ) - _element.paths = AAZListArg( - options=["paths"], - help="The URL paths matched by the rule. If omitted, the rule matches any path.", - ) - _element.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. Rules are evaluated in ascending priority order.", - required=True, - ) - - paths = cls._args_schema.network_security_policies.Element.url_filtering.rules.Element.paths - paths.Element = AAZStrArg() - - source = cls._args_schema.network_security_policies.Element.url_filtering.source - source.address_prefixes = AAZObjectArg( - options=["address-prefixes"], - ) - source.workload_id_patterns = AAZObjectArg( - options=["workload-id-patterns"], - ) - - address_prefixes = cls._args_schema.network_security_policies.Element.url_filtering.source.address_prefixes - address_prefixes.prefixes = AAZListArg( - options=["prefixes"], - help="The IP address prefixes, in CIDR notation, that identify the source(s).", - required=True, - ) - - prefixes = cls._args_schema.network_security_policies.Element.url_filtering.source.address_prefixes.prefixes - prefixes.Element = AAZStrArg() - - workload_id_patterns = cls._args_schema.network_security_policies.Element.url_filtering.source.workload_id_patterns - workload_id_patterns.patterns = AAZListArg( - options=["patterns"], - help="The workload ID patterns that identify the source(s).", - required=True, - ) - - patterns = cls._args_schema.network_security_policies.Element.url_filtering.source.workload_id_patterns.patterns - patterns.Element = AAZStrArg() - - # define Arg Group "Resource" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Resource", - help="The geo-location where the resource lives", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Resource", - help="Resource tags.", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.PolicyGroupsCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class PolicyGroupsCreateOrUpdate(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "policyGroupName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Content-Type", "application/json", - ), - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - @property - def content(self): - _content_value, _builder = self.new_content_builder( - self.ctx.args, - typ=AAZObjectType, - typ_kwargs={"flags": {"required": True, "client_flatten": True}} - ) - _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("displayName", AAZStrType, ".display_name") - properties.set_prop("networkSecurityPolicies", AAZListType, ".network_security_policies") - properties.set_prop("priority", AAZIntType, ".priority") - - network_security_policies = _builder.get(".properties.networkSecurityPolicies") - if network_security_policies is not None: - network_security_policies.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.networkSecurityPolicies[]") - if _elements is not None: - _elements.set_const("type", "ContentInspection", AAZStrType, ".content_inspection", typ_kwargs={"flags": {"required": True}}) - _elements.set_const("type", "FqdnFiltering", AAZStrType, ".fqdn_filtering", typ_kwargs={"flags": {"required": True}}) - _elements.set_const("type", "Mcp", AAZStrType, ".mcp", typ_kwargs={"flags": {"required": True}}) - _elements.set_const("type", "TlsInspection", AAZStrType, ".tls_inspection", typ_kwargs={"flags": {"required": True}}) - _elements.set_const("type", "UrlFiltering", AAZStrType, ".url_filtering", typ_kwargs={"flags": {"required": True}}) - _elements.discriminate_by("type", "ContentInspection") - _elements.discriminate_by("type", "FqdnFiltering") - _elements.discriminate_by("type", "Mcp") - _elements.discriminate_by("type", "TlsInspection") - _elements.discriminate_by("type", "UrlFiltering") - - disc_content_inspection = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}") - if disc_content_inspection is not None: - disc_content_inspection.set_prop("promptInjectionProtection", AAZObjectType, ".content_inspection.prompt_injection_protection") - disc_content_inspection.set_prop("source", AAZObjectType, ".content_inspection.source", typ_kwargs={"flags": {"required": True}}) - - prompt_injection_protection = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.promptInjectionProtection") - if prompt_injection_protection is not None: - prompt_injection_protection.set_prop("onDetection", AAZStrType, ".on_detection", typ_kwargs={"flags": {"required": True}}) - prompt_injection_protection.set_prop("promptLocations", AAZListType, ".prompt_locations") - prompt_injection_protection.set_prop("responseLocations", AAZListType, ".response_locations") - prompt_injection_protection.set_prop("sensitivity", AAZStrType, ".sensitivity") - - prompt_locations = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.promptInjectionProtection.promptLocations") - if prompt_locations is not None: - prompt_locations.set_elements(AAZStrType, ".") - - response_locations = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.promptInjectionProtection.responseLocations") - if response_locations is not None: - response_locations.set_elements(AAZStrType, ".") - - source = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.source") - if source is not None: - source.set_const("type", "AddressPrefixes", AAZStrType, ".address_prefixes", typ_kwargs={"flags": {"required": True}}) - source.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) - source.discriminate_by("type", "AddressPrefixes") - source.discriminate_by("type", "WorkloadIdPatterns") - - disc_address_prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.source{type:AddressPrefixes}") - if disc_address_prefixes is not None: - disc_address_prefixes.set_prop("prefixes", AAZListType, ".address_prefixes.prefixes", typ_kwargs={"flags": {"required": True}}) - - prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.source{type:AddressPrefixes}.prefixes") - if prefixes is not None: - prefixes.set_elements(AAZStrType, ".") - - disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.source{type:WorkloadIdPatterns}") - if disc_workload_id_patterns is not None: - disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) - - patterns = _builder.get(".properties.networkSecurityPolicies[]{type:ContentInspection}.source{type:WorkloadIdPatterns}.patterns") - if patterns is not None: - patterns.set_elements(AAZStrType, ".") - - disc_fqdn_filtering = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}") - if disc_fqdn_filtering is not None: - disc_fqdn_filtering.set_prop("destination", AAZObjectType, ".fqdn_filtering.destination") - disc_fqdn_filtering.set_prop("direction", AAZStrType, ".fqdn_filtering.direction") - disc_fqdn_filtering.set_prop("name", AAZStrType, ".fqdn_filtering.name") - disc_fqdn_filtering.set_prop("ports", AAZListType, ".fqdn_filtering.ports") - disc_fqdn_filtering.set_prop("priority", AAZIntType, ".fqdn_filtering.priority") - disc_fqdn_filtering.set_prop("source", AAZObjectType, ".fqdn_filtering.source", typ_kwargs={"flags": {"required": True}}) - - destination = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.destination") - if destination is not None: - destination.set_const("type", "Fqdns", AAZStrType, ".fqdns", typ_kwargs={"flags": {"required": True}}) - destination.discriminate_by("type", "Fqdns") - - disc_fqdns = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.destination{type:Fqdns}") - if disc_fqdns is not None: - disc_fqdns.set_prop("fqdns", AAZListType, ".fqdns.fqdns", typ_kwargs={"flags": {"required": True}}) - - fqdns = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.destination{type:Fqdns}.fqdns") - if fqdns is not None: - fqdns.set_elements(AAZStrType, ".") - - ports = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.ports") - if ports is not None: - ports.set_elements(AAZIntType, ".") - - source = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.source") - if source is not None: - source.set_const("type", "AddressPrefixes", AAZStrType, ".address_prefixes", typ_kwargs={"flags": {"required": True}}) - source.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) - source.discriminate_by("type", "AddressPrefixes") - source.discriminate_by("type", "WorkloadIdPatterns") - - disc_address_prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.source{type:AddressPrefixes}") - if disc_address_prefixes is not None: - disc_address_prefixes.set_prop("prefixes", AAZListType, ".address_prefixes.prefixes", typ_kwargs={"flags": {"required": True}}) - - prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.source{type:AddressPrefixes}.prefixes") - if prefixes is not None: - prefixes.set_elements(AAZStrType, ".") - - disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.source{type:WorkloadIdPatterns}") - if disc_workload_id_patterns is not None: - disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) - - patterns = _builder.get(".properties.networkSecurityPolicies[]{type:FqdnFiltering}.source{type:WorkloadIdPatterns}.patterns") - if patterns is not None: - patterns.set_elements(AAZStrType, ".") - - disc_mcp = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}") - if disc_mcp is not None: - disc_mcp.set_prop("defaultAction", AAZStrType, ".mcp.default_action", typ_kwargs={"flags": {"required": True}}) - disc_mcp.set_prop("destination", AAZObjectType, ".mcp.destination", typ_kwargs={"flags": {"required": True}}) - disc_mcp.set_prop("rules", AAZListType, ".mcp.rules", typ_kwargs={"flags": {"required": True}}) - disc_mcp.set_prop("source", AAZObjectType, ".mcp.source", typ_kwargs={"flags": {"required": True}}) - - destination = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination") - if destination is not None: - destination.set_const("type", "AddressPrefixes", AAZStrType, ".address_prefixes", typ_kwargs={"flags": {"required": True}}) - destination.set_const("type", "Fqdns", AAZStrType, ".fqdns", typ_kwargs={"flags": {"required": True}}) - destination.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) - destination.discriminate_by("type", "AddressPrefixes") - destination.discriminate_by("type", "Fqdns") - destination.discriminate_by("type", "WorkloadIdPatterns") - - disc_address_prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination{type:AddressPrefixes}") - if disc_address_prefixes is not None: - disc_address_prefixes.set_prop("prefixes", AAZListType, ".address_prefixes.prefixes", typ_kwargs={"flags": {"required": True}}) - - prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination{type:AddressPrefixes}.prefixes") - if prefixes is not None: - prefixes.set_elements(AAZStrType, ".") - - disc_fqdns = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination{type:Fqdns}") - if disc_fqdns is not None: - disc_fqdns.set_prop("fqdns", AAZListType, ".fqdns.fqdns", typ_kwargs={"flags": {"required": True}}) - - fqdns = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination{type:Fqdns}.fqdns") - if fqdns is not None: - fqdns.set_elements(AAZStrType, ".") - - disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination{type:WorkloadIdPatterns}") - if disc_workload_id_patterns is not None: - disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) - - patterns = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.destination{type:WorkloadIdPatterns}.patterns") - if patterns is not None: - patterns.set_elements(AAZStrType, ".") - - rules = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.rules") - if rules is not None: - rules.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.rules[]") - if _elements is not None: - _elements.set_prop("action", AAZStrType, ".action", typ_kwargs={"flags": {"required": True}}) - _elements.set_prop("tools", AAZListType, ".tools", typ_kwargs={"flags": {"required": True}}) - - tools = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.rules[].tools") - if tools is not None: - tools.set_elements(AAZStrType, ".") - - source = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.source") - if source is not None: - source.set_const("type", "AddressPrefixes", AAZStrType, ".address_prefixes", typ_kwargs={"flags": {"required": True}}) - source.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) - source.discriminate_by("type", "AddressPrefixes") - source.discriminate_by("type", "WorkloadIdPatterns") - - disc_address_prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.source{type:AddressPrefixes}") - if disc_address_prefixes is not None: - disc_address_prefixes.set_prop("prefixes", AAZListType, ".address_prefixes.prefixes", typ_kwargs={"flags": {"required": True}}) - - prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.source{type:AddressPrefixes}.prefixes") - if prefixes is not None: - prefixes.set_elements(AAZStrType, ".") - - disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.source{type:WorkloadIdPatterns}") - if disc_workload_id_patterns is not None: - disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) - - patterns = _builder.get(".properties.networkSecurityPolicies[]{type:Mcp}.source{type:WorkloadIdPatterns}.patterns") - if patterns is not None: - patterns.set_elements(AAZStrType, ".") - - disc_tls_inspection = _builder.get(".properties.networkSecurityPolicies[]{type:TlsInspection}") - if disc_tls_inspection is not None: - disc_tls_inspection.set_prop("certificate", AAZObjectType, ".tls_inspection.certificate", typ_kwargs={"flags": {"required": True}}) - disc_tls_inspection.set_prop("source", AAZObjectType, ".tls_inspection.source", typ_kwargs={"flags": {"required": True}}) - - certificate = _builder.get(".properties.networkSecurityPolicies[]{type:TlsInspection}.certificate") - if certificate is not None: - certificate.set_const("mode", "AzureManagedCA", AAZStrType, ".azure_managed_ca", typ_kwargs={"flags": {"required": True}}) - certificate.discriminate_by("mode", "AzureManagedCA") - - source = _builder.get(".properties.networkSecurityPolicies[]{type:TlsInspection}.source") - if source is not None: - source.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) - source.discriminate_by("type", "WorkloadIdPatterns") - - disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:TlsInspection}.source{type:WorkloadIdPatterns}") - if disc_workload_id_patterns is not None: - disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) - - patterns = _builder.get(".properties.networkSecurityPolicies[]{type:TlsInspection}.source{type:WorkloadIdPatterns}.patterns") - if patterns is not None: - patterns.set_elements(AAZStrType, ".") - - disc_url_filtering = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}") - if disc_url_filtering is not None: - disc_url_filtering.set_prop("defaultAction", AAZStrType, ".url_filtering.default_action", typ_kwargs={"flags": {"required": True}}) - disc_url_filtering.set_prop("destination", AAZObjectType, ".url_filtering.destination") - disc_url_filtering.set_prop("rules", AAZListType, ".url_filtering.rules", typ_kwargs={"flags": {"required": True}}) - disc_url_filtering.set_prop("source", AAZObjectType, ".url_filtering.source", typ_kwargs={"flags": {"required": True}}) - - destination = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination") - if destination is not None: - destination.set_const("type", "AddressPrefixes", AAZStrType, ".address_prefixes", typ_kwargs={"flags": {"required": True}}) - destination.set_const("type", "Fqdns", AAZStrType, ".fqdns", typ_kwargs={"flags": {"required": True}}) - destination.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) - destination.discriminate_by("type", "AddressPrefixes") - destination.discriminate_by("type", "Fqdns") - destination.discriminate_by("type", "WorkloadIdPatterns") - - disc_address_prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination{type:AddressPrefixes}") - if disc_address_prefixes is not None: - disc_address_prefixes.set_prop("prefixes", AAZListType, ".address_prefixes.prefixes", typ_kwargs={"flags": {"required": True}}) - - prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination{type:AddressPrefixes}.prefixes") - if prefixes is not None: - prefixes.set_elements(AAZStrType, ".") - - disc_fqdns = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination{type:Fqdns}") - if disc_fqdns is not None: - disc_fqdns.set_prop("fqdns", AAZListType, ".fqdns.fqdns", typ_kwargs={"flags": {"required": True}}) - - fqdns = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination{type:Fqdns}.fqdns") - if fqdns is not None: - fqdns.set_elements(AAZStrType, ".") - - disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination{type:WorkloadIdPatterns}") - if disc_workload_id_patterns is not None: - disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) - - patterns = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.destination{type:WorkloadIdPatterns}.patterns") - if patterns is not None: - patterns.set_elements(AAZStrType, ".") - - rules = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.rules") - if rules is not None: - rules.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.rules[]") - if _elements is not None: - _elements.set_prop("action", AAZStrType, ".action", typ_kwargs={"flags": {"required": True}}) - _elements.set_prop("hostname", AAZStrType, ".hostname") - _elements.set_prop("method", AAZStrType, ".method") - _elements.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) - _elements.set_prop("paths", AAZListType, ".paths") - _elements.set_prop("priority", AAZIntType, ".priority", typ_kwargs={"flags": {"required": True}}) - - paths = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.rules[].paths") - if paths is not None: - paths.set_elements(AAZStrType, ".") - - source = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.source") - if source is not None: - source.set_const("type", "AddressPrefixes", AAZStrType, ".address_prefixes", typ_kwargs={"flags": {"required": True}}) - source.set_const("type", "WorkloadIdPatterns", AAZStrType, ".workload_id_patterns", typ_kwargs={"flags": {"required": True}}) - source.discriminate_by("type", "AddressPrefixes") - source.discriminate_by("type", "WorkloadIdPatterns") - - disc_address_prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.source{type:AddressPrefixes}") - if disc_address_prefixes is not None: - disc_address_prefixes.set_prop("prefixes", AAZListType, ".address_prefixes.prefixes", typ_kwargs={"flags": {"required": True}}) - - prefixes = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.source{type:AddressPrefixes}.prefixes") - if prefixes is not None: - prefixes.set_elements(AAZStrType, ".") - - disc_workload_id_patterns = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.source{type:WorkloadIdPatterns}") - if disc_workload_id_patterns is not None: - disc_workload_id_patterns.set_prop("patterns", AAZListType, ".workload_id_patterns.patterns", typ_kwargs={"flags": {"required": True}}) - - patterns = _builder.get(".properties.networkSecurityPolicies[]{type:UrlFiltering}.source{type:WorkloadIdPatterns}.patterns") - if patterns is not None: - patterns.set_elements(AAZStrType, ".") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - - _schema_on_200_201 = cls._schema_on_200_201 - _schema_on_200_201.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200_201.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.properties = AAZObjectType() - _schema_on_200_201.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _schema_on_200_201.tags = AAZDictType() - _schema_on_200_201.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200_201.properties - properties.description = AAZStrType() - properties.display_name = AAZStrType( - serialized_name="displayName", - ) - properties.network_security_policies = AAZListType( - serialized_name="networkSecurityPolicies", - ) - properties.priority = AAZIntType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - network_security_policies = cls._schema_on_200_201.properties.network_security_policies - network_security_policies.Element = AAZObjectType() - - _element = cls._schema_on_200_201.properties.network_security_policies.Element - _element.type = AAZStrType( - flags={"required": True}, - ) - - disc_content_inspection = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection") - disc_content_inspection.prompt_injection_protection = AAZObjectType( - serialized_name="promptInjectionProtection", - ) - disc_content_inspection.source = AAZObjectType( - flags={"required": True}, - ) - - prompt_injection_protection = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection - prompt_injection_protection.on_detection = AAZStrType( - serialized_name="onDetection", - flags={"required": True}, - ) - prompt_injection_protection.prompt_locations = AAZListType( - serialized_name="promptLocations", - ) - prompt_injection_protection.response_locations = AAZListType( - serialized_name="responseLocations", - ) - prompt_injection_protection.sensitivity = AAZStrType() - - prompt_locations = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.prompt_locations - prompt_locations.Element = AAZStrType() - - response_locations = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.response_locations - response_locations.Element = AAZStrType() - - source = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_fqdn_filtering = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering") - disc_fqdn_filtering.destination = AAZObjectType() - disc_fqdn_filtering.direction = AAZStrType() - disc_fqdn_filtering.name = AAZStrType() - disc_fqdn_filtering.ports = AAZListType() - disc_fqdn_filtering.priority = AAZIntType() - disc_fqdn_filtering.source = AAZObjectType( - flags={"required": True}, - ) - - destination = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination - destination.type = AAZStrType( - flags={"required": True}, - ) - - disc_fqdns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns") - disc_fqdns.fqdns = AAZListType( - flags={"required": True}, - ) - - fqdns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns").fqdns - fqdns.Element = AAZStrType() - - ports = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").ports - ports.Element = AAZIntType() - - source = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_mcp = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp") - disc_mcp.default_action = AAZStrType( - serialized_name="defaultAction", - flags={"required": True}, - ) - disc_mcp.destination = AAZObjectType( - flags={"required": True}, - ) - disc_mcp.rules = AAZListType( - flags={"required": True}, - ) - disc_mcp.source = AAZObjectType( - flags={"required": True}, - ) - - destination = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination - destination.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_fqdns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns") - disc_fqdns.fqdns = AAZListType( - flags={"required": True}, - ) - - fqdns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns").fqdns - fqdns.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - rules = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules - rules.Element = AAZObjectType() - - _element = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element - _element.action = AAZStrType( - flags={"required": True}, - ) - _element.tools = AAZListType( - flags={"required": True}, - ) - - tools = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element.tools - tools.Element = AAZStrType() - - source = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_tls_inspection = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection") - disc_tls_inspection.certificate = AAZObjectType( - flags={"required": True}, - ) - disc_tls_inspection.source = AAZObjectType( - flags={"required": True}, - ) - - certificate = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").certificate - certificate.mode = AAZStrType( - flags={"required": True}, - ) - - source = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_url_filtering = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering") - disc_url_filtering.default_action = AAZStrType( - serialized_name="defaultAction", - flags={"required": True}, - ) - disc_url_filtering.destination = AAZObjectType() - disc_url_filtering.rules = AAZListType( - flags={"required": True}, - ) - disc_url_filtering.source = AAZObjectType( - flags={"required": True}, - ) - - destination = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination - destination.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_fqdns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns") - disc_fqdns.fqdns = AAZListType( - flags={"required": True}, - ) - - fqdns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns").fqdns - fqdns.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - rules = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules - rules.Element = AAZObjectType() - - _element = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element - _element.action = AAZStrType( - flags={"required": True}, - ) - _element.hostname = AAZStrType() - _element.method = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.paths = AAZListType() - _element.priority = AAZIntType( - flags={"required": True}, - ) - - paths = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element.paths - paths.Element = AAZStrType() - - source = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200_201.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - system_data = cls._schema_on_200_201.system_data - system_data.created_at = AAZStrType( - serialized_name="createdAt", - ) - system_data.created_by = AAZStrType( - serialized_name="createdBy", - ) - system_data.created_by_type = AAZStrType( - serialized_name="createdByType", - ) - system_data.last_modified_at = AAZStrType( - serialized_name="lastModifiedAt", - ) - system_data.last_modified_by = AAZStrType( - serialized_name="lastModifiedBy", - ) - system_data.last_modified_by_type = AAZStrType( - serialized_name="lastModifiedByType", - ) - - tags = cls._schema_on_200_201.tags - tags.Element = AAZStrType() - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - -__all__ = ["Create"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_delete.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_delete.py deleted file mode 100644 index 9eb7b495e5f..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_delete.py +++ /dev/null @@ -1,166 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh policy-group delete", - confirmation="Are you sure you want to perform this operation?", -) -class Delete(AAZCommand): - """Delete an Agent Mesh policy group - - :example: PolicyGroups_Delete - az agentmesh policy-group delete --resource-group rgnetworksecurity --name testPolicyGroup - """ - - _aaz_info = { - "version": "2026-07-21-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The name of the PolicyGroup", - required=True, - id_part="name", - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.PolicyGroupsDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class PolicyGroupsDelete(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "policyGroupName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - def on_204(self, session): - pass - - def on_200_201(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_list.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_list.py deleted file mode 100644 index a8ade384dd0..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_list.py +++ /dev/null @@ -1,953 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh policy-group list", -) -class List(AAZCommand): - """List Agent Mesh policy groups - - :example: PolicyGroups_ListBySubscription - az agentmesh policy-group list - - :example: PolicyGroups_ListByResourceGroup - az agentmesh policy-group list --resource-group rgnetworksecurity - """ - - _aaz_info = { - "version": "2026-07-21-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networksecurity/policygroups", "2026-07-21-preview"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups", "2026-07-21-preview"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, self._output) - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.PolicyGroupsListBySubscription(ctx=self.ctx)() - if condition_1: - self.PolicyGroupsListByResourceGroup(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class PolicyGroupsListBySubscription(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [200]: - return self.on_200(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkSecurity/policyGroups", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - def on_200(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200 - ) - - _schema_on_200 = None - - @classmethod - def _build_schema_on_200(cls): - if cls._schema_on_200 is not None: - return cls._schema_on_200 - - cls._schema_on_200 = AAZObjectType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType() - _element.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.description = AAZStrType() - properties.display_name = AAZStrType( - serialized_name="displayName", - ) - properties.network_security_policies = AAZListType( - serialized_name="networkSecurityPolicies", - ) - properties.priority = AAZIntType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - network_security_policies = cls._schema_on_200.value.Element.properties.network_security_policies - network_security_policies.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.network_security_policies.Element - _element.type = AAZStrType( - flags={"required": True}, - ) - - disc_content_inspection = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection") - disc_content_inspection.prompt_injection_protection = AAZObjectType( - serialized_name="promptInjectionProtection", - ) - disc_content_inspection.source = AAZObjectType( - flags={"required": True}, - ) - - prompt_injection_protection = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection - prompt_injection_protection.on_detection = AAZStrType( - serialized_name="onDetection", - flags={"required": True}, - ) - prompt_injection_protection.prompt_locations = AAZListType( - serialized_name="promptLocations", - ) - prompt_injection_protection.response_locations = AAZListType( - serialized_name="responseLocations", - ) - prompt_injection_protection.sensitivity = AAZStrType() - - prompt_locations = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.prompt_locations - prompt_locations.Element = AAZStrType() - - response_locations = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.response_locations - response_locations.Element = AAZStrType() - - source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_fqdn_filtering = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering") - disc_fqdn_filtering.destination = AAZObjectType() - disc_fqdn_filtering.direction = AAZStrType() - disc_fqdn_filtering.name = AAZStrType() - disc_fqdn_filtering.ports = AAZListType() - disc_fqdn_filtering.priority = AAZIntType() - disc_fqdn_filtering.source = AAZObjectType( - flags={"required": True}, - ) - - destination = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination - destination.type = AAZStrType( - flags={"required": True}, - ) - - disc_fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns") - disc_fqdns.fqdns = AAZListType( - flags={"required": True}, - ) - - fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns").fqdns - fqdns.Element = AAZStrType() - - ports = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").ports - ports.Element = AAZIntType() - - source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_mcp = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp") - disc_mcp.default_action = AAZStrType( - serialized_name="defaultAction", - flags={"required": True}, - ) - disc_mcp.destination = AAZObjectType( - flags={"required": True}, - ) - disc_mcp.rules = AAZListType( - flags={"required": True}, - ) - disc_mcp.source = AAZObjectType( - flags={"required": True}, - ) - - destination = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination - destination.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns") - disc_fqdns.fqdns = AAZListType( - flags={"required": True}, - ) - - fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns").fqdns - fqdns.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - rules = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules - rules.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element - _element.action = AAZStrType( - flags={"required": True}, - ) - _element.tools = AAZListType( - flags={"required": True}, - ) - - tools = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element.tools - tools.Element = AAZStrType() - - source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_tls_inspection = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection") - disc_tls_inspection.certificate = AAZObjectType( - flags={"required": True}, - ) - disc_tls_inspection.source = AAZObjectType( - flags={"required": True}, - ) - - certificate = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").certificate - certificate.mode = AAZStrType( - flags={"required": True}, - ) - - source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_url_filtering = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering") - disc_url_filtering.default_action = AAZStrType( - serialized_name="defaultAction", - flags={"required": True}, - ) - disc_url_filtering.destination = AAZObjectType() - disc_url_filtering.rules = AAZListType( - flags={"required": True}, - ) - disc_url_filtering.source = AAZObjectType( - flags={"required": True}, - ) - - destination = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination - destination.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns") - disc_fqdns.fqdns = AAZListType( - flags={"required": True}, - ) - - fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns").fqdns - fqdns.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - rules = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules - rules.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element - _element.action = AAZStrType( - flags={"required": True}, - ) - _element.hostname = AAZStrType() - _element.method = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.paths = AAZListType() - _element.priority = AAZIntType( - flags={"required": True}, - ) - - paths = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element.paths - paths.Element = AAZStrType() - - source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - system_data = cls._schema_on_200.value.Element.system_data - system_data.created_at = AAZStrType( - serialized_name="createdAt", - ) - system_data.created_by = AAZStrType( - serialized_name="createdBy", - ) - system_data.created_by_type = AAZStrType( - serialized_name="createdByType", - ) - system_data.last_modified_at = AAZStrType( - serialized_name="lastModifiedAt", - ) - system_data.last_modified_by = AAZStrType( - serialized_name="lastModifiedBy", - ) - system_data.last_modified_by_type = AAZStrType( - serialized_name="lastModifiedByType", - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class PolicyGroupsListByResourceGroup(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [200]: - return self.on_200(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/policyGroups", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - def on_200(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200 - ) - - _schema_on_200 = None - - @classmethod - def _build_schema_on_200(cls): - if cls._schema_on_200 is not None: - return cls._schema_on_200 - - cls._schema_on_200 = AAZObjectType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType() - _element.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.description = AAZStrType() - properties.display_name = AAZStrType( - serialized_name="displayName", - ) - properties.network_security_policies = AAZListType( - serialized_name="networkSecurityPolicies", - ) - properties.priority = AAZIntType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - network_security_policies = cls._schema_on_200.value.Element.properties.network_security_policies - network_security_policies.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.network_security_policies.Element - _element.type = AAZStrType( - flags={"required": True}, - ) - - disc_content_inspection = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection") - disc_content_inspection.prompt_injection_protection = AAZObjectType( - serialized_name="promptInjectionProtection", - ) - disc_content_inspection.source = AAZObjectType( - flags={"required": True}, - ) - - prompt_injection_protection = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection - prompt_injection_protection.on_detection = AAZStrType( - serialized_name="onDetection", - flags={"required": True}, - ) - prompt_injection_protection.prompt_locations = AAZListType( - serialized_name="promptLocations", - ) - prompt_injection_protection.response_locations = AAZListType( - serialized_name="responseLocations", - ) - prompt_injection_protection.sensitivity = AAZStrType() - - prompt_locations = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.prompt_locations - prompt_locations.Element = AAZStrType() - - response_locations = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.response_locations - response_locations.Element = AAZStrType() - - source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_fqdn_filtering = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering") - disc_fqdn_filtering.destination = AAZObjectType() - disc_fqdn_filtering.direction = AAZStrType() - disc_fqdn_filtering.name = AAZStrType() - disc_fqdn_filtering.ports = AAZListType() - disc_fqdn_filtering.priority = AAZIntType() - disc_fqdn_filtering.source = AAZObjectType( - flags={"required": True}, - ) - - destination = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination - destination.type = AAZStrType( - flags={"required": True}, - ) - - disc_fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns") - disc_fqdns.fqdns = AAZListType( - flags={"required": True}, - ) - - fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns").fqdns - fqdns.Element = AAZStrType() - - ports = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").ports - ports.Element = AAZIntType() - - source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_mcp = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp") - disc_mcp.default_action = AAZStrType( - serialized_name="defaultAction", - flags={"required": True}, - ) - disc_mcp.destination = AAZObjectType( - flags={"required": True}, - ) - disc_mcp.rules = AAZListType( - flags={"required": True}, - ) - disc_mcp.source = AAZObjectType( - flags={"required": True}, - ) - - destination = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination - destination.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns") - disc_fqdns.fqdns = AAZListType( - flags={"required": True}, - ) - - fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns").fqdns - fqdns.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - rules = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules - rules.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element - _element.action = AAZStrType( - flags={"required": True}, - ) - _element.tools = AAZListType( - flags={"required": True}, - ) - - tools = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element.tools - tools.Element = AAZStrType() - - source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_tls_inspection = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection") - disc_tls_inspection.certificate = AAZObjectType( - flags={"required": True}, - ) - disc_tls_inspection.source = AAZObjectType( - flags={"required": True}, - ) - - certificate = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").certificate - certificate.mode = AAZStrType( - flags={"required": True}, - ) - - source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_url_filtering = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering") - disc_url_filtering.default_action = AAZStrType( - serialized_name="defaultAction", - flags={"required": True}, - ) - disc_url_filtering.destination = AAZObjectType() - disc_url_filtering.rules = AAZListType( - flags={"required": True}, - ) - disc_url_filtering.source = AAZObjectType( - flags={"required": True}, - ) - - destination = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination - destination.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns") - disc_fqdns.fqdns = AAZListType( - flags={"required": True}, - ) - - fqdns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns").fqdns - fqdns.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - rules = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules - rules.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element - _element.action = AAZStrType( - flags={"required": True}, - ) - _element.hostname = AAZStrType() - _element.method = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.paths = AAZListType() - _element.priority = AAZIntType( - flags={"required": True}, - ) - - paths = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element.paths - paths.Element = AAZStrType() - - source = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.value.Element.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - system_data = cls._schema_on_200.value.Element.system_data - system_data.created_at = AAZStrType( - serialized_name="createdAt", - ) - system_data.created_by = AAZStrType( - serialized_name="createdBy", - ) - system_data.created_by_type = AAZStrType( - serialized_name="createdByType", - ) - system_data.last_modified_at = AAZStrType( - serialized_name="lastModifiedAt", - ) - system_data.last_modified_by = AAZStrType( - serialized_name="lastModifiedBy", - ) - system_data.last_modified_by_type = AAZStrType( - serialized_name="lastModifiedByType", - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - -__all__ = ["List"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_show.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_show.py deleted file mode 100644 index 6321cd317e9..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_show.py +++ /dev/null @@ -1,513 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh policy-group show", -) -class Show(AAZCommand): - """Get an Agent Mesh policy group - - :example: PolicyGroups_Get - az agentmesh policy-group show --resource-group rgnetworksecurity --name testPolicyGroup - """ - - _aaz_info = { - "version": "2026-07-21-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return self._output() - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The name of the PolicyGroup", - required=True, - id_part="name", - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.PolicyGroupsGet(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class PolicyGroupsGet(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [200]: - return self.on_200(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "policyGroupName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - def on_200(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200 - ) - - _schema_on_200 = None - - @classmethod - def _build_schema_on_200(cls): - if cls._schema_on_200 is not None: - return cls._schema_on_200 - - cls._schema_on_200 = AAZObjectType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType() - _schema_on_200.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.description = AAZStrType() - properties.display_name = AAZStrType( - serialized_name="displayName", - ) - properties.network_security_policies = AAZListType( - serialized_name="networkSecurityPolicies", - ) - properties.priority = AAZIntType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - network_security_policies = cls._schema_on_200.properties.network_security_policies - network_security_policies.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.network_security_policies.Element - _element.type = AAZStrType( - flags={"required": True}, - ) - - disc_content_inspection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection") - disc_content_inspection.prompt_injection_protection = AAZObjectType( - serialized_name="promptInjectionProtection", - ) - disc_content_inspection.source = AAZObjectType( - flags={"required": True}, - ) - - prompt_injection_protection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection - prompt_injection_protection.on_detection = AAZStrType( - serialized_name="onDetection", - flags={"required": True}, - ) - prompt_injection_protection.prompt_locations = AAZListType( - serialized_name="promptLocations", - ) - prompt_injection_protection.response_locations = AAZListType( - serialized_name="responseLocations", - ) - prompt_injection_protection.sensitivity = AAZStrType() - - prompt_locations = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.prompt_locations - prompt_locations.Element = AAZStrType() - - response_locations = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.response_locations - response_locations.Element = AAZStrType() - - source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_fqdn_filtering = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering") - disc_fqdn_filtering.destination = AAZObjectType() - disc_fqdn_filtering.direction = AAZStrType() - disc_fqdn_filtering.name = AAZStrType() - disc_fqdn_filtering.ports = AAZListType() - disc_fqdn_filtering.priority = AAZIntType() - disc_fqdn_filtering.source = AAZObjectType( - flags={"required": True}, - ) - - destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination - destination.type = AAZStrType( - flags={"required": True}, - ) - - disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns") - disc_fqdns.fqdns = AAZListType( - flags={"required": True}, - ) - - fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns").fqdns - fqdns.Element = AAZStrType() - - ports = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").ports - ports.Element = AAZIntType() - - source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_mcp = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp") - disc_mcp.default_action = AAZStrType( - serialized_name="defaultAction", - flags={"required": True}, - ) - disc_mcp.destination = AAZObjectType( - flags={"required": True}, - ) - disc_mcp.rules = AAZListType( - flags={"required": True}, - ) - disc_mcp.source = AAZObjectType( - flags={"required": True}, - ) - - destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination - destination.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns") - disc_fqdns.fqdns = AAZListType( - flags={"required": True}, - ) - - fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns").fqdns - fqdns.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - rules = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules - rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element - _element.action = AAZStrType( - flags={"required": True}, - ) - _element.tools = AAZListType( - flags={"required": True}, - ) - - tools = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element.tools - tools.Element = AAZStrType() - - source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_tls_inspection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection") - disc_tls_inspection.certificate = AAZObjectType( - flags={"required": True}, - ) - disc_tls_inspection.source = AAZObjectType( - flags={"required": True}, - ) - - certificate = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").certificate - certificate.mode = AAZStrType( - flags={"required": True}, - ) - - source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_url_filtering = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering") - disc_url_filtering.default_action = AAZStrType( - serialized_name="defaultAction", - flags={"required": True}, - ) - disc_url_filtering.destination = AAZObjectType() - disc_url_filtering.rules = AAZListType( - flags={"required": True}, - ) - disc_url_filtering.source = AAZObjectType( - flags={"required": True}, - ) - - destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination - destination.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns") - disc_fqdns.fqdns = AAZListType( - flags={"required": True}, - ) - - fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns").fqdns - fqdns.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - rules = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules - rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element - _element.action = AAZStrType( - flags={"required": True}, - ) - _element.hostname = AAZStrType() - _element.method = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.paths = AAZListType() - _element.priority = AAZIntType( - flags={"required": True}, - ) - - paths = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element.paths - paths.Element = AAZStrType() - - source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - system_data = cls._schema_on_200.system_data - system_data.created_at = AAZStrType( - serialized_name="createdAt", - ) - system_data.created_by = AAZStrType( - serialized_name="createdBy", - ) - system_data.created_by_type = AAZStrType( - serialized_name="createdByType", - ) - system_data.last_modified_at = AAZStrType( - serialized_name="lastModifiedAt", - ) - system_data.last_modified_by = AAZStrType( - serialized_name="lastModifiedBy", - ) - system_data.last_modified_by_type = AAZStrType( - serialized_name="lastModifiedByType", - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_update.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_update.py deleted file mode 100644 index 1a2ff9bc593..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_update.py +++ /dev/null @@ -1,560 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh policy-group update", -) -class Update(AAZCommand): - """Update an Agent Mesh policy group's tags - - :example: PolicyGroups_Update - az agentmesh policy-group update --resource-group rgnetworksecurity --name testPolicyGroup --tags "{env:production}" - """ - - _aaz_info = { - "version": "2026-07-21-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, self._output) - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The name of the PolicyGroup", - required=True, - id_part="name", - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Properties", - help="Resource tags.", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.PolicyGroupsUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class PolicyGroupsUpdate(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", - **self.url_parameters - ) - - @property - def method(self): - return "PATCH" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "policyGroupName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Content-Type", "application/json", - ), - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - @property - def content(self): - _content_value, _builder = self.new_content_builder( - self.ctx.args, - typ=AAZObjectType, - typ_kwargs={"flags": {"required": True, "client_flatten": True}} - ) - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200 - ) - - _schema_on_200 = None - - @classmethod - def _build_schema_on_200(cls): - if cls._schema_on_200 is not None: - return cls._schema_on_200 - - cls._schema_on_200 = AAZObjectType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType() - _schema_on_200.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.description = AAZStrType() - properties.display_name = AAZStrType( - serialized_name="displayName", - ) - properties.network_security_policies = AAZListType( - serialized_name="networkSecurityPolicies", - ) - properties.priority = AAZIntType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - network_security_policies = cls._schema_on_200.properties.network_security_policies - network_security_policies.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.network_security_policies.Element - _element.type = AAZStrType( - flags={"required": True}, - ) - - disc_content_inspection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection") - disc_content_inspection.prompt_injection_protection = AAZObjectType( - serialized_name="promptInjectionProtection", - ) - disc_content_inspection.source = AAZObjectType( - flags={"required": True}, - ) - - prompt_injection_protection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection - prompt_injection_protection.on_detection = AAZStrType( - serialized_name="onDetection", - flags={"required": True}, - ) - prompt_injection_protection.prompt_locations = AAZListType( - serialized_name="promptLocations", - ) - prompt_injection_protection.response_locations = AAZListType( - serialized_name="responseLocations", - ) - prompt_injection_protection.sensitivity = AAZStrType() - - prompt_locations = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.prompt_locations - prompt_locations.Element = AAZStrType() - - response_locations = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.response_locations - response_locations.Element = AAZStrType() - - source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_fqdn_filtering = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering") - disc_fqdn_filtering.destination = AAZObjectType() - disc_fqdn_filtering.direction = AAZStrType() - disc_fqdn_filtering.name = AAZStrType() - disc_fqdn_filtering.ports = AAZListType() - disc_fqdn_filtering.priority = AAZIntType() - disc_fqdn_filtering.source = AAZObjectType( - flags={"required": True}, - ) - - destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination - destination.type = AAZStrType( - flags={"required": True}, - ) - - disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns") - disc_fqdns.fqdns = AAZListType( - flags={"required": True}, - ) - - fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns").fqdns - fqdns.Element = AAZStrType() - - ports = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").ports - ports.Element = AAZIntType() - - source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_mcp = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp") - disc_mcp.default_action = AAZStrType( - serialized_name="defaultAction", - flags={"required": True}, - ) - disc_mcp.destination = AAZObjectType( - flags={"required": True}, - ) - disc_mcp.rules = AAZListType( - flags={"required": True}, - ) - disc_mcp.source = AAZObjectType( - flags={"required": True}, - ) - - destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination - destination.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns") - disc_fqdns.fqdns = AAZListType( - flags={"required": True}, - ) - - fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns").fqdns - fqdns.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - rules = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules - rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element - _element.action = AAZStrType( - flags={"required": True}, - ) - _element.tools = AAZListType( - flags={"required": True}, - ) - - tools = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element.tools - tools.Element = AAZStrType() - - source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_tls_inspection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection") - disc_tls_inspection.certificate = AAZObjectType( - flags={"required": True}, - ) - disc_tls_inspection.source = AAZObjectType( - flags={"required": True}, - ) - - certificate = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").certificate - certificate.mode = AAZStrType( - flags={"required": True}, - ) - - source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_url_filtering = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering") - disc_url_filtering.default_action = AAZStrType( - serialized_name="defaultAction", - flags={"required": True}, - ) - disc_url_filtering.destination = AAZObjectType() - disc_url_filtering.rules = AAZListType( - flags={"required": True}, - ) - disc_url_filtering.source = AAZObjectType( - flags={"required": True}, - ) - - destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination - destination.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns") - disc_fqdns.fqdns = AAZListType( - flags={"required": True}, - ) - - fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns").fqdns - fqdns.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - rules = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules - rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element - _element.action = AAZStrType( - flags={"required": True}, - ) - _element.hostname = AAZStrType() - _element.method = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.paths = AAZListType() - _element.priority = AAZIntType( - flags={"required": True}, - ) - - paths = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element.paths - paths.Element = AAZStrType() - - source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - system_data = cls._schema_on_200.system_data - system_data.created_at = AAZStrType( - serialized_name="createdAt", - ) - system_data.created_by = AAZStrType( - serialized_name="createdBy", - ) - system_data.created_by_type = AAZStrType( - serialized_name="createdByType", - ) - system_data.last_modified_at = AAZStrType( - serialized_name="lastModifiedAt", - ) - system_data.last_modified_by = AAZStrType( - serialized_name="lastModifiedBy", - ) - system_data.last_modified_by_type = AAZStrType( - serialized_name="lastModifiedByType", - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _UpdateHelper: - """Helper class for Update""" - - -__all__ = ["Update"] diff --git a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_wait.py b/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_wait.py deleted file mode 100644 index b816d17a0c5..00000000000 --- a/src/agentmesh/azext_agentmesh/aaz/latest/agentmesh/policy_group/_wait.py +++ /dev/null @@ -1,509 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "agentmesh policy-group wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return self._output() - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The name of the PolicyGroup", - required=True, - id_part="name", - fmt=AAZStrArgFormat( - pattern="^[a-zA-Z0-9-]{3,24}$", - ), - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.PolicyGroupsGet(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) - return result - - class PolicyGroupsGet(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [200]: - return self.on_200(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "policyGroupName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-07-21-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - def on_200(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200 - ) - - _schema_on_200 = None - - @classmethod - def _build_schema_on_200(cls): - if cls._schema_on_200 is not None: - return cls._schema_on_200 - - cls._schema_on_200 = AAZObjectType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType() - _schema_on_200.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.description = AAZStrType() - properties.display_name = AAZStrType( - serialized_name="displayName", - ) - properties.network_security_policies = AAZListType( - serialized_name="networkSecurityPolicies", - ) - properties.priority = AAZIntType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - network_security_policies = cls._schema_on_200.properties.network_security_policies - network_security_policies.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.network_security_policies.Element - _element.type = AAZStrType( - flags={"required": True}, - ) - - disc_content_inspection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection") - disc_content_inspection.prompt_injection_protection = AAZObjectType( - serialized_name="promptInjectionProtection", - ) - disc_content_inspection.source = AAZObjectType( - flags={"required": True}, - ) - - prompt_injection_protection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection - prompt_injection_protection.on_detection = AAZStrType( - serialized_name="onDetection", - flags={"required": True}, - ) - prompt_injection_protection.prompt_locations = AAZListType( - serialized_name="promptLocations", - ) - prompt_injection_protection.response_locations = AAZListType( - serialized_name="responseLocations", - ) - prompt_injection_protection.sensitivity = AAZStrType() - - prompt_locations = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.prompt_locations - prompt_locations.Element = AAZStrType() - - response_locations = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").prompt_injection_protection.response_locations - response_locations.Element = AAZStrType() - - source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "ContentInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_fqdn_filtering = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering") - disc_fqdn_filtering.destination = AAZObjectType() - disc_fqdn_filtering.direction = AAZStrType() - disc_fqdn_filtering.name = AAZStrType() - disc_fqdn_filtering.ports = AAZListType() - disc_fqdn_filtering.priority = AAZIntType() - disc_fqdn_filtering.source = AAZObjectType( - flags={"required": True}, - ) - - destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination - destination.type = AAZStrType( - flags={"required": True}, - ) - - disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns") - disc_fqdns.fqdns = AAZListType( - flags={"required": True}, - ) - - fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").destination.discriminate_by("type", "Fqdns").fqdns - fqdns.Element = AAZStrType() - - ports = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").ports - ports.Element = AAZIntType() - - source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "FqdnFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_mcp = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp") - disc_mcp.default_action = AAZStrType( - serialized_name="defaultAction", - flags={"required": True}, - ) - disc_mcp.destination = AAZObjectType( - flags={"required": True}, - ) - disc_mcp.rules = AAZListType( - flags={"required": True}, - ) - disc_mcp.source = AAZObjectType( - flags={"required": True}, - ) - - destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination - destination.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns") - disc_fqdns.fqdns = AAZListType( - flags={"required": True}, - ) - - fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "Fqdns").fqdns - fqdns.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").destination.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - rules = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules - rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element - _element.action = AAZStrType( - flags={"required": True}, - ) - _element.tools = AAZListType( - flags={"required": True}, - ) - - tools = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").rules.Element.tools - tools.Element = AAZStrType() - - source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "Mcp").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_tls_inspection = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection") - disc_tls_inspection.certificate = AAZObjectType( - flags={"required": True}, - ) - disc_tls_inspection.source = AAZObjectType( - flags={"required": True}, - ) - - certificate = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").certificate - certificate.mode = AAZStrType( - flags={"required": True}, - ) - - source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "TlsInspection").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - disc_url_filtering = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering") - disc_url_filtering.default_action = AAZStrType( - serialized_name="defaultAction", - flags={"required": True}, - ) - disc_url_filtering.destination = AAZObjectType() - disc_url_filtering.rules = AAZListType( - flags={"required": True}, - ) - disc_url_filtering.source = AAZObjectType( - flags={"required": True}, - ) - - destination = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination - destination.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns") - disc_fqdns.fqdns = AAZListType( - flags={"required": True}, - ) - - fqdns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "Fqdns").fqdns - fqdns.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").destination.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - rules = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules - rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element - _element.action = AAZStrType( - flags={"required": True}, - ) - _element.hostname = AAZStrType() - _element.method = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.paths = AAZListType() - _element.priority = AAZIntType( - flags={"required": True}, - ) - - paths = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").rules.Element.paths - paths.Element = AAZStrType() - - source = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source - source.type = AAZStrType( - flags={"required": True}, - ) - - disc_address_prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes") - disc_address_prefixes.prefixes = AAZListType( - flags={"required": True}, - ) - - prefixes = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "AddressPrefixes").prefixes - prefixes.Element = AAZStrType() - - disc_workload_id_patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns") - disc_workload_id_patterns.patterns = AAZListType( - flags={"required": True}, - ) - - patterns = cls._schema_on_200.properties.network_security_policies.Element.discriminate_by("type", "UrlFiltering").source.discriminate_by("type", "WorkloadIdPatterns").patterns - patterns.Element = AAZStrType() - - system_data = cls._schema_on_200.system_data - system_data.created_at = AAZStrType( - serialized_name="createdAt", - ) - system_data.created_by = AAZStrType( - serialized_name="createdBy", - ) - system_data.created_by_type = AAZStrType( - serialized_name="createdByType", - ) - system_data.last_modified_at = AAZStrType( - serialized_name="lastModifiedAt", - ) - system_data.last_modified_by = AAZStrType( - serialized_name="lastModifiedBy", - ) - system_data.last_modified_by_type = AAZStrType( - serialized_name="lastModifiedByType", - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - -__all__ = ["Wait"] diff --git a/src/agentmesh/azext_agentmesh/azext_metadata.json b/src/agentmesh/azext_agentmesh/azext_metadata.json deleted file mode 100644 index 71889bb136b..00000000000 --- a/src/agentmesh/azext_agentmesh/azext_metadata.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "azext.isPreview": true, - "azext.minCliCoreVersion": "2.75.0" -} \ No newline at end of file diff --git a/src/agentmesh/azext_agentmesh/commands.py b/src/agentmesh/azext_agentmesh/commands.py deleted file mode 100644 index b0d842e4993..00000000000 --- a/src/agentmesh/azext_agentmesh/commands.py +++ /dev/null @@ -1,15 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 - -# from azure.cli.core.commands import CliCommandType - - -def load_command_table(self, _): # pylint: disable=unused-argument - pass diff --git a/src/agentmesh/azext_agentmesh/custom.py b/src/agentmesh/azext_agentmesh/custom.py deleted file mode 100644 index 86df1e48ef5..00000000000 --- a/src/agentmesh/azext_agentmesh/custom.py +++ /dev/null @@ -1,14 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 - -from knack.log import get_logger - - -logger = get_logger(__name__) diff --git a/src/agentmesh/azext_agentmesh/tests/__init__.py b/src/agentmesh/azext_agentmesh/tests/__init__.py deleted file mode 100644 index 5757aea3175..00000000000 --- a/src/agentmesh/azext_agentmesh/tests/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 -# -------------------------------------------------------------------------------------------- diff --git a/src/agentmesh/azext_agentmesh/tests/latest/__init__.py b/src/agentmesh/azext_agentmesh/tests/latest/__init__.py deleted file mode 100644 index 5757aea3175..00000000000 --- a/src/agentmesh/azext_agentmesh/tests/latest/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 -# -------------------------------------------------------------------------------------------- diff --git a/src/agentmesh/azext_agentmesh/tests/latest/recordings/test_agentmesh_command_help.yaml b/src/agentmesh/azext_agentmesh/tests/latest/recordings/test_agentmesh_command_help.yaml deleted file mode 100644 index 591dc7c3b1a..00000000000 --- a/src/agentmesh/azext_agentmesh/tests/latest/recordings/test_agentmesh_command_help.yaml +++ /dev/null @@ -1,44 +0,0 @@ -interactions: -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - python-requests/2.33.0 - method: GET - uri: https://aka.ms/azExtCmdTree - response: - body: - string: '' - headers: - cache-control: - - max-age=0, no-cache, no-store - connection: - - keep-alive - content-length: - - '0' - date: - - Tue, 15 Sep 2026 22:07:43 GMT - expires: - - Tue, 15 Sep 2026 22:07:43 GMT - location: - - https://azurecliextensionsync.blob.core.windows.net/cmd-index/extensionCommandTree.json - pragma: - - no-cache - request-context: - - appId=cid-v1:d94c0f68-64bf-4036-8409-a0e761bb7ee1 - server: - - Kestrel - strict-transport-security: - - max-age=31536000 ; includeSubDomains - x-response-cache-status: - - 'True' - status: - code: 301 - message: Moved Permanently -version: 1 diff --git a/src/agentmesh/azext_agentmesh/tests/latest/test_agentmesh.py b/src/agentmesh/azext_agentmesh/tests/latest/test_agentmesh.py deleted file mode 100644 index 8a9a42c3bc0..00000000000 --- a/src/agentmesh/azext_agentmesh/tests/latest/test_agentmesh.py +++ /dev/null @@ -1,172 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 -# -------------------------------------------------------------------------------------------- - -import importlib -import unittest -from unittest.mock import MagicMock - -from azure.cli.testsdk import ScenarioTest - - -COMMANDS = ( - ("agentmesh fabric create", "azext_agentmesh.aaz.latest.agentmesh.fabric._create", "Create"), - ("agentmesh fabric show", "azext_agentmesh.aaz.latest.agentmesh.fabric._show", "Show"), - ("agentmesh fabric list", "azext_agentmesh.aaz.latest.agentmesh.fabric._list", "List"), - ("agentmesh fabric update", "azext_agentmesh.aaz.latest.agentmesh.fabric._update", "Update"), - ("agentmesh fabric delete", "azext_agentmesh.aaz.latest.agentmesh.fabric._delete", "Delete"), - ( - "agentmesh fabric member create", - "azext_agentmesh.aaz.latest.agentmesh.fabric.member._create", - "Create", - ), - ( - "agentmesh fabric member show", - "azext_agentmesh.aaz.latest.agentmesh.fabric.member._show", - "Show", - ), - ( - "agentmesh fabric member list", - "azext_agentmesh.aaz.latest.agentmesh.fabric.member._list", - "List", - ), - ( - "agentmesh fabric member update", - "azext_agentmesh.aaz.latest.agentmesh.fabric.member._update", - "Update", - ), - ( - "agentmesh fabric member delete", - "azext_agentmesh.aaz.latest.agentmesh.fabric.member._delete", - "Delete", - ), - ( - "agentmesh policy-group create", - "azext_agentmesh.aaz.latest.agentmesh.policy_group._create", - "Create", - ), - ( - "agentmesh policy-group show", - "azext_agentmesh.aaz.latest.agentmesh.policy_group._show", - "Show", - ), - ( - "agentmesh policy-group list", - "azext_agentmesh.aaz.latest.agentmesh.policy_group._list", - "List", - ), - ( - "agentmesh policy-group update", - "azext_agentmesh.aaz.latest.agentmesh.policy_group._update", - "Update", - ), - ( - "agentmesh policy-group delete", - "azext_agentmesh.aaz.latest.agentmesh.policy_group._delete", - "Delete", - ), -) - -HELP_ONLY_COMMANDS = ( - "agentmesh fabric wait", - "agentmesh fabric member wait", - "agentmesh policy-group wait", -) - -REQUEST_SHAPES = ( - ( - "azext_agentmesh.aaz.latest.agentmesh.fabric._create", - "Create", - "AgentFabricsCreateOrUpdate", - "PUT", - ), - ( - "azext_agentmesh.aaz.latest.agentmesh.fabric._update", - "Update", - "AgentFabricsUpdate", - "PATCH", - ), - ( - "azext_agentmesh.aaz.latest.agentmesh.fabric._delete", - "Delete", - "AgentFabricsDelete", - "DELETE", - ), - ( - "azext_agentmesh.aaz.latest.agentmesh.fabric.member._create", - "Create", - "MembersCreateOrUpdate", - "PUT", - ), - ( - "azext_agentmesh.aaz.latest.agentmesh.fabric.member._update", - "Update", - "MembersUpdate", - "PATCH", - ), - ( - "azext_agentmesh.aaz.latest.agentmesh.fabric.member._delete", - "Delete", - "MembersDelete", - "DELETE", - ), - ( - "azext_agentmesh.aaz.latest.agentmesh.policy_group._create", - "Create", - "PolicyGroupsCreateOrUpdate", - "PUT", - ), - ( - "azext_agentmesh.aaz.latest.agentmesh.policy_group._update", - "Update", - "PolicyGroupsUpdate", - "PATCH", - ), - ( - "azext_agentmesh.aaz.latest.agentmesh.policy_group._delete", - "Delete", - "PolicyGroupsDelete", - "DELETE", - ), -) - - -class AgentmeshScenario(ScenarioTest): - - def test_agentmesh_command_help(self): - commands = ( - "agentmesh", - "agentmesh fabric", - "agentmesh fabric member", - "agentmesh policy-group", - *(command for command, _, _ in COMMANDS), - *HELP_ONLY_COMMANDS, - ) - for command in commands: - try: - self.cmd(f"az {command} --help") - except SystemExit as ex: - self.assertEqual(ex.code, 0, f"{command} help failed") - - -class AgentmeshGeneratedCommandTest(unittest.TestCase): - - def test_all_commands_have_generated_examples(self): - for command, module_name, class_name in COMMANDS: - command_class = getattr(importlib.import_module(module_name), class_name) - self.assertIn(":example:", command_class.__doc__, command) - self.assertIn(f"az {command}", command_class.__doc__, command) - - def test_lro_request_shapes(self): - for module_name, class_name, operation_name, method in REQUEST_SHAPES: - command_class = getattr(importlib.import_module(module_name), class_name) - operation_class = getattr(command_class, operation_name) - operation = operation_class(ctx=MagicMock()) - self.assertEqual(operation.method, method) - self.assertEqual( - operation.query_parameters, - {"api-version": "2026-07-21-preview"}, - ) diff --git a/src/agentmesh/linter_exclusions.yml b/src/agentmesh/linter_exclusions.yml deleted file mode 100644 index 245f8957d2b..00000000000 --- a/src/agentmesh/linter_exclusions.yml +++ /dev/null @@ -1,5 +0,0 @@ -agentmesh policy-group create: - parameters: - network_security_policies: - rule_exclusions: - - option_length_too_long diff --git a/src/agentmesh/setup.cfg b/src/agentmesh/setup.cfg deleted file mode 100644 index 2fdd96e5d39..00000000000 --- a/src/agentmesh/setup.cfg +++ /dev/null @@ -1 +0,0 @@ -#setup.cfg \ No newline at end of file diff --git a/src/agentmesh/setup.py b/src/agentmesh/setup.py deleted file mode 100644 index 48c1f55ba8d..00000000000 --- a/src/agentmesh/setup.py +++ /dev/null @@ -1,51 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 codecs import open -from setuptools import setup, find_packages - - -# HISTORY.rst entry. -VERSION = '1.0.0b1' - -# 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.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'Programming Language :: Python :: 3.12', - 'Programming Language :: Python :: 3.13', - 'License :: OSI Approved :: MIT License', -] - -DEPENDENCIES = [] - -with open('README.md', 'r', encoding='utf-8') as f: - README = f.read() -with open('HISTORY.rst', 'r', encoding='utf-8') as f: - HISTORY = f.read() - -setup( - name='agentmesh', - version=VERSION, - description='Microsoft Azure Command-Line Tools Agent Mesh Extension.', - long_description=README + '\n\n' + HISTORY, - license='MIT', - author='Microsoft Corporation', - author_email='azpycli@microsoft.com', - url='https://github.com/Azure/azure-cli-extensions/tree/main/src/agentmesh', - classifiers=CLASSIFIERS, - packages=find_packages(exclude=["tests"]), - package_data={'azext_agentmesh': ['azext_metadata.json']}, - install_requires=DEPENDENCIES -) diff --git a/src/service_name.json b/src/service_name.json index c17b3e3fa44..006623a8062 100644 --- a/src/service_name.json +++ b/src/service_name.json @@ -29,11 +29,6 @@ "AzureServiceName": "Azure Agent Fabric", "URL": "" }, - { - "Command": "az agentmesh", - "AzureServiceName": "Azure Agent Mesh", - "URL": "" - }, { "Command": "az ai-examples", "AzureServiceName": "AI Examples", From 19cc52cc36f562c57bac5cf700a4e20e5dbdec88 Mon Sep 17 00:00:00 2001 From: Kshitija Murudi Date: Tue, 22 Sep 2026 10:18:35 -0700 Subject: [PATCH 4/8] Retry CI after transient index outage Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> From 8c3cc5660d84e6b87ecae4c4aee998701f5e69f6 Mon Sep 17 00:00:00 2001 From: Kshitija Murudi Date: Tue, 22 Sep 2026 11:12:34 -0700 Subject: [PATCH 5/8] Add Agent Fabric cluster associations Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/agentfabric/HISTORY.rst | 3 +- src/agentfabric/README.md | 40 +- .../cluster_association/__cmd_group.py | 23 + .../cluster_association/__init__.py | 17 + .../cluster_association/_create.py | 294 ++++++++++++ .../cluster_association/_delete.py | 179 ++++++++ .../agentfabric/cluster_association/_list.py | 235 ++++++++++ .../agentfabric/cluster_association/_show.py | 236 ++++++++++ .../cluster_association/_update.py | 426 ++++++++++++++++++ .../agentfabric/cluster_association/_wait.py | 232 ++++++++++ .../tests/latest/test_agentfabric.py | 124 ++++- 11 files changed, 1799 insertions(+), 10 deletions(-) create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/__cmd_group.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/__init__.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_create.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_delete.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_list.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_show.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_update.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_wait.py diff --git a/src/agentfabric/HISTORY.rst b/src/agentfabric/HISTORY.rst index 6e680cb998e..a1b3fa7b213 100644 --- a/src/agentfabric/HISTORY.rst +++ b/src/agentfabric/HISTORY.rst @@ -6,4 +6,5 @@ Release History 1.0.0b1 ++++++ * Initial preview release for Azure Agent Fabric using API version ``2026-07-21-preview``. -* Add Agent Fabric, member, and Policy Group create, show, list, update, delete, and wait commands. \ No newline at end of file +* Add Agent Fabric, member, and Policy Group create, show, list, update, delete, and wait commands. +* Add Cluster Association create, show, list, update, delete, and wait commands using API version ``2026-09-10-preview``. \ No newline at end of file diff --git a/src/agentfabric/README.md b/src/agentfabric/README.md index 2fe8c988336..8d9b2061283 100644 --- a/src/agentfabric/README.md +++ b/src/agentfabric/README.md @@ -1,15 +1,18 @@ # Azure CLI Agent Fabric Extension -This extension manages Azure Agent Fabric resources, their child members, and -independent Policy Group peer resources. It uses the `Microsoft.NetworkSecurity` -resource provider API version `2026-07-21-preview`. +This extension manages Azure Agent Fabric resources, their child members and +cluster associations, and independent Policy Group peer resources. It uses the +`Microsoft.NetworkSecurity` resource provider API version +`2026-07-21-preview`, with Cluster Associations using +`2026-09-10-preview`. ## Resource hierarchy ```text Microsoft.NetworkSecurity ├── agentFabrics/{fabricName} (independent top-level resource) -│ └── members/{memberName} (child of an Agent Fabric) +│ ├── members/{memberName} (child of an Agent Fabric) +│ └── clusterAssociations/{clusterAssociationName} (child of an Agent Fabric) └── policyGroups/{policyGroupName} (independent top-level peer resource) ``` @@ -57,6 +60,30 @@ az agentfabric member show \ --member-name myMember ``` +## Cluster Associations + +Cluster Associations enroll AKS managed clusters with an Agent Fabric. The +cluster must be in the same subscription as the Agent Fabric, but it can be in +a different resource group. The cluster resource ID is immutable; delete and +recreate the association to enroll a different cluster. + +```bash +az agentfabric cluster-association create \ + --resource-group myResourceGroup \ + --fabric-name myFabric \ + --name myClusterAssociation \ + --cluster-resource-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myAksResourceGroup/providers/Microsoft.ContainerService/managedClusters/myCluster \ + --sku Standard \ + --if-none-match '*' + +az agentfabric cluster-association show \ + --resource-group myResourceGroup \ + --fabric-name myFabric \ + --name myClusterAssociation +``` + +Supported SKUs are `Standard` and `Premium`. + ## Policy Groups Policy Groups are independent resource-group-scoped @@ -77,5 +104,6 @@ az agentfabric policy-group show \ Policy Group ARM IDs end with `/policyGroups/{name}`. -Long-running create, update, and delete operations support `--no-wait`. Use the -corresponding `wait` command to wait for provisioning to reach a target state. +Long-running create, update, and delete operations support `--no-wait`. Use +the corresponding `wait` command to wait for provisioning to reach a target +state. diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/__cmd_group.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/__cmd_group.py new file mode 100644 index 00000000000..b0301be466b --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/__cmd_group.py @@ -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( + "agentfabric cluster-association", +) +class __CMDGroup(AAZCommandGroup): + """Manage Cluster Association + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/__init__.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/__init__.py @@ -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 * diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_create.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_create.py new file mode 100644 index 00000000000..c956fb3a4cf --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_create.py @@ -0,0 +1,294 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric cluster-association create", +) +class Create(AAZCommand): + """Create a ClusterAssociation + + :example: ClusterAssociations_CreateOrUpdate + az agentfabric cluster-association create --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-association-name testClusterAssociation --if-none-match * --cluster-resource-id /subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgaks/providers/Microsoft.ContainerService/managedClusters/testCluster --sku Standard + """ + + _aaz_info = { + "version": "2026-09-10-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/clusterassociations/{}", "2026-09-10-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.if_none_match = AAZStrArg( + options=["--if-none-match"], + help="Set to \"*\" when creating an association to require that the resource does not already exist. The service returns 412 Precondition Failed when the condition is not met.", + enum={"*": "*"}, + ) + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="The name of the AgentFabric", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.cluster_association_name = AAZStrArg( + options=["-n", "--name", "--cluster-association-name"], + help="The name of the ClusterAssociation", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.cluster_resource_id = AAZResourceIdArg( + options=["--cluster-resource-id"], + arg_group="Properties", + help="The AKS managed cluster to enroll. The cluster must be in the same subscription as the AgentFabric; a different resource group is allowed. Set at creation and immutable thereafter; to enroll a different cluster, delete and recreate the association.", + required=True, + ) + _args_schema.sku = AAZStrArg( + options=["--sku"], + arg_group="Properties", + help="Determines which AgentFabric components are deployed to the cluster. Defaults to Standard when omitted at creation and remains unchanged when omitted during an update.", + enum={"Premium": "Premium", "Standard": "Standard"}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ClusterAssociationsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ClusterAssociationsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/clusterAssociations/{clusterAssociationName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "clusterAssociationName", self.ctx.args.cluster_association_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-09-10-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "If-None-Match", self.ctx.args.if_none_match, + ), + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("clusterResourceId", AAZStrType, ".cluster_resource_id", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("sku", AAZStrType, ".sku") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType() + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.cluster_resource_id = AAZStrType( + serialized_name="clusterResourceId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.sku = AAZStrType() + properties.status = AAZObjectType( + flags={"read_only": True}, + ) + + status = cls._schema_on_200_201.properties.status + status.code = AAZStrType( + flags={"read_only": True}, + ) + status.message = AAZStrType( + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_delete.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_delete.py new file mode 100644 index 00000000000..849565105c9 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_delete.py @@ -0,0 +1,179 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric cluster-association delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete a ClusterAssociation + + :example: ClusterAssociations_Delete + az agentfabric cluster-association delete --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-association-name testClusterAssociation + """ + + _aaz_info = { + "version": "2026-09-10-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/clusterassociations/{}", "2026-09-10-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.cluster_association_name = AAZStrArg( + options=["-n", "--name", "--cluster-association-name"], + help="The name of the ClusterAssociation", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ClusterAssociationsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ClusterAssociationsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/clusterAssociations/{clusterAssociationName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "clusterAssociationName", self.ctx.args.cluster_association_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-09-10-preview", + required=True, + ), + } + return parameters + + def on_204(self, session): + pass + + def on_200_201(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_list.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_list.py new file mode 100644 index 00000000000..2183d05f942 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_list.py @@ -0,0 +1,235 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric cluster-association list", +) +class List(AAZCommand): + """List ClusterAssociation resources by AgentFabric + + :example: ClusterAssociations_ListByParent + az agentfabric cluster-association list --resource-group rgnetworksecurity --fabric-name testAIFabric + """ + + _aaz_info = { + "version": "2026-09-10-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/clusterassociations", "2026-09-10-preview"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="The name of the AgentFabric", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ClusterAssociationsListByParent(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class ClusterAssociationsListByParent(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/clusterAssociations", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-09-10-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.cluster_resource_id = AAZStrType( + serialized_name="clusterResourceId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.sku = AAZStrType() + properties.status = AAZObjectType( + flags={"read_only": True}, + ) + + status = cls._schema_on_200.value.Element.properties.status + status.code = AAZStrType( + flags={"read_only": True}, + ) + status.message = AAZStrType( + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_show.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_show.py new file mode 100644 index 00000000000..8d9ee016566 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_show.py @@ -0,0 +1,236 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric cluster-association show", +) +class Show(AAZCommand): + """Get a ClusterAssociation + + :example: ClusterAssociations_Get + az agentfabric cluster-association show --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-association-name testClusterAssociation + """ + + _aaz_info = { + "version": "2026-09-10-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/clusterassociations/{}", "2026-09-10-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.cluster_association_name = AAZStrArg( + options=["-n", "--name", "--cluster-association-name"], + help="The name of the ClusterAssociation", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ClusterAssociationsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ClusterAssociationsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/clusterAssociations/{clusterAssociationName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "clusterAssociationName", self.ctx.args.cluster_association_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-09-10-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.cluster_resource_id = AAZStrType( + serialized_name="clusterResourceId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.sku = AAZStrType() + properties.status = AAZObjectType( + flags={"read_only": True}, + ) + + status = cls._schema_on_200.properties.status + status.code = AAZStrType( + flags={"read_only": True}, + ) + status.message = AAZStrType( + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_update.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_update.py new file mode 100644 index 00000000000..0f80e847f14 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_update.py @@ -0,0 +1,426 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric cluster-association update", +) +class Update(AAZCommand): + """Update a ClusterAssociation + + :example: ClusterAssociations_CreateOrUpdate + az agentfabric cluster-association update --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-association-name testClusterAssociation --sku Premium + """ + + _aaz_info = { + "version": "2026-09-10-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/clusterassociations/{}", "2026-09-10-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.cluster_association_name = AAZStrArg( + options=["-n", "--name", "--cluster-association-name"], + help="The name of the ClusterAssociation", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.sku = AAZStrArg( + options=["--sku"], + arg_group="Properties", + help="Determines which AgentFabric components are deployed to the cluster. Defaults to Standard when omitted at creation and remains unchanged when omitted during an update.", + nullable=True, + enum={"Premium": "Premium", "Standard": "Standard"}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ClusterAssociationsGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + yield self.ClusterAssociationsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + @register_callback + def pre_instance_update(self, instance): + pass + + @register_callback + def post_instance_update(self, instance): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ClusterAssociationsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/clusterAssociations/{clusterAssociationName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "clusterAssociationName", self.ctx.args.cluster_association_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-09-10-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + _UpdateHelper._build_schema_cluster_association_read(cls._schema_on_200) + + return cls._schema_on_200 + + class ClusterAssociationsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/clusterAssociations/{clusterAssociationName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "clusterAssociationName", self.ctx.args.cluster_association_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-09-10-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _UpdateHelper._build_schema_cluster_association_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("sku", AAZStrType, ".sku") + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_cluster_association_read = None + + @classmethod + def _build_schema_cluster_association_read(cls, _schema): + if cls._schema_cluster_association_read is not None: + _schema.id = cls._schema_cluster_association_read.id + _schema.name = cls._schema_cluster_association_read.name + _schema.properties = cls._schema_cluster_association_read.properties + _schema.system_data = cls._schema_cluster_association_read.system_data + _schema.type = cls._schema_cluster_association_read.type + return + + cls._schema_cluster_association_read = _schema_cluster_association_read = AAZObjectType() + + cluster_association_read = _schema_cluster_association_read + cluster_association_read.id = AAZStrType( + flags={"read_only": True}, + ) + cluster_association_read.name = AAZStrType( + flags={"read_only": True}, + ) + cluster_association_read.properties = AAZObjectType() + cluster_association_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + cluster_association_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_cluster_association_read.properties + properties.cluster_resource_id = AAZStrType( + serialized_name="clusterResourceId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.sku = AAZStrType() + properties.status = AAZObjectType( + flags={"read_only": True}, + ) + + status = _schema_cluster_association_read.properties.status + status.code = AAZStrType( + flags={"read_only": True}, + ) + status.message = AAZStrType( + flags={"read_only": True}, + ) + + system_data = _schema_cluster_association_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.id = cls._schema_cluster_association_read.id + _schema.name = cls._schema_cluster_association_read.name + _schema.properties = cls._schema_cluster_association_read.properties + _schema.system_data = cls._schema_cluster_association_read.system_data + _schema.type = cls._schema_cluster_association_read.type + + +__all__ = ["Update"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_wait.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_wait.py new file mode 100644 index 00000000000..733ad152da5 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_wait.py @@ -0,0 +1,232 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric cluster-association wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/clusterassociations/{}", "2026-09-10-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="The name of the AgentFabric", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.cluster_association_name = AAZStrArg( + options=["-n", "--name", "--cluster-association-name"], + help="The name of the ClusterAssociation", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ClusterAssociationsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class ClusterAssociationsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/clusterAssociations/{clusterAssociationName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "clusterAssociationName", self.ctx.args.cluster_association_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-09-10-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.cluster_resource_id = AAZStrType( + serialized_name="clusterResourceId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.sku = AAZStrType() + properties.status = AAZObjectType( + flags={"read_only": True}, + ) + + status = cls._schema_on_200.properties.status + status.code = AAZStrType( + flags={"read_only": True}, + ) + status.message = AAZStrType( + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/agentfabric/azext_agentfabric/tests/latest/test_agentfabric.py b/src/agentfabric/azext_agentfabric/tests/latest/test_agentfabric.py index d6b51ba482e..f53a8e13a04 100644 --- a/src/agentfabric/azext_agentfabric/tests/latest/test_agentfabric.py +++ b/src/agentfabric/azext_agentfabric/tests/latest/test_agentfabric.py @@ -44,6 +44,31 @@ "azext_agentfabric.aaz.latest.agentfabric.member._delete", "Delete", ), + ( + "agentfabric cluster-association create", + "azext_agentfabric.aaz.latest.agentfabric.cluster_association._create", + "Create", + ), + ( + "agentfabric cluster-association show", + "azext_agentfabric.aaz.latest.agentfabric.cluster_association._show", + "Show", + ), + ( + "agentfabric cluster-association list", + "azext_agentfabric.aaz.latest.agentfabric.cluster_association._list", + "List", + ), + ( + "agentfabric cluster-association update", + "azext_agentfabric.aaz.latest.agentfabric.cluster_association._update", + "Update", + ), + ( + "agentfabric cluster-association delete", + "azext_agentfabric.aaz.latest.agentfabric.cluster_association._delete", + "Delete", + ), ( "agentfabric policy-group create", "azext_agentfabric.aaz.latest.agentfabric.policy_group._create", @@ -74,6 +99,7 @@ HELP_ONLY_COMMANDS = ( "agentfabric wait", "agentfabric member wait", + "agentfabric cluster-association wait", "agentfabric policy-group wait", ) @@ -84,6 +110,7 @@ "AgentFabricsCreateOrUpdate", "PUT", "/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", + "2026-07-21-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric._update", @@ -91,6 +118,7 @@ "AgentFabricsUpdate", "PATCH", "/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", + "2026-07-21-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric._delete", @@ -98,6 +126,7 @@ "AgentFabricsDelete", "DELETE", "/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", + "2026-07-21-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric.member._create", @@ -105,6 +134,7 @@ "MembersCreateOrUpdate", "PUT", "/agentFabrics/{agentFabricName}/members/{memberName}", + "2026-07-21-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric.member._update", @@ -112,6 +142,7 @@ "MembersUpdate", "PATCH", "/agentFabrics/{agentFabricName}/members/{memberName}", + "2026-07-21-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric.member._delete", @@ -119,6 +150,47 @@ "MembersDelete", "DELETE", "/agentFabrics/{agentFabricName}/members/{memberName}", + "2026-07-21-preview", + ), + ( + "azext_agentfabric.aaz.latest.agentfabric.cluster_association._create", + "Create", + "ClusterAssociationsCreateOrUpdate", + "PUT", + "/agentFabrics/{agentFabricName}/clusterAssociations/{clusterAssociationName}", + "2026-09-10-preview", + ), + ( + "azext_agentfabric.aaz.latest.agentfabric.cluster_association._show", + "Show", + "ClusterAssociationsGet", + "GET", + "/agentFabrics/{agentFabricName}/clusterAssociations/{clusterAssociationName}", + "2026-09-10-preview", + ), + ( + "azext_agentfabric.aaz.latest.agentfabric.cluster_association._list", + "List", + "ClusterAssociationsListByParent", + "GET", + "/agentFabrics/{agentFabricName}/clusterAssociations", + "2026-09-10-preview", + ), + ( + "azext_agentfabric.aaz.latest.agentfabric.cluster_association._update", + "Update", + "ClusterAssociationsCreateOrUpdate", + "PUT", + "/agentFabrics/{agentFabricName}/clusterAssociations/{clusterAssociationName}", + "2026-09-10-preview", + ), + ( + "azext_agentfabric.aaz.latest.agentfabric.cluster_association._delete", + "Delete", + "ClusterAssociationsDelete", + "DELETE", + "/agentFabrics/{agentFabricName}/clusterAssociations/{clusterAssociationName}", + "2026-09-10-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric.policy_group._create", @@ -126,6 +198,7 @@ "PolicyGroupsCreateOrUpdate", "PUT", "/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", + "2026-07-21-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric.policy_group._update", @@ -133,6 +206,7 @@ "PolicyGroupsUpdate", "PATCH", "/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", + "2026-07-21-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric.policy_group._delete", @@ -140,6 +214,7 @@ "PolicyGroupsDelete", "DELETE", "/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", + "2026-07-21-preview", ), ) @@ -159,6 +234,7 @@ def test_agentfabric_command_help(self): commands = ( "agentfabric", "agentfabric member", + "agentfabric cluster-association", "agentfabric policy-group", *(command for command, _, _ in COMMANDS), *HELP_ONLY_COMMANDS, @@ -195,8 +271,15 @@ def test_all_commands_have_generated_examples(self): command, ) - def test_lro_request_shapes_and_resource_urls(self): - for module_name, class_name, operation_name, method, url_suffix in REQUEST_SHAPES: + def test_request_shapes_and_resource_urls(self): + for ( + module_name, + class_name, + operation_name, + method, + url_suffix, + api_version, + ) in REQUEST_SHAPES: command_class = getattr(importlib.import_module(module_name), class_name) operation_class = getattr(command_class, operation_name) operation = operation_class(ctx=MagicMock()) @@ -204,6 +287,41 @@ def test_lro_request_shapes_and_resource_urls(self): self.assertEqual(operation.method, method) self.assertEqual( operation.query_parameters, - {"api-version": "2026-07-21-preview"}, + {"api-version": api_version}, ) self.assertTrue(operation.url.endswith(url_suffix), operation.url) + + def test_cluster_association_contract(self): + create_module = importlib.import_module( + "azext_agentfabric.aaz.latest.agentfabric.cluster_association._create" + ) + create_schema = create_module.Create._build_arguments_schema() + self.assertTrue(create_schema.cluster_resource_id._required) + self.assertEqual( + create_schema.sku.enum.items, + {"Premium": "Premium", "Standard": "Standard"}, + ) + self.assertEqual(create_schema.if_none_match.enum.items, {"*": "*"}) + + update_module = importlib.import_module( + "azext_agentfabric.aaz.latest.agentfabric.cluster_association._update" + ) + update_schema = update_module.Update._build_arguments_schema() + self.assertFalse(hasattr(update_schema, "cluster_resource_id")) + self.assertFalse(hasattr(update_schema, "if_none_match")) + self.assertTrue(hasattr(update_schema, "sku")) + + show_module = importlib.import_module( + "azext_agentfabric.aaz.latest.agentfabric.cluster_association._show" + ) + output_schema = ( + show_module.Show.ClusterAssociationsGet._build_schema_on_200() + ) + self.assertEqual( + set(output_schema.properties._fields), + {"cluster_resource_id", "provisioning_state", "sku", "status"}, + ) + self.assertEqual( + set(output_schema.properties.status._fields), + {"code", "message"}, + ) From baeb0d55d40cdc4e7a563cb11d80d2c46705455b Mon Sep 17 00:00:00 2001 From: Kshitija Murudi Date: Tue, 22 Sep 2026 17:13:00 -0700 Subject: [PATCH 6/8] Sync Agent Fabric generated help Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../latest/agentfabric/cluster_association/__cmd_group.py | 2 +- .../aaz/latest/agentfabric/cluster_association/_create.py | 6 +++--- .../aaz/latest/agentfabric/cluster_association/_delete.py | 6 +++--- .../aaz/latest/agentfabric/cluster_association/_list.py | 4 ++-- .../aaz/latest/agentfabric/cluster_association/_show.py | 6 +++--- .../aaz/latest/agentfabric/cluster_association/_update.py | 6 +++--- .../aaz/latest/agentfabric/cluster_association/_wait.py | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/__cmd_group.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/__cmd_group.py index b0301be466b..e85983a6fc7 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/__cmd_group.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/__cmd_group.py @@ -15,7 +15,7 @@ "agentfabric cluster-association", ) class __CMDGroup(AAZCommandGroup): - """Manage Cluster Association + """Manage Cluster Association resources that are children of an Agent Fabric. The parent Fabric name is required. """ pass diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_create.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_create.py index c956fb3a4cf..7eaef6e7492 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_create.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_create.py @@ -15,7 +15,7 @@ "agentfabric cluster-association create", ) class Create(AAZCommand): - """Create a ClusterAssociation + """Create a Cluster Association resource as a child of an Agent Fabric. The parent Fabric name is required. :example: ClusterAssociations_CreateOrUpdate az agentfabric cluster-association create --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-association-name testClusterAssociation --if-none-match * --cluster-resource-id /subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgaks/providers/Microsoft.ContainerService/managedClusters/testCluster --sku Standard @@ -52,7 +52,7 @@ def _build_arguments_schema(cls, *args, **kwargs): ) _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], - help="The name of the AgentFabric", + help="The name of the parent Agent Fabric.", required=True, fmt=AAZStrArgFormat( pattern="^[a-zA-Z0-9-]{3,24}$", @@ -60,7 +60,7 @@ def _build_arguments_schema(cls, *args, **kwargs): ) _args_schema.cluster_association_name = AAZStrArg( options=["-n", "--name", "--cluster-association-name"], - help="The name of the ClusterAssociation", + help="The name of the Cluster Association.", required=True, fmt=AAZStrArgFormat( pattern="^[a-zA-Z0-9-]{3,24}$", diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_delete.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_delete.py index 849565105c9..845433000e1 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_delete.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_delete.py @@ -16,7 +16,7 @@ confirmation="Are you sure you want to perform this operation?", ) class Delete(AAZCommand): - """Delete a ClusterAssociation + """Delete a Cluster Association resource that is a child of an Agent Fabric. The parent Fabric name is required. :example: ClusterAssociations_Delete az agentfabric cluster-association delete --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-association-name testClusterAssociation @@ -48,7 +48,7 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], - help="The name of the AgentFabric", + help="The name of the parent Agent Fabric.", required=True, id_part="name", fmt=AAZStrArgFormat( @@ -57,7 +57,7 @@ def _build_arguments_schema(cls, *args, **kwargs): ) _args_schema.cluster_association_name = AAZStrArg( options=["-n", "--name", "--cluster-association-name"], - help="The name of the ClusterAssociation", + help="The name of the Cluster Association.", required=True, id_part="child_name_1", fmt=AAZStrArgFormat( diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_list.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_list.py index 2183d05f942..50b372395a0 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_list.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_list.py @@ -15,7 +15,7 @@ "agentfabric cluster-association list", ) class List(AAZCommand): - """List ClusterAssociation resources by AgentFabric + """List Cluster Association resources that are children of an Agent Fabric. The parent Fabric name is required. :example: ClusterAssociations_ListByParent az agentfabric cluster-association list --resource-group rgnetworksecurity --fabric-name testAIFabric @@ -47,7 +47,7 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], - help="The name of the AgentFabric", + help="The name of the parent Agent Fabric.", required=True, fmt=AAZStrArgFormat( pattern="^[a-zA-Z0-9-]{3,24}$", diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_show.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_show.py index 8d9ee016566..58230ff9275 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_show.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_show.py @@ -15,7 +15,7 @@ "agentfabric cluster-association show", ) class Show(AAZCommand): - """Get a ClusterAssociation + """Show a Cluster Association resource that is a child of an Agent Fabric. The parent Fabric name is required. :example: ClusterAssociations_Get az agentfabric cluster-association show --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-association-name testClusterAssociation @@ -46,7 +46,7 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], - help="The name of the AgentFabric", + help="The name of the parent Agent Fabric.", required=True, id_part="name", fmt=AAZStrArgFormat( @@ -55,7 +55,7 @@ def _build_arguments_schema(cls, *args, **kwargs): ) _args_schema.cluster_association_name = AAZStrArg( options=["-n", "--name", "--cluster-association-name"], - help="The name of the ClusterAssociation", + help="The name of the Cluster Association.", required=True, id_part="child_name_1", fmt=AAZStrArgFormat( diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_update.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_update.py index 0f80e847f14..1330c800e4a 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_update.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_update.py @@ -15,7 +15,7 @@ "agentfabric cluster-association update", ) class Update(AAZCommand): - """Update a ClusterAssociation + """Update a Cluster Association resource that is a child of an Agent Fabric. The parent Fabric name is required. :example: ClusterAssociations_CreateOrUpdate az agentfabric cluster-association update --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-association-name testClusterAssociation --sku Premium @@ -49,7 +49,7 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], - help="The name of the AgentFabric", + help="The name of the parent Agent Fabric.", required=True, id_part="name", fmt=AAZStrArgFormat( @@ -58,7 +58,7 @@ def _build_arguments_schema(cls, *args, **kwargs): ) _args_schema.cluster_association_name = AAZStrArg( options=["-n", "--name", "--cluster-association-name"], - help="The name of the ClusterAssociation", + help="The name of the Cluster Association.", required=True, id_part="child_name_1", fmt=AAZStrArgFormat( diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_wait.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_wait.py index 733ad152da5..d3240f9d207 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_wait.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_wait.py @@ -42,7 +42,7 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], - help="The name of the AgentFabric", + help="The name of the parent Agent Fabric.", required=True, id_part="name", fmt=AAZStrArgFormat( @@ -51,7 +51,7 @@ def _build_arguments_schema(cls, *args, **kwargs): ) _args_schema.cluster_association_name = AAZStrArg( options=["-n", "--name", "--cluster-association-name"], - help="The name of the ClusterAssociation", + help="The name of the Cluster Association.", required=True, id_part="child_name_1", fmt=AAZStrArgFormat( From d6c348c8b223bdc3ea36c595e0b1e5cf7c19ff7b Mon Sep 17 00:00:00 2001 From: Kshitija Murudi Date: Thu, 24 Sep 2026 11:31:20 -0700 Subject: [PATCH 7/8] Replace cluster associations with AKS enrollment Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/agentfabric/HISTORY.rst | 2 +- src/agentfabric/README.md | 41 ++++++------ .../__cmd_group.py | 4 +- .../{cluster_association => aks}/__init__.py | 4 +- .../_create.py => aks/_attach.py} | 34 +++++----- .../_delete.py => aks/_detach.py} | 24 +++---- .../{cluster_association => aks}/_list.py | 8 +-- .../{cluster_association => aks}/_show.py | 16 ++--- .../{cluster_association => aks}/_update.py | 18 +++--- .../{cluster_association => aks}/_wait.py | 10 +-- .../test_agentfabric_command_help.yaml | 44 +++++++++++++ .../tests/latest/test_agentfabric.py | 62 ++++++++++--------- 12 files changed, 154 insertions(+), 113 deletions(-) rename src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/{cluster_association => aks}/__cmd_group.py (75%) rename src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/{cluster_association => aks}/__init__.py (92%) rename src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/{cluster_association/_create.py => aks/_attach.py} (87%) rename src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/{cluster_association/_delete.py => aks/_detach.py} (88%) rename src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/{cluster_association => aks}/_list.py (95%) rename src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/{cluster_association => aks}/_show.py (92%) rename src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/{cluster_association => aks}/_update.py (95%) rename src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/{cluster_association => aks}/_wait.py (96%) create mode 100644 src/agentfabric/azext_agentfabric/tests/latest/recordings/test_agentfabric_command_help.yaml diff --git a/src/agentfabric/HISTORY.rst b/src/agentfabric/HISTORY.rst index a1b3fa7b213..593752b11b8 100644 --- a/src/agentfabric/HISTORY.rst +++ b/src/agentfabric/HISTORY.rst @@ -7,4 +7,4 @@ Release History ++++++ * Initial preview release for Azure Agent Fabric using API version ``2026-07-21-preview``. * Add Agent Fabric, member, and Policy Group create, show, list, update, delete, and wait commands. -* Add Cluster Association create, show, list, update, delete, and wait commands using API version ``2026-09-10-preview``. \ No newline at end of file +* Add AKS attach, show, list, update, detach, and wait enrollment commands using API version ``2026-09-10-preview``. \ No newline at end of file diff --git a/src/agentfabric/README.md b/src/agentfabric/README.md index 8d9b2061283..91d54e37956 100644 --- a/src/agentfabric/README.md +++ b/src/agentfabric/README.md @@ -1,10 +1,9 @@ # Azure CLI Agent Fabric Extension -This extension manages Azure Agent Fabric resources, their child members and -cluster associations, and independent Policy Group peer resources. It uses the +This extension manages Azure Agent Fabric resources, AKS cluster enrollment, +child members, and independent Policy Group peer resources. It uses the `Microsoft.NetworkSecurity` resource provider API version -`2026-07-21-preview`, with Cluster Associations using -`2026-09-10-preview`. +`2026-07-21-preview`, with AKS enrollment using `2026-09-10-preview`. ## Resource hierarchy @@ -12,7 +11,7 @@ cluster associations, and independent Policy Group peer resources. It uses the Microsoft.NetworkSecurity ├── agentFabrics/{fabricName} (independent top-level resource) │ ├── members/{memberName} (child of an Agent Fabric) -│ └── clusterAssociations/{clusterAssociationName} (child of an Agent Fabric) +│ └── clusterAssociations/{clusterName} (AKS enrollment implementation resource) └── policyGroups/{policyGroupName} (independent top-level peer resource) ``` @@ -60,29 +59,31 @@ az agentfabric member show \ --member-name myMember ``` -## Cluster Associations +## AKS enrollment -Cluster Associations enroll AKS managed clusters with an Agent Fabric. The -cluster must be in the same subscription as the Agent Fabric, but it can be in -a different resource group. The cluster resource ID is immutable; delete and -recreate the association to enroll a different cluster. +Create the Agent Fabric separately, then use `az agentfabric aks` to attach +AKS managed clusters. The cluster must be in the same subscription as the +Agent Fabric, but it can be in a different resource group. The AKS cluster name +is used as the underlying Cluster Association child resource name, while the +cluster resource ID is immutable. ```bash -az agentfabric cluster-association create \ +az agentfabric aks attach \ --resource-group myResourceGroup \ --fabric-name myFabric \ - --name myClusterAssociation \ + --cluster-name myCluster \ --cluster-resource-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myAksResourceGroup/providers/Microsoft.ContainerService/managedClusters/myCluster \ - --sku Standard \ - --if-none-match '*' + --sku Standard -az agentfabric cluster-association show \ +az agentfabric aks show \ --resource-group myResourceGroup \ --fabric-name myFabric \ - --name myClusterAssociation + --cluster-name myCluster ``` -Supported SKUs are `Standard` and `Premium`. +Supported SKUs are `Standard` and `Premium`. Run `aks attach` once per AKS +cluster to enroll multiple clusters in the same Agent Fabric. Use `aks update` +to change an enrollment SKU and `aks detach` to remove an enrollment. ## Policy Groups @@ -104,6 +105,6 @@ az agentfabric policy-group show \ Policy Group ARM IDs end with `/policyGroups/{name}`. -Long-running create, update, and delete operations support `--no-wait`. Use -the corresponding `wait` command to wait for provisioning to reach a target -state. +Long-running create, attach, update, detach, and delete operations support +`--no-wait`. Use the corresponding `wait` command to wait for provisioning to +reach a target state. diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/__cmd_group.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/__cmd_group.py similarity index 75% rename from src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/__cmd_group.py rename to src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/__cmd_group.py index e85983a6fc7..fb704394cd2 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/__cmd_group.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/__cmd_group.py @@ -12,10 +12,10 @@ @register_command_group( - "agentfabric cluster-association", + "agentfabric aks", ) class __CMDGroup(AAZCommandGroup): - """Manage Cluster Association resources that are children of an Agent Fabric. The parent Fabric name is required. + """Manage AKS cluster enrollment with an Agent Fabric. Commands use the AKS cluster name as the association child name and require the parent Fabric name. """ pass diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/__init__.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/__init__.py similarity index 92% rename from src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/__init__.py rename to src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/__init__.py index db73033039b..84fd64b5035 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/__init__.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/__init__.py @@ -9,8 +9,8 @@ # flake8: noqa from .__cmd_group import * -from ._create import * -from ._delete import * +from ._attach import * +from ._detach import * from ._list import * from ._show import * from ._update import * diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_create.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_attach.py similarity index 87% rename from src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_create.py rename to src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_attach.py index 7eaef6e7492..f5bb4462505 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_create.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_attach.py @@ -12,13 +12,13 @@ @register_command( - "agentfabric cluster-association create", + "agentfabric aks attach", ) -class Create(AAZCommand): - """Create a Cluster Association resource as a child of an Agent Fabric. The parent Fabric name is required. +class Attach(AAZCommand): + """Attach an AKS cluster to an Agent Fabric. The parent Fabric name and AKS cluster name are required. - :example: ClusterAssociations_CreateOrUpdate - az agentfabric cluster-association create --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-association-name testClusterAssociation --if-none-match * --cluster-resource-id /subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgaks/providers/Microsoft.ContainerService/managedClusters/testCluster --sku Standard + :example: Attach an AKS cluster + az agentfabric aks attach --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-name testCluster --cluster-resource-id /subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgaks/providers/Microsoft.ContainerService/managedClusters/testCluster --sku Standard """ _aaz_info = { @@ -45,23 +45,20 @@ def _build_arguments_schema(cls, *args, **kwargs): # define Arg Group "" _args_schema = cls._args_schema - _args_schema.if_none_match = AAZStrArg( - options=["--if-none-match"], - help="Set to \"*\" when creating an association to require that the resource does not already exist. The service returns 412 Precondition Failed when the condition is not met.", - enum={"*": "*"}, - ) _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], help="The name of the parent Agent Fabric.", required=True, + id_part="name", fmt=AAZStrArgFormat( pattern="^[a-zA-Z0-9-]{3,24}$", ), ) - _args_schema.cluster_association_name = AAZStrArg( - options=["-n", "--name", "--cluster-association-name"], - help="The name of the Cluster Association.", + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the AKS cluster. This value is used as the Cluster Association ARM child resource name.", required=True, + id_part="child_name_1", fmt=AAZStrArgFormat( pattern="^[a-zA-Z0-9-]{3,24}$", ), @@ -154,7 +151,7 @@ def url_parameters(self): required=True, ), **self.serialize_url_param( - "clusterAssociationName", self.ctx.args.cluster_association_name, + "clusterAssociationName", self.ctx.args.cluster_name, required=True, ), **self.serialize_url_param( @@ -181,9 +178,6 @@ def query_parameters(self): @property def header_parameters(self): parameters = { - **self.serialize_header_param( - "If-None-Match", self.ctx.args.if_none_match, - ), **self.serialize_header_param( "Content-Type", "application/json", ), @@ -287,8 +281,8 @@ def _build_schema_on_200_201(cls): return cls._schema_on_200_201 -class _CreateHelper: - """Helper class for Create""" +class _AttachHelper: + """Helper class for Attach""" -__all__ = ["Create"] +__all__ = ["Attach"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_delete.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_detach.py similarity index 88% rename from src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_delete.py rename to src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_detach.py index 845433000e1..91f32b74b58 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_delete.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_detach.py @@ -12,14 +12,14 @@ @register_command( - "agentfabric cluster-association delete", + "agentfabric aks detach", confirmation="Are you sure you want to perform this operation?", ) -class Delete(AAZCommand): - """Delete a Cluster Association resource that is a child of an Agent Fabric. The parent Fabric name is required. +class Detach(AAZCommand): + """Detach an AKS cluster from an Agent Fabric. The parent Fabric name and AKS cluster name are required. - :example: ClusterAssociations_Delete - az agentfabric cluster-association delete --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-association-name testClusterAssociation + :example: Detach an AKS cluster + az agentfabric aks detach --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-name testCluster """ _aaz_info = { @@ -55,9 +55,9 @@ def _build_arguments_schema(cls, *args, **kwargs): pattern="^[a-zA-Z0-9-]{3,24}$", ), ) - _args_schema.cluster_association_name = AAZStrArg( - options=["-n", "--name", "--cluster-association-name"], - help="The name of the Cluster Association.", + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the AKS cluster. This value is used as the Cluster Association ARM child resource name.", required=True, id_part="child_name_1", fmt=AAZStrArgFormat( @@ -141,7 +141,7 @@ def url_parameters(self): required=True, ), **self.serialize_url_param( - "clusterAssociationName", self.ctx.args.cluster_association_name, + "clusterAssociationName", self.ctx.args.cluster_name, required=True, ), **self.serialize_url_param( @@ -172,8 +172,8 @@ def on_200_201(self, session): pass -class _DeleteHelper: - """Helper class for Delete""" +class _DetachHelper: + """Helper class for Detach""" -__all__ = ["Delete"] +__all__ = ["Detach"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_list.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_list.py similarity index 95% rename from src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_list.py rename to src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_list.py index 50b372395a0..d8cc0f6fa1e 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_list.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_list.py @@ -12,13 +12,13 @@ @register_command( - "agentfabric cluster-association list", + "agentfabric aks list", ) class List(AAZCommand): - """List Cluster Association resources that are children of an Agent Fabric. The parent Fabric name is required. + """List AKS cluster enrollments for an Agent Fabric. The parent Fabric name is required. - :example: ClusterAssociations_ListByParent - az agentfabric cluster-association list --resource-group rgnetworksecurity --fabric-name testAIFabric + :example: List AKS cluster enrollments + az agentfabric aks list --resource-group rgnetworksecurity --fabric-name testAIFabric """ _aaz_info = { diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_show.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_show.py similarity index 92% rename from src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_show.py rename to src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_show.py index 58230ff9275..f17fda83074 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_show.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_show.py @@ -12,13 +12,13 @@ @register_command( - "agentfabric cluster-association show", + "agentfabric aks show", ) class Show(AAZCommand): - """Show a Cluster Association resource that is a child of an Agent Fabric. The parent Fabric name is required. + """Show an AKS cluster enrollment for an Agent Fabric. The parent Fabric name and AKS cluster name are required. - :example: ClusterAssociations_Get - az agentfabric cluster-association show --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-association-name testClusterAssociation + :example: Show an AKS cluster enrollment + az agentfabric aks show --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-name testCluster """ _aaz_info = { @@ -53,9 +53,9 @@ def _build_arguments_schema(cls, *args, **kwargs): pattern="^[a-zA-Z0-9-]{3,24}$", ), ) - _args_schema.cluster_association_name = AAZStrArg( - options=["-n", "--name", "--cluster-association-name"], - help="The name of the Cluster Association.", + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the AKS cluster. This value is used as the Cluster Association ARM child resource name.", required=True, id_part="child_name_1", fmt=AAZStrArgFormat( @@ -118,7 +118,7 @@ def url_parameters(self): required=True, ), **self.serialize_url_param( - "clusterAssociationName", self.ctx.args.cluster_association_name, + "clusterAssociationName", self.ctx.args.cluster_name, required=True, ), **self.serialize_url_param( diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_update.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_update.py similarity index 95% rename from src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_update.py rename to src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_update.py index 1330c800e4a..c6d70f64686 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_update.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_update.py @@ -12,13 +12,13 @@ @register_command( - "agentfabric cluster-association update", + "agentfabric aks update", ) class Update(AAZCommand): - """Update a Cluster Association resource that is a child of an Agent Fabric. The parent Fabric name is required. + """Update the SKU for an AKS cluster enrollment. The parent Fabric name and AKS cluster name are required. - :example: ClusterAssociations_CreateOrUpdate - az agentfabric cluster-association update --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-association-name testClusterAssociation --sku Premium + :example: Update an AKS cluster enrollment SKU + az agentfabric aks update --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-name testCluster --sku Premium """ _aaz_info = { @@ -56,9 +56,9 @@ def _build_arguments_schema(cls, *args, **kwargs): pattern="^[a-zA-Z0-9-]{3,24}$", ), ) - _args_schema.cluster_association_name = AAZStrArg( - options=["-n", "--name", "--cluster-association-name"], - help="The name of the Cluster Association.", + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the AKS cluster. This value is used as the Cluster Association ARM child resource name.", required=True, id_part="child_name_1", fmt=AAZStrArgFormat( @@ -145,7 +145,7 @@ def url_parameters(self): required=True, ), **self.serialize_url_param( - "clusterAssociationName", self.ctx.args.cluster_association_name, + "clusterAssociationName", self.ctx.args.cluster_name, required=True, ), **self.serialize_url_param( @@ -248,7 +248,7 @@ def url_parameters(self): required=True, ), **self.serialize_url_param( - "clusterAssociationName", self.ctx.args.cluster_association_name, + "clusterAssociationName", self.ctx.args.cluster_name, required=True, ), **self.serialize_url_param( diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_wait.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_wait.py similarity index 96% rename from src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_wait.py rename to src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_wait.py index d3240f9d207..db7d0b5100a 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/cluster_association/_wait.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_wait.py @@ -12,7 +12,7 @@ @register_command( - "agentfabric cluster-association wait", + "agentfabric aks wait", ) class Wait(AAZWaitCommand): """Place the CLI in a waiting state until a condition is met. @@ -49,9 +49,9 @@ def _build_arguments_schema(cls, *args, **kwargs): pattern="^[a-zA-Z0-9-]{3,24}$", ), ) - _args_schema.cluster_association_name = AAZStrArg( - options=["-n", "--name", "--cluster-association-name"], - help="The name of the Cluster Association.", + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the AKS cluster. This value is used as the Cluster Association ARM child resource name.", required=True, id_part="child_name_1", fmt=AAZStrArgFormat( @@ -114,7 +114,7 @@ def url_parameters(self): required=True, ), **self.serialize_url_param( - "clusterAssociationName", self.ctx.args.cluster_association_name, + "clusterAssociationName", self.ctx.args.cluster_name, required=True, ), **self.serialize_url_param( diff --git a/src/agentfabric/azext_agentfabric/tests/latest/recordings/test_agentfabric_command_help.yaml b/src/agentfabric/azext_agentfabric/tests/latest/recordings/test_agentfabric_command_help.yaml new file mode 100644 index 00000000000..591dc7c3b1a --- /dev/null +++ b/src/agentfabric/azext_agentfabric/tests/latest/recordings/test_agentfabric_command_help.yaml @@ -0,0 +1,44 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.33.0 + method: GET + uri: https://aka.ms/azExtCmdTree + response: + body: + string: '' + headers: + cache-control: + - max-age=0, no-cache, no-store + connection: + - keep-alive + content-length: + - '0' + date: + - Tue, 15 Sep 2026 22:07:43 GMT + expires: + - Tue, 15 Sep 2026 22:07:43 GMT + location: + - https://azurecliextensionsync.blob.core.windows.net/cmd-index/extensionCommandTree.json + pragma: + - no-cache + request-context: + - appId=cid-v1:d94c0f68-64bf-4036-8409-a0e761bb7ee1 + server: + - Kestrel + strict-transport-security: + - max-age=31536000 ; includeSubDomains + x-response-cache-status: + - 'True' + status: + code: 301 + message: Moved Permanently +version: 1 diff --git a/src/agentfabric/azext_agentfabric/tests/latest/test_agentfabric.py b/src/agentfabric/azext_agentfabric/tests/latest/test_agentfabric.py index f53a8e13a04..14215451ab8 100644 --- a/src/agentfabric/azext_agentfabric/tests/latest/test_agentfabric.py +++ b/src/agentfabric/azext_agentfabric/tests/latest/test_agentfabric.py @@ -45,29 +45,29 @@ "Delete", ), ( - "agentfabric cluster-association create", - "azext_agentfabric.aaz.latest.agentfabric.cluster_association._create", - "Create", + "agentfabric aks attach", + "azext_agentfabric.aaz.latest.agentfabric.aks._attach", + "Attach", ), ( - "agentfabric cluster-association show", - "azext_agentfabric.aaz.latest.agentfabric.cluster_association._show", + "agentfabric aks show", + "azext_agentfabric.aaz.latest.agentfabric.aks._show", "Show", ), ( - "agentfabric cluster-association list", - "azext_agentfabric.aaz.latest.agentfabric.cluster_association._list", + "agentfabric aks list", + "azext_agentfabric.aaz.latest.agentfabric.aks._list", "List", ), ( - "agentfabric cluster-association update", - "azext_agentfabric.aaz.latest.agentfabric.cluster_association._update", + "agentfabric aks update", + "azext_agentfabric.aaz.latest.agentfabric.aks._update", "Update", ), ( - "agentfabric cluster-association delete", - "azext_agentfabric.aaz.latest.agentfabric.cluster_association._delete", - "Delete", + "agentfabric aks detach", + "azext_agentfabric.aaz.latest.agentfabric.aks._detach", + "Detach", ), ( "agentfabric policy-group create", @@ -99,7 +99,7 @@ HELP_ONLY_COMMANDS = ( "agentfabric wait", "agentfabric member wait", - "agentfabric cluster-association wait", + "agentfabric aks wait", "agentfabric policy-group wait", ) @@ -153,15 +153,15 @@ "2026-07-21-preview", ), ( - "azext_agentfabric.aaz.latest.agentfabric.cluster_association._create", - "Create", + "azext_agentfabric.aaz.latest.agentfabric.aks._attach", + "Attach", "ClusterAssociationsCreateOrUpdate", "PUT", "/agentFabrics/{agentFabricName}/clusterAssociations/{clusterAssociationName}", "2026-09-10-preview", ), ( - "azext_agentfabric.aaz.latest.agentfabric.cluster_association._show", + "azext_agentfabric.aaz.latest.agentfabric.aks._show", "Show", "ClusterAssociationsGet", "GET", @@ -169,7 +169,7 @@ "2026-09-10-preview", ), ( - "azext_agentfabric.aaz.latest.agentfabric.cluster_association._list", + "azext_agentfabric.aaz.latest.agentfabric.aks._list", "List", "ClusterAssociationsListByParent", "GET", @@ -177,7 +177,7 @@ "2026-09-10-preview", ), ( - "azext_agentfabric.aaz.latest.agentfabric.cluster_association._update", + "azext_agentfabric.aaz.latest.agentfabric.aks._update", "Update", "ClusterAssociationsCreateOrUpdate", "PUT", @@ -185,8 +185,8 @@ "2026-09-10-preview", ), ( - "azext_agentfabric.aaz.latest.agentfabric.cluster_association._delete", - "Delete", + "azext_agentfabric.aaz.latest.agentfabric.aks._detach", + "Detach", "ClusterAssociationsDelete", "DELETE", "/agentFabrics/{agentFabricName}/clusterAssociations/{clusterAssociationName}", @@ -234,7 +234,7 @@ def test_agentfabric_command_help(self): commands = ( "agentfabric", "agentfabric member", - "agentfabric cluster-association", + "agentfabric aks", "agentfabric policy-group", *(command for command, _, _ in COMMANDS), *HELP_ONLY_COMMANDS, @@ -291,20 +291,22 @@ def test_request_shapes_and_resource_urls(self): ) self.assertTrue(operation.url.endswith(url_suffix), operation.url) - def test_cluster_association_contract(self): - create_module = importlib.import_module( - "azext_agentfabric.aaz.latest.agentfabric.cluster_association._create" + def test_aks_enrollment_contract(self): + attach_module = importlib.import_module( + "azext_agentfabric.aaz.latest.agentfabric.aks._attach" ) - create_schema = create_module.Create._build_arguments_schema() - self.assertTrue(create_schema.cluster_resource_id._required) + attach_schema = attach_module.Attach._build_arguments_schema() + self.assertTrue(attach_schema.cluster_resource_id._required) + self.assertTrue(attach_schema.cluster_name._required) + self.assertEqual(attach_schema.cluster_name._options, ["--cluster-name"]) self.assertEqual( - create_schema.sku.enum.items, + attach_schema.sku.enum.items, {"Premium": "Premium", "Standard": "Standard"}, ) - self.assertEqual(create_schema.if_none_match.enum.items, {"*": "*"}) + self.assertFalse(hasattr(attach_schema, "if_none_match")) update_module = importlib.import_module( - "azext_agentfabric.aaz.latest.agentfabric.cluster_association._update" + "azext_agentfabric.aaz.latest.agentfabric.aks._update" ) update_schema = update_module.Update._build_arguments_schema() self.assertFalse(hasattr(update_schema, "cluster_resource_id")) @@ -312,7 +314,7 @@ def test_cluster_association_contract(self): self.assertTrue(hasattr(update_schema, "sku")) show_module = importlib.import_module( - "azext_agentfabric.aaz.latest.agentfabric.cluster_association._show" + "azext_agentfabric.aaz.latest.agentfabric.aks._show" ) output_schema = ( show_module.Show.ClusterAssociationsGet._build_schema_on_200() From ac48673acb66288be4e44275a750fc770ad535d4 Mon Sep 17 00:00:00 2001 From: Kshitija Murudi Date: Sun, 11 Oct 2026 02:24:14 -0700 Subject: [PATCH 8/8] Refresh Agent Fabric to 2026-10-07 preview API Generate from RPSaaSDev 01be2263f53dd57906029e65115a9e475624be74 and Azure/aaz 27db6b454c340f5f46a6a9700fa4c6eee8c9d647. Preserve target identity before association PATCH and cover latest payload contracts. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/agentfabric/HISTORY.rst | 7 +- src/agentfabric/README.md | 67 +++- .../aaz/latest/agentfabric/__cmd_group.py | 2 + .../aaz/latest/agentfabric/_create.py | 91 ++++- .../aaz/latest/agentfabric/_delete.py | 8 +- .../aaz/latest/agentfabric/_list.py | 66 +++- .../aaz/latest/agentfabric/_show.py | 32 +- .../aaz/latest/agentfabric/_update.py | 56 ++- .../aaz/latest/agentfabric/_wait.py | 28 +- .../aaz/latest/agentfabric/aks/__cmd_group.py | 4 +- .../aaz/latest/agentfabric/aks/_attach.py | 64 +++- .../aaz/latest/agentfabric/aks/_detach.py | 24 +- .../aaz/latest/agentfabric/aks/_list.py | 21 +- .../aaz/latest/agentfabric/aks/_show.py | 31 +- .../aaz/latest/agentfabric/aks/_update.py | 354 ++++++------------ .../aaz/latest/agentfabric/aks/_wait.py | 21 +- .../egress_trust_bundle/__cmd_group.py | 25 ++ .../egress_trust_bundle/__init__.py | 13 + .../agentfabric/egress_trust_bundle/_list.py | 260 +++++++++++++ .../agentfabric/egress_trust_bundle/_show.py | 248 ++++++++++++ .../latest/agentfabric/member/__cmd_group.py | 4 +- .../aaz/latest/agentfabric/member/_create.py | 242 +++++++++++- .../aaz/latest/agentfabric/member/_delete.py | 18 +- .../aaz/latest/agentfabric/member/_list.py | 76 +++- .../aaz/latest/agentfabric/member/_show.py | 80 +++- .../aaz/latest/agentfabric/member/_update.py | 90 ++++- .../aaz/latest/agentfabric/member/_wait.py | 70 +++- .../agentfabric/policy_group/__cmd_group.py | 4 +- .../agentfabric/policy_group/_create.py | 26 +- .../agentfabric/policy_group/_delete.py | 12 +- .../latest/agentfabric/policy_group/_list.py | 20 +- .../latest/agentfabric/policy_group/_show.py | 12 +- .../agentfabric/policy_group/_update.py | 14 +- .../latest/agentfabric/policy_group/_wait.py | 4 +- src/agentfabric/azext_agentfabric/commands.py | 3 +- src/agentfabric/azext_agentfabric/custom.py | 26 ++ .../test_agentfabric_examples_parse.yaml | 44 +++ .../tests/latest/test_agentfabric.py | 275 ++++++++++++-- 38 files changed, 1997 insertions(+), 445 deletions(-) create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/egress_trust_bundle/__cmd_group.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/egress_trust_bundle/__init__.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/egress_trust_bundle/_list.py create mode 100644 src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/egress_trust_bundle/_show.py create mode 100644 src/agentfabric/azext_agentfabric/tests/latest/recordings/test_agentfabric_examples_parse.yaml diff --git a/src/agentfabric/HISTORY.rst b/src/agentfabric/HISTORY.rst index 593752b11b8..c3830880b63 100644 --- a/src/agentfabric/HISTORY.rst +++ b/src/agentfabric/HISTORY.rst @@ -5,6 +5,9 @@ Release History 1.0.0b1 ++++++ -* Initial preview release for Azure Agent Fabric using API version ``2026-07-21-preview``. +* Initial preview release for Azure Agent Fabric using API version ``2026-10-07-preview``. * Add Agent Fabric, member, and Policy Group create, show, list, update, delete, and wait commands. -* Add AKS attach, show, list, update, detach, and wait enrollment commands using API version ``2026-09-10-preview``. \ No newline at end of file +* Add AKS attach, show, list, update, detach, and wait enrollment commands. +* Add system-assigned Fabric identity and customer-owned Content Safety connection configuration. +* Add AKS member workloads, ACI SandboxGroup references, and service/target port mappings. +* Add egress trust bundle show and list commands. \ No newline at end of file diff --git a/src/agentfabric/README.md b/src/agentfabric/README.md index 91d54e37956..c34035e8d87 100644 --- a/src/agentfabric/README.md +++ b/src/agentfabric/README.md @@ -3,7 +3,12 @@ This extension manages Azure Agent Fabric resources, AKS cluster enrollment, child members, and independent Policy Group peer resources. It uses the `Microsoft.NetworkSecurity` resource provider API version -`2026-07-21-preview`, with AKS enrollment using `2026-09-10-preview`. +`2026-10-07-preview`. + +The commands are generated from the public contract on `RPSaaSDev` at commit +`01be2263f53dd57906029e65115a9e475624be74` in +[Azure/azure-rest-api-specs-pr](https://github.com/Azure/azure-rest-api-specs-pr/tree/01be2263f53dd57906029e65115a9e475624be74/specification/networksecurity/resource-manager/Microsoft.NetworkSecurity/agentFabric/preview/2026-10-07-preview). +This pins the API contract, not the version deployed in an Azure region. ## Resource hierarchy @@ -11,7 +16,8 @@ child members, and independent Policy Group peer resources. It uses the Microsoft.NetworkSecurity ├── agentFabrics/{fabricName} (independent top-level resource) │ ├── members/{memberName} (child of an Agent Fabric) -│ └── clusterAssociations/{clusterName} (AKS enrollment implementation resource) +│ ├── clusterAssociations/{associationName} (compute enrollment implementation resource) +│ └── egressTrustBundles/default (read-only certificate bundle) └── policyGroups/{policyGroupName} (independent top-level peer resource) ``` @@ -25,6 +31,18 @@ az extension add --name agentfabric Root CRUD commands manage Agent Fabric resources. +Fabrics support a system-assigned managed identity and a customer-owned Content +Safety connection. The connection is configured using the Fabric PUT operation +(`create`, which can also replace an existing fabric), not the tags/identity +PATCH operation (`update`). A nonempty connection requires both endpoint and +API key, including when rotating a key at the same endpoint. The API key is +write-only and is not returned by show or list. + +Omitting the connection or supplying an empty object preserves an existing +connection. For a new fabric, either form requests no inspection connection. +The service does not create a Content Safety account or fall back to shared +credentials for a newly configured customer-owned connection. + ```bash az agentfabric create \ --resource-group myResourceGroup \ @@ -45,6 +63,12 @@ az agentfabric list --resource-group myResourceGroup Members are children of an Agent Fabric, so member commands require the parent Fabric name through `--fabric-name`. +Workloads support `ACI`, `AKS`, and `AgentFabricSandbox` variants. AKS workloads +include the association ID, AKS resource ID, and an existing Kubernetes resource +reference; the CLI does not create that Kubernetes resource. Endpoint mappings +use `name`, `service-port`, `protocol`, and `target-port`, replacing the earlier +single `port` field. Member PATCH supports tags and `fqdn`, not workload changes. + ```bash az agentfabric member create \ --resource-group myResourceGroup \ @@ -63,28 +87,57 @@ az agentfabric member show \ Create the Agent Fabric separately, then use `az agentfabric aks` to attach AKS managed clusters. The cluster must be in the same subscription as the -Agent Fabric, but it can be in a different resource group. The AKS cluster name -is used as the underlying Cluster Association child resource name, while the -cluster resource ID is immutable. +Agent Fabric, but it can be in a different resource group. `--association-name` +identifies the enrollment child, independently of the target cluster name. +`--name/-n` and the earlier `--cluster-name` are aliases for that child name; +they do not resolve the target cluster ID. The target resource ID is immutable. +The latest wire contract also allows ACI SandboxGroup target IDs. ```bash az agentfabric aks attach \ --resource-group myResourceGroup \ --fabric-name myFabric \ - --cluster-name myCluster \ + --association-name myEnrollment \ + --location eastus \ --cluster-resource-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myAksResourceGroup/providers/Microsoft.ContainerService/managedClusters/myCluster \ --sku Standard az agentfabric aks show \ --resource-group myResourceGroup \ --fabric-name myFabric \ - --cluster-name myCluster + --association-name myEnrollment ``` Supported SKUs are `Standard` and `Premium`. Run `aks attach` once per AKS cluster to enroll multiple clusters in the same Agent Fabric. Use `aks update` to change an enrollment SKU and `aks detach` to remove an enrollment. +The latest API supports Standard-to-Premium upgrades, but rejects a downgrade +from Premium to Standard. Cluster Associations are now tracked resources with +location and tags. This differs from the earlier proxy-resource contract. +`aks update` first reads the enrollment to obtain its immutable target ID, +then PATCHes tags, SKU, or `--workload-cluster-gateway-ip`. Users do not need to +resupply the target ID. `aks wait` observes ARM provisioning state, not +Kubernetes readiness. Attach does not currently send `If-None-Match`; it uses +the API's create-or-replace PUT semantics rather than a create-only guarantee. + +## Egress trust bundles + +Egress trust bundles expose the certificate material and cache lifetime for a +Fabric's egress trust configuration. The API supports only show and list; the +item endpoint is the singleton `egressTrustBundles/default`. These are +read-only operations and do not install certificates on a cluster. + +```bash +az agentfabric egress-trust-bundle show \ + --resource-group myResourceGroup \ + --fabric-name myFabric + +az agentfabric egress-trust-bundle list \ + --resource-group myResourceGroup \ + --fabric-name myFabric +``` + ## Policy Groups Policy Groups are independent resource-group-scoped diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/__cmd_group.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/__cmd_group.py index 2abbc35cde6..3f95e595ce8 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/__cmd_group.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/__cmd_group.py @@ -16,6 +16,8 @@ ) class __CMDGroup(AAZCommandGroup): """Manage Agent Fabric and related Microsoft.NetworkSecurity resources. Root commands manage Agent Fabric resources. + + Manage Agent Fabric and related Microsoft.NetworkSecurity resources. Root create, show, list, update, and delete commands manage Agent Fabric resources. """ pass diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_create.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_create.py index 3a7326e01bb..661984643bc 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_create.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_create.py @@ -15,16 +15,21 @@ "agentfabric create", ) class Create(AAZCommand): - """Create an Agent Fabric resource. + """Create or replace an Agent Fabric resource. - :example: AgentFabrics_CreateOrUpdate - az agentfabric create --resource-group rgnetworksecurity --name testAIFabric --default-policy-groups "[/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgnetworksecurity/providers/Microsoft.NetworkSecurity/policyGroups/testPolicyGroup]" --trust-domain contoso.agentfabric --tags "{}" --location eastus + Create an Agent Fabric, including its optional system-assigned identity and complete customer-owned content inspection endpoint/API-key pair. Omitting the inspection profile or supplying an empty object requests no connection change for an existing Fabric. + + :example: Create an Agent Fabric with customer-owned content inspection + az agentfabric create --resource-group rgnetworksecurity --name testAIFabric --location westus3 --trust-domain contoso.agentfabric --identity "{type:SystemAssigned}" --inspection-profile "{endpoint:'https://contoso.cognitiveservices.azure.com/',api-key:}" + + :example: Create an Agent Fabric without content inspection + az agentfabric create --resource-group rgnetworksecurity --name testAIFabric --location westus3 --trust-domain contoso.agentfabric """ _aaz_info = { - "version": "2026-07-21-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-10-07-preview"], ] } @@ -60,10 +65,15 @@ def _build_arguments_schema(cls, *args, **kwargs): # define Arg Group "Properties" _args_schema = cls._args_schema + _args_schema.content_inspection_profile = AAZObjectArg( + options=["--inspection-profile", "--content-inspection-profile"], + arg_group="Properties", + help="The connection to the customer's Azure Content Safety account. For a new fabric created with API version `2026-09-29-preview` or later, omitting this profile or supplying {} requests no inspection capability and uses no platform-owned account or shared-key fallback. For an existing fabric, omitting the profile from PUT, including requests from older clients, or supplying {} preserves its customer-owned connection, legacy regional connection, or absence of connection. The empty object is a request for no connection change, not a stored replacement profile. Neither omission nor {} removes, probes, or creates a connection or cancels a pending connection update. Other Fabric fields and policy compatibility rules still apply. A nonempty request profile requires both endpoint and apiKey, even at the unchanged endpoint. PUT can rotate the key or replace the endpoint by supplying the complete pair. Tags- or identity-only PATCH requests cannot change this profile. Existing legacy fabrics without a profile retain their regional Content Safety endpoint and authentication path. Omission or {} triggers no connection probe, account-management call, key retrieval, or credential requirement. Supplying a complete profile explicitly configures a customer-owned connection; there is no automatic conversion or failed-connection fallback to regional credentials. The customer owns, pays for, and operates the account. The service does not create, reserve, manage, or delete it. The service validates new or changed endpoint/credential configuration and the required Content Safety API before activation; configuration alone does not indicate readiness or active policy enforcement. Unchanged configuration, GET, and list do not trigger a new validation request. A failed replacement preserves the existing connection and credential, including a legacy regional connection.", + ) _args_schema.default_policy_groups = AAZListArg( options=["--default-policy-groups"], arg_group="Properties", - help="The default policy groups to apply to all members of this fabric.", + help="The default policy groups to apply to all members of this fabric. A fabric without a configured inspection connection cannot reference a group containing any ContentInspection policy, even when that policy's selectors currently match no traffic. For an existing fabric, compatibility uses the stored configuration when PUT omits contentInspectionProfile or supplies an empty object. Existing legacy fabrics retain their regional Content Safety connection, which satisfies the inspection prerequisite without new probes. A connection still being validated is not an absent connection. Removing a group reference remains allowed, subject to other validation.", ) _args_schema.trust_domain = AAZStrArg( options=["--trust-domain"], @@ -75,12 +85,36 @@ def _build_arguments_schema(cls, *args, **kwargs): ), ) + content_inspection_profile = cls._args_schema.content_inspection_profile + content_inspection_profile.api_key = AAZPasswordArg( + options=["api-key"], + help="The nonempty API key for the specified account. Required together with endpoint in every nonempty request profile, even when the endpoint is unchanged. Supplying a different key with the endpoint on PUT rotates the stored credential. A missing key in a nonempty profile is rejected without retrieving a saved key or comparing with the saved endpoint to permit omission. Null and empty values are rejected, not treated as removal. The key is never returned in resource, list, or long-running operation responses.", + fmt=AAZStrArgFormat( + min_length=1, + ), + blank=AAZPromptPasswordInput( + msg="Password:", + ), + ) + content_inspection_profile.endpoint = AAZStrArg( + options=["endpoint"], + help="The HTTPS account endpoint, for example `https://contoso.cognitiveservices.azure.com/`. Only Azure Content Safety account endpoints in the service's supported Azure cloud are accepted. Credentials must not be forwarded to other destinations, including redirects. Required together with apiKey in a nonempty request profile, including key rotation. Changing the endpoint requires a key for the new account; the stored key is not reused.", + fmt=AAZStrArgFormat( + pattern="^https://[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\\.cognitiveservices\\.(azure\\.com|azure\\.us|azure\\.cn)/?$", + ), + ) + default_policy_groups = cls._args_schema.default_policy_groups default_policy_groups.Element = AAZResourceIdArg() # define Arg Group "Resource" _args_schema = cls._args_schema + _args_schema.identity = AAZObjectArg( + options=["--identity"], + arg_group="Resource", + help="The managed service identity assigned to this fabric. The service uses it to reach the clusters associated with the fabric on the customer's behalf.", + ) _args_schema.location = AAZResourceLocationArg( arg_group="Resource", help="The geo-location where the resource lives", @@ -95,6 +129,14 @@ def _build_arguments_schema(cls, *args, **kwargs): help="Resource tags.", ) + identity = cls._args_schema.identity + identity.type = AAZStrArg( + options=["type"], + help="Type of managed service identity (either system assigned, or none).", + required=True, + enum={"None": "None", "SystemAssigned": "SystemAssigned"}, + ) + tags = cls._args_schema.tags tags.Element = AAZStrArg() return cls._args_schema @@ -180,7 +222,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } @@ -205,15 +247,26 @@ def content(self): typ=AAZObjectType, typ_kwargs={"flags": {"required": True, "client_flatten": True}} ) + _builder.set_prop("identity", AAZObjectType, ".identity") _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) _builder.set_prop("properties", AAZObjectType) _builder.set_prop("tags", AAZDictType, ".tags") + identity = _builder.get(".identity") + if identity is not None: + identity.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + properties = _builder.get(".properties") if properties is not None: + properties.set_prop("contentInspectionProfile", AAZObjectType, ".content_inspection_profile") properties.set_prop("defaultPolicyGroups", AAZListType, ".default_policy_groups") properties.set_prop("trustDomain", AAZStrType, ".trust_domain") + content_inspection_profile = _builder.get(".properties.contentInspectionProfile") + if content_inspection_profile is not None: + content_inspection_profile.set_prop("apiKey", AAZStrType, ".api_key", typ_kwargs={"flags": {"secret": True}}) + content_inspection_profile.set_prop("endpoint", AAZStrType, ".endpoint") + default_policy_groups = _builder.get(".properties.defaultPolicyGroups") if default_policy_groups is not None: default_policy_groups.set_elements(AAZStrType, ".") @@ -245,6 +298,7 @@ def _build_schema_on_200_201(cls): _schema_on_200_201.id = AAZStrType( flags={"read_only": True}, ) + _schema_on_200_201.identity = AAZObjectType() _schema_on_200_201.location = AAZStrType( flags={"required": True}, ) @@ -261,7 +315,23 @@ def _build_schema_on_200_201(cls): flags={"read_only": True}, ) + identity = cls._schema_on_200_201.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + properties = cls._schema_on_200_201.properties + properties.content_inspection_profile = AAZObjectType( + serialized_name="contentInspectionProfile", + ) properties.default_policy_groups = AAZListType( serialized_name="defaultPolicyGroups", ) @@ -269,10 +339,17 @@ def _build_schema_on_200_201(cls): serialized_name="provisioningState", flags={"read_only": True}, ) + properties.resource_guid = AAZStrType( + serialized_name="resourceGuid", + flags={"read_only": True}, + ) properties.trust_domain = AAZStrType( serialized_name="trustDomain", ) + content_inspection_profile = cls._schema_on_200_201.properties.content_inspection_profile + content_inspection_profile.endpoint = AAZStrType() + default_policy_groups = cls._schema_on_200_201.properties.default_policy_groups default_policy_groups.Element = AAZStrType() diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_delete.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_delete.py index f7aa1fe6c11..1b51d4247e4 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_delete.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_delete.py @@ -18,14 +18,14 @@ class Delete(AAZCommand): """Delete an Agent Fabric resource. - :example: AgentFabrics_Delete + :example: Delete an Agent Fabric az agentfabric delete --resource-group rgnetworksecurity --name testAIFabric """ _aaz_info = { - "version": "2026-07-21-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-10-07-preview"], ] } @@ -146,7 +146,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_list.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_list.py index 282d8b8fd62..30f5c4822e7 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_list.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_list.py @@ -17,18 +17,18 @@ class List(AAZCommand): """List Agent Fabric resources. - :example: AgentFabrics_ListBySubscription - az agentfabric list - - :example: AgentFabrics_ListByResourceGroup + :example: List Agent Fabrics in a resource group az agentfabric list --resource-group rgnetworksecurity + + :example: List Agent Fabrics in a subscription + az agentfabric list """ _aaz_info = { - "version": "2026-07-21-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networksecurity/agentfabrics", "2026-07-21-preview"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networksecurity/agentfabrics", "2026-10-07-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics", "2026-10-07-preview"], ] } @@ -115,7 +115,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } @@ -162,6 +162,7 @@ def _build_schema_on_200(cls): _element.id = AAZStrType( flags={"read_only": True}, ) + _element.identity = AAZObjectType() _element.location = AAZStrType( flags={"required": True}, ) @@ -178,7 +179,23 @@ def _build_schema_on_200(cls): flags={"read_only": True}, ) + identity = cls._schema_on_200.value.Element.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + properties = cls._schema_on_200.value.Element.properties + properties.content_inspection_profile = AAZObjectType( + serialized_name="contentInspectionProfile", + ) properties.default_policy_groups = AAZListType( serialized_name="defaultPolicyGroups", ) @@ -186,10 +203,17 @@ def _build_schema_on_200(cls): serialized_name="provisioningState", flags={"read_only": True}, ) + properties.resource_guid = AAZStrType( + serialized_name="resourceGuid", + flags={"read_only": True}, + ) properties.trust_domain = AAZStrType( serialized_name="trustDomain", ) + content_inspection_profile = cls._schema_on_200.value.Element.properties.content_inspection_profile + content_inspection_profile.endpoint = AAZStrType() + default_policy_groups = cls._schema_on_200.value.Element.properties.default_policy_groups default_policy_groups.Element = AAZStrType() @@ -262,7 +286,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } @@ -309,6 +333,7 @@ def _build_schema_on_200(cls): _element.id = AAZStrType( flags={"read_only": True}, ) + _element.identity = AAZObjectType() _element.location = AAZStrType( flags={"required": True}, ) @@ -325,7 +350,23 @@ def _build_schema_on_200(cls): flags={"read_only": True}, ) + identity = cls._schema_on_200.value.Element.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + properties = cls._schema_on_200.value.Element.properties + properties.content_inspection_profile = AAZObjectType( + serialized_name="contentInspectionProfile", + ) properties.default_policy_groups = AAZListType( serialized_name="defaultPolicyGroups", ) @@ -333,10 +374,17 @@ def _build_schema_on_200(cls): serialized_name="provisioningState", flags={"read_only": True}, ) + properties.resource_guid = AAZStrType( + serialized_name="resourceGuid", + flags={"read_only": True}, + ) properties.trust_domain = AAZStrType( serialized_name="trustDomain", ) + content_inspection_profile = cls._schema_on_200.value.Element.properties.content_inspection_profile + content_inspection_profile.endpoint = AAZStrType() + default_policy_groups = cls._schema_on_200.value.Element.properties.default_policy_groups default_policy_groups.Element = AAZStrType() diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_show.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_show.py index 294c0ebeda6..f3ca71c1897 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_show.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_show.py @@ -17,14 +17,14 @@ class Show(AAZCommand): """Show an Agent Fabric resource. - :example: AgentFabrics_Get + :example: Show an Agent Fabric az agentfabric show --resource-group rgnetworksecurity --name testAIFabric """ _aaz_info = { - "version": "2026-07-21-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-10-07-preview"], ] } @@ -123,7 +123,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } @@ -159,6 +159,7 @@ def _build_schema_on_200(cls): _schema_on_200.id = AAZStrType( flags={"read_only": True}, ) + _schema_on_200.identity = AAZObjectType() _schema_on_200.location = AAZStrType( flags={"required": True}, ) @@ -175,7 +176,23 @@ def _build_schema_on_200(cls): flags={"read_only": True}, ) + identity = cls._schema_on_200.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + properties = cls._schema_on_200.properties + properties.content_inspection_profile = AAZObjectType( + serialized_name="contentInspectionProfile", + ) properties.default_policy_groups = AAZListType( serialized_name="defaultPolicyGroups", ) @@ -183,10 +200,17 @@ def _build_schema_on_200(cls): serialized_name="provisioningState", flags={"read_only": True}, ) + properties.resource_guid = AAZStrType( + serialized_name="resourceGuid", + flags={"read_only": True}, + ) properties.trust_domain = AAZStrType( serialized_name="trustDomain", ) + content_inspection_profile = cls._schema_on_200.properties.content_inspection_profile + content_inspection_profile.endpoint = AAZStrType() + default_policy_groups = cls._schema_on_200.properties.default_policy_groups default_policy_groups.Element = AAZStrType() diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_update.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_update.py index abd7b5a41a8..3d40a994d8a 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_update.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_update.py @@ -15,16 +15,18 @@ "agentfabric update", ) class Update(AAZCommand): - """Update an Agent Fabric resource. + """Update Agent Fabric tags or system-assigned identity. - :example: AgentFabrics_Update - az agentfabric update --resource-group rgnetworksecurity --name testAIFabric --tags "{env:production}" + Patch only tags and the system-assigned identity. Content inspection, trust domain, and default Policy Groups are not PATCH inputs. + + :example: Update Agent Fabric tags and identity + az agentfabric update --resource-group rgnetworksecurity --name testAIFabric --tags "{env:prod}" --identity "{type:SystemAssigned}" """ _aaz_info = { - "version": "2026-07-21-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-10-07-preview"], ] } @@ -61,12 +63,25 @@ def _build_arguments_schema(cls, *args, **kwargs): # define Arg Group "Properties" _args_schema = cls._args_schema + _args_schema.identity = AAZObjectArg( + options=["--identity"], + arg_group="Properties", + help="The managed service identity assigned to this fabric.", + ) _args_schema.tags = AAZDictArg( options=["--tags"], arg_group="Properties", help="Resource tags.", ) + identity = cls._args_schema.identity + identity.type = AAZStrArg( + options=["type"], + help="Type of managed service identity (either system assigned, or none).", + required=True, + enum={"None": "None", "SystemAssigned": "SystemAssigned"}, + ) + tags = cls._args_schema.tags tags.Element = AAZStrArg() return cls._args_schema @@ -152,7 +167,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } @@ -177,8 +192,13 @@ def content(self): typ=AAZObjectType, typ_kwargs={"flags": {"required": True, "client_flatten": True}} ) + _builder.set_prop("identity", AAZObjectType, ".identity") _builder.set_prop("tags", AAZDictType, ".tags") + identity = _builder.get(".identity") + if identity is not None: + identity.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + tags = _builder.get(".tags") if tags is not None: tags.set_elements(AAZStrType, ".") @@ -206,6 +226,7 @@ def _build_schema_on_200(cls): _schema_on_200.id = AAZStrType( flags={"read_only": True}, ) + _schema_on_200.identity = AAZObjectType() _schema_on_200.location = AAZStrType( flags={"required": True}, ) @@ -222,7 +243,23 @@ def _build_schema_on_200(cls): flags={"read_only": True}, ) + identity = cls._schema_on_200.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + properties = cls._schema_on_200.properties + properties.content_inspection_profile = AAZObjectType( + serialized_name="contentInspectionProfile", + ) properties.default_policy_groups = AAZListType( serialized_name="defaultPolicyGroups", ) @@ -230,10 +267,17 @@ def _build_schema_on_200(cls): serialized_name="provisioningState", flags={"read_only": True}, ) + properties.resource_guid = AAZStrType( + serialized_name="resourceGuid", + flags={"read_only": True}, + ) properties.trust_domain = AAZStrType( serialized_name="trustDomain", ) + content_inspection_profile = cls._schema_on_200.properties.content_inspection_profile + content_inspection_profile.endpoint = AAZStrType() + default_policy_groups = cls._schema_on_200.properties.default_policy_groups default_policy_groups.Element = AAZStrType() diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_wait.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_wait.py index 4fce0f83dc9..e2ecca1143c 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_wait.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/_wait.py @@ -20,7 +20,7 @@ class Wait(AAZWaitCommand): _aaz_info = { "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}", "2026-10-07-preview"], ] } @@ -119,7 +119,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } @@ -155,6 +155,7 @@ def _build_schema_on_200(cls): _schema_on_200.id = AAZStrType( flags={"read_only": True}, ) + _schema_on_200.identity = AAZObjectType() _schema_on_200.location = AAZStrType( flags={"required": True}, ) @@ -171,7 +172,23 @@ def _build_schema_on_200(cls): flags={"read_only": True}, ) + identity = cls._schema_on_200.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + properties = cls._schema_on_200.properties + properties.content_inspection_profile = AAZObjectType( + serialized_name="contentInspectionProfile", + ) properties.default_policy_groups = AAZListType( serialized_name="defaultPolicyGroups", ) @@ -179,10 +196,17 @@ def _build_schema_on_200(cls): serialized_name="provisioningState", flags={"read_only": True}, ) + properties.resource_guid = AAZStrType( + serialized_name="resourceGuid", + flags={"read_only": True}, + ) properties.trust_domain = AAZStrType( serialized_name="trustDomain", ) + content_inspection_profile = cls._schema_on_200.properties.content_inspection_profile + content_inspection_profile.endpoint = AAZStrType() + default_policy_groups = cls._schema_on_200.properties.default_policy_groups default_policy_groups.Element = AAZStrType() diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/__cmd_group.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/__cmd_group.py index fb704394cd2..2e2f8e42b49 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/__cmd_group.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/__cmd_group.py @@ -15,7 +15,9 @@ "agentfabric aks", ) class __CMDGroup(AAZCommandGroup): - """Manage AKS cluster enrollment with an Agent Fabric. Commands use the AKS cluster name as the association child name and require the parent Fabric name. + """Manage Agent Fabric compute enrollment. + + Manage compute-resource enrollment through ClusterAssociation resources under an Agent Fabric. This AKS-oriented command surface also preserves the REST API's support for ACI SandboxGroup resource IDs. Association names are independent from target resource names; --cluster-name is retained as a compatibility alias for the association name. """ pass diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_attach.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_attach.py index f5bb4462505..bc6781d2b8e 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_attach.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_attach.py @@ -15,16 +15,21 @@ "agentfabric aks attach", ) class Attach(AAZCommand): - """Attach an AKS cluster to an Agent Fabric. The parent Fabric name and AKS cluster name are required. + """Create a compute-resource association under an Agent Fabric. - :example: Attach an AKS cluster - az agentfabric aks attach --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-name testCluster --cluster-resource-id /subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgaks/providers/Microsoft.ContainerService/managedClusters/testCluster --sku Standard + Create a ClusterAssociation for an AKS managed cluster or ACI SandboxGroup. Location and the target resource ID are required. The association name is independent from the target resource name; --cluster-name remains a compatibility alias. + + :example: Attach an AKS managed cluster + az agentfabric aks attach --resource-group rgnetworksecurity --fabric-name testAIFabric --association-name testAssociation --location eastus --cluster-resource-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgaks/providers/Microsoft.ContainerService/managedClusters/testAksCluster --sku Premium --tags "{env:prod}" + + :example: Associate an ACI SandboxGroup + az agentfabric aks attach --resource-group rgnetworksecurity --fabric-name testAIFabric --association-name testSandboxAssociation --location eastus --cluster-resource-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgaci/providers/Microsoft.ContainerInstance/sandboxGroups/testSandboxGroup """ _aaz_info = { - "version": "2026-09-10-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/clusterassociations/{}", "2026-09-10-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/clusterassociations/{}", "2026-10-07-preview"], ] } @@ -47,16 +52,16 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], - help="The name of the parent Agent Fabric.", + help="Name of the parent Agent Fabric.", required=True, id_part="name", fmt=AAZStrArgFormat( pattern="^[a-zA-Z0-9-]{3,24}$", ), ) - _args_schema.cluster_name = AAZStrArg( - options=["--cluster-name"], - help="The name of the AKS cluster. This value is used as the Cluster Association ARM child resource name.", + _args_schema.association_name = AAZStrArg( + options=["-n", "--name", "--cluster-name", "--association-name"], + help="Name of the ClusterAssociation child resource. --cluster-name is retained as a compatibility alias.", required=True, id_part="child_name_1", fmt=AAZStrArgFormat( @@ -73,15 +78,35 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema.cluster_resource_id = AAZResourceIdArg( options=["--cluster-resource-id"], arg_group="Properties", - help="The AKS managed cluster to enroll. The cluster must be in the same subscription as the AgentFabric; a different resource group is allowed. Set at creation and immutable thereafter; to enroll a different cluster, delete and recreate the association.", + help="The AKS managed cluster, or (starting in API version `2026-10-07-preview`) ACI SandboxGroup, to enroll. The resource must be in the same subscription as the AgentFabric; a different resource group is allowed. Set at creation and immutable thereafter; to enroll a different resource, delete and recreate the association. AF rejects the request if the resource is already associated with another fabric.", required=True, ) _args_schema.sku = AAZStrArg( options=["--sku"], arg_group="Properties", - help="Determines which AgentFabric components are deployed to the cluster. Defaults to Standard when omitted at creation and remains unchanged when omitted during an update.", + help="Determines which AgentFabric components are deployed to the cluster. Defaults to Standard when omitted at creation. An update may upgrade Standard to Premium but cannot downgrade Premium to Standard. The SKU remains unchanged when omitted during an update.", enum={"Premium": "Premium", "Standard": "Standard"}, ) + + # define Arg Group "Resource" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Resource", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Resource", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() return cls._args_schema def _execute_operations(self): @@ -151,7 +176,7 @@ def url_parameters(self): required=True, ), **self.serialize_url_param( - "clusterAssociationName", self.ctx.args.cluster_name, + "clusterAssociationName", self.ctx.args.association_name, required=True, ), **self.serialize_url_param( @@ -169,7 +194,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-09-10-preview", + "api-version", "2026-10-07-preview", required=True, ), } @@ -194,13 +219,19 @@ def content(self): typ=AAZObjectType, typ_kwargs={"flags": {"required": True, "client_flatten": True}} ) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) _builder.set_prop("properties", AAZObjectType) + _builder.set_prop("tags", AAZDictType, ".tags") properties = _builder.get(".properties") if properties is not None: properties.set_prop("clusterResourceId", AAZStrType, ".cluster_resource_id", typ_kwargs={"flags": {"required": True}}) properties.set_prop("sku", AAZStrType, ".sku") + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + return self.serialize_content(_content_value) def on_200_201(self, session): @@ -224,6 +255,9 @@ def _build_schema_on_200_201(cls): _schema_on_200_201.id = AAZStrType( flags={"read_only": True}, ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) _schema_on_200_201.name = AAZStrType( flags={"read_only": True}, ) @@ -232,6 +266,7 @@ def _build_schema_on_200_201(cls): serialized_name="systemData", flags={"read_only": True}, ) + _schema_on_200_201.tags = AAZDictType() _schema_on_200_201.type = AAZStrType( flags={"read_only": True}, ) @@ -278,6 +313,9 @@ def _build_schema_on_200_201(cls): serialized_name="lastModifiedByType", ) + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + return cls._schema_on_200_201 diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_detach.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_detach.py index 91f32b74b58..46cabc54d0d 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_detach.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_detach.py @@ -16,16 +16,18 @@ confirmation="Are you sure you want to perform this operation?", ) class Detach(AAZCommand): - """Detach an AKS cluster from an Agent Fabric. The parent Fabric name and AKS cluster name are required. + """Delete an Agent Fabric compute association. - :example: Detach an AKS cluster - az agentfabric aks detach --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-name testCluster + Manage compute-resource enrollment through ClusterAssociation resources under an Agent Fabric. This AKS-oriented command surface also preserves the REST API's support for ACI SandboxGroup resource IDs. Association names are independent from target resource names; --cluster-name is retained as a compatibility alias for the association name. + + :example: Detach a compute association + az agentfabric aks detach --resource-group rgnetworksecurity --fabric-name testAIFabric --association-name testAssociation """ _aaz_info = { - "version": "2026-09-10-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/clusterassociations/{}", "2026-09-10-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/clusterassociations/{}", "2026-10-07-preview"], ] } @@ -48,16 +50,16 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], - help="The name of the parent Agent Fabric.", + help="Name of the parent Agent Fabric.", required=True, id_part="name", fmt=AAZStrArgFormat( pattern="^[a-zA-Z0-9-]{3,24}$", ), ) - _args_schema.cluster_name = AAZStrArg( - options=["--cluster-name"], - help="The name of the AKS cluster. This value is used as the Cluster Association ARM child resource name.", + _args_schema.association_name = AAZStrArg( + options=["-n", "--name", "--cluster-name", "--association-name"], + help="Name of the ClusterAssociation child resource. --cluster-name is retained as a compatibility alias.", required=True, id_part="child_name_1", fmt=AAZStrArgFormat( @@ -141,7 +143,7 @@ def url_parameters(self): required=True, ), **self.serialize_url_param( - "clusterAssociationName", self.ctx.args.cluster_name, + "clusterAssociationName", self.ctx.args.association_name, required=True, ), **self.serialize_url_param( @@ -159,7 +161,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-09-10-preview", + "api-version", "2026-10-07-preview", required=True, ), } diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_list.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_list.py index d8cc0f6fa1e..a387096666d 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_list.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_list.py @@ -15,16 +15,18 @@ "agentfabric aks list", ) class List(AAZCommand): - """List AKS cluster enrollments for an Agent Fabric. The parent Fabric name is required. + """List compute associations under an Agent Fabric. - :example: List AKS cluster enrollments + Manage compute-resource enrollment through ClusterAssociation resources under an Agent Fabric. This AKS-oriented command surface also preserves the REST API's support for ACI SandboxGroup resource IDs. Association names are independent from target resource names; --cluster-name is retained as a compatibility alias for the association name. + + :example: List compute associations az agentfabric aks list --resource-group rgnetworksecurity --fabric-name testAIFabric """ _aaz_info = { - "version": "2026-09-10-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/clusterassociations", "2026-09-10-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/clusterassociations", "2026-10-07-preview"], ] } @@ -47,7 +49,7 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], - help="The name of the parent Agent Fabric.", + help="Name of the parent Agent Fabric.", required=True, fmt=AAZStrArgFormat( pattern="^[a-zA-Z0-9-]{3,24}$", @@ -124,7 +126,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-09-10-preview", + "api-version", "2026-10-07-preview", required=True, ), } @@ -171,6 +173,9 @@ def _build_schema_on_200(cls): _element.id = AAZStrType( flags={"read_only": True}, ) + _element.location = AAZStrType( + flags={"required": True}, + ) _element.name = AAZStrType( flags={"read_only": True}, ) @@ -179,6 +184,7 @@ def _build_schema_on_200(cls): serialized_name="systemData", flags={"read_only": True}, ) + _element.tags = AAZDictType() _element.type = AAZStrType( flags={"read_only": True}, ) @@ -225,6 +231,9 @@ def _build_schema_on_200(cls): serialized_name="lastModifiedByType", ) + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + return cls._schema_on_200 diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_show.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_show.py index f17fda83074..1ab7e066fbb 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_show.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_show.py @@ -15,16 +15,18 @@ "agentfabric aks show", ) class Show(AAZCommand): - """Show an AKS cluster enrollment for an Agent Fabric. The parent Fabric name and AKS cluster name are required. + """Show an Agent Fabric compute association. - :example: Show an AKS cluster enrollment - az agentfabric aks show --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-name testCluster + Manage compute-resource enrollment through ClusterAssociation resources under an Agent Fabric. This AKS-oriented command surface also preserves the REST API's support for ACI SandboxGroup resource IDs. Association names are independent from target resource names; --cluster-name is retained as a compatibility alias for the association name. + + :example: Show a compute association + az agentfabric aks show --resource-group rgnetworksecurity --fabric-name testAIFabric --association-name testAssociation """ _aaz_info = { - "version": "2026-09-10-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/clusterassociations/{}", "2026-09-10-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/clusterassociations/{}", "2026-10-07-preview"], ] } @@ -46,16 +48,16 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], - help="The name of the parent Agent Fabric.", + help="Name of the parent Agent Fabric.", required=True, id_part="name", fmt=AAZStrArgFormat( pattern="^[a-zA-Z0-9-]{3,24}$", ), ) - _args_schema.cluster_name = AAZStrArg( - options=["--cluster-name"], - help="The name of the AKS cluster. This value is used as the Cluster Association ARM child resource name.", + _args_schema.association_name = AAZStrArg( + options=["-n", "--name", "--cluster-name", "--association-name"], + help="Name of the ClusterAssociation child resource. --cluster-name is retained as a compatibility alias.", required=True, id_part="child_name_1", fmt=AAZStrArgFormat( @@ -118,7 +120,7 @@ def url_parameters(self): required=True, ), **self.serialize_url_param( - "clusterAssociationName", self.ctx.args.cluster_name, + "clusterAssociationName", self.ctx.args.association_name, required=True, ), **self.serialize_url_param( @@ -136,7 +138,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-09-10-preview", + "api-version", "2026-10-07-preview", required=True, ), } @@ -172,6 +174,9 @@ def _build_schema_on_200(cls): _schema_on_200.id = AAZStrType( flags={"read_only": True}, ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) _schema_on_200.name = AAZStrType( flags={"read_only": True}, ) @@ -180,6 +185,7 @@ def _build_schema_on_200(cls): serialized_name="systemData", flags={"read_only": True}, ) + _schema_on_200.tags = AAZDictType() _schema_on_200.type = AAZStrType( flags={"read_only": True}, ) @@ -226,6 +232,9 @@ def _build_schema_on_200(cls): serialized_name="lastModifiedByType", ) + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + return cls._schema_on_200 diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_update.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_update.py index c6d70f64686..49eeaa88212 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_update.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_update.py @@ -15,23 +15,23 @@ "agentfabric aks update", ) class Update(AAZCommand): - """Update the SKU for an AKS cluster enrollment. The parent Fabric name and AKS cluster name are required. + """Patch an Agent Fabric compute association. - :example: Update an AKS cluster enrollment SKU - az agentfabric aks update --resource-group rgnetworksecurity --fabric-name testAIFabric --cluster-name testCluster --sku Premium + Patch tags, SKU, or workload cluster gateway IP. The existing immutable target resource ID is required by ARM linked authorization and must match the stored association. + + :example: Patch a compute association + az agentfabric aks update --resource-group rgnetworksecurity --fabric-name testAIFabric --association-name testAssociation --cluster-resource-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgaks/providers/Microsoft.ContainerService/managedClusters/testAksCluster --sku Premium --gateway-ip 10.0.0.4 --tags "{env:prod}" """ _aaz_info = { - "version": "2026-09-10-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/clusterassociations/{}", "2026-09-10-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/clusterassociations/{}", "2026-10-07-preview"], ] } AZ_SUPPORT_NO_WAIT = True - AZ_SUPPORT_GENERIC_UPDATE = True - def _handler(self, command_args): super()._handler(command_args) return self.build_lro_poller(self._execute_operations, self._output) @@ -49,16 +49,16 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], - help="The name of the parent Agent Fabric.", + help="Name of the parent Agent Fabric.", required=True, id_part="name", fmt=AAZStrArgFormat( pattern="^[a-zA-Z0-9-]{3,24}$", ), ) - _args_schema.cluster_name = AAZStrArg( - options=["--cluster-name"], - help="The name of the AKS cluster. This value is used as the Cluster Association ARM child resource name.", + _args_schema.association_name = AAZStrArg( + options=["-n", "--name", "--cluster-name", "--association-name"], + help="Name of the ClusterAssociation child resource. --cluster-name is retained as a compatibility alias.", required=True, id_part="child_name_1", fmt=AAZStrArgFormat( @@ -72,23 +72,36 @@ def _build_arguments_schema(cls, *args, **kwargs): # define Arg Group "Properties" _args_schema = cls._args_schema + _args_schema.cluster_resource_id = AAZResourceIdArg( + options=["--cluster-resource-id"], + arg_group="Properties", + help="The existing AKS managed cluster or ACI SandboxGroup. This value is required so Azure Resource Manager can perform linked authorization and must match the immutable clusterResourceId already stored on the association.", + required=True, + ) _args_schema.sku = AAZStrArg( options=["--sku"], arg_group="Properties", - help="Determines which AgentFabric components are deployed to the cluster. Defaults to Standard when omitted at creation and remains unchanged when omitted during an update.", - nullable=True, + help="Determines which AgentFabric components are deployed to the cluster. Only an upgrade from Standard to Premium is supported; Premium cannot be downgraded to Standard. When omitted, the PATCH request is an authorized no-op and the existing SKU remains unchanged.", enum={"Premium": "Premium", "Standard": "Standard"}, ) + _args_schema.workload_cluster_gateway_ip = AAZStrArg( + options=["--gateway-ip", "--workload-cluster-gateway-ip"], + arg_group="Properties", + help="The IPv4 or IPv6 address of the workload cluster gateway used for internal Agent Fabric routing. The resource provider validates the value.", + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Properties", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() return cls._args_schema def _execute_operations(self): self.pre_operations() - self.ClusterAssociationsGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.ClusterAssociationsCreateOrUpdate(ctx=self.ctx)() + yield self.ClusterAssociationsUpdate(ctx=self.ctx)() self.post_operations() @register_callback @@ -99,106 +112,11 @@ def pre_operations(self): def post_operations(self): pass - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - def _output(self, *args, **kwargs): result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) return result - class ClusterAssociationsGet(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [200]: - return self.on_200(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/clusterAssociations/{clusterAssociationName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "agentFabricName", self.ctx.args.fabric_name, - required=True, - ), - **self.serialize_url_param( - "clusterAssociationName", self.ctx.args.cluster_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2026-09-10-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - def on_200(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200 - ) - - _schema_on_200 = None - - @classmethod - def _build_schema_on_200(cls): - if cls._schema_on_200 is not None: - return cls._schema_on_200 - - cls._schema_on_200 = AAZObjectType() - _UpdateHelper._build_schema_cluster_association_read(cls._schema_on_200) - - return cls._schema_on_200 - - class ClusterAssociationsCreateOrUpdate(AAZHttpOperation): + class ClusterAssociationsUpdate(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -208,18 +126,18 @@ def __call__(self, *args, **kwargs): return self.client.build_lro_polling( self.ctx.args.no_wait, session, - self.on_200_201, + self.on_200, self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, + lro_options={"final-state-via": "location"}, path_format_arguments=self.url_parameters, ) - if session.http_response.status_code in [200, 201]: + if session.http_response.status_code in [200]: return self.client.build_lro_polling( self.ctx.args.no_wait, session, - self.on_200_201, + self.on_200, self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, + lro_options={"final-state-via": "location"}, path_format_arguments=self.url_parameters, ) @@ -234,7 +152,7 @@ def url(self): @property def method(self): - return "PUT" + return "PATCH" @property def error_format(self): @@ -248,7 +166,7 @@ def url_parameters(self): required=True, ), **self.serialize_url_param( - "clusterAssociationName", self.ctx.args.cluster_name, + "clusterAssociationName", self.ctx.args.association_name, required=True, ), **self.serialize_url_param( @@ -266,7 +184,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-09-10-preview", + "api-version", "2026-10-07-preview", required=True, ), } @@ -288,139 +206,111 @@ def header_parameters(self): def content(self): _content_value, _builder = self.new_content_builder( self.ctx.args, - value=self.ctx.vars.instance, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} ) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("clusterResourceId", AAZStrType, ".cluster_resource_id", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("sku", AAZStrType, ".sku") + properties.set_prop("workloadClusterGatewayIp", AAZStrType, ".workload_cluster_gateway_ip") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") return self.serialize_content(_content_value) - def on_200_201(self, session): + def on_200(self, session): data = self.deserialize_http_content(session) self.ctx.set_var( "instance", data, - schema_builder=self._build_schema_on_200_201 + schema_builder=self._build_schema_on_200 ) - _schema_on_200_201 = None + _schema_on_200 = None @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _UpdateHelper._build_schema_cluster_association_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + cls._schema_on_200 = AAZObjectType() - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType + properties = cls._schema_on_200.properties + properties.cluster_resource_id = AAZStrType( + serialized_name="clusterResourceId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.sku = AAZStrType() + properties.status = AAZObjectType( + flags={"read_only": True}, ) - _builder.set_prop("properties", AAZObjectType) - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("sku", AAZStrType, ".sku") + status = cls._schema_on_200.properties.status + status.code = AAZStrType( + flags={"read_only": True}, + ) + status.message = AAZStrType( + flags={"read_only": True}, + ) - return _instance_value + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) + return cls._schema_on_200 class _UpdateHelper: """Helper class for Update""" - _schema_cluster_association_read = None - - @classmethod - def _build_schema_cluster_association_read(cls, _schema): - if cls._schema_cluster_association_read is not None: - _schema.id = cls._schema_cluster_association_read.id - _schema.name = cls._schema_cluster_association_read.name - _schema.properties = cls._schema_cluster_association_read.properties - _schema.system_data = cls._schema_cluster_association_read.system_data - _schema.type = cls._schema_cluster_association_read.type - return - - cls._schema_cluster_association_read = _schema_cluster_association_read = AAZObjectType() - - cluster_association_read = _schema_cluster_association_read - cluster_association_read.id = AAZStrType( - flags={"read_only": True}, - ) - cluster_association_read.name = AAZStrType( - flags={"read_only": True}, - ) - cluster_association_read.properties = AAZObjectType() - cluster_association_read.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - cluster_association_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_cluster_association_read.properties - properties.cluster_resource_id = AAZStrType( - serialized_name="clusterResourceId", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.sku = AAZStrType() - properties.status = AAZObjectType( - flags={"read_only": True}, - ) - - status = _schema_cluster_association_read.properties.status - status.code = AAZStrType( - flags={"read_only": True}, - ) - status.message = AAZStrType( - flags={"read_only": True}, - ) - - system_data = _schema_cluster_association_read.system_data - system_data.created_at = AAZStrType( - serialized_name="createdAt", - ) - system_data.created_by = AAZStrType( - serialized_name="createdBy", - ) - system_data.created_by_type = AAZStrType( - serialized_name="createdByType", - ) - system_data.last_modified_at = AAZStrType( - serialized_name="lastModifiedAt", - ) - system_data.last_modified_by = AAZStrType( - serialized_name="lastModifiedBy", - ) - system_data.last_modified_by_type = AAZStrType( - serialized_name="lastModifiedByType", - ) - - _schema.id = cls._schema_cluster_association_read.id - _schema.name = cls._schema_cluster_association_read.name - _schema.properties = cls._schema_cluster_association_read.properties - _schema.system_data = cls._schema_cluster_association_read.system_data - _schema.type = cls._schema_cluster_association_read.type - __all__ = ["Update"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_wait.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_wait.py index db7d0b5100a..20a1a065d86 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_wait.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/aks/_wait.py @@ -20,7 +20,7 @@ class Wait(AAZWaitCommand): _aaz_info = { "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/clusterassociations/{}", "2026-09-10-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/clusterassociations/{}", "2026-10-07-preview"], ] } @@ -42,16 +42,16 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], - help="The name of the parent Agent Fabric.", + help="Name of the parent Agent Fabric.", required=True, id_part="name", fmt=AAZStrArgFormat( pattern="^[a-zA-Z0-9-]{3,24}$", ), ) - _args_schema.cluster_name = AAZStrArg( - options=["--cluster-name"], - help="The name of the AKS cluster. This value is used as the Cluster Association ARM child resource name.", + _args_schema.association_name = AAZStrArg( + options=["-n", "--name", "--cluster-name", "--association-name"], + help="Name of the ClusterAssociation child resource. --cluster-name is retained as a compatibility alias.", required=True, id_part="child_name_1", fmt=AAZStrArgFormat( @@ -114,7 +114,7 @@ def url_parameters(self): required=True, ), **self.serialize_url_param( - "clusterAssociationName", self.ctx.args.cluster_name, + "clusterAssociationName", self.ctx.args.association_name, required=True, ), **self.serialize_url_param( @@ -132,7 +132,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-09-10-preview", + "api-version", "2026-10-07-preview", required=True, ), } @@ -168,6 +168,9 @@ def _build_schema_on_200(cls): _schema_on_200.id = AAZStrType( flags={"read_only": True}, ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) _schema_on_200.name = AAZStrType( flags={"read_only": True}, ) @@ -176,6 +179,7 @@ def _build_schema_on_200(cls): serialized_name="systemData", flags={"read_only": True}, ) + _schema_on_200.tags = AAZDictType() _schema_on_200.type = AAZStrType( flags={"read_only": True}, ) @@ -222,6 +226,9 @@ def _build_schema_on_200(cls): serialized_name="lastModifiedByType", ) + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + return cls._schema_on_200 diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/egress_trust_bundle/__cmd_group.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/egress_trust_bundle/__cmd_group.py new file mode 100644 index 00000000000..32754739bba --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/egress_trust_bundle/__cmd_group.py @@ -0,0 +1,25 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric egress-trust-bundle", +) +class __CMDGroup(AAZCommandGroup): + """Read Agent Fabric egress trust bundles. + + Read the service-managed egress TLS-inspection trust bundle for an Agent Fabric. The singleton bundle is read-only and should be cached for its advertised validity period. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/egress_trust_bundle/__init__.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/egress_trust_bundle/__init__.py new file mode 100644 index 00000000000..2df85698253 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/egress_trust_bundle/__init__.py @@ -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: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._list import * +from ._show import * diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/egress_trust_bundle/_list.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/egress_trust_bundle/_list.py new file mode 100644 index 00000000000..a8f7d58b158 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/egress_trust_bundle/_list.py @@ -0,0 +1,260 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric egress-trust-bundle list", +) +class List(AAZCommand): + """List egress trust bundles for an Agent Fabric. + + Read the service-managed egress TLS-inspection trust bundle for an Agent Fabric. The singleton bundle is read-only and should be cached for its advertised validity period. + + :example: List egress trust bundles + az agentfabric egress-trust-bundle list --resource-group rgnetworksecurity --fabric-name testAIFabric + """ + + _aaz_info = { + "version": "2026-10-07-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/egresstrustbundles", "2026-10-07-preview"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="Name of the parent Agent Fabric.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.EgressTrustBundlesListByParent(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class EgressTrustBundlesListByParent(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/egressTrustBundles", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-10-07-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.bundle_version = AAZStrType( + serialized_name="bundleVersion", + flags={"read_only": True}, + ) + properties.cache_expires_at = AAZStrType( + serialized_name="cacheExpiresAt", + flags={"read_only": True}, + ) + properties.cache_validity_seconds = AAZIntType( + serialized_name="cacheValiditySeconds", + flags={"read_only": True}, + ) + properties.certificates = AAZListType( + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + certificates = cls._schema_on_200.value.Element.properties.certificates + certificates.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.certificates.Element + _element.certificate_id = AAZStrType( + serialized_name="certificateId", + flags={"read_only": True}, + ) + _element.not_after = AAZStrType( + serialized_name="notAfter", + flags={"read_only": True}, + ) + _element.not_before = AAZStrType( + serialized_name="notBefore", + flags={"read_only": True}, + ) + _element.pem = AAZStrType( + flags={"read_only": True}, + ) + _element.thumbprint_sha256 = AAZStrType( + serialized_name="thumbprintSha256", + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/egress_trust_bundle/_show.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/egress_trust_bundle/_show.py new file mode 100644 index 00000000000..dfbc2bc4e5d --- /dev/null +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/egress_trust_bundle/_show.py @@ -0,0 +1,248 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "agentfabric egress-trust-bundle show", +) +class Show(AAZCommand): + """Show the default egress trust bundle for an Agent Fabric. + + Read the service-managed egress TLS-inspection trust bundle for an Agent Fabric. The singleton bundle is read-only and should be cached for its advertised validity period. + + :example: Show the default egress trust bundle + az agentfabric egress-trust-bundle show --resource-group rgnetworksecurity --fabric-name testAIFabric + """ + + _aaz_info = { + "version": "2026-10-07-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/egresstrustbundles/default", "2026-10-07-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.fabric_name = AAZStrArg( + options=["--fabric-name"], + help="Name of the parent Agent Fabric.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,24}$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.EgressTrustBundlesGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class EgressTrustBundlesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}/egressTrustBundles/default", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "agentFabricName", self.ctx.args.fabric_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-10-07-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.bundle_version = AAZStrType( + serialized_name="bundleVersion", + flags={"read_only": True}, + ) + properties.cache_expires_at = AAZStrType( + serialized_name="cacheExpiresAt", + flags={"read_only": True}, + ) + properties.cache_validity_seconds = AAZIntType( + serialized_name="cacheValiditySeconds", + flags={"read_only": True}, + ) + properties.certificates = AAZListType( + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + certificates = cls._schema_on_200.properties.certificates + certificates.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.certificates.Element + _element.certificate_id = AAZStrType( + serialized_name="certificateId", + flags={"read_only": True}, + ) + _element.not_after = AAZStrType( + serialized_name="notAfter", + flags={"read_only": True}, + ) + _element.not_before = AAZStrType( + serialized_name="notBefore", + flags={"read_only": True}, + ) + _element.pem = AAZStrType( + flags={"read_only": True}, + ) + _element.thumbprint_sha256 = AAZStrType( + serialized_name="thumbprintSha256", + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/__cmd_group.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/__cmd_group.py index bc7e73f981a..cad85f8b347 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/__cmd_group.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/__cmd_group.py @@ -15,7 +15,9 @@ "agentfabric member", ) class __CMDGroup(AAZCommandGroup): - """Manage members that are children of an Agent Fabric. The parent Fabric name is required. + """Manage Agent Fabric members. + + Members are children of an Agent Fabric and require the parent Fabric name. Member workloads can describe ACI, AKS, or Agent Fabric sandbox resources. """ pass diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_create.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_create.py index c6b68612c49..f424fd6220b 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_create.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_create.py @@ -15,19 +15,24 @@ "agentfabric member create", ) class Create(AAZCommand): - """Create a member resource as a child of an Agent Fabric. The parent Fabric name is required. + """Create an ACI, AKS, or sandbox member under an Agent Fabric. - :example: Members_CreateOrUpdate - az agentfabric member create --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name testMember --location eastus --workload "{aci:{resource-id:/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgnetworksecurity/providers/Microsoft.ContainerInstance/containerGroups/testContainerGroup}}" + Members are children of an Agent Fabric and require the parent Fabric name. Member workloads can describe ACI, AKS, or Agent Fabric sandbox resources. - :example: Members_CreateOrUpdate_AgentFabricSandbox - az agentfabric member create --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name sandboxMember --location eastus --workload "{agent-fabric-sandbox:{image:{uri:'contoso.azurecr.io/agents/sandbox:1.0.0',digest:'sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae',pull-policy:IfNotPresent},resources:{cpu:2,memory:4Gi,disk:20Gi},agent-identity:{tenant-id:72f988bf-86f1-41af-91ab-2d7cd011db47,agent-id:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee},endpoints:[{name:http,port:8080}],domain:sandbox-member.testaifabric.contoso.com}}" + :example: Create an ACI SandboxGroup member + az agentfabric member create --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name testAciMember --location eastus --workload "{member-guid:11111111-2222-3333-4444-555555555555,aci:{resource-id:/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgaci/providers/Microsoft.ContainerInstance/sandboxGroups/testSandboxGroup}}" + + :example: Create an AKS member + az agentfabric member create --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name checkoutApi --location eastus --workload "{aks:{cluster-association-id:/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgnetworksecurity/providers/Microsoft.NetworkSecurity/agentFabrics/testAIFabric/clusterAssociations/testAssociation,cluster-resource-id:/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgaks/providers/Microsoft.ContainerService/managedClusters/testAksCluster,workload:{api-version:apps/v1,kind:Deployment,namespace:payments,name:checkout-api},endpoints:[{name:https,service-port:443,protocol:TCP,target-port:8443}]}}" + + :example: Create an Agent Fabric sandbox member + az agentfabric member create --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name sandboxMember --location eastus --workload "{agent-fabric-sandbox:{image:{uri:'contoso.azurecr.io/agents/sandbox:1.0.0',pull-policy:IfNotPresent},resources:{cpu:2,memory:4Gi,disk:20Gi},endpoints:[{name:http,service-port:80,protocol:TCP,target-port:8080}],domain:sandbox-member.testaifabric.contoso.com}}" """ _aaz_info = { - "version": "2026-07-21-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-10-07-preview"], ] } @@ -50,14 +55,14 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], - help="The name of the AgentFabric", + help="Name of the parent Agent Fabric.", required=True, fmt=AAZStrArgFormat( pattern="^[a-zA-Z0-9-]{3,24}$", ), ) _args_schema.member_name = AAZStrArg( - options=["--member-name"], + options=["-n", "--name", "--member-name"], help="The name of the Member", required=True, fmt=AAZStrArgFormat( @@ -71,6 +76,11 @@ def _build_arguments_schema(cls, *args, **kwargs): # define Arg Group "Properties" _args_schema = cls._args_schema + _args_schema.fqdn = AAZStrArg( + options=["--fqdn"], + arg_group="Properties", + help="The customer-provided fully qualified domain name associated with the member.", + ) _args_schema.workload = AAZObjectArg( options=["--workload"], arg_group="Properties", @@ -81,17 +91,108 @@ def _build_arguments_schema(cls, *args, **kwargs): workload.aci = AAZObjectArg( options=["aci"], ) + workload.aks = AAZObjectArg( + options=["aks"], + ) workload.agent_fabric_sandbox = AAZObjectArg( options=["agent-fabric-sandbox"], ) + workload.member_guid = AAZStrArg( + options=["member-guid"], + help="The unique identifier (GUID) assigned to the member when it is created. For most workload types this is assigned by the resource provider and is read-only. Starting in API version `2026-10-07-preview`, ACI workloads instead supply this value at creation: the ACI resource provider generates the GUID for the sandbox and this field is immutable afterward.", + ) aci = cls._args_schema.workload.aci aci.resource_id = AAZResourceIdArg( options=["resource-id"], - help="The Azure Resource Manager resource ID of the Azure Container Instances (ACI) container group backing this member's sandbox.", + help="The Azure Resource Manager resource ID of the Azure Container Instances (ACI) resource backing this member's sandbox. Starting in API version `2026-10-07-preview`, this identifies the parent SandboxGroup -- the enrollment boundary associated with the fabric through a ClusterAssociation -- rather than the individual container group.", + required=True, + ) + + aks = cls._args_schema.workload.aks + aks.cluster_association_id = AAZResourceIdArg( + options=["cluster-association-id"], + help="The Azure Resource Manager resource ID of the cluster association through which this member's workload is enrolled.", + required=True, + ) + aks.cluster_resource_id = AAZResourceIdArg( + options=["cluster-resource-id"], + help="The Azure Resource Manager resource ID of the managed cluster that hosts the workload.", + required=True, + ) + aks.endpoints = AAZListArg( + options=["endpoints"], + help="The network endpoints exposed by the workload.", + ) + aks.workload = AAZObjectArg( + options=["workload"], + help="The Kubernetes workload enrolled as this member. Reported when the workload is discovered in the enrolled cluster; member identity derives from the fabric and member name alone.", required=True, ) + endpoints = cls._args_schema.workload.aks.endpoints + endpoints.Element = AAZObjectArg() + + _element = cls._args_schema.workload.aks.endpoints.Element + _element.name = AAZStrArg( + options=["name"], + help="The name of the port mapping.", + required=True, + ) + _element.protocol = AAZStrArg( + options=["protocol"], + help="The network protocol used by the endpoint.", + required=True, + ) + _element.service_port = AAZIntArg( + options=["service-port"], + help="The port exposed by the service.", + required=True, + fmt=AAZIntArgFormat( + maximum=65535, + minimum=1, + ), + ) + _element.target_port = AAZIntArg( + options=["target-port"], + help="The port on the workload targeted by the service.", + required=True, + fmt=AAZIntArgFormat( + maximum=65535, + minimum=1, + ), + ) + + workload = cls._args_schema.workload.aks.workload + workload.api_version = AAZStrArg( + options=["api-version"], + help="The API group and version of the workload, for example `apps/v1`.", + required=True, + ) + workload.kind = AAZStrArg( + options=["kind"], + help="The kind of the workload, for example `Deployment`.", + required=True, + ) + workload.name = AAZStrArg( + options=["name"], + help="The name of the workload.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$", + max_length=253, + ), + ) + workload.namespace = AAZStrArg( + options=["namespace"], + help="The namespace the workload runs in.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", + max_length=63, + ), + ) + agent_fabric_sandbox = cls._args_schema.workload.agent_fabric_sandbox agent_fabric_sandbox.agent_identity = AAZObjectArg( options=["agent-identity"], @@ -138,11 +239,29 @@ def _build_arguments_schema(cls, *args, **kwargs): help="The name of the endpoint.", required=True, ) - _element.port = AAZIntArg( - options=["port"], - help="The port the endpoint listens on.", + _element.protocol = AAZStrArg( + options=["protocol"], + help="The network protocol used by the endpoint.", required=True, ) + _element.service_port = AAZIntArg( + options=["service-port"], + help="The port exposed by the service.", + required=True, + fmt=AAZIntArgFormat( + maximum=65535, + minimum=1, + ), + ) + _element.target_port = AAZIntArg( + options=["target-port"], + help="The port on the workload targeted by the service.", + required=True, + fmt=AAZIntArgFormat( + maximum=65535, + minimum=1, + ), + ) image = cls._args_schema.workload.agent_fabric_sandbox.image image.digest = AAZStrArg( @@ -282,7 +401,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } @@ -313,19 +432,48 @@ def content(self): properties = _builder.get(".properties") if properties is not None: + properties.set_prop("fqdn", AAZStrType, ".fqdn") properties.set_prop("workload", AAZObjectType, ".workload") workload = _builder.get(".properties.workload") if workload is not None: + workload.set_prop("memberGuid", AAZStrType, ".member_guid") workload.set_const("type", "ACI", AAZStrType, ".aci", typ_kwargs={"flags": {"required": True}}) + workload.set_const("type", "AKS", AAZStrType, ".aks", typ_kwargs={"flags": {"required": True}}) workload.set_const("type", "AgentFabricSandbox", AAZStrType, ".agent_fabric_sandbox", typ_kwargs={"flags": {"required": True}}) workload.discriminate_by("type", "ACI") + workload.discriminate_by("type", "AKS") workload.discriminate_by("type", "AgentFabricSandbox") disc_aci = _builder.get(".properties.workload{type:ACI}") if disc_aci is not None: disc_aci.set_prop("resourceId", AAZStrType, ".aci.resource_id", typ_kwargs={"flags": {"required": True}}) + disc_aks = _builder.get(".properties.workload{type:AKS}") + if disc_aks is not None: + disc_aks.set_prop("clusterAssociationId", AAZStrType, ".aks.cluster_association_id", typ_kwargs={"flags": {"required": True}}) + disc_aks.set_prop("clusterResourceId", AAZStrType, ".aks.cluster_resource_id", typ_kwargs={"flags": {"required": True}}) + disc_aks.set_prop("endpoints", AAZListType, ".aks.endpoints") + disc_aks.set_prop("workload", AAZObjectType, ".aks.workload", typ_kwargs={"flags": {"required": True}}) + + endpoints = _builder.get(".properties.workload{type:AKS}.endpoints") + if endpoints is not None: + endpoints.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.workload{type:AKS}.endpoints[]") + if _elements is not None: + _elements.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("servicePort", AAZIntType, ".service_port", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("targetPort", AAZIntType, ".target_port", typ_kwargs={"flags": {"required": True}}) + + workload = _builder.get(".properties.workload{type:AKS}.workload") + if workload is not None: + workload.set_prop("apiVersion", AAZStrType, ".api_version", typ_kwargs={"flags": {"required": True}}) + workload.set_prop("kind", AAZStrType, ".kind", typ_kwargs={"flags": {"required": True}}) + workload.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + workload.set_prop("namespace", AAZStrType, ".namespace", typ_kwargs={"flags": {"required": True}}) + disc_agent_fabric_sandbox = _builder.get(".properties.workload{type:AgentFabricSandbox}") if disc_agent_fabric_sandbox is not None: disc_agent_fabric_sandbox.set_prop("agentIdentity", AAZObjectType, ".agent_fabric_sandbox.agent_identity") @@ -346,7 +494,9 @@ def content(self): _elements = _builder.get(".properties.workload{type:AgentFabricSandbox}.endpoints[]") if _elements is not None: _elements.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) - _elements.set_prop("port", AAZIntType, ".port", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("servicePort", AAZIntType, ".service_port", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("targetPort", AAZIntType, ".target_port", typ_kwargs={"flags": {"required": True}}) image = _builder.get(".properties.workload{type:AgentFabricSandbox}.image") if image is not None: @@ -404,6 +554,7 @@ def _build_schema_on_200_201(cls): ) properties = cls._schema_on_200_201.properties + properties.fqdn = AAZStrType() properties.provisioning_state = AAZStrType( serialized_name="provisioningState", flags={"read_only": True}, @@ -415,6 +566,9 @@ def _build_schema_on_200_201(cls): properties.workload = AAZObjectType() workload = cls._schema_on_200_201.properties.workload + workload.member_guid = AAZStrType( + serialized_name="memberGuid", + ) workload.type = AAZStrType( flags={"required": True}, ) @@ -429,6 +583,54 @@ def _build_schema_on_200_201(cls): flags={"required": True}, ) + disc_aks = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AKS") + disc_aks.cluster_association_id = AAZStrType( + serialized_name="clusterAssociationId", + flags={"required": True}, + ) + disc_aks.cluster_resource_id = AAZStrType( + serialized_name="clusterResourceId", + flags={"required": True}, + ) + disc_aks.endpoints = AAZListType() + disc_aks.workload = AAZObjectType( + flags={"required": True}, + ) + + endpoints = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AKS").endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AKS").endpoints.Element + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.protocol = AAZStrType( + flags={"required": True}, + ) + _element.service_port = AAZIntType( + serialized_name="servicePort", + flags={"required": True}, + ) + _element.target_port = AAZIntType( + serialized_name="targetPort", + flags={"required": True}, + ) + + workload = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AKS").workload + workload.api_version = AAZStrType( + serialized_name="apiVersion", + flags={"required": True}, + ) + workload.kind = AAZStrType( + flags={"required": True}, + ) + workload.name = AAZStrType( + flags={"required": True}, + ) + workload.namespace = AAZStrType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox = cls._schema_on_200_201.properties.workload.discriminate_by("type", "AgentFabricSandbox") disc_agent_fabric_sandbox.agent_identity = AAZObjectType( serialized_name="agentIdentity", @@ -461,7 +663,15 @@ def _build_schema_on_200_201(cls): _element.name = AAZStrType( flags={"required": True}, ) - _element.port = AAZIntType( + _element.protocol = AAZStrType( + flags={"required": True}, + ) + _element.service_port = AAZIntType( + serialized_name="servicePort", + flags={"required": True}, + ) + _element.target_port = AAZIntType( + serialized_name="targetPort", flags={"required": True}, ) diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_delete.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_delete.py index 21d09dcce01..fd266a2370e 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_delete.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_delete.py @@ -16,16 +16,18 @@ confirmation="Are you sure you want to perform this operation?", ) class Delete(AAZCommand): - """Delete a member resource that is a child of an Agent Fabric. The parent Fabric name is required. + """Delete an Agent Fabric member. - :example: Members_Delete - az agentfabric member delete --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name testMember + Members are children of an Agent Fabric and require the parent Fabric name. Member workloads can describe ACI, AKS, or Agent Fabric sandbox resources. + + :example: Delete an Agent Fabric member + az agentfabric member delete --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name checkoutApi """ _aaz_info = { - "version": "2026-07-21-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-10-07-preview"], ] } @@ -48,7 +50,7 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], - help="The name of the AgentFabric", + help="Name of the parent Agent Fabric.", required=True, id_part="name", fmt=AAZStrArgFormat( @@ -56,7 +58,7 @@ def _build_arguments_schema(cls, *args, **kwargs): ), ) _args_schema.member_name = AAZStrArg( - options=["--member-name"], + options=["-n", "--name", "--member-name"], help="The name of the Member", required=True, id_part="child_name_1", @@ -159,7 +161,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_list.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_list.py index 45ca8a9d05d..32fab72f8b1 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_list.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_list.py @@ -15,16 +15,18 @@ "agentfabric member list", ) class List(AAZCommand): - """List member resources that are children of an Agent Fabric. The parent Fabric name is required. + """List members of an Agent Fabric. - :example: Members_ListByParent + Members are children of an Agent Fabric and require the parent Fabric name. Member workloads can describe ACI, AKS, or Agent Fabric sandbox resources. + + :example: List Agent Fabric members az agentfabric member list --resource-group rgnetworksecurity --fabric-name testAIFabric """ _aaz_info = { - "version": "2026-07-21-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members", "2026-10-07-preview"], ] } @@ -47,7 +49,7 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], - help="The name of the AgentFabric", + help="Name of the parent Agent Fabric.", required=True, fmt=AAZStrArgFormat( pattern="^[a-zA-Z0-9-]{3,24}$", @@ -124,7 +126,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } @@ -188,6 +190,7 @@ def _build_schema_on_200(cls): ) properties = cls._schema_on_200.value.Element.properties + properties.fqdn = AAZStrType() properties.provisioning_state = AAZStrType( serialized_name="provisioningState", flags={"read_only": True}, @@ -199,6 +202,9 @@ def _build_schema_on_200(cls): properties.workload = AAZObjectType() workload = cls._schema_on_200.value.Element.properties.workload + workload.member_guid = AAZStrType( + serialized_name="memberGuid", + ) workload.type = AAZStrType( flags={"required": True}, ) @@ -213,6 +219,54 @@ def _build_schema_on_200(cls): flags={"required": True}, ) + disc_aks = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AKS") + disc_aks.cluster_association_id = AAZStrType( + serialized_name="clusterAssociationId", + flags={"required": True}, + ) + disc_aks.cluster_resource_id = AAZStrType( + serialized_name="clusterResourceId", + flags={"required": True}, + ) + disc_aks.endpoints = AAZListType() + disc_aks.workload = AAZObjectType( + flags={"required": True}, + ) + + endpoints = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AKS").endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AKS").endpoints.Element + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.protocol = AAZStrType( + flags={"required": True}, + ) + _element.service_port = AAZIntType( + serialized_name="servicePort", + flags={"required": True}, + ) + _element.target_port = AAZIntType( + serialized_name="targetPort", + flags={"required": True}, + ) + + workload = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AKS").workload + workload.api_version = AAZStrType( + serialized_name="apiVersion", + flags={"required": True}, + ) + workload.kind = AAZStrType( + flags={"required": True}, + ) + workload.name = AAZStrType( + flags={"required": True}, + ) + workload.namespace = AAZStrType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox = cls._schema_on_200.value.Element.properties.workload.discriminate_by("type", "AgentFabricSandbox") disc_agent_fabric_sandbox.agent_identity = AAZObjectType( serialized_name="agentIdentity", @@ -245,7 +299,15 @@ def _build_schema_on_200(cls): _element.name = AAZStrType( flags={"required": True}, ) - _element.port = AAZIntType( + _element.protocol = AAZStrType( + flags={"required": True}, + ) + _element.service_port = AAZIntType( + serialized_name="servicePort", + flags={"required": True}, + ) + _element.target_port = AAZIntType( + serialized_name="targetPort", flags={"required": True}, ) diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_show.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_show.py index 2ffc848ada2..8ce3aa09898 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_show.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_show.py @@ -15,16 +15,18 @@ "agentfabric member show", ) class Show(AAZCommand): - """Show a member resource that is a child of an Agent Fabric. The parent Fabric name is required. + """Show an Agent Fabric member. - :example: Members_Get - az agentfabric member show --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name testMember + Members are children of an Agent Fabric and require the parent Fabric name. Member workloads can describe ACI, AKS, or Agent Fabric sandbox resources. + + :example: Show an Agent Fabric member + az agentfabric member show --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name checkoutApi """ _aaz_info = { - "version": "2026-07-21-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-10-07-preview"], ] } @@ -46,7 +48,7 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], - help="The name of the AgentFabric", + help="Name of the parent Agent Fabric.", required=True, id_part="name", fmt=AAZStrArgFormat( @@ -54,7 +56,7 @@ def _build_arguments_schema(cls, *args, **kwargs): ), ) _args_schema.member_name = AAZStrArg( - options=["--member-name"], + options=["-n", "--name", "--member-name"], help="The name of the Member", required=True, id_part="child_name_1", @@ -136,7 +138,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } @@ -189,6 +191,7 @@ def _build_schema_on_200(cls): ) properties = cls._schema_on_200.properties + properties.fqdn = AAZStrType() properties.provisioning_state = AAZStrType( serialized_name="provisioningState", flags={"read_only": True}, @@ -200,6 +203,9 @@ def _build_schema_on_200(cls): properties.workload = AAZObjectType() workload = cls._schema_on_200.properties.workload + workload.member_guid = AAZStrType( + serialized_name="memberGuid", + ) workload.type = AAZStrType( flags={"required": True}, ) @@ -214,6 +220,54 @@ def _build_schema_on_200(cls): flags={"required": True}, ) + disc_aks = cls._schema_on_200.properties.workload.discriminate_by("type", "AKS") + disc_aks.cluster_association_id = AAZStrType( + serialized_name="clusterAssociationId", + flags={"required": True}, + ) + disc_aks.cluster_resource_id = AAZStrType( + serialized_name="clusterResourceId", + flags={"required": True}, + ) + disc_aks.endpoints = AAZListType() + disc_aks.workload = AAZObjectType( + flags={"required": True}, + ) + + endpoints = cls._schema_on_200.properties.workload.discriminate_by("type", "AKS").endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.workload.discriminate_by("type", "AKS").endpoints.Element + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.protocol = AAZStrType( + flags={"required": True}, + ) + _element.service_port = AAZIntType( + serialized_name="servicePort", + flags={"required": True}, + ) + _element.target_port = AAZIntType( + serialized_name="targetPort", + flags={"required": True}, + ) + + workload = cls._schema_on_200.properties.workload.discriminate_by("type", "AKS").workload + workload.api_version = AAZStrType( + serialized_name="apiVersion", + flags={"required": True}, + ) + workload.kind = AAZStrType( + flags={"required": True}, + ) + workload.name = AAZStrType( + flags={"required": True}, + ) + workload.namespace = AAZStrType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox") disc_agent_fabric_sandbox.agent_identity = AAZObjectType( serialized_name="agentIdentity", @@ -246,7 +300,15 @@ def _build_schema_on_200(cls): _element.name = AAZStrType( flags={"required": True}, ) - _element.port = AAZIntType( + _element.protocol = AAZStrType( + flags={"required": True}, + ) + _element.service_port = AAZIntType( + serialized_name="servicePort", + flags={"required": True}, + ) + _element.target_port = AAZIntType( + serialized_name="targetPort", flags={"required": True}, ) diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_update.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_update.py index 51760007627..5402009fcbf 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_update.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_update.py @@ -15,16 +15,18 @@ "agentfabric member update", ) class Update(AAZCommand): - """Update a member resource that is a child of an Agent Fabric. The parent Fabric name is required. + """Update an Agent Fabric member's tags or FQDN. - :example: Members_Update - az agentfabric member update --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name testMember --tags "{environment:production}" + Patch member tags or properties.fqdn. The workload and member GUID remain create-only. + + :example: Update a member FQDN and tags + az agentfabric member update --resource-group rgnetworksecurity --fabric-name testAIFabric --member-name checkoutApi --fqdn checkout.contoso.com --tags "{env:prod}" """ _aaz_info = { - "version": "2026-07-21-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-10-07-preview"], ] } @@ -47,7 +49,7 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], - help="The name of the AgentFabric", + help="Name of the parent Agent Fabric.", required=True, id_part="name", fmt=AAZStrArgFormat( @@ -55,7 +57,7 @@ def _build_arguments_schema(cls, *args, **kwargs): ), ) _args_schema.member_name = AAZStrArg( - options=["--member-name"], + options=["-n", "--name", "--member-name"], help="The name of the Member", required=True, id_part="child_name_1", @@ -70,6 +72,11 @@ def _build_arguments_schema(cls, *args, **kwargs): # define Arg Group "Properties" _args_schema = cls._args_schema + _args_schema.fqdn = AAZStrArg( + options=["--fqdn"], + arg_group="Properties", + help="The customer-provided fully qualified domain name associated with the member.", + ) _args_schema.tags = AAZDictArg( options=["--tags"], arg_group="Properties", @@ -165,7 +172,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } @@ -190,8 +197,13 @@ def content(self): typ=AAZObjectType, typ_kwargs={"flags": {"required": True, "client_flatten": True}} ) + _builder.set_prop("properties", AAZObjectType) _builder.set_prop("tags", AAZDictType, ".tags") + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("fqdn", AAZStrType, ".fqdn") + tags = _builder.get(".tags") if tags is not None: tags.set_elements(AAZStrType, ".") @@ -236,6 +248,7 @@ def _build_schema_on_200(cls): ) properties = cls._schema_on_200.properties + properties.fqdn = AAZStrType() properties.provisioning_state = AAZStrType( serialized_name="provisioningState", flags={"read_only": True}, @@ -247,6 +260,9 @@ def _build_schema_on_200(cls): properties.workload = AAZObjectType() workload = cls._schema_on_200.properties.workload + workload.member_guid = AAZStrType( + serialized_name="memberGuid", + ) workload.type = AAZStrType( flags={"required": True}, ) @@ -261,6 +277,54 @@ def _build_schema_on_200(cls): flags={"required": True}, ) + disc_aks = cls._schema_on_200.properties.workload.discriminate_by("type", "AKS") + disc_aks.cluster_association_id = AAZStrType( + serialized_name="clusterAssociationId", + flags={"required": True}, + ) + disc_aks.cluster_resource_id = AAZStrType( + serialized_name="clusterResourceId", + flags={"required": True}, + ) + disc_aks.endpoints = AAZListType() + disc_aks.workload = AAZObjectType( + flags={"required": True}, + ) + + endpoints = cls._schema_on_200.properties.workload.discriminate_by("type", "AKS").endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.workload.discriminate_by("type", "AKS").endpoints.Element + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.protocol = AAZStrType( + flags={"required": True}, + ) + _element.service_port = AAZIntType( + serialized_name="servicePort", + flags={"required": True}, + ) + _element.target_port = AAZIntType( + serialized_name="targetPort", + flags={"required": True}, + ) + + workload = cls._schema_on_200.properties.workload.discriminate_by("type", "AKS").workload + workload.api_version = AAZStrType( + serialized_name="apiVersion", + flags={"required": True}, + ) + workload.kind = AAZStrType( + flags={"required": True}, + ) + workload.name = AAZStrType( + flags={"required": True}, + ) + workload.namespace = AAZStrType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox") disc_agent_fabric_sandbox.agent_identity = AAZObjectType( serialized_name="agentIdentity", @@ -293,7 +357,15 @@ def _build_schema_on_200(cls): _element.name = AAZStrType( flags={"required": True}, ) - _element.port = AAZIntType( + _element.protocol = AAZStrType( + flags={"required": True}, + ) + _element.service_port = AAZIntType( + serialized_name="servicePort", + flags={"required": True}, + ) + _element.target_port = AAZIntType( + serialized_name="targetPort", flags={"required": True}, ) diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_wait.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_wait.py index f48d23b60e7..95ed09a7020 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_wait.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/member/_wait.py @@ -20,7 +20,7 @@ class Wait(AAZWaitCommand): _aaz_info = { "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/agentfabrics/{}/members/{}", "2026-10-07-preview"], ] } @@ -42,7 +42,7 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.fabric_name = AAZStrArg( options=["--fabric-name"], - help="The name of the AgentFabric", + help="Name of the parent Agent Fabric.", required=True, id_part="name", fmt=AAZStrArgFormat( @@ -50,7 +50,7 @@ def _build_arguments_schema(cls, *args, **kwargs): ), ) _args_schema.member_name = AAZStrArg( - options=["--member-name"], + options=["-n", "--name", "--member-name"], help="The name of the Member", required=True, id_part="child_name_1", @@ -132,7 +132,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } @@ -185,6 +185,7 @@ def _build_schema_on_200(cls): ) properties = cls._schema_on_200.properties + properties.fqdn = AAZStrType() properties.provisioning_state = AAZStrType( serialized_name="provisioningState", flags={"read_only": True}, @@ -196,6 +197,9 @@ def _build_schema_on_200(cls): properties.workload = AAZObjectType() workload = cls._schema_on_200.properties.workload + workload.member_guid = AAZStrType( + serialized_name="memberGuid", + ) workload.type = AAZStrType( flags={"required": True}, ) @@ -210,6 +214,54 @@ def _build_schema_on_200(cls): flags={"required": True}, ) + disc_aks = cls._schema_on_200.properties.workload.discriminate_by("type", "AKS") + disc_aks.cluster_association_id = AAZStrType( + serialized_name="clusterAssociationId", + flags={"required": True}, + ) + disc_aks.cluster_resource_id = AAZStrType( + serialized_name="clusterResourceId", + flags={"required": True}, + ) + disc_aks.endpoints = AAZListType() + disc_aks.workload = AAZObjectType( + flags={"required": True}, + ) + + endpoints = cls._schema_on_200.properties.workload.discriminate_by("type", "AKS").endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.workload.discriminate_by("type", "AKS").endpoints.Element + _element.name = AAZStrType( + flags={"required": True}, + ) + _element.protocol = AAZStrType( + flags={"required": True}, + ) + _element.service_port = AAZIntType( + serialized_name="servicePort", + flags={"required": True}, + ) + _element.target_port = AAZIntType( + serialized_name="targetPort", + flags={"required": True}, + ) + + workload = cls._schema_on_200.properties.workload.discriminate_by("type", "AKS").workload + workload.api_version = AAZStrType( + serialized_name="apiVersion", + flags={"required": True}, + ) + workload.kind = AAZStrType( + flags={"required": True}, + ) + workload.name = AAZStrType( + flags={"required": True}, + ) + workload.namespace = AAZStrType( + flags={"required": True}, + ) + disc_agent_fabric_sandbox = cls._schema_on_200.properties.workload.discriminate_by("type", "AgentFabricSandbox") disc_agent_fabric_sandbox.agent_identity = AAZObjectType( serialized_name="agentIdentity", @@ -242,7 +294,15 @@ def _build_schema_on_200(cls): _element.name = AAZStrType( flags={"required": True}, ) - _element.port = AAZIntType( + _element.protocol = AAZStrType( + flags={"required": True}, + ) + _element.service_port = AAZIntType( + serialized_name="servicePort", + flags={"required": True}, + ) + _element.target_port = AAZIntType( + serialized_name="targetPort", flags={"required": True}, ) diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/__cmd_group.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/__cmd_group.py index b7398d921a9..41ab1dc4b19 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/__cmd_group.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/__cmd_group.py @@ -15,7 +15,9 @@ "agentfabric policy-group", ) class __CMDGroup(AAZCommandGroup): - """Manage independent resource-group-scoped Microsoft.NetworkSecurity Policy Group peer resources. Policy Groups are not children of an Agent Fabric. + """Manage independent Agent Fabric Policy Groups. + + Policy Groups are independent resource-group-scoped Microsoft.NetworkSecurity peer resources and are not children of an Agent Fabric. """ pass diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_create.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_create.py index 78d6c837899..71d8367237d 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_create.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_create.py @@ -15,28 +15,18 @@ "agentfabric policy-group create", ) class Create(AAZCommand): - """Create an independent resource-group-scoped Microsoft.NetworkSecurity Policy Group resource. Policy Groups are not children of an Agent Fabric. + """Create an independent Microsoft.NetworkSecurity Policy Group. - :example: PolicyGroups_CreateOrUpdate - az agentfabric policy-group create --resource-group rgnetworksecurity --name testPolicyGroup --location eastus --tags "{env:test}" --display-name "Test Policy Group" --description "A policy group for testing" --priority 100 --network-security-policies "[{fqdn-filtering:{name:allowOutbound,priority:10,direction:Outbound,ports:[443,80],source:{workload-id-patterns:{patterns:[workload1,workload2]}},destination:{fqdns:{fqdns:[example.com,contoso.com]}}}}]" + Policy Groups are independent resource-group-scoped Microsoft.NetworkSecurity peer resources and are not children of an Agent Fabric. - :example: PolicyGroups_CreateOrUpdate_ContentInspection - az agentfabric policy-group create --resource-group rgnetworksecurity --name contentInspectionGroup --location eastus --tags "{env:test}" --display-name "Content Inspection Policy Group" --description "A policy group demonstrating content inspection policies" --priority 100 --network-security-policies "[{content-inspection:{source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},prompt-injection-protection:{sensitivity:High,prompt-locations:['$.messages[*].content','$.input'],response-locations:['$.choices[*].message.content'],on-detection:BlockAndAlert}}}]" - - :example: PolicyGroups_CreateOrUpdate_Mcp - az agentfabric policy-group create --resource-group rgnetworksecurity --name mcpPolicyGroup --location eastus --tags "{env:test}" --display-name "MCP Policy Group" --description "A policy group demonstrating MCP server policies" --priority 100 --network-security-policies "[{mcp:{default-action:Deny,source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},destination:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/mcp/sa/*']}},rules:[{action:Allow,tools:[search,fetch]},{action:Deny,tools:[deleteFile]}]}},{mcp:{default-action:Allow,source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},destination:{fqdns:{fqdns:[mcp.contoso.com]}},rules:[{action:Deny,tools:[executeShell,writeFile]}]}},{mcp:{default-action:Deny,source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},destination:{address-prefixes:{prefixes:[10.0.0.0/24]}},rules:[{action:Allow,tools:[listResources,readResource]}]}}]" - - :example: PolicyGroups_CreateOrUpdate_TlsInspection - az agentfabric policy-group create --resource-group rgnetworksecurity --name tlsInspectionPolicyGroup --location eastus --tags "{env:test}" --display-name "TLS Inspection Policy Group" --description "A policy group demonstrating TLS inspection policies" --priority 100 --network-security-policies "[{tls-inspection:{source:{workload-id-patterns:{patterns:['spiffe://contoso.com/ns/default/sa/*']}},certificate:{azure-managed-ca:{}}}}]" - - :example: PolicyGroups_CreateOrUpdate_UrlFiltering - az agentfabric policy-group create --resource-group rgnetworksecurity --name urlFilteringPolicyGroup --location eastus --tags "{env:test}" --display-name "URL Filtering Policy Group" --description "A policy group demonstrating URL filtering" --priority 100 --network-security-policies "[{url-filtering:{default-action:Deny,source:{address-prefixes:{prefixes:[10.0.0.0/24]}},destination:{fqdns:{fqdns:[api.contoso.com]}},rules:[{name:allowProductApi,priority:10,hostname:api.contoso.com,method:GET,paths:['/v1/products','/v1/products/*'],action:Allow},{name:denyAdmin,priority:20,paths:['/admin/*'],action:Deny}]}}]" + :example: Create an independent FQDN filtering Policy Group + az agentfabric policy-group create --resource-group rgnetworksecurity --name testPolicyGroup --location eastus --display-name "Test Policy Group" --priority 100 --network-security-policies "[{fqdn-filtering:{name:allowOutbound,priority:10,direction:Outbound,ports:[443],source:{workload-id-patterns:{patterns:[workload1]}},destination:{fqdns:{fqdns:[example.com]}}}}]" """ _aaz_info = { - "version": "2026-07-21-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-10-07-preview"], ] } @@ -85,7 +75,7 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema.network_security_policies = AAZListArg( options=["--network-security-policies"], arg_group="Properties", - help="The list of network security policies.", + help="The list of network security policies. A PUT introducing a ContentInspection policy is incompatible if any associated fabric has no configured inspection connection, regardless of whether selectors currently match traffic. The request is rejected before persisting or distributing the proposed changes, preserving the previously accepted policies; mixed compatible and incompatible associations cannot partially apply changes or silently skip inspection. An unattached group, or one attached only to compatible fabrics, may contain ContentInspection policies. Removing ContentInspection policies remains allowed, subject to other validation.", ) _args_schema.priority = AAZIntArg( options=["--priority"], @@ -627,7 +617,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_delete.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_delete.py index 7afec806e6b..dabb565e306 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_delete.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_delete.py @@ -16,16 +16,18 @@ confirmation="Are you sure you want to perform this operation?", ) class Delete(AAZCommand): - """Delete an independent resource-group-scoped Microsoft.NetworkSecurity Policy Group resource. Policy Groups are not children of an Agent Fabric. + """Delete an independent Policy Group. - :example: PolicyGroups_Delete + Policy Groups are independent resource-group-scoped Microsoft.NetworkSecurity peer resources and are not children of an Agent Fabric. + + :example: Delete an independent Policy Group az agentfabric policy-group delete --resource-group rgnetworksecurity --name testPolicyGroup """ _aaz_info = { - "version": "2026-07-21-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-10-07-preview"], ] } @@ -146,7 +148,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_list.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_list.py index e62d3f8d00c..521057a4e7a 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_list.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_list.py @@ -15,20 +15,22 @@ "agentfabric policy-group list", ) class List(AAZCommand): - """List independent resource-group-scoped Microsoft.NetworkSecurity Policy Group resources. Policy Groups are not children of an Agent Fabric. + """List independent Policy Groups. - :example: PolicyGroups_ListBySubscription - az agentfabric policy-group list + Policy Groups are independent resource-group-scoped Microsoft.NetworkSecurity peer resources and are not children of an Agent Fabric. - :example: PolicyGroups_ListByResourceGroup + :example: List independent Policy Groups in a resource group az agentfabric policy-group list --resource-group rgnetworksecurity + + :example: List independent Policy Groups in a subscription + az agentfabric policy-group list """ _aaz_info = { - "version": "2026-07-21-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networksecurity/policygroups", "2026-07-21-preview"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networksecurity/policygroups", "2026-10-07-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups", "2026-10-07-preview"], ] } @@ -115,7 +117,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } @@ -552,7 +554,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_show.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_show.py index 1c93b534821..1eeaa087ad2 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_show.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_show.py @@ -15,16 +15,18 @@ "agentfabric policy-group show", ) class Show(AAZCommand): - """Show an independent resource-group-scoped Microsoft.NetworkSecurity Policy Group resource. Policy Groups are not children of an Agent Fabric. + """Show an independent Policy Group. - :example: PolicyGroups_Get + Policy Groups are independent resource-group-scoped Microsoft.NetworkSecurity peer resources and are not children of an Agent Fabric. + + :example: Show an independent Policy Group az agentfabric policy-group show --resource-group rgnetworksecurity --name testPolicyGroup """ _aaz_info = { - "version": "2026-07-21-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-10-07-preview"], ] } @@ -123,7 +125,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_update.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_update.py index 185d406be5b..b8c79925f82 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_update.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_update.py @@ -15,16 +15,18 @@ "agentfabric policy-group update", ) class Update(AAZCommand): - """Update an independent resource-group-scoped Microsoft.NetworkSecurity Policy Group resource. Policy Groups are not children of an Agent Fabric. + """Update an independent Policy Group's tags. - :example: PolicyGroups_Update - az agentfabric policy-group update --resource-group rgnetworksecurity --name testPolicyGroup --tags "{env:production}" + Policy Groups are independent resource-group-scoped Microsoft.NetworkSecurity peer resources and are not children of an Agent Fabric. + + :example: Update independent Policy Group tags + az agentfabric policy-group update --resource-group rgnetworksecurity --name testPolicyGroup --tags "{env:prod}" """ _aaz_info = { - "version": "2026-07-21-preview", + "version": "2026-10-07-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-10-07-preview"], ] } @@ -152,7 +154,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } diff --git a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_wait.py b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_wait.py index 10970b8c85a..dc720ec41e6 100644 --- a/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_wait.py +++ b/src/agentfabric/azext_agentfabric/aaz/latest/agentfabric/policy_group/_wait.py @@ -20,7 +20,7 @@ class Wait(AAZWaitCommand): _aaz_info = { "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-07-21-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networksecurity/policygroups/{}", "2026-10-07-preview"], ] } @@ -119,7 +119,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2026-07-21-preview", + "api-version", "2026-10-07-preview", required=True, ), } diff --git a/src/agentfabric/azext_agentfabric/commands.py b/src/agentfabric/azext_agentfabric/commands.py index b0d842e4993..c16115d6696 100644 --- a/src/agentfabric/azext_agentfabric/commands.py +++ b/src/agentfabric/azext_agentfabric/commands.py @@ -12,4 +12,5 @@ def load_command_table(self, _): # pylint: disable=unused-argument - pass + from .custom import AksUpdate + self.command_table["agentfabric aks update"] = AksUpdate(loader=self) diff --git a/src/agentfabric/azext_agentfabric/custom.py b/src/agentfabric/azext_agentfabric/custom.py index 86df1e48ef5..a87b194a97a 100644 --- a/src/agentfabric/azext_agentfabric/custom.py +++ b/src/agentfabric/azext_agentfabric/custom.py @@ -9,6 +9,32 @@ # pylint: disable=too-many-statements from knack.log import get_logger +from azure.cli.core.aaz import register_command +from .aaz.latest.agentfabric.aks import Show as _AksShow, Update as _AksUpdate logger = get_logger(__name__) + + +@register_command("agentfabric aks update") +class AksUpdate(_AksUpdate): + """Patch enrollment tags, SKU, or gateway IP. + + Reads the existing target resource ID for ARM linked authorization before + sending PATCH. Standard-to-Premium upgrades are supported; Premium-to-Standard + downgrades are rejected by the service. + + :example: Upgrade an enrollment SKU + az agentfabric aks update -g myResourceGroup --fabric-name myFabric -n myAssociation --sku Premium + """ + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + schema = super()._build_arguments_schema(*args, **kwargs) + schema.cluster_resource_id._required = False # pylint: disable=protected-access + schema.cluster_resource_id._registered = False # pylint: disable=protected-access + return schema + + def pre_operations(self): + _AksShow.ClusterAssociationsGet(ctx=self.ctx)() + self.ctx.args.cluster_resource_id = self.ctx.vars.instance.properties.cluster_resource_id diff --git a/src/agentfabric/azext_agentfabric/tests/latest/recordings/test_agentfabric_examples_parse.yaml b/src/agentfabric/azext_agentfabric/tests/latest/recordings/test_agentfabric_examples_parse.yaml new file mode 100644 index 00000000000..4d217a0cf72 --- /dev/null +++ b/src/agentfabric/azext_agentfabric/tests/latest/recordings/test_agentfabric_examples_parse.yaml @@ -0,0 +1,44 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate, zstd + Connection: + - keep-alive + User-Agent: + - python-requests/2.32.5 + method: GET + uri: https://aka.ms/azExtCmdTree + response: + body: + string: '' + headers: + cache-control: + - max-age=0, no-cache, no-store + connection: + - keep-alive + content-length: + - '0' + date: + - Sun, 11 Oct 2026 08:05:48 GMT + expires: + - Sun, 11 Oct 2026 08:05:48 GMT + location: + - https://azurecliextensionsync.blob.core.windows.net/cmd-index/extensionCommandTree.json + pragma: + - no-cache + request-context: + - appId=cid-v1:d94c0f68-64bf-4036-8409-a0e761bb7ee1 + server: + - Kestrel + strict-transport-security: + - max-age=31536000 ; includeSubDomains + x-response-cache-status: + - 'True' + status: + code: 301 + message: Moved Permanently +version: 1 diff --git a/src/agentfabric/azext_agentfabric/tests/latest/test_agentfabric.py b/src/agentfabric/azext_agentfabric/tests/latest/test_agentfabric.py index 14215451ab8..fcb95ffe109 100644 --- a/src/agentfabric/azext_agentfabric/tests/latest/test_agentfabric.py +++ b/src/agentfabric/azext_agentfabric/tests/latest/test_agentfabric.py @@ -11,6 +11,8 @@ from unittest.mock import MagicMock from azure.cli.testsdk import ScenarioTest +from azure.cli.core.aaz._command import AAZCommandCtx +from azext_agentfabric.custom import AksUpdate COMMANDS = ( @@ -61,14 +63,24 @@ ), ( "agentfabric aks update", - "azext_agentfabric.aaz.latest.agentfabric.aks._update", - "Update", + "azext_agentfabric.custom", + "AksUpdate", ), ( "agentfabric aks detach", "azext_agentfabric.aaz.latest.agentfabric.aks._detach", "Detach", ), + ( + "agentfabric egress-trust-bundle show", + "azext_agentfabric.aaz.latest.agentfabric.egress_trust_bundle._show", + "Show", + ), + ( + "agentfabric egress-trust-bundle list", + "azext_agentfabric.aaz.latest.agentfabric.egress_trust_bundle._list", + "List", + ), ( "agentfabric policy-group create", "azext_agentfabric.aaz.latest.agentfabric.policy_group._create", @@ -110,7 +122,7 @@ "AgentFabricsCreateOrUpdate", "PUT", "/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", - "2026-07-21-preview", + "2026-10-07-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric._update", @@ -118,7 +130,7 @@ "AgentFabricsUpdate", "PATCH", "/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", - "2026-07-21-preview", + "2026-10-07-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric._delete", @@ -126,7 +138,7 @@ "AgentFabricsDelete", "DELETE", "/Microsoft.NetworkSecurity/agentFabrics/{agentFabricName}", - "2026-07-21-preview", + "2026-10-07-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric.member._create", @@ -134,7 +146,7 @@ "MembersCreateOrUpdate", "PUT", "/agentFabrics/{agentFabricName}/members/{memberName}", - "2026-07-21-preview", + "2026-10-07-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric.member._update", @@ -142,7 +154,7 @@ "MembersUpdate", "PATCH", "/agentFabrics/{agentFabricName}/members/{memberName}", - "2026-07-21-preview", + "2026-10-07-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric.member._delete", @@ -150,7 +162,7 @@ "MembersDelete", "DELETE", "/agentFabrics/{agentFabricName}/members/{memberName}", - "2026-07-21-preview", + "2026-10-07-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric.aks._attach", @@ -158,7 +170,7 @@ "ClusterAssociationsCreateOrUpdate", "PUT", "/agentFabrics/{agentFabricName}/clusterAssociations/{clusterAssociationName}", - "2026-09-10-preview", + "2026-10-07-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric.aks._show", @@ -166,7 +178,7 @@ "ClusterAssociationsGet", "GET", "/agentFabrics/{agentFabricName}/clusterAssociations/{clusterAssociationName}", - "2026-09-10-preview", + "2026-10-07-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric.aks._list", @@ -174,15 +186,15 @@ "ClusterAssociationsListByParent", "GET", "/agentFabrics/{agentFabricName}/clusterAssociations", - "2026-09-10-preview", + "2026-10-07-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric.aks._update", "Update", - "ClusterAssociationsCreateOrUpdate", - "PUT", + "ClusterAssociationsUpdate", + "PATCH", "/agentFabrics/{agentFabricName}/clusterAssociations/{clusterAssociationName}", - "2026-09-10-preview", + "2026-10-07-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric.aks._detach", @@ -190,7 +202,7 @@ "ClusterAssociationsDelete", "DELETE", "/agentFabrics/{agentFabricName}/clusterAssociations/{clusterAssociationName}", - "2026-09-10-preview", + "2026-10-07-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric.policy_group._create", @@ -198,7 +210,7 @@ "PolicyGroupsCreateOrUpdate", "PUT", "/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", - "2026-07-21-preview", + "2026-10-07-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric.policy_group._update", @@ -206,7 +218,7 @@ "PolicyGroupsUpdate", "PATCH", "/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", - "2026-07-21-preview", + "2026-10-07-preview", ), ( "azext_agentfabric.aaz.latest.agentfabric.policy_group._delete", @@ -214,7 +226,7 @@ "PolicyGroupsDelete", "DELETE", "/Microsoft.NetworkSecurity/policyGroups/{policyGroupName}", - "2026-07-21-preview", + "2026-10-07-preview", ), ) @@ -235,6 +247,7 @@ def test_agentfabric_command_help(self): "agentfabric", "agentfabric member", "agentfabric aks", + "agentfabric egress-trust-bundle", "agentfabric policy-group", *(command for command, _, _ in COMMANDS), *HELP_ONLY_COMMANDS, @@ -262,6 +275,11 @@ def test_agentfabric_examples_parse(self): class AgentfabricGeneratedCommandTest(unittest.TestCase): + def _operation(self, command_class, operation_name, arguments): + ctx = AAZCommandCtx(MagicMock(), command_class._build_arguments_schema(), arguments) + ctx._clients["MgmtClient"] = MagicMock() # pylint: disable=protected-access + return getattr(command_class, operation_name)(ctx=ctx) + def test_all_commands_have_generated_examples(self): for command, module_name, class_name in COMMANDS: command_class = getattr(importlib.import_module(module_name), class_name) @@ -271,6 +289,20 @@ def test_all_commands_have_generated_examples(self): command, ) + def test_all_operations_use_latest_public_api(self): + from azure.cli.core.aaz import AAZHttpOperation + for command, module_name, class_name in COMMANDS: + command_class = getattr(importlib.import_module(module_name), class_name) + for operation_class in vars(command_class).values(): + if not isinstance(operation_class, type) or not issubclass(operation_class, AAZHttpOperation): + continue + operation = operation_class(ctx=MagicMock()) + operation.client.format_url.side_effect = lambda url, **_: url + self.assertEqual(operation.query_parameters, {"api-version": "2026-10-07-preview"}, command) + self.assertIn("/Microsoft.NetworkSecurity/", operation.url, command) + self.assertNotIn("Private.NetworkSecurity", operation.url, command) + self.assertFalse(operation.url.startswith("https://"), command) + def test_request_shapes_and_resource_urls(self): for ( module_name, @@ -297,8 +329,11 @@ def test_aks_enrollment_contract(self): ) attach_schema = attach_module.Attach._build_arguments_schema() self.assertTrue(attach_schema.cluster_resource_id._required) - self.assertTrue(attach_schema.cluster_name._required) - self.assertEqual(attach_schema.cluster_name._options, ["--cluster-name"]) + self.assertTrue(attach_schema.association_name._required) + self.assertIn("--cluster-name", attach_schema.association_name._options) + self.assertIn("--association-name", attach_schema.association_name._options) + self.assertTrue(attach_schema.location._required) + self.assertTrue(hasattr(attach_schema, "tags")) self.assertEqual( attach_schema.sku.enum.items, {"Premium": "Premium", "Standard": "Standard"}, @@ -309,9 +344,13 @@ def test_aks_enrollment_contract(self): "azext_agentfabric.aaz.latest.agentfabric.aks._update" ) update_schema = update_module.Update._build_arguments_schema() - self.assertFalse(hasattr(update_schema, "cluster_resource_id")) + self.assertTrue(update_schema.cluster_resource_id._required) self.assertFalse(hasattr(update_schema, "if_none_match")) self.assertTrue(hasattr(update_schema, "sku")) + self.assertTrue(hasattr(update_schema, "workload_cluster_gateway_ip")) + custom_schema = AksUpdate._build_arguments_schema() + self.assertFalse(custom_schema.cluster_resource_id._required) + self.assertFalse(custom_schema.cluster_resource_id._registered) show_module = importlib.import_module( "azext_agentfabric.aaz.latest.agentfabric.aks._show" @@ -327,3 +366,197 @@ def test_aks_enrollment_contract(self): set(output_schema.properties.status._fields), {"code", "message"}, ) + + def test_update_preserves_cluster_id_before_patch(self): + command = MagicMock() + cluster_id = "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.ContainerService/managedClusters/aks" + command.ctx.vars.instance.properties.cluster_resource_id = cluster_id + with unittest.mock.patch( + "azext_agentfabric.custom._AksShow.ClusterAssociationsGet" + ) as get_operation: + AksUpdate.pre_operations(command) + get_operation.assert_called_once_with(ctx=command.ctx) + get_operation.return_value.assert_called_once_with() + self.assertEqual(command.ctx.args.cluster_resource_id, cluster_id) + + def test_attach_and_patch_payloads(self): + from azext_agentfabric.aaz.latest.agentfabric.aks import Attach, Update + cluster_id = "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.ContainerService/managedClusters/aks" + arguments = { + "fabric_name": "fabric", + "association_name": "association", + "resource_group": "rg", + "cluster_resource_id": cluster_id, + "sku": "Premium", + "tags": {"env": "test"}, + } + attach = self._operation( + Attach, "ClusterAssociationsCreateOrUpdate", dict(arguments, location="eastus") + ) + self.assertEqual(attach.content, { + "location": "eastus", + "tags": {"env": "test"}, + "properties": {"clusterResourceId": cluster_id, "sku": "Premium"}, + }) + update = self._operation( + Update, "ClusterAssociationsUpdate", + dict(arguments, workload_cluster_gateway_ip="10.0.0.4"), + ) + self.assertEqual(update.content, { + "tags": {"env": "test"}, + "properties": { + "clusterResourceId": cluster_id, + "sku": "Premium", + "workloadClusterGatewayIp": "10.0.0.4", + }, + }) + session = MagicMock() + session.http_response.status_code = 202 + update.client.send_request.return_value = session + update() + self.assertEqual( + update.client.build_lro_polling.call_args.kwargs["lro_options"], + {"final-state-via": "location"}, + ) + + def test_custom_update_get_then_patch(self): + from azext_agentfabric.aaz.latest.agentfabric.aks import Show, Update + from knack.cli import CLI + cli_ctx = MagicMock(spec=CLI) + cli_ctx.data = {} + cli_ctx.cloud = MagicMock() + cli_ctx.config = MagicMock() + command = AksUpdate(cli_ctx=cli_ctx) + command.ctx = AAZCommandCtx(cli_ctx, AksUpdate._build_arguments_schema(), { + "fabric_name": "fabric", "association_name": "association", + "resource_group": "rg", "sku": "Premium", + }) + command.ctx._clients["MgmtClient"] = MagicMock() # pylint: disable=protected-access + cluster_id = "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.ContainerService/managedClusters/aks" + payloads = [] + output_builder = Show.ClusterAssociationsGet._build_schema_on_200 + + def read_existing(): + command.ctx.set_var("instance", { + "properties": {"clusterResourceId": cluster_id, "sku": "Standard"}, + }, schema_builder=output_builder) + + def record_patch(operation): + payloads.append(operation.content) + + with unittest.mock.patch( + "azext_agentfabric.custom._AksShow.ClusterAssociationsGet" + ) as read, unittest.mock.patch.object( + Update.ClusterAssociationsUpdate, "__call__", record_patch + ): + read.return_value.side_effect = read_existing + list(command._execute_operations()) # pylint: disable=protected-access + self.assertEqual(payloads, [{ + "properties": {"clusterResourceId": cluster_id, "sku": "Premium"}, + }]) + with unittest.mock.patch( + "azext_agentfabric.custom._AksShow.ClusterAssociationsGet", + side_effect=RuntimeError("GET failed"), + ), unittest.mock.patch.object(Update.ClusterAssociationsUpdate, "__call__") as patch: + with self.assertRaisesRegex(RuntimeError, "GET failed"): + list(command._execute_operations()) # pylint: disable=protected-access + patch.assert_not_called() + + def test_fabric_inspection_connection_payload_and_secret_output(self): + from azext_agentfabric.aaz.latest.agentfabric import Create + arguments = { + "name": "fabric", + "resource_group": "rg", + "location": "eastus", + "identity": {"type": "SystemAssigned"}, + "content_inspection_profile": { + "endpoint": "https://example.cognitiveservices.azure.com/", + "api_key": "test-key-not-a-credential", + }, + } + operation = self._operation(Create, "AgentFabricsCreateOrUpdate", arguments) + self.assertEqual(operation.content["identity"], {"type": "SystemAssigned"}) + self.assertEqual(operation.content["properties"]["contentInspectionProfile"], { + "endpoint": "https://example.cognitiveservices.azure.com/", + "apiKey": "test-key-not-a-credential", + }) + output = operation._build_schema_on_200_201() # pylint: disable=protected-access + self.assertNotIn("api_key", output.properties.content_inspection_profile._fields) + self.assertIn("resource_guid", output.properties._fields) + empty = self._operation( + Create, "AgentFabricsCreateOrUpdate", + dict(arguments, content_inspection_profile={}), + ) + self.assertEqual(empty.content["properties"]["contentInspectionProfile"], {}) + omitted = dict(arguments) + omitted.pop("content_inspection_profile") + self.assertNotIn("contentInspectionProfile", self._operation( + Create, "AgentFabricsCreateOrUpdate", omitted, + ).content.get("properties", {})) + + def test_member_patch_and_egress_bundle_contract(self): + from azext_agentfabric.aaz.latest.agentfabric.member import Update + from azext_agentfabric.aaz.latest.agentfabric.egress_trust_bundle import Show, List + operation = self._operation(Update, "MembersUpdate", { + "fabric_name": "fabric", "member_name": "member", "resource_group": "rg", + "fqdn": "member.example.com", "tags": {"env": "test"}, + }) + self.assertEqual(operation.content, { + "properties": {"fqdn": "member.example.com"}, "tags": {"env": "test"}, + }) + show = self._operation(Show, "EgressTrustBundlesGet", { + "fabric_name": "fabric", "resource_group": "rg", + }) + show.client.format_url.side_effect = lambda url, **_: url + self.assertTrue(show.url.endswith("/egressTrustBundles/default")) + schema = show._build_schema_on_200() # pylint: disable=protected-access + self.assertEqual(set(schema.properties._fields), { + "certificates", "bundle_version", "cache_validity_seconds", + "cache_expires_at", "provisioning_state", + }) + self.assertTrue(List.AZ_SUPPORT_PAGINATION) + + def test_member_aks_and_sandbox_endpoint_payloads(self): + from azext_agentfabric.aaz.latest.agentfabric.member import Create + endpoint = { + "name": "http", "protocol": "TCP", "service_port": 80, "target_port": 8080, + } + arguments = { + "fabric_name": "fabric", "member_name": "member", + "resource_group": "rg", "location": "eastus", "fqdn": "member.example.com", + "workload": {"aks": { + "cluster_association_id": "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.NetworkSecurity/agentFabrics/fabric/clusterAssociations/association", + "cluster_resource_id": "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.ContainerService/managedClusters/aks", + "workload": { + "api_version": "apps/v1", "kind": "Deployment", + "namespace": "agents", "name": "agent", + }, + "endpoints": [endpoint], + }}, + } + operation = self._operation(Create, "MembersCreateOrUpdate", arguments) + workload = operation.content["properties"]["workload"] + self.assertEqual(workload["type"], "AKS") + self.assertEqual(workload["workload"]["apiVersion"], "apps/v1") + self.assertEqual(workload["endpoints"], [{ + "name": "http", "protocol": "TCP", "servicePort": 80, "targetPort": 8080, + }]) + sandbox = dict(arguments, workload={"agent_fabric_sandbox": { + "image": {"uri": "example.com/agent:latest"}, + "resources": {"cpu": "1", "memory": "1Gi"}, + "domain": "example.com", "endpoints": [endpoint], + }}) + operation = self._operation(Create, "MembersCreateOrUpdate", sandbox) + workload = operation.content["properties"]["workload"] + self.assertNotIn("port", workload["endpoints"][0]) + self.assertEqual(workload["endpoints"][0]["targetPort"], 8080) + aci = dict(arguments, workload={ + "member_guid": "11111111-1111-1111-1111-111111111111", + "aci": { + "resource_id": "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.ContainerInstance/sandboxGroups/sandbox", + }, + }) + operation = self._operation(Create, "MembersCreateOrUpdate", aci) + workload = operation.content["properties"]["workload"] + self.assertEqual(workload["type"], "ACI") + self.assertEqual(workload["memberGuid"], "11111111-1111-1111-1111-111111111111")