From 534a86a6cb4501013a49451fa8ead8ddb0a1d6c6 Mon Sep 17 00:00:00 2001 From: Ankush Date: Tue, 17 Mar 2026 18:05:27 -0700 Subject: [PATCH] Add fileshares extension - Add Microsoft.FileShares CLI extension (2025-09-01-preview API) - 21 commands across 4 command groups (all Preview stage) - Command groups: file-shares, file-share, file-share-snapshot, private-endpoint-connection, private-link-resource - Generated from AAZ command models --- src/fileshares/HISTORY.rst | 8 + src/fileshares/README.md | 5 + src/fileshares/azext_fileshares/__init__.py | 42 ++ src/fileshares/azext_fileshares/_help.py | 11 + src/fileshares/azext_fileshares/_params.py | 13 + .../azext_fileshares/aaz/__init__.py | 6 + .../azext_fileshares/aaz/latest/__init__.py | 10 + .../aaz/latest/file_shares/__cmd_group.py | 23 + .../aaz/latest/file_shares/__init__.py | 15 + .../file_shares/_check_name_availability.py | 192 +++++ .../aaz/latest/file_shares/_get_limit.py | 238 ++++++ .../_get_provisioning_recommendation.py | 206 ++++++ .../latest/file_shares/_get_usage_datum.py | 173 +++++ .../file_shares/file_share/__cmd_group.py | 23 + .../latest/file_shares/file_share/__init__.py | 17 + .../latest/file_shares/file_share/_create.py | 585 +++++++++++++++ .../latest/file_shares/file_share/_delete.py | 166 +++++ .../latest/file_shares/file_share/_list.py | 679 +++++++++++++++++ .../latest/file_shares/file_share/_show.py | 395 ++++++++++ .../latest/file_shares/file_share/_update.py | 684 ++++++++++++++++++ .../latest/file_shares/file_share/_wait.py | 391 ++++++++++ .../file_share_snapshot/__cmd_group.py | 23 + .../file_share_snapshot/__init__.py | 16 + .../file_share/file_share_snapshot/_create.py | 192 +++++ .../file_share/file_share_snapshot/_delete.py | 179 +++++ .../file_share/file_share_snapshot/_list.py | 230 ++++++ .../file_share/file_share_snapshot/_show.py | 228 ++++++ .../file_share/file_share_snapshot/_update.py | 279 +++++++ .../__cmd_group.py | 23 + .../private_endpoint_connection/__init__.py | 17 + .../private_endpoint_connection/_create.py | 308 ++++++++ .../private_endpoint_connection/_delete.py | 176 +++++ .../private_endpoint_connection/_list.py | 247 +++++++ .../private_endpoint_connection/_show.py | 245 +++++++ .../private_endpoint_connection/_update.py | 457 ++++++++++++ .../private_endpoint_connection/_wait.py | 241 ++++++ .../private_link_resource/__cmd_group.py | 23 + .../private_link_resource/__init__.py | 13 + .../file_share/private_link_resource/_list.py | 233 ++++++ .../file_share/private_link_resource/_show.py | 234 ++++++ .../azext_fileshares/azext_metadata.json | 4 + src/fileshares/azext_fileshares/commands.py | 15 + src/fileshares/azext_fileshares/custom.py | 14 + .../azext_fileshares/tests/__init__.py | 6 + .../azext_fileshares/tests/latest/__init__.py | 6 + .../tests/latest/test_fileshares.py | 13 + src/fileshares/setup.cfg | 1 + src/fileshares/setup.py | 51 ++ 48 files changed, 7356 insertions(+) create mode 100644 src/fileshares/HISTORY.rst create mode 100644 src/fileshares/README.md create mode 100644 src/fileshares/azext_fileshares/__init__.py create mode 100644 src/fileshares/azext_fileshares/_help.py create mode 100644 src/fileshares/azext_fileshares/_params.py create mode 100644 src/fileshares/azext_fileshares/aaz/__init__.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/__init__.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/__cmd_group.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/__init__.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/_check_name_availability.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/_get_limit.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/_get_provisioning_recommendation.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/_get_usage_datum.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/__cmd_group.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/__init__.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_create.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_delete.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_list.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_show.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_update.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_wait.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/__cmd_group.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/__init__.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_create.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_delete.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_list.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_show.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_update.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/__cmd_group.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/__init__.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_create.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_delete.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_list.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_show.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_update.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_wait.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_link_resource/__cmd_group.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_link_resource/__init__.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_link_resource/_list.py create mode 100644 src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_link_resource/_show.py create mode 100644 src/fileshares/azext_fileshares/azext_metadata.json create mode 100644 src/fileshares/azext_fileshares/commands.py create mode 100644 src/fileshares/azext_fileshares/custom.py create mode 100644 src/fileshares/azext_fileshares/tests/__init__.py create mode 100644 src/fileshares/azext_fileshares/tests/latest/__init__.py create mode 100644 src/fileshares/azext_fileshares/tests/latest/test_fileshares.py create mode 100644 src/fileshares/setup.cfg create mode 100644 src/fileshares/setup.py diff --git a/src/fileshares/HISTORY.rst b/src/fileshares/HISTORY.rst new file mode 100644 index 00000000000..abbff5a61a7 --- /dev/null +++ b/src/fileshares/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +1.0.0b1 +++++++ +* Initial release. \ No newline at end of file diff --git a/src/fileshares/README.md b/src/fileshares/README.md new file mode 100644 index 00000000000..b845babf9d4 --- /dev/null +++ b/src/fileshares/README.md @@ -0,0 +1,5 @@ +# Azure CLI Fileshares Extension # +This is an extension to Azure CLI to manage Fileshares resources. + +## How to use ## +Please add commands usage here. \ No newline at end of file diff --git a/src/fileshares/azext_fileshares/__init__.py b/src/fileshares/azext_fileshares/__init__.py new file mode 100644 index 00000000000..984c08c8243 --- /dev/null +++ b/src/fileshares/azext_fileshares/__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_fileshares._help import helps # pylint: disable=unused-import + + +class FilesharesCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + custom_command_type = CliCommandType( + operations_tmpl='azext_fileshares.custom#{}') + super().__init__(cli_ctx=cli_ctx, + custom_command_type=custom_command_type) + + def load_command_table(self, args): + from azext_fileshares.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_fileshares._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = FilesharesCommandsLoader diff --git a/src/fileshares/azext_fileshares/_help.py b/src/fileshares/azext_fileshares/_help.py new file mode 100644 index 00000000000..126d5d00714 --- /dev/null +++ b/src/fileshares/azext_fileshares/_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/fileshares/azext_fileshares/_params.py b/src/fileshares/azext_fileshares/_params.py new file mode 100644 index 00000000000..cfcec717c9c --- /dev/null +++ b/src/fileshares/azext_fileshares/_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/fileshares/azext_fileshares/aaz/__init__.py b/src/fileshares/azext_fileshares/aaz/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/fileshares/azext_fileshares/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/fileshares/azext_fileshares/aaz/latest/__init__.py b/src/fileshares/azext_fileshares/aaz/latest/__init__.py new file mode 100644 index 00000000000..f6acc11aa4e --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/__init__.py @@ -0,0 +1,10 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/__cmd_group.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/__cmd_group.py new file mode 100644 index 00000000000..877598b2c89 --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/__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( + "file-shares", +) +class __CMDGroup(AAZCommandGroup): + """Manage File Shares + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/__init__.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/__init__.py new file mode 100644 index 00000000000..003f873ffe6 --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/__init__.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: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._check_name_availability import * +from ._get_limit import * +from ._get_provisioning_recommendation import * +from ._get_usage_datum import * diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/_check_name_availability.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/_check_name_availability.py new file mode 100644 index 00000000000..756a3f07afb --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/_check_name_availability.py @@ -0,0 +1,192 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares check-name-availability", +) +class CheckNameAvailability(AAZCommand): + """Implements local CheckNameAvailability operations + + :example: FileShares_CheckNameAvailability_MaximumSet + az file-shares check-name-availability --location westus --name fvykqbgmd --type Microsoft.FileShares/fileShares + + :example: FileShares_CheckNameAvailability_MinimumSet + az file-shares check-name-availability --location westus --name fvykqbgmd --type Microsoft.FileShares/fileShares --location westus + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.fileshares/locations/{}/checknameavailability", "2026-06-01"], + ] + } + + 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.location = AAZResourceLocationArg( + required=True, + id_part="name", + ) + + # define Arg Group "Body" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["--name"], + arg_group="Body", + help="The name of the resource for which availability needs to be checked.", + ) + _args_schema.type = AAZStrArg( + options=["--type"], + arg_group="Body", + help="The resource type.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.FileSharesCheckNameAvailability(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 FileSharesCheckNameAvailability(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.FileShares/locations/{location}/checkNameAvailability", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "location", self.ctx.args.location, + 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-06-01", + 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("name", AAZStrType, ".name") + _builder.set_prop("type", AAZStrType, ".type") + + 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.message = AAZStrType() + _schema_on_200.name_available = AAZBoolType( + serialized_name="nameAvailable", + ) + _schema_on_200.reason = AAZStrType() + + return cls._schema_on_200 + + +class _CheckNameAvailabilityHelper: + """Helper class for CheckNameAvailability""" + + +__all__ = ["CheckNameAvailability"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/_get_limit.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/_get_limit.py new file mode 100644 index 00000000000..30c25c93a66 --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/_get_limit.py @@ -0,0 +1,238 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares get-limit", +) +class GetLimit(AAZCommand): + """Get file shares limits. + + :example: FileShare_GetLimits_MaximumSet + az file-shares get-limit --location westus + + :example: FileShare_GetLimits_MinimumSet + az file-shares get-limit --location westus --location westus + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.fileshares/locations/{}/getlimits", "2026-06-01"], + ] + } + + 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.location = AAZResourceLocationArg( + required=True, + id_part="name", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.FileShareGetLimits(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 FileShareGetLimits(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.FileShares/locations/{location}/getLimits", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "location", self.ctx.args.location, + 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-06-01", + 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.properties = AAZObjectType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.limits = AAZObjectType( + flags={"required": True}, + ) + properties.provisioning_constants = AAZObjectType( + serialized_name="provisioningConstants", + flags={"required": True}, + ) + + limits = cls._schema_on_200.properties.limits + limits.max_file_share_private_endpoint_connections = AAZIntType( + serialized_name="maxFileSharePrivateEndpointConnections", + flags={"required": True}, + ) + limits.max_file_share_snapshots = AAZIntType( + serialized_name="maxFileShareSnapshots", + flags={"required": True}, + ) + limits.max_file_share_subnets = AAZIntType( + serialized_name="maxFileShareSubnets", + flags={"required": True}, + ) + limits.max_file_shares = AAZIntType( + serialized_name="maxFileShares", + flags={"required": True}, + ) + limits.max_provisioned_io_per_sec = AAZIntType( + serialized_name="maxProvisionedIOPerSec", + flags={"required": True}, + ) + limits.max_provisioned_storage_gi_b = AAZIntType( + serialized_name="maxProvisionedStorageGiB", + flags={"required": True}, + ) + limits.max_provisioned_throughput_mi_b_per_sec = AAZIntType( + serialized_name="maxProvisionedThroughputMiBPerSec", + flags={"required": True}, + ) + limits.min_provisioned_io_per_sec = AAZIntType( + serialized_name="minProvisionedIOPerSec", + flags={"required": True}, + ) + limits.min_provisioned_storage_gi_b = AAZIntType( + serialized_name="minProvisionedStorageGiB", + flags={"required": True}, + ) + limits.min_provisioned_throughput_mi_b_per_sec = AAZIntType( + serialized_name="minProvisionedThroughputMiBPerSec", + flags={"required": True}, + ) + + provisioning_constants = cls._schema_on_200.properties.provisioning_constants + provisioning_constants.base_io_per_sec = AAZIntType( + serialized_name="baseIOPerSec", + flags={"required": True}, + ) + provisioning_constants.base_throughput_mi_b_per_sec = AAZIntType( + serialized_name="baseThroughputMiBPerSec", + flags={"required": True}, + ) + provisioning_constants.guardrail_io_per_sec_scalar = AAZFloatType( + serialized_name="guardrailIOPerSecScalar", + flags={"required": True}, + ) + provisioning_constants.guardrail_throughput_scalar = AAZFloatType( + serialized_name="guardrailThroughputScalar", + flags={"required": True}, + ) + provisioning_constants.scalar_io_per_sec = AAZFloatType( + serialized_name="scalarIOPerSec", + flags={"required": True}, + ) + provisioning_constants.scalar_throughput_mi_b_per_sec = AAZFloatType( + serialized_name="scalarThroughputMiBPerSec", + flags={"required": True}, + ) + + return cls._schema_on_200 + + +class _GetLimitHelper: + """Helper class for GetLimit""" + + +__all__ = ["GetLimit"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/_get_provisioning_recommendation.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/_get_provisioning_recommendation.py new file mode 100644 index 00000000000..b2fec3b666c --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/_get_provisioning_recommendation.py @@ -0,0 +1,206 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares get-provisioning-recommendation", +) +class GetProvisioningRecommendation(AAZCommand): + """Get file shares provisioning parameters recommendation. + + :example: FileShare_GetProvisioningRecommendation_MaximumSet + az file-shares get-provisioning-recommendation --location westus --provisioned-storage-gi-b 7 + + :example: FileShare_GetProvisioningRecommendation_MinimumSet + az file-shares get-provisioning-recommendation --location westus --provisioned-storage-gi-b 7 --location westus --provisioned-storage-gi-b 7 + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.fileshares/locations/{}/getprovisioningrecommendation", "2026-06-01"], + ] + } + + 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.location = AAZResourceLocationArg( + required=True, + id_part="name", + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.provisioned_storage_gi_b = AAZIntArg( + options=["--provisioned-storage-gi-b"], + arg_group="Properties", + help="The desired provisioned storage size of the share in GiB. Will be use to calculate the values of remaining provisioning parameters.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.FileShareGetProvisioningRecommendation(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 FileShareGetProvisioningRecommendation(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.FileShares/locations/{location}/getProvisioningRecommendation", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "location", self.ctx.args.location, + 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-06-01", + 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("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("provisionedStorageGiB", AAZIntType, ".provisioned_storage_gi_b", typ_kwargs={"flags": {"required": True}}) + + 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.properties = AAZObjectType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.available_redundancy_options = AAZListType( + serialized_name="availableRedundancyOptions", + flags={"required": True}, + ) + properties.provisioned_io_per_sec = AAZIntType( + serialized_name="provisionedIOPerSec", + flags={"required": True}, + ) + properties.provisioned_throughput_mi_b_per_sec = AAZIntType( + serialized_name="provisionedThroughputMiBPerSec", + flags={"required": True}, + ) + + available_redundancy_options = cls._schema_on_200.properties.available_redundancy_options + available_redundancy_options.Element = AAZStrType() + + return cls._schema_on_200 + + +class _GetProvisioningRecommendationHelper: + """Helper class for GetProvisioningRecommendation""" + + +__all__ = ["GetProvisioningRecommendation"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/_get_usage_datum.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/_get_usage_datum.py new file mode 100644 index 00000000000..6389d98efbe --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/_get_usage_datum.py @@ -0,0 +1,173 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares get-usage-datum", +) +class GetUsageDatum(AAZCommand): + """Get file shares usage data. + + :example: FileShare_GetUsageData_MaximumSet + az file-shares get-usage-datum --location westus + + :example: FileShare_GetUsageData_MinimumSet + az file-shares get-usage-datum --location westus --location westus + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.fileshares/locations/{}/getusagedata", "2026-06-01"], + ] + } + + 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.location = AAZResourceLocationArg( + required=True, + id_part="name", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.FileShareGetUsageData(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 FileShareGetUsageData(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.FileShares/locations/{location}/getUsageData", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "location", self.ctx.args.location, + 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-06-01", + 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.properties = AAZObjectType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.live_shares = AAZObjectType( + serialized_name="liveShares", + flags={"required": True}, + ) + + live_shares = cls._schema_on_200.properties.live_shares + live_shares.file_share_count = AAZIntType( + serialized_name="fileShareCount", + flags={"required": True}, + ) + + return cls._schema_on_200 + + +class _GetUsageDatumHelper: + """Helper class for GetUsageDatum""" + + +__all__ = ["GetUsageDatum"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/__cmd_group.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/__cmd_group.py new file mode 100644 index 00000000000..6a4c7d8f018 --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/__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( + "file-shares file-share", +) +class __CMDGroup(AAZCommandGroup): + """Manage File Share + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/__init__.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/__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/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_create.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_create.py new file mode 100644 index 00000000000..64789c46932 --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_create.py @@ -0,0 +1,585 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares file-share create", +) +class Create(AAZCommand): + """Create a file share. + + :example: FileShares_CreateOrUpdate_MaximumSet + az file-shares file-share create --resource-group rgfileshares --resource-name fileshare --mount-name fileshare --media-tier SSD --redundancy Local --protocol NFS --provisioned-storage-gi-b 8 --provisioned-io-per-sec 5 --provisioned-throughput-mi-b-per-sec 22 --nfs-protocol-properties "{root-squash:NoRootSquash,encryption-in-transit-required:Enabled}" --public-access-properties "{allowed-subnets:[/subscriptions/9760acf5-4638-11e7-9bdb-020073ca7778/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3]}" --public-network-access Enabled --tags "{key9647:xwokdvyoae}" --location westus + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}", "2026-06-01"], + ] + } + + 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.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The resource name of the file share, as seen by the administrator through Azure Resource Manager.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + + # define Arg Group "Identity" + + _args_schema = cls._args_schema + _args_schema.mi_system_assigned = AAZStrArg( + options=["--system-assigned", "--mi-system-assigned"], + arg_group="Identity", + help="Set the system managed identity.", + blank="True", + ) + _args_schema.mi_user_assigned = AAZListArg( + options=["--user-assigned", "--mi-user-assigned"], + arg_group="Identity", + help="Set the user managed identities.", + blank=[], + ) + + mi_user_assigned = cls._args_schema.mi_user_assigned + mi_user_assigned.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.media_tier = AAZStrArg( + options=["--media-tier"], + arg_group="Properties", + help="The storage media tier of the file share.", + enum={"SSD": "SSD"}, + ) + _args_schema.mount_name = AAZStrArg( + options=["--mount-name"], + arg_group="Properties", + help="The name of the file share as seen by the end user when mounting the share, such as in a URI or UNC format in their operating system.", + ) + _args_schema.nfs_protocol_properties = AAZObjectArg( + options=["--nfs-protocol-properties"], + arg_group="Properties", + help="Protocol settings specific NFS.", + ) + _args_schema.protocol = AAZStrArg( + options=["--protocol"], + arg_group="Properties", + help="The file sharing protocol for this file share.", + enum={"NFS": "NFS"}, + ) + _args_schema.provisioned_io_per_sec = AAZIntArg( + options=["--provisioned-io-per-sec"], + arg_group="Properties", + help="The provisioned IO / sec of the share.", + ) + _args_schema.provisioned_storage_gi_b = AAZIntArg( + options=["--provisioned-storage-gi-b"], + arg_group="Properties", + help="The provisioned storage size of the share in GiB (1 GiB is 1024^3 bytes or 1073741824 bytes). A component of the file share's bill is the provisioned storage, regardless of the amount of used storage.", + ) + _args_schema.provisioned_throughput_mi_b_per_sec = AAZIntArg( + options=["--provisioned-throughput-mi-b-per-sec"], + arg_group="Properties", + help="The provisioned throughput / sec of the share.", + ) + _args_schema.public_access_properties = AAZObjectArg( + options=["--public-access-properties"], + arg_group="Properties", + help="The set of properties for control public access.", + ) + _args_schema.public_network_access = AAZStrArg( + options=["--public-network-access"], + arg_group="Properties", + help="Gets or sets allow or disallow public network access to azure managed file share", + enum={"Disabled": "Disabled", "Enabled": "Enabled"}, + ) + _args_schema.redundancy = AAZStrArg( + options=["--redundancy"], + arg_group="Properties", + help="The chosen redundancy level of the file share.", + enum={"Local": "Local", "Zone": "Zone"}, + ) + + nfs_protocol_properties = cls._args_schema.nfs_protocol_properties + nfs_protocol_properties.encryption_in_transit_required = AAZStrArg( + options=["encryption-in-transit-required"], + help="Encryption in transit defines whether data is encrypted for NFS shares.", + enum={"Disabled": "Disabled", "Enabled": "Enabled"}, + ) + nfs_protocol_properties.root_squash = AAZStrArg( + options=["root-squash"], + help="Root squash defines how root users on clients are mapped to the NFS share.", + enum={"AllSquash": "AllSquash", "NoRootSquash": "NoRootSquash", "RootSquash": "RootSquash"}, + ) + + public_access_properties = cls._args_schema.public_access_properties + public_access_properties.allowed_subnets = AAZListArg( + options=["allowed-subnets"], + help="The allowed set of subnets when access is restricted.", + ) + + allowed_subnets = cls._args_schema.public_access_properties.allowed_subnets + allowed_subnets.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.FileSharesCreateOrUpdate(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 FileSharesCreateOrUpdate(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.FileShares/fileShares/{resourceName}", + **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( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + 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("identity", AAZIdentityObjectType) + _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("userAssigned", AAZListType, ".mi_user_assigned", typ_kwargs={"flags": {"action": "create"}}) + identity.set_prop("systemAssigned", AAZStrType, ".mi_system_assigned", typ_kwargs={"flags": {"action": "create"}}) + + user_assigned = _builder.get(".identity.userAssigned") + if user_assigned is not None: + user_assigned.set_elements(AAZStrType, ".") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("mediaTier", AAZStrType, ".media_tier") + properties.set_prop("mountName", AAZStrType, ".mount_name") + properties.set_prop("nfsProtocolProperties", AAZObjectType, ".nfs_protocol_properties") + properties.set_prop("protocol", AAZStrType, ".protocol") + properties.set_prop("provisionedIOPerSec", AAZIntType, ".provisioned_io_per_sec") + properties.set_prop("provisionedStorageGiB", AAZIntType, ".provisioned_storage_gi_b") + properties.set_prop("provisionedThroughputMiBPerSec", AAZIntType, ".provisioned_throughput_mi_b_per_sec") + properties.set_prop("publicAccessProperties", AAZObjectType, ".public_access_properties") + properties.set_prop("publicNetworkAccess", AAZStrType, ".public_network_access") + properties.set_prop("redundancy", AAZStrType, ".redundancy") + + nfs_protocol_properties = _builder.get(".properties.nfsProtocolProperties") + if nfs_protocol_properties is not None: + nfs_protocol_properties.set_prop("encryptionInTransitRequired", AAZStrType, ".encryption_in_transit_required") + nfs_protocol_properties.set_prop("rootSquash", AAZStrType, ".root_squash") + + public_access_properties = _builder.get(".properties.publicAccessProperties") + if public_access_properties is not None: + public_access_properties.set_prop("allowedSubnets", AAZListType, ".allowed_subnets") + + allowed_subnets = _builder.get(".properties.publicAccessProperties.allowedSubnets") + if allowed_subnets is not None: + allowed_subnets.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.identity = AAZIdentityObjectType() + _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}, + ) + _CreateHelper._build_schema_system_data_read(_schema_on_200_201.system_data) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + 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}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = cls._schema_on_200_201.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType( + nullable=True, + ) + + _element = cls._schema_on_200_201.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.host_name = AAZStrType( + serialized_name="hostName", + flags={"read_only": True}, + ) + properties.included_burst_io_per_sec = AAZIntType( + serialized_name="includedBurstIOPerSec", + flags={"read_only": True}, + ) + properties.max_burst_io_per_sec_credits = AAZIntType( + serialized_name="maxBurstIOPerSecCredits", + flags={"read_only": True}, + ) + properties.media_tier = AAZStrType( + serialized_name="mediaTier", + ) + properties.mount_name = AAZStrType( + serialized_name="mountName", + ) + properties.nfs_protocol_properties = AAZObjectType( + serialized_name="nfsProtocolProperties", + ) + properties.private_endpoint_connections = AAZListType( + serialized_name="privateEndpointConnections", + flags={"read_only": True}, + ) + properties.protocol = AAZStrType() + properties.provisioned_io_per_sec = AAZIntType( + serialized_name="provisionedIOPerSec", + ) + properties.provisioned_io_per_sec_next_allowed_downgrade = AAZStrType( + serialized_name="provisionedIOPerSecNextAllowedDowngrade", + flags={"read_only": True}, + ) + properties.provisioned_storage_gi_b = AAZIntType( + serialized_name="provisionedStorageGiB", + ) + properties.provisioned_storage_next_allowed_downgrade = AAZStrType( + serialized_name="provisionedStorageNextAllowedDowngrade", + flags={"read_only": True}, + ) + properties.provisioned_throughput_mi_b_per_sec = AAZIntType( + serialized_name="provisionedThroughputMiBPerSec", + ) + properties.provisioned_throughput_next_allowed_downgrade = AAZStrType( + serialized_name="provisionedThroughputNextAllowedDowngrade", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.public_access_properties = AAZObjectType( + serialized_name="publicAccessProperties", + ) + properties.public_network_access = AAZStrType( + serialized_name="publicNetworkAccess", + ) + properties.redundancy = AAZStrType() + + nfs_protocol_properties = cls._schema_on_200_201.properties.nfs_protocol_properties + nfs_protocol_properties.encryption_in_transit_required = AAZStrType( + serialized_name="encryptionInTransitRequired", + ) + nfs_protocol_properties.root_squash = AAZStrType( + serialized_name="rootSquash", + ) + + private_endpoint_connections = cls._schema_on_200_201.properties.private_endpoint_connections + private_endpoint_connections.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.private_endpoint_connections.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _CreateHelper._build_schema_system_data_read(_element.system_data) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties.private_endpoint_connections.Element.properties + properties.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = cls._schema_on_200_201.properties.private_endpoint_connections.Element.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = cls._schema_on_200_201.properties.private_endpoint_connections.Element.properties.private_endpoint + private_endpoint.id = AAZStrType( + flags={"read_only": True}, + ) + + private_link_service_connection_state = cls._schema_on_200_201.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + ) + private_link_service_connection_state.description = AAZStrType() + private_link_service_connection_state.status = AAZStrType() + + public_access_properties = cls._schema_on_200_201.properties.public_access_properties + public_access_properties.allowed_subnets = AAZListType( + serialized_name="allowedSubnets", + ) + + allowed_subnets = cls._schema_on_200_201.properties.public_access_properties.allowed_subnets + allowed_subnets.Element = AAZStrType() + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + _schema_system_data_read = None + + @classmethod + def _build_schema_system_data_read(cls, _schema): + if cls._schema_system_data_read is not None: + _schema.created_at = cls._schema_system_data_read.created_at + _schema.created_by = cls._schema_system_data_read.created_by + _schema.created_by_type = cls._schema_system_data_read.created_by_type + _schema.last_modified_at = cls._schema_system_data_read.last_modified_at + _schema.last_modified_by = cls._schema_system_data_read.last_modified_by + _schema.last_modified_by_type = cls._schema_system_data_read.last_modified_by_type + return + + cls._schema_system_data_read = _schema_system_data_read = AAZObjectType( + flags={"read_only": True} + ) + + system_data_read = _schema_system_data_read + system_data_read.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data_read.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data_read.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data_read.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data_read.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data_read.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.created_at = cls._schema_system_data_read.created_at + _schema.created_by = cls._schema_system_data_read.created_by + _schema.created_by_type = cls._schema_system_data_read.created_by_type + _schema.last_modified_at = cls._schema_system_data_read.last_modified_at + _schema.last_modified_by = cls._schema_system_data_read.last_modified_by + _schema.last_modified_by_type = cls._schema_system_data_read.last_modified_by_type + + +__all__ = ["Create"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_delete.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_delete.py new file mode 100644 index 00000000000..71416e5969f --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_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( + "file-shares file-share delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete a FileShare + + :example: FileShares_Delete_MaximumSet + az file-shares file-share delete --resource-group rgfileshares --resource-name fileshare + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}", "2026-06-01"], + ] + } + + 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.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The resource name of the file share, as seen by the administrator through Azure Resource Manager.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.FileSharesDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class FileSharesDelete(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.FileShares/fileShares/{resourceName}", + **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( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + 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/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_list.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_list.py new file mode 100644 index 00000000000..a4d1c45acdb --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_list.py @@ -0,0 +1,679 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares file-share list", +) +class List(AAZCommand): + """List FileShare resources by subscription ID + + :example: FileShares_ListBySubscription_MaximumSet + az file-shares file-share list + + :example: FileShares_ListBySubscription_MinimumSet + az file-shares file-share list + + :example: FileShares_ListByParent_MaximumSet + az file-shares file-share list --resource-group rgfileshares + + :example: FileShares_ListByParent_MinimumSet + az file-shares file-share list --resource-group rgfileshares --resource-group rgfileshares + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.fileshares/fileshares", "2026-06-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares", "2026-06-01"], + ] + } + + 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.FileSharesListBySubscription(ctx=self.ctx)() + if condition_1: + self.FileSharesListByParent(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 FileSharesListBySubscription(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.FileShares/fileShares", + **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-06-01", + 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.identity = AAZIdentityObjectType() + _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}, + ) + _ListHelper._build_schema_system_data_read(_element.system_data) + _element.tags = AAZDictType() + _element.type = AAZStrType( + 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}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = cls._schema_on_200.value.Element.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType( + nullable=True, + ) + + _element = cls._schema_on_200.value.Element.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.host_name = AAZStrType( + serialized_name="hostName", + flags={"read_only": True}, + ) + properties.included_burst_io_per_sec = AAZIntType( + serialized_name="includedBurstIOPerSec", + flags={"read_only": True}, + ) + properties.max_burst_io_per_sec_credits = AAZIntType( + serialized_name="maxBurstIOPerSecCredits", + flags={"read_only": True}, + ) + properties.media_tier = AAZStrType( + serialized_name="mediaTier", + ) + properties.mount_name = AAZStrType( + serialized_name="mountName", + ) + properties.nfs_protocol_properties = AAZObjectType( + serialized_name="nfsProtocolProperties", + ) + properties.private_endpoint_connections = AAZListType( + serialized_name="privateEndpointConnections", + flags={"read_only": True}, + ) + properties.protocol = AAZStrType() + properties.provisioned_io_per_sec = AAZIntType( + serialized_name="provisionedIOPerSec", + ) + properties.provisioned_io_per_sec_next_allowed_downgrade = AAZStrType( + serialized_name="provisionedIOPerSecNextAllowedDowngrade", + flags={"read_only": True}, + ) + properties.provisioned_storage_gi_b = AAZIntType( + serialized_name="provisionedStorageGiB", + ) + properties.provisioned_storage_next_allowed_downgrade = AAZStrType( + serialized_name="provisionedStorageNextAllowedDowngrade", + flags={"read_only": True}, + ) + properties.provisioned_throughput_mi_b_per_sec = AAZIntType( + serialized_name="provisionedThroughputMiBPerSec", + ) + properties.provisioned_throughput_next_allowed_downgrade = AAZStrType( + serialized_name="provisionedThroughputNextAllowedDowngrade", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.public_access_properties = AAZObjectType( + serialized_name="publicAccessProperties", + ) + properties.public_network_access = AAZStrType( + serialized_name="publicNetworkAccess", + ) + properties.redundancy = AAZStrType() + + nfs_protocol_properties = cls._schema_on_200.value.Element.properties.nfs_protocol_properties + nfs_protocol_properties.encryption_in_transit_required = AAZStrType( + serialized_name="encryptionInTransitRequired", + ) + nfs_protocol_properties.root_squash = AAZStrType( + serialized_name="rootSquash", + ) + + private_endpoint_connections = cls._schema_on_200.value.Element.properties.private_endpoint_connections + private_endpoint_connections.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _ListHelper._build_schema_system_data_read(_element.system_data) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties + properties.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties.private_endpoint + private_endpoint.id = AAZStrType( + flags={"read_only": True}, + ) + + private_link_service_connection_state = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + ) + private_link_service_connection_state.description = AAZStrType() + private_link_service_connection_state.status = AAZStrType() + + public_access_properties = cls._schema_on_200.value.Element.properties.public_access_properties + public_access_properties.allowed_subnets = AAZListType( + serialized_name="allowedSubnets", + ) + + allowed_subnets = cls._schema_on_200.value.Element.properties.public_access_properties.allowed_subnets + allowed_subnets.Element = AAZStrType() + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class FileSharesListByParent(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.FileShares/fileShares", + **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-06-01", + 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.identity = AAZIdentityObjectType() + _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}, + ) + _ListHelper._build_schema_system_data_read(_element.system_data) + _element.tags = AAZDictType() + _element.type = AAZStrType( + 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}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = cls._schema_on_200.value.Element.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType( + nullable=True, + ) + + _element = cls._schema_on_200.value.Element.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.host_name = AAZStrType( + serialized_name="hostName", + flags={"read_only": True}, + ) + properties.included_burst_io_per_sec = AAZIntType( + serialized_name="includedBurstIOPerSec", + flags={"read_only": True}, + ) + properties.max_burst_io_per_sec_credits = AAZIntType( + serialized_name="maxBurstIOPerSecCredits", + flags={"read_only": True}, + ) + properties.media_tier = AAZStrType( + serialized_name="mediaTier", + ) + properties.mount_name = AAZStrType( + serialized_name="mountName", + ) + properties.nfs_protocol_properties = AAZObjectType( + serialized_name="nfsProtocolProperties", + ) + properties.private_endpoint_connections = AAZListType( + serialized_name="privateEndpointConnections", + flags={"read_only": True}, + ) + properties.protocol = AAZStrType() + properties.provisioned_io_per_sec = AAZIntType( + serialized_name="provisionedIOPerSec", + ) + properties.provisioned_io_per_sec_next_allowed_downgrade = AAZStrType( + serialized_name="provisionedIOPerSecNextAllowedDowngrade", + flags={"read_only": True}, + ) + properties.provisioned_storage_gi_b = AAZIntType( + serialized_name="provisionedStorageGiB", + ) + properties.provisioned_storage_next_allowed_downgrade = AAZStrType( + serialized_name="provisionedStorageNextAllowedDowngrade", + flags={"read_only": True}, + ) + properties.provisioned_throughput_mi_b_per_sec = AAZIntType( + serialized_name="provisionedThroughputMiBPerSec", + ) + properties.provisioned_throughput_next_allowed_downgrade = AAZStrType( + serialized_name="provisionedThroughputNextAllowedDowngrade", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.public_access_properties = AAZObjectType( + serialized_name="publicAccessProperties", + ) + properties.public_network_access = AAZStrType( + serialized_name="publicNetworkAccess", + ) + properties.redundancy = AAZStrType() + + nfs_protocol_properties = cls._schema_on_200.value.Element.properties.nfs_protocol_properties + nfs_protocol_properties.encryption_in_transit_required = AAZStrType( + serialized_name="encryptionInTransitRequired", + ) + nfs_protocol_properties.root_squash = AAZStrType( + serialized_name="rootSquash", + ) + + private_endpoint_connections = cls._schema_on_200.value.Element.properties.private_endpoint_connections + private_endpoint_connections.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _ListHelper._build_schema_system_data_read(_element.system_data) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties + properties.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties.private_endpoint + private_endpoint.id = AAZStrType( + flags={"read_only": True}, + ) + + private_link_service_connection_state = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + ) + private_link_service_connection_state.description = AAZStrType() + private_link_service_connection_state.status = AAZStrType() + + public_access_properties = cls._schema_on_200.value.Element.properties.public_access_properties + public_access_properties.allowed_subnets = AAZListType( + serialized_name="allowedSubnets", + ) + + allowed_subnets = cls._schema_on_200.value.Element.properties.public_access_properties.allowed_subnets + allowed_subnets.Element = AAZStrType() + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + _schema_system_data_read = None + + @classmethod + def _build_schema_system_data_read(cls, _schema): + if cls._schema_system_data_read is not None: + _schema.created_at = cls._schema_system_data_read.created_at + _schema.created_by = cls._schema_system_data_read.created_by + _schema.created_by_type = cls._schema_system_data_read.created_by_type + _schema.last_modified_at = cls._schema_system_data_read.last_modified_at + _schema.last_modified_by = cls._schema_system_data_read.last_modified_by + _schema.last_modified_by_type = cls._schema_system_data_read.last_modified_by_type + return + + cls._schema_system_data_read = _schema_system_data_read = AAZObjectType( + flags={"read_only": True} + ) + + system_data_read = _schema_system_data_read + system_data_read.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data_read.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data_read.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data_read.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data_read.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data_read.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.created_at = cls._schema_system_data_read.created_at + _schema.created_by = cls._schema_system_data_read.created_by + _schema.created_by_type = cls._schema_system_data_read.created_by_type + _schema.last_modified_at = cls._schema_system_data_read.last_modified_at + _schema.last_modified_by = cls._schema_system_data_read.last_modified_by + _schema.last_modified_by_type = cls._schema_system_data_read.last_modified_by_type + + +__all__ = ["List"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_show.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_show.py new file mode 100644 index 00000000000..9ac7d8b8ad8 --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_show.py @@ -0,0 +1,395 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares file-share show", +) +class Show(AAZCommand): + """Get a FileShare + + :example: FileShares_Get_MaximumSet + az file-shares file-share show --resource-group rgfileshares --resource-name fileshare + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}", "2026-06-01"], + ] + } + + 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.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The resource name of the file share, as seen by the administrator through Azure Resource Manager.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.FileSharesGet(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 FileSharesGet(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.FileShares/fileShares/{resourceName}", + **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( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + 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.identity = AAZIdentityObjectType() + _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}, + ) + _ShowHelper._build_schema_system_data_read(_schema_on_200.system_data) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + 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}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = cls._schema_on_200.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType( + nullable=True, + ) + + _element = cls._schema_on_200.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.host_name = AAZStrType( + serialized_name="hostName", + flags={"read_only": True}, + ) + properties.included_burst_io_per_sec = AAZIntType( + serialized_name="includedBurstIOPerSec", + flags={"read_only": True}, + ) + properties.max_burst_io_per_sec_credits = AAZIntType( + serialized_name="maxBurstIOPerSecCredits", + flags={"read_only": True}, + ) + properties.media_tier = AAZStrType( + serialized_name="mediaTier", + ) + properties.mount_name = AAZStrType( + serialized_name="mountName", + ) + properties.nfs_protocol_properties = AAZObjectType( + serialized_name="nfsProtocolProperties", + ) + properties.private_endpoint_connections = AAZListType( + serialized_name="privateEndpointConnections", + flags={"read_only": True}, + ) + properties.protocol = AAZStrType() + properties.provisioned_io_per_sec = AAZIntType( + serialized_name="provisionedIOPerSec", + ) + properties.provisioned_io_per_sec_next_allowed_downgrade = AAZStrType( + serialized_name="provisionedIOPerSecNextAllowedDowngrade", + flags={"read_only": True}, + ) + properties.provisioned_storage_gi_b = AAZIntType( + serialized_name="provisionedStorageGiB", + ) + properties.provisioned_storage_next_allowed_downgrade = AAZStrType( + serialized_name="provisionedStorageNextAllowedDowngrade", + flags={"read_only": True}, + ) + properties.provisioned_throughput_mi_b_per_sec = AAZIntType( + serialized_name="provisionedThroughputMiBPerSec", + ) + properties.provisioned_throughput_next_allowed_downgrade = AAZStrType( + serialized_name="provisionedThroughputNextAllowedDowngrade", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.public_access_properties = AAZObjectType( + serialized_name="publicAccessProperties", + ) + properties.public_network_access = AAZStrType( + serialized_name="publicNetworkAccess", + ) + properties.redundancy = AAZStrType() + + nfs_protocol_properties = cls._schema_on_200.properties.nfs_protocol_properties + nfs_protocol_properties.encryption_in_transit_required = AAZStrType( + serialized_name="encryptionInTransitRequired", + ) + nfs_protocol_properties.root_squash = AAZStrType( + serialized_name="rootSquash", + ) + + private_endpoint_connections = cls._schema_on_200.properties.private_endpoint_connections + private_endpoint_connections.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.private_endpoint_connections.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _ShowHelper._build_schema_system_data_read(_element.system_data) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties.private_endpoint_connections.Element.properties + properties.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.private_endpoint + private_endpoint.id = AAZStrType( + flags={"read_only": True}, + ) + + private_link_service_connection_state = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + ) + private_link_service_connection_state.description = AAZStrType() + private_link_service_connection_state.status = AAZStrType() + + public_access_properties = cls._schema_on_200.properties.public_access_properties + public_access_properties.allowed_subnets = AAZListType( + serialized_name="allowedSubnets", + ) + + allowed_subnets = cls._schema_on_200.properties.public_access_properties.allowed_subnets + allowed_subnets.Element = AAZStrType() + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + _schema_system_data_read = None + + @classmethod + def _build_schema_system_data_read(cls, _schema): + if cls._schema_system_data_read is not None: + _schema.created_at = cls._schema_system_data_read.created_at + _schema.created_by = cls._schema_system_data_read.created_by + _schema.created_by_type = cls._schema_system_data_read.created_by_type + _schema.last_modified_at = cls._schema_system_data_read.last_modified_at + _schema.last_modified_by = cls._schema_system_data_read.last_modified_by + _schema.last_modified_by_type = cls._schema_system_data_read.last_modified_by_type + return + + cls._schema_system_data_read = _schema_system_data_read = AAZObjectType( + flags={"read_only": True} + ) + + system_data_read = _schema_system_data_read + system_data_read.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data_read.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data_read.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data_read.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data_read.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data_read.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.created_at = cls._schema_system_data_read.created_at + _schema.created_by = cls._schema_system_data_read.created_by + _schema.created_by_type = cls._schema_system_data_read.created_by_type + _schema.last_modified_at = cls._schema_system_data_read.last_modified_at + _schema.last_modified_by = cls._schema_system_data_read.last_modified_by + _schema.last_modified_by_type = cls._schema_system_data_read.last_modified_by_type + + +__all__ = ["Show"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_update.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_update.py new file mode 100644 index 00000000000..e4fa73f31ff --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_update.py @@ -0,0 +1,684 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares file-share update", +) +class Update(AAZCommand): + """Update a file share. + + :example: FileShares_CreateOrUpdate_MaximumSet + az file-shares file-share update --resource-group rgfileshares --resource-name fileshare + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}", "2026-06-01"], + ] + } + + 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.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The resource name of the file share, as seen by the administrator through Azure Resource Manager.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + + # define Arg Group "Identity" + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.nfs_protocol_properties = AAZObjectArg( + options=["--nfs-protocol-properties"], + arg_group="Properties", + help="Protocol settings specific NFS.", + nullable=True, + ) + _args_schema.provisioned_io_per_sec = AAZIntArg( + options=["--provisioned-io-per-sec"], + arg_group="Properties", + help="The provisioned IO / sec of the share.", + nullable=True, + ) + _args_schema.provisioned_storage_gi_b = AAZIntArg( + options=["--provisioned-storage-gi-b"], + arg_group="Properties", + help="The provisioned storage size of the share in GiB (1 GiB is 1024^3 bytes or 1073741824 bytes). A component of the file share's bill is the provisioned storage, regardless of the amount of used storage.", + nullable=True, + ) + _args_schema.provisioned_throughput_mi_b_per_sec = AAZIntArg( + options=["--provisioned-throughput-mi-b-per-sec"], + arg_group="Properties", + help="The provisioned throughput / sec of the share.", + nullable=True, + ) + _args_schema.public_access_properties = AAZObjectArg( + options=["--public-access-properties"], + arg_group="Properties", + help="The set of properties for control public access.", + nullable=True, + ) + _args_schema.public_network_access = AAZStrArg( + options=["--public-network-access"], + arg_group="Properties", + help="Gets or sets allow or disallow public network access to azure managed file share", + nullable=True, + enum={"Disabled": "Disabled", "Enabled": "Enabled"}, + ) + + nfs_protocol_properties = cls._args_schema.nfs_protocol_properties + nfs_protocol_properties.encryption_in_transit_required = AAZStrArg( + options=["encryption-in-transit-required"], + help="Encryption in transit defines whether data is encrypted for NFS shares.", + nullable=True, + enum={"Disabled": "Disabled", "Enabled": "Enabled"}, + ) + nfs_protocol_properties.root_squash = AAZStrArg( + options=["root-squash"], + help="Root squash defines how root users on clients are mapped to the NFS share.", + nullable=True, + enum={"AllSquash": "AllSquash", "NoRootSquash": "NoRootSquash", "RootSquash": "RootSquash"}, + ) + + public_access_properties = cls._args_schema.public_access_properties + public_access_properties.allowed_subnets = AAZListArg( + options=["allowed-subnets"], + help="The allowed set of subnets when access is restricted.", + nullable=True, + ) + + allowed_subnets = cls._args_schema.public_access_properties.allowed_subnets + allowed_subnets.Element = AAZStrArg( + nullable=True, + ) + + # define Arg Group "Resource" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Resource", + help="Resource tags.", + nullable=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg( + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.FileSharesGet(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.FileSharesCreateOrUpdate(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 FileSharesGet(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.FileShares/fileShares/{resourceName}", + **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( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + 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_file_share_read(cls._schema_on_200) + + return cls._schema_on_200 + + class FileSharesCreateOrUpdate(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.FileShares/fileShares/{resourceName}", + **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( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + 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_file_share_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("identity", AAZIdentityObjectType) + _builder.set_prop("properties", AAZObjectType) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("nfsProtocolProperties", AAZObjectType, ".nfs_protocol_properties") + properties.set_prop("provisionedIOPerSec", AAZIntType, ".provisioned_io_per_sec") + properties.set_prop("provisionedStorageGiB", AAZIntType, ".provisioned_storage_gi_b") + properties.set_prop("provisionedThroughputMiBPerSec", AAZIntType, ".provisioned_throughput_mi_b_per_sec") + properties.set_prop("publicAccessProperties", AAZObjectType, ".public_access_properties") + properties.set_prop("publicNetworkAccess", AAZStrType, ".public_network_access") + + nfs_protocol_properties = _builder.get(".properties.nfsProtocolProperties") + if nfs_protocol_properties is not None: + nfs_protocol_properties.set_prop("encryptionInTransitRequired", AAZStrType, ".encryption_in_transit_required") + nfs_protocol_properties.set_prop("rootSquash", AAZStrType, ".root_squash") + + public_access_properties = _builder.get(".properties.publicAccessProperties") + if public_access_properties is not None: + public_access_properties.set_prop("allowedSubnets", AAZListType, ".allowed_subnets") + + allowed_subnets = _builder.get(".properties.publicAccessProperties.allowedSubnets") + if allowed_subnets is not None: + allowed_subnets.set_elements(AAZStrType, ".") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + 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_file_share_read = None + + @classmethod + def _build_schema_file_share_read(cls, _schema): + if cls._schema_file_share_read is not None: + _schema.id = cls._schema_file_share_read.id + _schema.identity = cls._schema_file_share_read.identity + _schema.location = cls._schema_file_share_read.location + _schema.name = cls._schema_file_share_read.name + _schema.properties = cls._schema_file_share_read.properties + _schema.system_data = cls._schema_file_share_read.system_data + _schema.tags = cls._schema_file_share_read.tags + _schema.type = cls._schema_file_share_read.type + return + + cls._schema_file_share_read = _schema_file_share_read = AAZObjectType() + + file_share_read = _schema_file_share_read + file_share_read.id = AAZStrType( + flags={"read_only": True}, + ) + file_share_read.identity = AAZIdentityObjectType() + file_share_read.location = AAZStrType( + flags={"required": True}, + ) + file_share_read.name = AAZStrType( + flags={"read_only": True}, + ) + file_share_read.properties = AAZObjectType() + file_share_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + cls._build_schema_system_data_read(file_share_read.system_data) + file_share_read.tags = AAZDictType() + file_share_read.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = _schema_file_share_read.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}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = _schema_file_share_read.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType( + nullable=True, + ) + + _element = _schema_file_share_read.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + properties = _schema_file_share_read.properties + properties.host_name = AAZStrType( + serialized_name="hostName", + flags={"read_only": True}, + ) + properties.included_burst_io_per_sec = AAZIntType( + serialized_name="includedBurstIOPerSec", + flags={"read_only": True}, + ) + properties.max_burst_io_per_sec_credits = AAZIntType( + serialized_name="maxBurstIOPerSecCredits", + flags={"read_only": True}, + ) + properties.media_tier = AAZStrType( + serialized_name="mediaTier", + ) + properties.mount_name = AAZStrType( + serialized_name="mountName", + ) + properties.nfs_protocol_properties = AAZObjectType( + serialized_name="nfsProtocolProperties", + ) + properties.private_endpoint_connections = AAZListType( + serialized_name="privateEndpointConnections", + flags={"read_only": True}, + ) + properties.protocol = AAZStrType() + properties.provisioned_io_per_sec = AAZIntType( + serialized_name="provisionedIOPerSec", + ) + properties.provisioned_io_per_sec_next_allowed_downgrade = AAZStrType( + serialized_name="provisionedIOPerSecNextAllowedDowngrade", + flags={"read_only": True}, + ) + properties.provisioned_storage_gi_b = AAZIntType( + serialized_name="provisionedStorageGiB", + ) + properties.provisioned_storage_next_allowed_downgrade = AAZStrType( + serialized_name="provisionedStorageNextAllowedDowngrade", + flags={"read_only": True}, + ) + properties.provisioned_throughput_mi_b_per_sec = AAZIntType( + serialized_name="provisionedThroughputMiBPerSec", + ) + properties.provisioned_throughput_next_allowed_downgrade = AAZStrType( + serialized_name="provisionedThroughputNextAllowedDowngrade", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.public_access_properties = AAZObjectType( + serialized_name="publicAccessProperties", + ) + properties.public_network_access = AAZStrType( + serialized_name="publicNetworkAccess", + ) + properties.redundancy = AAZStrType() + + nfs_protocol_properties = _schema_file_share_read.properties.nfs_protocol_properties + nfs_protocol_properties.encryption_in_transit_required = AAZStrType( + serialized_name="encryptionInTransitRequired", + ) + nfs_protocol_properties.root_squash = AAZStrType( + serialized_name="rootSquash", + ) + + private_endpoint_connections = _schema_file_share_read.properties.private_endpoint_connections + private_endpoint_connections.Element = AAZObjectType() + + _element = _schema_file_share_read.properties.private_endpoint_connections.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + cls._build_schema_system_data_read(_element.system_data) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_file_share_read.properties.private_endpoint_connections.Element.properties + properties.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = _schema_file_share_read.properties.private_endpoint_connections.Element.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = _schema_file_share_read.properties.private_endpoint_connections.Element.properties.private_endpoint + private_endpoint.id = AAZStrType( + flags={"read_only": True}, + ) + + private_link_service_connection_state = _schema_file_share_read.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + ) + private_link_service_connection_state.description = AAZStrType() + private_link_service_connection_state.status = AAZStrType() + + public_access_properties = _schema_file_share_read.properties.public_access_properties + public_access_properties.allowed_subnets = AAZListType( + serialized_name="allowedSubnets", + ) + + allowed_subnets = _schema_file_share_read.properties.public_access_properties.allowed_subnets + allowed_subnets.Element = AAZStrType() + + tags = _schema_file_share_read.tags + tags.Element = AAZStrType() + + _schema.id = cls._schema_file_share_read.id + _schema.identity = cls._schema_file_share_read.identity + _schema.location = cls._schema_file_share_read.location + _schema.name = cls._schema_file_share_read.name + _schema.properties = cls._schema_file_share_read.properties + _schema.system_data = cls._schema_file_share_read.system_data + _schema.tags = cls._schema_file_share_read.tags + _schema.type = cls._schema_file_share_read.type + + _schema_system_data_read = None + + @classmethod + def _build_schema_system_data_read(cls, _schema): + if cls._schema_system_data_read is not None: + _schema.created_at = cls._schema_system_data_read.created_at + _schema.created_by = cls._schema_system_data_read.created_by + _schema.created_by_type = cls._schema_system_data_read.created_by_type + _schema.last_modified_at = cls._schema_system_data_read.last_modified_at + _schema.last_modified_by = cls._schema_system_data_read.last_modified_by + _schema.last_modified_by_type = cls._schema_system_data_read.last_modified_by_type + return + + cls._schema_system_data_read = _schema_system_data_read = AAZObjectType( + flags={"read_only": True} + ) + + system_data_read = _schema_system_data_read + system_data_read.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data_read.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data_read.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data_read.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data_read.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data_read.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.created_at = cls._schema_system_data_read.created_at + _schema.created_by = cls._schema_system_data_read.created_by + _schema.created_by_type = cls._schema_system_data_read.created_by_type + _schema.last_modified_at = cls._schema_system_data_read.last_modified_at + _schema.last_modified_by = cls._schema_system_data_read.last_modified_by + _schema.last_modified_by_type = cls._schema_system_data_read.last_modified_by_type + + +__all__ = ["Update"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_wait.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_wait.py new file mode 100644 index 00000000000..e3035e1c46e --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/_wait.py @@ -0,0 +1,391 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares file-share 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.fileshares/fileshares/{}", "2026-06-01"], + ] + } + + 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.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The resource name of the file share, as seen by the administrator through Azure Resource Manager.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.FileSharesGet(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 FileSharesGet(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.FileShares/fileShares/{resourceName}", + **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( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + 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.identity = AAZIdentityObjectType() + _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}, + ) + _WaitHelper._build_schema_system_data_read(_schema_on_200.system_data) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + 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}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = cls._schema_on_200.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType( + nullable=True, + ) + + _element = cls._schema_on_200.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.host_name = AAZStrType( + serialized_name="hostName", + flags={"read_only": True}, + ) + properties.included_burst_io_per_sec = AAZIntType( + serialized_name="includedBurstIOPerSec", + flags={"read_only": True}, + ) + properties.max_burst_io_per_sec_credits = AAZIntType( + serialized_name="maxBurstIOPerSecCredits", + flags={"read_only": True}, + ) + properties.media_tier = AAZStrType( + serialized_name="mediaTier", + ) + properties.mount_name = AAZStrType( + serialized_name="mountName", + ) + properties.nfs_protocol_properties = AAZObjectType( + serialized_name="nfsProtocolProperties", + ) + properties.private_endpoint_connections = AAZListType( + serialized_name="privateEndpointConnections", + flags={"read_only": True}, + ) + properties.protocol = AAZStrType() + properties.provisioned_io_per_sec = AAZIntType( + serialized_name="provisionedIOPerSec", + ) + properties.provisioned_io_per_sec_next_allowed_downgrade = AAZStrType( + serialized_name="provisionedIOPerSecNextAllowedDowngrade", + flags={"read_only": True}, + ) + properties.provisioned_storage_gi_b = AAZIntType( + serialized_name="provisionedStorageGiB", + ) + properties.provisioned_storage_next_allowed_downgrade = AAZStrType( + serialized_name="provisionedStorageNextAllowedDowngrade", + flags={"read_only": True}, + ) + properties.provisioned_throughput_mi_b_per_sec = AAZIntType( + serialized_name="provisionedThroughputMiBPerSec", + ) + properties.provisioned_throughput_next_allowed_downgrade = AAZStrType( + serialized_name="provisionedThroughputNextAllowedDowngrade", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.public_access_properties = AAZObjectType( + serialized_name="publicAccessProperties", + ) + properties.public_network_access = AAZStrType( + serialized_name="publicNetworkAccess", + ) + properties.redundancy = AAZStrType() + + nfs_protocol_properties = cls._schema_on_200.properties.nfs_protocol_properties + nfs_protocol_properties.encryption_in_transit_required = AAZStrType( + serialized_name="encryptionInTransitRequired", + ) + nfs_protocol_properties.root_squash = AAZStrType( + serialized_name="rootSquash", + ) + + private_endpoint_connections = cls._schema_on_200.properties.private_endpoint_connections + private_endpoint_connections.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.private_endpoint_connections.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _WaitHelper._build_schema_system_data_read(_element.system_data) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties.private_endpoint_connections.Element.properties + properties.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.private_endpoint + private_endpoint.id = AAZStrType( + flags={"read_only": True}, + ) + + private_link_service_connection_state = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + ) + private_link_service_connection_state.description = AAZStrType() + private_link_service_connection_state.status = AAZStrType() + + public_access_properties = cls._schema_on_200.properties.public_access_properties + public_access_properties.allowed_subnets = AAZListType( + serialized_name="allowedSubnets", + ) + + allowed_subnets = cls._schema_on_200.properties.public_access_properties.allowed_subnets + allowed_subnets.Element = AAZStrType() + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + _schema_system_data_read = None + + @classmethod + def _build_schema_system_data_read(cls, _schema): + if cls._schema_system_data_read is not None: + _schema.created_at = cls._schema_system_data_read.created_at + _schema.created_by = cls._schema_system_data_read.created_by + _schema.created_by_type = cls._schema_system_data_read.created_by_type + _schema.last_modified_at = cls._schema_system_data_read.last_modified_at + _schema.last_modified_by = cls._schema_system_data_read.last_modified_by + _schema.last_modified_by_type = cls._schema_system_data_read.last_modified_by_type + return + + cls._schema_system_data_read = _schema_system_data_read = AAZObjectType( + flags={"read_only": True} + ) + + system_data_read = _schema_system_data_read + system_data_read.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data_read.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data_read.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data_read.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data_read.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data_read.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.created_at = cls._schema_system_data_read.created_at + _schema.created_by = cls._schema_system_data_read.created_by + _schema.created_by_type = cls._schema_system_data_read.created_by_type + _schema.last_modified_at = cls._schema_system_data_read.last_modified_at + _schema.last_modified_by = cls._schema_system_data_read.last_modified_by + _schema.last_modified_by_type = cls._schema_system_data_read.last_modified_by_type + + +__all__ = ["Wait"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/__cmd_group.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/__cmd_group.py new file mode 100644 index 00000000000..3311599f3e1 --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/__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( + "file-shares file-share file-share-snapshot", +) +class __CMDGroup(AAZCommandGroup): + """Manage File Share Snapshot + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/__init__.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/__init__.py new file mode 100644 index 00000000000..c401f439385 --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/__init__.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------------------------- +# 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 * diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_create.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_create.py new file mode 100644 index 00000000000..f738be365e8 --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_create.py @@ -0,0 +1,192 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares file-share file-share-snapshot create", +) +class Create(AAZCommand): + """Create a FileShareSnapshot. + + :example: FileShareSnapshot_CreateOrUpdate_MaximumSet + az file-shares file-share file-share-snapshot create --resource-group rgfileshares --resource-name fileshare --name testfilesharesnapshot --metadata "{key9372:jtc}" + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}/filesharesnapshots/{}", "2026-06-01"], + ] + } + + 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 FileShareSnapshot", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["--resource-name"], + help="The resource name of the file share, as seen by the administrator through Azure Resource Manager.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.metadata = AAZDictArg( + options=["--metadata"], + arg_group="Properties", + help="The metadata", + ) + + metadata = cls._args_schema.metadata + metadata.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.FileShareSnapshotCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class FileShareSnapshotCreateOrUpdate(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, + None, + 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.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name}", + **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( + "name", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "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("metadata", AAZDictType, ".metadata") + + metadata = _builder.get(".properties.metadata") + if metadata is not None: + metadata.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_delete.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_delete.py new file mode 100644 index 00000000000..2c1d87907cb --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_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( + "file-shares file-share file-share-snapshot delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete a FileShareSnapshot. + + :example: FileShareSnapshot_Delete_MaximumSet + az file-shares file-share file-share-snapshot delete --resource-group rgfileshares --resource-name fileshare --name testfilesharesnapshot + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}/filesharesnapshots/{}", "2026-06-01"], + ] + } + + 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 FileShareSnapshot", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["--resource-name"], + help="The resource name of the file share, as seen by the administrator through Azure Resource Manager.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.FileShareSnapshotDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class FileShareSnapshotDelete(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.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name}", + **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( + "name", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + 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/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_list.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_list.py new file mode 100644 index 00000000000..1f26c4280d1 --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_list.py @@ -0,0 +1,230 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares file-share file-share-snapshot list", +) +class List(AAZCommand): + """List FileShareSnapshot by FileShare. + + :example: FileShareSnapshot_List_MaximumSet + az file-shares file-share file-share-snapshot list --resource-group rgfileshares --resource-name fileshare + + :example: FileShareSnapshot_List_MinimumSet + az file-shares file-share file-share-snapshot list --resource-group rgfileshares --resource-name fileshare --resource-group rgfileshares --resource-name testfileshare + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}/filesharesnapshots", "2026-06-01"], + ] + } + + 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( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["--resource-name"], + help="The resource name of the file share, as seen by the administrator through Azure Resource Manager.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.FileShareSnapshotList(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 FileShareSnapshotList(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.FileShares/fileShares/{resourceName}/fileShareSnapshots", + **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( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + 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.initiator_id = AAZStrType( + serialized_name="initiatorId", + flags={"read_only": True}, + ) + properties.metadata = AAZDictType() + properties.snapshot_time = AAZStrType( + serialized_name="snapshotTime", + flags={"read_only": True}, + ) + + metadata = cls._schema_on_200.value.Element.properties.metadata + metadata.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", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_show.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_show.py new file mode 100644 index 00000000000..7fe24d74ce8 --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_show.py @@ -0,0 +1,228 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares file-share file-share-snapshot show", +) +class Show(AAZCommand): + """Get a FileShareSnapshot + + :example: FileShareSnapshot_Get_MaximumSet + az file-shares file-share file-share-snapshot show --resource-group rgfileshares --resource-name fileshare --name testfilesharesnapshot + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}/filesharesnapshots/{}", "2026-06-01"], + ] + } + + 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 FileShareSnapshot", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["--resource-name"], + help="The resource name of the file share, as seen by the administrator through Azure Resource Manager.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.FileShareSnapshotGet(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 FileShareSnapshotGet(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.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name}", + **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( + "name", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + 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.initiator_id = AAZStrType( + serialized_name="initiatorId", + flags={"read_only": True}, + ) + properties.metadata = AAZDictType() + properties.snapshot_time = AAZStrType( + serialized_name="snapshotTime", + flags={"read_only": True}, + ) + + metadata = cls._schema_on_200.properties.metadata + metadata.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", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_update.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_update.py new file mode 100644 index 00000000000..5becc6bb2ef --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/file_share_snapshot/_update.py @@ -0,0 +1,279 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares file-share file-share-snapshot update", +) +class Update(AAZCommand): + """Update a FileShareSnapshot. + + :example: FileShareSnapshot_Update_MaximumSet + az file-shares file-share file-share-snapshot update --resource-group rgfileshares --resource-name fileshare --name testfilesharesnapshot --metadata "{key491:dalhvhxqhjszelfuueetvxmgkbukwa}" + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}/filesharesnapshots/{}", "2026-06-01"], + ] + } + + 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 FileShareSnapshot", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["--resource-name"], + help="The resource name of the file share, as seen by the administrator through Azure Resource Manager.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.metadata = AAZDictArg( + options=["--metadata"], + arg_group="Properties", + help="The metadata", + ) + + metadata = cls._args_schema.metadata + metadata.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.FileShareSnapshotUpdate(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 FileShareSnapshotUpdate(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.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name}", + **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( + "name", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + 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("properties", AAZObjectType) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("metadata", AAZDictType, ".metadata") + + metadata = _builder.get(".properties.metadata") + if metadata is not None: + metadata.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.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.initiator_id = AAZStrType( + serialized_name="initiatorId", + flags={"read_only": True}, + ) + properties.metadata = AAZDictType() + properties.snapshot_time = AAZStrType( + serialized_name="snapshotTime", + flags={"read_only": True}, + ) + + metadata = cls._schema_on_200.properties.metadata + metadata.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", + ) + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + +__all__ = ["Update"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/__cmd_group.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/__cmd_group.py new file mode 100644 index 00000000000..a0dce23341b --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/__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( + "file-shares file-share private-endpoint-connection", +) +class __CMDGroup(AAZCommandGroup): + """Manage Private Endpoint Connection + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/__init__.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/__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/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_create.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_create.py new file mode 100644 index 00000000000..de515019bc5 --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_create.py @@ -0,0 +1,308 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares file-share private-endpoint-connection create", +) +class Create(AAZCommand): + """Create the state of specified private endpoint connection associated with the file share. + + :example: PrivateEndpointConnections_Create + az file-shares file-share private-endpoint-connection create --resource-group rgfileshares --resource-name fileshare --private-endpoint-connection-name privateEndpointConnection1 --private-link-service-connection-state "{status:Approved,description:'Approved by admin'}" + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}/privateendpointconnections/{}", "2026-06-01"], + ] + } + + 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.private_endpoint_connection_name = AAZStrArg( + options=["-n", "--name", "--private-endpoint-connection-name"], + help="The name of the private endpoint connection associated with the Azure resource.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["--resource-name"], + help="The resource name of the file share, as seen by the administrator through Azure Resource Manager.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.private_link_service_connection_state = AAZObjectArg( + options=["--private-link-service-connection-state"], + arg_group="Properties", + help="A collection of information about the state of the connection between service consumer and provider.", + ) + + private_link_service_connection_state = cls._args_schema.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrArg( + options=["actions-required"], + help="A message indicating if changes on the service provider require any updates on the consumer.", + ) + private_link_service_connection_state.description = AAZStrArg( + options=["description"], + help="The reason for approval/rejection of the connection.", + ) + private_link_service_connection_state.status = AAZStrArg( + options=["status"], + help="Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service.", + enum={"Approved": "Approved", "Pending": "Pending", "Rejected": "Rejected"}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.PrivateEndpointConnectionsCreate(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 PrivateEndpointConnectionsCreate(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.FileShares/fileShares/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + **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( + "privateEndpointConnectionName", self.ctx.args.private_endpoint_connection_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + 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("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("privateLinkServiceConnectionState", AAZObjectType, ".private_link_service_connection_state", typ_kwargs={"flags": {"required": True}}) + + private_link_service_connection_state = _builder.get(".properties.privateLinkServiceConnectionState") + if private_link_service_connection_state is not None: + private_link_service_connection_state.set_prop("actionsRequired", AAZStrType, ".actions_required") + private_link_service_connection_state.set_prop("description", AAZStrType, ".description") + private_link_service_connection_state.set_prop("status", AAZStrType, ".status") + + 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.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _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.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = cls._schema_on_200.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = cls._schema_on_200.properties.private_endpoint + private_endpoint.id = AAZStrType( + flags={"read_only": True}, + ) + + private_link_service_connection_state = cls._schema_on_200.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + ) + private_link_service_connection_state.description = AAZStrType() + private_link_service_connection_state.status = 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", + ) + + return cls._schema_on_200 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_delete.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_delete.py new file mode 100644 index 00000000000..65e29731583 --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_delete.py @@ -0,0 +1,176 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares file-share private-endpoint-connection delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the specified private endpoint connection associated with the file share. + + :example: PrivateEndpointConnections_Delete + az file-shares file-share private-endpoint-connection delete --resource-group rgfileshares --resource-name fileshare --private-endpoint-connection-name privateEndpointConnection1 + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}/privateendpointconnections/{}", "2026-06-01"], + ] + } + + 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.private_endpoint_connection_name = AAZStrArg( + options=["-n", "--name", "--private-endpoint-connection-name"], + help="The name of the private endpoint connection associated with the Azure resource.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["--resource-name"], + help="The resource name of the file share, as seen by the administrator through Azure Resource Manager.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.PrivateEndpointConnectionsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class PrivateEndpointConnectionsDelete(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, + ) + 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, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + **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( + "privateEndpointConnectionName", self.ctx.args.private_endpoint_connection_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_list.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_list.py new file mode 100644 index 00000000000..dea2981f28e --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_list.py @@ -0,0 +1,247 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares file-share private-endpoint-connection list", +) +class List(AAZCommand): + """List a PrivateEndpointConnection List. + + :example: PrivateEndpointConnections_ListByFileShare + az file-shares file-share private-endpoint-connection list --resource-group rgfileshares --resource-name fileshare + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}/privateendpointconnections", "2026-06-01"], + ] + } + + 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( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["--resource-name"], + help="The resource name of the file share, as seen by the administrator through Azure Resource Manager.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PrivateEndpointConnectionsListByFileShare(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 PrivateEndpointConnectionsListByFileShare(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.FileShares/fileShares/{resourceName}/privateEndpointConnections", + **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( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + 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( + flags={"client_flatten": True}, + ) + _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.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = cls._schema_on_200.value.Element.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = cls._schema_on_200.value.Element.properties.private_endpoint + private_endpoint.id = AAZStrType( + flags={"read_only": True}, + ) + + private_link_service_connection_state = cls._schema_on_200.value.Element.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + ) + private_link_service_connection_state.description = AAZStrType() + private_link_service_connection_state.status = 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", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_show.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_show.py new file mode 100644 index 00000000000..73a140769d1 --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_show.py @@ -0,0 +1,245 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares file-share private-endpoint-connection show", +) +class Show(AAZCommand): + """Get the specified private endpoint connection associated with the file share. + + :example: PrivateEndpointConnections_Get + az file-shares file-share private-endpoint-connection show --resource-group rgfileshares --resource-name fileshare --private-endpoint-connection-name privateEndpointConnection1 + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}/privateendpointconnections/{}", "2026-06-01"], + ] + } + + 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.private_endpoint_connection_name = AAZStrArg( + options=["-n", "--name", "--private-endpoint-connection-name"], + help="The name of the private endpoint connection associated with the Azure resource.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["--resource-name"], + help="The resource name of the file share, as seen by the administrator through Azure Resource Manager.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PrivateEndpointConnectionsGet(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 PrivateEndpointConnectionsGet(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.FileShares/fileShares/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + **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( + "privateEndpointConnectionName", self.ctx.args.private_endpoint_connection_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + 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( + flags={"client_flatten": True}, + ) + _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.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = cls._schema_on_200.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = cls._schema_on_200.properties.private_endpoint + private_endpoint.id = AAZStrType( + flags={"read_only": True}, + ) + + private_link_service_connection_state = cls._schema_on_200.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + ) + private_link_service_connection_state.description = AAZStrType() + private_link_service_connection_state.status = 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", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_update.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_update.py new file mode 100644 index 00000000000..025e079a8f9 --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_update.py @@ -0,0 +1,457 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares file-share private-endpoint-connection update", +) +class Update(AAZCommand): + """Update the state of specified private endpoint connection associated with the file share. + + :example: PrivateEndpointConnections_Create + az file-shares file-share private-endpoint-connection update --resource-group rgfileshares --resource-name fileshare --private-endpoint-connection-name privateEndpointConnection1 + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}/privateendpointconnections/{}", "2026-06-01"], + ] + } + + 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.private_endpoint_connection_name = AAZStrArg( + options=["-n", "--name", "--private-endpoint-connection-name"], + help="The name of the private endpoint connection associated with the Azure resource.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["--resource-name"], + help="The resource name of the file share, as seen by the administrator through Azure Resource Manager.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.private_link_service_connection_state = AAZObjectArg( + options=["--private-link-service-connection-state"], + arg_group="Properties", + help="A collection of information about the state of the connection between service consumer and provider.", + ) + + private_link_service_connection_state = cls._args_schema.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrArg( + options=["actions-required"], + help="A message indicating if changes on the service provider require any updates on the consumer.", + nullable=True, + ) + private_link_service_connection_state.description = AAZStrArg( + options=["description"], + help="The reason for approval/rejection of the connection.", + nullable=True, + ) + private_link_service_connection_state.status = AAZStrArg( + options=["status"], + help="Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service.", + nullable=True, + enum={"Approved": "Approved", "Pending": "Pending", "Rejected": "Rejected"}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PrivateEndpointConnectionsGet(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.PrivateEndpointConnectionsCreate(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 PrivateEndpointConnectionsGet(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.FileShares/fileShares/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + **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( + "privateEndpointConnectionName", self.ctx.args.private_endpoint_connection_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + 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_private_endpoint_connection_read(cls._schema_on_200) + + return cls._schema_on_200 + + class PrivateEndpointConnectionsCreate(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.FileShares/fileShares/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + **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( + "privateEndpointConnectionName", self.ctx.args.private_endpoint_connection_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + 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(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_private_endpoint_connection_read(cls._schema_on_200) + + return cls._schema_on_200 + + 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, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("privateLinkServiceConnectionState", AAZObjectType, ".private_link_service_connection_state", typ_kwargs={"flags": {"required": True}}) + + private_link_service_connection_state = _builder.get(".properties.privateLinkServiceConnectionState") + if private_link_service_connection_state is not None: + private_link_service_connection_state.set_prop("actionsRequired", AAZStrType, ".actions_required") + private_link_service_connection_state.set_prop("description", AAZStrType, ".description") + private_link_service_connection_state.set_prop("status", AAZStrType, ".status") + + 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_private_endpoint_connection_read = None + + @classmethod + def _build_schema_private_endpoint_connection_read(cls, _schema): + if cls._schema_private_endpoint_connection_read is not None: + _schema.id = cls._schema_private_endpoint_connection_read.id + _schema.name = cls._schema_private_endpoint_connection_read.name + _schema.properties = cls._schema_private_endpoint_connection_read.properties + _schema.system_data = cls._schema_private_endpoint_connection_read.system_data + _schema.type = cls._schema_private_endpoint_connection_read.type + return + + cls._schema_private_endpoint_connection_read = _schema_private_endpoint_connection_read = AAZObjectType() + + private_endpoint_connection_read = _schema_private_endpoint_connection_read + private_endpoint_connection_read.id = AAZStrType( + flags={"read_only": True}, + ) + private_endpoint_connection_read.name = AAZStrType( + flags={"read_only": True}, + ) + private_endpoint_connection_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + private_endpoint_connection_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + private_endpoint_connection_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_private_endpoint_connection_read.properties + properties.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = _schema_private_endpoint_connection_read.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = _schema_private_endpoint_connection_read.properties.private_endpoint + private_endpoint.id = AAZStrType( + flags={"read_only": True}, + ) + + private_link_service_connection_state = _schema_private_endpoint_connection_read.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + ) + private_link_service_connection_state.description = AAZStrType() + private_link_service_connection_state.status = AAZStrType() + + system_data = _schema_private_endpoint_connection_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_private_endpoint_connection_read.id + _schema.name = cls._schema_private_endpoint_connection_read.name + _schema.properties = cls._schema_private_endpoint_connection_read.properties + _schema.system_data = cls._schema_private_endpoint_connection_read.system_data + _schema.type = cls._schema_private_endpoint_connection_read.type + + +__all__ = ["Update"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_wait.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_wait.py new file mode 100644 index 00000000000..001c1ad87ff --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_endpoint_connection/_wait.py @@ -0,0 +1,241 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares file-share private-endpoint-connection 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.fileshares/fileshares/{}/privateendpointconnections/{}", "2026-06-01"], + ] + } + + 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.private_endpoint_connection_name = AAZStrArg( + options=["-n", "--name", "--private-endpoint-connection-name"], + help="The name of the private endpoint connection associated with the Azure resource.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["--resource-name"], + help="The resource name of the file share, as seen by the administrator through Azure Resource Manager.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PrivateEndpointConnectionsGet(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 PrivateEndpointConnectionsGet(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.FileShares/fileShares/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + **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( + "privateEndpointConnectionName", self.ctx.args.private_endpoint_connection_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + 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( + flags={"client_flatten": True}, + ) + _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.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = cls._schema_on_200.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = cls._schema_on_200.properties.private_endpoint + private_endpoint.id = AAZStrType( + flags={"read_only": True}, + ) + + private_link_service_connection_state = cls._schema_on_200.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + ) + private_link_service_connection_state.description = AAZStrType() + private_link_service_connection_state.status = 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", + ) + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_link_resource/__cmd_group.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_link_resource/__cmd_group.py new file mode 100644 index 00000000000..a9b0e38436c --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_link_resource/__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( + "file-shares file-share private-link-resource", +) +class __CMDGroup(AAZCommandGroup): + """Manage Private Link Resource + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_link_resource/__init__.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_link_resource/__init__.py new file mode 100644 index 00000000000..2df85698253 --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_link_resource/__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/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_link_resource/_list.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_link_resource/_list.py new file mode 100644 index 00000000000..ad007648e1c --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_link_resource/_list.py @@ -0,0 +1,233 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares file-share private-link-resource list", +) +class List(AAZCommand): + """List the private link resources that need to be created for a file share. + + :example: List PrivateLinkResources + az file-shares file-share private-link-resource list --resource-group res4303 --resource-name testfileshare01 + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}/privatelinkresources", "2026-06-01"], + ] + } + + 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( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["--resource-name"], + help="The resource name of the file share, as seen by the administrator through Azure Resource Manager.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PrivateLinkResourcesList(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 PrivateLinkResourcesList(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.FileShares/fileShares/{resourceName}/privateLinkResources", + **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( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + 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.group_id = AAZStrType( + serialized_name="groupId", + flags={"read_only": True}, + ) + properties.required_members = AAZListType( + serialized_name="requiredMembers", + flags={"read_only": True}, + ) + properties.required_zone_names = AAZListType( + serialized_name="requiredZoneNames", + flags={"read_only": True}, + ) + + required_members = cls._schema_on_200.value.Element.properties.required_members + required_members.Element = AAZStrType() + + required_zone_names = cls._schema_on_200.value.Element.properties.required_zone_names + required_zone_names.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", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_link_resource/_show.py b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_link_resource/_show.py new file mode 100644 index 00000000000..7751fdc913f --- /dev/null +++ b/src/fileshares/azext_fileshares/aaz/latest/file_shares/file_share/private_link_resource/_show.py @@ -0,0 +1,234 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "file-shares file-share private-link-resource show", +) +class Show(AAZCommand): + """Get the private link resources that need to be created for a file share. + + :example: Get PrivateLinkResource + az file-shares file-share private-link-resource show --resource-group res4303 --resource-name testfileshare01 --private-link-resource-name fileshare + """ + + _aaz_info = { + "version": "2026-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}/privatelinkresources/{}", "2026-06-01"], + ] + } + + 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.private_link_resource_name = AAZStrArg( + options=["-n", "--name", "--private-link-resource-name"], + help="The name of the private link resource.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^[a-z][a-z0-9]*$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["--resource-name"], + help="The resource name of the file share, as seen by the administrator through Azure Resource Manager.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-z]|[0-9])([a-z]|[0-9]|(-(?!-))){1,61}([a-z]|[0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PrivateLinkResourcesGet(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 PrivateLinkResourcesGet(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.FileShares/fileShares/{resourceName}/privateLinkResources/{privateLinkResourceName}", + **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( + "privateLinkResourceName", self.ctx.args.private_link_resource_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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-06-01", + 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.group_id = AAZStrType( + serialized_name="groupId", + flags={"read_only": True}, + ) + properties.required_members = AAZListType( + serialized_name="requiredMembers", + flags={"read_only": True}, + ) + properties.required_zone_names = AAZListType( + serialized_name="requiredZoneNames", + flags={"read_only": True}, + ) + + required_members = cls._schema_on_200.properties.required_members + required_members.Element = AAZStrType() + + required_zone_names = cls._schema_on_200.properties.required_zone_names + required_zone_names.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", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/fileshares/azext_fileshares/azext_metadata.json b/src/fileshares/azext_fileshares/azext_metadata.json new file mode 100644 index 00000000000..71889bb136b --- /dev/null +++ b/src/fileshares/azext_fileshares/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/fileshares/azext_fileshares/commands.py b/src/fileshares/azext_fileshares/commands.py new file mode 100644 index 00000000000..b0d842e4993 --- /dev/null +++ b/src/fileshares/azext_fileshares/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/fileshares/azext_fileshares/custom.py b/src/fileshares/azext_fileshares/custom.py new file mode 100644 index 00000000000..86df1e48ef5 --- /dev/null +++ b/src/fileshares/azext_fileshares/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/fileshares/azext_fileshares/tests/__init__.py b/src/fileshares/azext_fileshares/tests/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/fileshares/azext_fileshares/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/fileshares/azext_fileshares/tests/latest/__init__.py b/src/fileshares/azext_fileshares/tests/latest/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/fileshares/azext_fileshares/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/fileshares/azext_fileshares/tests/latest/test_fileshares.py b/src/fileshares/azext_fileshares/tests/latest/test_fileshares.py new file mode 100644 index 00000000000..4b58bddf089 --- /dev/null +++ b/src/fileshares/azext_fileshares/tests/latest/test_fileshares.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 +# -------------------------------------------------------------------------------------------- + +from azure.cli.testsdk import * + + +class FilesharesScenario(ScenarioTest): + # TODO: add tests here + pass diff --git a/src/fileshares/setup.cfg b/src/fileshares/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/fileshares/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/fileshares/setup.py b/src/fileshares/setup.py new file mode 100644 index 00000000000..58f6e80f696 --- /dev/null +++ b/src/fileshares/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='fileshares', + version=VERSION, + description='Microsoft Azure Command-Line Tools Fileshares 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/fileshares', + classifiers=CLASSIFIERS, + packages=find_packages(exclude=["tests"]), + package_data={'azext_fileshares': ['azext_metadata.json']}, + install_requires=DEPENDENCIES +)